From: Caleb Sander Date: Thu, 14 Sep 2023 21:14:13 +0000 (-0600) Subject: ioctl: export nvme_{g,s}et_features_iocs_profile() X-Git-Tag: v1.6~16 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1b8477dd4a24c4332b67725a365632100ad5e4c7;p=users%2Fsagi%2Flibnvme.git ioctl: export nvme_{g,s}et_features_iocs_profile() nvme_get_features_iocs_profile() and nvme_set_features_iocs_profile() are defined but not exorted in libnvme.so. nvme_set_features_iocs_profile()'s prototype was also removed, so add it back. IOCSI is a 9-bit value, so fix its bitmask and change its type to u16. Signed-off-by: Caleb Sander --- diff --git a/src/libnvme.map b/src/libnvme.map index 29f4c180..5215c284 100644 --- a/src/libnvme.map +++ b/src/libnvme.map @@ -6,9 +6,11 @@ LIBNVME_1_6 { nvme_ctrl_get_src_addr; nvme_ctrl_release_fd; nvme_get_features_host_mem_buf2; + nvme_get_features_iocs_profile; nvme_host_release_fds; nvme_ns_release_fd; nvme_root_release_fds; + nvme_set_features_iocs_profile; nvme_subsystem_get_iopolicy; nvme_subsystem_release_fds; nvme_set_debug; diff --git a/src/nvme/ioctl.c b/src/nvme/ioctl.c index 24bfd8e4..a183f501 100644 --- a/src/nvme/ioctl.c +++ b/src/nvme/ioctl.c @@ -887,7 +887,7 @@ int nvme_set_features_write_protect(int fd, enum nvme_feat_nswpcfg_state state, false, result); } -int nvme_set_features_iocs_profile(int fd, __u8 iocsi, bool save) +int nvme_set_features_iocs_profile(int fd, __u16 iocsi, bool save) { __u32 value = NVME_SET(iocsi, FEAT_IOCSP_IOCSCI); diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index 916fa871..ff58ad35 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -2551,6 +2551,17 @@ int nvme_set_features_resv_persist(int fd, bool ptpl, bool save, __u32 *result); int nvme_set_features_write_protect(int fd, enum nvme_feat_nswpcfg_state state, bool save, __u32 *result); +/** + * nvme_set_features_iocs_profile() - Set I/O command set profile feature + * @fd: File descriptor of nvme device + * @iocsi: I/O Command Set Combination Index + * @save: Save value across power states + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. + */ +int nvme_set_features_iocs_profile(int fd, __u16 iocsi, bool save); + /** * nvme_get_features() - Retrieve a feature attribute * @args: &struct nvme_get_features_args argument structure diff --git a/src/nvme/types.h b/src/nvme/types.h index 5c7eecca..b1bc72f7 100644 --- a/src/nvme/types.h +++ b/src/nvme/types.h @@ -7020,7 +7020,7 @@ enum nvme_feat { NVME_FEAT_WP_WPS_SHIFT = 0, NVME_FEAT_WP_WPS_MASK = 0x7, NVME_FEAT_IOCSP_IOCSCI_SHIFT = 0, - NVME_FEAT_IOCSP_IOCSCI_MASK = 0xff, + NVME_FEAT_IOCSP_IOCSCI_MASK = 0x1ff, NVME_FEAT_FDP_ENABLED_SHIFT = 0, NVME_FEAT_FDP_ENABLED_MASK = 0x1, NVME_FEAT_FDP_INDEX_SHIFT = 8,