]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: remove optional for dirfd parameter
authorXiubo Li <xiubli@redhat.com>
Mon, 1 Nov 2021 02:57:16 +0000 (10:57 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 2 Nov 2021 01:17:23 +0000 (09:17 +0800)
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 <xiubli@redhat.com>
src/client/Client.cc
src/client/Client.h

index 32183de7d03f1d7af9a362c5d694332744730919..94acb461df6f09897f4208b6af93e1257c81b592 100644 (file)
@@ -9121,7 +9121,7 @@ int Client::getdir(const char *relpath, list<string>& contents,
 /****** file i/o **********/
 
 // common parts for open and openat. call with client_lock locked.
-int Client::create_and_open(std::optional<int> 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<int> 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;
 
index b6a76faca508373987d2e89858f5d6c5a6d877af..66ec9c7a49191e48b41c642deca725a0f1f55aec 100644 (file)
@@ -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<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 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);
   }