Skip to content

Commit 4203a37

Browse files
sc108-leedwsuse
authored andcommitted
ioctl: Add identify ioctl for CNS 09h, 0Ah
09h - Identify Namespace data structure for the specified User Data Format index containing the namespace capabilities for the NVM Command Set. 0Ah - I/O Command Set specific Identify Namespace data structure for the specified User Data Format index containing the namespace capabilities for the I/O Command Set specified in the CSI field. Signed-off-by: Steven Seungcheol Lee <[email protected]>
1 parent d335784 commit 4203a37

3 files changed

Lines changed: 73 additions & 0 deletions

File tree

src/libnvme.map

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ LIBNVME_1_0 {
156156
nvme_identify_domain_list;
157157
nvme_identify_endurance_group_list;
158158
nvme_identify_independent_identify_ns;
159+
nvme_identify_ns_csi_user_data_format;
160+
nvme_identify_iocs_ns_csi_user_data_format;
159161
nvme_identify_iocs;
160162
nvme_identify_ns;
161163
nvme_identify_ns_descs;

src/nvme/ioctl.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,75 @@ static inline int nvme_identify_independent_identify_ns(int fd, __u32 nsid,
949949
return nvme_identify(&args);
950950
}
951951

952+
/**
953+
* nvme_identify_ns_csi_user_data_format() -
954+
* @fd: File descriptor of nvme device
955+
* @user_data_format: Return namespaces capability of identifier
956+
* @uuidx: UUID selection, if supported
957+
* @csi: Command Set Identifier
958+
*
959+
* Identify Namespace data structure for the specified User Data Format
960+
* index containing the namespace capabilities for the NVM Command Set.
961+
*
962+
* Return: The nvme command status if a response was received (see
963+
* &enum nvme_status_field) or -1 with errno set otherwise.
964+
*/
965+
static inline int nvme_identify_ns_csi_user_data_format(int fd,
966+
__u16 user_data_format, __u8 uuidx,
967+
enum nvme_csi csi, void *data)
968+
{
969+
struct nvme_identify_args args = {
970+
.result = NULL,
971+
.data = data,
972+
.args_size = sizeof(args),
973+
.fd = fd,
974+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
975+
.cns = NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT,
976+
.csi = csi,
977+
.nsid = NVME_NSID_NONE,
978+
.cntid = NVME_CNTLID_NONE,
979+
.cns_specific_id = user_data_format,
980+
.uuidx = uuidx,
981+
};
982+
983+
return nvme_identify(&args);
984+
}
985+
986+
/**
987+
* nvme_identify_iocs_ns_csi_user_data_format() -
988+
* @fd: File descriptor of nvme device
989+
* @user_data_format: Return namespaces capability of identifier
990+
* @uuidx: UUID selection, if supported
991+
* @csi: Command Set Identifier
992+
*
993+
* I/O Command Set specific Identify Namespace data structure for
994+
* the specified User Data Format index containing the namespace
995+
* capabilities for the I/O Command Set specified in the CSI field.
996+
*
997+
* Return: The nvme command status if a response was received (see
998+
* &enum nvme_status_field) or -1 with errno set otherwise.
999+
*/
1000+
static inline int nvme_identify_iocs_ns_csi_user_data_format(int fd,
1001+
__u16 user_data_format, __u8 uuidx,
1002+
enum nvme_csi csi, void *data)
1003+
{
1004+
struct nvme_identify_args args = {
1005+
.result = NULL,
1006+
.data = data,
1007+
.args_size = sizeof(args),
1008+
.fd = fd,
1009+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
1010+
.cns = NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT,
1011+
.csi = csi,
1012+
.nsid = NVME_NSID_NONE,
1013+
.cntid = NVME_CNTLID_NONE,
1014+
.cns_specific_id = user_data_format,
1015+
.uuidx = uuidx,
1016+
};
1017+
1018+
return nvme_identify(&args);
1019+
}
1020+
9521021
/**
9531022
* nvme_nvm_identify_ctrl() -
9541023
* @fd: File descriptor of nvme device

src/nvme/types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5802,6 +5802,8 @@ enum nvme_identify_cns {
58025802
NVME_IDENTIFY_CNS_CSI_CTRL = 0x06,
58035803
NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST = 0x07,
58045804
NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS = 0x08,
5805+
NVME_IDENTIFY_CNS_NS_USER_DATA_FORMAT = 0x09,
5806+
NVME_IDENTIFY_CNS_CSI_NS_USER_DATA_FORMAT = 0x0A,
58055807
NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST = 0x10,
58065808
NVME_IDENTIFY_CNS_ALLOCATED_NS = 0x11,
58075809
NVME_IDENTIFY_CNS_NS_CTRL_LIST = 0x12,

0 commit comments

Comments
 (0)