From 939c95af14303e410b5c736d9c50b9805b9b3def Mon Sep 17 00:00:00 2001 From: Caleb Sander Date: Sat, 12 Aug 2023 14:50:03 -0600 Subject: [PATCH] ioctl: use available Identify helper functions nvme_identify_independent_identify_ns() only specifies a CNS and a NSID, so have it just call nvme_identify_cns_nsid() instead of duplicating most of its implementation. Similarly, nvme_zns_identify_ns() is just nvme_identify_ns_csi() with the CSI set to ZNS and no UUID index. Signed-off-by: Caleb Sander --- src/nvme/ioctl.h | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index 8ce80a0b..47d8625e 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -980,21 +980,8 @@ static inline int nvme_identify_allocated_ns_list_csi(int fd, __u32 nsid, static inline int nvme_identify_independent_identify_ns(int fd, __u32 nsid, struct nvme_id_independent_id_ns *ns) { - struct nvme_identify_args args = { - .result = NULL, - .data = ns, - .args_size = sizeof(args), - .fd = fd, - .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .cns = NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS, - .csi = NVME_CSI_NVM, - .nsid = nsid, - .cntid = NVME_CNTLID_NONE, - .cns_specific_id = NVME_CNSSPECID_NONE, - .uuidx = NVME_UUID_NONE, - }; - - return nvme_identify(&args); + return nvme_identify_cns_nsid( + fd, NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS, nsid, ns); } /** @@ -1193,20 +1180,8 @@ static inline int nvme_identify_iocs(int fd, __u16 cntlid, static inline int nvme_zns_identify_ns(int fd, __u32 nsid, struct nvme_zns_id_ns *data) { - struct nvme_identify_args args = { - .result = NULL, - .data = data, - .args_size = sizeof(args), - .fd = fd, - .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .cns = NVME_IDENTIFY_CNS_CSI_NS, - .csi = NVME_CSI_ZNS, - .nsid = nsid, - .cntid = NVME_CNTLID_NONE, - .cns_specific_id = NVME_CNSSPECID_NONE, - }; - - return nvme_identify(&args); + return nvme_identify_ns_csi( + fd, nsid, NVME_UUID_NONE, NVME_CSI_ZNS, data); } /** -- 2.50.1