]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: move callback typedefs and arg struct into ceph_ll_client.h
authorJeff Layton <jlayton@redhat.com>
Thu, 16 Apr 2020 16:09:54 +0000 (12:09 -0400)
committerVicente Cheng <freeze.bilsted@gmail.com>
Wed, 20 May 2020 08:42:07 +0000 (08:42 +0000)
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 <jlayton@redhat.com>
(cherry picked from commit 8370f70cacfb0bccc96d121cab687376155e8b8d)

src/client/Client.cc
src/client/Client.h
src/client/Delegation.h
src/client/fuse_ll.cc
src/include/cephfs/ceph_ll_client.h
src/include/cephfs/libcephfs.h
src/libcephfs.cc

index b92abcfa244e478e7d1f901a183d62c9bdae0556..b4e4a1abbaa22a1a6d3322c5c8c692dba897d00c 100644 (file)
@@ -10420,7 +10420,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;
index c488cf7c38634f79f0f311653cbba6bc6a0cede1..98745db8a730d4e6337cbd7bc56498fb2e33163b 100644 (file)
@@ -121,29 +121,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
 
@@ -602,7 +579,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;
index e260f6c9980a8612cd7abbe102f9979e79ba95d5..d24a02487e135ccb9c0cfe488c2e13c574331961 100644 (file)
@@ -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);
 
index b35606309ce3371e75ab1a508be7f8632914327c..88afd05de51edb91081593025dcb934277a282ba 100644 (file)
@@ -1233,7 +1233,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<bool>("fuse_use_invalidate_cb") ?
       ino_invalidate_cb : NULL,
index f2645c0e0ff6134f52d0e1541f07a1c57d40123c..c1af46dc010f82816d63008827860a58e1e9a1a6 100644 (file)
 
 #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
index 2876a317c303f7859b5c4009ff56b38977693178..ae771f07fe8d7e301f7ced5f2e632aca8f8af9fa 100644 (file)
@@ -78,27 +78,7 @@ 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;
 struct CephContext;
-#else /* _cplusplus */
-
-struct inodeno_t;
-struct vinodeno_t;
-typedef struct vinodeno_t vinodeno;
 #endif /* ! __cplusplus */
 
 struct UserPerm;
@@ -1794,7 +1774,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
index ebc8e932825b7d136d270007c513b034b7ad2a63..0e5d9e6e365748090821fdc05e9deaf839d3b33f 100644 (file)
@@ -116,7 +116,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);