xnvme_ident¶
Header¶
/**
* Cross-platform I/O library for NVMe based devices
*
* Copyright (C) Simon A. F. Lund <simon.lund@samsung.com>
* Copyright (C) Klaus B. A. Jensen <k.jensen@samsung.com>
* SPDX-License-Identifier: Apache-2.0
*
* @file libxnvme_ident.h
*/
#ifndef __LIBXNVME_IDENT
#define __LIBXNVME_IDENT
#ifdef __cplusplus
extern "C" {
#endif
#include <libxnvme_util.h>
#define XNVME_IDENT_URI_LEN 384
#define XNVME_IDENT_SCHM_LEN 5
#define XNVME_IDENT_TRGT_LEN 155
#define XNVME_IDENT_OPTS_LEN 160
#define XNVME_IDENT_OPTS_SEP '?'
#define XNVME_IDENT_OPT_MAX 20
#define XNVME_IDENT_URI_LEN_MIN (XNVME_IDENT_SCHM_LEN + 1)
/**
* Representation of device identifiers once decoded from text-representation
*
* @struct xnvme_ident
*/
struct xnvme_ident {
char subnqn[256];
char uri[XNVME_IDENT_URI_LEN];
uint32_t dtype;
uint32_t nsid;
uint8_t csi;
uint8_t rsvd[55];
};
XNVME_STATIC_ASSERT(sizeof(struct xnvme_ident) == 704, "Incorrect size")
/**
* Parse the given 'uri' into ::xnvme_ident
*
* @param uri
* @param ident Pointer to ident to fill with values parsed from 'uri'
*
* @return On success, 0 is returned. On error, negative `errno` is returned.
*/
int
xnvme_ident_from_uri(const char *uri, struct xnvme_ident *ident);
#ifdef __cplusplus
}
#endif
#endif /* __LIBXNVME_IDENT */
Enums¶
Structs¶
Functions¶
xnvme_ident_fpr¶
-
int
xnvme_ident_fpr
(FILE *stream, const struct xnvme_ident *ident, int opts)¶ Prints the given xnvme_ident to the given output stream.
- Return
On success, the number of characters printed is returned.
- Parameters
stream
: output stream used for printingident
: pointer to structure to printopts
: printer options, see xnvme_pr
xnvme_ident_from_uri¶
-
int
xnvme_ident_from_uri
(const char *uri, struct xnvme_ident *ident)¶ Parse the given ‘uri’ into xnvme_ident.
- Return
On success, 0 is returned. On error, negative
errno
is returned.- Parameters
uri
:ident
: Pointer to ident to fill with values parsed from ‘uri’
xnvme_ident_pr¶
-
int
xnvme_ident_pr
(const struct xnvme_ident *ident, int opts)¶ Prints the given xnvme_ident to stdout.
- Return
On success, the number of characters printed is returned.
- Parameters
ident
: pointer to structure to printopts
: printer options, see xnvme_pr
xnvme_ident_yaml¶
-
int
xnvme_ident_yaml
(FILE *stream, const struct xnvme_ident *ident, int indent, const char *sep, int head)¶ Writes a YAML-representation of the given ‘ident’ to stream.