From c3adaa456fc0424779329411e1065268ff3d08d6 Mon Sep 17 00:00:00 2001
From: Minwoo Im <minwoo.im.dev@gmail.com>
Date: Thu, 30 Nov 2017 23:49:19 +0900
Subject: nvme-cli: replace values of all namespaces with NVME_NSID_ALL

Git-commit: 2c2175e57be39ae53537932cf070a1452528e3dc
References: bsc#1076004

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    |  8 ++++----
 memblaze-nvme.c |  2 +-
 nvme-ioctl.c    |  2 +-
 nvme.c          | 12 ++++++------
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/intel-nvme.c b/intel-nvme.c
index 8ff506c..125e30b 100644
--- a/intel-nvme.c
+++ b/intel-nvme.c
@@ -150,7 +150,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[] = {
@@ -196,7 +196,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);
@@ -256,7 +256,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);
@@ -322,7 +322,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);
diff --git a/memblaze-nvme.c b/memblaze-nvme.c
index b48a0e8..1e092db 100644
--- a/memblaze-nvme.c
+++ b/memblaze-nvme.c
@@ -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[] = {
diff --git a/nvme-ioctl.c b/nvme-ioctl.c
index d3af11e..8e7b785 100644
--- a/nvme-ioctl.c
+++ b/nvme-ioctl.c
@@ -389,7 +389,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 af0955a..ad99e07 100644
--- a/nvme.c
+++ b/nvme.c
@@ -187,7 +187,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_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",
 	};
@@ -376,7 +376,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,
 	};
@@ -1479,7 +1479,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,
@@ -1505,7 +1505,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)
@@ -1972,7 +1972,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[] = {
-- 
2.13.7

