libxnvme_lba.h#

Structs#

xnvme_lba_range#

struct xnvme_lba_range#

Representation of a range of logical-block-addresses aka LBAs.

Public Members

uint64_t slba#

Range start-LBA; begins at and includes this address.

uint64_t elba#

Range end-LBA; ends at and includes this address.

uint32_t naddrs#

Number of addresses in range [slba, elba].

uint64_t nbytes#

Number of bytes covered by [slba, elba].

struct xnvme_lba_range_attr attr#

xnvme_lba_range_attr#

struct xnvme_lba_range_attr#

SPDX-FileCopyrightText: Samsung Electronics Co., Ltd.

SPDX-License-Identifier: BSD-3-Clause

Public Members

bool is_zoned#

Whether the range covers a zone [zslba, zslba + cap].

bool is_valid#

Whether the range is valid.

Functions#

xnvme_lba_range_fpr#

int xnvme_lba_range_fpr(FILE *stream, struct xnvme_lba_range *range, int opts)#

Prints the given backend attribute to the given output stream.

Parameters:
  • stream – output stream used for printing

  • range – Pointer to the xnvme_lba_range to print

  • opts – printer options, see xnvme_pr

Returns:

On success, the number of characters printed is returned.

xnvme_lba_range_from_offset_nbytes#

struct xnvme_lba_range xnvme_lba_range_from_offset_nbytes(struct xnvme_dev *dev, uint64_t offset, uint64_t nbytes)#

Initializes a range starting at the given byte-offset and spanning nbytes.

Parameters:
  • dev – Device handle obtained with xnvme_dev_open()

  • offset – Offset in bytes satisfying offset < capacity

  • nbytes – Number of bytes, satisfying offset + nbytes < capacity

Returns:

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_from_slba_elba#

struct xnvme_lba_range xnvme_lba_range_from_slba_elba(struct xnvme_dev *dev, uint64_t slba, uint64_t elba)#

Initializes a range starting at the given start-lba (slba) and spanning naddrs.

Parameters:
  • dev – Device handle obtained with xnvme_dev_open()

  • slba – A valid lba on the given dev

  • elba – A valid lba on the given dev

Returns:

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_from_slba_naddrs#

struct xnvme_lba_range xnvme_lba_range_from_slba_naddrs(struct xnvme_dev *dev, uint64_t slba, uint64_t naddrs)#

Initializes a range starting at the given start-lba (slba) and spanning naddrs.

Parameters:
  • dev – Device handle obtained with xnvme_dev_open()

  • slba – A valid lba on the given dev

  • naddrs – A non-zero number of addresses, satisfying slba + naddrs < device capacity

Returns:

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_from_zdescr#

struct xnvme_lba_range xnvme_lba_range_from_zdescr(struct xnvme_dev *dev, struct xnvme_spec_znd_descr *zdescr)#

Initializes a range starting at the given zone-start-LBA and spanning zone-capacity.

Parameters:
  • dev – Device handle obtained with xnvme_dev_open()

  • zdescr – Pointer to a zone-descriptor valid on the given dev

Returns:

On success, an initialized range is returned by value with attr.is_valid = 1. On error, a potential non, or partially, initialized struct is returned by value with attr.is_valid = 0.

xnvme_lba_range_pr#

int xnvme_lba_range_pr(struct xnvme_lba_range *range, int opts)#

Prints the given backend attribute to stdout.

Parameters:
Returns:

On success, the number of characters printed is returned.