From: Tokunori Ikegami Date: Wed, 10 Apr 2024 16:08:26 +0000 (+0900) Subject: ioctl: Add nvme_ns_mgmt_delete_timeout() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=057f84207301e9a838c453be56d01158cdc62f33;p=users%2Fsagi%2Flibnvme.git ioctl: Add nvme_ns_mgmt_delete_timeout() The existing nvme_ns_mgmt_delete() does not support the timeout. Signed-off-by: Tokunori Ikegami --- diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index 99179080..5a1760d9 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -3647,9 +3647,11 @@ static inline int nvme_ns_mgmt_create(int fd, struct nvme_id_ns *ns, } /** - * nvme_ns_mgmt_delete() - Delete a non attached namespace + * nvme_ns_mgmt_delete_timeout() - Delete a non attached namespace with timeout * @fd: File descriptor of nvme device * @nsid: Namespace identifier to delete + * @timeout: Override the default timeout to this value in milliseconds; + * set to 0 to use the system default. * * It is recommended that a namespace being deleted is not attached to any * controller. Use the nvme_ns_detach_ctrls() first if the namespace is still @@ -3658,7 +3660,7 @@ static inline int nvme_ns_mgmt_create(int fd, struct nvme_id_ns *ns, * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. */ -static inline int nvme_ns_mgmt_delete(int fd, __u32 nsid) +static inline int nvme_ns_mgmt_delete_timeout(int fd, __u32 nsid, __u32 timeout) { __u32 result = 0; int err; @@ -3667,7 +3669,7 @@ static inline int nvme_ns_mgmt_delete(int fd, __u32 nsid) .ns = NULL, .args_size = sizeof(args), .fd = fd, - .timeout = 0, + .timeout = timeout, .nsid = nsid, .sel = NVME_NS_MGMT_SEL_DELETE, .csi = 0, @@ -3682,6 +3684,23 @@ static inline int nvme_ns_mgmt_delete(int fd, __u32 nsid) return err; } +/** + * nvme_ns_mgmt_delete() - Delete a non attached namespace + * @fd: File descriptor of nvme device + * @nsid: Namespace identifier to delete + * + * It is recommended that a namespace being deleted is not attached to any + * controller. Use the nvme_ns_detach_ctrls() first if the namespace is still + * attached. + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. + */ +static inline int nvme_ns_mgmt_delete(int fd, __u32 nsid) +{ + return nvme_ns_mgmt_delete_timeout(fd, nsid, 0); +} + /** * nvme_ns_attach() - Attach or detach namespace to controller(s) * @args: &struct nvme_ns_attach_args Argument structure