linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: [PATCH] btrfs-progs: cleanup: avoid to use literal for getopt val
Date: Fri, 19 Dec 2014 14:31:54 +0900	[thread overview]
Message-ID: <5493B84A.6080100@jp.fujitsu.com> (raw)

From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

---
Tested with dev/integration-20141218 + this patch
---
 cmds-fi-disk_usage.c | 8 ++++----
 cmds-filesystem.c    | 8 ++++----
 utils.h              | 3 +++
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
index d81f011..5e8e39b 100644
--- a/cmds-fi-disk_usage.c
+++ b/cmds-fi-disk_usage.c
@@ -877,8 +877,8 @@ int cmd_filesystem_usage(int argc, char **argv)
 			{ "mbytes", no_argument, NULL, 'm'},
 			{ "gbytes", no_argument, NULL, 'g'},
 			{ "tbytes", no_argument, NULL, 't'},
-			{ "si", no_argument, NULL, 256},
-			{ "iec", no_argument, NULL, 257},
+			{ "si", no_argument, NULL, GETOPT_VAL_SI},
+			{ "iec", no_argument, NULL, GETOPT_VAL_IEC},
 		};
 		int c = getopt_long(argc, argv, "bhHkmgtT", long_options,
 				&long_index);
@@ -907,10 +907,10 @@ int cmd_filesystem_usage(int argc, char **argv)
 		case 'H':
 			unit_mode = UNITS_HUMAN_DECIMAL;
 			break;
-		case 256:
+		case GETOPT_VAL_SI:
 			units_set_mode(&unit_mode, UNITS_DECIMAL);
 			break;
-		case 257:
+		case GETOPT_VAL_IEC:
 			units_set_mode(&unit_mode, UNITS_BINARY);
 			break;
 		case 'T':
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 7eaccb9..8f037dd 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -216,8 +216,8 @@ static int cmd_filesystem_df(int argc, char **argv)
 			{ "mbytes", no_argument, NULL, 'm'},
 			{ "gbytes", no_argument, NULL, 'g'},
 			{ "tbytes", no_argument, NULL, 't'},
-			{ "si", no_argument, NULL, 256},
-			{ "iec", no_argument, NULL, 257},
+			{ "si", no_argument, NULL, GETOPT_VAL_SI},
+			{ "iec", no_argument, NULL, GETOPT_VAL_IEC},
 		};
 		int c = getopt_long(argc, argv, "bhHkmgt", long_options,
 					&long_index);
@@ -245,10 +245,10 @@ static int cmd_filesystem_df(int argc, char **argv)
 		case 'H':
 			unit_mode = UNITS_HUMAN_DECIMAL;
 			break;
-		case 256:
+		case GETOPT_VAL_SI:
 			units_set_mode(&unit_mode, UNITS_DECIMAL);
 			break;
-		case 257:
+		case GETOPT_VAL_IEC:
 			units_set_mode(&unit_mode, UNITS_BINARY);
 			break;
 		default:
diff --git a/utils.h b/utils.h
index 0464c2d..34fd5e4 100644
--- a/utils.h
+++ b/utils.h
@@ -40,6 +40,9 @@
 
 #define ARGV0_BUF_SIZE	PATH_MAX
 
+#define GETOPT_VAL_SI	256
+#define GETOPT_VAL_IEC	257
+
 int check_argc_exact(int nargs, int expected);
 int check_argc_min(int nargs, int expected);
 int check_argc_max(int nargs, int expected);
-- 
1.8.3.1


                 reply	other threads:[~2014-12-19  5:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5493B84A.6080100@jp.fujitsu.com \
    --to=takeuchi_satoru@jp.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).