]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
report zones helpers
authorKeith Busch <kbusch@kernel.org>
Fri, 5 Jun 2020 03:36:52 +0000 (20:36 -0700)
committerKeith Busch <kbusch@kernel.org>
Fri, 5 Jun 2020 03:36:52 +0000 (20:36 -0700)
Signed-off-by: Keith Busch <kbusch@kernel.org>
src/nvme/ioctl.c
src/nvme/ioctl.h

index d2bb0727e5b2cc355ec74857e25266207cde6a72..ced189b516f5da4fba7962b3fa0ceaa6a84d0ada 100644 (file)
@@ -1836,7 +1836,7 @@ int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba,
                        DW(zras_feat, NVME_ZNS_MGMT_RECV_ZRAS_FEAT);
 
        struct nvme_passthru_cmd cmd = {
-               .opcode         = nvme_zns_cmd_mgmt_send,
+               .opcode         = nvme_zns_cmd_mgmt_recv,
                .nsid           = nsid,
                .cdw10          = cdw10,
                .cdw11          = cdw11,
@@ -1849,6 +1849,22 @@ int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba,
        return nvme_submit_io_passthru(fd, &cmd, NULL);
 }
 
+int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba, bool extended,
+                         enum nvme_zns_report_options opts, bool partial,
+                         __u32 data_len, void *data)
+{
+       BUILD_ASSERT(sizeof(struct nvme_zns_desc) == 64);
+       enum nvme_zns_recv_action zra;
+
+       if (extended)
+               zra = NVME_ZNS_ZRA_EXTENDED_REPORT_ZONES;
+       else
+               zra = NVME_ZNS_ZRA_REPORT_ZONES;
+
+       return nvme_zns_mgmt_recv(fd, nsid, slba, zra, opts, partial,
+               data_len, data);
+}
+
 int nvme_zns_append(int fd, __u32 nsid, __u64 zslba, __u16 nlb, __u16 control,
                    __u32 ilbrt, __u16 lbat, __u16 lbatm, __u32 data_len,
                    void *data, __u32 metadata_len, void *metadata,
index d1ebc687119555c683b16c7541481ba6bbe90253..22edcbe2be357d70264c34097ca0a64b1ac9f8dd 100644 (file)
@@ -3077,9 +3077,27 @@ enum nvme_zns_recv_action {
 };
 
 /**
- * enum nvme_zns_recv_action_spec -
+ * nvme_zns_mgmt_recv() -
+ * @fd:                File descriptor of nvme device
+ * @nsid:      Namespace ID
+ * @slba:
+ * @zra:
+ * @zrasf:
+ * @zras_feat:
+ * @data_len:
+ * @data:
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba,
+                      enum nvme_zns_recv_action zra, __u16 zrasf,
+                      bool zras_feat, __u32 data_len, void *data);
+
+/**
+ * enum nvme_zns_report_options -
  */
-enum nvme_zns_recv_action_spec {
+enum nvme_zns_report_options {
        NVME_ZNS_ZRAS_REPORT_ALL                = 0x0,
        NVME_ZNS_ZRAS_REPORT_EMPTY              = 0x1,
        NVME_ZNS_ZRAS_REPORT_IMPL_OPENED        = 0x2,
@@ -3090,17 +3108,9 @@ enum nvme_zns_recv_action_spec {
        NVME_ZNS_ZRAS_REPORT_OFFLINE            = 0x7,
 };
 
-/**
- * nvme_zns_mgmt_recv() -
- * @fd:                File descriptor of nvme device
- * @nsid:      Namespace ID
- *
- * Return: The nvme command status if a response was received (see
- * &enum nvme_status_field) or -1 with errno set otherwise.
- */
-int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba,
-                      enum nvme_zns_recv_action zra, __u16 zrasf,
-                      bool zras_feat, __u32 data_len, void *data);
+int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba, bool extended,
+                         enum nvme_zns_report_options opts, bool partial,
+                         __u32 data_len, void *data);
 
 /**
  * nvme_zns_append() -