SPDK Initialization Helper. 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 | |
int | spdk_rpc_initialize (const char *listen_addr) |
Create the SPDK JSON-RPC server and listen at the provided address. More... | |
void | spdk_rpc_finish (void) |
Shut down the SPDK JSON-RPC target. | |
void | spdk_subsystem_init (spdk_subsystem_init_fn cb_fn, void *cb_arg) |
Begin the initialization process for all SPDK subsystems. More... | |
void | spdk_subsystem_init_from_json_config (const char *json_config_file, const char *rpc_addr, spdk_subsystem_init_fn cb_fn, void *cb_arg, bool stop_on_error) |
Like spdk_subsystem_init, but additionally configure each subsystem using the provided JSON config file. More... | |
void | spdk_subsystem_fini (spdk_subsystem_fini_fn cb_fn, void *cb_arg) |
Tear down all of the subsystems in the correct order. More... | |
SPDK Initialization Helper.
int spdk_rpc_initialize | ( | const char * | listen_addr | ) |
Create the SPDK JSON-RPC server and listen at the provided address.
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 |
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_init_from_json_config | ( | const char * | json_config_file, |
const char * | rpc_addr, | ||
spdk_subsystem_init_fn | cb_fn, | ||
void * | cb_arg, | ||
bool | stop_on_error | ||
) |
Like spdk_subsystem_init, but additionally configure each subsystem using the provided JSON config file.
This will automatically start a JSON RPC server and then stop it.
json_config_file | Path to a JSON config file. |
rpc_addr | Path to a unix domain socket to send configuration RPCs to. |
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. |