~ubuntu-branches/ubuntu/natty/redhat-cluster/natty

« back to all changes in this revision

Viewing changes to gfs2/fsck/lost_n_found.c

  • Committer: Bazaar Package Importer
  • Author(s): Ante Karamatic
  • Date: 2009-09-15 07:15:43 UTC
  • mfrom: (1.1.16 upstream) (10.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090915071543-vr089k11l3kl9llu
Tags: 3.0.2-2ubuntu1
Remove unnecessary build dep on libvolume-id-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#include <sys/stat.h>
6
6
#include <unistd.h>
7
7
#include <dirent.h>
 
8
#include <libintl.h>
 
9
#define _(String) gettext(String)
8
10
 
9
11
#include "fsck.h"
10
12
#include "libgfs2.h"
29
31
        if(!lf_dip) {
30
32
                struct gfs2_block_query q = {0};
31
33
 
32
 
                log_info("Locating/Creating lost and found directory\n");
 
34
                log_info( _("Locating/Creating lost and found directory\n"));
33
35
 
34
36
        lf_dip = createi(ip->i_sbd->md.rooti, "lost+found", S_IFDIR | 0700, 0);
35
37
        if(gfs2_block_check(ip->i_sbd, bl, lf_dip->i_di.di_num.no_addr, &q)) {
54
56
                }
55
57
        }
56
58
        if(ip->i_di.di_num.no_addr == lf_dip->i_di.di_num.no_addr) {
57
 
                log_err("Trying to add lost+found to itself...skipping");
 
59
                log_err( _("Trying to add lost+found to itself...skipping"));
58
60
                return 0;
59
61
        }
60
62
        switch(ip->i_di.di_mode & S_IFMT){
61
63
        case S_IFDIR:
62
 
                log_info("Adding .. entry pointing to lost+found for %"PRIu64"\n",
63
 
                                 ip->i_di.di_num.no_addr);
 
64
                log_info( _("Adding .. entry pointing to lost+found for %llu\n"),
 
65
                                 (unsigned long long)ip->i_di.di_num.no_addr);
64
66
                sprintf(tmp_name, "..");
65
67
                filename_len = strlen(tmp_name);  /* no trailing NULL */
66
68
                if(!(filename = malloc((sizeof(char) * filename_len) + 1))) {
67
 
                        log_err("Unable to allocate name\n");
 
69
                        log_err( _("Unable to allocate name\n"));
68
70
                        stack;
69
71
                        return -1;
70
72
                }
71
73
                if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) {
72
 
                        log_err("Unable to zero name\n");
 
74
                        log_err( _("Unable to zero name\n"));
73
75
                        stack;
74
76
                        return -1;
75
77
                }
76
78
                memcpy(filename, tmp_name, filename_len);
77
79
 
78
80
                if(gfs2_dirent_del(ip, NULL, filename, filename_len))
79
 
                        log_warn("add_inode_to_lf:  "
80
 
                                         "Unable to remove \"..\" directory entry.\n");
 
81
                        log_warn( _("add_inode_to_lf:  "
 
82
                                         "Unable to remove \"..\" directory entry.\n"));
81
83
 
82
84
                dir_add(ip, filename, filename_len, &(lf_dip->i_di.di_num), DT_DIR);
83
85
                free(filename);
123
125
        }
124
126
        filename_len = strlen(tmp_name);  /* no trailing NULL */
125
127
        if(!(filename = malloc(sizeof(char) * filename_len))) {
126
 
                log_err("Unable to allocate name\n");
 
128
                log_err( _("Unable to allocate name\n"));
127
129
                        stack;
128
130
                        return -1;
129
131
                }
130
132
        if(!memset(filename, 0, sizeof(char) * filename_len)) {
131
 
                log_err("Unable to zero name\n");
 
133
                log_err( _("Unable to zero name\n"));
132
134
                stack;
133
135
                return -1;
134
136
        }
140
142
                increment_link(ip->i_sbd, lf_dip->i_di.di_num.no_addr);
141
143
 
142
144
        free(filename);
143
 
        log_notice("Added inode #%"PRIu64" to lost+found dir\n",
144
 
                           ip->i_di.di_num.no_addr);
 
145
        log_notice( _("Added inode #%llu to lost+found dir\n"),
 
146
                   (unsigned long long)ip->i_di.di_num.no_addr);
145
147
        return 0;
146
148
}