]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: Rearrange members in nvme_resv_acquire_args
authorDaniel Wagner <dwagner@suse.de>
Thu, 13 Jan 2022 17:54:43 +0000 (18:54 +0100)
committerDaniel Wagner <dwagner@suse.de>
Thu, 13 Jan 2022 17:54:43 +0000 (18:54 +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_resv_acquire_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_resv_rtype       rtype;                /*    24     4 */
        enum nvme_resv_racqa       racqa;                /*    28     4 */
        __u64                      crkey;                /*    32     8 */
        __u64                      nrkey;                /*    40     8 */
        _Bool                      iekey;                /*    48     1 */

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

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

index 81d1b1bb0a43f4ca63801f2d5a193d57f54e6bd2..24fd59decbdf7819997fa31054b4eae35ba353a3 100644 (file)
@@ -3796,28 +3796,28 @@ int nvme_copy(struct nvme_copy_args *args);
 /**
  * nvme_resv_acquire_args - Arguments for the NVMe Reservation Acquire Comand
  * @fd:                File descriptor of nvme device
+ * @result:    The command completion result from CQE dword0
+ * @timeout:   Timeout in ms
  * @nsid:      Namespace identifier
  * @rtype:     The type of reservation to be create, see &enum nvme_resv_rtype
  * @racqa:     The action that is performed by the command, see &enum nvme_resv_racqa
- * @iekey:     Set to ignore the existing key
  * @crkey:     The current reservation key associated with the host
  * @nrkey:     The reservation key to be unregistered from the namespace if
- *             the action is preempt
- * @timeout:   Timeout in ms
- * @result:    The command completion result from CQE dword0
+ *             the action is preempt
+ * @iekey:     Set to ignore the existing key
  */
 struct nvme_resv_acquire_args {
        int args_size;
        int fd;
+       __u32 *result;
+       __u32 timeout;
        __u32 nsid;
        enum nvme_resv_rtype rtype;
        enum nvme_resv_racqa racqa;
-       bool iekey;
        __u64 crkey;
        __u64 nrkey;
-       __u32 timeout;
-       __u32 *result;
-};
+       bool iekey;
+} __attribute__((packed, aligned(__alignof__(__u64))));
 
 /**
  * nvme_resv_acquire() - Send an nvme reservation acquire