]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
tree: Move global device info to a single struct
authorJeremy Kerr <jk@codeconstruct.com.au>
Tue, 12 Jul 2022 02:59:20 +0000 (10:59 +0800)
committerDaniel Wagner <dwagner@suse.de>
Fri, 12 Aug 2022 06:50:42 +0000 (08:50 +0200)
commitbd9af05822391753de43f0bf7ce4a45e07367aec
treef0253ffd0c16d6e4f3eba01d329eb385bfad38f0
parent93a539d5a0ec7418e3fe95c5f2bbdf4aa2a2c80a
tree: Move global device info to a single struct

Currently, we have a couple of globals that refer to the current NVMe
device: the device name, and the stat buffer:

    static struct stat nvme_stat;
    const char *devicename;

This change moves those two globals into a single global struct:

    struct nvme_dev {
            struct stat stat;
            const char *name;
    };

    extern struct nvme_dev *nvme_dev;

This will make it easier to constrain the scope of these globals in a
later change.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
14 files changed:
nvme.c
nvme.h
plugins/innogrit/innogrit-nvme.c
plugins/intel/intel-nvme.c
plugins/memblaze/memblaze-nvme.c
plugins/ocp/ocp-nvme.c
plugins/scaleflux/sfx-nvme.c
plugins/seagate/seagate-nvme.c
plugins/shannon/shannon-nvme.c
plugins/solidigm/solidigm-garbage-collection.c
plugins/solidigm/solidigm-smart.c
plugins/toshiba/toshiba-nvme.c
plugins/wdc/wdc-nvme.c
plugins/ymtc/ymtc-nvme.c