From: Daniel Wagner Date: Fri, 12 Apr 2024 10:58:34 +0000 (+0200) Subject: Revert "ioctl: add nvme_set_features_host_behavior2()" X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0c06e40181e3a68a16257c64a0598f894f62ee50;p=users%2Fsagi%2Flibnvme.git Revert "ioctl: add nvme_set_features_host_behavior2()" This reverts commit eff57ae736dc14a22229b9f50b68abd6001edc97. The result field is undefined for many commands and thus can have random values. Thus we can't blindly evaluate these for all commands. Signed-off-by: Daniel Wagner --- diff --git a/src/libnvme.map b/src/libnvme.map index c2a23e3a..b3c87201 100644 --- a/src/libnvme.map +++ b/src/libnvme.map @@ -11,7 +11,6 @@ LIBNVME_1.9 { nvme_update_key; nvme_ctrl_get_cntlid; nvme_set_features_timestamp2; - nvme_set_features_host_behavior2; }; LIBNVME_1_8 { diff --git a/src/nvme/ioctl.c b/src/nvme/ioctl.c index d54b367c..726171e4 100644 --- a/src/nvme/ioctl.c +++ b/src/nvme/ioctl.c @@ -661,19 +661,7 @@ int nvme_set_features_lba_sts_interval(int fd, __u16 lsiri, __u16 lsipi, } int nvme_set_features_host_behavior(int fd, bool save, - struct nvme_feat_host_behavior *data) -{ - __u32 result = 0; - int err; - - err = nvme_set_features_host_behavior2(fd, save, data, &result); - if (err && result) - err = result; - return err; -} - -int nvme_set_features_host_behavior2(int fd, bool save, - struct nvme_feat_host_behavior *data, __u32 *result) + struct nvme_feat_host_behavior *data) { struct nvme_set_features_args args = { .args_size = sizeof(args), @@ -688,7 +676,7 @@ int nvme_set_features_host_behavior2(int fd, bool save, .data_len = sizeof(*data), .data = data, .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .result = result, + .result = NULL, }; return nvme_set_features(&args); diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index f35b2f21..1584d551 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -2833,24 +2833,10 @@ int nvme_set_features_lba_sts_interval(int fd, __u16 lsiri, __u16 lsipi, * @save: Save value across power states * @data: Pointer to structure nvme_feat_host_behavior * - * Return: The nvme command status if a response was received (see - * &enum nvme_status_field) or -1 with errno set otherwise. + * Return: 0 if the ioctl was successful or -1 with errno set otherwise. */ int nvme_set_features_host_behavior(int fd, bool save, - struct nvme_feat_host_behavior *data); - -/** - * nvme_set_features_host_behavior2() - Set host behavior feature - * @fd: File descriptor of nvme device - * @save: Save value across power states - * @data: Pointer to structure nvme_feat_host_behavior - * @result: The command completion result from CQE dword0 - * - * Return: 0 if the ioctl was successful, -1 with errno set to EPROTO when - * a non-zero state is returned in @result, or -1 with errno set otherwise. - */ -int nvme_set_features_host_behavior2(int fd, bool save, - struct nvme_feat_host_behavior *data, __u32 *result); + struct nvme_feat_host_behavior *data); /** * nvme_set_features_sanitize() - Set sanitize feature @@ -2861,6 +2847,7 @@ int nvme_set_features_host_behavior2(int fd, bool save, * * Return: 0 if the ioctl was successful, -1 with errno set to EPROTO when * a non-zero state is returned in @result, or -1 with errno set otherwise. + * Return: 0 if the ioctl was successful or -1 with errno set otherwise. */ int nvme_set_features_sanitize(int fd, bool nodrm, bool save, __u32 *result);