diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/Client.cc | 36 | ||||
-rw-r--r-- | src/client/Client.h | 3 | ||||
-rw-r--r-- | src/include/cephfs/libcephfs.h | 8 | ||||
-rw-r--r-- | src/libcephfs.cc | 16 |
4 files changed, 51 insertions, 12 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc index fe73d033f9f..33cf900add9 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -10902,6 +10902,42 @@ int Client::ll_mknod(Inode *parent, const char *name, mode_t mode, return r; } +int Client::ll_mknodx(Inode *parent, const char *name, mode_t mode, + dev_t rdev, Inode **out, + struct ceph_statx *stx, unsigned want, unsigned flags, + const UserPerm& perms) +{ + unsigned caps = statx_to_mask(flags, want); + Mutex::Locker lock(client_lock); + + vinodeno_t vparent = _get_vino(parent); + + ldout(cct, 3) << "ll_mknodx " << vparent << " " << name << dendl; + tout(cct) << "ll_mknodx" << std::endl; + tout(cct) << vparent.ino.val << std::endl; + tout(cct) << name << std::endl; + tout(cct) << mode << std::endl; + tout(cct) << rdev << std::endl; + + if (!cct->_conf->fuse_default_permissions) { + int r = may_create(parent, perms); + if (r < 0) + return r; + } + + InodeRef in; + int r = _mknod(parent, name, mode, rdev, perms, &in); + if (r == 0) { + fill_statx(in, caps, stx); + _ll_get(in.get()); + } + tout(cct) << stx->stx_ino << std::endl; + ldout(cct, 3) << "ll_mknodx " << vparent << " " << name + << " = " << r << " (" << hex << stx->stx_ino << dec << ")" << dendl; + *out = in.get(); + return r; +} + int Client::_create(Inode *dir, const char *name, int flags, mode_t mode, InodeRef *inp, Fh **fhp, int stripe_unit, int stripe_count, int object_size, const char *data_pool, bool *created, diff --git a/src/client/Client.h b/src/client/Client.h index c2f4e8cbf86..9cc0679f790 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1139,6 +1139,9 @@ public: int ll_readlink(Inode *in, char *buf, size_t bufsize, const UserPerm& perms); int ll_mknod(Inode *in, const char *name, mode_t mode, dev_t rdev, struct stat *attr, Inode **out, const UserPerm& perms); + int ll_mknodx(Inode *parent, const char *name, mode_t mode, dev_t rdev, + Inode **out, struct ceph_statx *stx, unsigned want, + unsigned flags, const UserPerm& perms); int ll_mkdir(Inode *in, const char *name, mode_t mode, struct stat *attr, Inode **out, const UserPerm& perm); int ll_symlink(Inode *in, const char *name, const char *value, diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index f1b01812b90..191d83e9acb 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -1481,10 +1481,10 @@ int ceph_ll_create(struct ceph_mount_info *cmount, Inode *parent, const char *name, mode_t mode, int oflags, Inode **outp, Fh **fhp, struct ceph_statx *stx, unsigned want, unsigned lflags, const UserPerm *perms); -int ceph_ll_mknod(struct ceph_mount_info *cmount, struct Inode *parent, - const char *name, mode_t mode, dev_t rdev, - struct stat *attr, struct Inode **out, - int uid, int gid); +int ceph_ll_mknod(struct ceph_mount_info *cmount, Inode *parent, + const char *name, mode_t mode, dev_t rdev, Inode **out, + struct ceph_statx *stx, unsigned want, unsigned flags, + const UserPerm *perms); int ceph_ll_mkdir(struct ceph_mount_info *cmount, struct Inode *parent, const char *name, mode_t mode, struct stat *attr, Inode **out, int uid, int gid); diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 4f4e99e7fd9..79ced12d368 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -1547,14 +1547,14 @@ extern "C" int ceph_ll_create(class ceph_mount_info *cmount, fhp, stx, want, lflags, *perms); } -extern "C" int ceph_ll_mknod(class ceph_mount_info *cmount, - struct Inode *parent, const char *name, - mode_t mode, dev_t rdev, struct stat *attr, - struct Inode **out, int uid, int gid) -{ - UserPerm perms(uid, gid); - return (cmount->get_client())->ll_mknod(parent, name, mode, rdev, - attr, out, perms); +extern "C" int ceph_ll_mknod(class ceph_mount_info *cmount, Inode *parent, + const char *name, mode_t mode, dev_t rdev, + Inode **out, struct ceph_statx *stx, + unsigned want, unsigned flags, + const UserPerm *perms) +{ + return (cmount->get_client())->ll_mknodx(parent, name, mode, rdev, + out, stx, want, flags, *perms); } extern "C" int ceph_ll_mkdir(class ceph_mount_info *cmount, |