]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: Rearrange members in nvme_zns_mgmt_send_args
authorDaniel Wagner <dwagner@suse.de>
Thu, 13 Jan 2022 18:04:09 +0000 (19:04 +0100)
committerDaniel Wagner <dwagner@suse.de>
Thu, 13 Jan 2022 18:04:09 +0000 (19:04 +0100)
Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_zns_mgmt_send_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u64                      slba;                 /*    24     8 */
        enum nvme_zns_send_action  zsa;                  /*    32     4 */
        __u32                      data_len;             /*    36     4 */
        void *                     data;                 /*    40     8 */
        _Bool                      select_all;           /*    48     1 */
        __u8                       zsaso;                /*    49     1 */

        /* size: 56, cachelines: 1, members: 11 */
        /* padding: 6 */
        /* last cacheline: 56 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
src/nvme/ioctl.h

index 86ef600c33fe6d76ebc5c97a5c06566676363573..91fc3c4f347137e723c5f0ed77cf8616fb9804ca 100644 (file)
@@ -3939,29 +3939,29 @@ int nvme_resv_report(struct nvme_resv_report_args *args);
 /**
  * nvme_zns_mgmt_send_args - Arguments for the NVMe ZNS Management Send command
  * @fd:                File descriptor of nvme device
+ * @result:    The command completion result from CQE dword0
+ * @timeout:   timeout in ms
  * @nsid:      Namespace ID
  * @slba:      Starting logical block address
  * @zsa:       Zone send action
- * @select_all:        Select all flag
- * @zsaso:     Zone Send Action Specific Option
  * @data_len:  Length of @data
  * @data:      Userspace address of the data
- * @timeout:   timeout in ms
- * @result:    The command completion result from CQE dword0
+ * @select_all:        Select all flag
+ * @zsaso:     Zone Send Action Specific Option
  */
 struct nvme_zns_mgmt_send_args {
        int args_size;
        int fd;
+       __u32 *result;
+       __u32 timeout;
        __u32 nsid;
        __u64 slba;
        enum nvme_zns_send_action zsa;
-       bool select_all;
-       __u8 zsaso;
        __u32 data_len;
        void *data;
-       __u32 timeout;
-       __u32 *result;
-};
+       bool select_all;
+       __u8 zsaso;
+} __attribute__((packed, aligned(__alignof__(__u64))));
 
 /**
  * nvme_zns_mgmt_send() -