libxnvme_pi.h#

Enums#

xnvme_pi_check_type#

enum xnvme_pi_check_type#

Values:

enumerator XNVME_PI_FLAGS_REFTAG_CHECK#
enumerator XNVME_PI_FLAGS_APPTAG_CHECK#
enumerator XNVME_PI_FLAGS_GUARD_CHECK#

xnvme_pi_type#

enum xnvme_pi_type#

Values:

enumerator XNVME_PI_DISABLE#
enumerator XNVME_PI_TYPE1#
enumerator XNVME_PI_TYPE2#
enumerator XNVME_PI_TYPE3#

Structs#

xnvme_pi_ctx#

struct xnvme_pi_ctx#

Public Members

uint32_t block_size#
uint32_t md_size#
uint32_t guard_interval#
uint32_t pi_flags#
bool md_interleave#
uint16_t pi_type#
uint16_t pi_format#
uint64_t init_ref_tag#
uint16_t app_tag#
uint16_t apptag_mask#

Functions#

xnvme_pi_ctx_init#

int xnvme_pi_ctx_init(struct xnvme_pi_ctx *ctx, uint32_t block_size, uint32_t md_size, bool md_interleave, bool pi_loc, enum xnvme_pi_type pi_type, uint32_t pi_flags, uint32_t init_ref_tag, uint16_t apptag_mask, uint16_t app_tag, enum xnvme_spec_nvm_ns_pif pi_format)#

Initialize the Protection Information context.

Parameters:
  • ctx – Pointer to xnvme_pi_ctx

  • block_size – Block size

  • md_size – Metadata size

  • md_interleave – metadata part of data buffer

  • pi_loc – Protection Information location in data/metadata buffer

  • pi_type – Protection Information Type

  • pi_flags – Protection Information flags

  • init_ref_tag – initial offset

  • apptag_mask – Application Tag mask

  • app_tag – Application Tag

  • pi_format – Protection Information Format

Returns:

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

xnvme_pi_generate#

void xnvme_pi_generate(struct xnvme_pi_ctx *ctx, uint8_t *data_buf, uint8_t *md_buf, uint32_t num_blocks)#

Generate and fill Protection information part of metadata.

Parameters:
  • ctx – Pointer to xnvme_pi_ctx

  • data_buf – Pointer to data-payload

  • md_buf – Pointer to meta-payload

  • num_blocks – Number of logical blocks

xnvme_pi_size#

size_t xnvme_pi_size(enum xnvme_spec_nvm_ns_pif pi_format)#

Return the protection information size.

Parameters:
  • pi_format – Protection Information Format

Returns:

On success, the size for protection information format.

xnvme_pi_verify#

int xnvme_pi_verify(struct xnvme_pi_ctx *ctx, uint8_t *data_buf, uint8_t *md_buf, uint32_t num_blocks)#

Verify the protection information content of metadata.

Parameters:
  • ctx – Pointer to xnvme_pi_ctx

  • data_buf – Pointer to data-payload

  • md_buf – Pointer to meta-payload

  • num_blocks – Number of logical blocks

Returns:

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