nvm_cmd - Raw Commands

nvm_cmd_opts

enum nvm_cmd_opts

Enumeration of nvm_cmd options.

Values:

NVM_CMD_SYNC = 0x1 << 3
NVM_CMD_ASYNC = 0x1 << 4
NVM_CMD_SCALAR = 0x1 << 5
NVM_CMD_VECTOR = 0x1 << 6
NVM_CMD_PRP = 0x1 << 7
NVM_CMD_SGL = 0x1 << 8

nvm_cmd_gfeat

int nvm_cmd_gfeat(struct nvm_dev * dev, uint8_t id, union nvm_spec_feat * feat, struct nvm_ret * ret)

Execute an Open-Channel 2.0 Get Feature command.

Return
0 on success, -1 on error and errno set to indicate the error.
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • id: Feature identifier (see NVMe 1.3; Figure 84)
  • feat: Structure defining feature attributes
  • ret: Pointer to structure in which to store lower-level status and result

nvm_cmd_idfy

struct nvm_spec_idfy* nvm_cmd_idfy(struct nvm_dev * dev, struct nvm_ret * ret)

Execute an Open-Channel 1.2 identify / Open-Channel 2.0 geometry command.

NOTE: Caller is responsible for de-allocating the returned structure

Return
On success, pointer identify structure is returned. On error, NULL is returned and errno set to indicate the error and ret filled with lower-level result codes

nvm_cmd_erase

int nvm_cmd_erase(struct nvm_dev * dev, struct nvm_addr addrs[], int naddrs, void * meta, uint16_t flags, struct nvm_ret * ret)

Execute an Open-Channel 1.2 erase / Open-Channel 2.0 reset command.

Return
On success, 0 is returned. On error, -1 is returned and errno set to indicate the error and ret filled with lower-level result codes

nvm_cmd_gbbt_arbs

int nvm_cmd_gbbt_arbs(struct nvm_dev * dev, int bs, int naddrs, struct nvm_addr addrs[])

Find an arbitrary set of ‘naddrs’ block-addresses on the given ‘dev’, in the given block state ‘bs’ and store them in the provided ‘addrs’ array.

Return
On success, 0 is returned. On error, -1 is returned and errno set to indicate the error.

nvm_cmd_sbbt

int nvm_cmd_sbbt(struct nvm_dev * dev, struct nvm_addr * addrs, int naddrs, uint16_t flags, struct nvm_ret * ret)

Execute an Open-Channel 1.2 set bad block table command.

Return
On success, 0 is returned. On error, -1 is returned and errno set to indicate the error.

nvm_cmd_rprt

struct nvm_spec_rprt* nvm_cmd_rprt(struct nvm_dev * dev, struct nvm_addr * addr, int opt, struct nvm_ret * ret)

Executes one or multiple Open-Channel 2.0 get-log-page for chunk-information.

Note
Caller is responsible for de-allocating the returned structure
Return
On success, pointer report chunk structure is returned. On error, NULL is returned and errno set to indicate the error and ret filled with lower-level result codes
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • addr: Pointer to a struct nvm_addr containing the address of a chunk to report about
  • opt: Reporting options, see enum nvm_spec_chunk_state
  • ret: Pointer to structure in which to store lower-level status and result

nvm_cmd_rprt_arbs

int nvm_cmd_rprt_arbs(struct nvm_dev * dev, int cs, int naddrs, struct nvm_addr addrs[])

Find an arbitrary set of ‘naddrs’ chunk-addresses on the given ‘dev’, in the given chunk state ‘cs’ and store them in the provided ‘addrs’ array.

Return
0 on success, -1 on error and errno set to indicate the error.

nvm_cmd_gbbt

struct nvm_spec_bbt* nvm_cmd_gbbt(struct nvm_dev * dev, struct nvm_addr addr, struct nvm_ret * ret)

Execute an Open-Channel 1.2 get bad-block-table command.

Return
On success, pointer to bad block table is returned. On error, NULL is returned and errno set to indicate the error and ret filled with lower-level result codes

nvm_cmd_sfeat

int nvm_cmd_sfeat(struct nvm_dev * dev, uint8_t id, const union nvm_spec_feat * feat, struct nvm_ret * ret)

Execute an Open-Channel 2.0 Set Feature command.

Return
0 on success, -1 on error and errno set to indicate the error.
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • id: Feature identifier (see NVMe 1.3; Figure 84)
  • feat: Structure defining feature attributes
  • ret: Pointer to structure in which to store lower-level status and result

nvm_cmd_copy

int nvm_cmd_copy(struct nvm_dev * dev, struct nvm_addr src[], struct nvm_addr dst[], int naddrs, uint16_t flags, struct nvm_ret * ret)

Execute an Open-Channel 2.0 vector-copy command.

Return
On success, 0 is returned. On error, -1 is returned and errno set to indicate the error and ret filled with lower-level result codes

nvm_cmd_write

int nvm_cmd_write(struct nvm_dev * dev, struct nvm_addr addrs[], int naddrs, const void * data, const void * meta, uint16_t flags, struct nvm_ret * ret)

Execute an Open-Channel 1.2 / 2.0 vector-write command.

Return
On success, 0 is returned. On error, -1 is returned and errno set to indicate the error and ret filled with lower-level result codes

nvm_cmd_read

int nvm_cmd_read(struct nvm_dev * dev, struct nvm_addr addrs[], int naddrs, void * data, void * meta, uint16_t flags, struct nvm_ret * ret)

Execute an Open-Channel 1.2 / 2.0 vector-read command.

Return
On success, 0 is returned. On error, -1 is returned and errno set to indicate the error and ret filled with lower-level result codes