]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
3 years agoioctl: Rearrange members in nvme_capacity_mgmt_args
Daniel Wagner [Thu, 13 Jan 2022 14:47:05 +0000 (15:47 +0100)]
ioctl: Rearrange members in nvme_capacity_mgmt_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_capacity_mgmt_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      cdw11;                /*    20     4 */
        __u32                      cdw12;                /*    24     4 */
        __u16                      element_id;           /*    28     2 */
        __u8                       op;                   /*    30     1 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_directive_recv_args
Daniel Wagner [Thu, 13 Jan 2022 14:42:22 +0000 (15:42 +0100)]
ioctl: Rearrange members in nvme_directive_recv_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_directive_recv_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_directive_receive_doper doper;         /*    24     4 */
        enum nvme_directive_dtype  dtype;                /*    28     4 */
        __u32                      cdw12;                /*    32     4 */
        __u32                      data_len;             /*    36     4 */
        void *                     data;                 /*    40     8 */
        __u16                      dspec;                /*    48     2 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_directive_send_args
Daniel Wagner [Thu, 13 Jan 2022 14:26:01 +0000 (15:26 +0100)]
ioctl: Rearrange members in nvme_directive_send_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_directive_send_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_directive_send_doper doper;            /*    24     4 */
        enum nvme_directive_dtype  dtype;                /*    28     4 */
        __u32                      cdw12;                /*    32     4 */
        __u32                      data_len;             /*    36     4 */
        void *                     data;                 /*    40     8 */
        __u16                      dspec;                /*    48     2 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_get_lba_status_args
Daniel Wagner [Thu, 13 Jan 2022 14:23:02 +0000 (15:23 +0100)]
ioctl: Rearrange members in nvme_get_lba_status_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_get_lba_status_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u32                      mndw;                 /*    24     4 */
        enum nvme_lba_status_atype atype;                /*    28     4 */
        __u64                      slba;                 /*    32     8 */
        struct nvme_lba_status *   lbas;                 /*    40     8 */
        __u16                      rl;                   /*    48     2 */

        /* size: 50, cachelines: 1, members: 10 */
        /* last cacheline: 50 bytes */
} __attribute__((__packed__));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_security_receive_args
Daniel Wagner [Thu, 13 Jan 2022 14:20:34 +0000 (15:20 +0100)]
ioctl: Rearrange members in nvme_security_receive_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_security_receive_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u8                       nssf;                 /*    24     1 */
        __u8                       spsp0;                /*    25     1 */
        __u8                       spsp1;                /*    26     1 */
        __u8                       secp;                 /*    27     1 */
        __u32                      al;                   /*    28     4 */
        void *                     data;                 /*    32     8 */
        __u32                      data_len;             /*    40     4 */

        /* size: 48, cachelines: 1, members: 12 */
        /* padding: 4 */
        /* last cacheline: 48 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_security_send_args
Daniel Wagner [Thu, 13 Jan 2022 14:16:54 +0000 (15:16 +0100)]
ioctl: Rearrange members in nvme_security_send_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_security_send_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u8                       nssf;                 /*    24     1 */
        __u8                       spsp0;                /*    25     1 */
        __u8                       spsp1;                /*    26     1 */
        __u8                       secp;                 /*    27     1 */
        __u32                      tl;                   /*    28     4 */
        void *                     data;                 /*    32     8 */
        __u32                      data_len;             /*    40     4 */

        /* size: 48, cachelines: 1, members: 12 */
        /* padding: 4 */
        /* last cacheline: 48 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_fw_commit_args
Daniel Wagner [Thu, 13 Jan 2022 14:15:54 +0000 (15:15 +0100)]
ioctl: Rearrange members in nvme_fw_commit_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_fw_commit_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        enum nvme_fw_commit_ca     action;               /*    20     4 */
        __u8                       slot;                 /*    24     1 */
        _Bool                      bpid;                 /*    25     1 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_fw_download_args
Daniel Wagner [Thu, 13 Jan 2022 14:09:09 +0000 (15:09 +0100)]
ioctl: Rearrange members in nvme_fw_download_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_fw_download_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      offset;               /*    20     4 */
        void *                     data;                 /*    24     8 */
        __u32                      data_len;             /*    32     4 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_ns_attach_args
Daniel Wagner [Thu, 13 Jan 2022 14:07:09 +0000 (15:07 +0100)]
ioctl: Rearrange members in nvme_ns_attach_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_ns_attach_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        struct nvme_ctrl_list *    ctrlist;              /*    24     8 */
        enum nvme_ns_attach_sel    sel;                  /*    32     4 */

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

While at it also introduce the result member.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_ns_mgmt_args
Daniel Wagner [Thu, 13 Jan 2022 14:04:53 +0000 (15:04 +0100)]
ioctl: Rearrange members in nvme_ns_mgmt_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_ns_mgmt_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        struct nvme_id_ns *        ns;                   /*    24     8 */
        enum nvme_ns_mgmt_sel      sel;                  /*    32     4 */
        __u8                       csi;                  /*    36     1 */

        /* size: 40, cachelines: 1, members: 8 */
        /* padding: 3 */
        /* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_format_nvm_args
Daniel Wagner [Thu, 13 Jan 2022 14:03:11 +0000 (15:03 +0100)]
ioctl: Rearrange members in nvme_format_nvm_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_format_nvm_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_cmd_format_mset  mset;                 /*    24     4 */
        enum nvme_cmd_format_pi    pi;                   /*    28     4 */
        enum nvme_cmd_format_pil   pil;                  /*    32     4 */
        enum nvme_cmd_format_ses   ses;                  /*    36     4 */
        __u8                       lbaf;                 /*    40     1 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_get_features_args
Daniel Wagner [Thu, 13 Jan 2022 14:01:08 +0000 (15:01 +0100)]
ioctl: Rearrange members in nvme_get_features_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_get_features_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_get_features_sel sel;                  /*    24     4 */
        __u32                      cdw11;                /*    28     4 */
        __u32                      data_len;             /*    32     4 */
        void *                     data;                 /*    36     8 */
        __u8                       fid;                  /*    44     1 */
        __u8                       uuidx;                /*    45     1 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_set_features_args
Daniel Wagner [Thu, 13 Jan 2022 13:48:26 +0000 (14:48 +0100)]
ioctl: Rearrange members in nvme_set_features_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_set_features_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u32                      cdw11;                /*    24     4 */
        __u32                      cdw12;                /*    28     4 */
        __u32                      cdw15;                /*    32     4 */
        __u32                      data_len;             /*    36     4 */
        void *                     data;                 /*    40     8 */
        _Bool                      save;                 /*    48     1 */
        __u8                       uuidx;                /*    49     1 */
        __u8                       fid;                  /*    50     1 */

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

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_get_log_args
Daniel Wagner [Thu, 13 Jan 2022 13:43:31 +0000 (14:43 +0100)]
ioctl: Rearrange members in nvme_get_log_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_get_log_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        enum nvme_cmd_get_log_lid  lid;                  /*    20     4 */
        __u64                      lpo;                  /*    24     8 */
        void *                     log;                  /*    32     8 */
        __u32                      len;                  /*    40     4 */
        __u32                      nsid;                 /*    44     4 */
        enum nvme_csi              csi;                  /*    48     4 */
        __u16                      lsi;                  /*    52     2 */
        __u8                       lsp;                  /*    54     1 */
        __u8                       uuidx;                /*    55     1 */
        _Bool                      rae;                  /*    56     1 */
        _Bool                      ot;                   /*    57     1 */

        /* size: 64, cachelines: 1, members: 15 */
        /* padding: 6 */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_identify_args
Daniel Wagner [Thu, 13 Jan 2022 13:19:16 +0000 (14:19 +0100)]
ioctl: Rearrange members in nvme_identify_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_identify_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        enum nvme_identify_cns     cns;                  /*    20     4 */
        void *                     data;                 /*    24     8 */
        enum nvme_csi              csi;                  /*    32     4 */
        __u32                      nsid;                 /*    36     4 */
        __u16                      cntid;                /*    40     2 */
        __u16                      nvmsetid;             /*    42     2 */
        __u16                      domid;                /*    44     2 */
        __u8                       uuidx;                /*    46     1 */

        /* size: 48, cachelines: 1, members: 12 */
        /* padding: 1 */
        /* last cacheline: 48 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Remove declration of nvme_set_features_iocs_profile()
Daniel Wagner [Thu, 13 Jan 2022 13:56:34 +0000 (14:56 +0100)]
ioctl: Remove declration of nvme_set_features_iocs_profile()

There is no implemenation for this function. Remove it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #150 from hreinecke/api-rework
Daniel Wagner [Tue, 11 Jan 2022 14:23:06 +0000 (15:23 +0100)]
Merge pull request #150 from hreinecke/api-rework

Rework the libnvme ioctl API

3 years agolibnvme.map: Export nvme_io
Daniel Wagner [Tue, 11 Jan 2022 13:18:39 +0000 (14:18 +0100)]
libnvme.map: Export nvme_io

Add missing export.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoInline nvme_flush()
Hannes Reinecke [Fri, 17 Dec 2021 11:49:18 +0000 (12:49 +0100)]
Inline nvme_flush()

nvme_flush() is a trivial wrapper around nvme_submit_io_passthru(),
so inline it instead of carrying a function in the library.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_zns_append()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_zns_append()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_zns_mgmt_send() and nvme_zns_mgmt_recv()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_zns_mgmt_send() and nvme_zns_mgmt_recv()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Also convert zns.c to use nvme_zns_report_zones() instead of calling
nvme_zns_mgmt_recv() directly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for NVMe reservation commands
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for NVMe reservation commands

Use an argument structure for NVMe reservation commands like
nvme_resv_acquire() or nvme_resv_release() instead of passing all
arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_copy()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_copy()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_dsm()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_dsm()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for NVMe I/O commands
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for NVMe I/O commands

Use an argument structure for NVMe I/O commands like nvme_read() or
nvme_write() instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_virtual_mgmt()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_virtual_mgmt()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_dev_self_test()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_dev_self_test()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_sanize_nvm()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_sanize_nvm()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_set_property() and nvme_get_property()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_set_property() and nvme_get_property()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_lockdown()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_lockdown()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_capacity_mgmt()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_capacity_mgmt()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_directive_send() and nvme_directive_receive()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_directive_send() and nvme_directive_receive()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_get_lba_status()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_get_lba_status()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_security_send() and nvme_security_receive()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_security_send() and nvme_security_receive()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_fw_commit()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_fw_commit()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_fw_download()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_fw_download()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_format_nvm() and nvme_ns_mgmt()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_format_nvm() and nvme_ns_mgmt()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoInline nvme_identify() wrapper functions
Hannes Reinecke [Fri, 17 Dec 2021 12:43:19 +0000 (13:43 +0100)]
Inline nvme_identify() wrapper functions

No point in having wrapper functions as part of the libnvme library.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_identify()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_identify()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_set_features() and nvme_get_features()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_set_features() and nvme_get_features()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Also convert zns.c to use nvme_zns_report_zones() instead of calling
nvme_zns_mgmt_recv() directly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoInline nvme_get_log() wrapper functions
Hannes Reinecke [Fri, 17 Dec 2021 12:43:19 +0000 (13:43 +0100)]
Inline nvme_get_log() wrapper functions

No point in having wrapper functions as part of the libnvme library.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoUse argument structure for nvme_get_log()
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_get_log()

Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #167 from martin-belanger/fix-the-docs
Daniel Wagner [Mon, 10 Jan 2022 13:36:31 +0000 (14:36 +0100)]
Merge pull request #167 from martin-belanger/fix-the-docs

Fix error building the man pages

3 years agofix error building the man pages
Martin Belanger [Mon, 10 Jan 2022 13:23:59 +0000 (08:23 -0500)]
fix error building the man pages

3 years agobuild: Remove more in tree build artifacts
Daniel Wagner [Fri, 7 Jan 2022 15:57:10 +0000 (16:57 +0100)]
build: Remove more in tree build artifacts

meson doesn't do any in tree builds. Remove the old Makefile generated
config files from gitignore.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Fix *.wrap exclude pattern in .gitignore
Daniel Wagner [Fri, 7 Jan 2022 15:53:50 +0000 (16:53 +0100)]
build: Fix *.wrap exclude pattern in .gitignore

The current rules trigger git to to complain with

 $ git add subprojects/openssl.wrap
 The following paths are ignored by one of your .gitignore files:
 subprojects

We need to keep the parent directory in the tracking domain and just
filter out all sub directories and files except the wrap files.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #163 from igaw/build-check-python-devel
Daniel Wagner [Fri, 7 Jan 2022 14:06:37 +0000 (15:06 +0100)]
Merge pull request #163 from igaw/build-check-python-devel

build: Detect if Python.h header is present

3 years agobuild: Detect if Python.h header is present
Daniel Wagner [Fri, 7 Jan 2022 11:41:33 +0000 (12:41 +0100)]
build: Detect if Python.h header is present

Make sure the devel package is also installed not just the the Python
interpreter.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Remove in-tree config files from gitignore
Daniel Wagner [Fri, 7 Jan 2022 13:29:50 +0000 (14:29 +0100)]
build: Remove in-tree config files from gitignore

meson doesn't do any in tree builds. Remove the old Makefile generated
config files from gitignore.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #151 from igaw/logical-block-size
Daniel Wagner [Fri, 7 Jan 2022 13:06:23 +0000 (14:06 +0100)]
Merge pull request #151 from igaw/logical-block-size

linux: Add nvme_get_logical_block_size()

3 years agoMerge pull request #158 from igaw/nvme_gen_dhchap_key
Daniel Wagner [Fri, 7 Jan 2022 13:06:03 +0000 (14:06 +0100)]
Merge pull request #158 from igaw/nvme_gen_dhchap_key

linux: Add support to generate DH-HMAC-CHAP keys

3 years agolinux: Add support to generate DH-HMAC-CHAP keys
Daniel Wagner [Thu, 23 Dec 2021 13:59:01 +0000 (14:59 +0100)]
linux: Add support to generate DH-HMAC-CHAP keys

Initially the DH-HMAC-CHAP key generation code was part of the
nvme-cli repository and depended on OpenSSL 1. Move the key generation
code into the library. While at it also add support for OpenSSL 3.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agolinux: Add nvme_get_logical_block_size()
Daniel Wagner [Mon, 20 Dec 2021 15:28:03 +0000 (16:28 +0100)]
linux: Add nvme_get_logical_block_size()

Add helper to retrieve logical block size using nvme_identify_ns().

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #162 from igaw/build-cleanup-makefile-drop
Daniel Wagner [Fri, 7 Jan 2022 10:26:17 +0000 (11:26 +0100)]
Merge pull request #162 from igaw/build-cleanup-makefile-drop

build: Remove unused configurator

3 years agobuild: Remove unused configurator
Daniel Wagner [Fri, 7 Jan 2022 10:20:16 +0000 (11:20 +0100)]
build: Remove unused configurator

The configurator tool was used for the Makefile based build. Not
needed for meson builds. Remove it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #155 from martin-belanger/replace-make-by-meson
Daniel Wagner [Fri, 7 Jan 2022 09:55:08 +0000 (10:55 +0100)]
Merge pull request #155 from martin-belanger/replace-make-by-meson

Replace make by meson

3 years agoMerge pull request #159 from igaw/build-cleanups
Daniel Wagner [Wed, 29 Dec 2021 07:55:10 +0000 (08:55 +0100)]
Merge pull request #159 from igaw/build-cleanups

Build cleanups

3 years agobuild: Set C dialect and warning level
Daniel Wagner [Mon, 27 Dec 2021 15:09:04 +0000 (16:09 +0100)]
build: Set C dialect and warning level

Currently, the Makefile is not setting the C dialect but the code was
carved out from the nvme-cli code base which relies on gnu99.
Let's define the C dialect to avoid any confusion and make the build
more consistent.

Without defining the default warning level the build system will use
the default level, which is implementation depended.  For example muon
sets it to 3 which includes '-Wpendantic'.  This results in a lot of
ISO-C non compliant warnings.

Let's define the warning level so that all build systems are using the
same values.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Use _dep postfix for all dependency objects
Daniel Wagner [Thu, 23 Dec 2021 13:51:35 +0000 (14:51 +0100)]
build: Use _dep postfix for all dependency objects

Use consistently _dep postfix for all dependency objects.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Avoid including wrong config.h as subpackage
Daniel Wagner [Thu, 23 Dec 2021 15:38:04 +0000 (16:38 +0100)]
build: Avoid including wrong config.h as subpackage

In case the consuming project also uses a config.h we need to hide our
config.h file. By using the path to our config.h we avoid this
confusion. Obviously, 'src' is a bit too generic, thus move the
generated config.h under libnvme.

Introduce also a private include path because ccan has '#include
"config.h"' in its sources. So we need to present a config.h in the
lookup path but it needs to be the one from this project and not the
one from the consuming project.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agolib: Resort libnvme.map
Daniel Wagner [Thu, 23 Dec 2021 14:03:49 +0000 (15:03 +0100)]
lib: Resort libnvme.map

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #156 from igaw/build-static-inline
Daniel Wagner [Thu, 23 Dec 2021 09:58:56 +0000 (10:58 +0100)]
Merge pull request #156 from igaw/build-static-inline

util: Define inline function as static inline

3 years agoutil: Define inline function as static inline
Daniel Wagner [Wed, 22 Dec 2021 07:34:03 +0000 (08:34 +0100)]
util: Define inline function as static inline

The gcc in Centos 6.10 complains with

  src/nvme/util.h:120: multiple definition of `nvme_feature_decode_arbitration'

'inline' alone does not guarantee that the function gets inlined. The
compiler is still free to decide, thus in this case it doesn't inline
and that's why we having multiple implementation with the same
name (in different compile units). 'static inline' forces the inline
which was the indent of this code.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoReplacing make by meson.
Martin Belanger [Tue, 21 Dec 2021 20:36:38 +0000 (15:36 -0500)]
Replacing make by meson.

This involves replacing all Makefiles by meson.build files.
Also the top-level configure script now simply invokes meson.
The top-level Makefile is just a wrapper for meson. It supports
the following operations:

make
make test
make install
make clean    # Remove build artifacts but keep configuration
make purge    # Remove build artifacts and configuration

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #153 from igaw/build-fix-fabrics
Daniel Wagner [Wed, 22 Dec 2021 07:22:14 +0000 (08:22 +0100)]
Merge pull request #153 from igaw/build-fix-fabrics

fabrics: Declare loop index at the beginning of the block

3 years agofabrics: Declare loop index at the beginning of the block
Daniel Wagner [Tue, 21 Dec 2021 14:56:14 +0000 (15:56 +0100)]
fabrics: Declare loop index at the beginning of the block

The gcc in Centos 6.10 complains with

nvme/fabrics.c:909: error: ‘for’ loop initial declarations are only allowed in C99 mode
nvme/fabrics.c:909: note: use option -std=c99 or -std=gnu99 to compileyour code

Let's declare the index at the beginning of the basic block.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #152 from hreinecke/tsas
Hannes Reinecke [Tue, 21 Dec 2021 07:58:06 +0000 (08:58 +0100)]
Merge pull request #152 from hreinecke/tsas

Decode TLS1.3 transport security

3 years agoDecode TLS1.3 transport security
Hannes Reinecke [Tue, 21 Dec 2021 07:55:15 +0000 (08:55 +0100)]
Decode TLS1.3 transport security

Add the definition for TLS1.3 in the transport security attribute
settings (tsas) field.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #146 from igaw/add-ctrl-metadata-and-ns-metadata
Daniel Wagner [Fri, 17 Dec 2021 16:42:25 +0000 (17:42 +0100)]
Merge pull request #146 from igaw/add-ctrl-metadata-and-ns-metadata

types: Add Controller Metadata and Namespace Metadata

3 years agoMerge pull request #147 from sc108-lee/add/gitignore
Daniel Wagner [Thu, 16 Dec 2021 08:20:22 +0000 (09:20 +0100)]
Merge pull request #147 from sc108-lee/add/gitignore

build: Add subpackages contents to .gitignore

3 years agobuild: Add subpackages contents to .gitignore
Steven Seungcheol Lee [Thu, 16 Dec 2021 05:58:09 +0000 (14:58 +0900)]
build: Add subpackages contents to .gitignore

we just need to maintain .wrap files for dependencies

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agotypes: Add Controller Metadata and Namespace Metadata
Daniel Wagner [Mon, 13 Dec 2021 17:37:21 +0000 (02:37 +0900)]
types: Add Controller Metadata and Namespace Metadata

Port and extent the libnvme part from the commit "Add NVMe MI
Features: Controller Metadata (0x7E) and Namespace Metadata (0x7F)."
from the nvme-cli monolithic branch.

While at it add the missing definitions and add some documentation.

This is based on Tokunori Ikegami first port attempt.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #144 from igaw/add_get_log_page_fields_2.0
Daniel Wagner [Wed, 15 Dec 2021 13:35:40 +0000 (14:35 +0100)]
Merge pull request #144 from igaw/add_get_log_page_fields_2.0

ioctl: Add Offset Type to get_log_page()

3 years agoioctl: Add Offset Type to get_log_page()
Daniel Wagner [Fri, 10 Dec 2021 16:33:49 +0000 (17:33 +0100)]
ioctl: Add Offset Type to get_log_page()

Port of the "add get log page 2.0 spec fields" patch.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: Add documentation to enum nvme_csi
Daniel Wagner [Mon, 13 Dec 2021 13:23:07 +0000 (14:23 +0100)]
types: Add documentation to enum nvme_csi

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge branch 'pel_header_fix'
Daniel Wagner [Fri, 10 Dec 2021 14:47:47 +0000 (15:47 +0100)]
Merge branch 'pel_header_fix'

3 years agolibnvme: Add new events support in PEL
Wen Xiong [Wed, 1 Dec 2021 22:15:50 +0000 (17:15 -0500)]
libnvme: Add new events support in PEL

Add two new events support in header file.

Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
3 years agoMerge pull request #143 from sc108-lee/tp4076
Daniel Wagner [Fri, 10 Dec 2021 12:46:02 +0000 (13:46 +0100)]
Merge pull request #143 from sc108-lee/tp4076

zns: Add support for zone random write area (zrwa)

3 years agozns: Add support for zone random write area (zrwa)
Steven Seungcheol Lee [Wed, 8 Dec 2021 03:49:14 +0000 (12:49 +0900)]
zns: Add support for zone random write area (zrwa)

NVMe - TP 4076 Zoned Random Write Area 2021.08.23 - Ratified

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Co-authored-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoMerge pull request #141 from igaw/ccan-debug-build
Daniel Wagner [Thu, 9 Dec 2021 12:30:07 +0000 (13:30 +0100)]
Merge pull request #141 from igaw/ccan-debug-build

build: Enable ccan debug code for debug build

3 years agoMerge pull request #142 from sc108-lee/add_map
Daniel Wagner [Thu, 9 Dec 2021 12:29:40 +0000 (13:29 +0100)]
Merge pull request #142 from sc108-lee/add_map

Add missing function(nvme_get_log_zns_changed_zones) to map file

3 years agoAdd missing function(nvme_get_log_zns_changed_zones) to map file
Steven Seungcheol Lee [Thu, 9 Dec 2021 11:17:09 +0000 (20:17 +0900)]
Add missing function(nvme_get_log_zns_changed_zones) to map file

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agoMerge pull request #138 from tbzatek/fabrics-fixes-3
Daniel Wagner [Thu, 9 Dec 2021 10:54:58 +0000 (11:54 +0100)]
Merge pull request #138 from tbzatek/fabrics-fixes-3

Misc. fabrics fixes

3 years agoMerge pull request #137 from tbzatek/fabrics-fixes-2
Daniel Wagner [Thu, 9 Dec 2021 10:51:57 +0000 (11:51 +0100)]
Merge pull request #137 from tbzatek/fabrics-fixes-2

types: Fabrics doc strings updates

3 years agobuild: Enable ccan debug code for debug build
Daniel Wagner [Thu, 9 Dec 2021 10:37:20 +0000 (11:37 +0100)]
build: Enable ccan debug code for debug build

The ccan library has support debugging, let's enable this when
building the debug version of the library.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #129 from martin-belanger/document-sanitize-address
Daniel Wagner [Thu, 9 Dec 2021 10:09:21 +0000 (11:09 +0100)]
Merge pull request #129 from martin-belanger/document-sanitize-address

Document meson build options

3 years agoMerge pull request #130 from sc108-lee/remove/unused_doc
Daniel Wagner [Thu, 9 Dec 2021 10:06:56 +0000 (11:06 +0100)]
Merge pull request #130 from sc108-lee/remove/unused_doc

doc: There is no nvme_host_mem_buf_desc in source files

3 years agoMerge pull request #131 from sc108-lee/fix/json-c
Daniel Wagner [Thu, 9 Dec 2021 10:05:01 +0000 (11:05 +0100)]
Merge pull request #131 from sc108-lee/fix/json-c

Add libjson version check on configure to fix build error

3 years agotree: Handle NULL hostid in nvme_lookup_host()
Tomas Bzatek [Wed, 1 Dec 2021 17:15:59 +0000 (18:15 +0100)]
tree: Handle NULL hostid in nvme_lookup_host()

When hostid is specified for lookup and some of the tree
host records carry a NULL, avoid a segfault here on strcmp().

3 years agofabrics: Don't include trailing newline in nvmf_hostnqn_generate()
Tomas Bzatek [Wed, 1 Dec 2021 16:38:12 +0000 (17:38 +0100)]
fabrics: Don't include trailing newline in nvmf_hostnqn_generate()

The generated string is directly used in nvme_lookup_host() and
might cause mismatches due to the inclusion of a trailing newline.

3 years agotypes: Fabrics doc strings updates
Tomas Bzatek [Wed, 1 Dec 2021 15:41:53 +0000 (16:41 +0100)]
types: Fabrics doc strings updates

Includes a typo correction, prefix changes, transition away from anonymous
enums and added some more enum members according to the standard.
All subtle API breaks.

3 years agoMerge pull request #136 from martin-belanger/memleak-swig-module
Hannes Reinecke [Wed, 1 Dec 2021 07:01:46 +0000 (08:01 +0100)]
Merge pull request #136 from martin-belanger/memleak-swig-module

Fix memory leak in SWIG module

3 years agoFix memory leak.
Martin Belanger [Tue, 30 Nov 2021 19:50:29 +0000 (14:50 -0500)]
Fix memory leak.

The API PyDict_SetItemString() does not steal references
when adding objects to a dictionary. Therefore, the caller
must decrement the reference count after adding objects to
the dictionary if those objects are no longer needed.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #133 from sc108-lee/update-id-ctrl
Hannes Reinecke [Mon, 29 Nov 2021 07:25:47 +0000 (08:25 +0100)]
Merge pull request #133 from sc108-lee/update-id-ctrl

recover monolithic commit 782086cc4fd590f1df171c927ebf9a2debc0a052

3 years agoMerge pull request #134 from hreinecke/discovery-fix
Hannes Reinecke [Mon, 29 Nov 2021 06:47:40 +0000 (07:47 +0100)]
Merge pull request #134 from hreinecke/discovery-fix

fabrics: fix endless loop in connect-all for NVME_NQN_CURR

3 years agofabrics: fix endless loop in connect-all for NVME_NQN_CURR
Sagi Grimberg [Sun, 28 Nov 2021 13:03:03 +0000 (15:03 +0200)]
fabrics: fix endless loop in connect-all for NVME_NQN_CURR

For a discovery log page entry that indicates the discovery controller
that returned it (i.e. itself), we need to set the controller as
discovered (because we got the discovery log page by connecting to it).

Without this connect-all goes in an endless loop keep connecting and
retrieving the log page from the same discovery subsystem port.

Fixes: 06a8f001d314 ("tree,fabrics: detect discovery loops")
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
3 years agodoc: Add ocfs explaination
Steven Seungcheol Lee [Wed, 24 Nov 2021 09:51:16 +0000 (18:51 +0900)]
doc: Add ocfs explaination

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agonvme: add optional copy format support id ctrl field
Gollu Appalanaidu [Fri, 28 May 2021 05:10:40 +0000 (10:40 +0530)]
nvme: add optional copy format support id ctrl field

Add the OCFS field in Identify Controller Structure, as per the
Ratified TP 4065b (Simple Copy Command).

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
3 years agoMerge pull request #132 from hreinecke/loop-fix
Hannes Reinecke [Mon, 22 Nov 2021 16:42:30 +0000 (17:42 +0100)]
Merge pull request #132 from hreinecke/loop-fix

tree: fixup loop address handling

3 years agotree: fixup loop address handling
Hannes Reinecke [Mon, 22 Nov 2021 16:35:36 +0000 (17:35 +0100)]
tree: fixup loop address handling

'loop' controllers have an empty 'address' sysfs attribute, so we
need to check for loop to avoid failures due to an invalid controller
address.

Signed-off-by: Hannes Reinecke <hare@suse.de>