]> 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)
committerNathan Cutler <ncutler@suse.com>
Thu, 4 Jun 2020 13:08:40 +0000 (15:08 +0200)
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)

Conflicts:
src/include/cephfs/libcephfs.h
- nautilus version of this file does not have the line:
      struct CephContext;

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 56f1f4966355530bc70d63f97e252a54ea65207b..5c80d3bdf51d57e717cdc3fdfd0fa6e01cb476d8 100644 (file)
@@ -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;
index a5d21132b73acf55f38770b8c39b012a18991ead..66cd5c8d0cec49688dd7448f782343652d1b6215 100644 (file)
@@ -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;
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 20158e626680d26a99ac397712718bc006ebdc90..9a305fb14051e914038d5f46fa4a3ec8681de2ba 100644 (file)
@@ -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<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 7ed86893f4daaa7cd3161f8631d0a2c62ef64cda..a1fc0a7e30aebb2a54c741fc6a771c9d2f757c4f 100755 (executable)
@@ -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
index 65a539e7eeb5e6ef2d8a5f44e6f5b4d07f0827d5..160ff47a99b6ff92489dc7906705ba461ffdd4c3 100755 (executable)
@@ -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);