SPDK Initialization Helper. More...
Data Structures | |
struct | spdk_rpc_opts |
Structure with optional parameters for the JSON-RPC server initialization. More... | |
Macros | |
#define | SPDK_DEFAULT_RPC_ADDR "/var/tmp/spdk.sock" |
Typedefs | |
typedef void(* | spdk_subsystem_init_fn) (int rc, void *ctx) |
typedef void(* | spdk_subsystem_fini_fn) (void *ctx) |
Functions | |
SPDK_STATIC_ASSERT (sizeof(struct spdk_rpc_opts)==24, "Incorrect size") | |
int | spdk_rpc_initialize (const char *listen_addr, const struct spdk_rpc_opts *opts) |
Create SPDK JSON-RPC server listening at provided address and start polling it for connections. | |
void | spdk_rpc_finish (void) |
Stop SPDK JSON-RPC servers and stop polling for new connections on all addresses. | |
void | spdk_rpc_server_finish (const char *listen_addr) |
Stop SPDK JSON-RPC server and stop polling for new connections on provided address. | |
void | spdk_subsystem_init (spdk_subsystem_init_fn cb_fn, void *cb_arg) |
Begin the initialization process for all SPDK subsystems. | |
void | spdk_subsystem_load_config (void *json, ssize_t json_size, spdk_subsystem_init_fn cb_fn, void *cb_arg, bool stop_on_error) |
Loads RPC configuration from provided JSON for current RPC state. | |
void | spdk_subsystem_fini (spdk_subsystem_fini_fn cb_fn, void *cb_arg) |
Tear down all of the subsystems in the correct order. | |
bool | spdk_subsystem_exists (const char *name) |
Check if the specified subsystem exists in the application. | |
void | spdk_rpc_server_pause (const char *listen_addr) |
Pause polling RPC server with given address. | |
void | spdk_rpc_server_resume (const char *listen_addr) |
Resume polling RPC server with given address. | |
SPDK Initialization Helper.
int spdk_rpc_initialize | ( | const char * | listen_addr, |
const struct spdk_rpc_opts * | opts ) |
Create SPDK JSON-RPC server listening at provided address and start polling it for connections.
The RPC server is optional and is independent of subsystem initialization. The RPC server can be started and stopped at any time.
listen_addr | Path to a unix domain socket to listen on |
opts | Options for JSON-RPC server initialization. If NULL, default values are used. |
void spdk_rpc_server_finish | ( | const char * | listen_addr | ) |
Stop SPDK JSON-RPC server and stop polling for new connections on provided address.
listen_addr | Path to a unix domain socket. |
void spdk_rpc_server_pause | ( | const char * | listen_addr | ) |
Pause polling RPC server with given address.
listen_addr | Address, on which RPC server listens for connections. |
void spdk_rpc_server_resume | ( | const char * | listen_addr | ) |
Resume polling RPC server with given address.
listen_addr | Address, on which RPC server listens for connections. |
bool spdk_subsystem_exists | ( | const char * | name | ) |
Check if the specified subsystem exists in the application.
name | Name of the subsystem to look for |
void spdk_subsystem_fini | ( | spdk_subsystem_fini_fn | cb_fn, |
void * | cb_arg ) |
Tear down all of the subsystems in the correct order.
cb_fn | Function called when the process is complete. |
cb_arg | User context passed to cb_fn |
void spdk_subsystem_init | ( | spdk_subsystem_init_fn | cb_fn, |
void * | cb_arg ) |
Begin the initialization process for all SPDK subsystems.
SPDK is divided into subsystems at a macro-level and each subsystem automatically registers itself with this library at start up using a C constructor. Further, each subsystem can declare other subsystems that it depends on. Calling this function will correctly initialize all subsystems that are present, in the required order.
cb_fn | Function called when the process is complete. |
cb_arg | User context passed to cb_fn. |
void spdk_subsystem_load_config | ( | void * | json, |
ssize_t | json_size, | ||
spdk_subsystem_init_fn | cb_fn, | ||
void * | cb_arg, | ||
bool | stop_on_error ) |
Loads RPC configuration from provided JSON for current RPC state.
The function will automatically start a JSON RPC server for configuration purposes and then stop it. JSON data will be copied, so parsing will not disturb the original memory.
json | Raw JSON data. |
json_size | Size of JSON data. |
cb_fn | Function called when the process is complete. |
cb_arg | User context passed to cb_fn. |
stop_on_error | Whether to stop initialization if one of the JSON RPCs fails. |