]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: make client_dentry_callback_t more friendly for C
authorJeff Layton <jlayton@redhat.com>
Thu, 16 Apr 2020 14:05:20 +0000 (10:05 -0400)
committerVicente Cheng <freeze.bilsted@gmail.com>
Wed, 20 May 2020 08:41:55 +0000 (08:41 +0000)
C doesn't have the string type, and doesn't understand references.
Change client_dentry_callback_t to take separate pointer and length
arguments.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
(cherry picked from commit 79b588211017d8af15a0e49628563dbe45b55ccb)

src/client/Client.cc
src/client/Client.h
src/client/fuse_ll.cc

index d3dceee2e521192cc999d12c0a07a3f336ea1c40..51a811c47966c7e3e5e2211303baa8d4d221642a 100644 (file)
@@ -5135,7 +5135,7 @@ void Client::_async_dentry_invalidate(vinodeno_t dirino, vinodeno_t ino, string&
     return;
   ldout(cct, 10) << __func__ << " '" << name << "' ino " << ino
                 << " in dir " << dirino << dendl;
-  dentry_invalidate_cb(callback_handle, dirino, ino, name);
+  dentry_invalidate_cb(callback_handle, dirino, ino, name.c_str(), name.length());
 }
 
 void Client::_schedule_invalidate_dentry_callback(Dentry *dn, bool del)
index 0ec989db2672b881b9f18c1e4d78804016a41441..89f36328ffefcc99b79a90fbdc7ca7a28f4179fc 100644 (file)
@@ -125,7 +125,8 @@ class ceph_lock_state_t;
 typedef void (*client_ino_callback_t)(void *handle, vinodeno_t ino, int64_t off, int64_t len);
 
 typedef void (*client_dentry_callback_t)(void *handle, vinodeno_t dirino,
-                                        vinodeno_t ino, string& name);
+                                        vinodeno_t ino, const char *name,
+                                        size_t len);
 typedef int (*client_remount_callback_t)(void *handle);
 
 typedef void(*client_switch_interrupt_callback_t)(void *handle, void *data);
index 3aeda459c1cc441879ee702dd8881533d17a7184..57d64a6666042837239b68a85d9a37e7601e95e7 100644 (file)
@@ -937,7 +937,7 @@ static void ino_invalidate_cb(void *handle, vinodeno_t vino, int64_t off,
 }
 
 static void dentry_invalidate_cb(void *handle, vinodeno_t dirino,
-                                vinodeno_t ino, string& name)
+                                vinodeno_t ino, const char *name, size_t len)
 {
   CephFuse::Handle *cfuse = (CephFuse::Handle *)handle;
   fuse_ino_t fdirino = cfuse->make_fake_ino(dirino.ino, dirino.snapid);
@@ -946,12 +946,12 @@ static void dentry_invalidate_cb(void *handle, vinodeno_t dirino,
   if (ino.ino != inodeno_t())
     fino = cfuse->make_fake_ino(ino.ino, ino.snapid);
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-  fuse_lowlevel_notify_delete(cfuse->se, fdirino, fino, name.c_str(), name.length());
+  fuse_lowlevel_notify_delete(cfuse->se, fdirino, fino, name, len);
 #else
-  fuse_lowlevel_notify_delete(cfuse->ch, fdirino, fino, name.c_str(), name.length());
+  fuse_lowlevel_notify_delete(cfuse->ch, fdirino, fino, name, len);
 #endif
 #elif FUSE_VERSION >= FUSE_MAKE_VERSION(2, 8)
-  fuse_lowlevel_notify_inval_entry(cfuse->ch, fdirino, name.c_str(), name.length());
+  fuse_lowlevel_notify_inval_entry(cfuse->ch, fdirino, name, len);
 #endif
 }