public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: gfs2-utils: master - fsck.gfs2: Add gettext support Date: Tue, 24 Mar 2009 21:00:00 -0000 [thread overview] Message-ID: <20090324205932.802A51201A0@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=abf33c329569dffa30eb74dd7214a1c8a4ac16fe Commit: abf33c329569dffa30eb74dd7214a1c8a4ac16fe Parent: 90a7e2c443fdaa3c6bec6ff588de3f994cb78663 Author: Steven Whitehouse <steve@dolmen.chygwyn.com> AuthorDate: Tue Mar 24 20:50:24 2009 +0000 Committer: Steven Whitehouse <steve@dolmen.chygwyn.com> CommitterDate: Tue Mar 24 20:50:24 2009 +0000 fsck.gfs2: Add gettext support The messages need to be cleaned up a bit, but this is the guts of it anyway. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> --- gfs2/fsck/eattr.c | 8 ++- gfs2/fsck/fs_recovery.c | 28 ++++---- gfs2/fsck/initialize.c | 64 +++++++++-------- gfs2/fsck/link.c | 28 ++++---- gfs2/fsck/lost_n_found.c | 22 +++--- gfs2/fsck/main.c | 99 ++++++++++++++------------ gfs2/fsck/metawalk.c | 98 +++++++++++++------------- gfs2/fsck/pass1.c | 156 +++++++++++++++++++++-------------------- gfs2/fsck/pass1b.c | 91 ++++++++++++------------ gfs2/fsck/pass1c.c | 44 ++++++------ gfs2/fsck/pass2.c | 176 +++++++++++++++++++++++----------------------- gfs2/fsck/pass3.c | 100 +++++++++++++------------- gfs2/fsck/pass4.c | 60 ++++++++-------- gfs2/fsck/pass5.c | 44 ++++++------ gfs2/fsck/rgrepair.c | 76 ++++++++++---------- gfs2/fsck/util.c | 4 +- 16 files changed, 566 insertions(+), 532 deletions(-) diff --git a/gfs2/fsck/eattr.c b/gfs2/fsck/eattr.c index 0fe2421..5898759 100644 --- a/gfs2/fsck/eattr.c +++ b/gfs2/fsck/eattr.c @@ -1,5 +1,7 @@ #include <stdint.h> #include <string.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -14,7 +16,7 @@ static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block) } if(q.dup_block) { - log_debug("Not clearing block with marked as a duplicate\n"); + log_debug( _("Not clearing block with marked as a duplicate\n")); return 1; } @@ -74,8 +76,8 @@ int clear_eattr_entry (struct gfs2_inode *ip, if(max_ptrs > ea_hdr->ea_num_ptrs) { return 1; } else { - log_debug(" Pointers Required: %d\n" - " Pointers Reported: %d\n", + log_debug( _(" Pointers Required: %d\n" + " Pointers Reported: %d\n"), max_ptrs, ea_hdr->ea_num_ptrs); } diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c index fb830fe..fa5b547 100644 --- a/gfs2/fsck/fs_recovery.c +++ b/gfs2/fsck/fs_recovery.c @@ -4,6 +4,8 @@ #include <string.h> #include <time.h> #include <unistd.h> +#include <libintl.h> +#define _(String) gettext(String) #include "fsck.h" #include "fs_recovery.h" @@ -334,7 +336,7 @@ int gfs2_recover_journal(struct gfs2_inode *ip, int j) unsigned int pass; int error; - log_info("jid=%u: Looking at journal...\n", j); + log_info( _("jid=%u: Looking at journal...\n"), j); osi_list_init(&sd_revoke_list); error = gfs2_find_jhead(ip, &head); @@ -342,12 +344,12 @@ int gfs2_recover_journal(struct gfs2_inode *ip, int j) goto out; if (head.lh_flags & GFS2_LOG_HEAD_UNMOUNT) { - log_info("jid=%u: Journal is clean.\n", j); + log_info( _("jid=%u: Journal is clean.\n"), j); return 0; } - if (query(&opts, "\nJournal #%d (\"journal%d\") is dirty. Okay to replay it? (y/n)", + if (query(&opts, _("\nJournal #%d (\"journal%d\") is dirty. Okay to replay it? (y/n)"), j+1, j)) { - log_info("jid=%u: Replaying journal...\n", j); + log_info( _("jid=%u: Replaying journal...\n"), j); sd_found_jblocks = sd_replayed_jblocks = 0; sd_found_metablocks = sd_replayed_metablocks = 0; @@ -359,28 +361,28 @@ int gfs2_recover_journal(struct gfs2_inode *ip, int j) if (error) goto out; } - log_info("jid=%u: Found %u revoke tags\n", j, + log_info( _("jid=%u: Found %u revoke tags\n"), j, sd_found_revokes); gfs2_revoke_clean(sdp); error = clean_journal(ip, &head); if (error) goto out; - log_err("jid=%u: Replayed %u of %u journaled data blocks\n", + log_err( _("jid=%u: Replayed %u of %u journaled data blocks\n"), j, sd_replayed_jblocks, sd_found_jblocks); - log_err("jid=%u: Replayed %u of %u metadata blocks\n", + log_err( _("jid=%u: Replayed %u of %u metadata blocks\n"), j, sd_replayed_metablocks, sd_found_metablocks); } else { - if (query(&opts, "Do you want to clear the dirty journal instead? (y/n)")) { + if (query(&opts, _("Do you want to clear the dirty journal instead? (y/n)"))) { write_journal(sdp, sdp->md.journal[j], j, sdp->md.journal[j]->i_di.di_size / sdp->sd_sb.sb_bsize); } else - log_err("jid=%u: Dirty journal not replayed or cleared.\n", j); + log_err( _("jid=%u: Dirty journal not replayed or cleared.\n"), j); } out: - log_info("jid=%u: %s\n", j, (error) ? "Failed" : "Done"); + log_info( _("jid=%u: %s\n"), j, (error) ? "Failed" : "Done"); return error; } @@ -397,7 +399,7 @@ out: int replay_journals(struct gfs2_sbd *sdp){ int i; - log_notice("Recovering journals (this may take a while)"); + log_notice( _("Recovering journals (this may take a while)")); /* Get master dinode */ sdp->master_dir = gfs2_load_inode(sdp, @@ -406,7 +408,7 @@ int replay_journals(struct gfs2_sbd *sdp){ /* read in the journal index data */ if (ji_update(sdp)){ - log_err("Unable to read in jindex inode.\n"); + log_err( _("Unable to read in jindex inode.\n")); return -1; } @@ -417,7 +419,7 @@ int replay_journals(struct gfs2_sbd *sdp){ inode_put(sdp->md.journal[i], (opts.no ? not_updated : updated)); } - log_notice("\nJournal recovery complete.\n"); + log_notice( _("\nJournal recovery complete.\n")); inode_put(sdp->master_dir, not_updated); inode_put(sdp->md.jiinode, not_updated); /* Sync the buffers to disk so we get a fresh start. */ diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c index 198009f..e06b4b6 100644 --- a/gfs2/fsck/initialize.c +++ b/gfs2/fsck/initialize.c @@ -7,6 +7,8 @@ #include <fcntl.h> #include <string.h> #include <unistd.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -79,12 +81,12 @@ static void empty_super_block(struct gfs2_sbd *sdp) { uint32_t i; - log_info("Freeing buffers.\n"); + log_info( _("Freeing buffers.\n")); while(!osi_list_empty(&sdp->rglist)){ struct rgrp_list *rgd; rgd = osi_list_entry(sdp->rglist.next, struct rgrp_list, list); - log_debug("Deleting rgd for 0x%llx: rgd=0x%p bits=0x%p\n", + log_debug( _("Deleting rgd for 0x%llx: rgd=0x%p bits=0x%p\n"), (unsigned long long)rgd->ri.ri_addr, rgd, rgd->bits); osi_list_del(&rgd->list); if(rgd->bits) @@ -131,7 +133,7 @@ static int set_block_ranges(struct gfs2_sbd *sdp) uint64_t rmin = 0; int error; - log_info("Setting block ranges...\n"); + log_info( _("Setting block ranges...\n")); for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next) { @@ -145,8 +147,8 @@ static int set_block_ranges(struct gfs2_sbd *sdp) last_fs_block = rmax; if (last_fs_block > 0xffffffff && sizeof(unsigned long) <= 4) { - log_crit("This file system is too big for this computer to handle.\n"); - log_crit("Last fs block = 0x%llx, but sizeof(unsigned long) is %lu bytes.\n", + log_crit( _("This file system is too big for this computer to handle.\n")); + log_crit( _("Last fs block = 0x%llx, but sizeof(unsigned long) is %lu bytes.\n"), (unsigned long long)last_fs_block, sizeof(unsigned long)); goto fail; @@ -156,16 +158,16 @@ static int set_block_ranges(struct gfs2_sbd *sdp) first_data_block = rmin; if(fsck_lseek(sdp->device_fd, (last_fs_block * sdp->sd_sb.sb_bsize))){ - log_crit("Can't seek to last block in file system: %" - PRIu64" (0x%" PRIx64 ")\n", last_fs_block, last_fs_block); + log_crit( _("Can't seek to last block in file system: %" + PRIu64" (0x%" PRIx64 ")\n"), last_fs_block, last_fs_block); goto fail; } memset(buf, 0, sdp->sd_sb.sb_bsize); error = read(sdp->device_fd, buf, sdp->sd_sb.sb_bsize); if (error != sdp->sd_sb.sb_bsize){ - log_crit("Can't read last block in file system (error %u), " - "last_fs_block: %"PRIu64" (0x%" PRIx64 ")\n", error, + log_crit( _("Can't read last block in file system (error %u), " + "last_fs_block: %"PRIu64" (0x%" PRIx64 ")\n"), error, last_fs_block, last_fs_block); goto fail; } @@ -194,7 +196,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp) ****************** Initialize important inodes ****************** *******************************************************************/ - log_info("Initializing special inodes...\n"); + log_info( _("Initializing special inodes...\n")); /* Get master dinode */ sdp->master_dir = gfs2_load_inode(sdp, @@ -234,42 +236,42 @@ static int init_system_inodes(struct gfs2_sbd *sdp) /* read in the ji data */ if (ji_update(sdp)){ - log_err("Unable to read in ji inode.\n"); + log_err( _("Unable to read in ji inode.\n")); return -1; } - log_warn("Validating Resource Group index.\n"); + log_warn( _("Validating Resource Group index.\n")); for (trust_lvl = blind_faith; trust_lvl <= distrust; trust_lvl++) { - log_warn("Level %d RG check.\n", trust_lvl + 1); + log_warn( _("Level %d RG check.\n"), trust_lvl + 1); if ((rg_repair(sdp, trust_lvl, &rgcount) == 0) && (ri_update(sdp, 0, &rgcount) == 0)) { - log_err("(level %d passed)\n", trust_lvl + 1); + log_err( _("(level %d passed)\n"), trust_lvl + 1); break; } else - log_err("(level %d failed)\n", trust_lvl + 1); + log_err( _("(level %d failed)\n"), trust_lvl + 1); } if (trust_lvl > distrust) { - log_err("RG recovery impossible; I can't fix this file system.\n"); + log_err( _("RG recovery impossible; I can't fix this file system.\n")); return -1; } - log_info("%u resource groups found.\n", rgcount); + log_info( _("%u resource groups found.\n"), rgcount); /******************************************************************* ******* Now, set boundary fields in the super block ************* *******************************************************************/ if(set_block_ranges(sdp)){ - log_err("Unable to determine the boundaries of the" - " file system.\n"); + log_err( _("Unable to determine the boundaries of the" + " file system.\n")); goto fail; } bl = gfs2_block_list_create(sdp, last_fs_block+1, &addl_mem_needed); if (!bl) { - log_crit("This system doesn't have enough memory + swap space to fsck this file system.\n"); - log_crit("Additional memory needed is approximately: %lluMB\n", + log_crit( _("This system doesn't have enough memory + swap space to fsck this file system.\n")); + log_crit( _("Additional memory needed is approximately: %lluMB\n"), (unsigned long long)(addl_mem_needed / 1048576ULL)); - log_crit("Please increase your swap space by that amount and run gfs2_fsck again.\n"); + log_crit( _("Please increase your swap space by that amount and run gfs2_fsck again.\n")); goto fail; } return 0; @@ -294,7 +296,7 @@ static int fill_super_block(struct gfs2_sbd *sdp) /******************************************************************** ***************** First, initialize all lists ********************** ********************************************************************/ - 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); @@ -310,8 +312,8 @@ static int fill_super_block(struct gfs2_sbd *sdp) sdp->bsize = sdp->sd_sb.sb_bsize; if(sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize){ - log_crit("GFS superblock is larger than the blocksize!\n"); - log_debug("sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize\n"); + log_crit( _("GFS superblock is larger than the blocksize!\n")); + log_debug( _("sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize\n")); return -1; } @@ -331,13 +333,13 @@ int initialize(struct gfs2_sbd *sbp) { if(opts.no) { if ((sbp->device_fd = open(opts.device, O_RDONLY)) < 0) { - log_crit("Unable to open device: %s\n", opts.device); + log_crit( _("Unable to open device: %s\n"), opts.device); return FSCK_USAGE; } } else { /* read in sb from disk */ if ((sbp->device_fd = open(opts.device, O_RDWR)) < 0){ - log_crit("Unable to open device: %s\n", opts.device); + log_crit( _("Unable to open device: %s\n"), opts.device); return FSCK_USAGE; } } @@ -349,7 +351,7 @@ int initialize(struct gfs2_sbd *sbp) /* Change lock protocol to be fsck_* instead of lock_* */ if(!opts.no) { if(block_mounters(sbp, 1)) { - log_err("Unable to block other mounters\n"); + log_err( _("Unable to block other mounters\n")); return FSCK_USAGE; } } @@ -373,10 +375,10 @@ static void destroy_sbp(struct gfs2_sbd *sbp) { if(!opts.no) { if(block_mounters(sbp, 0)) { - log_warn("Unable to unblock other mounters - manual intervention required\n"); - log_warn("Use 'gfs2_tool sb <device> proto' to fix\n"); + log_warn( _("Unable to unblock other mounters - manual intervention required\n")); + log_warn( _("Use 'gfs2_tool sb <device> proto' to fix\n")); } - log_info("Syncing the device.\n"); + log_info( _("Syncing the device.\n")); fsync(sbp->device_fd); } empty_super_block(sbp); diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c index 1e5fe7f..9666f63 100644 --- a/gfs2/fsck/link.c +++ b/gfs2/fsck/link.c @@ -3,6 +3,8 @@ #include <stdint.h> #include <string.h> #include <unistd.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -12,15 +14,15 @@ int set_link_count(struct gfs2_sbd *sbp, uint64_t inode_no, uint32_t count) { struct inode_info *ii = NULL; - log_debug("Setting link count to %u for %" PRIu64 " (0x%" PRIx64 ")\n", + log_debug( _("Setting link count to %u for %" PRIu64 " (0x%" PRIx64 ")\n"), count, inode_no, inode_no); /* If the list has entries, look for one that matches * inode_no */ ii = inode_hash_search(inode_hash, inode_no); if(ii) { if(ii->link_count) { - log_err("Link count already set for inode #%" PRIu64 " (0x%" - PRIx64 ")!\n", inode_no, inode_no); + log_err( _("Link count already set for inode #%" PRIu64 " (0x%" + PRIx64 ")!\n"), inode_no, inode_no); stack; return -1; } @@ -31,7 +33,7 @@ int set_link_count(struct gfs2_sbd *sbp, uint64_t inode_no, uint32_t count) /* If not match was found, add a new entry and set it's * link count to count*/ if(!(ii = (struct inode_info *) malloc(sizeof(*ii)))) { - log_err("Unable to allocate inode_info structure\n"); + log_err( _("Unable to allocate inode_info structure\n")); stack; return -1; } @@ -52,21 +54,21 @@ int increment_link(struct gfs2_sbd *sbp, uint64_t inode_no) * inode_no */ if(ii) { ii->counted_links++; - log_debug("Incremented counted links to %u for %"PRIu64" (0x%" - PRIx64 ")\n", ii->counted_links, inode_no, inode_no); + log_debug( _("Incremented counted links to %u for %"PRIu64" (0x%" + PRIx64 ")\n"), ii->counted_links, inode_no, inode_no); return 0; } - log_debug("No match found when incrementing link for %" PRIu64 - " (0x%" PRIx64 ")!\n", inode_no, inode_no); + log_debug( _("No match found when incrementing link for %" PRIu64 + " (0x%" PRIx64 ")!\n"), inode_no, inode_no); /* If no match was found, add a new entry and set its * counted links to 1 */ if(!(ii = (struct inode_info *) malloc(sizeof(*ii)))) { - log_err("Unable to allocate inode_info structure\n"); + log_err( _("Unable to allocate inode_info structure\n")); stack; return -1; } if(!memset(ii, 0, sizeof(*ii))) { - log_err("Unable to zero inode_info structure\n"); + log_err( _("Unable to zero inode_info structure\n")); stack; return -1; } @@ -84,13 +86,13 @@ int decrement_link(struct gfs2_sbd *sbp, uint64_t inode_no) ii = inode_hash_search(inode_hash, inode_no); /* If the list has entries, look for one that matches * inode_no */ - log_err("Decrementing %"PRIu64" (0x%" PRIx64 ")\n", inode_no, inode_no); + log_err( _("Decrementing %"PRIu64" (0x%" PRIx64 ")\n"), inode_no, inode_no); if(ii) { ii->counted_links--; return 0; } - log_debug("No match found when decrementing link for %" PRIu64 - " (0x%" PRIx64 ")!\n", inode_no, inode_no); + log_debug( _("No match found when decrementing link for %" PRIu64 + " (0x%" PRIx64 ")!\n"), inode_no, inode_no); return -1; } diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c index 4310770..4170380 100644 --- a/gfs2/fsck/lost_n_found.c +++ b/gfs2/fsck/lost_n_found.c @@ -5,6 +5,8 @@ #include <sys/stat.h> #include <unistd.h> #include <dirent.h> +#include <libintl.h> +#define _(String) gettext(String) #include "fsck.h" #include "libgfs2.h" @@ -29,7 +31,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){ if(!lf_dip) { struct gfs2_block_query q = {0}; - log_info("Locating/Creating lost and found directory\n"); + log_info( _("Locating/Creating lost and found directory\n")); lf_dip = createi(ip->i_sbd->md.rooti, "lost+found", S_IFDIR | 0700, 0); if(gfs2_block_check(ip->i_sbd, bl, lf_dip->i_di.di_num.no_addr, &q)) { @@ -54,30 +56,30 @@ int add_inode_to_lf(struct gfs2_inode *ip){ } } if(ip->i_di.di_num.no_addr == lf_dip->i_di.di_num.no_addr) { - log_err("Trying to add lost+found to itself...skipping"); + log_err( _("Trying to add lost+found to itself...skipping")); return 0; } switch(ip->i_di.di_mode & S_IFMT){ case S_IFDIR: - log_info("Adding .. entry pointing to lost+found for %llu\n", + log_info( _("Adding .. entry pointing to lost+found for %llu\n"), (unsigned long long)ip->i_di.di_num.no_addr); sprintf(tmp_name, ".."); filename_len = strlen(tmp_name); /* no trailing NULL */ if(!(filename = malloc((sizeof(char) * filename_len) + 1))) { - log_err("Unable to allocate name\n"); + log_err( _("Unable to allocate name\n")); stack; return -1; } if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) { - log_err("Unable to zero name\n"); + log_err( _("Unable to zero name\n")); stack; return -1; } memcpy(filename, tmp_name, filename_len); if(gfs2_dirent_del(ip, NULL, filename, filename_len)) - log_warn("add_inode_to_lf: " - "Unable to remove \"..\" directory entry.\n"); + log_warn( _("add_inode_to_lf: " + "Unable to remove \"..\" directory entry.\n")); dir_add(ip, filename, filename_len, &(lf_dip->i_di.di_num), DT_DIR); free(filename); @@ -123,12 +125,12 @@ int add_inode_to_lf(struct gfs2_inode *ip){ } filename_len = strlen(tmp_name); /* no trailing NULL */ if(!(filename = malloc(sizeof(char) * filename_len))) { - log_err("Unable to allocate name\n"); + log_err( _("Unable to allocate name\n")); stack; return -1; } if(!memset(filename, 0, sizeof(char) * filename_len)) { - log_err("Unable to zero name\n"); + log_err( _("Unable to zero name\n")); stack; return -1; } @@ -140,7 +142,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){ increment_link(ip->i_sbd, lf_dip->i_di.di_num.no_addr); free(filename); - log_notice("Added inode #%llu to lost+found dir\n", + log_notice( _("Added inode #%llu to lost+found dir\n"), (unsigned long long)ip->i_di.di_num.no_addr); return 0; } diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c index 3481b4f..6cc937a 100644 --- a/gfs2/fsck/main.c +++ b/gfs2/fsck/main.c @@ -7,6 +7,8 @@ #include <stdarg.h> #include <ctype.h> #include <signal.h> +#include <libintl.h> +#define _(String) gettext(String) #include "copyright.cf" #include "libgfs2.h" @@ -39,14 +41,14 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...) void usage(char *name) { - printf("Usage: %s [-hnqvVy] <device> \n", basename(name)); + printf( _("Usage: %s [-hnqvVy] <device> \n"), basename(name)); } void version(void) { - printf("GFS2 fsck %s (built %s %s)\n", + printf( _("GFS2 fsck %s (built %s %s)\n"), RELEASE_VERSION, __DATE__, __TIME__); - printf("%s\n", REDHAT_COPYRIGHT); + printf( _(REDHAT_COPYRIGHT "\n")); } int read_cmdline(int argc, char **argv, struct gfs2_options *opts) @@ -78,11 +80,11 @@ int read_cmdline(int argc, char **argv, struct gfs2_options *opts) break; case ':': case '?': - fprintf(stderr, "Please use '-h' for usage.\n"); + fprintf(stderr, _("Please use '-h' for usage.\n")); return FSCK_USAGE; default: - fprintf(stderr, "Bad programmer! You forgot to catch" - " the %c flag\n", c); + fprintf(stderr, _("Bad programmer! You forgot to catch" + " the %c flag\n"), c); return FSCK_USAGE; } @@ -90,11 +92,11 @@ int read_cmdline(int argc, char **argv, struct gfs2_options *opts) if(argc > optind) { opts->device = (argv[optind]); if(!opts->device) { - fprintf(stderr, "Please use '-h' for usage.\n"); + fprintf(stderr, _("Please use '-h' for usage.\n")); return FSCK_USAGE; } } else { - fprintf(stderr, "No device specified. Use '-h' for usage.\n"); + fprintf(stderr, _("No device specified. Use '-h' for usage.\n")); return FSCK_USAGE; } return 0; @@ -106,15 +108,15 @@ void interrupt(int sig) char progress[PATH_MAX]; if (!last_reported_block || last_reported_block == last_fs_block) - sprintf(progress, "progress unknown.\n"); + sprintf(progress, _("progress unknown.\n")); else - sprintf(progress, "processing block %" PRIu64 " out of %" - PRIu64 "\n", last_reported_block, last_fs_block); + sprintf(progress, _("processing block %" PRIu64 " out of %" + PRIu64 "\n"), last_reported_block, last_fs_block); response = generic_interrupt("gfs2_fsck", pass, progress, - "Do you want to abort gfs2_fsck, skip " \ + _("Do you want to abort gfs2_fsck, skip " \ "the rest of this pass or continue " \ - "(a/s/c)?", "asc"); + "(a/s/c)?"), "asc"); if(tolower(response) == 's') { skip_this_pass = TRUE; return; @@ -134,20 +136,20 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename, uint64_t iblock = 0; struct dir_status ds = {0}; - log_info("Checking system inode '%s'\n", filename); + log_info( _("Checking system inode '%s'\n"), filename); if (sysinode) { /* Read in the system inode, look at its dentries, and start * reading through them */ iblock = sysinode->i_di.di_num.no_addr; - log_info("System inode for '%s' is located at block %" - PRIu64 " (0x%" PRIx64 ")\n", filename, + log_info( _("System inode for '%s' is located at block %" + PRIu64 " (0x%" PRIx64 ")\n"), filename, iblock, iblock); /* FIXME: check this block's validity */ if(gfs2_block_check(sysinode->i_sbd, bl, iblock, &ds.q)) { - log_crit("Can't get %s inode block %" PRIu64 " (0x%" - PRIx64 ") from block list\n", filename, + log_crit( _("Can't get %s inode block %" PRIu64 " (0x%" + PRIx64 ") from block list\n"), filename, iblock, iblock); return -1; } @@ -156,7 +158,7 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename, /* bitmap. In that case, don't rebuild the inode. */ /* Just reuse the inode and fix the bitmap. */ if (ds.q.block_type == gfs2_block_free) { - log_info("The inode exists but the block is not marked 'in use'; fixing it.\n"); + log_info( _("The inode exists but the block is not marked 'in use'; fixing it.\n")); gfs2_block_set(sysinode->i_sbd, bl, sysinode->i_di.di_num.no_addr, mark); @@ -167,16 +169,16 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename, } } else - log_info("System inode for '%s' is missing.\n", filename); + log_info( _("System inode for '%s' is missing.\n"), filename); /* If there are errors with the inode here, we need to * create a new inode and get it all setup - of course, * everything will be in lost+found then, but we *need* our * system inodes before we can do any of that. */ if(!sysinode || ds.q.block_type != mark) { - log_err("Invalid or missing %s system inode.\n", filename); + log_err( _("Invalid or missing %s system inode.\n"), filename); errors_found++; if ((errors_corrected += - query(&opts, "Create new %s system inode? (y/n) ", + query(&opts, _("Create new %s system inode? (y/n) "), filename))) { builder(sysinode->i_sbd); gfs2_block_set(sysinode->i_sbd, bl, @@ -188,7 +190,7 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename, sysinode->i_di.di_num.no_addr); } else { - log_err("Cannot continue without valid %s inode\n", + log_err( _("Cannot continue without valid %s inode\n"), filename); return -1; } @@ -253,27 +255,30 @@ int main(int argc, char **argv) enum update_flags update_sys_files; int error = 0; + setlocale(LC_ALL, ""); + textdomain("fsck.gfs2"); + memset(sbp, 0, sizeof(*sbp)); if((error = read_cmdline(argc, argv, &opts))) exit(error); setbuf(stdout, NULL); - log_notice("Initializing fsck\n"); + log_notice( _("Initializing fsck\n")); if ((error = initialize(sbp))) exit(error); signal(SIGINT, interrupt); - log_notice("Starting pass1\n"); + log_notice( _("Starting pass1\n")); pass = "pass 1"; last_reported_block = 0; if ((error = pass1(sbp))) exit(error); if (skip_this_pass || fsck_abort) { skip_this_pass = FALSE; - log_notice("Pass1 interrupted \n"); + log_notice( _("Pass1 interrupted \n")); } else - log_notice("Pass1 complete \n"); + log_notice( _("Pass1 complete \n")); /* Make sure the system inodes are okay & represented in the bitmap. */ check_system_inodes(sbp); @@ -281,81 +286,81 @@ int main(int argc, char **argv) if (!fsck_abort) { last_reported_block = 0; pass = "pass 1b"; - log_notice("Starting pass1b\n"); + log_notice( _("Starting pass1b\n")); if((error = pass1b(sbp))) exit(error); if (skip_this_pass || fsck_abort) { skip_this_pass = FALSE; - log_notice("Pass1b interrupted \n"); + log_notice( _("Pass1b interrupted \n")); } else - log_notice("Pass1b complete\n"); + log_notice( _("Pass1b complete\n")); } if (!fsck_abort) { last_reported_block = 0; pass = "pass 1c"; - log_notice("Starting pass1c\n"); + log_notice( _("Starting pass1c\n")); if((error = pass1c(sbp))) exit(error); if (skip_this_pass || fsck_abort) { skip_this_pass = FALSE; - log_notice("Pass1c interrupted \n"); + log_notice( _("Pass1c interrupted \n")); } else - log_notice("Pass1c complete\n"); + log_notice( _("Pass1c complete\n")); } if (!fsck_abort) { last_reported_block = 0; pass = "pass 2"; - log_notice("Starting pass2\n"); + log_notice( _("Starting pass2\n")); if ((error = pass2(sbp))) exit(error); if (skip_this_pass || fsck_abort) { skip_this_pass = FALSE; - log_notice("Pass2 interrupted \n"); + log_notice( _("Pass2 interrupted \n")); } else - log_notice("Pass2 complete \n"); + log_notice( _("Pass2 complete \n")); } if (!fsck_abort) { last_reported_block = 0; pass = "pass 3"; - log_notice("Starting pass3\n"); + log_notice( _("Starting pass3\n")); if ((error = pass3(sbp))) exit(error); if (skip_this_pass || fsck_abort) { skip_this_pass = FALSE; - log_notice("Pass3 interrupted \n"); + log_notice( _("Pass3 interrupted \n")); } else - log_notice("Pass3 complete \n"); + log_notice( _("Pass3 complete \n")); } if (!fsck_abort) { last_reported_block = 0; pass = "pass 4"; - log_notice("Starting pass4\n"); + log_notice( _("Starting pass4\n")); if ((error = pass4(sbp))) exit(error); if (skip_this_pass || fsck_abort) { skip_this_pass = FALSE; - log_notice("Pass4 interrupted \n"); + log_notice( _("Pass4 interrupted \n")); } else - log_notice("Pass4 complete \n"); + log_notice( _("Pass4 complete \n")); } if (!fsck_abort) { last_reported_block = 0; pass = "pass 5"; - log_notice("Starting pass5\n"); + log_notice( _("Starting pass5\n")); if ((error = pass5(sbp))) exit(error); if (skip_this_pass || fsck_abort) { skip_this_pass = FALSE; - log_notice("Pass5 interrupted \n"); + log_notice( _("Pass5 interrupted \n")); error = FSCK_CANCELED; } else - log_notice("Pass5 complete \n"); + log_notice( _("Pass5 complete \n")); } else { error = FSCK_CANCELED; } @@ -375,11 +380,11 @@ int main(int argc, char **argv) inode_put(lf_dip, update_sys_files); if (!opts.no) - log_notice("Writing changes to disk\n"); + log_notice( _("Writing changes to disk\n")); bsync(&sbp->buf_list); bsync(&sbp->nvbuf_list); destroy(sbp); - log_notice("gfs2_fsck complete \n"); + log_notice( _("gfs2_fsck complete \n")); if (!error) { if (!errors_found) diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c index bb5dbd5..6f12655 100644 --- a/gfs2/fsck/metawalk.c +++ b/gfs2/fsck/metawalk.c @@ -5,6 +5,8 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -63,7 +65,7 @@ struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp, ip = calloc(1, sizeof(struct gfs2_inode)); if (ip == NULL) { - fprintf(stderr, "Out of memory in %s\n", __FUNCTION__); + fprintf(stderr, _("Out of memory in %s\n"), __FUNCTION__); exit(-1); } gfs2_dinode_in(&ip->i_di, bh->b_data); @@ -153,11 +155,11 @@ int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, else if (type == DIR_EXHASH) { dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_leaf)); leaf = (struct gfs2_leaf *)bh->b_data; - log_debug("Checking leaf %" PRIu64 " (0x%" PRIx64 ")\n", + log_debug( _("Checking leaf %" PRIu64 " (0x%" PRIx64 ")\n"), bh->b_blocknr, bh->b_blocknr); } else { - log_err("Invalid directory type %d specified\n", type); + log_err( _("Invalid directory type %d specified\n"), type); return -1; } @@ -172,16 +174,16 @@ int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, if (de.de_rec_len < sizeof(struct gfs2_dirent) + de.de_name_len || !de.de_name_len) { - log_err("Directory block %llu (0x%llx" + log_err( _("Directory block %llu (0x%llx" "), entry %d of directory %llu" - "(0x%llx) is corrupt.\n", + "(0x%llx) is corrupt.\n"), (unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr, (*count) + 1, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); errors_found++; - if (query(&opts, "Attempt to repair it? (y/n) ")) { + if (query(&opts, _("Attempt to repair it? (y/n) "))) { if (dirent_repair(ip, bh, &de, dent, type, first)) break; @@ -191,21 +193,21 @@ int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, } } else { - log_err("Corrupt directory entry ignored, " - "stopped after checking %d entries.\n", + log_err( _("Corrupt directory entry ignored, " + "stopped after checking %d entries.\n"), *count); break; } } if (!de.de_inum.no_formal_ino){ if(first){ - log_debug("First dirent is a sentinel (place holder).\n"); + log_debug( _("First dirent is a sentinel (place holder).\n")); first = 0; } else { /* FIXME: Do something about this */ - log_err("Directory entry with inode number of " + log_err( _("Directory entry with inode number of " "zero in leaf %llu (0x%llx) of " - "directory %llu (0x%llx)!\n", + "directory %llu (0x%llx)!\n"), (unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr, (unsigned long long)ip->i_di.di_num.no_addr, @@ -214,7 +216,7 @@ int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, } } else { if (!de.de_inum.no_addr && first) { /* reverse sentinel */ - log_debug("First dirent is a Sentinel (place holder).\n"); + log_debug( _("First dirent is a Sentinel (place holder).\n")); /* Swap the two to silently make it a proper sentinel */ de.de_inum.no_addr = de.de_inum.no_formal_ino; de.de_inum.no_formal_ino = 0; @@ -239,7 +241,7 @@ int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh, } if ((char *)dent + de.de_rec_len >= bh_end){ - log_debug("Last entry processed.\n"); + log_debug( _("Last entry processed.\n")); break; } @@ -263,8 +265,8 @@ void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no, const char *msg) { if (*bad_leaf != *leaf_no) { - log_err("Directory Inode %llu (0x%llx) points to leaf %llu" - " (0x%llx) %s.\n", + log_err( _("Directory Inode %llu (0x%llx) points to leaf %llu" + " (0x%llx) %s.\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)*leaf_no, @@ -272,12 +274,12 @@ void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no, } errors_found++; if (*leaf_no == *bad_leaf || - query(&opts, "Attempt to patch around it? (y/n) ")) { + query(&opts, _("Attempt to patch around it? (y/n) "))) { errors_corrected++; gfs2_put_leaf_nr(ip, index, old_leaf); } else - log_err("Bad leaf left in place.\n"); + log_err( _("Bad leaf left in place.\n")); *bad_leaf = *leaf_no; *leaf_no = old_leaf; } @@ -314,10 +316,10 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, continue; } else { if(ref_count != exp_count){ - log_err("Dir #%llu (0x%llx) has an incorrect " + log_err( _("Dir #%llu (0x%llx) has an incorrect " "number of pointers to leaf #%llu " " (0x%llx)\n\tFound: %u, Expected: " - "%u\n", (unsigned long long) + "%u\n"), (unsigned long long) ip->i_di.di_num.no_addr, (unsigned long long) ip->i_di.di_num.no_addr, @@ -325,7 +327,7 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, (unsigned long long)old_leaf, ref_count, exp_count); errors_found++; - if (query(&opts, "Attempt to fix it? (y/n) ")) + if (query(&opts, _("Attempt to fix it? (y/n) "))) { int factor = 0, divisor = ref_count; @@ -350,9 +352,9 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, do { /* Make sure the block number is in range. */ if(gfs2_check_range(ip->i_sbd, leaf_no)){ - log_err("Leaf block #%llu (0x%llx) is out " + log_err( _("Leaf block #%llu (0x%llx) is out " "of range for directory #%llu (0x%llx" - ").\n", (unsigned long long)leaf_no, + ").\n"), (unsigned long long)leaf_no, (unsigned long long)leaf_no, (unsigned long long) ip->i_di.di_num.no_addr, @@ -360,7 +362,7 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, ip->i_di.di_num.no_addr); warn_and_patch(ip, &leaf_no, &bad_leaf, old_leaf, index, - "that is out of range"); + _("that is out of range")); memcpy(&leaf, &oldleaf, sizeof(oldleaf)); break; } @@ -372,7 +374,7 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, if (gfs2_check_meta(lbh, GFS2_METATYPE_LF)) { warn_and_patch(ip, &leaf_no, &bad_leaf, old_leaf, index, - "that is not really a leaf"); + _("that is not really a leaf")); memcpy(&leaf, &oldleaf, sizeof(oldleaf)); brelse(lbh, (opts.no ? not_updated : updated)); break; @@ -391,18 +393,18 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, * values and replace them with the correct value. */ if (leaf.lf_dirent_format == (GFS2_FORMAT_DE << 16)) { - log_debug("incorrect lf_dirent_format at leaf #%" PRIu64 "\n", leaf_no); + log_debug( _("incorrect lf_dirent_format at leaf #%" PRIu64 "\n"), leaf_no); leaf.lf_dirent_format = GFS2_FORMAT_DE; gfs2_leaf_out(&leaf, lbh->b_data); - log_debug("Fixing lf_dirent_format.\n"); + log_debug( _("Fixing lf_dirent_format.\n")); *update = (opts.no ? not_updated : updated); } /* Make sure it's really a leaf. */ if (leaf.lf_header.mh_type != GFS2_METATYPE_LF) { - log_err("Inode %llu (0x%llx" + log_err( _("Inode %llu (0x%llx" ") points to bad leaf %llu" - " (0x%llx).\n", + " (0x%llx).\n"), (unsigned long long) ip->i_di.di_num.no_addr, (unsigned long long) @@ -413,7 +415,7 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, break; } exp_count = (1 << (ip->i_di.di_depth - leaf.lf_depth)); - log_debug("expected count %u - di_depth %u, leaf depth %u\n", + log_debug( _("expected count %u - di_depth %u, leaf depth %u\n"), exp_count, ip->i_di.di_depth, leaf.lf_depth); if(pass->check_dentry && @@ -442,11 +444,11 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, lbh = bread(&sbp->buf_list, leaf_no); gfs2_leaf_in(&leaf, lbh->b_data); - log_err("Leaf %llu (0x%llx) entry " + log_err( _("Leaf %llu (0x%llx) entry " "count in directory %llu" " (0x%llx) doesn't match " "number of entries found " - "- is %u, found %u\n", + "- is %u, found %u\n"), (unsigned long long)leaf_no, (unsigned long long)leaf_no, (unsigned long long) @@ -455,14 +457,14 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, ip->i_di.di_num.no_addr, leaf.lf_entries, count); errors_found++; - if(query(&opts, "Update leaf entry count? (y/n) ")) { + if(query(&opts, _("Update leaf entry count? (y/n) "))) { errors_corrected++; leaf.lf_entries = count; gfs2_leaf_out(&leaf, lbh->b_data); - log_warn("Leaf entry count updated\n"); + log_warn( _("Leaf entry count updated\n")); f = updated; } else - log_err("Leaf entry count left in inconsistant state\n"); + log_err( _("Leaf entry count left in inconsistant state\n")); brelse(lbh, f); } /* FIXME: Need to get entry count and @@ -473,7 +475,7 @@ int check_leaf(struct gfs2_inode *ip, enum update_flags *update, if(!leaf.lf_next) break; leaf_no = leaf.lf_next; - log_debug("Leaf chain detected.\n"); + log_debug( _("Leaf chain detected.\n")); } } while(1); old_leaf = leaf_no; @@ -532,8 +534,8 @@ static int check_eattr_entries(struct gfs2_inode *ip, update_it, pass->private)) { errors_found++; - if (query(&opts, "Repair the bad EA? " - "(y/n) ")) { + if (query(&opts, _("Repair the bad EA? " + "(y/n) "))) { errors_corrected++; ea_hdr->ea_num_ptrs = i; ea_hdr->ea_data_len = @@ -545,7 +547,7 @@ static int check_eattr_entries(struct gfs2_inode *ip, a single byte. */ return -1; } - log_err("The bad EA was not fixed.\n"); + log_err( _("The bad EA was not fixed.\n")); } tot_ealen += sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header); @@ -580,7 +582,7 @@ static int check_leaf_eattr(struct gfs2_inode *ip, uint64_t block, struct gfs2_buffer_head *bh = NULL; int error = 0; - log_debug("Checking EA leaf block #%"PRIu64" (0x%" PRIx64 ").\n", + log_debug( _("Checking EA leaf block #%"PRIu64" (0x%" PRIx64 ").\n"), block, block); if(pass->check_eattr_leaf) { @@ -618,7 +620,7 @@ static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect, struct gfs2_sbd *sdp = ip->i_sbd; *want_updated = not_updated; - log_debug("Checking EA indirect block #%"PRIu64" (0x%" PRIx64 ").\n", + log_debug( _("Checking EA indirect block #%"PRIu64" (0x%" PRIx64 ").\n"), indirect, indirect); if (!pass->check_eattr_indir) @@ -683,7 +685,7 @@ int check_inode_eattr(struct gfs2_inode *ip, enum update_flags *want_updated, return 0; } - log_debug("Extended attributes exist for inode #%llu (0x%llx).\n", + log_debug( _("Extended attributes exist for inode #%llu (0x%llx).\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); @@ -755,8 +757,8 @@ static int build_and_check_metalist(struct gfs2_inode *ip, goto fail; } if(err > 0) { - log_debug("Skipping block %" PRIu64 - " (0x%" PRIx64 ")\n", + log_debug( _("Skipping block %" PRIu64 + " (0x%" PRIx64 ")\n"), block, block); continue; } @@ -816,7 +818,7 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass) /* We don't need to record directory blocks - they will be * recorded later...i think... */ if (S_ISDIR(ip->i_di.di_mode)) - log_debug("Directory with height > 0 at %llu (0x%llx)\n", + log_debug( _("Directory with height > 0 at %llu (0x%llx)\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); @@ -952,10 +954,10 @@ int remove_dentry_from_dir(struct gfs2_sbd *sbp, uint64_t dir, struct gfs2_block_query q; int error; - log_debug("Removing dentry %" PRIu64 " (0x%" PRIx64 ") from directory %" - PRIu64" (0x%" PRIx64 ")\n", dentryblock, dentryblock, dir, dir); + log_debug( _("Removing dentry %" PRIu64 " (0x%" PRIx64 ") from directory %" + PRIu64" (0x%" PRIx64 ")\n"), dentryblock, dentryblock, dir, dir); if(gfs2_check_range(sbp, dir)) { - log_err("Parent directory out of range\n"); + log_err( _("Parent directory out of range\n")); return 1; } remove_dentry_fxns.private = &dentryblock; @@ -966,7 +968,7 @@ int remove_dentry_from_dir(struct gfs2_sbd *sbp, uint64_t dir, return -1; } if(q.block_type != gfs2_inode_dir) { - log_info("Parent block is not a directory...ignoring\n"); + log_info( _("Parent block is not a directory...ignoring\n")); return 1; } /* Need to run check_dir with a private var of dentryblock, diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c index 6a63338..eab90cb 100644 --- a/gfs2/fsck/pass1.c +++ b/gfs2/fsck/pass1.c @@ -16,6 +16,8 @@ #include <time.h> #include <sys/ioctl.h> #include <inttypes.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -72,7 +74,7 @@ static int leaf(struct gfs2_inode *ip, uint64_t block, { struct block_count *bc = (struct block_count *) private; - log_debug("\tLeaf block at %15" PRIu64 " (0x%" PRIx64 ")\n", + log_debug( _("\tLeaf block at %15" PRIu64 " (0x%" PRIx64 ")\n"), block, block); gfs2_block_set(ip->i_sbd, bl, block, gfs2_leaf_blk); bc->indir_count++; @@ -92,7 +94,7 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block, if (gfs2_check_range(ip->i_sbd, block)){ /* blk outside of FS */ gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr, gfs2_bad_block); - log_debug("Bad indirect block pointer (out of range).\n"); + log_debug( _("Bad indirect block pointer (out of range).\n")); return 1; } @@ -101,16 +103,16 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block, return -1; } if(q.block_type != gfs2_block_free) { - log_debug("Found duplicate block in indirect block -" - " was marked %d\n", q.block_type); + log_debug( _("Found duplicate block in indirect block -" + " was marked %d\n"), q.block_type); gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block); found_dup = 1; } nbh = bread(&ip->i_sbd->buf_list, block); if (gfs2_check_meta(nbh, GFS2_METATYPE_IN)){ - log_debug("Bad indirect block pointer " - "(points to something that is not an indirect block).\n"); + log_debug( _("Bad indirect block pointer " + "(points to something that is not an indirect block).\n")); if(!found_dup) { gfs2_block_set(ip->i_sbd, bl, block, gfs2_meta_inval); brelse(nbh, not_updated); @@ -119,7 +121,7 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block, }else /* blk check ok */ *bh = nbh; - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to indirect block.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to indirect block.\n"), block, block); gfs2_block_set(ip->i_sbd, bl, block, gfs2_indir_blk); bc->indir_count++; @@ -133,7 +135,7 @@ static int check_data(struct gfs2_inode *ip, uint64_t block, void *private) struct block_count *bc = (struct block_count *) private; if (gfs2_check_range(ip->i_sbd, block)) { - log_err( "Bad data block pointer (out of range)\n"); + log_err( _("Bad data block pointer (out of range)\n")); /* Mark the owner of this block with the bad_block * designator so we know to check it for out of range blocks later */ gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr, @@ -145,13 +147,13 @@ static int check_data(struct gfs2_inode *ip, uint64_t block, void *private) return -1; } if(q.block_type != gfs2_block_free) { - log_debug("Found duplicate block at %" PRIu64 " (0x%"PRIx64 ")\n", + log_debug( _("Found duplicate block at %" PRIu64 " (0x%"PRIx64 ")\n"), block, block); gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block); bc->data_count++; return 1; } - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to data block\n", block, + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to data block\n"), block, block); gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_used); bc->data_count++; @@ -174,15 +176,15 @@ static int clear_eas(struct gfs2_inode *ip, struct block_count *bc, struct gfs2_sbd *sdp = ip->i_sbd; *want_updated = not_updated; - log_err("Inode #%llu (0x%llx): %s", + log_err( _("Inode #%llu (0x%llx): %s"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, emsg); if (block) - log_err(" at block #%" PRIu64 " (0x%" PRIx64 ")", + log_err( _(" at block #%" PRIu64 " (0x%" PRIx64 ")"), block, block); log_err(".\n"); errors_found++; - if ((errors_corrected += query(&opts, "Clear the bad EA? (y/n) "))) { + if ((errors_corrected += query(&opts, _("Clear the bad EA? (y/n) ")))) { if (block == 0) block = ip->i_di.di_eattr; gfs2_block_clear(sdp, bl, block, gfs2_eattr_block); @@ -200,7 +202,7 @@ static int clear_eas(struct gfs2_inode *ip, struct block_count *bc, *want_updated = updated; return 1; } else { - log_err("The bad EA was not fixed.\n"); + log_err( _("The bad EA was not fixed.\n")); bc->ea_count++; return 0; } @@ -238,18 +240,18 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect, if(gfs2_check_meta(*bh, GFS2_METATYPE_IN)) { if(q.block_type != gfs2_block_free) { /* Duplicate? */ if (!clear_eas(ip, bc, indirect, 1, want_updated, - "Bad indirect EA duplicate found")) + _("Bad indirect EA duplicate found"))) gfs2_block_set(sdp, bl, indirect, gfs2_dup_block); return 1; } clear_eas(ip, bc, indirect, 0, want_updated, - "EA indirect block has incorrect type"); + _("EA indirect block has incorrect type")); return 1; } if(q.block_type != gfs2_block_free) { /* Duplicate? */ - log_err("Inode #%llu (0x%llx): Duplicate EA indirect " - "block found at #%llu (0x%llx).\n", + log_err( _("Inode #%llu (0x%llx): Duplicate EA indirect " + "block found at #%llu (0x%llx).\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)indirect, @@ -258,8 +260,8 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect, bc->ea_count++; ret = 1; } else { - log_debug("Setting #%" PRIu64 " (0x%" PRIx64 - ") to indirect EA block\n", indirect, indirect); + log_debug( _("Setting #%" PRIu64 " (0x%" PRIx64 + ") to indirect EA block\n"), indirect, indirect); gfs2_block_set(sdp, bl, indirect, gfs2_indir_blk); bc->ea_count++; } @@ -270,7 +272,7 @@ static int finish_eattr_indir(struct gfs2_inode *ip, int indir_ok, enum update_flags *want_updated, void *private) { if (indir_ok) { - log_debug("Marking inode #%llu (0x%llx) with eattr block\n", + log_debug( _("Marking inode #%llu (0x%llx) with eattr block\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); /* Mark the inode as having an eattr in the block map @@ -280,7 +282,7 @@ static int finish_eattr_indir(struct gfs2_inode *ip, int indir_ok, return 0; } clear_eas(ip, (struct block_count *)private, 0, 0, want_updated, - "has unrecoverable indirect EA errors"); + _("has unrecoverable indirect EA errors")); return 0; } @@ -310,8 +312,8 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr, int ret = 0; if(gfs2_check_range(sdp, el_blk)){ - log_err("Inode #%llu (0x%llx): EA extended " - "leaf block #%llu (0x%llx) is out of range.\n", + log_err( _("Inode #%llu (0x%llx): EA extended " + "leaf block #%llu (0x%llx) is out of range.\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)el_blk, @@ -333,22 +335,22 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr, if(gfs2_check_meta(el_buf, GFS2_METATYPE_ED)) { if(q.block_type != gfs2_block_free) /* Duplicate? */ clear_eas(ip, bc, el_blk, 1, want_updated, - "has bad extended EA duplicate"); + _("has bad extended EA duplicate")); else clear_eas(ip, bc, el_blk, 0, want_updated, - "EA extended leaf block has incorrect type"); + _("EA extended leaf block has incorrect type")); ret = 1; } else { /* If this looks like an EA */ if(q.block_type != gfs2_block_free) { /* Duplicate? */ - log_debug("Duplicate block found at #%" PRIu64 - " (0x%" PRIx64 ").\n", + log_debug( _("Duplicate block found at #%" PRIu64 + " (0x%" PRIx64 ").\n"), el_blk, el_blk); gfs2_block_set(sdp, bl, el_blk, gfs2_dup_block); bc->ea_count++; ret = 1; } else { - log_debug("Setting block #%" PRIu64 - " (0x%" PRIx64 ") to eattr block\n", + log_debug( _("Setting block #%" PRIu64 + " (0x%" PRIx64 ") to eattr block\n"), el_blk, el_blk); gfs2_block_set(sdp, bl, el_blk, gfs2_meta_eattr); bc->ea_count++; @@ -372,13 +374,13 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block, /* This inode contains an eattr - it may be invalid, but the * eattr attributes points to a non-zero block */ if (parent != ip->i_di.di_num.no_addr) { /* if parent isn't the inode */ - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to eattr block\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to eattr block\n"), parent, parent); gfs2_block_set(sdp, bl, parent, gfs2_eattr_block); } if(gfs2_check_range(sdp, block)){ - log_warn("Inode #%llu (0x%llx): EA leaf block #%llu (0x%llx" - ") is out of range.\n", + log_warn( _("Inode #%llu (0x%llx): EA leaf block #%llu (0x%llx" + ") is out of range.\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)block, (unsigned long long)block); @@ -398,25 +400,25 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block, if(gfs2_check_meta(leaf_bh, GFS2_METATYPE_EA)) { if(q.block_type != gfs2_block_free) { /* Duplicate? */ clear_eas(ip, bc, block, 1, want_updated, - "Bad EA duplicate found"); + _("Bad EA duplicate found")); } else { clear_eas(ip, bc, block, 0, want_updated, - "EA leaf block has incorrect type"); + _("EA leaf block has incorrect type")); } ret = 1; brelse(leaf_bh, not_updated); } else { /* If this looks like an EA */ if(q.block_type != gfs2_block_free) { /* Duplicate? */ - log_debug("Duplicate block found at #%" PRIu64 - " (0x%" PRIx64 ").\n", + log_debug( _("Duplicate block found at #%" PRIu64 + " (0x%" PRIx64 ").\n"), block, block); gfs2_block_set(sdp, bl, block, gfs2_dup_block); bc->ea_count++; ret = 1; brelse(leaf_bh, not_updated); } else { - log_debug("Setting block #%" PRIu64 - " (0x%" PRIx64 ") to eattr block\n", + log_debug( _("Setting block #%" PRIu64 + " (0x%" PRIx64 ") to eattr block\n"), block, block); gfs2_block_set(sdp, bl, block, gfs2_meta_eattr); @@ -464,7 +466,7 @@ static int check_eattr_entries(struct gfs2_inode *ip, if(max_ptrs > ea_hdr->ea_num_ptrs) { return 1; } else { - log_debug(" Pointers Required: %d\n Pointers Reported: %d\n", + log_debug( _(" Pointers Required: %d\n Pointers Reported: %d\n"), max_ptrs, ea_hdr->ea_num_ptrs); } } @@ -516,7 +518,7 @@ int clear_leaf(struct gfs2_inode *ip, uint64_t block, return -1; } if(!q.dup_block) { - log_crit("Setting leaf #%" PRIu64 " (0x%" PRIx64 ") invalid\n", + log_crit( _("Setting leaf #%" PRIu64 " (0x%" PRIx64 ") invalid\n"), block, block); if(gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_free)) { stack; @@ -539,17 +541,17 @@ int add_to_dir_list(struct gfs2_sbd *sbp, uint64_t block) * matter too much */ find_di(sbp, block, &di); if(di) { - log_err("Attempting to add directory block #%" PRIu64 - " (0x%" PRIx64 ") which is already in list\n", block, block); + log_err( _("Attempting to add directory block #%" PRIu64 + " (0x%" PRIx64 ") which is already in list\n"), block, block); return -1; } if(!(newdi = (struct dir_info *) malloc(sizeof(struct dir_info)))) { - log_crit("Unable to allocate dir_info structure\n"); + log_crit( _("Unable to allocate dir_info structure\n")); return -1; } if(!memset(newdi, 0, sizeof(*newdi))) { - log_crit("Error while zeroing dir_info structure\n"); + log_crit( _("Error while zeroing dir_info structure\n")); return -1; } @@ -575,21 +577,21 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, ip = fsck_inode_get(sdp, bh); if (ip->i_di.di_num.no_addr != block) { - log_err("Inode #%llu (0x%llx): Bad inode address found: %llu " - "(0x%llx)\n", (unsigned long long)block, + log_err( _("Inode #%llu (0x%llx): Bad inode address found: %llu " + "(0x%llx)\n"), (unsigned long long)block, (unsigned long long)block, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); errors_found++; if((errors_corrected += - query(&opts, "Fix address in inode at block #%" - PRIu64 " (0x%" PRIx64 ")? (y/n) ", block, block))) { + query(&opts, _("Fix address in inode at block #%" + PRIu64 " (0x%" PRIx64 ")? (y/n) "), block, block))) { ip->i_di.di_num.no_addr = ip->i_di.di_num.no_formal_ino = block; gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data); f = updated; } else - log_err("Address in inode at block #%" PRIu64 - " (0x%" PRIx64 ") not fixed\n", block, block); + log_err( _("Address in inode at block #%" PRIu64 + " (0x%" PRIx64 ") not fixed\n"), block, block); } if(gfs2_block_check(sdp, bl, block, &q)) { @@ -598,7 +600,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, return -1; } if(q.block_type != gfs2_block_free) { - log_debug("Found duplicate block at #%" PRIu64 " (0x%" PRIx64 ")\n", + log_debug( _("Found duplicate block at #%" PRIu64 " (0x%" PRIx64 ")\n"), block, block); if(gfs2_block_mark(sdp, bl, block, gfs2_dup_block)) { stack; @@ -612,7 +614,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, switch(ip->i_di.di_mode & S_IFMT) { case S_IFDIR: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to directory inode.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to directory inode.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_inode_dir)) { stack; @@ -626,7 +628,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, } break; case S_IFREG: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to file inode.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to file inode.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_inode_file)) { stack; @@ -635,7 +637,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, } break; case S_IFLNK: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to symlink inode.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to symlink inode.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_inode_lnk)) { stack; @@ -644,7 +646,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, } break; case S_IFBLK: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to block dev inode.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to block dev inode.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_inode_blk)) { stack; @@ -653,7 +655,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, } break; case S_IFCHR: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to char dev inode.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to char dev inode.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_inode_chr)) { stack; @@ -662,7 +664,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, } break; case S_IFIFO: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to fifo inode.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to fifo inode.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_inode_fifo)) { stack; @@ -671,7 +673,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, } break; case S_IFSOCK: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to socket inode.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to socket inode.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_inode_sock)) { stack; @@ -680,7 +682,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, } break; default: - log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to invalid.\n", + log_debug( _("Setting %" PRIu64 " (0x%" PRIx64 ") to invalid.\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) { stack; @@ -700,14 +702,14 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, /* FIXME: fix height and depth here - wasn't implemented in * old fsck either, so no biggy... */ if (ip->i_di.di_height < compute_height(sdp, ip->i_di.di_size)){ - log_warn("Dinode #%llu (0x%llx) has bad height " - "Found %u, Expected >= %u\n", + log_warn( _("Dinode #%llu (0x%llx) has bad height " + "Found %u, Expected >= %u\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, ip->i_di.di_height, compute_height(sdp, ip->i_di.di_size)); /* once implemented, remove continue statement */ - log_warn("Marking inode invalid\n"); + log_warn( _("Marking inode invalid\n")); if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) { stack; fsck_inode_put(ip, f); @@ -721,14 +723,14 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, if (S_ISDIR(ip->i_di.di_mode) && (ip->i_di.di_flags & GFS2_DIF_EXHASH)) { if (((1 << ip->i_di.di_depth) * sizeof(uint64_t)) != ip->i_di.di_size){ - log_warn("Directory dinode #%llu (0x%llx" - ") has bad depth. Found %u, Expected %u\n", + log_warn( _("Directory dinode #%llu (0x%llx" + ") has bad depth. Found %u, Expected %u\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, ip->i_di.di_depth, (1 >> (ip->i_di.di_size/sizeof(uint64_t)))); /* once implemented, remove continue statement */ - log_warn("Marking inode invalid\n"); + log_warn( _("Marking inode invalid\n")); if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) { stack; fsck_inode_put(ip, f); @@ -748,7 +750,7 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, return 0; } if(error > 0) { - log_warn("Marking inode #%llu (0x%llx) invalid\n", + log_warn( _("Marking inode #%llu (0x%llx) invalid\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); /* FIXME: Must set all leaves invalid as well */ @@ -764,8 +766,8 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, if (ip->i_di.di_blocks != (1 + bc.indir_count + bc.data_count + bc.ea_count)) { - log_err("Inode #%llu (0x%llx): Ondisk block count (%llu" - ") does not match what fsck found (%llu)\n", + log_err( _("Inode #%llu (0x%llx): Ondisk block count (%llu" + ") does not match what fsck found (%llu)\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_blocks, @@ -773,14 +775,14 @@ int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, bc.data_count + bc.ea_count); errors_found++; if ((errors_corrected += - query(&opts, "Fix ondisk block count? (y/n) "))) { + query(&opts, _("Fix ondisk block count? (y/n) ")))) { ip->i_di.di_blocks = 1 + bc.indir_count + bc.data_count + bc.ea_count; gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data); f = updated; } else - log_err("Bad block count for #%llu (0x%llx" - ") not fixed\n", + log_err( _("Bad block count for #%llu (0x%llx" + ") not fixed\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); } @@ -793,7 +795,7 @@ int scan_meta(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, uint64_t block) { if (gfs2_check_meta(bh, 0)) { - log_debug("Found invalid metadata at #%" PRIu64 " (0x%" PRIx64 ")\n", + log_debug( _("Found invalid metadata at #%" PRIu64 " (0x%" PRIx64 ")\n"), block, block); if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) { stack; @@ -803,7 +805,7 @@ int scan_meta(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh, return 0; } - log_debug("Checking metadata block #%" PRIu64 " (0x%" PRIx64 ")\n", block, + log_debug( _("Checking metadata block #%" PRIu64 " (0x%" PRIx64 ")\n"), block, block); if (!gfs2_check_meta(bh, GFS2_METATYPE_DI)) { @@ -867,14 +869,14 @@ int pass1(struct gfs2_sbd *sbp) for (tmp = sbp->rglist.next; tmp != &sbp->rglist; tmp = tmp->next, rg_count++){ - log_info("Checking metadata in Resource Group #%" PRIu64 "\n", + log_info( _("Checking metadata in Resource Group #%" PRIu64 "\n"), rg_count); rgd = osi_list_entry(tmp, struct rgrp_list, list); if(gfs2_rgrp_read(sbp, rgd)){ stack; return FSCK_ERROR; } - log_debug("RG at %llu (0x%llx) is %u long\n", + log_debug( _("RG at %llu (0x%llx) is %u long\n"), (unsigned long long)rgd->ri.ri_addr, (unsigned long long)rgd->ri.ri_addr, rgd->ri.ri_length); @@ -900,7 +902,7 @@ int pass1(struct gfs2_sbd *sbp) return FSCK_OK; } if (skip_this_pass) { - printf("Skipping pass 1 is not a good idea.\n"); + printf( _("Skipping pass 1 is not a good idea.\n")); skip_this_pass = FALSE; fflush(stdout); } diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c index bcef089..ba3f860 100644 --- a/gfs2/fsck/pass1b.c +++ b/gfs2/fsck/pass1b.c @@ -2,6 +2,8 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -93,10 +95,9 @@ static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block, } static int check_eattr_entry(struct gfs2_inode *ip, - struct gfs2_buffer_head *leaf_bh, - struct gfs2_ea_header *ea_hdr, - struct gfs2_ea_header *ea_hdr_prev, - void *private) + struct gfs2_buffer_head *leaf_bh, + struct gfs2_ea_header *ea_hdr, + struct gfs2_ea_header *ea_hdr_prev, void *private) { return 0; } @@ -138,9 +139,9 @@ static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de, if(id->block_no == de->de_inum.no_addr) { id->name = strdup(filename); id->parent = ip->i_di.di_num.no_addr; - log_debug("Duplicate block %llu (0x%llx" + log_debug( _("Duplicate block %llu (0x%llx" ") is in file or directory %llu" - " (0x%llx) named %s\n", + " (0x%llx) named %s\n"), (unsigned long long)id->block_no, (unsigned long long)id->block_no, (unsigned long long) @@ -170,12 +171,12 @@ static int clear_dup_metalist(struct gfs2_inode *ip, uint64_t block, if(dh->ref_count == 1) return 1; if(block == dh->b->block_no) { - log_err("Found dup in inode \"%s\" (block #%llu" - ") with block #%llu\n", - dh->id->name ? dh->id->name : "unknown name", + log_err( _("Found dup in inode \"%s\" (block #%llu" + ") with block #%llu\n"), + dh->id->name ? dh->id->name : _("unknown name"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)block); - log_err("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n", + log_err( _("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n"), dh->id->name ? dh->id->name : "", dh->id->parent, dh->id->parent); inode_hash_remove(inode_hash, ip->i_di.di_num.no_addr); @@ -195,14 +196,14 @@ static int clear_dup_data(struct gfs2_inode *ip, uint64_t block, void *private) return 1; } if(block == dh->b->block_no) { - log_err("Found dup in inode \"%s\" for block #%llu" - " (0x%llx) at block #%llu (0x%llx)\n", - dh->id->name ? dh->id->name : "unknown name", + log_err( _("Found dup in inode \"%s\" for block #%llu" + " (0x%llx) at block #%llu (0x%llx)\n"), + dh->id->name ? dh->id->name : _("unknown name"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)block, (unsigned long long)block); - log_err("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n", + log_err( _("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n"), dh->id->name ? dh->id->name : "", dh->id->parent, dh->id->parent); inode_hash_remove(inode_hash, ip->i_di.di_num.no_addr); @@ -227,14 +228,14 @@ static int clear_dup_eattr_indir(struct gfs2_inode *ip, uint64_t block, if(dh->ref_count == 1) return 1; if(block == dh->b->block_no) { - log_err("Found dup in inode \"%s\" with address #%llu" - " (0x%llx) with block #%llu (0x%llx)\n", - dh->id->name ? dh->id->name : "unknown name", + log_err( _("Found dup in inode \"%s\" with address #%llu" + " (0x%llx) with block #%llu (0x%llx)\n"), + dh->id->name ? dh->id->name : _("unknown name"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)block, (unsigned long long)block); - log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n", + log_err( _("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n"), dh->id->name ? dh->id->name : "", dh->id->parent, dh->id->parent); gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_eattr, @@ -254,14 +255,14 @@ static int clear_dup_eattr_leaf(struct gfs2_inode *ip, uint64_t block, if(dh->ref_count == 1) return 1; if(block == dh->b->block_no) { - log_err("Found dup in inode \"%s\" with address #%llu" - " (0x%llx) with block #%llu (0x%llx)\n", - dh->id->name ? dh->id->name : "unknown name", + log_err( _("Found dup in inode \"%s\" with address #%llu" + " (0x%llx) with block #%llu (0x%llx)\n"), + dh->id->name ? dh->id->name : _("unknown name"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)block, (unsigned long long)block); - log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n", + log_err( _("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n"), dh->id->name ? dh->id->name : "", dh->id->parent, dh->id->parent); /* mark the main eattr block invalid */ @@ -307,7 +308,7 @@ static int clear_eattr_entry (struct gfs2_inode *ip, if(max_ptrs > ea_hdr->ea_num_ptrs) return 1; else { - log_debug(" Pointers Required: %d\n Pointers Reported: %d\n", + log_debug( _(" Pointers Required: %d\n Pointers Reported: %d\n"), max_ptrs, ea_hdr->ea_num_ptrs); } } @@ -328,13 +329,13 @@ static int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr, if(dh->ref_count == 1) return 1; if(block == dh->b->block_no) { - log_err("Found dup in inode \"%s\" with address #%llu" - " (0x%llx) with block #%llu (0x%llx)\n", - dh->id->name ? dh->id->name : "unknown name", + log_err( _("Found dup in inode \"%s\" with address #%llu" + " (0x%llx) with block #%llu (0x%llx)\n"), + dh->id->name ? dh->id->name : _("unknown name"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)block, (unsigned long long)block); - log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n", + log_err( _("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n"), dh->id->name ? dh->id->name : "", dh->id->parent, dh->id->parent); /* mark the main eattr block invalid */ @@ -366,15 +367,15 @@ int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct blocks *b) enum update_flags update; ip = fsck_load_inode(sbp, inode); /* bread, inode_get */ - log_info("Checking inode %" PRIu64 " (0x%" PRIx64 + log_info( _("Checking inode %" PRIu64 " (0x%" PRIx64 ")'s metatree for references to block %" PRIu64 " (0x%" PRIx64 - ")\n", inode, inode, b->block_no, b->block_no); + ")\n"), inode, inode, b->block_no, b->block_no); if(check_metatree(ip, &find_refs)) { stack; fsck_inode_put(ip, not_updated); /* out, brelse, free */ return -1; } - log_info("Done checking metatree\n"); + log_info( _("Done checking metatree\n")); /* Check for ea references in the inode */ if(check_inode_eattr(ip, &update, &find_refs) < 0){ stack; @@ -383,15 +384,15 @@ int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct blocks *b) } if (myfi.found) { if(!(id = malloc(sizeof(*id)))) { - log_crit("Unable to allocate inode_with_dups structure\n"); + log_crit( _("Unable to allocate inode_with_dups structure\n")); return -1; } if(!(memset(id, 0, sizeof(*id)))) { - log_crit("Unable to zero inode_with_dups structure\n"); + log_crit( _("Unable to zero inode_with_dups structure\n")); return -1; } - log_debug("Found %d entries with block %" PRIu64 - " (0x%" PRIx64 ") in inode #%" PRIu64 " (0x%" PRIx64 ")\n", + log_debug( _("Found %d entries with block %" PRIu64 + " (0x%" PRIx64 ") in inode #%" PRIu64 " (0x%" PRIx64 ")\n"), myfi.found, b->block_no, b->block_no, inode, inode); id->dup_count = myfi.found; id->block_no = inode; @@ -426,19 +427,19 @@ int handle_dup_blk(struct gfs2_sbd *sbp, struct blocks *b) dh.ref_inode_count++; dh.ref_count += id->dup_count; } - log_notice("Block %llu (0x%llx) has %d inodes referencing it" - " for a total of %d duplicate references\n", + log_notice( _("Block %llu (0x%llx) has %d inodes referencing it" + " for a total of %d duplicate references\n"), (unsigned long long)b->block_no, (unsigned long long)b->block_no, dh.ref_inode_count, dh.ref_count); osi_list_foreach(tmp, &b->ref_inode_list) { id = osi_list_entry(tmp, struct inode_with_dups, list); - log_warn("Inode %s has %d reference(s) to block %"PRIu64 - " (0x%" PRIx64 ")\n", id->name, id->dup_count, b->block_no, + log_warn( _("Inode %s has %d reference(s) to block %"PRIu64 + " (0x%" PRIx64 ")\n"), id->name, id->dup_count, b->block_no, b->block_no); /* FIXME: User input */ - log_warn("Clearing...\n"); + log_warn( _("Clearing...\n")); ip = fsck_load_inode(sbp, id->block_no); dh.b = b; dh.id = id; @@ -475,24 +476,24 @@ int pass1b(struct gfs2_sbd *sbp) find_dirents.check_dentry = &find_dentry; int rc = FSCK_OK; - log_info("Looking for duplicate blocks...\n"); + log_info( _("Looking for duplicate blocks...\n")); /* If there were no dups in the bitmap, we don't need to do anymore */ if(osi_list_empty(&sbp->dup_blocks.list)) { - log_info("No duplicate blocks found\n"); + log_info( _("No duplicate blocks found\n")); return FSCK_OK; } /* Rescan the fs looking for pointers to blocks that are in * the duplicate block map */ - log_info("Scanning filesystem for inodes containing duplicate blocks...\n"); - log_debug("Filesystem has %"PRIu64" (0x%" PRIx64 ") blocks total\n", + log_info( _("Scanning filesystem for inodes containing duplicate blocks...\n")); + log_debug( _("Filesystem has %"PRIu64" (0x%" PRIx64 ") blocks total\n"), last_fs_block, last_fs_block); for(i = 0; i < last_fs_block; i += 1) { warm_fuzzy_stuff(i); if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ goto out; - log_debug("Scanning block %" PRIu64 " (0x%" PRIx64 ") for inodes\n", + log_debug( _("Scanning block %" PRIu64 " (0x%" PRIx64 ") for inodes\n"), i, i); if(gfs2_block_check(sbp, bl, i, &q)) { stack; @@ -522,7 +523,7 @@ int pass1b(struct gfs2_sbd *sbp) /* Fix dups here - it's going to slow things down a lot to fix * it later */ - log_info("Handling duplicate blocks\n"); + log_info( _("Handling duplicate blocks\n")); out: while (!osi_list_empty(&sbp->dup_blocks.list)) { b = osi_list_entry(&sbp->dup_blocks.list.next, struct blocks, diff --git a/gfs2/fsck/pass1c.c b/gfs2/fsck/pass1c.c index 9fd21db..d83ff94 100644 --- a/gfs2/fsck/pass1c.c +++ b/gfs2/fsck/pass1c.c @@ -2,6 +2,8 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -13,7 +15,7 @@ static int remove_eattr_entry(struct gfs2_sbd *sdp, struct gfs2_ea_header *curr, struct gfs2_ea_header *prev) { - log_warn("Removing EA located in block #%"PRIu64" (0x%" PRIx64 ").\n", + log_warn( _("Removing EA located in block #%"PRIu64" (0x%" PRIx64 ").\n"), leaf_bh->b_blocknr, leaf_bh->b_blocknr); if(!prev) curr->ea_type = GFS2_EATYPE_UNUSED; @@ -37,9 +39,9 @@ int check_eattr_indir(struct gfs2_inode *ip, uint64_t block, *update = not_updated; if(gfs2_check_range(sbp, block)) { - log_err("Extended attributes indirect block #%llu" + log_err( _("Extended attributes indirect block #%llu" " (0x%llx) for inode #%llu" - " (0x%llx) out of range...removing\n", + " (0x%llx) out of range...removing\n"), (unsigned long long)block, (unsigned long long)block, (unsigned long long)ip->i_di.di_num.no_addr, @@ -53,9 +55,9 @@ int check_eattr_indir(struct gfs2_inode *ip, uint64_t block, return -1; } else if(q.block_type != gfs2_indir_blk) { - log_err("Extended attributes indirect block #%llu" + log_err( _("Extended attributes indirect block #%llu" " (0x%llx) for inode #%llu" - " (0x%llx) invalid...removing\n", + " (0x%llx) invalid...removing\n"), (unsigned long long)block, (unsigned long long)block, (unsigned long long)ip->i_di.di_num.no_addr, @@ -80,8 +82,8 @@ int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block, *update = not_updated; if(gfs2_check_range(sbp, block)) { - log_err("Extended attributes block for inode #%llu" - " (0x%llx) out of range...removing\n", + log_err( _("Extended attributes block for inode #%llu" + " (0x%llx) out of range...removing\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); ip->i_di.di_eattr = 0; @@ -93,8 +95,8 @@ int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block, return -1; } else if(q.block_type != gfs2_meta_eattr) { - log_err("Extended attributes block for inode #%llu" - " (0x%llx) invalid...removing\n", + log_err( _("Extended attributes block for inode #%llu" + " (0x%llx) invalid...removing\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); ip->i_di.di_eattr = 0; @@ -120,7 +122,7 @@ static int check_eattr_entry(struct gfs2_inode *ip, uint32_t max_size = sdp->sd_sb.sb_bsize; if(!ea_hdr->ea_name_len){ - log_err("EA has name length == 0\n"); + log_err( _("EA has name length == 0\n")); ea_hdr->ea_flags |= GFS2_EAFLAG_LAST; ea_hdr->ea_rec_len = cpu_to_be32(max_size - offset); if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){ @@ -130,7 +132,7 @@ static int check_eattr_entry(struct gfs2_inode *ip, return 1; } if(offset + be32_to_cpu(ea_hdr->ea_rec_len) > max_size){ - log_err("EA rec length too long\n"); + log_err( _("EA rec length too long\n")); ea_hdr->ea_flags |= GFS2_EAFLAG_LAST; ea_hdr->ea_rec_len = cpu_to_be32(max_size - offset); if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){ @@ -141,7 +143,7 @@ static int check_eattr_entry(struct gfs2_inode *ip, } if(offset + be32_to_cpu(ea_hdr->ea_rec_len) == max_size && (ea_hdr->ea_flags & GFS2_EAFLAG_LAST) == 0){ - log_err("last EA has no last entry flag\n"); + log_err( _("last EA has no last entry flag\n")); ea_hdr->ea_flags |= GFS2_EAFLAG_LAST; if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){ stack; @@ -150,7 +152,7 @@ static int check_eattr_entry(struct gfs2_inode *ip, return 1; } if(!ea_hdr->ea_name_len){ - log_err("EA has name length == 0\n"); + log_err( _("EA has name length == 0\n")); if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){ stack; return -1; @@ -164,7 +166,7 @@ static int check_eattr_entry(struct gfs2_inode *ip, if(!GFS2_EATYPE_VALID(ea_hdr->ea_type) && ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){ - log_err("EA (%s) type is invalid (%d > %d).\n", + log_err( _("EA (%s) type is invalid (%d > %d).\n"), ea_name, ea_hdr->ea_type, GFS2_EATYPE_LAST); if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){ stack; @@ -181,9 +183,9 @@ static int check_eattr_entry(struct gfs2_inode *ip, max_ptrs = (be32_to_cpu(ea_hdr->ea_data_len)+avail_size-1)/avail_size; if(max_ptrs > ea_hdr->ea_num_ptrs){ - log_err("EA (%s) has incorrect number of pointers.\n", ea_name); - log_err(" Required: %d\n" - " Reported: %d\n", + log_err( _("EA (%s) has incorrect number of pointers.\n"), ea_name); + log_err( _(" Required: %d\n" + " Reported: %d\n"), max_ptrs, ea_hdr->ea_num_ptrs); if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){ stack; @@ -191,7 +193,7 @@ static int check_eattr_entry(struct gfs2_inode *ip, } return 1; } else { - log_debug(" Pointers Required: %d\n Pointers Reported: %d\n", + log_debug( _(" Pointers Required: %d\n Pointers Reported: %d\n"), max_ptrs, ea_hdr->ea_num_ptrs); } } @@ -241,7 +243,7 @@ int pass1c(struct gfs2_sbd *sbp) pass1c_fxns.check_eattr_extentry = &check_eattr_extentry; pass1c_fxns.private = NULL; - log_info("Looking for inodes containing ea blocks...\n"); + log_info( _("Looking for inodes containing ea blocks...\n")); osi_list_foreach_safe(tmp, &sbp->eattr_blocks.list, x) { ea_block = osi_list_entry(tmp, struct special_blocks, list); block_no = ea_block->block; @@ -250,12 +252,12 @@ int pass1c(struct gfs2_sbd *sbp) return FSCK_OK; bh = bread(&sbp->buf_list, block_no); if (gfs2_check_meta(bh, GFS2_METATYPE_IN)) { /* if a dinode */ - log_info("EA in inode %"PRIu64" (0x%" PRIx64 ")\n", + log_info( _("EA in inode %"PRIu64" (0x%" PRIx64 ")\n"), block_no, block_no); gfs2_block_clear(sbp, bl, block_no, gfs2_eattr_block); ip = fsck_inode_get(sbp, bh); - log_debug("Found eattr at %llu (0x%llx)\n", + log_debug( _("Found eattr at %llu (0x%llx)\n"), (unsigned long long)ip->i_di.di_eattr, (unsigned long long)ip->i_di.di_eattr); /* FIXME: Handle walking the eattr here */ diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c index 6047408..290ebf3 100644 --- a/gfs2/fsck/pass2.c +++ b/gfs2/fsck/pass2.c @@ -4,6 +4,8 @@ #include <string.h> #include <inttypes.h> #include <sys/stat.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -24,9 +26,9 @@ int set_parent_dir(struct gfs2_sbd *sbp, uint64_t childblock, if(!find_di(sbp, childblock, &di)) { if(di->dinode == childblock) { if (di->treewalk_parent) { - log_err("Another directory at block %" PRIu64 + log_err( _("Another directory at block %" PRIu64 " (0x%" PRIx64 ") already contains" - " this child - checking %" PRIu64 " (0x%" PRIx64 ")\n", + " this child - checking %" PRIu64 " (0x%" PRIx64 ")\n"), di->treewalk_parent, di->treewalk_parent, parentblock, parentblock); return 1; @@ -34,8 +36,8 @@ int set_parent_dir(struct gfs2_sbd *sbp, uint64_t childblock, di->treewalk_parent = parentblock; } } else { - log_err("Unable to find block %"PRIu64" (0x%" PRIx64 - ") in dir_info list\n", childblock, childblock); + log_err( _("Unable to find block %"PRIu64" (0x%" PRIx64 + ") in dir_info list\n"), childblock, childblock); return -1; } @@ -55,17 +57,17 @@ int set_dotdot_dir(struct gfs2_sbd *sbp, uint64_t childblock, if(di->dotdot_parent && sbp->md.rooti->i_di.di_num.no_addr != di->dinode) { /* This should never happen */ - log_crit("Dotdot parent already set for" + log_crit( _("Dotdot parent already set for" " block %"PRIu64" (0x%" PRIx64 ") -> %" PRIu64 - " (0x%" PRIx64 ")\n", childblock, childblock, + " (0x%" PRIx64 ")\n"), childblock, childblock, di->dotdot_parent, di->dotdot_parent); return -1; } di->dotdot_parent = parentblock; } } else { - log_err("Unable to find block %"PRIu64" (0x%" PRIx64 - ") in dir_info list\n", childblock, childblock); + log_err( _("Unable to find block %"PRIu64" (0x%" PRIx64 + ") in dir_info list\n"), childblock, childblock); return -1; } @@ -133,7 +135,7 @@ static int check_file_type(uint8_t de_type, uint8_t block_type) return 1; break; default: - log_err("Invalid block type\n"); + log_err( _("Invalid block type\n")); return -1; break; } @@ -172,9 +174,9 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, /* Start of checks */ if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len)){ - log_err("Dir entry with bad record or name length\n" + log_err( _("Dir entry with bad record or name length\n" "\tRecord length = %u\n" - "\tName length = %u\n", + "\tName length = %u\n"), de->de_rec_len, de->de_name_len); gfs2_block_set(sbp, bl, ip->i_di.di_num.no_addr, @@ -186,23 +188,23 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, calculated_hash = gfs2_disk_hash(filename, de->de_name_len); if (de->de_hash != calculated_hash){ - log_err("Dir entry with bad hash or name length\n" + log_err( _("Dir entry with bad hash or name length\n" "\tHash found = %u (0x%x)\n" - "\tFilename = %s\n", de->de_hash, de->de_hash, + "\tFilename = %s\n"), de->de_hash, de->de_hash, filename); - log_err("\tName length found = %u\n" - "\tHash expected = %u (0x%x)\n", + log_err( _("\tName length found = %u\n" + "\tHash expected = %u (0x%x)\n"), de->de_name_len, calculated_hash, calculated_hash); errors_found++; - if(query(&opts, "Fix directory hash for %s? (y/n) ", + if(query(&opts, _("Fix directory hash for %s? (y/n) "), filename)) { errors_corrected++; de->de_hash = calculated_hash; gfs2_dirent_out(de, (char *)dent); - log_err("Directory entry hash for %s fixed.\n", filename); + log_err( _("Directory entry hash for %s fixed.\n"), filename); } else { - log_err("Directory entry hash for %s not fixed.\n", filename); + log_err( _("Directory entry hash for %s not fixed.\n"), filename); return 1; } } @@ -215,18 +217,18 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, strncpy(tmp_name, filename, MAX_FILENAME - 1); if(gfs2_check_range(ip->i_sbd, entryblock)) { - log_err("Block # referenced by directory entry %s is out of range\n", + log_err( _("Block # referenced by directory entry %s is out of range\n"), tmp_name); errors_found++; if(query(&opts, - "Clear directory entry tp out of range block? (y/n) ")) { + _("Clear directory entry tp out of range block? (y/n) "))) { errors_corrected++; - log_err("Clearing %s\n", tmp_name); + log_err( _("Clearing %s\n"), tmp_name); dirent2_del(ip, bh, prev_de, dent); *update = updated; return 1; } else { - log_err("Directory entry to out of range block remains\n"); + log_err( _("Directory entry to out of range block remains\n")); (*count)++; ds->entry_count++; return 0; @@ -243,10 +245,10 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, /* FIXME: user interface */ /* FIXME: do i want to kill the inode here? */ /* Handle bad blocks */ - log_err("Found a bad directory entry: %s\n", filename); + log_err( _("Found a bad directory entry: %s\n"), filename); errors_found++; - if(query(&opts, "Clear entry to inode containing bad blocks? (y/n)")) { + if(query(&opts, _("Clear entry to inode containing bad blocks? (y/n)"))) { errors_corrected++; entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr); @@ -263,7 +265,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, *update = updated; return 1; } else { - log_warn("Entry to inode containing bad blocks remains\n"); + log_warn( _("Entry to inode containing bad blocks remains\n")); (*count)++; ds->entry_count++; return 0; @@ -274,9 +276,9 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, q.block_type != gfs2_inode_lnk && q.block_type != gfs2_inode_blk && q.block_type != gfs2_inode_chr && q.block_type != gfs2_inode_fifo && q.block_type != gfs2_inode_sock) { - log_err("Directory entry '%s' at block %llu (0x%llx" + log_err( _("Directory entry '%s' at block %llu (0x%llx" ") in dir inode %llu (0x%llx" - ") has an invalid block type: %d.\n", tmp_name, + ") has an invalid block type: %d.\n"), tmp_name, (unsigned long long)de->de_inum.no_addr, (unsigned long long)de->de_inum.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, @@ -284,16 +286,16 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, q.block_type); errors_found++; - if(query(&opts, "Clear directory entry to non-inode block? (y/n) ")) { + if(query(&opts, _("Clear directory entry to non-inode block? (y/n) "))) { /* FIXME: make sure all blocks referenced by * this inode are cleared in the bitmap */ errors_corrected++; dirent2_del(ip, bh, prev_de, dent); *update = updated; - log_warn("Directory entry '%s' cleared\n", tmp_name); + log_warn( _("Directory entry '%s' cleared\n"), tmp_name); return 1; } else { - log_err("Directory entry to non-inode block remains\n"); + log_err( _("Directory entry to non-inode block remains\n")); (*count)++; ds->entry_count++; return 0; @@ -306,14 +308,14 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, return -1; } if(error > 0) { - log_warn("Type '%s' in dir entry (%s, %llu/0x%llx) conflicts" - " with type '%s' in dinode. (Dir entry is stale.)\n", + log_warn( _("Type '%s' in dir entry (%s, %llu/0x%llx) conflicts" + " with type '%s' in dinode. (Dir entry is stale.)\n"), de_type_string(de->de_type), tmp_name, (unsigned long long)de->de_inum.no_addr, (unsigned long long)de->de_inum.no_addr, block_type_string(&q)); errors_found++; - if(query(&opts, "Clear stale directory entry? (y/n) ")) { + if(query(&opts, _("Clear stale directory entry? (y/n) "))) { errors_corrected++; entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr); check_inode_eattr(entry_ip, update, &clear_eattrs); @@ -323,7 +325,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, *update = updated; return 1; } else { - log_err("Stale directory entry remains\n"); + log_err( _("Stale directory entry remains\n")); (*count)++; ds->entry_count++; return 0; @@ -331,15 +333,15 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, } if(!strcmp(".", tmp_name)) { - log_debug("Found . dentry\n"); + log_debug( _("Found . dentry\n")); if(ds->dotdir) { - log_err("Already found '.' entry in directory %llu" - " (0x%llx)\n", + log_err( _("Already found '.' entry in directory %llu" + " (0x%llx)\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); errors_found++; - if(query(&opts, "Clear duplicate '.' entry? (y/n) ")) { + if(query(&opts, _("Clear duplicate '.' entry? (y/n) "))) { errors_corrected++; entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr); @@ -351,7 +353,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, *update = updated; return 1; } else { - log_err("Duplicate '.' entry remains\n"); + log_err( _("Duplicate '.' entry remains\n")); /* FIXME: Should we continue on here * and check the rest of the '.' * entry? */ @@ -367,10 +369,10 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, /* check that '.' refers to this inode */ if(de->de_inum.no_addr != ip->i_di.di_num.no_addr) { - log_err("'.' entry's value incorrect in directory %llu" + log_err( _("'.' entry's value incorrect in directory %llu" " (0x%llx). Points to %llu" " (0x%llx) when it should point to %llu" - " (0x%llx).\n", + " (0x%llx).\n"), (unsigned long long)de->de_inum.no_addr, (unsigned long long)de->de_inum.no_addr, (unsigned long long)de->de_inum.no_addr, @@ -378,7 +380,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); errors_found++; - if(query(&opts, "Remove '.' reference? (y/n) ")) { + if(query(&opts, _("Remove '.' reference? (y/n) "))) { errors_corrected++; entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr); check_inode_eattr(entry_ip, update, @@ -390,7 +392,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, return 1; } else { - log_err("Invalid '.' reference remains\n"); + log_err( _("Invalid '.' reference remains\n")); /* Not setting ds->dotdir here since * this '.' entry is invalid */ increment_link(sbp, de->de_inum.no_addr); @@ -408,14 +410,14 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, return 0; } if(!strcmp("..", tmp_name)) { - log_debug("Found .. dentry\n"); + log_debug( _("Found .. dentry\n")); if(ds->dotdotdir) { - log_err("Already found '..' entry in directory %llu" - "(0x%llx)\n", + log_err( _("Already found '..' entry in directory %llu" + "(0x%llx)\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); errors_found++; - if(query(&opts, "Clear duplicate '..' entry? (y/n) ")) { + if(query(&opts, _("Clear duplicate '..' entry? (y/n) "))) { errors_corrected++; entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr); @@ -427,7 +429,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, *update = 1; return 1; } else { - log_err("Duplicate '..' entry remains\n"); + log_err( _("Duplicate '..' entry remains\n")); /* FIXME: Should we continue on here * and check the rest of the '..' * entry? */ @@ -439,12 +441,12 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, } if(q.block_type != gfs2_inode_dir) { - log_err("Found '..' entry in directory %llu (0x%llx) " - "pointing to something that's not a directory", + log_err( _("Found '..' entry in directory %llu (0x%llx) " + "pointing to something that's not a directory"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); errors_found++; - if(query(&opts, "Clear bad '..' directory entry? (y/n) ")) { + if(query(&opts, _("Clear bad '..' directory entry? (y/n) "))) { errors_corrected++; entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr); check_inode_eattr(entry_ip, update, @@ -455,7 +457,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, *update = 1; return 1; } else { - log_err("Bad '..' directory entry remains\n"); + log_err( _("Bad '..' directory entry remains\n")); increment_link(sbp, de->de_inum.no_addr); (*count)++; ds->entry_count++; @@ -484,7 +486,7 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, /* After this point we're only concerned with * directories */ if(q.block_type != gfs2_inode_dir) { - log_debug("Found non-dir inode dentry\n"); + log_debug( _("Found non-dir inode dentry\n")); increment_link(sbp, de->de_inum.no_addr); *update = (opts.no ? not_updated : updated); (*count)++; @@ -492,23 +494,23 @@ int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent, return 0; } - log_debug("Found plain directory dentry\n"); + log_debug( _("Found plain directory dentry\n")); error = set_parent_dir(sbp, entryblock, ip->i_di.di_num.no_addr); if(error > 0) { - log_err("%s: Hard link to block %" PRIu64" (0x%" PRIx64 - ") detected.\n", filename, entryblock, entryblock); + log_err( _("%s: Hard link to block %" PRIu64" (0x%" PRIx64 + ") detected.\n"), filename, entryblock, entryblock); errors_found++; - if(query(&opts, "Clear hard link to directory? (y/n) ")) { + if(query(&opts, _("Clear hard link to directory? (y/n) "))) { errors_corrected++; *update = 1; dirent2_del(ip, bh, prev_de, dent); - log_warn("Directory entry %s cleared\n", filename); + log_warn( _("Directory entry %s cleared\n"), filename); return 1; } else { - log_err("Hard link to directory remains\n"); + log_err( _("Hard link to directory remains\n")); (*count)++; ds->entry_count++; return 0; @@ -552,7 +554,7 @@ int check_system_dir(struct gfs2_inode *sysinode, const char *dirname, enum update_flags update = not_updated; int error = 0; - log_info("Checking system directory inode '%s'\n", dirname); + log_info( _("Checking system directory inode '%s'\n"), dirname); if (sysinode) { iblock = sysinode->i_di.di_num.no_addr; @@ -582,21 +584,21 @@ int check_system_dir(struct gfs2_inode *sysinode, const char *dirname, return -1; } if(!ds.dotdir) { - log_err("No '.' entry found for %s directory.\n", dirname); + log_err( _("No '.' entry found for %s directory.\n"), dirname); sprintf(tmp_name, "."); filename_len = strlen(tmp_name); /* no trailing NULL */ if(!(filename = malloc(sizeof(char) * filename_len))) { - log_err("Unable to allocate name string\n"); + log_err( _("Unable to allocate name string\n")); stack; return -1; } if(!(memset(filename, 0, sizeof(char) * filename_len))) { - log_err("Unable to zero name string\n"); + log_err( _("Unable to zero name string\n")); stack; return -1; } memcpy(filename, tmp_name, filename_len); - log_warn("Adding '.' entry\n"); + log_warn( _("Adding '.' entry\n")); dir_add(sysinode, filename, filename_len, &(sysinode->i_di.di_num), DT_DIR); increment_link(sysinode->i_sbd, @@ -606,23 +608,23 @@ int check_system_dir(struct gfs2_inode *sysinode, const char *dirname, update = 1; } if(sysinode->i_di.di_entries != ds.entry_count) { - log_err("%s inode %llu (0x%llx" - "): Entries is %d - should be %d\n", dirname, + log_err( _("%s inode %llu (0x%llx" + "): Entries is %d - should be %d\n"), dirname, (unsigned long long)sysinode->i_di.di_num.no_addr, (unsigned long long)sysinode->i_di.di_num.no_addr, sysinode->i_di.di_entries, ds.entry_count); errors_found++; - if(query(&opts, "Fix entries for %s inode %llu (0x%llx" - ")? (y/n) ", dirname, + if(query(&opts, _("Fix entries for %s inode %llu (0x%llx" + ")? (y/n) "), dirname, (unsigned long long)sysinode->i_di.di_num.no_addr, (unsigned long long)sysinode->i_di.di_num.no_addr)) { errors_corrected++; sysinode->i_di.di_entries = ds.entry_count; - log_warn("Entries updated\n"); + log_warn( _("Entries updated\n")); update = 1; } else { - log_err("Entries for inode %llu (0x%llx" - ") left out of sync\n", + log_err( _("Entries for inode %llu (0x%llx" + ") left out of sync\n"), (unsigned long long) sysinode->i_di.di_num.no_addr, (unsigned long long) @@ -687,7 +689,7 @@ int pass2(struct gfs2_sbd *sbp) stack; return FSCK_ERROR; } - log_info("Checking directory inodes.\n"); + log_info( _("Checking directory inodes.\n")); /* Grab each directory inode, and run checks on it */ for(i = 0; i < last_fs_block; i++) { warm_fuzzy_stuff(i); @@ -699,16 +701,16 @@ int pass2(struct gfs2_sbd *sbp) continue; if(gfs2_block_check(sbp, bl, i, &q)) { - log_err("Can't get block %"PRIu64 " (0x%" PRIx64 - ") from block list\n", i, i); + log_err( _("Can't get block %"PRIu64 " (0x%" PRIx64 + ") from block list\n"), i, i); return FSCK_ERROR; } if(q.block_type != gfs2_inode_dir) continue; - log_debug("Checking directory inode at block %"PRIu64" (0x%" - PRIx64 ")\n", i, i); + log_debug( _("Checking directory inode at block %"PRIu64" (0x%" + PRIx64 ")\n"), i, i); memset(&ds, 0, sizeof(ds)); pass2_fxns.private = (void *) &ds; @@ -738,9 +740,9 @@ int pass2(struct gfs2_sbd *sbp) if(error == 0) { /* FIXME: factor */ errors_found++; - if(query(&opts, "Remove directory entry for bad" + if(query(&opts, _("Remove directory entry for bad" " inode %"PRIu64" (0x%" PRIx64 ") in %"PRIu64 - " (0x%" PRIx64 ")? (y/n)", i, i, di->treewalk_parent, + " (0x%" PRIx64 ")? (y/n)"), i, i, di->treewalk_parent, di->treewalk_parent)) { errors_corrected++; error = remove_dentry_from_dir(sbp, di->treewalk_parent, @@ -750,30 +752,30 @@ int pass2(struct gfs2_sbd *sbp) return FSCK_ERROR; } if(error > 0) { - log_warn("Unable to find dentry for %" + log_warn( _("Unable to find dentry for %" PRIu64 " (0x%" PRIx64 ") in %" PRIu64 - " (0x%" PRIx64 ")\n", i, i, + " (0x%" PRIx64 ")\n"), i, i, di->treewalk_parent, di->treewalk_parent); } - log_warn("Directory entry removed\n"); + log_warn( _("Directory entry removed\n")); } else - log_err("Directory entry to invalid inode remains.\n"); + log_err( _("Directory entry to invalid inode remains.\n")); } gfs2_block_set(sbp, bl, i, gfs2_meta_inval); } bh = bread(&sbp->buf_list, i); ip = fsck_inode_get(sbp, bh); if(!ds.dotdir) { - log_err("No '.' entry found\n"); + log_err( _("No '.' entry found\n")); sprintf(tmp_name, "."); filename_len = strlen(tmp_name); /* no trailing NULL */ if(!(filename = malloc(sizeof(char) * filename_len))) { - log_err("Unable to allocate name string\n"); + log_err( _("Unable to allocate name string\n")); stack; return FSCK_ERROR; } if(!memset(filename, 0, sizeof(char) * filename_len)) { - log_err("Unable to zero name string\n"); + log_err( _("Unable to zero name string\n")); stack; return FSCK_ERROR; } @@ -790,8 +792,8 @@ int pass2(struct gfs2_sbd *sbp) bh = bread(&sbp->buf_list, i); ip = fsck_inode_get(sbp, bh); if(ip->i_di.di_entries != ds.entry_count) { - log_err("Entries is %d - should be %d for inode " - "block %llu (0x%llx)\n", + log_err( _("Entries is %d - should be %d for inode " + "block %llu (0x%llx)\n"), ip->i_di.di_entries, ds.entry_count, (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c index a5c0202..e618e87 100644 --- a/gfs2/fsck/pass3.c +++ b/gfs2/fsck/pass3.c @@ -3,6 +3,8 @@ #include <inttypes.h> #include <string.h> #include <dirent.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "osi_list.h" @@ -12,7 +14,7 @@ #include "metawalk.h" static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot, - uint64_t olddotdot, uint64_t block) + uint64_t olddotdot, uint64_t block) { char *filename; int filename_len; @@ -29,14 +31,14 @@ static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot, filename_len = strlen(".."); if(!(filename = malloc((sizeof(char) * filename_len) + 1))) { - log_err("Unable to allocate name\n"); + log_err( _("Unable to allocate name\n")); fsck_inode_put(ip, not_updated); fsck_inode_put(pip, not_updated); stack; return -1; } if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) { - log_err("Unable to zero name\n"); + log_err( _("Unable to zero name\n")); fsck_inode_put(ip, not_updated); fsck_inode_put(pip, not_updated); stack; @@ -44,7 +46,7 @@ static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot, } memcpy(filename, "..", filename_len); if(gfs2_dirent_del(ip, NULL, filename, filename_len)) - log_warn("Unable to remove \"..\" directory entry.\n"); + log_warn( _("Unable to remove \"..\" directory entry.\n")); else decrement_link(sbp, olddotdot); dir_add(ip, filename, filename_len, &pip->i_di.di_num, DT_DIR); @@ -66,22 +68,22 @@ struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp, return NULL; if(di->dotdot_parent != di->treewalk_parent) { - log_warn("Directory '..' and treewalk connections disagree for inode %" - PRIu64 " (0x%" PRIx64 ")\n", di->dinode, di->dinode); - log_notice("'..' has %" PRIu64" (0x%" PRIx64 "), treewalk has %" - PRIu64" (0x%" PRIx64 ")\n", di->dotdot_parent, + log_warn( _("Directory '..' and treewalk connections disagree for inode %" + PRIu64 " (0x%" PRIx64 ")\n"), di->dinode, di->dinode); + log_notice( _("'..' has %" PRIu64" (0x%" PRIx64 "), treewalk has %" + PRIu64" (0x%" PRIx64 ")\n"), di->dotdot_parent, di->dotdot_parent, di->treewalk_parent, di->treewalk_parent); if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) { - log_err("Unable to find block %"PRIu64 - " (0x%" PRIx64 ") in block map.\n", + log_err( _("Unable to find block %"PRIu64 + " (0x%" PRIx64 ") in block map.\n"), di->dotdot_parent, di->dotdot_parent); return NULL; } if(gfs2_block_check(sbp, bl, di->treewalk_parent, &q_treewalk)) { - log_err("Unable to find block %"PRIu64 - " (0x%" PRIx64 ") in block map\n", + log_err( _("Unable to find block %"PRIu64 + " (0x%" PRIx64 ") in block map\n"), di->treewalk_parent, di->treewalk_parent); return NULL; } @@ -94,12 +96,12 @@ struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp, */ if(q_dotdot.block_type != gfs2_inode_dir) { if(q_treewalk.block_type != gfs2_inode_dir) { - log_err( "Orphaned directory, move to lost+found\n"); + log_err( _("Orphaned directory, move to lost+found\n")); return NULL; } else { - log_warn("Treewalk parent is correct," - " fixing dotdot -> %"PRIu64" (0x%" PRIx64 ")\n", + log_warn( _("Treewalk parent is correct," + " fixing dotdot -> %"PRIu64" (0x%" PRIx64 ")\n"), di->treewalk_parent, di->treewalk_parent); attach_dotdot_to(sbp, di->treewalk_parent, di->dotdot_parent, di->dinode); @@ -109,15 +111,15 @@ struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp, else { if(q_treewalk.block_type != gfs2_inode_dir) { int error = 0; - log_warn(".. parent is valid, but treewalk" - "is bad - reattaching to lost+found"); + log_warn( _(".. parent is valid, but treewalk" + "is bad - reattaching to lost+found")); /* FIXME: add a dinode for this entry instead? */ errors_found++; - if(query(&opts, "Remove directory entry for bad" + if(query(&opts, _("Remove directory entry for bad" " inode %"PRIu64" (0x%" PRIx64 ") in %"PRIu64 - " (0x%" PRIx64 ")? (y/n)", di->dinode, di->dinode, + " (0x%" PRIx64 ")? (y/n)"), di->dinode, di->dinode, di->treewalk_parent, di->treewalk_parent)) { errors_corrected++; error = remove_dentry_from_dir(sbp, di->treewalk_parent, @@ -127,23 +129,23 @@ struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp, return NULL; } if(error > 0) { - log_warn("Unable to find dentry for block %" + log_warn( _("Unable to find dentry for block %" PRIu64" (0x%" PRIx64 ") in %" PRIu64 " (0x%" - PRIx64 ")\n",di->dinode, di->dinode, + PRIx64 ")\n"),di->dinode, di->dinode, di->treewalk_parent, di->treewalk_parent); } - log_warn("Directory entry removed\n"); + log_warn( _("Directory entry removed\n")); } else { - log_err("Directory entry to invalid inode remains\n"); + log_err( _("Directory entry to invalid inode remains\n")); } - log_info("Marking directory unlinked\n"); + log_info( _("Marking directory unlinked\n")); return NULL; } else { - log_err("Both .. and treewalk parents are " + log_err( _("Both .. and treewalk parents are " "directories, going with treewalk for " - "now...\n"); + "now...\n")); attach_dotdot_to(sbp, di->treewalk_parent, di->dotdot_parent, di->dinode); di->dotdot_parent = di->treewalk_parent; @@ -152,14 +154,14 @@ struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp, } else { if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) { - log_err("Unable to find parent block %"PRIu64 - " (0x%" PRIx64 ") in block map\n", + log_err( _("Unable to find parent block %"PRIu64 + " (0x%" PRIx64 ") in block map\n"), di->dotdot_parent, di->dotdot_parent); return NULL; } if(q_dotdot.block_type != gfs2_inode_dir) { - log_err("Orphaned directory at block %" PRIu64 " (0x%" PRIx64 - ") moved to lost+found\n", di->dinode, di->dinode); + log_err( _("Orphaned directory at block %" PRIu64 " (0x%" PRIx64 + ") moved to lost+found\n"), di->dinode, di->dinode); return NULL; } } @@ -184,12 +186,12 @@ int pass3(struct gfs2_sbd *sbp) find_di(sbp, sbp->md.rooti->i_di.di_num.no_addr, &di); if(di) { - log_info("Marking root inode connected\n"); + log_info( _("Marking root inode connected\n")); di->checked = 1; } find_di(sbp, sbp->master_dir->i_di.di_num.no_addr, &di); if(di) { - log_info("Marking master directory inode connected\n"); + log_info( _("Marking master directory inode connected\n")); di->checked = 1; } @@ -197,7 +199,7 @@ int pass3(struct gfs2_sbd *sbp) * until we find one that's been checked already. If we don't * find a parent, put in lost+found. */ - log_info("Checking directory linkage.\n"); + log_info( _("Checking directory linkage.\n")); for(i = 0; i < FSCK_HASH_SIZE; i++) { osi_list_foreach(tmp, &dir_hash[i]) { di = osi_list_entry(tmp, struct dir_info, list); @@ -216,17 +218,17 @@ int pass3(struct gfs2_sbd *sbp) return FSCK_ERROR; } if(q.bad_block) { - log_err("Found unlinked directory containing bad block\n"); + log_err( _("Found unlinked directory containing bad block\n")); errors_found++; if(query(&opts, - "Clear unlinked directory with bad blocks? (y/n) ")) { + _("Clear unlinked directory with bad blocks? (y/n) "))) { errors_corrected++; gfs2_block_set(sbp, bl, di->dinode, gfs2_block_free); break; } else - log_err("Unlinked directory with bad block remains\n"); + log_err( _("Unlinked directory with bad block remains\n")); } if(q.block_type != gfs2_inode_dir && q.block_type != gfs2_inode_file && @@ -235,22 +237,22 @@ int pass3(struct gfs2_sbd *sbp) q.block_type != gfs2_inode_chr && q.block_type != gfs2_inode_fifo && q.block_type != gfs2_inode_sock) { - log_err("Unlinked block marked as inode not an inode\n"); + log_err( _("Unlinked block marked as inode not an inode\n")); gfs2_block_set(sbp, bl, di->dinode, gfs2_block_free); - log_err("Cleared\n"); + log_err( _("Cleared\n")); break; } - log_err("Found unlinked directory at block %" PRIu64 - " (0x%" PRIx64 ")\n", di->dinode, di->dinode); + log_err( _("Found unlinked directory at block %" PRIu64 + " (0x%" PRIx64 ")\n"), di->dinode, di->dinode); ip = fsck_load_inode(sbp, di->dinode); /* Don't skip zero size directories * with eattrs */ if(!ip->i_di.di_size && !ip->i_di.di_eattr){ - log_err("Unlinked directory has zero size.\n"); + log_err( _("Unlinked directory has zero size.\n")); errors_found++; - if(query(&opts, "Remove zero-size unlinked directory? (y/n) ")) { + if(query(&opts, _("Remove zero-size unlinked directory? (y/n) "))) { errors_corrected++; gfs2_block_set(sbp, bl, di->dinode, @@ -258,34 +260,34 @@ int pass3(struct gfs2_sbd *sbp) fsck_inode_put(ip, not_updated); break; } else { - log_err("Zero-size unlinked directory remains\n"); + log_err( _("Zero-size unlinked directory remains\n")); } } errors_found++; - if(query(&opts, "Add unlinked directory to lost+found? (y/n) ")) { + if(query(&opts, _("Add unlinked directory to lost+found? (y/n) "))) { errors_corrected++; if(add_inode_to_lf(ip)) { fsck_inode_put(ip, not_updated); stack; return FSCK_ERROR; } - log_warn("Directory relinked to lost+found\n"); + log_warn( _("Directory relinked to lost+found\n")); } else { - log_err("Unlinked directory remains unlinked\n"); + log_err( _("Unlinked directory remains unlinked\n")); } fsck_inode_put(ip, not_updated); break; } else { - log_debug("Directory at block %" PRIu64 " (0x%" - PRIx64 ") connected\n", di->dinode, di->dinode); + log_debug( _("Directory at block %" PRIu64 " (0x%" + PRIx64 ") connected\n"), di->dinode, di->dinode); } di = tdi; } } } if(lf_dip) - log_debug("At end of pass3, lost+found entries is %u\n", + log_debug( _("At end of pass3, lost+found entries is %u\n"), lf_dip->i_di.di_entries); return FSCK_OK; } diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c index 38cff40..f5a5c68 100644 --- a/gfs2/fsck/pass4.c +++ b/gfs2/fsck/pass4.c @@ -1,6 +1,8 @@ #include <inttypes.h> #include <stdlib.h> #include <stdio.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -12,14 +14,14 @@ int fix_inode_count(struct gfs2_sbd *sbp, struct inode_info *ii, struct gfs2_inode *ip) { - log_info("Fixing inode count for %llu (0x%llx) \n", + log_info( _("Fixing inode count for %llu (0x%llx) \n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr); if(ip->i_di.di_nlink == ii->counted_links) return 0; ip->i_di.di_nlink = ii->counted_links; - log_debug("Changing inode %llu (0x%llx) to have %u links\n", + log_debug( _("Changing inode %llu (0x%llx) to have %u links\n"), (unsigned long long)ip->i_di.di_num.no_addr, (unsigned long long)ip->i_di.di_num.no_addr, ii->counted_links); @@ -41,32 +43,32 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) { return 0; f = not_updated; if(!(ii = osi_list_entry(tmp, struct inode_info, list))) { - log_crit("osi_list_foreach broken in scan_info_list!!\n"); + log_crit( _("osi_list_foreach broken in scan_info_list!!\n")); exit(FSCK_ERROR); } - log_debug("Checking reference count on inode at block %" PRIu64 - " (0x%" PRIx64 ")\n", ii->inode, ii->inode); + log_debug( _("Checking reference count on inode at block %" PRIu64 + " (0x%" PRIx64 ")\n"), ii->inode, ii->inode); if(ii->counted_links == 0) { - log_err("Found unlinked inode at %" PRIu64 " (0x%" PRIx64 ")\n", + log_err( _("Found unlinked inode at %" PRIu64 " (0x%" PRIx64 ")\n"), ii->inode, ii->inode); if(gfs2_block_check(sbp, bl, ii->inode, &q)) { stack; return -1; } if(q.bad_block) { - log_err("Unlinked inode %llu (0x%llx) contains" - "bad blocks\n", + log_err( _("Unlinked inode %llu (0x%llx) contains" + "bad blocks\n"), (unsigned long long)ii->inode, (unsigned long long)ii->inode); errors_found++; if(query(&opts, - "Clear unlinked inode with bad blocks? (y/n) ")) { + _("Clear unlinked inode with bad blocks? (y/n) "))) { errors_corrected++; gfs2_block_set(sbp, bl, ii->inode, gfs2_block_free); continue; } else - log_err("Unlinked inode with bad blocks not cleared\n"); + log_err( _("Unlinked inode with bad blocks not cleared\n")); } if(q.block_type != gfs2_inode_dir && q.block_type != gfs2_inode_file && @@ -75,10 +77,10 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) { q.block_type != gfs2_inode_chr && q.block_type != gfs2_inode_fifo && q.block_type != gfs2_inode_sock) { - log_err("Unlinked block marked as inode not an inode\n"); + log_err( _("Unlinked block marked as inode not an inode\n")); gfs2_block_set(sbp, bl, ii->inode, gfs2_block_free); - log_err("Cleared\n"); + log_err( _("Cleared\n")); continue; } ip = fsck_load_inode(sbp, ii->inode); @@ -87,9 +89,9 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) { * eattrs - there might be relevent info in * them. */ if(!ip->i_di.di_size && !ip->i_di.di_eattr){ - log_err("Unlinked inode has zero size\n"); + log_err( _("Unlinked inode has zero size\n")); errors_found++; - if(query(&opts, "Clear zero-size unlinked inode? (y/n) ")) { + if(query(&opts, _("Clear zero-size unlinked inode? (y/n) "))) { errors_corrected++; gfs2_block_set(sbp, bl, ii->inode, gfs2_block_free); @@ -99,7 +101,7 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) { } errors_found++; - if(query(&opts, "Add unlinked inode to lost+found? (y/n)")) { + if(query(&opts, _("Add unlinked inode to lost+found? (y/n)"))) { errors_corrected++; f = updated; if(add_inode_to_lf(ip)) { @@ -112,37 +114,37 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) { lf_addition = 1; } } else - log_err("Unlinked inode left unlinked\n"); + log_err( _("Unlinked inode left unlinked\n")); fsck_inode_put(ip, f); } /* if(ii->counted_links == 0) */ else if(ii->link_count != ii->counted_links) { - log_err("Link count inconsistent for inode %" PRIu64 - " (0x%" PRIx64 ") has %u but fsck found %u.\n", ii->inode, + log_err( _("Link count inconsistent for inode %" PRIu64 + " (0x%" PRIx64 ") has %u but fsck found %u.\n"), ii->inode, ii->inode, ii->link_count, ii->counted_links); /* Read in the inode, adjust the link count, * and write it back out */ errors_found++; - if(query(&opts, "Update link count for inode %" - PRIu64 " (0x%" PRIx64 ") ? (y/n) ", ii->inode, ii->inode)) { + if(query(&opts, _("Update link count for inode %" + PRIu64 " (0x%" PRIx64 ") ? (y/n) "), ii->inode, ii->inode)) { errors_corrected++; ip = fsck_load_inode(sbp, ii->inode); /* bread, inode_get */ fix_inode_count(sbp, ii, ip); fsck_inode_put(ip, updated); /* out, brelse, free */ - log_warn("Link count updated for inode %" - PRIu64 " (0x%" PRIx64 ") \n", ii->inode, ii->inode); + log_warn( _("Link count updated for inode %" + PRIu64 " (0x%" PRIx64 ") \n"), ii->inode, ii->inode); } else { - log_err("Link count for inode %" PRIu64 " (0x%" PRIx64 - ") still incorrect\n", ii->inode, ii->inode); + log_err( _("Link count for inode %" PRIu64 " (0x%" PRIx64 + ") still incorrect\n"), ii->inode, ii->inode); } } - log_debug("block %" PRIu64 " (0x%" PRIx64 ") has link count %d\n", + log_debug( _("block %" PRIu64 " (0x%" PRIx64 ") has link count %d\n"), ii->inode, ii->inode, ii->link_count); } /* osi_list_foreach(tmp, list) */ if (lf_addition) { if(!(ii = inode_hash_search(inode_hash, lf_dip->i_di.di_num.no_addr))) { - log_crit("Unable to find lost+found inode in inode_hash!!\n"); + log_crit( _("Unable to find lost+found inode in inode_hash!!\n")); return -1; } else { fix_inode_count(sbp, ii, lf_dip); @@ -166,9 +168,9 @@ int pass4(struct gfs2_sbd *sbp) uint32_t i; osi_list_t *list; if(lf_dip) - log_debug("At beginning of pass4, lost+found entries is %u\n", + log_debug( _("At beginning of pass4, lost+found entries is %u\n"), lf_dip->i_di.di_entries); - log_info("Checking inode reference counts.\n"); + log_info( _("Checking inode reference counts.\n")); for (i = 0; i < FSCK_HASH_SIZE; i++) { if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ return FSCK_OK; @@ -180,7 +182,7 @@ int pass4(struct gfs2_sbd *sbp) } if(lf_dip) - log_debug("At end of pass4, lost+found entries is %u\n", + log_debug( _("At end of pass4, lost+found entries is %u\n"), lf_dip->i_di.di_entries); return FSCK_OK; } diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c index aa63f11..4b28a98 100644 --- a/gfs2/fsck/pass5.c +++ b/gfs2/fsck/pass5.c @@ -2,6 +2,8 @@ #include <string.h> #include <inttypes.h> #include <stdlib.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fsck.h" @@ -45,7 +47,7 @@ int convert_mark(struct gfs2_block_query *q, uint32_t *count) return GFS2_BLKST_USED; default: - log_err("Invalid state %d found\n", q->block_type); + log_err( _("Invalid state %d found\n"), q->block_type); return -1; } return -1; @@ -82,31 +84,31 @@ int check_block_status(struct gfs2_sbd *sbp, char *buffer, unsigned int buflen, So we ignore it. */ if (rg_status == GFS2_BLKST_UNLINKED && block_status == GFS2_BLKST_FREE) { - log_warn("Unlinked block found at block %" - PRIu64" (0x%" PRIx64 "), left unchanged.\n", + log_warn( _("Unlinked block found at block %" + PRIu64" (0x%" PRIx64 "), left unchanged.\n"), block, block); } else if (rg_status != block_status) { const char *blockstatus[] = {"Free", "Data", "Unlinked", "inode"}; - log_err("Ondisk and fsck bitmaps differ at" - " block %"PRIu64" (0x%" PRIx64 ") \n", block, block); - log_err("Ondisk status is %u (%s) but FSCK thinks it should be ", + log_err( _("Ondisk and fsck bitmaps differ at" + " block %"PRIu64" (0x%" PRIx64 ") \n"), block, block); + log_err( _("Ondisk status is %u (%s) but FSCK thinks it should be "), rg_status, blockstatus[rg_status]); log_err("%u (%s)\n", block_status, blockstatus[block_status]); - log_err("Metadata type is %u (%s)\n", q.block_type, + log_err( _("Metadata type is %u (%s)\n"), q.block_type, block_type_string(&q)); errors_found++; - if(query(&opts, "Fix bitmap for block %" - PRIu64" (0x%" PRIx64 ") ? (y/n) ", block, block)) { + if(query(&opts, _("Fix bitmap for block %" + PRIu64" (0x%" PRIx64 ") ? (y/n) "), block, block)) { errors_corrected++; if(gfs2_set_bitmap(sbp, block, block_status)) - log_err("Failed.\n"); + log_err( _("Failed.\n")); else - log_err("Succeeded.\n"); + log_err( _("Succeeded.\n")); } else - log_err("Bitmap at block %"PRIu64" (0x%" PRIx64 - ") left inconsistent\n", block, block); + log_err( _("Bitmap at block %"PRIu64" (0x%" PRIx64 + ") left inconsistent\n"), block, block); } (*rg_block)++; bit += GFS2_BIT_SIZE; @@ -139,8 +141,8 @@ enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp, /* actually adjust counters and write out to disk */ if(rgp->rg.rg_free != count[0]) { - log_err("RG #%llu (0x%llx) free count inconsistent: " - "is %u should be %u\n", + log_err( _("RG #%llu (0x%llx) free count inconsistent: " + "is %u should be %u\n"), (unsigned long long)rgp->ri.ri_addr, (unsigned long long)rgp->ri.ri_addr, rgp->rg.rg_free, count[0]); @@ -148,7 +150,7 @@ enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp, update = 1; } if(rgp->rg.rg_dinodes != count[1]) { - log_err("Inode count inconsistent: is %u should be %u\n", + log_err( _("Inode count inconsistent: is %u should be %u\n"), rgp->rg.rg_dinodes, count[1]); rgp->rg.rg_dinodes = count[1]; update = 1; @@ -157,19 +159,19 @@ enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp, /* FIXME not sure how to handle this case ATM - it * means that the total number of blocks we've counted * exceeds the blocks in the rg */ - log_err("Internal fsck error - AAHHH!\n"); + log_err( _("Internal fsck error - AAHHH!\n")); exit(FSCK_ERROR); } if(update) { errors_found++; - if(query(&opts, "Update resource group counts? (y/n) ")) { + if(query(&opts, _("Update resource group counts? (y/n) "))) { errors_corrected++; - log_warn("Resource group counts updated\n"); + log_warn( _("Resource group counts updated\n")); /* write out the rgrp */ gfs2_rgrp_out(&rgp->rg, rgp->bh[0]->b_data); return updated; } else - log_err("Resource group counts left inconsistent\n"); + log_err( _("Resource group counts left inconsistent\n")); } return not_updated; } @@ -193,7 +195,7 @@ int pass5(struct gfs2_sbd *sbp) if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ return FSCK_OK; - log_info("Verifying Resource Group #%" PRIu64 "\n", rg_count); + log_info( _("Verifying Resource Group #%" PRIu64 "\n"), rg_count); memset(count, 0, sizeof(count)); rgp = osi_list_entry(tmp, struct rgrp_list, list); diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c index 4ddd740..783d216 100644 --- a/gfs2/fsck/rgrepair.c +++ b/gfs2/fsck/rgrepair.c @@ -5,6 +5,8 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "osi_list.h" @@ -45,7 +47,7 @@ void find_journaled_rgs(struct gfs2_sbd *sdp) osi_list_init(&false_rgrps.list); for (j = 0; j < sdp->md.journals; j++) { - log_debug("Checking for RGs in journal%d.\n", j); + log_debug( _("Checking for RGs in journal%d.\n"), j); ip = sdp->md.journal[j]; jblocks = ip->i_di.di_size / sdp->sd_sb.sb_bsize; for (b = 0; b < jblocks; b++) { @@ -55,8 +57,8 @@ void find_journaled_rgs(struct gfs2_sbd *sdp) break; bh = bread(&sdp->buf_list, dblock); if (!gfs2_check_meta(bh, GFS2_METATYPE_RG)) { - log_debug("False RG found at block " - "0x%" PRIx64 "\n", dblock); + log_debug( _("False RG found at block " + "0x%" PRIx64 "\n"), dblock); gfs2_special_set(&false_rgrps, dblock); } brelse(bh, not_updated); @@ -131,7 +133,7 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, if (((blk == sdp->sb_addr + 1) || (!gfs2_check_meta(bh, GFS2_METATYPE_RG))) && !is_false_rg(blk)) { - log_debug("RG found at block 0x%" PRIx64 "\n", blk); + log_debug( _("RG found at block 0x%" PRIx64 "\n"), blk); if (blk > sdp->sb_addr + 1) { uint64_t rgdist; @@ -152,7 +154,7 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, first_rg_dist = rgdist; if (rgdist < shortest_dist_btwn_rgs) { shortest_dist_btwn_rgs = rgdist; - log_debug("(shortest so far)\n"); + log_debug( _("(shortest so far)\n")); } else log_debug("\n"); @@ -171,8 +173,8 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, /* first_rg_dist would measure from #1 to #3, which would be bad. */ /* We need to take remedial measures to fix it (from the index). */ /* -------------------------------------------------------------- */ - log_debug("First RG distance: 0x%" PRIx64 "\n", first_rg_dist); - log_debug("Distance between RGs: 0x%" PRIx64 "\n", + log_debug( _("First RG distance: 0x%" PRIx64 "\n"), first_rg_dist); + log_debug( _("Distance between RGs: 0x%" PRIx64 "\n"), shortest_dist_btwn_rgs); if (first_rg_dist >= shortest_dist_btwn_rgs + (shortest_dist_btwn_rgs / 4)) { @@ -182,18 +184,18 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, sizeof(struct gfs2_rindex)); gfs2_rindex_in(&tmpndx, (char *)&buf); if (tmpndx.ri_addr > sdp->sb_addr + 1) { /* sanity check */ - log_warn("RG 2 is damaged: getting dist from index: "); + log_warn( _("RG 2 is damaged: getting dist from index: ")); first_rg_dist = tmpndx.ri_addr - (sdp->sb_addr + 1); log_warn("0x%" PRIx64 "\n", first_rg_dist); } else { - log_warn("RG index 2 is damaged: extrapolating dist: "); + log_warn( _("RG index 2 is damaged: extrapolating dist: ")); first_rg_dist = sdp->device.length - (sdp->rgrps - 1) * (sdp->device.length / sdp->rgrps); log_warn("0x%" PRIx64 "\n", first_rg_dist); } - log_debug("Adjusted first RG distance: 0x%" PRIx64 "\n", + log_debug( _("Adjusted first RG distance: 0x%" PRIx64 "\n"), first_rg_dist); } /* if first RG distance is within tolerance */ /* -------------------------------------------------------------- */ @@ -204,14 +206,14 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, block_bump = first_rg_dist; for (blk = sdp->sb_addr + 1; blk <= sdp->device.length; blk += block_bump) { - log_debug("Block 0x%" PRIx64 "\n", blk); + log_debug( _("Block 0x%" PRIx64 "\n"), blk); bh = bread(&sdp->nvbuf_list, blk); rg_was_fnd = (!gfs2_check_meta(bh, GFS2_METATYPE_RG)); brelse(bh, not_updated); /* Allocate a new RG and index. */ calc_rgd = malloc(sizeof(struct rgrp_list)); if (!calc_rgd) { - log_crit("Can't allocate memory for rg repair.\n"); + log_crit( _("Can't allocate memory for rg repair.\n")); return -1; } memset(calc_rgd, 0, sizeof(struct rgrp_list)); @@ -224,11 +226,11 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, /* ------------------------------------------------- */ corrupt_rgs++; if (corrupt_rgs < 5) - log_debug("Missing or damaged RG at block %" - PRIu64 " (0x%" PRIx64 ")\n", + log_debug( _("Missing or damaged RG at block %" + PRIu64 " (0x%" PRIx64 ")\n"), blk, blk); else { - log_crit("Error: too many bad RGs.\n"); + log_crit( _("Error: too many bad RGs.\n")); return -1; } } @@ -250,11 +252,11 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, } /* for subsequent bitmaps */ gfs2_compute_bitstructs(sdp, calc_rgd); - log_debug("Memory allocated for rg at 0x%llx, bh: %p\n", + log_debug( _("Memory allocated for rg at 0x%llx, bh: %p\n"), (unsigned long long)calc_rgd->ri.ri_addr, calc_rgd->bh); if (!calc_rgd->bh) { - log_crit("Can't allocate memory for bitmap repair.\n"); + log_crit( _("Can't allocate memory for bitmap repair.\n")); return -1; } calc_rgd->ri.ri_data0 = calc_rgd->ri.ri_addr + @@ -271,11 +273,11 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, GFS2_NBBY; prev_rgd->ri.ri_bitbytes = prev_rgd->ri.ri_data / GFS2_NBBY; - log_debug("Prev ri_data set to: %" PRIx32 ".\n", + log_debug( _("Prev ri_data set to: %" PRIx32 ".\n"), prev_rgd->ri.ri_data); } number_of_rgs++; - log_warn("%c RG %d at block 0x%" PRIX64 " %s", + log_warn( _("%c RG %d at block 0x%" PRIX64 " %s"), (rg_was_fnd ? ' ' : '*'), number_of_rgs, blk, (rg_was_fnd ? "intact" : "*** DAMAGED ***")); prev_rgd = calc_rgd; @@ -286,7 +288,7 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, else block_bump = shortest_dist_btwn_rgs; if (block_bump != 1) - log_warn(" [length 0x%" PRIx64 "]\n", block_bump); + log_warn( _(" [length 0x%" PRIx64 "]\n"), block_bump); } /* for each rg block */ /* ----------------------------------------------------------------- */ /* If we got to the end of the fs, we still need to fix the */ @@ -302,14 +304,14 @@ int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list, prev_rgd->ri.ri_data = rgblocks; prev_rgd->ri.ri_data -= prev_rgd->ri.ri_data % GFS2_NBBY; prev_rgd->ri.ri_bitbytes = prev_rgd->ri.ri_data / GFS2_NBBY; - log_debug("Prev ri_data set to: %" PRIx32 ".\n", + log_debug( _("Prev ri_data set to: %" PRIx32 ".\n"), prev_rgd->ri.ri_data); prev_rgd = NULL; /* make sure we don't use it later */ } /* ---------------------------------------------- */ /* Now dump out the information (if verbose mode) */ /* ---------------------------------------------- */ - log_debug("RG index rebuilt as follows:\n"); + log_debug( _("RG index rebuilt as follows:\n")); for (tmp = ret_list, rgi = 0; tmp != ret_list; tmp = tmp->next, rgi++) { calc_rgd = osi_list_entry(tmp, struct rgrp_list, list); @@ -343,7 +345,7 @@ int gfs2_rindex_calculate(struct gfs2_sbd *sdp, osi_list_t *ret_list, osi_list_init(ret_list); sdp->rgsize = GFS2_DEFAULT_RGSIZE; /* compute_rgrp_layout adjusts */ if (device_geometry(sdp)) { - fprintf(stderr, "Geometry error\n"); + fprintf(stderr, _("Geometry error\n")); exit(-1); } fix_device_geometry(sdp); @@ -351,7 +353,7 @@ int gfs2_rindex_calculate(struct gfs2_sbd *sdp, osi_list_t *ret_list, compute_rgrp_layout(sdp, FALSE); build_rgrps(sdp, FALSE); /* FALSE = calc but don't write to disk. */ *num_rgs = 0; - log_debug("fs_total_size = 0x%" PRIX64 " blocks.\n", + log_debug( _("fs_total_size = 0x%" PRIX64 " blocks.\n"), sdp->device.length); /* ----------------------------------------------------------------- */ /* Calculate how many RGs there are supposed to be based on the */ @@ -361,7 +363,7 @@ int gfs2_rindex_calculate(struct gfs2_sbd *sdp, osi_list_t *ret_list, /* the index. */ /* ----------------------------------------------------------------- */ *num_rgs = sdp->md.riinode->i_di.di_size / sizeof(struct gfs2_rindex); - log_warn("L2: number of rgs in the index = %d.\n", *num_rgs); + log_warn( _("L2: number of rgs in the index = %d.\n"), *num_rgs); return 0; } @@ -374,15 +376,15 @@ int rewrite_rg_block(struct gfs2_sbd *sdp, struct rgrp_list *rg, { int x = errblock - rg->ri.ri_addr; - log_err("Block #%"PRIu64" (0x%" PRIx64") (%d of %d) is neither" - " GFS2_METATYPE_RB nor GFS2_METATYPE_RG.\n", + log_err( _("Block #%"PRIu64" (0x%" PRIx64") (%d of %d) is neither" + " GFS2_METATYPE_RB nor GFS2_METATYPE_RG.\n"), rg->bh[x]->b_blocknr, rg->bh[x]->b_blocknr, (int)x+1, (int)rg->ri.ri_length); errors_found++; if (query(&opts, "Fix the RG? (y/n)")) { errors_corrected++; - log_err("Attempting to repair the RG.\n"); + log_err( _("Attempting to repair the RG.\n")); rg->bh[x] = bread(&sdp->nvbuf_list, rg->ri.ri_addr + x); if (x) { struct gfs2_meta_header mh; @@ -436,7 +438,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count) error = gfs2_rindex_rebuild(sdp, &expected_rglist, &calc_rg_count); if (error) { - log_crit("Error rebuilding rg list.\n"); + log_crit( _("Error rebuilding rg list.\n")); gfs2_rgrp_free(&expected_rglist, not_updated); return -1; } @@ -446,16 +448,16 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count) osi_list_init(&sdp->rglist); /* Just to be safe */ rindex_read(sdp, 0, &rgcount_from_index); if (sdp->md.riinode->i_di.di_size % sizeof(struct gfs2_rindex)) { - log_warn("WARNING: rindex file is corrupt.\n"); + log_warn( _("WARNING: rindex file is corrupt.\n")); gfs2_rgrp_free(&expected_rglist, not_updated); gfs2_rgrp_free(&sdp->rglist, not_updated); return -1; } - log_warn("L%d: number of rgs expected = %lld.\n", trust_lvl + 1, + log_warn( _("L%d: number of rgs expected = %lld.\n"), trust_lvl + 1, (unsigned long long)sdp->rgrps); if (calc_rg_count != sdp->rgrps) { - log_warn("L%d: They don't match; either (1) the fs was extended, (2) an odd\n", trust_lvl + 1); - log_warn("L%d: rg size was used, or (3) we have a corrupt rg index.\n", trust_lvl + 1); + log_warn( _("L%d: They don't match; either (1) the fs was extended, (2) an odd\n"), trust_lvl + 1); + log_warn( _("L%d: rg size was used, or (3) we have a corrupt rg index.\n"), trust_lvl + 1); gfs2_rgrp_free(&expected_rglist, not_updated); gfs2_rgrp_free(&sdp->rglist, not_updated); return -1; @@ -484,9 +486,9 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count) } } if (trust_lvl < distrust && descrepencies > (trust_lvl * 8)) { - log_warn("Level %d didn't work. Too many descepencies.\n", + log_warn( _("Level %d didn't work. Too many descepencies.\n"), trust_lvl + 1); - log_warn("%d out of %d RGs did not match what was expected.\n", + log_warn( _("%d out of %d RGs did not match what was expected.\n"), descrepencies, rg); gfs2_rgrp_free(&expected_rglist, not_updated); gfs2_rgrp_free(&sdp->rglist, not_updated); @@ -512,7 +514,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count) /* If we modified the index, write it back to disk. */ if (rindex_modified) { errors_found++; - if (query(&opts, "Fix the index? (y/n)")) { + if (query(&opts, _("Fix the index? (y/n)"))) { errors_corrected++; gfs2_rindex_out(&expected->ri, (char *)&buf); gfs2_writei(sdp->md.riinode, (char *)&buf, @@ -535,7 +537,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count) gfs2_compute_bitstructs(sdp, actual); } else - log_err("RG index not fixed.\n"); + log_err( _("RG index not fixed.\n")); rindex_modified = FALSE; } diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c index 46b1de3..af88a7f 100644 --- a/gfs2/fsck/util.c +++ b/gfs2/fsck/util.c @@ -4,6 +4,8 @@ #include <unistd.h> #include <sys/time.h> #include <stdio.h> +#include <libintl.h> +#define _(String) gettext(String) #include "libgfs2.h" #include "fs_bits.h" @@ -61,7 +63,7 @@ void warm_fuzzy_stuff(uint64_t block) seconds = tv.tv_sec; if (last_fs_block) { percent = (block * 100) / last_fs_block; - log_notice("\r%" PRIu64 " percent complete.\r", percent); + log_notice( _("\r%" PRIu64 " percent complete.\r"), percent); } } }
reply other threads:[~2009-03-24 21:00 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=20090324205932.802A51201A0@lists.fedorahosted.org \ --to=swhiteho@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /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: linkBe 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 read-only IMAP folder(s) and NNTP newsgroup(s).