Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/e2fsprogs
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- Location:
- branches/2.2.9/mindi-busybox/e2fsprogs
- Files:
-
- 9 added
- 91 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/e2fsprogs/Config.in
r1765 r2725 1 # DO NOT EDIT. This file is generated from Config.src 1 2 # 2 3 # For a description of the syntax of this configuration file, … … 6 7 menu "Linux Ext2 FS Progs" 7 8 9 10 8 11 config CHATTR 9 12 bool "chattr" 10 default n13 default y 11 14 help 12 15 chattr changes the file attributes on a second extended file system. 13 16 14 17 ### config E2FSCK 15 ### 16 ### default n17 ### 18 ### 19 ### 20 ### 21 ### 18 ### bool "e2fsck" 19 ### default y 20 ### help 21 ### e2fsck is used to check Linux second extended file systems (ext2fs). 22 ### e2fsck also supports ext2 filesystems countaining a journal (ext3). 23 ### The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also 24 ### provided. 22 25 23 26 config FSCK 24 27 bool "fsck" 25 default n28 default y 26 29 help 27 30 fsck is used to check and optionally repair one or more filesystems. … … 31 34 config LSATTR 32 35 bool "lsattr" 33 default n 36 default y 37 depends on PLATFORM_LINUX 34 38 help 35 39 lsattr lists the file attributes on a second extended file system. 36 40 37 41 ### config MKE2FS 38 ### 39 ### default n40 ### 41 ### mke2fs is used to create an ext2/ext3 filesystem.The normal compat42 ### 42 ### bool "mke2fs" 43 ### default y 44 ### help 45 ### mke2fs is used to create an ext2/ext3 filesystem. The normal compat 46 ### symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. 43 47 44 ###config TUNE2FS45 ###bool "tune2fs"46 ### defaultn47 ###help48 ###tune2fs allows the system administrator to adjust various tunable49 ###filesystem parameters on Linux ext2/ext3 filesystems.48 config TUNE2FS 49 bool "tune2fs" 50 default n # off: it is too limited compared to upstream version 51 help 52 tune2fs allows the system administrator to adjust various tunable 53 filesystem parameters on Linux ext2/ext3 filesystems. 50 54 51 55 ### config E2LABEL 52 ### 53 ### default n54 ### 55 ### 56 ### 57 ### 56 ### bool "e2label" 57 ### default y 58 ### depends on TUNE2FS 59 ### help 60 ### e2label will display or change the filesystem label on the ext2 61 ### filesystem located on device. 58 62 63 ### NB: this one is now provided by util-linux/volume_id/* 59 64 ### config FINDFS 60 ### 61 ### default n62 ### 63 ### 64 ### 65 ### 65 ### bool "findfs" 66 ### default y 67 ### depends on TUNE2FS 68 ### help 69 ### findfs will search the disks in the system looking for a filesystem 70 ### which has a label matching label or a UUID equal to uuid. 66 71 67 72 endmenu -
branches/2.2.9/mindi-busybox/e2fsprogs/Kbuild
r1765 r2725 1 # DO NOT EDIT. This file is generated from Kbuild.src 1 2 # Makefile for busybox 2 3 # 3 4 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 4 5 # 5 # Licensed under the GPL v2, see the file LICENSE in this tarball.6 # Licensed under GPLv2, see file LICENSE in this source tree. 6 7 7 8 lib-y:= 9 10 8 11 9 12 lib-$(CONFIG_CHATTR) += chattr.o e2fs_lib.o 10 13 lib-$(CONFIG_LSATTR) += lsattr.o e2fs_lib.o 11 14 12 lib-$(CONFIG_FSCK) += fsck.o 15 lib-$(CONFIG_FSCK) += fsck.o 16 lib-$(CONFIG_TUNE2FS) += tune2fs.o -
branches/2.2.9/mindi-busybox/e2fsprogs/chattr.c
r1765 r2725 38 38 static unsigned long get_flag(char c) 39 39 { 40 /* Two separate vectors take less space than vector of structs */ 41 static const char flags_letter[] ALIGN1 = "ASDacdijsutT"; 42 static const unsigned long flags_val[] = { 43 /* A */ EXT2_NOATIME_FL, 44 /* S */ EXT2_SYNC_FL, 45 /* D */ EXT2_DIRSYNC_FL, 46 /* a */ EXT2_APPEND_FL, 47 /* c */ EXT2_COMPR_FL, 48 /* d */ EXT2_NODUMP_FL, 49 /* i */ EXT2_IMMUTABLE_FL, 50 /* j */ EXT3_JOURNAL_DATA_FL, 51 /* s */ EXT2_SECRM_FL, 52 /* u */ EXT2_UNRM_FL, 53 /* t */ EXT2_NOTAIL_FL, 54 /* T */ EXT2_TOPDIR_FL, 55 }; 56 const char *fp; 57 58 for (fp = flags_letter; *fp; fp++) 59 if (*fp == c) 60 return flags_val[fp - flags_letter]; 40 const char *fp = strchr(e2attr_flags_sname_chattr, c); 41 if (fp) 42 return e2attr_flags_value_chattr[fp - e2attr_flags_sname_chattr]; 61 43 bb_show_usage(); 62 44 } … … 86 68 static void change_attributes(const char *name, struct globals *gp); 87 69 88 static int chattr_dir_proc(const char *dir_name, struct dirent *de, void *gp)70 static int FAST_FUNC chattr_dir_proc(const char *dir_name, struct dirent *de, void *gp) 89 71 { 90 72 char *path = concat_subpath_file(dir_name, de->d_name); … … 143 125 } 144 126 145 int chattr_main(int argc, char **argv) ;146 int chattr_main(int argc , char **argv)127 int chattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 128 int chattr_main(int argc UNUSED_PARAM, char **argv) 147 129 { 148 130 struct globals g; -
branches/2.2.9/mindi-busybox/e2fsprogs/e2fs_defs.h
r1765 r2725 11 11 */ 12 12 13 #ifndef _LINUX_EXT2_FS_H14 #define _LINUX_EXT2_FS_H13 #ifndef LINUX_EXT2_FS_H 14 #define LINUX_EXT2_FS_H 1 15 15 16 16 /* … … 559 559 ~EXT2_DIR_ROUND) 560 560 561 #endif /* _LINUX_EXT2_FS_H */561 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/e2fs_lib.c
r1765 r2725 3 3 * See README for additional information 4 4 * 5 * This file can be redistributed under the terms of the GNU Library General 6 * Public License 5 * Licensed under GPLv2, see file LICENSE in this source tree. 7 6 */ 8 7 … … 30 29 /* Iterate a function on each entry of a directory */ 31 30 int iterate_on_dir(const char *dir_name, 32 int (*func)(const char *, struct dirent *, void *),33 void * 31 int FAST_FUNC (*func)(const char *, struct dirent *, void *), 32 void *private) 34 33 { 35 34 DIR *dir; 36 struct dirent *de, *dep; 37 int max_len, len; 38 39 max_len = PATH_MAX + sizeof(struct dirent); 40 de = xmalloc(max_len+1); 41 memset(de, 0, max_len+1); 35 struct dirent *de; 42 36 43 37 dir = opendir(dir_name); 44 38 if (dir == NULL) { 45 free(de);46 39 return -1; 47 40 } 48 while ((dep = readdir(dir))) { 49 len = sizeof(struct dirent); 50 if (len < dep->d_reclen) 51 len = dep->d_reclen; 52 if (len > max_len) 53 len = max_len; 54 memcpy(de, dep, len); 41 while ((de = readdir(dir)) != NULL) { 55 42 func(dir_name, de, private); 56 43 } 57 44 closedir(dir); 58 free(de);59 45 return 0; 60 46 } … … 68 54 IF_LONG_IS_WIDER(int ver;) 69 55 70 fd = open(name, O_ NONBLOCK);56 fd = open(name, O_RDONLY | O_NONBLOCK); 71 57 if (fd == -1) 72 58 return -1; … … 110 96 goto notsupp; 111 97 } 112 fd = open(name, O_ NONBLOCK); /* neither read nor write asked for */98 fd = open(name, O_RDONLY | O_NONBLOCK); /* neither read nor write asked for */ 113 99 if (fd == -1) 114 100 return -1; … … 142 128 143 129 /* Print file attributes on an ext2 file system */ 144 struct flags_name { 145 unsigned long flag; 146 char short_name; 147 const char *long_name; 130 const uint32_t e2attr_flags_value[] = { 131 #ifdef ENABLE_COMPRESSION 132 EXT2_COMPRBLK_FL, 133 EXT2_DIRTY_FL, 134 EXT2_NOCOMPR_FL, 135 EXT2_ECOMPR_FL, 136 #endif 137 EXT2_INDEX_FL, 138 EXT2_SECRM_FL, 139 EXT2_UNRM_FL, 140 EXT2_SYNC_FL, 141 EXT2_DIRSYNC_FL, 142 EXT2_IMMUTABLE_FL, 143 EXT2_APPEND_FL, 144 EXT2_NODUMP_FL, 145 EXT2_NOATIME_FL, 146 EXT2_COMPR_FL, 147 EXT3_JOURNAL_DATA_FL, 148 EXT2_NOTAIL_FL, 149 EXT2_TOPDIR_FL 148 150 }; 149 151 150 /* TODO: apart from I and (disabled) COMPRESSION flags, this 151 * is a duplicate of a table from chattr. Merge? */ 152 static const struct flags_name flags_array[] = { 153 { EXT2_SECRM_FL, 's', "Secure_Deletion" }, 154 { EXT2_UNRM_FL, 'u' , "Undelete" }, 155 { EXT2_SYNC_FL, 'S', "Synchronous_Updates" }, 156 { EXT2_DIRSYNC_FL, 'D', "Synchronous_Directory_Updates" }, 157 { EXT2_IMMUTABLE_FL, 'i', "Immutable" }, 158 { EXT2_APPEND_FL, 'a', "Append_Only" }, 159 { EXT2_NODUMP_FL, 'd', "No_Dump" }, 160 { EXT2_NOATIME_FL, 'A', "No_Atime" }, 161 { EXT2_COMPR_FL, 'c', "Compression_Requested" }, 152 const char e2attr_flags_sname[] = 162 153 #ifdef ENABLE_COMPRESSION 163 { EXT2_COMPRBLK_FL, 'B', "Compressed_File" }, 164 { EXT2_DIRTY_FL, 'Z', "Compressed_Dirty_File" }, 165 { EXT2_NOCOMPR_FL, 'X', "Compression_Raw_Access" }, 166 { EXT2_ECOMPR_FL, 'E', "Compression_Error" }, 167 #endif 168 { EXT3_JOURNAL_DATA_FL, 'j', "Journaled_Data" }, 169 { EXT2_INDEX_FL, 'I', "Indexed_directory" }, 170 { EXT2_NOTAIL_FL, 't', "No_Tailmerging" }, 171 { EXT2_TOPDIR_FL, 'T', "Top_of_Directory_Hierarchies" }, 172 { 0, '\0', NULL } 173 }; 174 175 void print_flags(FILE *f, unsigned long flags, unsigned options) 176 { 177 const struct flags_name *fp; 178 154 "BZXE" 155 #endif 156 "I" 157 "suSDiadAcjtT"; 158 159 static const char e2attr_flags_lname[] = 160 #ifdef ENABLE_COMPRESSION 161 "Compressed_File" "\0" 162 "Compressed_Dirty_File" "\0" 163 "Compression_Raw_Access" "\0" 164 "Compression_Error" "\0" 165 #endif 166 "Indexed_directory" "\0" 167 "Secure_Deletion" "\0" 168 "Undelete" "\0" 169 "Synchronous_Updates" "\0" 170 "Synchronous_Directory_Updates" "\0" 171 "Immutable" "\0" 172 "Append_Only" "\0" 173 "No_Dump" "\0" 174 "No_Atime" "\0" 175 "Compression_Requested" "\0" 176 "Journaled_Data" "\0" 177 "No_Tailmerging" "\0" 178 "Top_of_Directory_Hierarchies" "\0" 179 /* Another trailing NUL is added by compiler */; 180 181 void print_e2flags(FILE *f, unsigned long flags, unsigned options) 182 { 183 const uint32_t *fv; 184 const char *fn; 185 186 fv = e2attr_flags_value; 179 187 if (options & PFOPT_LONG) { 180 188 int first = 1; 181 for (fp = flags_array; fp->short_name; fp++) { 182 if (flags & fp->flag) { 189 fn = e2attr_flags_lname; 190 do { 191 if (flags & *fv) { 183 192 if (!first) 184 193 fputs(", ", f); 185 fputs(f p->long_name, f);194 fputs(fn, f); 186 195 first = 0; 187 196 } 188 } 197 fv++; 198 fn += strlen(fn) + 1; 199 } while (*fn); 189 200 if (first) 190 201 fputs("---", f); 191 202 } else { 192 for (fp = flags_array; fp->short_name; fp++) { 203 fn = e2attr_flags_sname; 204 do { 193 205 char c = '-'; 194 if (flags & fp->flag)195 c = fp->short_name;206 if (flags & *fv) 207 c = *fn; 196 208 fputc(c, f); 197 } 198 } 199 } 209 fv++; 210 fn++; 211 } while (*fn); 212 } 213 } -
branches/2.2.9/mindi-busybox/e2fsprogs/e2fs_lib.h
r1765 r2725 10 10 #include "e2fs_defs.h" 11 11 12 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 13 12 14 /* Iterate a function on each entry of a directory */ 13 15 int iterate_on_dir(const char *dir_name, 14 int (*func)(const char *, struct dirent *, void *),16 int FAST_FUNC (*func)(const char *, struct dirent *, void *), 15 17 void *private); 16 18 … … 28 30 #define PFOPT_LONG 1 29 31 /* Print file attributes on an ext2 file system */ 30 void print_flags(FILE *f, unsigned long flags, unsigned options); 32 void print_e2flags(FILE *f, unsigned long flags, unsigned options); 33 34 extern const uint32_t e2attr_flags_value[]; 35 extern const char e2attr_flags_sname[]; 36 37 /* If you plan to ENABLE_COMPRESSION, see e2fs_lib.c and chattr.c - */ 38 /* make sure that chattr doesn't accept bad options! */ 39 #ifdef ENABLE_COMPRESSION 40 #define e2attr_flags_value_chattr (&e2attr_flags_value[5]) 41 #define e2attr_flags_sname_chattr (&e2attr_flags_sname[5]) 42 #else 43 #define e2attr_flags_value_chattr (&e2attr_flags_value[1]) 44 #define e2attr_flags_sname_chattr (&e2attr_flags_sname[1]) 45 #endif 46 47 POP_SAVED_FUNCTION_VISIBILITY -
branches/2.2.9/mindi-busybox/e2fsprogs/fsck.c
r1765 r2725 21 21 * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. 22 22 * 23 * %Begin-Header% 24 * This file may be redistributed under the terms of the GNU Public 25 * License. 26 * %End-Header% 23 * Licensed under GPLv2, see file LICENSE in this source tree. 27 24 */ 28 25 … … 40 37 #include "libbb.h" 41 38 39 /* "progress indicator" code is somewhat buggy and ext[23] specific. 40 * We should be filesystem agnostic. IOW: there should be a well-defined 41 * API for fsck.something, NOT ad-hoc hacks in generic fsck. */ 42 #define DO_PROGRESS_INDICATOR 0 43 44 /* fsck 1.41.4 (27-Jan-2009) manpage says: 45 * 0 - No errors 46 * 1 - File system errors corrected 47 * 2 - System should be rebooted 48 * 4 - File system errors left uncorrected 49 * 8 - Operational error 50 * 16 - Usage or syntax error 51 * 32 - Fsck canceled by user request 52 * 128 - Shared library error 53 */ 42 54 #define EXIT_OK 0 43 55 #define EXIT_NONDESTRUCT 1 … … 51 63 * Internal structure for mount table entries. 52 64 */ 53 54 65 struct fs_info { 55 66 struct fs_info *next; … … 58 69 char *type; 59 70 char *opts; 60 int freq;61 71 int passno; 62 72 int flags; … … 72 82 int pid; 73 83 int flags; 74 int exit_status; 84 #if DO_PROGRESS_INDICATOR 75 85 time_t start_time; 86 #endif 76 87 char *prog; 77 char *type;78 88 char *device; 79 89 char *base_device; /* /dev/hda for /dev/hdaN etc */ … … 103 113 #define BASE_MD "/dev/md" 104 114 105 static char **devices;106 115 static char **args; 107 static int num_devices;108 116 static int num_args; 109 117 static int verbose; … … 116 124 static smallint fs_type_negated; 117 125 118 static volatile smallint cancel_requested;119 static smallint doall;120 126 static smallint noexecute; 121 127 static smallint serialize; 122 128 static smallint skip_root; 123 129 /* static smallint like_mount; */ 124 static smallint notitle;125 130 static smallint parallel_root; 126 131 static smallint force_all_parallel; 127 132 128 /* "progress indicator" code is somewhat buggy and ext[23] specific.129 * We should be filesystem agnostic. IOW: there should be a well-defined130 * API for fsck.something, NOT ad-hoc hacks in generic fsck. */131 #define DO_PROGRESS_INDICATOR 0132 133 #if DO_PROGRESS_INDICATOR 133 134 static smallint progress; … … 169 170 int len; 170 171 #endif 171 cp = str = xstrdup(device); 172 173 /* Skip over /dev/; if it's not present, give up. */ 174 if (strncmp(cp, "/dev/", 5) != 0) 172 str = xstrdup(device); 173 174 /* Skip over "/dev/"; if it's not present, give up */ 175 cp = skip_dev_pfx(str); 176 if (cp == str) 175 177 goto errout; 176 cp += 5;177 178 178 179 /* … … 274 275 static struct fs_info *create_fs_device(const char *device, const char *mntpnt, 275 276 const char *type, const char *opts, 276 int freq, intpassno)277 int passno) 277 278 { 278 279 struct fs_info *fs; … … 281 282 fs->device = xstrdup(device); 282 283 fs->mountpt = xstrdup(mntpnt); 284 if (strchr(type, ',')) 285 type = (char *)"auto"; 283 286 fs->type = xstrdup(type); 284 287 fs->opts = xstrdup(opts ? opts : ""); 285 fs->freq = freq; 286 fs->passno = passno; 288 fs->passno = passno < 0 ? 1 : passno; 287 289 /*fs->flags = 0; */ 288 290 /*fs->next = NULL; */ … … 297 299 } 298 300 299 static void strip_line(char *line)300 {301 char *p = line + strlen(line) - 1;302 303 while (*line) {304 if (*p != '\n' && *p != '\r')305 break;306 *p-- = '\0';307 }308 }309 310 static char *parse_word(char **buf)311 {312 char *word, *next;313 314 word = *buf;315 if (*word == '\0')316 return NULL;317 318 word = skip_whitespace(word);319 next = skip_non_whitespace(word);320 if (*next)321 *next++ = '\0';322 *buf = next;323 return word;324 }325 326 static void parse_escape(char *word)327 {328 char *q, c;329 const char *p;330 331 if (!word)332 return;333 334 for (p = q = word; *p; q++) {335 c = *p++;336 if (c != '\\') {337 *q = c;338 } else {339 *q = bb_process_escape_sequence(&p);340 }341 }342 *q = '\0';343 }344 345 static int parse_fstab_line(char *line, struct fs_info **ret_fs)346 {347 char *device, *mntpnt, *type, *opts, *freq, *passno, *cp;348 struct fs_info *fs;349 350 *ret_fs = 0;351 strip_line(line);352 cp = strchr(line, '#');353 if (cp)354 *cp = '\0'; /* Ignore everything after the comment char */355 cp = line;356 357 device = parse_word(&cp);358 if (!device) return 0; /* Allow blank lines */359 mntpnt = parse_word(&cp);360 type = parse_word(&cp);361 opts = parse_word(&cp);362 freq = parse_word(&cp);363 passno = parse_word(&cp);364 365 if (!mntpnt || !type)366 return -1;367 368 parse_escape(device);369 parse_escape(mntpnt);370 parse_escape(type);371 parse_escape(opts);372 parse_escape(freq);373 parse_escape(passno);374 375 if (strchr(type, ','))376 type = NULL;377 378 fs = create_fs_device(device, mntpnt, type ? type : "auto", opts,379 freq ? atoi(freq) : -1,380 passno ? atoi(passno) : -1);381 *ret_fs = fs;382 return 0;383 }384 385 301 /* Load the filesystem database from /etc/fstab */ 386 302 static void load_fs_info(const char *filename) 387 303 { 388 FILE *f; 389 int lineno = 0; 390 int old_fstab = 1; 304 FILE *fstab; 305 struct mntent mte; 391 306 struct fs_info *fs; 392 307 393 f = fopen_or_warn(filename, "r"); 394 if (f == NULL) { 308 fstab = setmntent(filename, "r"); 309 if (!fstab) { 310 bb_perror_msg("can't read '%s'", filename); 395 311 return; 396 312 } 397 while (1) { 398 int r; 399 char *buf = xmalloc_getline(f); 400 if (!buf) break; 401 r = parse_fstab_line(buf, &fs); 402 free(buf); 403 lineno++; 404 if (r < 0) { 405 bb_error_msg("WARNING: bad format " 406 "on line %d of %s", lineno, filename); 407 continue; 408 } 409 if (!fs) 410 continue; 411 if (fs->passno < 0) 412 fs->passno = 0; 413 else 414 old_fstab = 0; 415 } 416 fclose(f); 417 418 if (old_fstab) { 419 fputs("\007" 420 "WARNING: Your /etc/fstab does not contain the fsck passno field.\n" 421 "I will kludge around things for you, but you should fix\n" 422 "your /etc/fstab file as soon as you can.\n\n", stderr); 423 for (fs = filesys_info; fs; fs = fs->next) { 424 fs->passno = 1; 425 } 426 } 313 314 // Loop through entries 315 while (getmntent_r(fstab, &mte, bb_common_bufsiz1, COMMON_BUFSIZE)) { 316 //bb_info_msg("CREATE[%s][%s][%s][%s][%d]", mte.mnt_fsname, mte.mnt_dir, 317 // mte.mnt_type, mte.mnt_opts, 318 // mte.mnt_passno); 319 fs = create_fs_device(mte.mnt_fsname, mte.mnt_dir, 320 mte.mnt_type, mte.mnt_opts, 321 mte.mnt_passno); 322 } 323 endmntent(fstab); 427 324 } 428 325 … … 461 358 * Send a signal to all outstanding fsck child processes 462 359 */ 463 static void kill_all_if_ cancel_requested(void)360 static void kill_all_if_got_signal(void) 464 361 { 465 362 static smallint kill_sent; … … 467 364 struct fsck_instance *inst; 468 365 469 if (! cancel_requested|| kill_sent)366 if (!bb_got_signal || kill_sent) 470 367 return; 471 368 … … 480 377 /* 481 378 * Wait for one child process to exit; when it does, unlink it from 482 * the list of executing child processes, and return it. 483 */ 484 static struct fsck_instance *wait_one(int flags) 379 * the list of executing child processes, free, and return its exit status. 380 * If there is no exited child, return -1. 381 */ 382 static int wait_one(int flags) 485 383 { 486 384 int status; … … 490 388 491 389 if (!instance_list) 492 return NULL; 493 494 if (noexecute) { 495 inst = instance_list; 496 prev = NULL; 497 #ifdef RANDOM_DEBUG 498 while (inst->next && (random() & 1)) { 499 prev = inst; 500 inst = inst->next; 501 } 502 #endif 503 inst->exit_status = 0; 504 goto ret_inst; 505 } 506 507 inst = prev = NULL; /* for gcc */ 508 do { 390 return -1; 391 /* if (noexecute) { already returned -1; } */ 392 393 while (1) { 509 394 pid = waitpid(-1, &status, flags); 510 kill_all_if_ cancel_requested();511 if (pid == 0 && (flags & WNOHANG))512 return NULL;395 kill_all_if_got_signal(); 396 if (pid == 0) /* flags == WNOHANG and no children exited */ 397 return -1; 513 398 if (pid < 0) { 514 if (errno == EINTR || errno == EAGAIN)399 if (errno == EINTR) 515 400 continue; 516 if (errno == ECHILD) { 517 bb_error_msg("wait: no more child process?!?");518 return NULL;401 if (errno == ECHILD) { /* paranoia */ 402 bb_error_msg("wait: no more children"); 403 return -1; 519 404 } 520 405 bb_perror_msg("wait"); … … 523 408 prev = NULL; 524 409 inst = instance_list; 525 while (inst){410 do { 526 411 if (inst->pid == pid) 527 break;412 goto child_died; 528 413 prev = inst; 529 414 inst = inst->next; 530 } 531 } while (!inst); 415 } while (inst); 416 } 417 child_died: 532 418 533 419 if (WIFEXITED(status)) … … 537 423 status = EXIT_UNCORRECTED; 538 424 if (sig != SIGINT) { 539 printf("Warning ... %s %s exited "540 " withsignal %d\n",425 printf("Warning: %s %s terminated " 426 "by signal %d\n", 541 427 inst->prog, inst->device, sig); 542 428 status = EXIT_ERROR; … … 547 433 status = EXIT_ERROR; 548 434 } 549 inst->exit_status = status;550 435 551 436 #if DO_PROGRESS_INDICATOR … … 576 461 #endif 577 462 578 ret_inst:579 463 if (prev) 580 464 prev->next = inst->next; … … 583 467 if (verbose > 1) 584 468 printf("Finished with %s (exit status %d)\n", 585 inst->device, inst->exit_status);469 inst->device, status); 586 470 num_running--; 587 return inst;588 } 589 590 #define FLAG_WAIT_ALL 0 591 #define FLAG_WAIT_ATLEAST_ONE 1 471 free_instance(inst); 472 473 return status; 474 } 475 592 476 /* 593 477 * Wait until all executing child processes have exited; return the 594 478 * logical OR of all of their exit code values. 595 479 */ 480 #define FLAG_WAIT_ALL 0 481 #define FLAG_WAIT_ATLEAST_ONE WNOHANG 596 482 static int wait_many(int flags) 597 483 { 598 struct fsck_instance *inst;484 int exit_status; 599 485 int global_status = 0; 600 486 int wait_flags = 0; 601 487 602 while ((inst = wait_one(wait_flags))) { 603 global_status |= inst->exit_status; 604 free_instance(inst); 605 #ifdef RANDOM_DEBUG 606 if (noexecute && (flags & WNOHANG) && !(random() % 3)) 607 break; 608 #endif 609 if (flags & FLAG_WAIT_ATLEAST_ONE) 610 wait_flags = WNOHANG; 488 while ((exit_status = wait_one(wait_flags)) != -1) { 489 global_status |= exit_status; 490 wait_flags |= flags; 611 491 } 612 492 return global_status; … … 617 497 * child processes we are waiting for. 618 498 */ 619 static void execute(const char *type, const char *device, const char *mntpt, 620 int interactive) 621 { 622 char *argv[num_args + 4]; /* see count below: */ 623 int argc; 499 static void execute(const char *type, const char *device, 500 const char *mntpt /*, int interactive */) 501 { 624 502 int i; 625 503 struct fsck_instance *inst; 626 504 pid_t pid; 627 505 628 inst = xzalloc(sizeof(*inst)); 629 630 argv[0] = xasprintf("fsck.%s", type); /* 1 */ 631 for (i = 0; i < num_args; i++) 632 argv[i+1] = args[i]; /* num_args */ 633 argc = num_args + 1; 506 args[0] = xasprintf("fsck.%s", type); 634 507 635 508 #if DO_PROGRESS_INDICATOR … … 638 511 || strcmp(type, "ext3") == 0 639 512 ) { 640 arg v[argc++] = xasprintf("-C%d", progress_fd); /* 1 */513 args[XXX] = xasprintf("-C%d", progress_fd); /* 1 */ 641 514 inst->flags |= FLAG_PROGRESS; 642 515 } … … 644 517 #endif 645 518 646 arg v[argc++] = xstrdup(device); /* 1 */647 argv[argc] = NULL; /* 1*/519 args[num_args - 2] = (char*)device; 520 /* args[num_args - 1] = NULL; - already is */ 648 521 649 522 if (verbose || noexecute) { 650 printf("[%s (%d) -- %s]", arg v[0], num_running,523 printf("[%s (%d) -- %s]", args[0], num_running, 651 524 mntpt ? mntpt : device); 652 for (i = 0; i < argc; i++)653 printf(" %s", arg v[i]);654 puts("");525 for (i = 0; args[i]; i++) 526 printf(" %s", args[i]); 527 bb_putchar('\n'); 655 528 } 656 529 … … 658 531 pid = -1; 659 532 if (!noexecute) { 660 pid = spawn(arg v);533 pid = spawn(args); 661 534 if (pid < 0) 662 bb_perror_msg("%s", argv[0]); 663 } 664 665 for (i = num_args+1; i < argc; i++) 666 free(argv[i]); 667 535 bb_simple_perror_msg(args[0]); 536 } 537 538 #if DO_PROGRESS_INDICATOR 539 free(args[XXX]); 540 #endif 541 542 /* No child, so don't record an instance */ 543 if (pid <= 0) { 544 free(args[0]); 545 return; 546 } 547 548 inst = xzalloc(sizeof(*inst)); 668 549 inst->pid = pid; 669 inst->prog = argv[0]; 670 inst->type = xstrdup(type); 550 inst->prog = args[0]; 671 551 inst->device = xstrdup(device); 672 552 inst->base_device = base_device(device); 553 #if DO_PROGRESS_INDICATOR 673 554 inst->start_time = time(NULL); 555 #endif 674 556 675 557 /* Add to the list of running fsck's. … … 689 571 * specified in /etc/fstab, or "auto". 690 572 */ 691 static void fsck_device(struct fs_info *fs , int interactive)573 static void fsck_device(struct fs_info *fs /*, int interactive */) 692 574 { 693 575 const char *type; … … 716 598 717 599 num_running++; 718 execute(type, fs->device, fs->mountpt , interactive);600 execute(type, fs->device, fs->mountpt /*, interactive */); 719 601 } 720 602 … … 868 750 * filesystem types (done as a side-effect of calling ignore()). 869 751 */ 870 for (fs = filesys_info; fs; fs = fs->next) {752 for (fs = filesys_info; fs; fs = fs->next) 871 753 if (ignore(fs)) 872 754 fs->flags |= FLAG_DONE; 873 }874 755 875 756 /* … … 878 759 if (!parallel_root) { 879 760 for (fs = filesys_info; fs; fs = fs->next) { 880 if (LONE_CHAR(fs->mountpt, '/')) 881 break;882 }883 if (fs) {884 if (!skip_root && !ignore(fs)) {885 fsck_device(fs, 1);886 status |= wait_many(FLAG_WAIT_ALL);887 if (status > EXIT_NONDESTRUCT)888 return status;761 if (LONE_CHAR(fs->mountpt, '/')) { 762 if (!skip_root && !ignore(fs)) { 763 fsck_device(fs /*, 1*/); 764 status |= wait_many(FLAG_WAIT_ALL); 765 if (status > EXIT_NONDESTRUCT) 766 return status; 767 } 768 fs->flags |= FLAG_DONE; 769 break; 889 770 } 890 fs->flags |= FLAG_DONE;891 771 } 892 772 } 893 773 /* 894 * This is for the bone-headed user who enters the root 895 * filesystem twice. Skip root will skip all root entries. 774 * This is for the bone-headed user who has root 775 * filesystem listed twice. 776 * "Skip root" will skip _all_ root entries. 896 777 */ 897 778 if (skip_root) … … 907 788 908 789 for (fs = filesys_info; fs; fs = fs->next) { 909 if ( cancel_requested)790 if (bb_got_signal) 910 791 break; 911 792 if (fs->flags & FLAG_DONE) … … 913 794 /* 914 795 * If the filesystem's pass number is higher 915 * than the current pass number, then we d on't796 * than the current pass number, then we didn't 916 797 * do it yet. 917 798 */ … … 932 813 * Spawn off the fsck process 933 814 */ 934 fsck_device(fs , serialize);815 fsck_device(fs /*, serialize*/); 935 816 fs->flags |= FLAG_DONE; 936 817 … … 947 828 } 948 829 } 949 if ( cancel_requested)830 if (bb_got_signal) 950 831 break; 951 832 if (verbose > 1) … … 960 841 not_done_yet = 1; 961 842 } 962 kill_all_if_ cancel_requested();843 kill_all_if_got_signal(); 963 844 status |= wait_many(FLAG_WAIT_ATLEAST_ONE); 964 845 return status; … … 976 857 smallint negate; 977 858 978 if (fs_type) { 979 s = fs_type; 980 while ((s = strchr(s, ','))) { 981 num++; 982 s++; 983 } 859 s = fs_type; 860 while ((s = strchr(s, ','))) { 861 num++; 862 s++; 984 863 } 985 864 … … 987 866 fs_type_flag = xzalloc(num * sizeof(fs_type_flag[0])); 988 867 fs_type_negated = -1; /* not yet known is it negated or not */ 989 990 if (!fs_type)991 return;992 868 993 869 num = 0; … … 1028 904 } 1029 905 1030 static void parse_args(int argc, char **argv) 1031 { 1032 int i, j; 1033 char *arg, *tmp; 1034 char *options = NULL; 1035 int optpos = 0; 1036 int opts_for_fsck = 0; 1037 1038 /* in bss, so already zeroed 906 static char **new_args(void) 907 { 908 args = xrealloc_vector(args, 2, num_args); 909 return &args[num_args++]; 910 } 911 912 int fsck_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 913 int fsck_main(int argc UNUSED_PARAM, char **argv) 914 { 915 int i, status; 916 /*int interactive;*/ 917 struct fs_info *fs; 918 const char *fstab; 919 char *tmp; 920 char **devices; 921 int num_devices; 922 smallint opts_for_fsck; 923 smallint doall; 924 smallint notitle; 925 926 /* we want wait() to be interruptible */ 927 signal_no_SA_RESTART_empty_mask(SIGINT, record_signo); 928 signal_no_SA_RESTART_empty_mask(SIGTERM, record_signo); 929 930 setbuf(stdout, NULL); 931 932 opts_for_fsck = doall = notitle = 0; 933 devices = NULL; 1039 934 num_devices = 0; 1040 num_args = 0; 1041 instance_list = NULL; 1042 */ 1043 1044 /* TODO: getopt32 */ 1045 for (i = 1; i < argc; i++) { 1046 arg = argv[i]; 935 new_args(); /* args[0] = NULL, will be replaced by fsck.<type> */ 936 /* instance_list = NULL; - in bss, so already zeroed */ 937 938 while (*++argv) { 939 int j; 940 int optpos; 941 char *options; 942 char *arg = *argv; 1047 943 1048 944 /* "/dev/blk" or "/path" or "UUID=xxx" or "LABEL=xxx" */ … … 1051 947 // "/path", "UUID=xxx" or "LABEL=xxx" into block device name 1052 948 // ("UUID=xxx"/"LABEL=xxx" can probably shifted to fsck.auto duties) 1053 devices = xrealloc (devices, (num_devices+1) * sizeof(devices[0]));1054 devices[num_devices++] = xstrdup(arg);949 devices = xrealloc_vector(devices, 2, num_devices); 950 devices[num_devices++] = arg; 1055 951 continue; 1056 952 } 1057 953 1058 954 if (arg[0] != '-' || opts_for_fsck) { 1059 args = xrealloc(args, (num_args+1) * sizeof(args[0])); 1060 args[num_args++] = xstrdup(arg); 955 *new_args() = arg; 1061 956 continue; 1062 957 } 1063 958 959 if (LONE_CHAR(arg + 1, '-')) { /* "--" ? */ 960 opts_for_fsck = 1; 961 continue; 962 } 963 964 optpos = 0; 965 options = NULL; 1064 966 for (j = 1; arg[j]; j++) { 1065 if (opts_for_fsck) {1066 optpos++;1067 /* one extra for '\0' */1068 options = xrealloc(options, optpos + 2);1069 options[optpos] = arg[j];1070 continue;1071 }1072 967 switch (arg[j]) { 1073 968 case 'A': … … 1078 973 progress = 1; 1079 974 if (arg[++j]) { /* -Cn */ 1080 progress_fd = xatoi_ u(&arg[j]);975 progress_fd = xatoi_positive(&arg[j]); 1081 976 goto next_arg; 1082 977 } 1083 978 /* -C n */ 1084 progress_fd = xatoi_u(argv[++i]); 979 if (!*++argv) 980 bb_show_usage(); 981 progress_fd = xatoi_positive(*argv); 1085 982 goto next_arg; 1086 983 #endif … … 1111 1008 if (arg[++j]) 1112 1009 tmp = &arg[j]; 1113 else if ( ++i < argc)1114 tmp = argv[i];1010 else if (*++argv) 1011 tmp = *argv; 1115 1012 else 1116 1013 bb_show_usage(); … … 1118 1015 compile_fs_type(fstype); 1119 1016 goto next_arg; 1120 case '-':1121 opts_for_fsck++;1122 break;1123 1017 case '?': 1124 1018 bb_show_usage(); … … 1136 1030 options[0] = '-'; 1137 1031 options[optpos + 1] = '\0'; 1138 args = xrealloc(args, (num_args+1) * sizeof(args[0])); 1139 args[num_args++] = options; 1140 optpos = 0; 1141 options = NULL; 1032 *new_args() = options; 1142 1033 } 1143 1034 } … … 1147 1038 if (tmp) 1148 1039 max_running = xatoi(tmp); 1149 } 1150 1151 static void signal_cancel(int sig ATTRIBUTE_UNUSED) 1152 { 1153 cancel_requested = 1; 1154 } 1155 1156 int fsck_main(int argc, char **argv); 1157 int fsck_main(int argc, char **argv) 1158 { 1159 int i, status = 0; 1160 int interactive; 1161 const char *fstab; 1162 struct fs_info *fs; 1163 struct sigaction sa; 1164 1165 memset(&sa, 0, sizeof(sa)); 1166 sa.sa_handler = signal_cancel; 1167 sigaction(SIGINT, &sa, 0); 1168 sigaction(SIGTERM, &sa, 0); 1169 1170 setbuf(stdout, NULL); 1171 1172 parse_args(argc, argv); 1040 new_args(); /* args[num_args - 2] will be replaced by <device> */ 1041 new_args(); /* args[num_args - 1] is the last, NULL element */ 1173 1042 1174 1043 if (!notitle) … … 1182 1051 load_fs_info(fstab); 1183 1052 1184 interactive = (num_devices == 1) | serialize; 1185 1186 /* If -A was specified ("check all"), do that! */ 1053 /*interactive = (num_devices == 1) | serialize;*/ 1054 1055 if (num_devices == 0) 1056 /*interactive =*/ serialize = doall = 1; 1187 1057 if (doall) 1188 1058 return check_all(); 1189 1059 1190 if (num_devices == 0) { 1191 serialize = 1; 1192 interactive = 1; 1193 return check_all(); 1194 } 1195 1060 status = 0; 1196 1061 for (i = 0; i < num_devices; i++) { 1197 if ( cancel_requested) {1198 kill_all_if_ cancel_requested();1062 if (bb_got_signal) { 1063 kill_all_if_got_signal(); 1199 1064 break; 1200 1065 } … … 1202 1067 fs = lookup(devices[i]); 1203 1068 if (!fs) 1204 fs = create_fs_device(devices[i], 0, "auto", 0, -1, -1);1205 fsck_device(fs , interactive);1069 fs = create_fs_device(devices[i], "", "auto", NULL, -1); 1070 fsck_device(fs /*, interactive */); 1206 1071 1207 1072 if (serialize 1208 1073 || (max_running && (num_running >= max_running)) 1209 1074 ) { 1210 struct fsck_instance *inst; 1211 1212 inst = wait_one(0); 1213 if (inst) { 1214 status |= inst->exit_status; 1215 free_instance(inst); 1216 } 1075 int exit_status = wait_one(0); 1076 if (exit_status >= 0) 1077 status |= exit_status; 1217 1078 if (verbose > 1) 1218 1079 puts("----------------------------------"); -
branches/2.2.9/mindi-busybox/e2fsprogs/lsattr.c
r1765 r2725 46 46 if (option_mask32 & OPT_PF_LONG) { 47 47 printf("%-28s ", name); 48 print_ flags(stdout, fsflags, PFOPT_LONG);49 puts("");48 print_e2flags(stdout, fsflags, PFOPT_LONG); 49 bb_putchar('\n'); 50 50 } else { 51 print_ flags(stdout, fsflags, 0);51 print_e2flags(stdout, fsflags, 0); 52 52 printf(" %s\n", name); 53 53 } … … 58 58 } 59 59 60 static int lsattr_dir_proc(const char *dir_name, struct dirent *de, 61 void *private) 60 static int FAST_FUNC lsattr_dir_proc(const char *dir_name, 61 struct dirent *de, 62 void *private UNUSED_PARAM) 62 63 { 63 64 struct stat st; … … 75 76 printf("\n%s:\n", path); 76 77 iterate_on_dir(path, lsattr_dir_proc, NULL); 77 puts("");78 bb_putchar('\n'); 78 79 } 79 80 } … … 96 97 } 97 98 98 int lsattr_main(int argc, char **argv) ;99 int lsattr_main(int argc , char **argv)99 int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 100 int lsattr_main(int argc UNUSED_PARAM, char **argv) 100 101 { 101 102 getopt32(argv, "Radlv"); … … 103 104 104 105 if (!*argv) 105 lsattr_args("."); 106 else { 107 while (*argv) 108 lsattr_args(*argv++); 109 } 106 *--argv = (char*)"."; 107 do lsattr_args(*argv++); while (*argv); 110 108 111 109 return EXIT_SUCCESS; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/Config.in
r1765 r2725 1 # DO NOT EDIT. This file is generated from Config.src 1 2 # 2 3 # For a description of the syntax of this configuration file, … … 5 6 6 7 menu "Linux Ext2 FS Progs" 8 9 7 10 8 11 config CHATTR … … 39 42 default n 40 43 help 41 mke2fs is used to create an ext2/ext3 filesystem. 44 mke2fs is used to create an ext2/ext3 filesystem. The normal compat 42 45 symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. 43 46 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/Kbuild
r1765 r2725 1 # DO NOT EDIT. This file is generated from Kbuild.src 1 2 # Makefile for busybox 2 3 # 3 4 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 4 5 # 5 # Licensed under the GPL v2, see the file LICENSE in this tarball.6 # Licensed under GPLv2, see file LICENSE in this source tree. 6 7 7 8 lib-y:= 9 10 8 11 9 12 lib-$(CONFIG_CHATTR) += chattr.o -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/Kbuild
r1765 r2725 1 # DO NOT EDIT. This file is generated from Kbuild.src 1 2 # Makefile for busybox 2 3 # 3 4 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 4 5 # 5 # Licensed under the GPL v2, see the file LICENSE in this tarball.6 # Licensed under GPLv2, see file LICENSE in this source tree. 6 7 7 8 NEEDED-$(CONFIG_E2FSCK) = y … … 11 12 12 13 lib-y:= 14 15 16 13 17 lib-$(NEEDED-y) += cache.o dev.o devname.o devno.o blkid_getsize.o \ 14 18 probe.o read.o resolve.o save.o tag.o list.o -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/blkid.h
r1765 r2725 11 11 * %End-Header% 12 12 */ 13 14 #ifndef _BLKID_BLKID_H 15 #define _BLKID_BLKID_H 13 #ifndef BLKID_BLKID_H 14 #define BLKID_BLKID_H 1 16 15 17 16 #include <sys/types.h> … … 103 102 #endif 104 103 105 #endif /* _BLKID_BLKID_H */104 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/blkidP.h
r1765 r2725 11 11 * %End-Header% 12 12 */ 13 14 #ifndef _BLKID_BLKIDP_H 15 #define _BLKID_BLKIDP_H 13 #ifndef BLKID_BLKIDP_H 14 #define BLKID_BLKIDP_H 1 16 15 17 16 #include <sys/types.h> … … 185 184 #endif 186 185 187 #endif /* _BLKID_BLKIDP_H */186 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/cache.c
r1765 r2725 36 36 filename ? filename : "default cache")); 37 37 38 if (!(cache = (blkid_cache) calloc(1, sizeof(struct blkid_struct_cache)))) 39 return -BLKID_ERR_MEM; 38 cache = xzalloc(sizeof(struct blkid_struct_cache)); 40 39 41 40 INIT_LIST_HEAD(&cache->bic_devs); -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/dev.c
r1765 r2725 21 21 blkid_dev dev; 22 22 23 if (!(dev = (blkid_dev) calloc(1, sizeof(struct blkid_struct_dev)))) 24 return NULL; 23 dev = xzalloc(sizeof(struct blkid_struct_dev)); 25 24 26 25 INIT_LIST_HEAD(&dev->bid_devs); … … 83 82 printf(" tag: NULL\n"); 84 83 } 85 puts("");84 bb_putchar('\n'); 86 85 } 87 86 #endif … … 162 161 { 163 162 blkid_dev_iterate iter; 164 blkid_cache 163 blkid_cache cache = NULL; 165 164 blkid_dev dev; 166 165 int c, ret; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/devname.c
r1765 r2725 153 153 154 154 DBG(DEBUG_DEVNAME, printf("opening %s\n", lvm_device)); 155 if ((lvf = fopen (lvm_device, "r")) == NULL) {155 if ((lvf = fopen_for_read(lvm_device)) == NULL) { 156 156 DBG(DEBUG_DEVNAME, printf("%s: (%d) %s\n", lvm_device, errno, 157 157 strerror(errno))); … … 234 234 char device[110]; 235 235 236 procpt = fopen (PROC_EVMS_VOLUMES, "r");236 procpt = fopen_for_read(PROC_EVMS_VOLUMES); 237 237 if (!procpt) 238 238 return 0; 239 239 while (fgets(line, sizeof(line), procpt)) { 240 if (sscanf 240 if (sscanf(line, " %d %d %d %*s %*s %[^\n ]", 241 241 &ma, &mi, &sz, device) != 4) 242 242 continue; … … 259 259 FILE *proc; 260 260 char line[1024]; 261 char ptname0[128], ptname1[128], *ptname = 0;261 char ptname0[128], ptname1[128], *ptname = NULL; 262 262 char *ptnames[2]; 263 263 dev_t devs[2]; … … 274 274 275 275 if (cache->bic_flags & BLKID_BIC_FL_PROBED && 276 time( 0) - cache->bic_time < BLKID_PROBE_INTERVAL)276 time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL) 277 277 return 0; 278 278 … … 283 283 #endif 284 284 285 proc = fopen (PROC_PARTITIONS, "r");285 proc = fopen_for_read(PROC_PARTITIONS); 286 286 if (!proc) 287 287 return -BLKID_ERR_PROC; … … 336 336 fclose(proc); 337 337 338 cache->bic_time = time( 0);338 cache->bic_time = time(NULL); 339 339 cache->bic_flags |= BLKID_BIC_FL_PROBED; 340 340 blkid_flush_cache(cache); -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/list.h
r1765 r2725 1 1 /* vi: set sw=4 ts=4: */ 2 2 #if !defined(_BLKID_LIST_H) && !defined(LIST_HEAD) 3 #define _BLKID_LIST_H3 #define BLKID_LIST_H 1 4 4 5 5 #ifdef __cplusplus … … 71 71 #endif 72 72 73 #endif /* _BLKID_LIST_H */73 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/probe.c
r1765 r2725 83 83 { 84 84 struct ext2_super_block *es = (struct ext2_super_block *) buf; 85 const char *label = 0;85 const char *label = NULL; 86 86 87 87 DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", … … 169 169 struct vfat_super_block *vs; 170 170 char serno[10]; 171 const char *label = 0;171 const char *label = NULL; 172 172 int label_len = 0; 173 173 … … 202 202 struct msdos_super_block *ms = (struct msdos_super_block *) buf; 203 203 char serno[10]; 204 const char *label = 0;204 const char *label = NULL; 205 205 int label_len = 0; 206 206 … … 233 233 { 234 234 struct xfs_super_block *xs; 235 const char *label = 0;235 const char *label = NULL; 236 236 237 237 xs = (struct xfs_super_block *)buf; … … 251 251 struct reiserfs_super_block *rs = (struct reiserfs_super_block *) buf; 252 252 unsigned int blocksize; 253 const char *label = 0;253 const char *label = NULL; 254 254 255 255 blocksize = blkid_le16(rs->rs_blocksize); … … 278 278 { 279 279 struct jfs_super_block *js; 280 const char *label = 0;280 const char *label = NULL; 281 281 282 282 js = (struct jfs_super_block *)buf; … … 296 296 { 297 297 struct romfs_super_block *ros; 298 const char *label = 0;298 const char *label = NULL; 299 299 300 300 ros = (struct romfs_super_block *)buf; … … 313 313 { 314 314 struct cramfs_super_block *csb; 315 const char *label = 0;315 const char *label = NULL; 316 316 317 317 csb = (struct cramfs_super_block *)buf; … … 430 430 major = ocfsmajor(ovh); 431 431 if (major == 1) 432 blkid_set_tag(dev, "SEC_TYPE","ocfs1",sizeof("ocfs1"));432 blkid_set_tag(dev, "SEC_TYPE", "ocfs1", sizeof("ocfs1")); 433 433 else if (major >= 9) 434 blkid_set_tag(dev, "SEC_TYPE","ntocfs",sizeof("ntocfs"));434 blkid_set_tag(dev, "SEC_TYPE", "ntocfs", sizeof("ntocfs")); 435 435 436 436 blkid_set_tag(dev, "LABEL", (const char*)ovl.label, ocfslabellen(ovl)); … … 563 563 return NULL; 564 564 565 now = time( 0);565 now = time(NULL); 566 566 diff = now - dev->bid_time; 567 567 … … 660 660 if (dev && type) { 661 661 dev->bid_devno = st.st_rdev; 662 dev->bid_time = time( 0);662 dev->bid_time = time(NULL); 663 663 dev->bid_flags |= BLKID_BID_FL_VERIFIED; 664 664 cache->bic_flags |= BLKID_BIC_FL_CHANGED; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/probe.h
r1765 r2725 12 12 * %End-Header% 13 13 */ 14 15 #ifndef _BLKID_PROBE_H 16 #define _BLKID_PROBE_H 14 #ifndef BLKID_PROBE_H 15 #define BLKID_PROBE_H 1 17 16 18 17 #include <linux/types.h> … … 309 308 __asm__("bswap %0" : "=r" (val) : "0" (val)); 310 309 #else 311 __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes 312 "rorl $16,%0\n\t" /* swap words 313 "xchgb %b0,%h0" /* swap higher bytes 310 __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ 311 "rorl $16,%0\n\t" /* swap words */ 312 "xchgb %b0,%h0" /* swap higher bytes */ 314 313 :"=q" (val) 315 314 : "0" (val)); … … 320 319 _INLINE_ __u16 blkid_swab16(__u16 val) 321 320 { 322 __asm__("xchgb %b0,%h0" /* swap bytes */ \323 : "=q" (val) \324 : "0" (val)); \321 __asm__("xchgb %b0,%h0" /* swap bytes */ 322 : "=q" (val) 323 : "0" (val)); 325 324 return val; 326 325 } -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/read.c
r1765 r2725 375 375 cache->bic_filename)); 376 376 377 file = fdopen(fd, "r"); 378 if (!file) 379 goto errout; 377 file = xfdopen_for_read(fd); 380 378 381 379 while (fgets(buf, sizeof(buf), file)) { … … 437 435 printf(" tag: NULL\n"); 438 436 } 439 puts("");437 bb_putchar('\n'); 440 438 } 441 439 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/resolve.c
r1765 r2725 66 66 blkid_dev dev; 67 67 blkid_cache c = cache; 68 char *t = 0, *v = 0;68 char *t = NULL, *v = NULL; 69 69 char *ret = NULL; 70 70 … … 122 122 } 123 123 if (blkid_get_cache(&cache, bb_dev_null) < 0) { 124 fprintf(stderr, " cannot get blkid cache\n");124 fprintf(stderr, "Can't get blkid cache\n"); 125 125 exit(1); 126 126 } -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/save.c
r1765 r2725 96 96 fd = mkstemp(tmp); 97 97 if (fd >= 0) { 98 file = fdopen(fd, "w");98 file = xfdopen_for_write(fd); 99 99 opened = tmp; 100 100 } … … 103 103 104 104 if (!file) { 105 file = fopen (filename, "w");105 file = fopen_for_write(filename); 106 106 opened = filename; 107 107 } -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/blkid/tag.c
r1765 r2725 22 22 blkid_tag tag; 23 23 24 if (!(tag = (blkid_tag) calloc(1, sizeof(struct blkid_struct_tag)))) 25 return NULL; 24 tag = xzalloc(sizeof(struct blkid_struct_tag)); 26 25 27 26 INIT_LIST_HEAD(&tag->bit_tags); … … 114 113 { 115 114 blkid_tag t = 0, head = 0; 116 char *val = 0;115 char *val = NULL; 117 116 118 117 if (!dev || !name) … … 365 364 { 366 365 blkid_tag_iterate iter; 367 blkid_cache 366 blkid_cache cache = NULL; 368 367 blkid_dev dev; 369 368 int c, ret, found; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/chattr.c
r1765 r2725 171 171 } 172 172 173 int chattr_main(int argc, char **argv) ;173 int chattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 174 174 int chattr_main(int argc, char **argv) 175 175 { -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/e2fsbb.h
r1765 r2725 7 7 */ 8 8 9 #ifndef __E2FSBB_H__10 #define __E2FSBB_H__19 #ifndef E2FSBB_H 10 #define E2FSBB_H 1 11 11 12 12 #include "libbb.h" … … 41 41 #endif 42 42 43 #endif /* __E2FSBB_H__ */43 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/e2fsck.c
r1765 r2725 27 27 * part of the ext2fs journaling system. 28 28 * 29 * Licensed under GPLv2 or later, see file License in this tarball for details. 30 */ 31 32 #ifndef _GNU_SOURCE 33 #define _GNU_SOURCE 1 /* get strnlen() */ 34 #endif 29 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 30 */ 35 31 36 32 #include "e2fsck.h" /*Put all of our defines here to clean things up*/ … … 90 86 struct problem_context { 91 87 errcode_t errcode; 92 ext2_ino_t ino, ino2, dir;88 ext2_ino_t ino, ino2, dir; 93 89 struct ext2_inode *inode; 94 90 struct ext2_dir_entry *dirent; 95 blk_t blk, blk2;91 blk_t blk, blk2; 96 92 e2_blkcnt_t blkcount; 97 93 int group; 98 __u64 num;99 const char *str;94 __u64 num; 95 const char *str; 100 96 }; 101 97 … … 134 130 135 131 typedef struct dnode_t { 136 137 138 139 140 141 132 struct dnode_t *dict_left; 133 struct dnode_t *dict_right; 134 struct dnode_t *dict_parent; 135 dnode_color_t dict_color; 136 const void *dict_key; 137 void *dict_data; 142 138 } dnode_t; 143 139 … … 146 142 147 143 typedef struct dict_t { 148 149 150 151 152 153 144 dnode_t dict_nilnode; 145 dictcount_t dict_nodecount; 146 dictcount_t dict_maxcount; 147 dict_comp_t dict_compare; 148 dnode_free_t dict_freenode; 149 int dict_dupes; 154 150 } dict_t; 155 151 … … 157 153 158 154 typedef struct dict_load_t { 159 160 155 dict_t *dict_dictptr; 156 dnode_t dict_nilnode; 161 157 } dict_load_t; 162 158 … … 193 189 #define K_DEV_JOURNAL 2 194 190 195 #define lock_buffer(bh) do {} while (0)196 #define unlock_buffer(bh) do {} while (0)191 #define lock_buffer(bh) do {} while (0) 192 #define unlock_buffer(bh) do {} while (0) 197 193 #define buffer_req(bh) 1 198 #define do_readahead(journal, start) do {} while (0)194 #define do_readahead(journal, start) do {} while (0) 199 195 200 196 static e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */ … … 215 211 kmem_cache_t *new_cache; 216 212 217 new_cache = malloc(sizeof(*new_cache)); 218 if (new_cache) 219 new_cache->object_length = len; 213 new_cache = xmalloc(sizeof(*new_cache)); 214 new_cache->object_length = len; 220 215 return new_cache; 221 216 } … … 270 265 static void rotate_left(dnode_t *upper) 271 266 { 272 273 274 275 276 277 278 279 280 281 282 283 284 upparent->left = lower;285 286 assert (upper == upparent->right);287 upparent->right = lower;288 289 290 291 267 dnode_t *lower, *lowleft, *upparent; 268 269 lower = upper->right; 270 upper->right = lowleft = lower->left; 271 lowleft->parent = upper; 272 273 lower->parent = upparent = upper->parent; 274 275 /* don't need to check for root node here because root->parent is 276 the sentinel nil node, and root->parent->left points back to root */ 277 278 if (upper == upparent->left) { 279 upparent->left = lower; 280 } else { 281 assert (upper == upparent->right); 282 upparent->right = lower; 283 } 284 285 lower->left = upper; 286 upper->parent = lower; 292 287 } 293 288 … … 299 294 static void rotate_right(dnode_t *upper) 300 295 { 301 302 303 304 305 306 307 308 309 310 upparent->right = lower;311 312 assert (upper == upparent->left);313 upparent->left = lower;314 315 316 317 296 dnode_t *lower, *lowright, *upparent; 297 298 lower = upper->left; 299 upper->left = lowright = lower->right; 300 lowright->parent = upper; 301 302 lower->parent = upparent = upper->parent; 303 304 if (upper == upparent->right) { 305 upparent->right = lower; 306 } else { 307 assert (upper == upparent->left); 308 upparent->left = lower; 309 } 310 311 lower->right = upper; 312 upper->parent = lower; 318 313 } 319 314 … … 325 320 static void free_nodes(dict_t *dict, dnode_t *node, dnode_t *nil) 326 321 { 327 328 return;329 330 331 322 if (node == nil) 323 return; 324 free_nodes(dict, node->left, nil); 325 free_nodes(dict, node->right, nil); 326 dict->dict_freenode(node); 332 327 } 333 328 … … 341 336 static int verify_dict_has_node(dnode_t *nil, dnode_t *root, dnode_t *node) 342 337 { 343 344 return root == node345 || verify_dict_has_node(nil, root->left, node)346 || verify_dict_has_node(nil, root->right, node);347 348 338 if (root != nil) { 339 return root == node 340 || verify_dict_has_node(nil, root->left, node) 341 || verify_dict_has_node(nil, root->right, node); 342 } 343 return 0; 349 344 } 350 345 … … 356 351 static void dict_set_allocator(dict_t *dict, dnode_free_t fr) 357 352 { 358 assert(dict_count(dict) == 0);359 353 assert(dict_count(dict) == 0); 354 dict->dict_freenode = fr; 360 355 } 361 356 … … 367 362 static void dict_free_nodes(dict_t *dict) 368 363 { 369 370 371 372 373 364 dnode_t *nil = dict_nil(dict), *root = dict_root(dict); 365 free_nodes(dict, root, nil); 366 dict->dict_nodecount = 0; 367 dict->nilnode.left = &dict->nilnode; 368 dict->nilnode.right = &dict->nilnode; 374 369 } 375 370 … … 380 375 static dict_t *dict_init(dict_t *dict, dictcount_t maxcount, dict_comp_t comp) 381 376 { 382 383 384 385 386 387 388 389 390 391 377 dict->compare = comp; 378 dict->dict_freenode = dnode_free; 379 dict->dict_nodecount = 0; 380 dict->maxcount = maxcount; 381 dict->nilnode.left = &dict->nilnode; 382 dict->nilnode.right = &dict->nilnode; 383 dict->nilnode.parent = &dict->nilnode; 384 dict->nilnode.color = dnode_black; 385 dict->dupes = 0; 386 return dict; 392 387 } 393 388 … … 401 396 static dnode_t *dict_lookup(dict_t *dict, const void *key) 402 397 { 403 dnode_t *root = dict_root(dict); 404 dnode_t *nil = dict_nil(dict); 405 dnode_t *saved; 406 int result; 407 408 /* simple binary search adapted for trees that contain duplicate keys */ 409 410 while (root != nil) { 411 result = dict->compare(key, root->key); 412 if (result < 0) 413 root = root->left; 414 else if (result > 0) 415 root = root->right; 416 else { 417 if (!dict->dupes) { /* no duplicates, return match */ 418 return root; 419 } else { /* could be dupes, find leftmost one */ 420 do { 421 saved = root; 422 root = root->left; 423 while (root != nil && dict->compare(key, root->key)) 398 dnode_t *root = dict_root(dict); 399 dnode_t *nil = dict_nil(dict); 400 dnode_t *saved; 401 int result; 402 403 /* simple binary search adapted for trees that contain duplicate keys */ 404 405 while (root != nil) { 406 result = dict->compare(key, root->key); 407 if (result < 0) 408 root = root->left; 409 else if (result > 0) 424 410 root = root->right; 425 } while (root != nil); 426 return saved; 427 } 428 } 429 } 430 431 return NULL; 411 else { 412 if (!dict->dupes) { /* no duplicates, return match */ 413 return root; 414 } else { /* could be dupes, find leftmost one */ 415 do { 416 saved = root; 417 root = root->left; 418 while (root != nil && dict->compare(key, root->key)) 419 root = root->right; 420 } while (root != nil); 421 return saved; 422 } 423 } 424 } 425 426 return NULL; 432 427 } 433 428 … … 442 437 static void dict_insert(dict_t *dict, dnode_t *node, const void *key) 443 438 { 444 dnode_t *where = dict_root(dict), *nil = dict_nil(dict); 445 dnode_t *parent = nil, *uncle, *grandpa; 446 int result = -1; 447 448 node->key = key; 449 450 /* basic binary tree insert */ 451 452 while (where != nil) { 453 parent = where; 454 result = dict->compare(key, where->key); 455 /* trap attempts at duplicate key insertion unless it's explicitly allowed */ 456 assert (dict->dupes || result != 0); 439 dnode_t *where = dict_root(dict), *nil = dict_nil(dict); 440 dnode_t *parent = nil, *uncle, *grandpa; 441 int result = -1; 442 443 node->key = key; 444 445 /* basic binary tree insert */ 446 447 while (where != nil) { 448 parent = where; 449 result = dict->compare(key, where->key); 450 /* trap attempts at duplicate key insertion unless it's explicitly allowed */ 451 assert(dict->dupes || result != 0); 452 if (result < 0) 453 where = where->left; 454 else 455 where = where->right; 456 } 457 458 assert(where == nil); 459 457 460 if (result < 0) 458 where = where->left;461 parent->left = node; 459 462 else 460 where = where->right; 461 } 462 463 assert (where == nil); 464 465 if (result < 0) 466 parent->left = node; 467 else 468 parent->right = node; 469 470 node->parent = parent; 471 node->left = nil; 472 node->right = nil; 473 474 dict->dict_nodecount++; 475 476 /* red black adjustments */ 477 478 node->color = dnode_red; 479 480 while (parent->color == dnode_red) { 481 grandpa = parent->parent; 482 if (parent == grandpa->left) { 483 uncle = grandpa->right; 484 if (uncle->color == dnode_red) { /* red parent, red uncle */ 485 parent->color = dnode_black; 486 uncle->color = dnode_black; 487 grandpa->color = dnode_red; 488 node = grandpa; 489 parent = grandpa->parent; 490 } else { /* red parent, black uncle */ 491 if (node == parent->right) { 492 rotate_left(parent); 493 parent = node; 494 assert (grandpa == parent->parent); 495 /* rotation between parent and child preserves grandpa */ 496 } 497 parent->color = dnode_black; 498 grandpa->color = dnode_red; 499 rotate_right(grandpa); 500 break; 501 } 502 } else { /* symmetric cases: parent == parent->parent->right */ 503 uncle = grandpa->left; 504 if (uncle->color == dnode_red) { 505 parent->color = dnode_black; 506 uncle->color = dnode_black; 507 grandpa->color = dnode_red; 508 node = grandpa; 509 parent = grandpa->parent; 510 } else { 511 if (node == parent->left) { 512 rotate_right(parent); 513 parent = node; 514 assert (grandpa == parent->parent); 515 } 516 parent->color = dnode_black; 517 grandpa->color = dnode_red; 518 rotate_left(grandpa); 519 break; 520 } 521 } 522 } 523 524 dict_root(dict)->color = dnode_black; 525 463 parent->right = node; 464 465 node->parent = parent; 466 node->left = nil; 467 node->right = nil; 468 469 dict->dict_nodecount++; 470 471 /* red black adjustments */ 472 473 node->color = dnode_red; 474 475 while (parent->color == dnode_red) { 476 grandpa = parent->parent; 477 if (parent == grandpa->left) { 478 uncle = grandpa->right; 479 if (uncle->color == dnode_red) { /* red parent, red uncle */ 480 parent->color = dnode_black; 481 uncle->color = dnode_black; 482 grandpa->color = dnode_red; 483 node = grandpa; 484 parent = grandpa->parent; 485 } else { /* red parent, black uncle */ 486 if (node == parent->right) { 487 rotate_left(parent); 488 parent = node; 489 assert (grandpa == parent->parent); 490 /* rotation between parent and child preserves grandpa */ 491 } 492 parent->color = dnode_black; 493 grandpa->color = dnode_red; 494 rotate_right(grandpa); 495 break; 496 } 497 } else { /* symmetric cases: parent == parent->parent->right */ 498 uncle = grandpa->left; 499 if (uncle->color == dnode_red) { 500 parent->color = dnode_black; 501 uncle->color = dnode_black; 502 grandpa->color = dnode_red; 503 node = grandpa; 504 parent = grandpa->parent; 505 } else { 506 if (node == parent->left) { 507 rotate_right(parent); 508 parent = node; 509 assert (grandpa == parent->parent); 510 } 511 parent->color = dnode_black; 512 grandpa->color = dnode_red; 513 rotate_left(grandpa); 514 break; 515 } 516 } 517 } 518 519 dict_root(dict)->color = dnode_black; 526 520 } 527 521 … … 533 527 static dnode_t *dnode_init(dnode_t *dnode, void *data) 534 528 { 535 536 537 538 539 529 dnode->data = data; 530 dnode->parent = NULL; 531 dnode->left = NULL; 532 dnode->right = NULL; 533 return dnode; 540 534 } 541 535 542 536 static int dict_alloc_insert(dict_t *dict, const void *key, void *data) 543 537 { 544 dnode_t *node = malloc(sizeof(dnode_t)); 545 546 if (node) { 538 dnode_t *node = xmalloc(sizeof(dnode_t)); 539 547 540 dnode_init(node, data); 548 541 dict_insert(dict, node, key); 549 542 return 1; 550 }551 return 0;552 543 } 553 544 … … 559 550 static dnode_t *dict_first(dict_t *dict) 560 551 { 561 562 563 564 while ((left = root->left) != nil)565 566 567 552 dnode_t *nil = dict_nil(dict), *root = dict_root(dict), *left; 553 554 if (root != nil) 555 while ((left = root->left) != nil) 556 root = left; 557 558 return (root == nil) ? NULL : root; 568 559 } 569 560 … … 577 568 static dnode_t *dict_next(dict_t *dict, dnode_t *curr) 578 569 { 579 dnode_t *nil = dict_nil(dict), *parent, *left; 580 581 if (curr->right != nil) { 582 curr = curr->right; 583 while ((left = curr->left) != nil) 584 curr = left; 585 return curr; 586 } 587 588 parent = curr->parent; 589 590 while (parent != nil && curr == parent->right) { 591 curr = parent; 570 dnode_t *nil = dict_nil(dict), *parent, *left; 571 572 if (curr->right != nil) { 573 curr = curr->right; 574 while ((left = curr->left) != nil) 575 curr = left; 576 return curr; 577 } 578 592 579 parent = curr->parent; 593 } 594 595 return (parent == nil) ? NULL : parent; 580 581 while (parent != nil && curr == parent->right) { 582 curr = parent; 583 parent = curr->parent; 584 } 585 586 return (parent == nil) ? NULL : parent; 596 587 } 597 588 … … 599 590 static void dnode_free(dnode_t *node) 600 591 { 601 592 free(node); 602 593 } 603 594 … … 810 801 * sizeof (struct dx_dirblock_info), 811 802 "dx_block info array"); 812 813 803 } 814 804 … … 1544 1534 struct inode *j_inode = NULL; 1545 1535 struct kdev_s *dev_fs = NULL, *dev_journal; 1546 const char *journal_name = 0;1536 const char *journal_name = NULL; 1547 1537 journal_t *journal = NULL; 1548 1538 errcode_t retval = 0; … … 1733 1723 ext2fs_free_mem(&journal); 1734 1724 return retval; 1735 1736 1725 } 1737 1726 … … 1887 1876 1888 1877 /* Leave a valid existing V1 superblock signature alone. 1889 * Anything unrecogni sable we overwrite with a new V21878 * Anything unrecognizable we overwrite with a new V2 1890 1879 * signature. */ 1891 1880 … … 2271 2260 fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY; 2272 2261 inode.i_links_count = 0; 2273 inode.i_dtime = time( 0);2262 inode.i_dtime = time(NULL); 2274 2263 if ((retval = ext2fs_write_inode(fs, ino, &inode)) != 0) 2275 2264 goto err_out; … … 2393 2382 N_("llost+found"), 2394 2383 N_("Lis a link"), 2395 2396 2384 N_("mmultiply-claimed"), 2385 N_("ninvalid"), 2397 2386 N_("oorphaned"), 2398 2387 N_("pproblem in"), … … 2444 2433 } 2445 2434 if ((ch < 32) || (ch == 0x7f)) { 2446 fputc('^', stdout);2435 bb_putchar('^'); 2447 2436 ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */ 2448 2437 } 2449 fputc(ch, stdout);2438 bb_putchar(ch); 2450 2439 } 2451 2440 } … … 2498 2487 if (*first && islower(*str)) { 2499 2488 *first = 0; 2500 fputc(toupper(*str++), stdout);2489 bb_putchar(toupper(*str++)); 2501 2490 } 2502 2491 print_e2fsck_message(ctx, str, pctx, *first); … … 2631 2620 switch (ch) { 2632 2621 case '%': 2633 fputc('%', stdout);2622 bb_putchar('%'); 2634 2623 break; 2635 2624 case 'b': … … 2655 2644 break; 2656 2645 case 'm': 2657 printf("%s", error_message(ctx->errcode));2646 fputs(error_message(ctx->errcode), stdout); 2658 2647 break; 2659 2648 case 'N': … … 2677 2666 break; 2678 2667 case 's': 2679 printf("%s", ctx->str ? ctx->str : "NULL");2668 fputs((ctx->str ? ctx->str : "NULL"), stdout); 2680 2669 break; 2681 2670 case 'X': … … 2743 2732 region_t region; 2744 2733 2745 region = malloc(sizeof(struct region_struct)); 2746 if (!region) 2747 return NULL; 2748 memset(region, 0, sizeof(struct region_struct)); 2734 region = xzalloc(sizeof(struct region_struct)); 2749 2735 region->min = min; 2750 2736 region->max = max; … … 2811 2797 * Insert a new region element structure into the linked list 2812 2798 */ 2813 new_region = malloc(sizeof(struct region_el)); 2814 if (!new_region) 2815 return -1; 2799 new_region = xmalloc(sizeof(struct region_el)); 2816 2800 new_region->start = start; 2817 2801 new_region->end = start + n; … … 3382 3366 if (!LINUX_S_ISDIR(inode->i_mode)) { 3383 3367 if (fix_problem(ctx, PR_1_ROOT_NO_DIR, &pctx)) { 3384 inode->i_dtime = time( 0);3368 inode->i_dtime = time(NULL); 3385 3369 inode->i_links_count = 0; 3386 3370 ext2fs_icount_store(ctx->inode_link_info, … … 3389 3373 "pass1"); 3390 3374 } 3391 3392 3375 } 3393 3376 /* … … 3476 3459 if (fix_problem(ctx, PR_1_LOW_DTIME, &pctx)) { 3477 3460 inode->i_dtime = inode->i_links_count ? 3478 0 : time( 0);3461 0 : time(NULL); 3479 3462 e2fsck_write_inode(ctx, ino, inode, 3480 3463 "pass1"); … … 3490 3473 if (fix_problem(ctx, 3491 3474 PR_1_ZERO_DTIME, &pctx)) { 3492 inode->i_dtime = time( 0);3475 inode->i_dtime = time(NULL); 3493 3476 e2fsck_write_inode(ctx, ino, inode, 3494 3477 "pass1"); … … 3660 3643 e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode, 3661 3644 "recreate inode"); 3662 inode->i_mtime = time( 0);3645 inode->i_mtime = time(NULL); 3663 3646 e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode, 3664 3647 "recreate inode"); … … 3692 3675 ext2fs_free_mem(&block_buf); 3693 3676 ext2fs_free_mem(&inode); 3694 3695 3677 } 3696 3678 … … 4170 4152 inode->i_links_count = 0; 4171 4153 ext2fs_icount_store(ctx->inode_link_info, ino, 0); 4172 inode->i_dtime = time( 0);4154 inode->i_dtime = time(NULL); 4173 4155 dirty_inode++; 4174 4156 ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino); … … 4203 4185 inode->i_links_count = 0; 4204 4186 ext2fs_icount_store(ctx->inode_link_info, ino, 0); 4205 inode->i_dtime = time( 0);4187 inode->i_dtime = time(NULL); 4206 4188 dirty_inode++; 4207 4189 ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino); … … 4465 4447 } 4466 4448 } else { 4467 ext2fs_mark_block_bitmap(ctx->block_found_map, 4468 b); 4449 ext2fs_mark_block_bitmap(ctx->block_found_map, b); 4469 4450 } 4470 4451 } … … 4483 4464 } 4484 4465 } else { 4485 ext2fs_mark_block_bitmap(ctx->block_found_map, 4486 fs->group_desc[i].bg_block_bitmap); 4487 } 4488 4466 ext2fs_mark_block_bitmap(ctx->block_found_map, 4467 fs->group_desc[i].bg_block_bitmap); 4468 } 4489 4469 } 4490 4470 /* … … 4500 4480 } 4501 4481 } else { 4502 4503 4482 ext2fs_mark_block_bitmap(ctx->block_found_map, 4483 fs->group_desc[i].bg_inode_bitmap); 4504 4484 } 4505 4485 } … … 5148 5128 e2fsck_read_inode(ctx, ino, &inode, "delete_file"); 5149 5129 inode.i_links_count = 0; 5150 inode.i_dtime = time( 0);5130 inode.i_dtime = time(NULL); 5151 5131 if (inode.i_file_acl && 5152 5132 (fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) { … … 5602 5582 } 5603 5583 } 5604 5605 5584 } 5606 5585 … … 6019 5998 struct dx_dir_info *dx_dir; 6020 5999 #ifdef ENABLE_HTREE 6021 struct dx_dirblock_info *dx_db = 0;6000 struct dx_dirblock_info *dx_db = NULL; 6022 6001 #endif /* ENABLE_HTREE */ 6023 6002 struct ext2_dir_entry *dirent, *prev; … … 6394 6373 e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode"); 6395 6374 inode.i_links_count = 0; 6396 inode.i_dtime = time( 0);6375 inode.i_dtime = time(NULL); 6397 6376 e2fsck_write_inode(ctx, ino, &inode, "deallocate_inode"); 6398 6377 clear_problem_context(&pctx); … … 6891 6870 inode.i_mode = 040755; 6892 6871 inode.i_size = fs->blocksize; 6893 inode.i_atime = inode.i_ctime = inode.i_mtime = time( 0);6872 inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL); 6894 6873 inode.i_links_count = 2; 6895 6874 inode.i_blocks = fs->blocksize / 512; … … 7139 7118 inode.i_mode = 040700; 7140 7119 inode.i_size = fs->blocksize; 7141 inode.i_atime = inode.i_ctime = inode.i_mtime = time( 0);7120 inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL); 7142 7121 inode.i_links_count = 2; 7143 7122 inode.i_blocks = fs->blocksize / 512; … … 7493 7472 ext2fs_icount_store(ctx->inode_link_info, i, 0); 7494 7473 inode.i_links_count = 0; 7495 inode.i_dtime = time( 0);7474 inode.i_dtime = time(NULL); 7496 7475 e2fsck_write_inode(ctx, i, &inode, 7497 7476 "disconnect_inode"); … … 7534 7513 struct problem_context pctx; 7535 7514 __u16 link_count, link_counted; 7536 char *buf = 0;7515 char *buf = NULL; 7537 7516 int group, maxgroup; 7538 7517 … … 9401 9380 /* Cannot proceed without a root inode. */ 9402 9381 { PR_3_NO_ROOT_INODE_ABORT, 9403 N_(" Cannot proceed without a @r.\n"),9382 N_("can't proceed without a @r.\n"), 9404 9383 PROMPT_NONE, PR_FATAL }, 9405 9384 … … 9680 9659 ext2_filsys fs = ctx->fs; 9681 9660 const struct e2fsck_problem *ptr; 9682 struct latch_descr *ldesc = 0;9661 struct latch_descr *ldesc = NULL; 9683 9662 const char *message; 9684 9663 int def_yn, answer, ans; … … 9762 9741 printf("%s.\n", answer ? 9763 9742 _(preen_msg[(int) ptr->prompt]) : _("IGNORED")); 9764 9765 9743 } 9766 9744 … … 10015 9993 * to do with it? That depends on the pass... */ 10016 9994 10017 switch (blocktype) {9995 switch (blocktype) { 10018 9996 case JFS_DESCRIPTOR_BLOCK: 10019 9997 /* If it is a valid descriptor block, replay it … … 10312 10290 } 10313 10291 if (fd->num_array >= fd->max_array) { 10314 new_array = realloc(fd->harray,10292 new_array = xrealloc(fd->harray, 10315 10293 sizeof(struct hash_entry) * (fd->max_array+500)); 10316 if (!new_array) {10317 fd->err = ENOMEM;10318 return BLOCK_ABORT;10319 }10320 10294 fd->harray = new_array; 10321 10295 fd->max_array += 500; … … 10392 10366 10393 10367 if (outdir->max) { 10394 new_mem = realloc(outdir->buf, blocks * fs->blocksize); 10395 if (!new_mem) 10396 return ENOMEM; 10368 new_mem = xrealloc(outdir->buf, blocks * fs->blocksize); 10397 10369 outdir->buf = new_mem; 10398 new_mem = realloc(outdir->hashes,10370 new_mem = xrealloc(outdir->hashes, 10399 10371 blocks * sizeof(ext2_dirhash_t)); 10400 if (!new_mem)10401 return ENOMEM;10402 10372 outdir->hashes = new_mem; 10403 10373 } else { 10404 outdir->buf = malloc(blocks * fs->blocksize);10405 outdir->hashes = malloc(blocks * sizeof(ext2_dirhash_t));10374 outdir->buf = xmalloc(blocks * fs->blocksize); 10375 outdir->hashes = xmalloc(blocks * sizeof(ext2_dirhash_t)); 10406 10376 outdir->num = 0; 10407 10377 } … … 10687 10657 { 10688 10658 struct ext2_dx_root_info *root_info; 10689 struct ext2_dx_entry *root, *dx_ent = 0;10659 struct ext2_dx_entry *root, *dx_ent = NULL; 10690 10660 struct ext2_dx_countlimit *root_limit, *limit; 10691 10661 errcode_t retval; … … 10839 10809 errcode_t retval; 10840 10810 struct ext2_inode inode; 10841 char *dir_buf = 0;10811 char *dir_buf = NULL; 10842 10812 struct fill_dir_struct fd; 10843 10813 struct out_dir outdir; … … 10850 10820 retval = ENOMEM; 10851 10821 fd.harray = 0; 10852 dir_buf = malloc(inode.i_size); 10853 if (!dir_buf) 10854 goto errout; 10822 dir_buf = xmalloc(inode.i_size); 10855 10823 10856 10824 fd.max_array = inode.i_size / 32; 10857 10825 fd.num_array = 0; 10858 fd.harray = malloc(fd.max_array * sizeof(struct hash_entry)); 10859 if (!fd.harray) 10860 goto errout; 10826 fd.harray = xmalloc(fd.max_array * sizeof(struct hash_entry)); 10861 10827 10862 10828 fd.ctx = ctx; … … 11159 11125 shift = 0; 11160 11126 tmp = hash_size; 11161 while ((tmp >>= 1UL) != 0UL)11127 while ((tmp >>= 1UL) != 0UL) 11162 11128 shift++; 11163 11129 journal->j_revoke->hash_shift = shift; 11164 11130 11165 journal->j_revoke->hash_table = malloc(hash_size * sizeof(struct list_head)); 11166 if (!journal->j_revoke->hash_table) { 11167 free(journal->j_revoke); 11168 journal->j_revoke = NULL; 11169 return -ENOMEM; 11170 } 11131 journal->j_revoke->hash_table = xmalloc(hash_size * sizeof(struct list_head)); 11171 11132 11172 11133 for (tmp = 0; tmp < hash_size; tmp++) … … 11355 11316 (blk >= fs->super->s_blocks_count)) { 11356 11317 fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, pctx); 11357 11318 return_abort: 11358 11319 pb->abort = 1; 11359 11320 return BLOCK_ABORT; … … 11559 11520 ext2fs_inode_alloc_stats2(fs, ino, -1, 11560 11521 LINUX_S_ISDIR(inode.i_mode)); 11561 inode.i_dtime = time( 0);11522 inode.i_dtime = time(NULL); 11562 11523 } else { 11563 11524 inode.i_dtime = 0; … … 11568 11529 ext2fs_free_mem(&block_buf); 11569 11530 return 0; 11570 return_abort:11531 return_abort: 11571 11532 ext2fs_free_mem(&block_buf); 11572 11533 return 1; … … 11586 11547 int i, j, gdt_off, ind_off; 11587 11548 blk_t blk, pblk, expect; 11588 __u32 *dind_buf = 0, *ind_buf;11549 __u32 *dind_buf = NULL, *ind_buf; 11589 11550 errcode_t retval; 11590 11551 … … 11649 11610 (blk < fs->super->s_first_data_block || 11650 11611 blk >= fs->super->s_blocks_count)) { 11651 11612 resize_inode_invalid: 11652 11613 if (fix_problem(ctx, PR_0_RESIZE_INODE_INVALID, &pctx)) { 11653 11614 memset(&inode, 0, sizeof(inode)); … … 11691 11652 } 11692 11653 11693 cleanup:11654 cleanup: 11694 11655 ext2fs_free_mem(&dind_buf); 11695 11696 } 11656 } 11697 11657 11698 11658 static void check_super_block(e2fsck_t ctx) … … 11873 11833 (gd->bg_used_dirs_count > sb->s_inodes_per_group)) 11874 11834 ext2fs_unmark_valid(fs); 11875 11876 11835 } 11877 11836 … … 11933 11892 ~EXT2_FEATURE_INCOMPAT_FILETYPE; 11934 11893 ext2fs_mark_super_dirty(fs); 11935 11936 11894 } 11937 11895 } … … 12220 12178 char buf[256]; 12221 12179 12222 ret = malloc(size); 12223 if (!ret) { 12224 sprintf(buf, "Can't allocate %s\n", description); 12225 bb_error_msg_and_die(buf); 12226 } 12227 memset(ret, 0, size); 12180 ret = xzalloc(size); 12228 12181 return ret; 12229 12182 } … … 12237 12190 if (!len) 12238 12191 len = strlen(str); 12239 ret = malloc(len+1); 12240 if (ret) { 12241 strncpy(ret, str, len); 12242 ret[len] = 0; 12243 } 12192 ret = xmalloc(len+1); 12193 strncpy(ret, str, len); 12194 ret[len] = 0; 12244 12195 return ret; 12245 12196 } … … 12252 12203 int fail = 0; 12253 12204 12254 while (1) {12205 while (1) { 12255 12206 if (e2fsck_global_ctx && 12256 12207 (e2fsck_global_ctx->flags & E2F_FLAG_CANCEL)) { … … 12282 12233 tmp.c_cc[VMIN] = 1; 12283 12234 tmp.c_cc[VTIME] = 0; 12284 tcsetattr (0, TCSANOW,&tmp);12235 tcsetattr_stdin_TCSANOW(&tmp); 12285 12236 #endif 12286 12237 … … 12298 12249 if (c == 3) { 12299 12250 #ifdef HAVE_TERMIOS_H 12300 tcsetattr (0, TCSANOW,&termios);12251 tcsetattr_stdin_TCSANOW(&termios); 12301 12252 #endif 12302 12253 if (e2fsck_global_ctx && … … 12324 12275 puts ("no\n"); 12325 12276 #ifdef HAVE_TERMIOS_H 12326 tcsetattr (0, TCSANOW,&termios);12277 tcsetattr_stdin_TCSANOW(&termios); 12327 12278 #endif 12328 12279 return def; … … 12633 12584 &ctx->mount_flags); 12634 12585 if (retval) { 12635 bb_error_msg(_("while determining whether %s is mounted ."),12586 bb_error_msg(_("while determining whether %s is mounted"), 12636 12587 ctx->filesystem_name); 12637 12588 return; … … 12654 12605 printf(_("%s is mounted. "), ctx->filesystem_name); 12655 12606 if (!ctx->interactive) 12656 bb_error_msg_and_die(_(" Cannot continue, aborting."));12607 bb_error_msg_and_die(_("can't continue, aborting")); 12657 12608 printf(_("\n\n\007\007\007\007WARNING!!! " 12658 12609 "Running e2fsck on a mounted filesystem may cause\n" … … 12673 12624 struct dirent* de; 12674 12625 12675 f = fopen ("/proc/apm", "r");12626 f = fopen_for_read("/proc/apm"); 12676 12627 if (f) { 12677 12628 if (fscanf(f, "%s %s %s %x", tmp, tmp, tmp, &acflag) != 4) … … 12687 12638 snprintf(fname, 80, "/proc/acpi/ac_adapter/%s/state", 12688 12639 de->d_name); 12689 f = fopen (fname, "r");12640 f = fopen_for_read(fname); 12690 12641 if (!f) 12691 12642 continue; … … 12715 12666 long next_check; 12716 12667 int batt = is_on_batt(); 12717 time_t now = time( 0);12668 time_t now = time(NULL); 12718 12669 12719 12670 if ((ctx->options & E2F_OPT_FORCE) || cflag || swapfs) … … 12768 12719 printf(_(" (check in %ld mounts)"), next_check); 12769 12720 } 12770 fputc('\n', stdout);12721 bb_putchar('\n'); 12771 12722 ext2fs_close(fs); 12772 12723 ctx->fs = NULL; … … 12865 12816 spaces + (sizeof(spaces) - (dpywidth - i + 1))); 12866 12817 if (fixed_percent == 1000) 12867 fputc('|', stdout);12818 bb_putchar('|'); 12868 12819 else 12869 fputc(spinner[ctx->progress_pos & 3], stdout);12820 bb_putchar(spinner[ctx->progress_pos & 3]); 12870 12821 printf(" %4.1f%% ", percent); 12871 12822 if (dpynum) … … 12893 12844 if (ctx->progress_fd) { 12894 12845 sprintf(buf, "%d %lu %lu\n", pass, cur, max); 12895 write(ctx->progress_fd, buf, strlen(buf));12846 xwrite_str(ctx->progress_fd, buf); 12896 12847 } else { 12897 12848 percent = calc_percent(&e2fsck_tbl, pass, cur, max); … … 13009 12960 errcode_t retval; 13010 12961 struct sigaction sa; 13011 char *extended_opts = 0;12962 char *extended_opts = NULL; 13012 12963 13013 12964 retval = e2fsck_allocate_context(&ctx); … … 13061 13012 if (ctx->options & (E2F_OPT_YES|E2F_OPT_NO)) { 13062 13013 conflict_opt: 13063 bb_error_msg_and_die(_(" Only one the options -p/-a, -n or -y may be specified."));13014 bb_error_msg_and_die(_("only one the options -p/-a, -n or -y may be specified")); 13064 13015 } 13065 13016 ctx->options |= E2F_OPT_PREEN; … … 13374 13325 * device driver is being bogus. 13375 13326 */ 13376 bb_error_msg(_("can not set superblock flags on %s"), ctx->device_name);13327 bb_error_msg(_("can't set superblock flags on %s"), ctx->device_name); 13377 13328 bb_error_msg_and_die(0); 13378 13329 } … … 13406 13357 /* FIXME - do we support this at all? */ 13407 13358 if (sb->s_feature_incompat & EXT2_FEATURE_INCOMPAT_COMPRESSION) 13408 bb_error_msg(_(" Warning: compression support is experimental."));13359 bb_error_msg(_("warning: compression support is experimental")); 13409 13360 #endif 13410 13361 #ifndef ENABLE_HTREE -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/e2fsck.h
r1765 r2725 630 630 631 631 632 #define tid_gt(x, y) 632 #define tid_gt(x, y) ((x - y) > 0) 633 633 634 634 static inline int tid_geq(tid_t x, tid_t y) … … 637 637 return (difference >= 0); 638 638 } 639 640 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/e2p/Kbuild
r1765 r2725 1 # DO NOT EDIT. This file is generated from Kbuild.src 1 2 # Makefile for busybox 2 3 # 3 4 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 4 5 # 5 # Licensed under the GPL v2, see the file LICENSE in this tarball.6 # Licensed under GPLv2, see file LICENSE in this source tree. 6 7 7 8 NEEDED-$(CONFIG_CHATTR) = y … … 11 12 12 13 lib-y:= 14 15 16 13 17 lib-$(NEEDED-y) += fgetsetflags.o fgetsetversion.o pf.o iod.o mntopts.o \ 14 18 feature.o ls.o uuid.o pe.o ostype.o ps.o hashstr.o \ -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/e2p/e2p.h
r1765 r2725 14 14 #endif 15 15 16 /* `options' for print_ flags() */16 /* `options' for print_e2flags() */ 17 17 18 18 #define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */ … … 38 38 void list_super2(struct ext2_super_block * s, FILE *f); 39 39 #define list_super(s) list_super2(s, stdout) 40 void print_fs_errors (FILE * 41 void print_flags (FILE * 42 void print_fs_state (FILE * 40 void print_fs_errors (FILE *f, unsigned short errors); 41 void print_flags (FILE *f, unsigned long flags, unsigned options); 42 void print_fs_state (FILE *f, unsigned short state); 43 43 int setflags (int fd, unsigned long flags); 44 44 int setversion (int fd, unsigned long version); -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/e2p/ostype.c
r1765 r2725 71 71 } 72 72 #endif 73 74 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/e2p/pf.c
r1765 r2725 49 49 }; 50 50 51 void print_flags (FILE * 51 void print_flags (FILE *f, unsigned long flags, unsigned options) 52 52 { 53 53 int long_opt = (options & PFOPT_LONG); -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/Kbuild
r1765 r2725 1 # DO NOT EDIT. This file is generated from Kbuild.src 1 2 # Makefile for busybox 2 3 # 3 4 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 4 5 # 5 # Licensed under the GPL v2, see the file LICENSE in this tarball.6 # Licensed under GPLv2, see file LICENSE in this source tree. 6 7 7 8 NEEDED-$(CONFIG_E2FSCK) = y … … 11 12 12 13 lib-y:= 14 15 16 13 17 lib-$(NEEDED-y) += gen_bitmap.o bitops.o ismounted.o mkjournal.o unix_io.o \ 14 18 rw_bitmaps.o initialize.o bitmaps.o block.o \ -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c
r1765 r2725 110 110 errcode_t retval; 111 111 blk_t block; 112 char *buf = 0;112 char *buf = NULL; 113 113 114 114 if (!block_buf) { … … 172 172 return EXT2_ET_BLOCK_ALLOC_FAIL; 173 173 } 174 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/alloc_tables.c
r1765 r2725 98 98 } 99 99 100 101 100 return 0; 102 101 } 103 104 105 102 106 103 errcode_t ext2fs_allocate_tables(ext2_filsys fs) … … 116 113 return 0; 117 114 } 118 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c
r1765 r2725 126 126 goto cleanup; 127 127 128 inode.i_atime = inode.i_mtime = time( 0);128 inode.i_atime = inode.i_mtime = time(NULL); 129 129 if (!inode.i_ctime) 130 inode.i_ctime = time( 0);130 inode.i_ctime = time(NULL); 131 131 inode.i_blocks = rec.bad_block_count * (fs->blocksize / 512); 132 132 inode.i_size = rec.bad_block_count * fs->blocksize; … … 261 261 return BLOCK_CHANGED; 262 262 } 263 264 265 266 267 268 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/bitops.c
r1765 r2725 66 66 } 67 67 68 #endif 68 #endif /* !_EXT2_HAVE_ASM_BITOPS_ */ 69 69 70 70 void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, … … 89 89 #endif 90 90 } 91 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/bitops.h
r1765 r2725 14 14 * Linus Torvalds. 15 15 */ 16 17 16 #include <string.h> 18 //#include <strings.h>19 17 20 18 extern int ext2fs_set_bit(unsigned int nr,void * addr); -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/block.c
r1765 r2725 436 436 block_buf, xlate_func, &xl); 437 437 } 438 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c
r1765 r2725 137 137 blk_t addr_per_block; 138 138 blk_t b; 139 char *buf = 0;139 char *buf = NULL; 140 140 errcode_t retval = 0; 141 141 int blocks_alloc = 0, inode_dirty = 0; … … 260 260 return retval; 261 261 } 262 263 264 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/bmove.c
r1765 r2725 154 154 return 0; 155 155 } 156 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/brel.h
r1765 r2725 85 85 #define ext2fs_brel_delete(brel, old) ((brel)->delete((brel), old)) 86 86 #define ext2fs_brel_free(brel) ((brel)->free((brel))) 87 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c
r1765 r2725 207 207 errcode_t retval; 208 208 unsigned long fs_state; 209 struct ext2_super_block *super_shadow = 0;210 struct ext2_group_desc *group_shadow = 0;209 struct ext2_super_block *super_shadow = NULL; 210 struct ext2_group_desc *group_shadow = NULL; 211 211 char *group_ptr; 212 212 int old_desc_blocks; … … 379 379 return 0; 380 380 } 381 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/cmp_bitmaps.c
r1765 r2725 71 71 return 0; 72 72 } 73 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/dir_iterate.c
r1765 r2725 218 218 return 0; 219 219 } 220 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c
r1765 r2725 81 81 errcode_t retval; 82 82 char *p, *end; 83 char *buf = 0;83 char *buf = NULL; 84 84 struct ext2_dir_entry *dirent; 85 85 … … 131 131 return ext2fs_write_dir_block2(fs, block, inbuf, 0); 132 132 } 133 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/dirhash.c
r1765 r2725 43 43 b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); 44 44 b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); 45 } while (--n);45 } while (--n); 46 46 47 47 buf[0] += b0; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/dupfs.c
r1765 r2725 93 93 ext2fs_free(fs); 94 94 return retval; 95 96 95 } 97 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/e2image.h
r1765 r2725 38 38 __u32 offset_reserved[8]; 39 39 }; 40 41 42 43 44 45 46 47 48 49 50 51 52 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_ext_attr.h
r1765 r2725 51 51 #define EXT2_XATTR_SIZE(size) \ 52 52 (((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND) 53 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h
r1765 r2725 14 14 * Copyright (C) 1991, 1992 Linus Torvalds 15 15 */ 16 17 #ifndef _LINUX_EXT2_FS_H 18 #define _LINUX_EXT2_FS_H 16 #ifndef LINUX_EXT2_FS_H 17 #define LINUX_EXT2_FS_H 1 19 18 20 19 #include "ext2_types.h" /* Changed from linux/types.h */ … … 568 567 ~EXT2_DIR_ROUND) 569 568 570 #endif /* _LINUX_EXT2_FS_H */569 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h
r1765 r2725 10 10 * %End-Header% 11 11 */ 12 13 #ifndef _EXT2FS_EXT2_IO_H 14 #define _EXT2FS_EXT2_IO_H 12 #ifndef EXT2FS_EXT2_IO_H 13 #define EXT2FS_EXT2_IO_H 1 15 14 16 15 /* … … 111 110 (int blksize, errcode_t err); 112 111 113 #endif /* _EXT2FS_EXT2_IO_H */ 114 112 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h
r1765 r2725 10 10 * %End-Header% 11 11 */ 12 13 #ifndef _EXT2FS_EXT2FS_H 14 #define _EXT2FS_EXT2FS_H 12 #ifndef EXT2FS_EXT2FS_H 13 #define EXT2FS_EXT2FS_H 1 15 14 16 15 … … 921 920 #endif 922 921 923 #endif /* _EXT2FS_EXT2FS_H */922 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2fsP.h
r1765 r2725 86 86 int ref_offset, 87 87 void *priv_data); 88 89 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs_inline.c
r1765 r2725 51 51 * with C99 strict type aliasing rules. */ 52 52 memcpy(&p, ptr, sizeof (p)); 53 p = realloc(p, size); 54 if (!p) 55 return EXT2_ET_NO_MEMORY; 53 p = xrealloc(p, size); 56 54 memcpy(ptr, &p, sizeof (p)); 57 55 return 0; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext_attr.c
r1765 r2725 69 69 errcode_t retval; 70 70 struct ext2_ext_attr_header *header; 71 char *buf = 0;71 char *buf = NULL; 72 72 73 73 if ((blk >= fs->super->s_blocks_count) || -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/finddev.c
r1765 r2725 116 116 char *ext2fs_find_block_device(dev_t device) 117 117 { 118 struct dir_list *list = 0, *new_list = 0;118 struct dir_list *list = NULL, *new_list = NULL; 119 119 struct dir_list *current; 120 char *ret_path = 0;120 char *ret_path = NULL; 121 121 122 122 /* -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/flushb.c
r1765 r2725 24 24 #if HAVE_SYS_MOUNT_H 25 25 #include <sys/param.h> 26 #include <sys/mount.h> 26 #include <sys/mount.h> /* This may define BLKFLSBUF */ 27 27 #endif 28 28 … … 39 39 #ifdef __linux__ 40 40 #ifndef BLKFLSBUF 41 #define BLKFLSBUF _IO(0x12,97)/* flush buffer cache */41 #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ 42 42 #endif 43 43 #ifndef FDFLUSH 44 #define FDFLUSH _IO(2,0x4b)/* flush floppy disk */44 #define FDFLUSH _IO(2,0x4b) /* flush floppy disk */ 45 45 #endif 46 46 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/freefs.c
r1765 r2725 126 126 ext2fs_free_mem(&dblist); 127 127 } 128 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c
r1765 r2725 154 154 ext2fs_free_mem(&buf); 155 155 return retval; 156 157 156 } -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/getsize.c
r1765 r2725 79 79 dev = CreateFile(file, GENERIC_READ, 80 80 FILE_SHARE_READ | FILE_SHARE_WRITE , 81 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);81 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 82 82 83 83 if (dev == INVALID_HANDLE_VALUE) -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/imager.c
r1765 r2725 334 334 errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) 335 335 { 336 char *ptr, *buf = 0;336 char *ptr, *buf = NULL; 337 337 int size; 338 338 ssize_t actual; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ind_block.c
r1765 r2725 68 68 return io_channel_write_blk(fs->io, blk, 1, buf); 69 69 } 70 71 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/inline.c
r1765 r2725 2 2 /* 3 3 * inline.c --- Includes the inlined functions defined in the header 4 * 5 * 4 * files as standalone functions, in case the application program 5 * is compiled with inlining turned off. 6 6 * 7 7 * Copyright (C) 1993, 1994 Theodore Ts'o. … … 31 31 #define INCLUDE_INLINE_FUNCS 32 32 #include "ext2fs.h" 33 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/inode.c
r1765 r2725 765 765 return 0; 766 766 } 767 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/inode_io.c
r1765 r2725 269 269 return ext2fs_file_flush(data->file); 270 270 } 271 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/ismounted.c
r1765 r2725 60 60 #ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */ 61 61 file_rdev = st_buf.st_rdev; 62 #endif 62 #endif /* __GNU__ */ 63 63 } else { 64 64 file_dev = st_buf.st_dev; … … 74 74 if (file_rdev && (file_rdev == st_buf.st_rdev)) 75 75 break; 76 #endif 76 #endif /* __GNU__ */ 77 77 } else { 78 78 if (file_dev && ((file_dev == st_buf.st_dev) && … … 100 100 } 101 101 } 102 #endif 102 #endif /* __GNU__ */ 103 103 goto errout; 104 104 } … … 248 248 S_ISBLK(st_buf.st_mode)) 249 249 file_dev = st_buf.st_rdev; 250 #endif 251 252 if (!(f = fopen ("/proc/swaps", "r")))250 #endif /* __GNU__ */ 251 252 if (!(f = fopen_for_read("/proc/swaps"))) 253 253 return 0; 254 254 /* Skip the first line */ … … 272 272 break; 273 273 } 274 #endif 274 #endif /* __GNU__ */ 275 275 } 276 276 fclose(f); -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/jfs_dat.h
r1765 r2725 61 61 __u32 s_sequence; /* first commit ID expected in log */ 62 62 __u32 s_start; /* blocknr of start of log */ 63 64 63 } journal_superblock_t; 65 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/kernel-jbd.h
r1765 r2725 14 14 * filesystem journaling support. 15 15 */ 16 17 #ifndef _LINUX_JBD_H 18 #define _LINUX_JBD_H 16 #ifndef LINUX_JBD_H 17 #define LINUX_JBD_H 1 19 18 20 19 #include <sys/types.h> … … 234 233 235 234 236 #endif /* _LINUX_JBD_H */235 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/kernel-list.h
r1765 r2725 1 1 /* vi: set sw=4 ts=4: */ 2 #ifndef _LINUX_LIST_H3 #define _LINUX_LIST_H2 #ifndef LINUX_LIST_H 3 #define LINUX_LIST_H 1 4 4 5 5 /* -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/lookup.c
r1765 r2725 67 67 return (ls.found) ? 0 : EXT2_ET_FILE_NOT_FOUND; 68 68 } 69 70 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c
r1765 r2725 40 40 ext2_ino_t scratch_ino; 41 41 blk_t blk; 42 char *block = 0;42 char *block = NULL; 43 43 44 44 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); … … 137 137 ext2fs_free_mem(&block); 138 138 return retval; 139 140 139 } 141 142 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c
r1765 r2725 96 96 { 97 97 errcode_t retval; 98 char *buf = 0;98 char *buf = NULL; 99 99 int fd, ret_size; 100 100 blk_t i; … … 189 189 else 190 190 return BLOCK_CHANGED; 191 192 191 } 193 192 … … 232 231 inode.i_size += fs->blocksize * size; 233 232 inode.i_blocks += (fs->blocksize / 512) * es.newblocks; 234 inode.i_mtime = inode.i_ctime = time( 0);233 inode.i_mtime = inode.i_ctime = time(NULL); 235 234 inode.i_links_count = 1; 236 235 inode.i_mode = LINUX_S_IFREG | 0600; … … 424 423 ext2fs_close(fs); 425 424 exit(0); 426 427 } 428 #endif 425 } 426 #endif -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/namei.c
r1765 r2725 31 31 { 32 32 char *pathname; 33 char *buffer = 0;33 char *buffer = NULL; 34 34 errcode_t retval; 35 35 struct ext2_inode ei; … … 49 49 return EXT2_ET_SYMLINK_LOOP; 50 50 } 51 if (ext2fs_inode_data_blocks(fs, &ei)) {51 if (ext2fs_inode_data_blocks(fs, &ei)) { 52 52 retval = ext2fs_get_mem(fs->blocksize, &buffer); 53 53 if (retval) … … 203 203 return retval; 204 204 } 205 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/newdir.c
r1765 r2725 67 67 dir->name[0] = '.'; 68 68 dir->name[1] = '.'; 69 70 69 } 71 70 *block = buf; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/read_bb.c
r1765 r2725 95 95 return rb.err; 96 96 } 97 98 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/read_bb_file.c
r1765 r2725 95 95 call_compat_invalid); 96 96 } 97 98 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c
r1765 r2725 114 114 inode.i_size = inode_size & 0xFFFFFFFF; 115 115 inode.i_size_high = (inode_size >> 32) & 0xFFFFFFFF; 116 if (inode.i_size_high) {116 if (inode.i_size_high) { 117 117 sb->s_feature_ro_compat |= 118 118 EXT2_FEATURE_RO_COMPAT_LARGE_FILE; 119 119 } 120 inode.i_ctime = time( 0);120 inode.i_ctime = time(NULL); 121 121 } 122 122 … … 210 210 #endif 211 211 if (inode_dirty) { 212 inode.i_atime = inode.i_mtime = time( 0);212 inode.i_atime = inode.i_mtime = time(NULL); 213 213 retval2 = ext2fs_write_inode(fs, EXT2_RESIZE_INO, &inode); 214 214 if (!retval) … … 219 219 return retval; 220 220 } 221 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/rs_bitmap.c
r1765 r2725 105 105 return retval; 106 106 } 107 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c
r1765 r2725 150 150 { 151 151 dgrp_t i; 152 char *block_bitmap = 0, *inode_bitmap = 0;152 char *block_bitmap = NULL, *inode_bitmap = NULL; 153 153 char *buf; 154 154 errcode_t retval; … … 267 267 errcode_t ext2fs_read_bitmaps(ext2_filsys fs) 268 268 { 269 270 269 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); 271 270 … … 294 293 return 0; 295 294 } 296 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/swapfs.c
r1765 r2725 67 67 for (i=0; i < 17; i++) 68 68 sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]); 69 70 69 } 71 70 … … 223 222 bufsize - sizeof(struct ext2_inode) - 224 223 t->i_extra_isize - sizeof(__u32), 0); 225 226 224 } 227 225 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/test_io.c
r1765 r2725 181 181 data->outfile = NULL; 182 182 if ((value = getenv("TEST_IO_LOGFILE")) != NULL) 183 data->outfile = fopen (value, "w");183 data->outfile = fopen_for_write(value); 184 184 if (!data->outfile) 185 185 data->outfile = stderr; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/ext2fs/unlink.c
r1765 r2725 98 98 return (ls.done) ? 0 : EXT2_ET_DIR_NO_SPACE; 99 99 } 100 -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/fsck.c
r1765 r2725 21 21 * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. 22 22 * 23 * %Begin-Header% 24 * This file may be redistributed under the terms of the GNU Public 25 * License. 26 * %End-Header% 23 * Licensed under GPLv2, see file LICENSE in this source tree. 27 24 */ 28 25 … … 286 283 if (!s) 287 284 return 0; 288 ret = strdup(s);285 ret = xstrdup(s); 289 286 return ret; 290 287 } … … 353 350 return; 354 351 355 for (p = q = word; *p; q++) { 356 c = *p++; 357 if (c != '\\') { 358 *q = c; 359 } else { 360 *q = bb_process_escape_sequence(&p); 361 } 362 } 363 *q = 0; 352 strcpy_and_process_escape_sequences(word, word); 364 353 } 365 354 … … 381 370 struct fs_info *fs; 382 371 383 if (!(fs = malloc(sizeof(struct fs_info)))) 384 return NULL; 372 fs = xmalloc(sizeof(struct fs_info)); 385 373 386 374 fs->device = string_copy(device); … … 478 466 struct fs_info *fs; 479 467 480 if ((f = fopen(filename, "r")) == NULL) { 481 bb_perror_msg("WARNING: cannot open %s", filename); 468 if ((f = fopen_or_warn(filename, "r")) == NULL) { 482 469 return; 483 470 } … … 535 522 static char *find_fsck(char *type) 536 523 { 537 538 539 540 541 542 543 544 545 for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) {546 s = xasprintf(tpl, s, type);547 if (stat(s, &st) == 0) break;548 free(s);549 550 551 524 char *s; 525 const char *tpl; 526 char *p = string_copy(fsck_path); 527 struct stat st; 528 529 /* Are we looking for a program or just a type? */ 530 tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s"); 531 532 for (s = strtok(p, ":"); s; s = strtok(NULL, ":")) { 533 s = xasprintf(tpl, s, type); 534 if (stat(s, &st) == 0) break; 535 free(s); 536 } 537 free(p); 538 return s; 552 539 } 553 540 … … 578 565 pid_t pid; 579 566 580 inst = malloc(sizeof(struct fsck_instance)); 581 if (!inst) 582 return ENOMEM; 583 memset(inst, 0, sizeof(struct fsck_instance)); 567 inst = xzalloc(sizeof(struct fsck_instance)); 584 568 585 569 prog = xasprintf("fsck.%s", type); … … 614 598 for (i=0; i < argc; i++) 615 599 printf("%s ", argv[i]); 616 puts("");600 bb_putchar('\n'); 617 601 } 618 602 … … 621 605 pid = -1; 622 606 else if ((pid = fork()) < 0) { 623 perror(" fork");607 perror("vfork"+1); 624 608 return errno; 625 609 } else if (pid == 0) { … … 627 611 close(0); 628 612 (void) execv(s, argv); 629 bb_ perror_msg_and_die("%s",argv[0]);613 bb_simple_perror_msg_and_die(argv[0]); 630 614 } 631 615 … … 887 871 num = 0; 888 872 s = strtok(list, ","); 889 while (s) {873 while (s) { 890 874 negate = 0; 891 875 if (strncmp(s, "no", 2) == 0) { … … 932 916 933 917 s = strtok(list, ","); 934 while (s) {918 while (s) { 935 919 if (strcmp(s, opt) == 0) { 936 920 free(list); … … 1006 990 if (s == NULL) { 1007 991 if (wanted) 1008 bb_error_msg("can not check %s: fsck.%s not found",992 bb_error_msg("can't check %s: fsck.%s not found", 1009 993 fs->device, fs->type); 1010 994 return 1; … … 1175 1159 { 1176 1160 int i, j; 1177 char *arg, *dev, *tmp = 0;1161 char *arg, *dev, *tmp = NULL; 1178 1162 char options[128]; 1179 1163 int opt = 0; … … 1208 1192 */ 1209 1193 if (access("/proc/partitions", R_OK) < 0) { 1210 bb_perror_msg_and_die("can not open /proc/partitions "1194 bb_perror_msg_and_die("can't open /proc/partitions " 1211 1195 "(is /proc mounted?)"); 1212 1196 } … … 1220 1204 else 1221 1205 bb_error_msg_and_die( 1222 "can not find matching filesystem: %s", arg);1206 "can't find matching filesystem: %s", arg); 1223 1207 } 1224 1208 devices[num_devices++] = dev ? dev : string_copy(arg); … … 1322 1306 } 1323 1307 1324 int fsck_main(int argc, char **argv) ;1308 int fsck_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 1325 1309 int fsck_main(int argc, char **argv) 1326 1310 { -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/lsattr.c
r1765 r2725 13 13 /* 14 14 * History: 15 * 93/10/30 16 * 93/11/13 17 * 94/02/27 18 * 98/12/29 15 * 93/10/30 - Creation 16 * 93/11/13 - Replace stat() calls by lstat() to avoid loops 17 * 94/02/27 - Integrated in Ted's distribution 18 * 98/12/29 - Display version info only when -V specified (G M Sipe) 19 19 */ 20 20 … … 57 57 if (flags & OPT_PF_LONG) { 58 58 printf("%-28s ", name); 59 print_ flags(stdout, fsflags, PFOPT_LONG);60 puts("");59 print_e2flags(stdout, fsflags, PFOPT_LONG); 60 bb_putchar('\n'); 61 61 } else { 62 print_ flags(stdout, fsflags, 0);62 print_e2flags(stdout, fsflags, 0); 63 63 printf(" %s\n", name); 64 64 } … … 103 103 printf("\n%s:\n", path); 104 104 iterate_on_dir(path, lsattr_dir_proc, NULL); 105 puts("");105 bb_putchar('\n'); 106 106 } 107 107 } … … 113 113 } 114 114 115 int lsattr_main(int argc, char **argv) ;115 int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 116 116 int lsattr_main(int argc, char **argv) 117 117 { -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/mke2fs.c
r1765 r2725 6 6 * 2003, 2004, 2005 by Theodore Ts'o. 7 7 * 8 * This file may be redistributed under the terms of the GNU Public 9 * License. 8 * Licensed under GPLv2, see file LICENSE in this source tree. 10 9 */ 11 10 … … 177 176 if (retval) { 178 177 va_start(ap, fmt); 179 fprintf(stderr, "\nCould not ");178 fprintf(stderr, "\nCould not "); 180 179 vfprintf(stderr, fmt, ap); 181 180 fprintf(stderr, "\n"); … … 210 209 if (retval) { 211 210 va_start(ap, fmt); 212 fprintf(stderr, "\nWarning: ");211 fprintf(stderr, "\nWarning: "); 213 212 vfprintf(stderr, fmt, ap); 214 213 fprintf(stderr, "\n"); … … 226 225 errcode_t retval; 227 226 228 f = xfopen (bad_blocks_file, "r");227 f = xfopen_for_read(bad_blocks_file); 229 228 retval = ext2fs_read_bb_FILE(fs, f, bb_list, invalid_block); 230 229 fclose (f); … … 247 246 f = popen(buf, "r"); 248 247 if (!f) { 249 bb_perror_msg_and_die("can not run '%s'", buf);248 bb_perror_msg_and_die("can't run '%s'", buf); 250 249 } 251 250 retval = ext2fs_read_bb_FILE(fs, f, bb_list, invalid_block); … … 642 641 s->s_inodes_per_group); 643 642 if (fs->group_desc_count == 1) { 644 puts("");643 bb_putchar('\n'); 645 644 return; 646 645 } … … 677 676 } 678 677 679 if ((sb->s_creator_os = e2p_string2os(os)) >= 0) {678 if ((sb->s_creator_os = e2p_string2os(os)) >= 0) { 680 679 return 1; 681 680 } else if (!strcasecmp("GNU", os)) { … … 801 800 ext2_ino_t num_inodes = 0; 802 801 errcode_t retval; 803 char * extended_opts = 0;804 const char * fs_type = 0;802 char * extended_opts = NULL; 803 const char * fs_type = NULL; 805 804 blk_t dev_size; 806 805 long sysval; … … 897 896 break; 898 897 case 'r': 899 param.s_rev_level = xatoi_ u(optarg);898 param.s_rev_level = xatoi_positive(optarg); 900 899 if (param.s_rev_level == EXT2_GOOD_OLD_REV) { 901 900 param.s_feature_incompat = 0; … … 914 913 #ifdef EXT2_DYNAMIC_REV 915 914 case 'I': 916 inode_size = xatoi_ u(optarg);915 inode_size = xatoi_positive(optarg); 917 916 break; 918 917 #endif 919 918 case 'N': 920 num_inodes = xatoi_ u(optarg);919 num_inodes = xatoi_positive(optarg); 921 920 break; 922 921 case 'v': … … 1188 1187 if (ENABLE_FEATURE_CLEAN_UP) 1189 1188 atexit(mke2fs_clean_up); 1190 if (!PRS(argc, argv))1189 if (!PRS(argc, argv)) 1191 1190 return 0; 1192 1191 … … 1307 1306 NULL, &ret_blk, NULL); 1308 1307 1309 mke2fs_warning_msg(retval, "can not zero block %u at end of filesystem", ret_blk);1308 mke2fs_warning_msg(retval, "can't zero block %u at end of filesystem", ret_blk); 1310 1309 write_inode_tables(fs); 1311 1310 create_root_dir(fs); -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/tune2fs.c
r1765 r2725 9 9 * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. 10 10 * 11 * %Begin-Header% 12 * This file may be redistributed under the terms of the GNU Public 13 * License. 14 * %End-Header% 11 * Licensed under GPLv2, see file LICENSE in this source tree. 15 12 */ 16 13 … … 396 393 #endif 397 394 if (ts.tm_mday == 0) { 398 bb_error_msg_and_die(" Cannot parse date/time specifier: %s", str);395 bb_error_msg_and_die("can't parse date/time specifier: %s", str); 399 396 } 400 397 return mktime(&ts); … … 558 555 } 559 556 560 #ifdef CONFIG_FINDFS561 static ATTRIBUTE_NORETURN void do_findfs(int argc, char **argv)562 {563 if ((argc != 2) ||564 (strncmp(argv[1], "LABEL=", 6) && strncmp(argv[1], "UUID=", 5)))565 bb_show_usage();566 device_name = x_blkid_get_devname(argv[1]);567 puts(device_name);568 exit(0);569 }570 #else571 #define do_findfs(x, y)572 #endif573 574 557 static void tune2fs_clean_up(void) 575 558 { … … 578 561 } 579 562 580 int tune2fs_main(int argc, char **argv) ;563 int tune2fs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 581 564 int tune2fs_main(int argc, char **argv) 582 565 { … … 589 572 atexit(tune2fs_clean_up); 590 573 591 if (ENABLE_FINDFS && (applet_name[0] == 'f')) /* findfs */ 592 do_findfs(argc, argv); /* no return */ 593 else if (ENABLE_E2LABEL && (applet_name[0] == 'e')) /* e2label */ 574 if (ENABLE_E2LABEL && (applet_name[0] == 'e')) /* e2label */ 594 575 parse_e2label_options(argc, argv); 595 576 else … … 610 591 retval = ext2fs_check_if_mounted(device_name, &mount_flags); 611 592 if (retval) 612 bb_error_msg_and_die("can not determine if %s is mounted", device_name);593 bb_error_msg_and_die("can't determine if %s is mounted", device_name); 613 594 /* Normally we only need to write out the superblock */ 614 595 fs->flags |= EXT2_FLAG_SUPER_ONLY; -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/util.c
r1765 r2725 5 5 * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. 6 6 * 7 * %Begin-Header% 8 * This file may be redistributed under the terms of the GNU Public 9 * License. 10 * %End-Header% 7 * Licensed under GPLv2, see file LICENSE in this source tree. 11 8 */ 12 9 … … 38 35 if (force) 39 36 return; 40 if (val == -1)41 bb_perror_msg_and_die("can not stat %s", device);37 if (val == -1) 38 bb_perror_msg_and_die("can't stat '%s'", device); 42 39 if (!S_ISBLK(s.st_mode)) { 43 40 printf("%s is not a block special device.\n", device); … … 83 80 retval = ext2fs_check_if_mounted(device, &mount_flags); 84 81 if (retval) { 85 bb_error_msg("can not determine if %s is mounted", device);82 bb_error_msg("can't determine if %s is mounted", device); 86 83 return; 87 84 } … … 99 96 goto force_check; 100 97 } 101 102 98 } 103 99 … … 220 216 fs->blocksize, io_ptr, &jfs); 221 217 if (retval) 222 bb_error_msg_and_die("can not journal device %s", journal_device);223 if (!quiet)218 bb_error_msg_and_die("can't journal device %s", journal_device); 219 if (!quiet) 224 220 printf("Adding journal to device %s: ", journal_device); 225 221 fflush(stdout); 226 222 retval = ext2fs_add_journal_device(fs, jfs); 227 if (retval)223 if (retval) 228 224 bb_error_msg_and_die("\nFailed to add journal to device %s", journal_device); 229 if (!quiet)225 if (!quiet) 230 226 puts("done"); 231 227 ext2fs_close(jfs); … … 243 239 return; 244 240 } 245 if (!quiet)241 if (!quiet) 246 242 printf("Creating journal (%ld blocks): ", journal_blocks); 247 243 fflush(stdout); 248 244 retval = ext2fs_add_journal_inode(fs, journal_blocks, 249 245 journal_flags); 250 if (retval)251 bb_error_msg_and_die("can not create journal");252 if (!quiet)246 if (retval) 247 bb_error_msg_and_die("can't create journal"); 248 if (!quiet) 253 249 puts("done"); 254 250 } … … 263 259 else 264 260 oldpath = PATH_SET; 265 putenv 261 putenv(oldpath); 266 262 return oldpath; 267 263 } -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/uuid/Kbuild
r1765 r2725 1 # DO NOT EDIT. This file is generated from Kbuild.src 1 2 # Makefile for busybox 2 3 # 3 4 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 4 5 # 5 # Licensed under the GPL v2, see the file LICENSE in this tarball.6 # Licensed under GPLv2, see file LICENSE in this source tree. 6 7 7 8 NEEDED-$(CONFIG_E2FSCK) = y … … 11 12 12 13 lib-y:= 14 15 13 16 lib-$(NEEDED-y) += compare.o gen_uuid.o pack.o parse.o unpack.o unparse.o \ 14 17 uuid_time.o -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/uuid/gen_uuid.c
r1765 r2725 166 166 for (i = 0; i < n; i+= ifreq_size(*ifrp) ) { 167 167 ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); 168 strncpy (ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);168 strncpy_IFNAMSIZ(ifr.ifr_name, ifrp->ifr_name); 169 169 #ifdef SIOCGIFHWADDR 170 170 if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/uuid/uuid.h
r1765 r2725 33 33 * %End-Header% 34 34 */ 35 36 #ifndef _UUID_UUID_H 37 #define _UUID_UUID_H 35 #ifndef UUID_UUID_H 36 #define UUID_UUID_H 1 38 37 39 38 #include <sys/types.h> … … 55 54 #ifdef __GNUC__ 56 55 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ 57 static const uuid_t name ATTRIBUTE_UNUSED= {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}56 static const uuid_t name UNUSED_PARAM = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} 58 57 #else 59 58 #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ -
branches/2.2.9/mindi-busybox/e2fsprogs/old_e2fsprogs/uuid/uuid_time.c
r1765 r2725 148 148 break; 149 149 default: 150 puts("");150 bb_putchar('\n'); 151 151 } 152 152 if (type != 1) {
Note:
See TracChangeset
for help on using the changeset viewer.