2019-01-25 07:03:46 -05:00
|
|
|
/*
|
|
|
|
|
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-07-25 17:53:48 -05:00
|
|
|
#include "fuse_mknod.hpp"
|
|
|
|
|
|
2019-01-25 07:03:46 -05:00
|
|
|
#include "config.hpp"
|
|
|
|
|
#include "errno.hpp"
|
2025-07-25 17:53:48 -05:00
|
|
|
#include "error.hpp"
|
2019-01-25 07:03:46 -05:00
|
|
|
#include "fs_acl.hpp"
|
2025-12-05 21:03:48 -06:00
|
|
|
#include "fs_mknod_as.hpp"
|
2019-01-25 07:03:46 -05:00
|
|
|
#include "fs_clonepath.hpp"
|
|
|
|
|
#include "fs_path.hpp"
|
|
|
|
|
#include "ugid.hpp"
|
|
|
|
|
|
|
|
|
|
|
2025-07-25 17:53:48 -05:00
|
|
|
int
|
2025-10-13 00:21:36 -04:00
|
|
|
FUSE::mknod(const fuse_req_ctx_t *ctx_,
|
|
|
|
|
const char *fusepath_,
|
|
|
|
|
mode_t mode_,
|
|
|
|
|
dev_t rdev_)
|
2025-07-25 17:53:48 -05:00
|
|
|
{
|
|
|
|
|
int rv;
|
2025-12-05 21:03:48 -06:00
|
|
|
const fs::path fusepath{fusepath_};
|
2025-12-29 10:58:37 -06:00
|
|
|
const ugid_t ugid(ctx_);
|
|
|
|
|
|
|
|
|
|
rv = cfg.mknod(ugid,
|
|
|
|
|
cfg.branches,
|
|
|
|
|
fusepath,
|
|
|
|
|
mode_,
|
|
|
|
|
ctx_->umask,
|
|
|
|
|
rdev_);
|
2025-07-25 17:53:48 -05:00
|
|
|
if(rv == -EROFS)
|
|
|
|
|
{
|
2025-09-06 12:03:51 -04:00
|
|
|
cfg.branches.find_and_set_mode_ro();
|
2025-12-29 10:58:37 -06:00
|
|
|
rv = cfg.mknod(ugid,
|
|
|
|
|
cfg.branches,
|
|
|
|
|
fusepath,
|
|
|
|
|
mode_,
|
|
|
|
|
ctx_->umask,
|
|
|
|
|
rdev_);
|
2025-07-25 17:53:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rv;
|
2019-01-25 07:03:46 -05:00
|
|
|
}
|