]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
Revert "ioctl: add nvme_set_features_host_behavior2()"
authorDaniel Wagner <dwagner@suse.de>
Fri, 12 Apr 2024 10:58:34 +0000 (12:58 +0200)
committerDaniel Wagner <wagi@monom.org>
Fri, 12 Apr 2024 11:17:54 +0000 (13:17 +0200)
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 <dwagner@suse.de>
src/libnvme.map
src/nvme/ioctl.c
src/nvme/ioctl.h

index c2a23e3aa434a805a112b5a613df4952e5459eec..b3c872019de7c07dbb831547b280cd4a755092e4 100644 (file)
@@ -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 {
index d54b367ccfc024fada5f54cac83da79bd272e57a..726171e44e2679f7413e8ff1d2236a482dbd9784 100644 (file)
@@ -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);
index f35b2f21771a2d42eccedb844bf2075707a50a17..1584d5515601527846de5113c4960ed8b44ccb14 100644 (file)
@@ -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);