From 5a254a2701ebdb90aae40cb2c78a6e76739ccd9d Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Mon, 1 Nov 2021 10:57:16 +0800 Subject: [PATCH] client: remove optional for dirfd parameter All the callers when calling the create_and_open() there will always be with a dirfd. I beleive this was introduced when coding previous patches temporarily, but forgot to remove or fix it when pushing it. Signed-off-by: Xiubo Li --- src/client/Client.cc | 12 +++++------- src/client/Client.h | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 32183de7d03..94acb461df6 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -9121,7 +9121,7 @@ int Client::getdir(const char *relpath, list& contents, /****** file i/o **********/ // common parts for open and openat. call with client_lock locked. -int Client::create_and_open(std::optional dirfd, const char *relpath, int flags, +int Client::create_and_open(int dirfd, const char *relpath, int flags, const UserPerm& perms, mode_t mode, int stripe_unit, int stripe_count, int object_size, const char *data_pool, std::string alternate_name) { @@ -9147,14 +9147,12 @@ int Client::create_and_open(std::optional dirfd, const char *relpath, int f int mask = ceph_caps_for_mode(ceph_flags_to_mode(cflags)); InodeRef dirinode = nullptr; - if (dirfd) { - int r = get_fd_inode(*dirfd, &dirinode); - if (r < 0) { - return r; - } + int r = get_fd_inode(dirfd, &dirinode); + if (r < 0) { + return r; } - int r = path_walk(path, &in, perms, followsym, mask, dirinode); + r = path_walk(path, &in, perms, followsym, mask, dirinode); if (r == 0 && (flags & O_CREAT) && (flags & O_EXCL)) return -CEPHFS_EEXIST; diff --git a/src/client/Client.h b/src/client/Client.h index b6a76faca50..66ec9c7a491 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -437,9 +437,9 @@ public: // file ops int mknod(const char *path, mode_t mode, const UserPerm& perms, dev_t rdev=0); - int create_and_open(std::optional dirfd, const char *relpath, int flags, const UserPerm& perms, - mode_t mode, int stripe_unit, int stripe_count, int object_size, const char *data_pool, - std::string alternate_name); + int create_and_open(int dirfd, const char *relpath, int flags, const UserPerm& perms, + mode_t mode, int stripe_unit, int stripe_count, int object_size, + const char *data_pool, std::string alternate_name); int open(const char *path, int flags, const UserPerm& perms, mode_t mode=0, std::string alternate_name="") { return open(path, flags, perms, mode, 0, 0, 0, NULL, alternate_name); } -- 2.39.5