From: Jeff Layton Date: Thu, 16 Apr 2020 16:09:54 +0000 (-0400) Subject: client: move callback typedefs and arg struct into ceph_ll_client.h X-Git-Tag: v14.2.10~7^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0e105de6c64a1e15ac54a4584f1e249059b0bbf4;p=ceph.git client: move callback typedefs and arg struct into ceph_ll_client.h Put them in a common interface header file. This also allows us to eliminate the duplicate definition of ceph_deleg_cb_t in Delegation.h. Signed-off-by: Jeff Layton (cherry picked from commit 8370f70cacfb0bccc96d121cab687376155e8b8d) Conflicts: src/include/cephfs/libcephfs.h - nautilus version of this file does not have the line: struct CephContext; --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 56f1f496635..5c80d3bdf51 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -10379,7 +10379,7 @@ int Client::ll_statfs(Inode *in, struct statvfs *stbuf, const UserPerm& perms) return statfs(0, stbuf, perms); } -void Client::ll_register_callbacks(struct client_callback_args *args) +void Client::ll_register_callbacks(struct ceph_client_callback_args *args) { if (!args) return; diff --git a/src/client/Client.h b/src/client/Client.h index a5d21132b73..66cd5c8d0ce 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -122,29 +122,6 @@ struct CapSnap; struct MetaRequest; 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, 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); -typedef mode_t (*client_umask_callback_t)(void *handle); - -/* Callback for delegation recalls */ -typedef void (*ceph_deleg_cb_t)(Fh *fh, void *priv); - -struct client_callback_args { - void *handle; - client_ino_callback_t ino_cb; - client_dentry_callback_t dentry_cb; - client_switch_interrupt_callback_t switch_intr_cb; - client_remount_callback_t remount_cb; - client_umask_callback_t umask_cb; -}; - // ======================================================== // client interface @@ -601,7 +578,7 @@ public: int ll_osdaddr(int osd, uint32_t *addr); int ll_osdaddr(int osd, char* buf, size_t size); - void ll_register_callbacks(struct client_callback_args *args); + void ll_register_callbacks(struct ceph_client_callback_args *args); int test_dentry_handling(bool can_invalidate); const char** get_tracked_conf_keys() const override; diff --git a/src/client/Delegation.h b/src/client/Delegation.h index e260f6c9980..d24a02487e1 100644 --- a/src/client/Delegation.h +++ b/src/client/Delegation.h @@ -5,8 +5,7 @@ #include "common/Clock.h" #include "common/Timer.h" - -class Fh; +#include "include/cephfs/ceph_ll_client.h" /* Commands for manipulating delegation state */ #ifndef CEPH_DELEGATION_NONE @@ -15,9 +14,6 @@ class Fh; # define CEPH_DELEGATION_WR 2 #endif -/* Callback for delegation recalls */ -typedef void (*ceph_deleg_cb_t)(Fh *fh, void *priv); - /* Converts CEPH_DELEGATION_* to cap mask */ int ceph_deleg_caps_for_type(unsigned type); diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 20158e62668..9a305fb1405 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -1234,7 +1234,7 @@ int CephFuse::Handle::start() #endif - struct client_callback_args args = { + struct ceph_client_callback_args args = { handle: this, ino_cb: client->cct->_conf.get_val("fuse_use_invalidate_cb") ? ino_invalidate_cb : NULL, diff --git a/src/include/cephfs/ceph_ll_client.h b/src/include/cephfs/ceph_ll_client.h index f2645c0e0ff..c1af46dc010 100644 --- a/src/include/cephfs/ceph_ll_client.h +++ b/src/include/cephfs/ceph_ll_client.h @@ -17,7 +17,31 @@ #ifdef __cplusplus extern "C" { -#endif + +class Fh; + +struct inodeno_t; +struct vinodeno_t; +typedef struct vinodeno_t vinodeno; + +#else /* __cplusplus */ + +typedef struct Fh Fh; + +typedef struct inodeno_t { + uint64_t val; +} inodeno_t; + +typedef struct _snapid_t { + uint64_t val; +} snapid_t; + +typedef struct vinodeno_t { + inodeno_t ino; + snapid_t snapid; +} vinodeno_t; + +#endif /* __cplusplus */ /* * Heavily borrowed from David Howells' draft statx patchset. @@ -74,6 +98,40 @@ struct ceph_statx { */ #define CEPH_REQ_FLAG_MASK (AT_SYMLINK_NOFOLLOW|AT_NO_ATTR_SYNC) +/* delegation recalls */ +typedef void (*ceph_deleg_cb_t)(Fh *fh, void *priv); + +/* inode data/metadata invalidation */ +typedef void (*client_ino_callback_t)(void *handle, vinodeno_t ino, + int64_t off, int64_t len); + +/* dentry invalidation */ +typedef void (*client_dentry_callback_t)(void *handle, vinodeno_t dirino, + vinodeno_t ino, const char *name, + size_t len); + +/* remount entire fs */ +typedef int (*client_remount_callback_t)(void *handle); + +/* lock request interrupted */ +typedef void (*client_switch_interrupt_callback_t)(void *handle, void *data); + +/* fetch umask of actor */ +typedef mode_t (*client_umask_callback_t)(void *handle); + +/* + * The handle is an opaque value that gets passed to some callbacks. Any fields + * set to NULL will be left alone. There is no way to unregister callbacks. + */ +struct ceph_client_callback_args { + void *handle; + client_ino_callback_t ino_cb; + client_dentry_callback_t dentry_cb; + client_switch_interrupt_callback_t switch_intr_cb; + client_remount_callback_t remount_cb; + client_umask_callback_t umask_cb; +}; + #ifdef __cplusplus } #endif diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index 7ed86893f4d..a1fc0a7e30a 100755 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -74,27 +74,6 @@ struct ceph_file_layout { uint32_t fl_pg_pool; /* namespace, crush ruleset, rep level */ } __attribute__ ((packed)); - -typedef struct inodeno_t { - uint64_t val; -} inodeno_t; - -typedef struct _snapid_t { - uint64_t val; -} snapid_t; - -typedef struct vinodeno_t { - inodeno_t ino; - snapid_t snapid; -} vinodeno_t; - -typedef struct Fh Fh; -#else /* _cplusplus */ - -struct inodeno_t; -struct vinodeno_t; -typedef struct vinodeno_t vinodeno; - #endif /* ! __cplusplus */ struct UserPerm; @@ -1775,7 +1754,6 @@ int ceph_ll_lazyio(struct ceph_mount_info *cmount, Fh *fh, int enable); * needs, but it should take care to choose a value that allows it to avoid * forcible eviction from the cluster in the event of an application bug. */ -typedef void (*ceph_deleg_cb_t)(struct Fh *fh, void *priv); /* Commands for manipulating delegation state */ #ifndef CEPH_DELEGATION_NONE diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 65a539e7eeb..160ff47a99b 100755 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -117,7 +117,7 @@ public: goto fail; { - client_callback_args args = {}; + ceph_client_callback_args args = {}; args.handle = this; args.umask_cb = umask_cb; client->ll_register_callbacks(&args);