Backend Interface#
The core of the xNVMe API is encapsulated by a backend interface. The backend interface consists of implementations of the following.
Attributes#
name, name of the backend configdescr, human-readable descriptioncaps, bitmask of capabilities (xnvme_be_cap) used for URI-based config selection
Device#
enumerate(), lists devicesdev_from_ident(), open of a given device and return a handledev_close(), close a device handle
Memory#
buf_alloc(), allocate buffer usable with commandsbuf_free(), de-allocate buffersbuf_vtophys()buf_realloc()
Asynchronous#
cmd_io(), submit an IO-command to a qpairpoke(), process completions on a qpairwait(), wait until all outstanding commands are completedinit(), initialize a qpairterm(), terminate a qpairsupported(), informed whether async. commands are supported
Synchronous#
cmd_io(), submit an IO-command and wait for its completioncmd_admin(), submit and Admin-command and wait for its completionsupported(), inform wether sync. commands are supported
Backend Interface - Implementation#
Each platform defines its available backend configs in a
xnvme_platform_<os>.c file, registering them via the
g_xnvme_platform structure. A backend config (xnvme_be_config) is a
complete recipe combining async, sync, admin, dev, and mem implementations.
Have a look at the existing implementations:
lib/platform/<os>/xnvme_platform_<os>.c: platform registration, scan, classify and the list of configs the OS offerslib/platform/<os>/xnvme_platform_<os>_configs.c: the configs that combine implementations from several directorieslib/backend/<dir>/: one directory per mechanism, such asliburing,posixorspdk, and one per OS for its own interfaces, such aslinuxlib/backend/xnvme_be_registry.h: extern declarations for all configs
And the definition of the backend interface in:
lib/backend/xnvme_be.h