xnvmec

Enums

xnvmec_opt

enum xnvmec_opt

Command-Line Options, each command-line option can be one of xnvmec_opt_type.

Values:

enumerator XNVMEC_OPT_NONE

XNVMEC_OPT_NONE.

enumerator XNVMEC_OPT_CDW00

XNVMEC_OPT_CDW00.

enumerator XNVMEC_OPT_CDW01

XNVMEC_OPT_CDW01.

enumerator XNVMEC_OPT_CDW02

XNVMEC_OPT_CDW02.

enumerator XNVMEC_OPT_CDW03

XNVMEC_OPT_CDW03.

enumerator XNVMEC_OPT_CDW04

XNVMEC_OPT_CDW04.

enumerator XNVMEC_OPT_CDW05

XNVMEC_OPT_CDW05.

enumerator XNVMEC_OPT_CDW06

XNVMEC_OPT_CDW06.

enumerator XNVMEC_OPT_CDW07

XNVMEC_OPT_CDW07.

enumerator XNVMEC_OPT_CDW08

XNVMEC_OPT_CDW08.

enumerator XNVMEC_OPT_CDW09

XNVMEC_OPT_CDW09.

enumerator XNVMEC_OPT_CDW10

XNVMEC_OPT_CDW10.

enumerator XNVMEC_OPT_CDW11

XNVMEC_OPT_CDW11.

enumerator XNVMEC_OPT_CDW12

XNVMEC_OPT_CDW12.

enumerator XNVMEC_OPT_CDW13

XNVMEC_OPT_CDW13.

enumerator XNVMEC_OPT_CDW14

XNVMEC_OPT_CDW14.

enumerator XNVMEC_OPT_CDW15

XNVMEC_OPT_CDW15.

enumerator XNVMEC_OPT_CMD_INPUT

XNVMEC_OPT_CMD_INPUT.

enumerator XNVMEC_OPT_CMD_OUTPUT

XNVMEC_OPT_CMD_OUTPUT.

enumerator XNVMEC_OPT_DATA_NBYTES

XNVMEC_OPT_DATA_NBYTES.

enumerator XNVMEC_OPT_DATA_INPUT

XNVMEC_OPT_DATA_INPUT.

enumerator XNVMEC_OPT_DATA_OUTPUT

XNVMEC_OPT_DATA_OUTPUT.

enumerator XNVMEC_OPT_META_NBYTES

XNVMEC_OPT_META_NBYTES.

enumerator XNVMEC_OPT_META_INPUT

XNVMEC_OPT_META_INPUT.

enumerator XNVMEC_OPT_META_OUTPUT

XNVMEC_OPT_META_OUTPUT.

enumerator XNVMEC_OPT_LBAF

XNVMEC_OPT_LBAF.

enumerator XNVMEC_OPT_SLBA

XNVMEC_OPT_SLBA.

enumerator XNVMEC_OPT_ELBA

XNVMEC_OPT_ELBA.

enumerator XNVMEC_OPT_LBA

XNVMEC_OPT_LBA.

enumerator XNVMEC_OPT_NLB

XNVMEC_OPT_NLB.

enumerator XNVMEC_OPT_URI

XNVMEC_OPT_URI.

enumerator XNVMEC_OPT_SYS_URI

XNVMEC_OPT_SYS_URI.

enumerator XNVMEC_OPT_UUID

XNVMEC_OPT_UUID.

enumerator XNVMEC_OPT_NSID

XNVMEC_OPT_NSID.

enumerator XNVMEC_OPT_CNS

XNVMEC_OPT_CNS.

enumerator XNVMEC_OPT_CSI

XNVMEC_OPT_CSI.

enumerator XNVMEC_OPT_INDEX

XNVMEC_OPT_INDEX.

enumerator XNVMEC_OPT_SETID

XNVMEC_OPT_SETID.

enumerator XNVMEC_OPT_CNTID

XNVMEC_OPT_CNTID.

enumerator XNVMEC_OPT_LID

XNVMEC_OPT_LID.

enumerator XNVMEC_OPT_LSP

XNVMEC_OPT_LSP.

enumerator XNVMEC_OPT_LPO_NBYTES

XNVMEC_OPT_LPO_NBYTES.

enumerator XNVMEC_OPT_RAE

XNVMEC_OPT_RAE.

enumerator XNVMEC_OPT_CLEAR

XNVMEC_OPT_CLEAR.

enumerator XNVMEC_OPT_ZF

XNVMEC_OPT_ZF.

enumerator XNVMEC_OPT_SES

XNVMEC_OPT_SES.

enumerator XNVMEC_OPT_SEL

XNVMEC_OPT_SEL.

enumerator XNVMEC_OPT_MSET

XNVMEC_OPT_MSET.

enumerator XNVMEC_OPT_AUSE

XNVMEC_OPT_AUSE.

enumerator XNVMEC_OPT_OVRPAT

XNVMEC_OPT_OVRPAT.

enumerator XNVMEC_OPT_OWPASS

XNVMEC_OPT_OWPASS.

enumerator XNVMEC_OPT_OIPBP

XNVMEC_OPT_OIPBP.

enumerator XNVMEC_OPT_NODAS

XNVMEC_OPT_NODAS.

enumerator XNVMEC_OPT_ACTION

XNVMEC_OPT_ACTION.

enumerator XNVMEC_OPT_ZRMS

XNVMEC_OPT_ZRMS.

enumerator XNVMEC_OPT_PI

XNVMEC_OPT_PI.

enumerator XNVMEC_OPT_PIL

XNVMEC_OPT_PIL.

enumerator XNVMEC_OPT_FID

XNVMEC_OPT_FID.

enumerator XNVMEC_OPT_FEAT

XNVMEC_OPT_FEAT.

enumerator XNVMEC_OPT_SEED

XNVMEC_OPT_SEED.

enumerator XNVMEC_OPT_LIMIT

XNVMEC_OPT_LIMIT.

enumerator XNVMEC_OPT_IOSIZE

XNVMEC_OPT_IOSIZE.

enumerator XNVMEC_OPT_QDEPTH

XNVMEC_OPT_QDEPTH.

enumerator XNVMEC_OPT_DIRECT

XNVMEC_OPT_DIRECT.

enumerator XNVMEC_OPT_STATUS

XNVMEC_OPT_STATUS.

enumerator XNVMEC_OPT_SAVE

XNVMEC_OPT_SAVE.

enumerator XNVMEC_OPT_RESET

XNVMEC_OPT_RESET.

enumerator XNVMEC_OPT_VERBOSE

XNVMEC_OPT_VERBOSE.

enumerator XNVMEC_OPT_HELP

XNVMEC_OPT_HELP.

enumerator XNVMEC_OPT_COUNT

XNVMEC_OPT_COUNT.

enumerator XNVMEC_OPT_OFFSET

XNVMEC_OPT_OFFSET.

enumerator XNVMEC_OPT_OPCODE

XNVMEC_OPT_OPCODE.

enumerator XNVMEC_OPT_FLAGS

XNVMEC_OPT_FLAGS.

enumerator XNVMEC_OPT_ALL

XNVMEC_OPT_ALL.

enumerator XNVMEC_OPT_BE

XNVMEC_OPT_BE.

enumerator XNVMEC_OPT_MEM

XNVMEC_OPT_MEM.

enumerator XNVMEC_OPT_SYNC

XNVMEC_OPT_SYNC.

enumerator XNVMEC_OPT_ASYNC

XNVMEC_OPT_ASYNC.

enumerator XNVMEC_OPT_ADMIN

XNVMEC_OPT_ADMIN.

enumerator XNVMEC_OPT_SHM_ID

XNVMEC_OPT_SHM_ID.

enumerator XNVMEC_OPT_MAIN_CORE

XNVMEC_OPT_MAIN_CORE.

enumerator XNVMEC_OPT_CORE_MASK

XNVMEC_OPT_CORE_MASK.

enumerator XNVMEC_OPT_USE_CMB_SQS

XNVMEC_OPT_USE_CMB_SQS.

enumerator XNVMEC_OPT_CSS

XNVMEC_OPT_CSS.

enumerator XNVMEC_OPT_POLL_IO

XNVMEC_OPT_POLL_IO.

enumerator XNVMEC_OPT_POLL_SQ

XNVMEC_OPT_POLL_SQ.

enumerator XNVMEC_OPT_REGISTER_FILES

XNVMEC_OPT_REGISTER_FILES.

enumerator XNVMEC_OPT_REGISTER_BUFFERS

XNVMEC_OPT_REGISTER_BUFFERS.

enumerator XNVMEC_OPT_TRUNCATE

XNVMEC_OPT_TRUNCATE.

enumerator XNVMEC_OPT_RDONLY

XNVMEC_OPT_RDONLY.

enumerator XNVMEC_OPT_WRONLY

XNVMEC_OPT_WRONLY.

enumerator XNVMEC_OPT_RDWR

XNVMEC_OPT_RDWR.

enumerator XNVMEC_OPT_CREATE

XNVMEC_OPT_CREATE.

enumerator XNVMEC_OPT_CREATE_MODE

XNVMEC_OPT_CREATE_MODE.

enumerator XNVMEC_OPT_OFLAGS

XNVMEC_OPT_OFLAGS.

enumerator XNVMEC_OPT_ADRFAM

XNVMEC_OPT_ADRFAM.

enumerator XNVMEC_OPT_DEV_NSID

XNVMEC_OPT_DEV_NSID.

enumerator XNVMEC_OPT_END

XNVMEC_OPT_END.

xnvmec_opt_type

enum xnvmec_opt_type

XNVMEC_LFLG: .

/cli verbose; always optional XNVMEC_LOPT: ./cli arg 0x0; optionally provide a value XNVMEC_LREQ: ./cli arg 0x0; require providing a value XNVMEC_POSA: ./cli arg1 arg2; required, ordered, and provides a value

Values:

enumerator XNVMEC_POSA

XNVMEC_POSA.

enumerator XNVMEC_LFLG

XNVMEC_LFLG.

enumerator XNVMEC_LOPT

XNVMEC_LOPT.

enumerator XNVMEC_LREQ

XNVMEC_LREQ.

xnvmec_opt_value_type

enum xnvmec_opt_value_type

Values:

enumerator XNVMEC_OPT_VTYPE_URI
enumerator XNVMEC_OPT_VTYPE_NUM
enumerator XNVMEC_OPT_VTYPE_HEX
enumerator XNVMEC_OPT_VTYPE_FILE
enumerator XNVMEC_OPT_VTYPE_STR

xnvmec_opts

enum xnvmec_opts

Values:

enumerator XNVMEC_INIT_NONE
enumerator XNVMEC_INIT_DEV_OPEN

Structs

xnvmec

struct xnvmec

Public Members

const char *title

Setup by user.

const char *descr_short

Setup by user.

const char *descr_long

Setup by user.

int nsubs

Setup by user.

struct xnvmec_sub *subs

Setup by user.

int (*ver_pr)()

Setup by library if unset.

int argc

Setup by library.

char **argv

Setup by library.

struct xnvmec_args args

Setup by library.

int given[XNVMEC_OPT_END]

Setup by library.

struct xnvmec_sub *sub

Setup by library.

struct xnvme_timer timer

Used by xnvmec_timer_*.

xnvmec_args

struct xnvmec_args

Options are stored in an instance of this structure.

Public Members

struct xnvme_dev *dev

Created.

const struct xnvme_geo *geo

Created.

const char *uri
const char *sys_uri
const char *cmd_input
const char *cmd_output
size_t data_nbytes
const char *data_input
const char *data_output
size_t meta_nbytes
const char *meta_input
const char *meta_output
uint32_t cdw[16]
uint64_t lbaf
uint64_t lba
uint32_t nlb
uint64_t slba
uint64_t elba
uint32_t uuid
uint32_t nsid
uint32_t dev_nsid
uint32_t cns
uint32_t csi
uint64_t index
uint32_t setid
uint64_t cntid
uint32_t lid
uint32_t lsp
uint64_t lpo_nbytes
uint32_t rae
uint32_t clear
uint32_t zf
uint32_t ses
uint32_t sel
uint32_t mset
uint32_t ause
uint32_t ovrpat
uint32_t owpass
uint32_t oipbp
uint32_t nodas
uint32_t action
uint32_t zrms
uint32_t pi
uint32_t pil
uint32_t fid
uint32_t feat
uint32_t seed
uint32_t iosize
uint32_t qdepth
uint32_t direct
uint32_t limit
uint64_t count
uint64_t offset
uint64_t opcode
uint64_t flags
uint64_t all
uint32_t status
uint32_t save
uint32_t reset
uint32_t verbose
uint32_t help
const char *be
const char *mem
const char *sync
const char *async
const char *admin
uint64_t shm_id
uint32_t main_core
const char *core_mask
struct xnvmec_args.[anonymous] css

SPDK controller-setup: do command-set-selection.

uint32_t use_cmb_sqs
const char *adrfam
uint32_t poll_io
uint32_t poll_sq
uint32_t register_files
uint32_t register_buffers
uint32_t truncate
uint32_t rdonly
uint32_t wronly
uint32_t rdwr
uint32_t create
uint32_t create_mode
uint32_t oflags

xnvmec_opt_attr

struct xnvmec_opt_attr

Public Members

enum xnvmec_opt opt
enum xnvmec_opt_value_type vtype
const char *name
const char *descr
char getoptval

xnvmec_sub

struct xnvmec_sub

Filled by the user of libxnvmc, usually statically right above main.

Public Members

const char *name

Short name of the sub-command.

const char *descr_short

Short sub-command description.

const char *descr_long

Long sub-command description.

xnvmec_subfunc command

Function to execute.

Options to parse into args and pass onto func

struct xnvmec_sub_opt opts[XNVMEC_SUB_OPTS_LEN]

xnvmec_sub_opt

struct xnvmec_sub_opt

Public Members

enum xnvmec_opt opt
enum xnvmec_opt_type type

Functions

xnvmec

int xnvmec(struct xnvmec *cli, int argc, char **argv, int opts)

xnvmec_args_pr

void xnvmec_args_pr(struct xnvmec_args *args, int opts)

xnvmec_buf_clear

void *xnvmec_buf_clear(void *buf, size_t nbytes)

xnvmec_buf_diff

size_t xnvmec_buf_diff(const void *expected, const void *actual, size_t nbytes)

Returns the number of bytes where expected is different from actual.

Parameters
  • expected

  • actual

  • nbytes

Returns

On success, returns number of bytes that differ

xnvmec_buf_diff_pr

void xnvmec_buf_diff_pr(const void *expected, const void *actual, size_t nbytes, int opts)

Prints the number and value of bytes where expected is different from actual.

Parameters
  • expected

  • actual

  • nbytes

  • opts

xnvmec_buf_fill

int xnvmec_buf_fill(void *buf, size_t nbytes, const char *content)

Fills buf with content nbytes of content.

Parameters
  • buf – Pointer to the buffer to fill

  • content – Name of a file, or special “zero”, or “anum”

  • nbytes – Amount of bytes to fill in buf

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvmec_buf_from_file

int xnvmec_buf_from_file(void *buf, size_t nbytes, const char *path)

Read content of file into buffer.

Parameters
  • buf – Pointer to the buffer

  • nbytes – Size of buf

  • path – Source to read from

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvmec_buf_to_file

int xnvmec_buf_to_file(void *buf, size_t nbytes, const char *path)

Write content of buffer into file.

  • If file exists, then it is truncated / overwritten

  • If file does NOT exist, then it is created

  • When file is created, permissions are set to user WRITE + READ

Parameters
  • buf – Pointer to the buffer

  • nbytes – Size of buf

  • path – Destination where buffer will be dumped to

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvmec_cli_to_opts

int xnvmec_cli_to_opts(const struct xnvmec *cli, struct xnvme_opts *opts)

Fill the given ‘opts’ with values parsed in the given ‘cli’.

Parameters
  • cli – The command-line-interface to parse arguments for

  • opts – The device-options to fill

Returns

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

xnvmec_cmd_from_file

int xnvmec_cmd_from_file(struct xnvme_spec_cmd *cmd, const char *fpath)

Fill the the given ‘cmd’ with content of file at ‘fpath’.

Parameters
  • cmd – the command to fill

  • fpath – path to file

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvmec_cmd_to_file

int xnvmec_cmd_to_file(const struct xnvme_spec_cmd *cmd, const char *fpath)

Stores the given cmd in fpath

Parameters
  • cmd – the command to store

  • fpath – path to store content of cmd in

Returns

On success, 0 is returned. On error, negative errno is returned.

xnvmec_get_opt_attr

const struct xnvmec_opt_attr *xnvmec_get_opt_attr(enum xnvmec_opt opt)

xnvmec_perr

void xnvmec_perr(const char *msg, int err)

xnvmec_pinf

void xnvmec_pinf(const char *format, ...)

xnvmec_timer_bw_pr

static inline void xnvmec_timer_bw_pr(struct xnvmec *cli, const char *prefix, size_t nbytes)

xnvmec_timer_start

static inline uint64_t xnvmec_timer_start(struct xnvmec *cli)

xnvmec_timer_stop

static inline uint64_t xnvmec_timer_stop(struct xnvmec *cli)