]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/spdk/include/spdk/rpc.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / include / spdk / rpc.h
index ab1fa61bd49b6812fec8eadd2aa234fc4e60dc17..2ffb0e2db9bb84682462c4f8183501e1e32f46d5 100644 (file)
@@ -81,6 +81,25 @@ typedef void (*spdk_rpc_method_handler)(struct spdk_jsonrpc_request *request,
 void spdk_rpc_register_method(const char *method, spdk_rpc_method_handler func,
                              uint32_t state_mask);
 
+/**
+ * Register a deprecated alias for an RPC method.
+ *
+ * \param method Name for the registered method.
+ * \param alias Alias for the registered method.
+ */
+void spdk_rpc_register_alias_deprecated(const char *method, const char *alias);
+
+/**
+ * Check if \c method is allowed for \c state_mask
+ *
+ * \param method Method name
+ * \param state_mask state mask to check against
+ * \return 0 if method is allowed or negative error code:
+ * -EPERM method is not allowed
+ * -ENOENT method not found
+ */
+int spdk_rpc_is_method_allowed(const char *method, uint32_t state_mask);
+
 #define SPDK_RPC_STARTUP       0x1
 #define SPDK_RPC_RUNTIME       0x2
 
@@ -90,6 +109,12 @@ static void __attribute__((constructor)) rpc_register_##func(void) \
        spdk_rpc_register_method(method, func, state_mask); \
 }
 
+#define SPDK_RPC_REGISTER_ALIAS_DEPRECATED(method, alias) \
+static void __attribute__((constructor)) rpc_register_##alias(void) \
+{ \
+       spdk_rpc_register_alias_deprecated(#method, #alias); \
+}
+
 /**
  * Set the state mask of the RPC server. Any RPC method whose state mask is
  * equal to the state of the RPC server is allowed.
@@ -98,6 +123,12 @@ static void __attribute__((constructor)) rpc_register_##func(void) \
  */
 void spdk_rpc_set_state(uint32_t state_mask);
 
+/**
+ * Get the current state of the RPC server.
+ *
+ * \return The current state of the RPC server.
+ */
+uint32_t spdk_rpc_get_state(void);
 
 #ifdef __cplusplus
 }