]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: replace values of all namespaces with NVME_NSID_ALL
authorMinwoo Im <minwoo.im.dev@gmail.com>
Thu, 30 Nov 2017 14:49:19 +0000 (23:49 +0900)
committerKeith Busch <keith.busch@intel.com>
Thu, 30 Nov 2017 21:38:32 +0000 (14:38 -0700)
Replace all magic numbers(0xffffffff) which means all namespaces
with NVME_NSID_ALL applied by a commit
c5a1120("nvme-cli: resync nvme.h with the kernel's").

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
intel-nvme.c
memblaze-nvme.c
nvme-ioctl.c
nvme.c

index 5b854c0b5706dd2ea8de16ab8402f6a78700a694..a2d12d91ae0de91409dd8e596b9cb9a0cdd2675f 100644 (file)
@@ -241,7 +241,7 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
        };
 
        struct config cfg = {
-               .namespace_id = 0xffffffff,
+               .namespace_id = NVME_NSID_ALL,
        };
 
        const struct argconfig_commandline_options command_line_options[] = {
@@ -290,7 +290,7 @@ static int get_market_log(int argc, char **argv, struct command *cmd, struct plu
 
        fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
 
-       err = nvme_get_log(fd, 0xffffffff, 0xdd, sizeof(log), log);
+       err = nvme_get_log(fd, NVME_NSID_ALL, 0xdd, sizeof(log), log);
        if (!err) {
                if (!cfg.raw_binary)
                        printf("Intel Marketing Name Log:\n%s\n", log);
@@ -350,7 +350,7 @@ static int get_temp_stats_log(int argc, char **argv, struct command *cmd, struct
 
        fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
 
-       err = nvme_get_log(fd, 0xffffffff, 0xc5, sizeof(stats), &stats);
+       err = nvme_get_log(fd, NVME_NSID_ALL, 0xc5, sizeof(stats), &stats);
        if (!err) {
                if (!cfg.raw_binary)
                        show_temp_stats(&stats);
@@ -416,7 +416,7 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct
 
        fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
 
-       err = nvme_get_log(fd, 0xffffffff, cfg.write ? 0xc2 : 0xc1, sizeof(stats), &stats);
+       err = nvme_get_log(fd, NVME_NSID_ALL, cfg.write ? 0xc2 : 0xc1, sizeof(stats), &stats);
        if (!err) {
                if (!cfg.raw_binary)
                        show_lat_stats(&stats, cfg.write);
index b48a0e837e681039f2772c0d9ca48cbdfddb4309..1e092db2027982f148a5cbb82b1c6c1ae11d964b 100644 (file)
@@ -212,7 +212,7 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
        };
 
        struct config cfg = {
-               .namespace_id = 0xffffffff,
+               .namespace_id = NVME_NSID_ALL,
        };
 
        const struct argconfig_commandline_options command_line_options[] = {
index 1843faf7d110ec07687ad70d73ce71cb0bdb5a1f..4948c87a08ba58e5a7cbd83bd4fb9956922f8295 100644 (file)
@@ -400,7 +400,7 @@ int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data)
 
 int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log)
 {
-       return nvme_get_log(fd, 0xffffffff, NVME_LOG_FW_SLOT, sizeof(*fw_log), fw_log);
+       return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_FW_SLOT, sizeof(*fw_log), fw_log);
 }
 
 int nvme_error_log(int fd, __u32 nsid, int entries,
diff --git a/nvme.c b/nvme.c
index 35b10a791eee8a80f58e1bb2d7c4f90832c92085..9f0b8e2fca51879073fcccf2edcc99240352755d 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -185,7 +185,7 @@ static int get_smart_log(int argc, char **argv, struct command *cmd, struct plug
        };
 
        struct config cfg = {
-               .namespace_id = 0xffffffff,
+               .namespace_id = NVME_NSID_ALL,
                .output_format = "normal",
        };
 
@@ -244,7 +244,7 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl
        if (fd < 0)
                return fd;
 
-       err = nvme_get_log(fd, 0xffffffff, 5, 4096, &effects);
+       err = nvme_get_log(fd, NVME_NSID_ALL, 5, 4096, &effects);
        if (!err)
                show_effects_log(&effects);
        else if (err > 0)
@@ -274,7 +274,7 @@ static int get_error_log(int argc, char **argv, struct command *cmd, struct plug
        };
 
        struct config cfg = {
-               .namespace_id = 0xffffffff,
+               .namespace_id = NVME_NSID_ALL,
                .log_entries  = 64,
                .output_format = "normal",
        };
@@ -408,7 +408,7 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl
        };
 
        struct config cfg = {
-               .namespace_id = 0xffffffff,
+               .namespace_id = NVME_NSID_ALL,
                .log_id       = 0,
                .log_len      = 0,
        };
@@ -1720,7 +1720,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
        };
 
        struct config cfg = {
-               .namespace_id = 0xffffffff,
+               .namespace_id = NVME_NSID_ALL,
                .timeout      = 600000,
                .lbaf         = 0xff,
                .ses          = 0,
@@ -1746,7 +1746,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
 
        if (S_ISBLK(nvme_stat.st_mode))
                cfg.namespace_id = get_nsid(fd);
-       if (cfg.namespace_id != 0xffffffff) {
+       if (cfg.namespace_id != NVME_NSID_ALL) {
                err = nvme_identify_ns(fd, cfg.namespace_id, 0, &ns);
                if (err) {
                        if (err < 0)
@@ -2360,7 +2360,7 @@ static int flush(int argc, char **argv, struct command *cmd, struct plugin *plug
        };
 
        struct config cfg = {
-               .namespace_id = 0xffffffff,
+               .namespace_id = NVME_NSID_ALL,
        };
 
        const struct argconfig_commandline_options command_line_options[] = {