summaryrefslogtreecommitdiff
blob: de5d2f6c19f37b2bafd8ddd1ec869d3ed5d7c143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
--- src/main_lde.c.orig	2003-11-11 10:06:07.847527296 -0500
+++ src/main_lde.c	2003-11-11 10:06:40.338587904 -0500
@@ -79,7 +79,7 @@
 char *badblocks_directory = NULL;
 
 int CURR_DEVICE = 0;
-volatile struct _lde_flags lde_flags = 
+volatile struct _lde_flags my_lde_flags = 
   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ;
 
 void (*lde_warn)(char *fmt, ...) = tty_warn;
@@ -110,18 +110,18 @@
   /* Set last character to 0 (we've allocated a space for the 0) */
   mtab[statbuf.st_size] = 0;
   if (strstr(mtab, device_name))
-    lde_flags.mounted = 1;
+    my_lde_flags.mounted = 1;
   else
-    lde_flags.mounted = 0;
+    my_lde_flags.mounted = 0;
   free(mtab);
 
-  return lde_flags.mounted;
+  return my_lde_flags.mounted;
 }
 
 /* Define a handler for Interrupt signals: Ctrl-C */
 static void handle_sigint(int a, void * b, void *c)
 {
-  lde_flags.quit_now = 1;
+  my_lde_flags.quit_now = 1;
 }
 
 int check_root(void)
@@ -293,10 +293,10 @@
 	exit(0);
 	break;
       case 'a': /* Search disk space marked in use as well as unused */
-	lde_flags.search_all = 1;
+	my_lde_flags.search_all = 1;
 	break;
       case '0': /* Linux 2.0 blanked indirect workaround */
-	lde_flags.blanked_indirects = 1;
+	my_lde_flags.blanked_indirects = 1;
 	break;
       case 'g': /* Search for an inode which contains the specified block */
 	opts->grep_mode = 1;
@@ -325,14 +325,14 @@
 	break;
       case 'r':
       case 'p': /* open FS read only */
-	lde_flags.paranoid = 1;
+	my_lde_flags.paranoid = 1;
 	break;
       case 'P': /* Superblock scanner */
 	opts->superscan = 1;
 	opts->skiptableread = 1;
 	break;
       case 'q': /* no audio -- well nop beeps */
-	lde_flags.quiet = 1;
+	my_lde_flags.quiet = 1;
 	break;
       case 's': /* Override blocksize */
 	opts->blocksize = read_num(optarg);
@@ -393,7 +393,7 @@
 	opts->search_off = read_num(optarg);
 	break;
 	  case 'F': /* Log all errors/messages to /tmp/ldeerrors */
-	lde_flags.logtofile = 1;
+	my_lde_flags.logtofile = 1;
 	break;
       case 'L': /* Set length for search string */
 	opts->search_len = read_num(optarg);
@@ -403,21 +403,21 @@
 	}
 	break;
       case 'w': /* Set FS writable */
-	lde_flags.write_ok = 1;
+	my_lde_flags.write_ok = 1;
 	break;
       case '!': /* Search for indirect blocks. */
-	lde_flags.indirect_search = 1;
+	my_lde_flags.indirect_search = 1;
 	opts->search_string = "";
 	opts->search_len = 0;
 	break;
       case '@': /* Lookup inodes on search matches. */
-	lde_flags.inode_lookup = 1;
+	my_lde_flags.inode_lookup = 1;
 	break;
       case '#': /* Check for recoverablilty on search matches. */
-	lde_flags.check_recover = 1;
+	my_lde_flags.check_recover = 1;
 	break;
       case '%': /* Always append data when recovery file exists */
-	lde_flags.always_append = 1;
+	my_lde_flags.always_append = 1;
 	break;
       case 'f': /* Specify name of recovery file */
 	opts->recover_file_name = optarg;
@@ -458,7 +458,7 @@
 
   struct _main_opts main_opts = { 0, 0, 0, AUTODETECT, 0, 0, 0UL, 0UL, NULL, NULL, NULL, 0, 0, 0, 0 };
 
-  /* Set things up to handle control-c:  just sets lde_flags.quit_now to 1 */
+  /* Set things up to handle control-c:  just sets my_lde_flags.quit_now to 1 */
   sigemptyset(&sa_mask);
   intaction.sa_handler = (void *)handle_sigint;
   intaction.sa_mask = sa_mask;
@@ -467,17 +467,17 @@
 
   parse_cmdline(argc, argv, &main_opts);
 
-  if (check_mount(device_name)&&!lde_flags.paranoid)
+  if (check_mount(device_name)&&!my_lde_flags.paranoid)
     lde_warn("Device \"%s\" is mounted, be careful",device_name);
 
 #ifndef PARANOID
-  if (!lde_flags.paranoid) {
+  if (!my_lde_flags.paranoid) {
     CURR_DEVICE = open(device_name,O_RDWR|O_BINARY);
     if (CURR_DEVICE < 0) {
       lde_warn("No write access to \"%s\",  attempting to open read-only.",
 	       device_name);
       CURR_DEVICE = open(device_name,O_RDONLY|O_BINARY);
-      lde_flags.write_ok = 0;
+      my_lde_flags.write_ok = 0;
     }
   } else
 #endif
@@ -507,7 +507,7 @@
   /* Process requests handled by tty based lde */
   if (main_opts.recover_file_name!=NULL) {
     /* Check if file exists, if so, check if append flag is set and open accordingly */
-    if ( ( (fp = open(main_opts.recover_file_name,O_RDONLY|O_BINARY)) > 0 ) && lde_flags.always_append ) {
+    if ( ( (fp = open(main_opts.recover_file_name,O_RDONLY|O_BINARY)) > 0 ) && my_lde_flags.always_append ) {
       close(fp);
       fp = open(main_opts.recover_file_name,O_WRONLY|O_APPEND|O_BINARY);
     } else {  /* It's ok to create a new file */
@@ -550,14 +550,14 @@
       }
 
       /* Looks for recoverable inodes */
-      if (lde_flags.check_recover) {
+      if (my_lde_flags.check_recover) {
 	lde_warn = no_warn;  /* Suppress output */
 	for (nr=main_opts.dump_start; nr<main_opts.dump_end; nr++) {
-	  if (lde_flags.quit_now) {
+	  if (my_lde_flags.quit_now) {
 	    fprintf(stderr,"Search aborted at inode 0x%lX\n",nr);
 	    exit(0);
 	  }
-	  if ((!FS_cmd.inode_in_use(nr))||(lde_flags.search_all)) {
+	  if ((!FS_cmd.inode_in_use(nr))||(my_lde_flags.search_all)) {
 	    GInode = FS_cmd.read_inode(nr);
 	    /* Make sure there's some data here */
 	    hasdata = 0;
@@ -584,7 +584,7 @@
 	  }
 	}
 	exit(0);
-      } /* if (lde_flags.check_recover) */
+      } /* if (my_lde_flags.check_recover) */
 
     } else {
       if ((main_opts.dump_start>sb->nzones)||(main_opts.dump_end>sb->nzones)) {
@@ -597,9 +597,9 @@
       }
 
       /* Lookup blocks inode reference and exit */
-      if (lde_flags.inode_lookup) {
+      if (my_lde_flags.inode_lookup) {
 	for (nr=main_opts.dump_start; nr<main_opts.dump_end; nr++) {
-	  if (lde_flags.quit_now) {
+	  if (my_lde_flags.quit_now) {
 	    fprintf(stderr,"Search aborted at block 0x%lX\n",nr);
 	    exit(0);
 	  }
@@ -607,7 +607,7 @@
 	  if ( (inode_nr = find_inode(nr, 0UL)) ) {
 	    printf("found in inode 0x%lX\n",inode_nr);
 	  } else {
-	    printf("not found in any %sinode\n",((lde_flags.search_all)?"":"unused ") );
+	    printf("not found in any %sinode\n",((my_lde_flags.search_all)?"":"unused ") );
 	  }
 	}
 	exit(0);
@@ -615,7 +615,7 @@
 
     }
     for (nr=main_opts.dump_start; nr<main_opts.dump_end; nr++) {
-      if (lde_flags.quit_now) {
+      if (my_lde_flags.quit_now) {
 	fprintf(stderr,"\nDump aborted at 0x%lX\n",nr);
 	exit(0);
       }