From: Jeff Layton Date: Thu, 16 Apr 2020 14:05:20 +0000 (-0400) Subject: client: make client_dentry_callback_t more friendly for C X-Git-Tag: v14.2.10~7^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=676a871ff2aef6361df56e3f4377e2b83c28a26e;p=ceph.git client: make client_dentry_callback_t more friendly for C 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 (cherry picked from commit 79b588211017d8af15a0e49628563dbe45b55ccb) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 7d833e795b6..eeb55a71ed4 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -5125,7 +5125,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) diff --git a/src/client/Client.h b/src/client/Client.h index 4905d78cacd..aec66d31bb7 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -126,7 +126,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); diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 824cc85157c..04ea168ca20 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -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 }