libxnvme_nvm.h#
Functions#
xnvme_nvm_compare#
-
int xnvme_nvm_compare(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint64_t slba, uint16_t nlb, void *dbuf, void *mbuf)#
Submit, and optionally wait for completion of, a NVMe Compare.
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
slba – The LBA to start the compare at
nlb – Number of LBAs to be compared. NOTE: nlb is a zero-based value
dbuf – Pointer to buffer; Payload as indicated by ‘ctx->opts’
mbuf – Pointer to buffer; Payload as indicated by ‘ctx->opts’
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_nvm_dsm#
-
int xnvme_nvm_dsm(struct xnvme_cmd_ctx *ctx, uint32_t nsid, struct xnvme_spec_dsm_range *dsm_range, uint8_t nr, bool ad, bool idw, bool idr)#
Deallocate or hint at read/write usage of a range.
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
dsm_range – A buffer of ranges, each with context attributes, slba and nlb
nr – Number of ranges in the given ranges-buffer, zero-based value
ad – The NVM subsystem may deallocate all provided ranges
idw – The dataset should be optimized for write access as an integral unit
idr – The dataset should be optimized for read access as an integral unit
- Returns:
On success, 0 is returned. On error, -1 is returned.
xnvme_nvm_mgmt_recv#
-
int xnvme_nvm_mgmt_recv(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint8_t mo, uint16_t mos, void *dbuf, uint32_t dbuf_nbytes)#
Submit, and wait for completion of a I/O management receive command.
See also
xnvme_cmd_opts
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
mo – Management operation
mos – Management operation specific field
dbuf – pointer to data-payload
dbuf_nbytes – size of the data-payload in bytes
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_nvm_mgmt_send#
-
int xnvme_nvm_mgmt_send(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint8_t mo, uint16_t mos, void *dbuf, uint32_t dbuf_nbytes)#
Submit, and wait for completion of a I/O management send command.
See also
xnvme_cmd_opts
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
mo – Management operation
mos – Management operation specific field
dbuf – pointer to data-payload
dbuf_nbytes – size of the data-payload in bytes
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_nvm_read#
-
int xnvme_nvm_read(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint64_t slba, uint16_t nlb, void *dbuf, void *mbuf)#
SPDX-FileCopyrightText: Samsung Electronics Co., Ltd.
SPDX-License-Identifier: BSD-3-Clause Submit, and optionally wait for completion of, a NVMe Read
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
slba – The LBA to start reading from
nlb – The number of LBAs to read. NOTE: nlb is a zero-based value
dbuf – Pointer to data-payload
mbuf – Pointer to meta-payload
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_nvm_scopy#
-
int xnvme_nvm_scopy(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint64_t sdlba, struct xnvme_spec_nvm_scopy_fmt_zero *ranges, uint8_t nr, enum xnvme_nvm_scopy_fmt copy_fmt)#
Submit, and optionally wait for completion of a NVMe Simple-Copy-Command.
See also
xnvme_cmd_opts
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
sdlba – The Starting Destination LBA to start copying to
ranges – Pointer to ranges-buffer, see xnvme_spec_nvm_scopy_fmt_zero
nr – Number of ranges in the given ranges-buffer, zero-based value
copy_fmt – For of ranges
- Returns:
On success, 0 is returned. On error, -1 is returned,
errno
set to indicate andctx.cpl
filled with lower-level status codes
xnvme_nvm_write#
-
int xnvme_nvm_write(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint64_t slba, uint16_t nlb, const void *dbuf, const void *mbuf)#
Submit, and optionally wait for completion of, a NVMe Write.
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
slba – The LBA to start the write at
nlb – Number of LBAs to be written. NOTE: nlb is a zero-based value
dbuf – Pointer to buffer; Payload as indicated by ‘ctx->opts’
mbuf – Pointer to buffer; Payload as indicated by ‘ctx->opts’
- Returns:
On success, 0 is returned. On error, negative
errno
is returned.
xnvme_nvm_write_uncorrectable#
-
int xnvme_nvm_write_uncorrectable(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint64_t slba, uint16_t nlb)#
Submit a write uncorrected command.
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
slba – The Starting Destination LBA
nlb – Number Of Logical Blocks
xnvme_nvm_write_zeroes#
-
int xnvme_nvm_write_zeroes(struct xnvme_cmd_ctx *ctx, uint32_t nsid, uint64_t slba, uint16_t nlb)#
Submit a write zeroes command.
See also
xnvme_cmd_opts
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
nsid – Namespace Identifier
slba – The LBA to start the write at
nlb – Number Of Logical Blocks
- Returns:
On success, 0 is returned. On error, -1 is returned,
errno
set to indicate and param ctx.cpl filled with lower-level status codes
xnvme_prep_nvm#
-
void xnvme_prep_nvm(struct xnvme_cmd_ctx *ctx, uint8_t opcode, uint32_t nsid, uint64_t slba, uint16_t nlb)#
Submit, and optionally wait for completion of, a NVMe Write.
- Parameters:
ctx – Pointer to command context (xnvme_cmd_ctx)
opcode – Opcode for the NVMe command
nsid – Namespace Identifier
slba – The LBA to start the write at
nlb – Number of LBAs to be written. NOTE: nlb is a zero-based value