This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: STABLE3 - gfs2-utils: Clean up leftover prog_name globals


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=15258fc72f6c13531acbf7ebfb7420171d1775f0
Commit:        15258fc72f6c13531acbf7ebfb7420171d1775f0
Parent:        9315b8c66ea39b439ef97ec912d6390b39bc0932
Author:        Andrew Price <andy@andrewprice.me.uk>
AuthorDate:    Thu May 28 21:55:56 2009 +0100
Committer:     Andrew Price <andy@andrewprice.me.uk>
CommitterDate: Fri May 29 08:40:47 2009 +0100

gfs2-utils: Clean up leftover prog_name globals

Since commit a37669 "libgfs2: Move prog_name out of the library" libgfs2
no longer requires an external prog_name in each tool which uses it.
This patch rids prog_name from those tools which still provide it.
---
 gfs2/convert/gfs2_convert.c |    1 -
 gfs2/edit/hexedit.h         |    1 -
 gfs2/fsck/main.c            |    1 -
 gfs2/mkfs/gfs2_mkfs.h       |    2 --
 gfs2/mkfs/main.c            |    5 +----
 gfs2/mkfs/main_jadd.c       |    6 +++---
 gfs2/mkfs/main_mkfs.c       |   10 ++++------
 gfs2/mount/mount.gfs2.c     |    9 +++------
 gfs2/mount/mtab.c           |    1 -
 gfs2/mount/util.c           |    1 -
 gfs2/mount/util.h           |    5 ++---
 gfs2/quota/gfs2_quota.h     |    2 --
 gfs2/quota/main.c           |   10 +++-------
 gfs2/tool/gfs2_tool.h       |    1 -
 gfs2/tool/main.c            |    3 ---
 group/gfs_control/main.c    |   10 ++++------
 16 files changed, 20 insertions(+), 48 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index b7c84e3..2f47f94 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -131,7 +131,6 @@ int seconds;
 struct timeval tv;
 uint64_t dirs_fixed;
 uint64_t dirents_fixed;
-const char *prog_name = "gfs2_convert"; /* needed by libgfs2 */
 struct gfs1_jindex *sd_jindex = NULL;    /* gfs1 journal index in memory */
 int gfs2_inptrs;
 uint64_t gfs2_heightsize[GFS2_MAX_META_HEIGHT];
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 6977edf..11d4aa3 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -42,7 +42,6 @@ enum dsp_mode { HEX_MODE = 0, GFS2_MODE = 1, EXTENDED_MODE = 2 };
 #define GFS_LOG_DESC_Q          (402)    /* quota */
 #define GFS_LOG_DESC_LAST       (500)    /* final in a logged transaction */
 
-extern char *prog_name;
 extern uint64_t block;
 extern int blockhist;
 extern int edit_mode;
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index c85e6de..5cef826 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -26,7 +26,6 @@ int errors_found = 0, errors_corrected = 0;
 const char *pass = "";
 uint64_t last_data_block;
 uint64_t first_data_block;
-const char *prog_name = "gfs2_fsck"; /* needed by libgfs2 */
 
 /* This function is for libgfs2's sake.                                      */
 void print_it(const char *label, const char *fmt, const char *fmt2, ...)
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index a058b79..14bf4f6 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -64,6 +64,4 @@ void main_shrink(int argc, char *argv[]);
 #define FS_FL_USER_VISIBLE              0x0003DFFF /* User visible flags */
 #define FS_FL_USER_MODIFIABLE           0x000380FF /* User modifiable flags */
 
-extern char *prog_name;
-
 #endif /* __GFS2_MKFS_DOT_H__ */
diff --git a/gfs2/mkfs/main.c b/gfs2/mkfs/main.c
index 1e9d225..d1ad9ad 100644
--- a/gfs2/mkfs/main.c
+++ b/gfs2/mkfs/main.c
@@ -17,8 +17,6 @@
 #include "libgfs2.h"
 #include "gfs2_mkfs.h"
 
-char *prog_name;
-
 /**
  * main - do everything
  * @argc:
@@ -35,10 +33,9 @@ main(int argc, char *argv[])
 	setlocale(LC_ALL, "");
 	textdomain("mkfs.gfs2");
 
-	prog_name = argv[0];
 	srandom(time(NULL) ^ getpid());
 
-	p = strdup(prog_name);
+	p = strdup(argv[0]);
 	whoami = basename(p);
 	
 	if (!strcmp(whoami, "gfs2_jadd"))
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index e2dc4d0..13107e2 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -61,10 +61,10 @@ int rename2system(struct gfs2_sbd *sdp, const char *new_dir, const char *new_nam
 
 /**
  * print_usage - print out usage information
- *
+ * @prog_name: The name of this program
  */
 
-static void print_usage(void)
+static void print_usage(const char *prog_name)
 {
 	printf( _("Usage:\n\n"
 		"%s [options] /path/to/filesystem\n\n"
@@ -102,7 +102,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 			sdp->debug = TRUE;
 			break;
 		case 'h':
-			print_usage();
+			print_usage(argv[0]);
 			exit(0);
 			break;
 		case 'J':
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index e9c16bf..824b73d 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -21,8 +21,6 @@
 #include "gfs2_mkfs.h"
 #include "libvolume_id.h"
 
-char *prog_name;
-
 /**
  * This function is for libgfs2's sake.
  */
@@ -38,11 +36,11 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...)
 
 /**
  * print_usage - print out usage information
- *
+ * @prog_name: The name of this program
  */
 
 static void
-print_usage(void)
+print_usage(const char *prog_name)
 {
 	printf( _("Usage:\n\n"
 		"%s [options] <device> [ block-count ]\n\n"
@@ -96,7 +94,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 			break;
 
 		case 'h':
-			print_usage();
+			print_usage(argv[0]);
 			exit(0);
 			break;
 
@@ -523,7 +521,7 @@ void main_mkfs(int argc, char *argv[])
 		sdp->orig_fssize >>= GFS2_BASIC_BLOCK_SHIFT;
 		if (sdp->orig_fssize > sdp->device.length) {
 			fprintf(stderr, _("%s: Specified block count is bigger "
-				"than the actual device.\n"), prog_name);
+				"than the actual device.\n"), argv[0]);
 			die( _("Device Size is %.2f GB (%"PRIu64" blocks)\n"),
 			       real_device_size / ((float)(1 << 30)),
 			       real_device_size / sdp->bsize);
diff --git a/gfs2/mount/mount.gfs2.c b/gfs2/mount/mount.gfs2.c
index f84dfde..2442f59 100644
--- a/gfs2/mount/mount.gfs2.c
+++ b/gfs2/mount/mount.gfs2.c
@@ -1,6 +1,5 @@
 #include "util.h"
 
-const char *prog_name;
 const char *fsname;
 int verbose, fake_mount = 0, no_mtab = 0;
 static sigset_t old_sigset;
@@ -165,12 +164,10 @@ int main(int argc, char **argv)
 	memset(&mo, 0, sizeof(mo));
 	memset(&sb, 0, sizeof(sb));
 
-	prog_name = argv[0];
+	if (!strstr(argv[0], "gfs"))
+		die("invalid mount helper name \"%s\"\n", argv[0]);
 
-	if (!strstr(prog_name, "gfs"))
-		die("invalid mount helper name \"%s\"\n", prog_name);
-
-	fsname = (strstr(prog_name, "gfs2")) ? "gfs2" : "gfs";
+	fsname = (strstr(argv[0], "gfs2")) ? "gfs2" : "gfs";
 	strcpy(mo.type, fsname);
 
 	if (argc < 2) {
diff --git a/gfs2/mount/mtab.c b/gfs2/mount/mtab.c
index 9d6dba1..fe5c744 100644
--- a/gfs2/mount/mtab.c
+++ b/gfs2/mount/mtab.c
@@ -1,6 +1,5 @@
 #include "util.h"
 
-extern char *prog_name;
 extern char *fsname;
 extern int verbose;
 static int ignoring_mtab;
diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
index 805e8a2..5c86027 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -43,7 +43,6 @@
 
 #endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
 
-extern char *prog_name;
 extern char *fsname;
 extern int verbose;
 
diff --git a/gfs2/mount/util.h b/gfs2/mount/util.h
index fe0f83d..7b856ac 100644
--- a/gfs2/mount/util.h
+++ b/gfs2/mount/util.h
@@ -23,20 +23,19 @@
 
 #define die(fmt, args...) \
 do { \
-	fprintf(stderr, "%s: ", prog_name); \
 	fprintf(stderr, fmt, ##args); \
 	exit(EXIT_FAILURE); \
 } while (0)
 
 #define warn(fmt, args...) \
 do { \
-	fprintf(stderr, "%s: " fmt "\n", prog_name, ##args); \
+	fprintf(stderr, fmt "\n", ##args); \
 } while (0)
 
 #define log_debug(fmt, args...) \
 do { \
 	if (verbose) \
-		printf("%s: " fmt "\n", prog_name, ##args); \
+		printf(fmt "\n", ##args); \
 } while (0)
 
 #define do_read(fd, buff, len) \
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index 27342f8..462246f 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -58,8 +58,6 @@ struct commandline {
 };
 typedef struct commandline commandline_t;
 
-extern char *prog_name;
-
 /*  main.c  */
 
 void do_get_super(int fd, struct gfs2_sb *sb);
diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
index 5e2e487..a160897 100644
--- a/gfs2/quota/main.c
+++ b/gfs2/quota/main.c
@@ -29,8 +29,6 @@
 
 #define OPTION_STRING ("bdf:g:hkl:mnsu:V")
 
-char *prog_name;
-
 /**
  * This function is for libgfs2's sake.
  */
@@ -46,11 +44,11 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...)
 
 /**
  * print_usage - print usage info to the user
- *
+ * @prog_name: The name of this program
  */
 
 static void
-print_usage(void)
+print_usage(const char *prog_name)
 {
 	printf("Usage:\n");
 	printf("\n");
@@ -153,7 +151,7 @@ decode_arguments(int argc, char *argv[], commandline_t *comline)
 			break;
 
 		case 'h':
-			print_usage();
+			print_usage(argv[0]);
 			exit(EXIT_SUCCESS);
 			break;
 
@@ -1032,8 +1030,6 @@ main(int argc, char *argv[])
     struct gfs2_sbd sbd, *sdp = &sbd;
 	commandline_t comline;
 
-	prog_name = argv[0];
-
 	memset(sdp, 0, sizeof(struct gfs2_sbd));
 	memset(&comline, 0, sizeof(commandline_t));
 
diff --git a/gfs2/tool/gfs2_tool.h b/gfs2/tool/gfs2_tool.h
index 11583a0..884856f 100644
--- a/gfs2/tool/gfs2_tool.h
+++ b/gfs2/tool/gfs2_tool.h
@@ -6,7 +6,6 @@
 #define OUTPUT_K      1
 #define OUTPUT_HUMAN  2
 
-extern char *prog_name;
 extern char *action;
 extern int override;
 extern int expert;
diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c
index 7e1f127..27a3d69 100644
--- a/gfs2/tool/main.c
+++ b/gfs2/tool/main.c
@@ -19,7 +19,6 @@
 #include "gfs2_tool.h"
 #include "libgfs2.h"
 
-char *prog_name;
 char *action = NULL;
 int override = FALSE;
 int expert = FALSE;
@@ -157,8 +156,6 @@ static void decode_arguments(int argc, char *argv[])
 
 int main(int argc, char *argv[])
 {
-	prog_name = argv[0];
-
 	setlocale(LC_ALL, "");
 	textdomain("gfs2_tool");
 
diff --git a/group/gfs_control/main.c b/group/gfs_control/main.c
index 6132d32..12fee97 100644
--- a/group/gfs_control/main.c
+++ b/group/gfs_control/main.c
@@ -23,7 +23,6 @@
 #define OP_LEAVE			5
 #define OP_JOINLEAVE			6
 
-static char *prog_name;
 static char *fsname;
 static int operation;
 static int opt_ind;
@@ -36,7 +35,7 @@ struct gfsc_mountgroup mgs[MAX_MG];
 struct gfsc_node nodes[MAX_NODES];
 
 
-static void print_usage(void)
+static void print_usage(const char *prog_name)
 {
 	printf("Usage:\n");
 	printf("\n");
@@ -64,13 +63,13 @@ static void decode_arguments(int argc, char **argv)
 			break;
 
 		case 'h':
-			print_usage();
+			print_usage(argv[0]);
 			exit(EXIT_SUCCESS);
 			break;
 
 		case 'V':
 			printf("%s %s (built %s %s)\n",
-				prog_name, RELEASE_VERSION, __DATE__, __TIME__);
+				argv[0], RELEASE_VERSION, __DATE__, __TIME__);
 			/* printf("%s\n", REDHAT_COPYRIGHT); */
 			exit(EXIT_SUCCESS);
 			break;
@@ -124,7 +123,7 @@ static void decode_arguments(int argc, char **argv)
 	}
 
 	if (!operation || !opt_ind) {
-		print_usage();
+		print_usage(argv[0]);
 		exit(EXIT_FAILURE);
 	}
 
@@ -439,7 +438,6 @@ static void do_dump(void)
 
 int main(int argc, char **argv)
 {
-	prog_name = argv[0];
 	decode_arguments(argc, argv);
 
 	switch (operation) {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]