From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15619 invoked by alias); 30 Mar 2009 13:10:23 -0000 Received: (qmail 15367 invoked by alias); 30 Mar 2009 13:10:21 -0000 X-SWARE-Spam-Status: No, hits=1.3 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_41,J_CHICKENPOX_43,J_CHICKENPOX_46,J_CHICKENPOX_52,J_CHICKENPOX_63,J_CHICKENPOX_66,SPF_HELO_PASS X-Spam-Status: No, hits=1.3 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_41,J_CHICKENPOX_43,J_CHICKENPOX_46,J_CHICKENPOX_52,J_CHICKENPOX_63,J_CHICKENPOX_66,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion.fedora.phx.redhat.com Subject: cluster: STABLE3 - Revert "Remove unused code from various places" To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: 39e55607a1487c14141989755643b9873de09873 X-Git-Newrev: 3ad8c3945b9a4508992efd6a5ad9be1820b84e7b From: "Fabio M. Di Nitto" Message-Id: <20090330130951.01F061202D3@lists.fedorahosted.org> Date: Mon, 30 Mar 2009 13:10:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00979.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=3ad8c3945b9a4508992efd6a5ad9be1820b84e7b Commit: 3ad8c3945b9a4508992efd6a5ad9be1820b84e7b Parent: 39e55607a1487c14141989755643b9873de09873 Author: Fabio M. Di Nitto AuthorDate: Mon Mar 30 15:09:30 2009 +0200 Committer: Fabio M. Di Nitto CommitterDate: Mon Mar 30 15:09:30 2009 +0200 Revert "Remove unused code from various places" This reverts commit 4396a783d1f6ccd6d868dc06b99c84ccfa1d96e9. --- gfs2/mkfs/main.c | 9 +-- gfs2/mkfs/main_grow.c | 46 +++++++-------- gfs2/mkfs/main_jadd.c | 135 ++++++++++++++++++++++-------------------- gfs2/mkfs/main_mkfs.c | 157 +++++++++++++++++++++++++------------------------ 4 files changed, 175 insertions(+), 172 deletions(-) diff --git a/gfs2/mkfs/main.c b/gfs2/mkfs/main.c index 3f96782..2707262 100644 --- a/gfs2/mkfs/main.c +++ b/gfs2/mkfs/main.c @@ -10,8 +10,6 @@ #include #include #include -#include -#define _(String) gettext(String) #include #include "libgfs2.h" @@ -32,9 +30,6 @@ main(int argc, char *argv[]) { char *p, *whoami; - setlocale(LC_ALL, ""); - textdomain("mkfs.gfs2"); - prog_name = argv[0]; srandom(time(NULL) ^ getpid()); @@ -52,9 +47,9 @@ main(int argc, char *argv[]) main_shrink(argc, argv); #endif else - die( _("I don't know who I am!\n")); + die("I don't know who I am!\n"); free(p); - return 0; + return EXIT_SUCCESS; } diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c index e87623a..0e18d1a 100644 --- a/gfs2/mkfs/main_grow.c +++ b/gfs2/mkfs/main_grow.c @@ -16,8 +16,6 @@ #include #include #include -#include -#define _(String) gettext(String) #include "libgfs2.h" #include "gfs2_mkfs.h" @@ -46,7 +44,7 @@ extern int rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name); static void usage(void) { fprintf(stdout, - _("Usage:\n" + "Usage:\n" "\n" "gfs2_grow [options] /path/to/filesystem\n" "\n" @@ -55,7 +53,7 @@ static void usage(void) " -q Quiet, reduce verbosity\n" " -T Test, do everything except update FS\n" " -V Version information\n" - " -v Verbose, increase verbosity\n")); + " -v Verbose, increase verbosity\n"); } void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) @@ -71,7 +69,7 @@ void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case 'V': printf("%s %s (built %s %s)\n", argv[0], RELEASE_VERSION, __DATE__, __TIME__); - printf( _(REDHAT_COPYRIGHT "\n")); + printf("%s\n", REDHAT_COPYRIGHT); exit(0); case 'h': usage(); @@ -80,8 +78,8 @@ void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) decrease_verbosity(); break; case 'T': - printf( _("(Test mode--File system will not " - "be changed)\n")); + printf("(Test mode--File system will not " + "be changed)\n"); test = 1; break; case 'v': @@ -90,11 +88,11 @@ void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case ':': case '?': /* Unknown flag */ - fprintf(stderr, _("Please use '-h' for usage.\n")); + fprintf(stderr, "Please use '-h' for usage.\n"); exit(EXIT_FAILURE); default: - fprintf(stderr, _("Bad programmer! You forgot" - " to catch the %c flag\n"), opt); + fprintf(stderr, "Bad programmer! You forgot" + " to catch the %c flag\n", opt); exit(EXIT_FAILURE); break; } @@ -193,11 +191,11 @@ void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count) rg = 0; osi_list_foreach(tmp, &sdp->rglist) rg++; - log_info( _("%d new rindex entries.\n"), rg); + log_info("%d new rindex entries.\n", rg); writelen = rg * sizeof(struct gfs2_rindex); buf = calloc(1, writelen); if (buf == NULL) { - fprintf(stderr, _("Out of memory in %s\n"), __FUNCTION__); + fprintf(stderr, "Out of memory in %s\n", __FUNCTION__); exit(-1); } /* Now add the new rg entries to the rg index. Here we */ @@ -270,7 +268,7 @@ main_grow(int argc, char *argv[]) if (check_for_gfs2(sdp)) { if (errno == EINVAL) fprintf(stderr, - _("Not a valid GFS2 mount point: %s\n"), + "Not a valid GFS2 mount point: %s\n", sdp->path_name); else fprintf(stderr, "%s\n", strerror(errno)); @@ -279,13 +277,13 @@ main_grow(int argc, char *argv[]) sdp->device_fd = open(sdp->device_name, (test ? O_RDONLY : O_RDWR)); if (sdp->device_fd < 0) - die( _("can't open device %s: %s\n"), + die("can't open device %s: %s\n", sdp->device_name, strerror(errno)); if (device_geometry(sdp)) { - fprintf(stderr, _("Geometry error\n")); + fprintf(stderr, "Geometry error\n"); exit(-1); } - log_info( _("Initializing lists...\n")); + log_info("Initializing lists...\n"); osi_list_init(&sdp->rglist); init_buf_list(sdp, &sdp->buf_list, 128 << 20); init_buf_list(sdp, &sdp->nvbuf_list, 0xffffffff); @@ -294,11 +292,11 @@ main_grow(int argc, char *argv[]) sdp->bsize = sdp->sd_sb.sb_bsize; compute_constants(sdp); if(read_sb(sdp) < 0) - die( _("gfs: Error reading superblock.\n")); + die("gfs: Error reading superblock.\n"); fix_device_geometry(sdp); if (mount_gfs2_meta(sdp)) { - fprintf(stderr, _("Error mounting GFS2 metafs: %s\n"), + fprintf(stderr, "Error mounting GFS2 metafs: %s\n", strerror(errno)); exit(-1); } @@ -307,7 +305,7 @@ main_grow(int argc, char *argv[]) rindex_fd = open(rindex_name, (test ? O_RDONLY : O_RDWR)); if (rindex_fd < 0) { cleanup_metafs(sdp); - die( _("GFS2 rindex not found. Please run gfs2_fsck.\n")); + die("GFS2 rindex not found. Please run gfs2_fsck.\n"); } /* Get master dinode */ sdp->master_dir = @@ -323,11 +321,11 @@ main_grow(int argc, char *argv[]) figure_out_rgsize(sdp, &rgsize); fsgrowth = ((sdp->device.length - fssize) * sdp->bsize); if (fsgrowth < rgsize * sdp->bsize) { - log_err( _("Error: The device has grown by less than " - "one Resource Group (RG).\n")); - log_err( _("The device grew by %" PRIu64 "MB. "), + log_err("Error: The device has grown by less than " + "one Resource Group (RG).\n"); + log_err("The device grew by %" PRIu64 "MB. ", fsgrowth / MB); - log_err( _("One RG is %uMB for this file system.\n"), + log_err("One RG is %uMB for this file system.\n", (rgsize * sdp->bsize) / MB); } else { @@ -347,5 +345,5 @@ main_grow(int argc, char *argv[]) } close(sdp->path_fd); sync(); - log_notice( _("gfs2_grow complete.\n")); + log_notice("gfs2_grow complete.\n"); } diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c index 5f9e461..3f574de 100644 --- a/gfs2/mkfs/main_jadd.c +++ b/gfs2/mkfs/main_jadd.c @@ -15,8 +15,6 @@ #include #include #include -#include -#define _(String) gettext(String) #include #include "libgfs2.h" @@ -25,36 +23,38 @@ #define BUF_SIZE 4096 #define RANDOM(values) ((values) * (random() / (RAND_MAX + 1.0))) -void make_jdata(int fd, char *value) +void +make_jdata(int fd, char *value) { int err; uint32_t val; err = ioctl(fd, FS_IOC_GETFLAGS, &val); if (err) - die( _("error doing get flags (%d): %s\n"), err, strerror(errno)); + die("error doing get flags (%d): %s\n", err, strerror(errno)); if (strcmp(value, "set") == 0) val |= FS_JOURNAL_DATA_FL; if (strcmp(value, "clear") == 0) val &= ~FS_JOURNAL_DATA_FL; err = ioctl(fd, FS_IOC_SETFLAGS, &val); if (err) - die( _("error doing set flags (%d): %s\n"), err, strerror(errno)); + die("error doing set flags (%d): %s\n", err, strerror(errno)); } -int rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name) +int +rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name) { char oldpath[PATH_MAX], newpath[PATH_MAX]; int error = 0; error = snprintf(oldpath, PATH_MAX, "%s/new_inode", sdp->metafs_path); if (error >= PATH_MAX) - die( _("rename2system (1)\n")); + die("rename2system (1)\n"); error = snprintf(newpath, PATH_MAX, "%s/%s/%s", sdp->metafs_path, new_dir, new_name); if (error >= PATH_MAX) - die( _("rename2system (2)\n")); + die("rename2system (2)\n"); return rename(oldpath, newpath); } @@ -64,18 +64,22 @@ int rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name) * */ -static void print_usage(void) +static void +print_usage(void) { - printf( _("Usage:\n\n" - "%s [options] /path/to/filesystem\n\n" - "Options:\n\n" - " -c Size of quota change file\n" - " -D Enable debugging code\n" - " -h Print this help, then exit\n" - " -J Size of journals\n" - " -j Number of journals\n" - " -q Don't print anything\n" - " -V Print program version information, then exit\n"), prog_name); + printf("Usage:\n"); + printf("\n"); + printf("%s [options] /path/to/filesystem\n", prog_name); + printf("\n"); + printf("Options:\n"); + printf("\n"); + printf(" -c Size of quota change file\n"); + printf(" -D Enable debugging code\n"); + printf(" -h Print this help, then exit\n"); + printf(" -J Size of journals\n"); + printf(" -j Number of journals\n"); + printf(" -q Don't print anything\n"); + printf(" -V Print program version information, then exit\n"); } /** @@ -86,7 +90,8 @@ static void print_usage(void) * */ -static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) +static void +decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) { int cont = TRUE; int optchar; @@ -103,7 +108,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) break; case 'h': print_usage(); - exit(0); + exit(EXIT_SUCCESS); break; case 'J': sdp->jsize = atoi(optarg); @@ -117,22 +122,22 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case 'V': printf("gfs2_jadd %s (built %s %s)\n", RELEASE_VERSION, __DATE__, __TIME__); - printf( _(REDHAT_COPYRIGHT "\n")); - exit(0); + printf("%s\n", REDHAT_COPYRIGHT); + exit(EXIT_SUCCESS); break; case 'X': sdp->expert = TRUE; break; case ':': case '?': - fprintf(stderr, _("Please use '-h' for usage.\n")); + fprintf(stderr, "Please use '-h' for usage.\n"); exit(EXIT_FAILURE); break; case EOF: cont = FALSE; break; default: - die( _("unknown option: %c\n"), optchar); + die("unknown option: %c\n", optchar); break; }; } @@ -141,13 +146,13 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) sdp->path_name = argv[optind]; optind++; } else - die( _("no path specified (try -h for help)\n")); + die("no path specified (try -h for help)\n"); if (optind < argc) - die( _("Unrecognized option: %s\n"), argv[optind]); + die("Unrecognized option: %s\n", argv[optind]); if (sdp->debug) { - printf( _("Command Line Arguments:\n")); + printf("Command Line Arguments:\n"); printf(" qcsize = %u\n", sdp->qcsize); printf(" jsize = %u\n", sdp->jsize); printf(" journals = %u\n", sdp->md.journals); @@ -160,11 +165,11 @@ static void verify_arguments(struct gfs2_sbd *sdp) { if (!sdp->md.journals) - die( _("no journals specified\n")); + die("no journals specified\n"); if (sdp->jsize < 32 || sdp->jsize > 1024) - die( _("bad journal size\n")); + die("bad journal size\n"); if (!sdp->qcsize || sdp->qcsize > 64) - die( _("bad quota change size\n")); + die("bad quota change size\n"); } /** @@ -184,9 +189,9 @@ print_results(struct gfs2_sbd *sdp) if (sdp->expert) printf("Expert mode: on\n"); - printf( _("Filesystem: %s\n"), sdp->path_name); - printf( _("Old Journals %u\n"), sdp->orig_journals); - printf( _("New Journals %u\n"), sdp->md.journals); + printf("Filesystem: %s\n", sdp->path_name); + printf("Old Journals %u\n", sdp->orig_journals); + printf("New Journals %u\n", sdp->md.journals); } @@ -208,16 +213,17 @@ create_new_inode(struct gfs2_sbd *sdp) if (errno == EEXIST) { error = unlink(name); if (error) - die( _("can't unlink %s: %s\n"), + die("can't unlink %s: %s\n", name, strerror(errno)); } else - die( _("can't create %s: %s\n"), name, strerror(errno)); + die("can't create %s: %s\n", name, strerror(errno)); } return fd; } -void add_ir(struct gfs2_sbd *sdp) +void +add_ir(struct gfs2_sbd *sdp) { int fd; char new_name[256]; @@ -231,8 +237,8 @@ void add_ir(struct gfs2_sbd *sdp) memset(&ir, 0, sizeof(struct gfs2_inum_range)); if (write(fd, (void*)&ir, sizeof(struct gfs2_inum_range)) != sizeof(struct gfs2_inum_range)) { - fprintf(stderr, _( "write error: %s from %s:%d: " - "offset 0\n"), strerror(errno), + fprintf(stderr, "write error: %s from %s:%d: " + "offset 0\n", strerror(errno), __FUNCTION__, __LINE__); exit(-1); } @@ -243,7 +249,7 @@ void add_ir(struct gfs2_sbd *sdp) sprintf(new_name, "inum_range%u", sdp->md.journals); error = rename2system(sdp, "per_node", new_name); if (error < 0 && errno != EEXIST) - die( _("can't rename2system %s (%d): %s\n"), + die("can't rename2system %s (%d): %s\n", new_name, error, strerror(errno)); } @@ -263,8 +269,8 @@ add_sc(struct gfs2_sbd *sdp) memset(&sc, 0, sizeof(struct gfs2_statfs_change)); if (write(fd, (void*)&sc, sizeof(struct gfs2_statfs_change)) != sizeof(struct gfs2_statfs_change)) { - fprintf(stderr, _("write error: %s from %s:%d: " - "offset 0\n"), strerror(errno), + fprintf(stderr, "write error: %s from %s:%d: " + "offset 0\n", strerror(errno), __FUNCTION__, __LINE__); exit(-1); } @@ -275,7 +281,7 @@ add_sc(struct gfs2_sbd *sdp) sprintf(new_name, "statfs_change%u", sdp->md.journals); error = rename2system(sdp, "per_node", new_name); if (error < 0 && errno != EEXIST) - die( _("can't rename2system %s (%d): %s\n"), + die("can't rename2system %s (%d): %s\n", new_name, error, strerror(errno)); } @@ -300,8 +306,8 @@ add_qc(struct gfs2_sbd *sdp) for (x=0; xbsize) != sdp->bsize) { - fprintf(stderr, _("write error: %s from %s:%d: " - "block %lld (0x%llx)\n"), + fprintf(stderr, "write error: %s from %s:%d: " + "block %lld (0x%llx)\n", strerror(errno), __FUNCTION__, __LINE__, (unsigned long long)x, @@ -320,8 +326,8 @@ add_qc(struct gfs2_sbd *sdp) for (x=0; xbsize) != sdp->bsize) { - fprintf(stderr, _("write error: %s from %s:%d: " - "block %lld (0x%llx)\n"), + fprintf(stderr, "write error: %s from %s:%d: " + "block %lld (0x%llx)\n", strerror(errno), __FUNCTION__, __LINE__, (unsigned long long)x, @@ -332,7 +338,7 @@ add_qc(struct gfs2_sbd *sdp) error = fsync(fd); if (error) - die( _("can't fsync: %s\n"), + die("can't fsync: %s\n", strerror(errno)); } @@ -341,7 +347,7 @@ add_qc(struct gfs2_sbd *sdp) sprintf(new_name, "quota_change%u", sdp->md.journals); error = rename2system(sdp, "per_node", new_name); if (error < 0 && errno != EEXIST) - die( _("can't rename2system %s (%d): %s\n"), + die("can't rename2system %s (%d): %s\n", new_name, error, strerror(errno)); } @@ -350,7 +356,7 @@ gather_info(struct gfs2_sbd *sdp) { struct statfs statbuf; if (statfs(sdp->path_name, &statbuf) < 0) { - die( _("Could not statfs the filesystem %s: %s\n"), + die("Could not statfs the filesystem %s: %s\n", sdp->path_name, strerror(errno)); } sdp->bsize = statbuf.f_bsize; @@ -367,8 +373,8 @@ find_current_journals(struct gfs2_sbd *sdp) sprintf(jindex, "%s/jindex", sdp->metafs_path); dirp = opendir(jindex); if (!dirp) { - die( _("Could not find the jindex directory " - "in gfs2meta mount! error: %s\n"), strerror(errno)); + die("Could not find the jindex directory " + "in gfs2meta mount! error: %s\n", strerror(errno)); } while (dirp) { if ((dp = readdir(dirp)) != NULL) { @@ -380,8 +386,8 @@ find_current_journals(struct gfs2_sbd *sdp) close: closedir(dirp); if (existing_journals <= 0) { - die( _("There are no journals for this " - "gfs2 fs! Did you mkfs.gfs2 correctly?\n")); + die("There are no journals for this " + "gfs2 fs! Did you mkfs.gfs2 correctly?\n"); } sdp->orig_journals = existing_journals; @@ -408,8 +414,8 @@ add_j(struct gfs2_sbd *sdp) memset(buf, 0, sdp->bsize); for (x=0; xbsize) != sdp->bsize) { - fprintf(stderr, _("write error: %s from %s:%d: " - "block %lld (0x%llx)\n"), + fprintf(stderr, "write error: %s from %s:%d: " + "block %lld (0x%llx)\n", strerror(errno), __FUNCTION__, __LINE__, (unsigned long long)x, @@ -436,8 +442,8 @@ add_j(struct gfs2_sbd *sdp) ((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash); if (write(fd, buf, sdp->bsize) != sdp->bsize) { - fprintf(stderr, _("write error: %s from %s:%d: " - "block %lld (0x%llx)\n"), + fprintf(stderr, "write error: %s from %s:%d: " + "block %lld (0x%llx)\n", strerror(errno), __FUNCTION__, __LINE__, (unsigned long long)x, @@ -451,7 +457,7 @@ add_j(struct gfs2_sbd *sdp) error = fsync(fd); if (error) - die( _("can't fsync: %s\n"), + die("can't fsync: %s\n", strerror(errno)); } @@ -460,7 +466,7 @@ add_j(struct gfs2_sbd *sdp) sprintf(new_name, "journal%u", sdp->md.journals); error = rename2system(sdp, "jindex", new_name); if (error < 0 && errno != EEXIST) - die( _("can't rename2system %s (%d): %s\n"), + die("can't rename2system %s (%d): %s\n", new_name, error, strerror(errno)); } @@ -471,7 +477,8 @@ add_j(struct gfs2_sbd *sdp) * */ -void main_jadd(int argc, char *argv[]) +void +main_jadd(int argc, char *argv[]) { struct gfs2_sbd sbd, *sdp = &sbd; unsigned int total; @@ -486,12 +493,12 @@ void main_jadd(int argc, char *argv[]) sdp->path_fd = open(sdp->path_name, O_RDONLY); if (sdp->path_fd < 0) - die( _("can't open root directory %s: %s\n"), + die("can't open root directory %s: %s\n", sdp->path_name, strerror(errno)); if (check_for_gfs2(sdp)) { if (errno == EINVAL) - fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"), + fprintf(stderr, "Not a valid GFS2 mount point: %s\n", sdp->path_name); else fprintf(stderr, "%s\n", strerror(errno)); @@ -501,7 +508,7 @@ void main_jadd(int argc, char *argv[]) gather_info(sdp); if (mount_gfs2_meta(sdp)) { - fprintf(stderr, _("Error mounting GFS2 metafs: %s\n"), + fprintf(stderr, "Error mounting GFS2 metafs: %s\n", strerror(errno)); exit(-1); } diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c index edda1d0..cdc0068 100644 --- a/gfs2/mkfs/main_mkfs.c +++ b/gfs2/mkfs/main_mkfs.c @@ -13,8 +13,6 @@ #include #include #include -#include -#define _(String) gettext(String) #include #include "libgfs2.h" @@ -44,22 +42,25 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...) static void print_usage(void) { - printf( _("Usage:\n\n" - "%s [options] [ block-count ]\n\n" - "Options:\n\n" - " -b Filesystem block size\n" - " -c Size of quota change file\n" - " -D Enable debugging code\n" - " -h Print this help, then exit\n" - " -J Size of journals\n" - " -j Number of journals\n" - " -O Don't ask for confirmation\n" - " -p Name of the locking protocol\n" - " -q Don't print anything\n" - " -r Resource Group Size\n" - " -t Name of the lock table\n" - " -u Size of unlinked file\n" - " -V Print program version information, then exit\n"), prog_name); + printf("Usage:\n"); + printf("\n"); + printf("%s [options] [ block-count ]\n", prog_name); + printf("\n"); + printf("Options:\n"); + printf("\n"); + printf(" -b Filesystem block size\n"); + printf(" -c Size of quota change file\n"); + printf(" -D Enable debugging code\n"); + printf(" -h Print this help, then exit\n"); + printf(" -J Size of journals\n"); + printf(" -j Number of journals\n"); + printf(" -O Don't ask for confirmation\n"); + printf(" -p Name of the locking protocol\n"); + printf(" -q Don't print anything\n"); + printf(" -r Resource Group Size\n"); + printf(" -t Name of the lock table\n"); + printf(" -u Size of unlinked file\n"); + printf(" -V Print program version information, then exit\n"); } /** @@ -70,7 +71,8 @@ print_usage(void) * */ -static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) +static void +decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) { int cont = TRUE; int optchar; @@ -97,7 +99,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case 'h': print_usage(); - exit(0); + exit(EXIT_SUCCESS); break; case 'J': @@ -114,7 +116,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case 'p': if (strlen(optarg) >= GFS2_LOCKNAME_LEN) - die( _("lock protocol name %s is too long\n"), + die("lock protocol name %s is too long\n", optarg); strcpy(sdp->lockproto, optarg); break; @@ -129,7 +131,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case 't': if (strlen(optarg) >= GFS2_LOCKNAME_LEN) - die( _("lock table name %s is too long\n"), optarg); + die("lock table name %s is too long\n", optarg); strcpy(sdp->locktable, optarg); break; @@ -140,7 +142,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case 'V': printf("gfs2_mkfs %s (built %s %s)\n", RELEASE_VERSION, __DATE__, __TIME__); - printf( _(REDHAT_COPYRIGHT "\n")); + printf("%s\n", REDHAT_COPYRIGHT); exit(EXIT_SUCCESS); break; @@ -150,7 +152,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) case ':': case '?': - fprintf(stderr, _("Please use '-h' for usage.\n")); + fprintf(stderr, "Please use '-h' for usage.\n"); exit(EXIT_FAILURE); break; @@ -167,11 +169,11 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) isdigit(optarg[0])) sdp->orig_fssize = atol(optarg); else - die( _("More than one device specified (try -h for help)\n")); + die("More than one device specified (try -h for help)\n"); break; default: - die( _("unknown option: %c\n"), optchar); + die("unknown option: %c\n", optchar); break; }; } @@ -180,16 +182,16 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) strcpy(sdp->device_name, argv[optind++]); if (sdp->device_name[0] == '\0') - die( _("no device specified (try -h for help)\n")); + die("no device specified (try -h for help)\n"); if (optind < argc) sdp->orig_fssize = atol(argv[optind++]); if (optind < argc) - die( _("Unrecognized argument: %s\n"), argv[optind]); + die("Unrecognized argument: %s\n", argv[optind]); if (sdp->debug) { - printf( _("Command Line Arguments:\n")); + printf("Command Line Arguments:\n"); printf(" bsize = %u\n", sdp->bsize); printf(" qcsize = %u\n", sdp->qcsize); printf(" jsize = %u\n", sdp->jsize); @@ -198,7 +200,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp) printf(" proto = %s\n", sdp->lockproto); printf(" quiet = %d\n", sdp->quiet); if (sdp->rgsize==-1) - printf( _(" rgsize = optimize for best performance\n")); + printf(" rgsize = optimize for best performance\n"); else printf(" rgsize = %u\n", sdp->rgsize); printf(" table = %s\n", sdp->locktable); @@ -227,33 +229,33 @@ static void test_locking(char *lockproto, char *locktable) strcmp(lockproto, "lock_dlm") == 0) { for (c = locktable; *c; c++) { if (isspace(*c)) - die( _("locktable error: contains space characters\n")); + die("locktable error: contains space characters\n"); if (!isprint(*c)) - die( _("locktable error: contains unprintable characters\n")); + die("locktable error: contains unprintable characters\n"); } c = strstr(locktable, ":"); if (!c) - die( _("locktable error: missing colon in the locktable\n")); + die("locktable error: missing colon in the locktable\n"); if (c == locktable) - die( _("locktable error: missing cluster name\n")); + die("locktable error: missing cluster name\n"); if (c - locktable > 16) - die( _("locktable error: cluster name too long\n")); + die("locktable error: cluster name too long\n"); c++; if (!c) - die( _("locktable error: missing filesystem name\n")); + die("locktable error: missing filesystem name\n"); if (strstr(c, ":")) - die( _("locktable error: more than one colon present\n")); + die("locktable error: more than one colon present\n"); if (!strlen(c)) - die( _("locktable error: missing filesystem name\n")); + die("locktable error: missing filesystem name\n"); if (strlen(c) > 16) - die( _("locktable error: filesystem name too long\n")); + die("locktable error: filesystem name too long\n"); } else { - die( _("lockproto error: %s unknown\n"), lockproto); + die("lockproto error: %s unknown\n", lockproto); } } @@ -271,28 +273,28 @@ static void verify_arguments(struct gfs2_sbd *sdp) break; if (!x || sdp->bsize > 65536) - die( _("block size must be a power of two between 512 and 65536\n")); + die("block size must be a power of two between 512 and 65536\n"); /* Look at this! Why can't we go bigger than 2GB? */ if (sdp->expert) { if (1 > sdp->rgsize || sdp->rgsize > 2048) - die( _("bad resource group size\n")); + die("bad resource group size\n"); } else { if (32 > sdp->rgsize || sdp->rgsize > 2048) - die( _("bad resource group size\n")); + die("bad resource group size\n"); } if (!sdp->md.journals) - die( _("no journals specified\n")); + die("no journals specified\n"); if (sdp->jsize < 8 || sdp->jsize > 1024) - die( _("bad journal size\n")); + die("bad journal size\n"); if (!sdp->utsize || sdp->utsize > 64) - die( _("bad unlinked size\n")); + die("bad unlinked size\n"); if (!sdp->qcsize || sdp->qcsize > 64) - die( _("bad quota change size\n")); + die("bad quota change size\n"); } /** @@ -309,14 +311,14 @@ static void are_you_sure(struct gfs2_sbd *sdp) fd = open(sdp->device_name, O_RDONLY); if (fd < 0) - die( _("Error: device %s not found.\n"), sdp->device_name); + die("Error: device %s not found.\n", sdp->device_name); vid = volume_id_open_fd(fd); if (vid == NULL) { close(fd); - die( _("error identifying the contents of %s: %s\n"), + die("error identifying the contents of %s: %s\n", sdp->device_name, strerror(errno)); } - printf( _("This will destroy any data on %s.\n"), sdp->device_name); + printf("This will destroy any data on %s.\n", sdp->device_name); if (volume_id_probe_all(vid, 0, sdp->device_size) == 0) { const char *fstype, *fsusage; int rc; @@ -326,18 +328,18 @@ static void are_you_sure(struct gfs2_sbd *sdp) rc = volume_id_get_usage(vid, &fsusage); if (!rc || strncmp(fsusage, "other", 5) == 0) fsusage = "partition"; - printf( _(" It appears to contain a %s %s.\n"), fstype, + printf(" It appears to contain a %s %s.\n", fstype, fsusage); } } volume_id_close(vid); close(fd); - printf( _("\nAre you sure you want to proceed? [y/n] ")); + printf("\nAre you sure you want to proceed? [y/n] "); if(!fgets(input, 32, stdin)) - die( _("unable to read from stdin\n")); + die("unable to read from stdin\n"); if (input[0] != 'y') - die( _("aborted\n")); + die("aborted\n"); else printf("\n"); } @@ -354,15 +356,15 @@ void check_mount(char *device) int fd; if (stat(device, &st_buf) < 0) - die( _("could not stat device %s\n"), device); + die("could not stat device %s\n", device); if (!S_ISBLK(st_buf.st_mode)) - die( _("%s is not a block device\n"), device); + die("%s is not a block device\n", device); fd = open(device, O_RDONLY | O_NONBLOCK | O_EXCL); if (fd < 0) { if (errno == EBUSY) { - die( _("device %s is busy\n"), device); + die("device %s is busy\n", device); } } else { @@ -432,31 +434,31 @@ print_results(struct gfs2_sbd *sdp, uint64_t real_device_size, return; if (sdp->expert) - printf( _("Expert mode: on\n")); + printf("Expert mode: on\n"); - printf( _("Device: %s\n"), sdp->device_name); + printf("Device: %s\n", sdp->device_name); - printf( _("Blocksize: %u\n"), sdp->bsize); - printf( _("Device Size %.2f GB (%"PRIu64" blocks)\n"), + printf("Blocksize: %u\n", sdp->bsize); + printf("Device Size %.2f GB (%"PRIu64" blocks)\n", real_device_size / ((float)(1 << 30)), real_device_size / sdp->bsize); - printf( _("Filesystem Size: %.2f GB (%"PRIu64" blocks)\n"), + printf("Filesystem Size: %.2f GB (%"PRIu64" blocks)\n", sdp->fssize / ((float)(1 << 30)) * sdp->bsize, sdp->fssize); - printf( _("Journals: %u\n"), sdp->md.journals); - printf( _("Resource Groups: %"PRIu64"\n"), sdp->rgrps); + printf("Journals: %u\n", sdp->md.journals); + printf("Resource Groups: %"PRIu64"\n", sdp->rgrps); - printf( _("Locking Protocol: \"%s\"\n"), sdp->lockproto); - printf( _("Lock Table: \"%s\"\n"), sdp->locktable); + printf("Locking Protocol: \"%s\"\n", sdp->lockproto); + printf("Lock Table: \"%s\"\n", sdp->locktable); if (sdp->debug) { printf("\n"); - printf( _("Spills: %u\n"), + printf("Spills: %u\n", sdp->buf_list.spills); - printf( _("Writes: %u\n"), sdp->writes); + printf("Writes: %u\n", sdp->writes); } - printf( _("UUID: %s\n"), str_uuid(uuid)); + printf("UUID: %s\n", str_uuid(uuid)); printf("\n"); } @@ -467,7 +469,8 @@ print_results(struct gfs2_sbd *sdp, uint64_t real_device_size, * */ -void main_mkfs(int argc, char *argv[]) +void +main_mkfs(int argc, char *argv[]) { struct gfs2_sbd sbd, *sdp = &sbd; int error; @@ -499,7 +502,7 @@ void main_mkfs(int argc, char *argv[]) sdp->device_fd = open(sdp->device_name, O_RDWR); if (sdp->device_fd < 0) - die( _("can't open device %s: %s\n"), + die("can't open device %s: %s\n", sdp->device_name, strerror(errno)); if (!sdp->override) @@ -511,7 +514,7 @@ void main_mkfs(int argc, char *argv[]) device_size(sdp->device_fd, &real_device_size); if (device_geometry(sdp)) { - fprintf(stderr, _("Geometry error\n")); + fprintf(stderr, "Geometry error\n"); exit(-1); } /* Convert optional block-count to basic blocks */ @@ -519,9 +522,9 @@ void main_mkfs(int argc, char *argv[]) sdp->orig_fssize *= sdp->bsize; 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); - die( _("Device Size is %.2f GB (%"PRIu64" blocks)\n"), + fprintf(stderr, "%s: Specified block count is bigger " + "than the actual device.\n", prog_name); + die("Device Size is %.2f GB (%"PRIu64" blocks)\n", real_device_size / ((float)(1 << 30)), real_device_size / sdp->bsize); } @@ -562,11 +565,11 @@ void main_mkfs(int argc, char *argv[]) error = fsync(sdp->device_fd); if (error) - die( _("can't fsync device (%d): %s\n"), + die("can't fsync device (%d): %s\n", error, strerror(errno)); error = close(sdp->device_fd); if (error) - die( _("error closing device (%d): %s\n"), + die("error closing device (%d): %s\n", error, strerror(errno)); print_results(sdp, real_device_size, uuid);