diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/badblocks.c | 72 | ||||
-rw-r--r-- | misc/base_device.c | 8 | ||||
-rw-r--r-- | misc/blkid.c | 4 | ||||
-rw-r--r-- | misc/chattr.c | 2 | ||||
-rw-r--r-- | misc/dumpe2fs.c | 26 | ||||
-rw-r--r-- | misc/e2image.c | 66 | ||||
-rw-r--r-- | misc/e2initrd_helper.c | 24 | ||||
-rw-r--r-- | misc/e2label.c | 2 | ||||
-rw-r--r-- | misc/filefrag.c | 10 | ||||
-rw-r--r-- | misc/findsuper.c | 20 | ||||
-rw-r--r-- | misc/fsck.c | 58 | ||||
-rw-r--r-- | misc/logsave.c | 20 | ||||
-rw-r--r-- | misc/lsattr.c | 2 | ||||
-rw-r--r-- | misc/mke2fs.c | 96 | ||||
-rw-r--r-- | misc/mklost+found.c | 2 | ||||
-rw-r--r-- | misc/partinfo.c | 14 | ||||
-rw-r--r-- | misc/tune2fs.c | 28 | ||||
-rw-r--r-- | misc/util.c | 16 | ||||
-rw-r--r-- | misc/util.h | 2 | ||||
-rw-r--r-- | misc/uuidd.c | 2 | ||||
-rw-r--r-- | misc/uuidgen.c | 4 |
21 files changed, 239 insertions, 239 deletions
diff --git a/misc/badblocks.c b/misc/badblocks.c index ef6ab5b2..6261cbea 100644 --- a/misc/badblocks.c +++ b/misc/badblocks.c @@ -10,7 +10,7 @@ * * This file is based on the minix file system programs fsck and mkfs * written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi> - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -24,7 +24,7 @@ * 99/06/30...99/07/26 - Added non-destructive write-testing, * configurable blocks-at-once parameter, * loading of badblocks list to avoid testing - * blocks known to be bad, multiple passes to + * blocks known to be bad, multiple passes to * make sure that no new blocks are added to the * list. (Work done by David Beattie) */ @@ -92,8 +92,8 @@ static void usage(void) static void exclusive_usage(void) { - fprintf(stderr, - _("%s: The -n and -w options are mutually exclusive.\n\n"), + fprintf(stderr, + _("%s: The -n and -w options are mutually exclusive.\n\n"), program_name); exit(1); } @@ -108,7 +108,7 @@ static ext2_badblocks_iterate bb_iter = NULL; static void *allocate_buffer(size_t size) { void *ret = 0; - + #ifdef HAVE_POSIX_MEMALIGN if (posix_memalign(&ret, sys_page_size, size) < 0) ret = 0; @@ -119,7 +119,7 @@ static void *allocate_buffer(size_t size) #ifdef HAVE_VALLOC ret = valloc(size); #endif /* HAVE_VALLOC */ -#endif /* HAVE_MEMALIGN */ +#endif /* HAVE_MEMALIGN */ #endif /* HAVE_POSIX_MEMALIGN */ if (!ret) @@ -149,7 +149,7 @@ static int bb_output (blk_t bad) } /* kludge: - increment the iteration through the bb_list if + increment the iteration through the bb_list if an element was just added before the current iteration position. This should not cause next_bad to change. */ if (bb_iter && bad < next_bad) @@ -159,7 +159,7 @@ static int bb_output (blk_t bad) static void print_status(void) { - fprintf(stderr, "%15lu/%15lu", (unsigned long) currently_testing, + fprintf(stderr, "%15lu/%15lu", (unsigned long) currently_testing, (unsigned long) num_blocks); fputs("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", stderr); fflush (stderr); @@ -211,7 +211,7 @@ static void set_o_direct(int dev, unsigned char *buffer, size_t size, #ifdef O_DIRECT int new_flag = O_DIRECT; int flag; - + if ((((unsigned long) buffer & (sys_page_size - 1)) != 0) || ((size & (sys_page_size - 1)) != 0) || ((current_block & ((sys_page_size >> 9)-1)) != 0)) @@ -235,7 +235,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, { unsigned int i, nb; unsigned char bpattern[sizeof(pattern)], *ptr; - + if (pattern == (unsigned int) ~0) { for (ptr = buffer; ptr < buffer + n; ptr++) { (*ptr) = random() % (1 << (8 * sizeof(char))); @@ -296,7 +296,7 @@ static int do_read (int dev, unsigned char * buffer, int try, int block_size, if (d_flag) gettimeofday(&tv2, NULL); if (got < 0) - got = 0; + got = 0; if (got & 511) fprintf(stderr, _("Weird value (%ld) in do_read\n"), got); got /= block_size; @@ -361,7 +361,7 @@ static int do_write(int dev, unsigned char * buffer, int try, int block_size, /* Try the write */ got = write (dev, buffer, try * block_size); if (got < 0) - got = 0; + got = 0; if (got & 511) fprintf(stderr, "Weird value (%ld) in do_write\n", got); got /= block_size; @@ -410,8 +410,8 @@ static unsigned int test_ro (int dev, blk_t last_block, exit (1); } if (v_flag) { - fprintf (stderr, _("Checking blocks %lu to %lu\n"), - (unsigned long) first_block, + fprintf (stderr, _("Checking blocks %lu to %lu\n"), + (unsigned long) first_block, (unsigned long) last_block - 1); } if (t_flag) { @@ -466,7 +466,7 @@ static unsigned int test_ro (int dev, blk_t last_block, if ( (blocks_at_once >= sys_page_size >> 9) && (currently_testing % (sys_page_size >> 9)!= 0)) try -= (sys_page_size >> 9) - - (currently_testing + - (currently_testing % (sys_page_size >> 9)); continue; } @@ -501,7 +501,7 @@ static unsigned int test_rw (int dev, blk_t last_block, buffer = allocate_buffer(2 * blocks_at_once * block_size); read_buffer = buffer + blocks_at_once * block_size; - + if (!buffer) { com_err (program_name, ENOMEM, _("while allocating buffers")); exit (1); @@ -510,10 +510,10 @@ static unsigned int test_rw (int dev, blk_t last_block, flush_bufs(); if (v_flag) { - fputs(_("Checking for bad blocks in read-write mode\n"), + fputs(_("Checking for bad blocks in read-write mode\n"), stderr); fprintf(stderr, _("From block %lu to %lu\n"), - (unsigned long) first_block, + (unsigned long) first_block, (unsigned long) last_block - 1); } if (t_flag) { @@ -551,10 +551,10 @@ static unsigned int test_rw (int dev, blk_t last_block, try = blocks_at_once; /* recover page-aligned offset for O_DIRECT */ if ( (blocks_at_once >= sys_page_size >> 9) - && (currently_testing % + && (currently_testing % (sys_page_size >> 9)!= 0)) try -= (sys_page_size >> 9) - - (currently_testing + - (currently_testing % (sys_page_size >> 9)); continue; } else @@ -563,7 +563,7 @@ static unsigned int test_rw (int dev, blk_t last_block, bb_count += bb_output(currently_testing++); } } - + num_blocks = 0; alarm (0); if (s_flag | v_flag) @@ -603,14 +603,14 @@ static unsigned int test_rw (int dev, blk_t last_block, if ( (blocks_at_once >= sys_page_size >> 9) && (currently_testing % (sys_page_size >> 9)!= 0)) try = blocks_at_once - (sys_page_size >> 9) - - (currently_testing + - (currently_testing % (sys_page_size >> 9)); else try = blocks_at_once; if (v_flag > 1) print_status(); } - + num_blocks = 0; alarm (0); if (s_flag | v_flag) @@ -668,13 +668,13 @@ static unsigned int test_nd (int dev, blk_t last_block, save_base = blkbuf; test_base = blkbuf + (blocks_at_once * block_size); read_base = blkbuf + (2 * blocks_at_once * block_size); - + num_saved = 0; flush_bufs(); if (v_flag) { fputs(_("Checking for bad blocks in non-destructive read-write mode\n"), stderr); - fprintf (stderr, _("From block %lu to %lu\n"), + fprintf (stderr, _("From block %lu to %lu\n"), (unsigned long) first_block, (unsigned long) last_block - 1); } @@ -697,7 +697,7 @@ static unsigned int test_nd (int dev, blk_t last_block, fflush (out); exit(1); } - + /* set up abend handler */ capture_terminate(terminate_env); @@ -763,7 +763,7 @@ static unsigned int test_nd (int dev, blk_t last_block, if (written != got) com_err (program_name, errno, _("during test data write, block %lu"), - (unsigned long) currently_testing + + (unsigned long) currently_testing + written); buf_used += got; @@ -810,7 +810,7 @@ static unsigned int test_nd (int dev, blk_t last_block, try = test_record[used2].num; used2++; } - + got = do_read (dev, read_ptr, try, block_size, currently_testing); @@ -824,7 +824,7 @@ static unsigned int test_nd (int dev, blk_t last_block, bb_count += bb_output(currently_testing + got); got++; } - + /* write back original data */ do_write (dev, save_ptr, got, block_size, currently_testing); @@ -903,7 +903,7 @@ static unsigned int parse_uint(const char *str, const char *descr) { char *tmp; unsigned long ret; - + errno = 0; ret = strtoul(str, &tmp, 0); if (*tmp || errno || (ret > UINT_MAX) || @@ -958,7 +958,7 @@ int main (int argc, char ** argv) sys_page_size = sysval; #endif /* _SC_PAGESIZE */ #endif /* HAVE_SYSCONF */ - + if (argc && *argv) program_name = *argv; while ((c = getopt (argc, argv, "b:d:e:fi:o:svwnc:p:h:t:X")) != EOF) { @@ -1008,7 +1008,7 @@ int main (int argc, char ** argv) d_flag = parse_uint(optarg, "read delay factor"); break; case 'p': - num_passes = parse_uint(optarg, + num_passes = parse_uint(optarg, "number of clean passes"); break; case 'h': @@ -1018,7 +1018,7 @@ int main (int argc, char ** argv) if (t_flag + 1 > t_max) { unsigned int *t_patts_new; - t_patts_new = realloc(t_patts, sizeof(int) * + t_patts_new = realloc(t_patts, sizeof(int) * (t_max + T_INC)); if (!t_patts_new) { com_err(program_name, ENOMEM, @@ -1095,7 +1095,7 @@ int main (int argc, char ** argv) } if (w_flag) check_mount(device_name); - + open_flag = w_flag ? O_RDWR : O_RDONLY; dev = open (device_name, open_flag); if (dev == -1) { @@ -1180,10 +1180,10 @@ int main (int argc, char ** argv) passes_clean = 0; else ++passes_clean; - + if (v_flag) fprintf(stderr, - _("Pass completed, %u bad blocks found.\n"), + _("Pass completed, %u bad blocks found.\n"), bb_count); } while (passes_clean < num_passes); diff --git a/misc/base_device.c b/misc/base_device.c index 6237d0e6..aad2ba05 100644 --- a/misc/base_device.c +++ b/misc/base_device.c @@ -5,12 +5,12 @@ * assure that we only fsck one partition on a particular drive at any * one time. Otherwise, the disk heads will be seeking all over the * place. If the base device can not be determined, return NULL. - * + * * The base_device() function returns an allocated string which must * be freed. - * + * * Written by Theodore Ts'o, <tytso@mit.edu> - * + * * Copyright (C) 2000 Theodore Ts'o. * * %Begin-Header% @@ -58,7 +58,7 @@ char *base_device(const char *device) /* Skip over /dev/dsk/... */ if (strncmp(cp, "dsk/", 4) == 0) cp += 4; - + /* * For md devices, we treat them all as if they were all * on one disk, since we don't know how to parallelize them. diff --git a/misc/blkid.c b/misc/blkid.c index c7679ad5..4bbf9fbf 100644 --- a/misc/blkid.c +++ b/misc/blkid.c @@ -410,8 +410,8 @@ int main(int argc, char **argv) BLKID_DEV_NORMAL); if (dev) { - if (search_type && - !blkid_dev_has_tag(dev, search_type, + if (search_type && + !blkid_dev_has_tag(dev, search_type, search_value)) continue; print_tags(dev, show, numtag, output_format); diff --git a/misc/chattr.c b/misc/chattr.c index daae163d..3d67519d 100644 --- a/misc/chattr.c +++ b/misc/chattr.c @@ -111,7 +111,7 @@ static const struct flags_char flags_array[] = { static unsigned long get_flag(char c) { const struct flags_char *fp; - + for (fp = flags_array; fp->flag != 0; fp++) { if (fp->optchar == c) return fp->flag; diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index 98a63159..9ef54769 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -57,7 +57,7 @@ static void usage(void) static void print_number(unsigned long num) { - if (hex_format) + if (hex_format) printf("0x%04lx", num); else printf("%lu", num); @@ -65,7 +65,7 @@ static void print_number(unsigned long num) static void print_range(unsigned long a, unsigned long b) { - if (hex_format) + if (hex_format) printf("0x%04lx-0x%04lx", a, b); else printf("%lu-%lu", a, b); @@ -162,7 +162,7 @@ static void list_desc (ext2_filsys fs) first_block = ext2fs_group_first_block(fs, i); last_block = ext2fs_group_last_block(fs, i); - ext2fs_super_and_bgd_loc(fs, i, &super_blk, + ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, &new_desc_blk, 0); printf (_("Group %lu: (Blocks "), i); @@ -181,12 +181,12 @@ static void list_desc (ext2_filsys fs) } if (old_desc_blk) { printf(_(", Group descriptors at ")); - print_range(old_desc_blk, + print_range(old_desc_blk, old_desc_blk + old_desc_blocks - 1); if (reserved_gdt) { printf(_("\n Reserved GDT blocks at ")); print_range(old_desc_blk + old_desc_blocks, - old_desc_blk + old_desc_blocks + + old_desc_blk + old_desc_blocks + reserved_gdt - 1); } } else if (new_desc_blk) { @@ -225,7 +225,7 @@ static void list_desc (ext2_filsys fs) fs->group_desc[i].bg_itable_unused); if (block_bitmap) { fputs(_(" Free blocks: "), stdout); - ext2fs_get_block_bitmap_range(fs->block_map, + ext2fs_get_block_bitmap_range(fs->block_map, blk_itr, block_nbytes << 3, block_bitmap); print_free (i, block_bitmap, fs->super->s_blocks_per_group, @@ -235,7 +235,7 @@ static void list_desc (ext2_filsys fs) } if (inode_bitmap) { fputs(_(" Free inodes: "), stdout); - ext2fs_get_inode_bitmap_range(fs->inode_map, + ext2fs_get_inode_bitmap_range(fs->inode_map, ino_itr, inode_nbytes << 3, inode_bitmap); print_free (i, inode_bitmap, fs->super->s_inodes_per_group, 1); @@ -285,7 +285,7 @@ static void print_inline_journal_information(ext2_filsys fs) errcode_t retval; ino_t ino = fs->super->s_journal_inum; int size; - + retval = ext2fs_read_inode(fs, ino, &inode); if (retval) { com_err(program_name, retval, @@ -346,7 +346,7 @@ static void print_journal_information(ext2_filsys fs) } } -static void parse_extended_opts(const char *opts, blk_t *superblock, +static void parse_extended_opts(const char *opts, blk_t *superblock, int *blocksize) { char *buf, *token, *next, *p, *arg, *badopt = 0; @@ -421,7 +421,7 @@ static void parse_extended_opts(const char *opts, blk_t *superblock, exit(1); } free(buf); -} +} int main (int argc, char ** argv) { @@ -447,7 +447,7 @@ int main (int argc, char ** argv) E2FSPROGS_DATE); if (argc && *argv) program_name = *argv; - + while ((c = getopt (argc, argv, "bfhixVo:")) != EOF) { switch (c) { case 'b': @@ -463,7 +463,7 @@ int main (int argc, char ** argv) image_dump++; break; case 'o': - parse_extended_opts(optarg, &use_superblock, + parse_extended_opts(optarg, &use_superblock, &use_blocksize); break; case 'V': @@ -486,7 +486,7 @@ int main (int argc, char ** argv) flags |= EXT2_FLAG_FORCE; if (image_dump) flags |= EXT2_FLAG_IMAGE_FILE; - + if (use_superblock && !use_blocksize) { for (use_blocksize = EXT2_MIN_BLOCK_SIZE; use_blocksize <= EXT2_MAX_BLOCK_SIZE; diff --git a/misc/e2image.c b/misc/e2image.c index 358b3614..9659d496 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -47,7 +47,7 @@ char * device_name = NULL; static void usage(void) { - fprintf(stderr, _("Usage: %s [-rsI] device image_file\n"), + fprintf(stderr, _("Usage: %s [-rsI] device image_file\n"), program_name); exit (1); } @@ -68,10 +68,10 @@ static void write_header(int fd, struct ext2_image_hdr *hdr, int blocksize) exit(1); } memset(header_buf, 0, blocksize); - + if (hdr) memcpy(header_buf, hdr, sizeof(struct ext2_image_hdr)); - + actual = write(fd, header_buf, blocksize); if (actual < 0) { perror("write header"); @@ -100,7 +100,7 @@ static void write_image_file(ext2_filsys fs, int fd) com_err(program_name, retval, _("while writing superblock")); exit(1); } - + hdr.offset_inode = lseek(fd, 0, SEEK_CUR); retval = ext2fs_image_inode_write(fs, fd, (fd != 1) ? IMAGER_FLAG_SPARSEWRITE : 0); @@ -108,7 +108,7 @@ static void write_image_file(ext2_filsys fs, int fd) com_err(program_name, retval, _("while writing inode table")); exit(1); } - + hdr.offset_blockmap = lseek(fd, 0, SEEK_CUR); retval = ext2fs_image_bitmap_write(fs, fd, 0); if (retval) { @@ -129,7 +129,7 @@ static void write_image_file(ext2_filsys fs, int fd) strncpy(hdr.fs_device_name, device_name, sizeof(hdr.fs_device_name)-1); hdr.fs_device_name[sizeof(hdr.fs_device_name) - 1] = 0; hdr.fs_blocksize = fs->blocksize; - + if (stat(device_name, &st) == 0) hdr.fs_device = st.st_rdev; @@ -163,12 +163,12 @@ struct process_block_struct { static ino_t stashed_ino = 0; static struct ext2_inode *stashed_inode; -static errcode_t meta_get_blocks(ext2_filsys fs EXT2FS_ATTR((unused)), +static errcode_t meta_get_blocks(ext2_filsys fs EXT2FS_ATTR((unused)), ext2_ino_t ino, blk_t *blocks) { int i; - + if ((ino != stashed_ino) || !stashed_inode) return EXT2_ET_CALLBACK_NOTHANDLED; @@ -177,7 +177,7 @@ static errcode_t meta_get_blocks(ext2_filsys fs EXT2FS_ATTR((unused)), return 0; } -static errcode_t meta_check_directory(ext2_filsys fs EXT2FS_ATTR((unused)), +static errcode_t meta_check_directory(ext2_filsys fs EXT2FS_ATTR((unused)), ext2_ino_t ino) { if ((ino != stashed_ino) || !stashed_inode) @@ -188,7 +188,7 @@ static errcode_t meta_check_directory(ext2_filsys fs EXT2FS_ATTR((unused)), return 0; } -static errcode_t meta_read_inode(ext2_filsys fs EXT2FS_ATTR((unused)), +static errcode_t meta_read_inode(ext2_filsys fs EXT2FS_ATTR((unused)), ext2_ino_t ino, struct ext2_inode *inode) { @@ -212,11 +212,11 @@ static void use_inode_shortcuts(ext2_filsys fs, int bool) } } -static int process_dir_block(ext2_filsys fs EXT2FS_ATTR((unused)), +static int process_dir_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t *block_nr, - e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), + e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), blk_t ref_block EXT2FS_ATTR((unused)), - int ref_offset EXT2FS_ATTR((unused)), + int ref_offset EXT2FS_ATTR((unused)), void *priv_data EXT2FS_ATTR((unused))) { struct process_block_struct *p; @@ -224,16 +224,16 @@ static int process_dir_block(ext2_filsys fs EXT2FS_ATTR((unused)), p = (struct process_block_struct *) priv_data; ext2fs_mark_block_bitmap(meta_block_map, *block_nr); - if (scramble_block_map && p->is_dir && blockcnt >= 0) + if (scramble_block_map && p->is_dir && blockcnt >= 0) ext2fs_mark_block_bitmap(scramble_block_map, *block_nr); return 0; } -static int process_file_block(ext2_filsys fs EXT2FS_ATTR((unused)), +static int process_file_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t *block_nr, - e2_blkcnt_t blockcnt, + e2_blkcnt_t blockcnt, blk_t ref_block EXT2FS_ATTR((unused)), - int ref_offset EXT2FS_ATTR((unused)), + int ref_offset EXT2FS_ATTR((unused)), void *priv_data EXT2FS_ATTR((unused))) { if (blockcnt < 0) { @@ -246,13 +246,13 @@ static void mark_table_blocks(ext2_filsys fs) { blk_t first_block, b; unsigned int i,j; - + first_block = fs->super->s_first_data_block; /* * Mark primary superblock */ ext2fs_mark_block_bitmap(meta_block_map, first_block); - + /* * Mark the primary superblock descriptors */ @@ -271,17 +271,17 @@ static void mark_table_blocks(ext2_filsys fs) j++, b++) ext2fs_mark_block_bitmap(meta_block_map, b); } - + /* - * Mark block used for the block bitmap + * Mark block used for the block bitmap */ if (fs->group_desc[i].bg_block_bitmap) { ext2fs_mark_block_bitmap(meta_block_map, fs->group_desc[i].bg_block_bitmap); } - + /* - * Mark block used for the inode bitmap + * Mark block used for the inode bitmap */ if (fs->group_desc[i].bg_inode_bitmap) { ext2fs_mark_block_bitmap(meta_block_map, @@ -358,7 +358,7 @@ static void scramble_dir_block(ext2_filsys fs, blk_t blk, char *buf) if (rec_len < 8 || (rec_len % 4) || (p+rec_len > end)) { printf("Corrupt directory block %lu: " - "bad rec_len (%d)\n", (unsigned long) blk, + "bad rec_len (%d)\n", (unsigned long) blk, rec_len); rec_len = end - p; #ifdef WORDS_BIGENDIAN @@ -368,7 +368,7 @@ static void scramble_dir_block(ext2_filsys fs, blk_t blk, char *buf) } if (dirent->name_len + 8 > rec_len) { printf("Corrupt directory block %lu: " - "bad name_len (%d)\n", (unsigned long) blk, + "bad name_len (%d)\n", (unsigned long) blk, dirent->name_len); dirent->name_len = rec_len - 8; continue; @@ -420,7 +420,7 @@ static void output_meta_data_blocks(ext2_filsys fs, int fd) com_err(program_name, retval, "error reading block %u", blk); } - if (scramble_block_map && + if (scramble_block_map && ext2fs_test_block_bitmap(scramble_block_map, blk)) scramble_dir_block(fs, blk, buf); if ((fd != 1) && check_zero_block(buf, fs->blocksize)) @@ -455,7 +455,7 @@ static void write_raw_image_file(ext2_filsys fs, int fd, int scramble_flag) ext2_ino_t ino; errcode_t retval; char * block_buf; - + retval = ext2fs_allocate_block_bitmap(fs, "in-use block map", &meta_block_map); if (retval) { @@ -467,12 +467,12 @@ static void write_raw_image_file(ext2_filsys fs, int fd, int scramble_flag) retval = ext2fs_allocate_block_bitmap(fs, "scramble block map", &scramble_block_map); if (retval) { - com_err(program_name, retval, + com_err(program_name, retval, "while allocating scramble block bitmap"); exit(1); } } - + mark_table_blocks(fs); retval = ext2fs_open_inode_scan(fs, 0, &scan); @@ -486,7 +486,7 @@ static void write_raw_image_file(ext2_filsys fs, int fd, int scramble_flag) com_err(program_name, 0, "Can't allocate block buffer"); exit(1); } - + use_inode_shortcuts(fs, 1); stashed_inode = &inode; while (1) { @@ -508,7 +508,7 @@ static void write_raw_image_file(ext2_filsys fs, int fd, int scramble_flag) } if (!ext2fs_inode_has_valid_blocks(&inode)) continue; - + stashed_ino = ino; pb.ino = ino; pb.is_dir = LINUX_S_ISDIR(inode.i_mode); @@ -559,7 +559,7 @@ static void install_image(char *device, char *image_fn, int raw_flag) com_err(program_name, 0, "Raw images cannot be installed"); exit(1); } - + #ifdef CONFIG_TESTIO_DEBUG io_ptr = test_io_manager; test_io_backing_manager = unix_io_manager; @@ -591,7 +591,7 @@ static void install_image(char *device, char *image_fn, int raw_flag) exit(1); } - retval = io_ptr->open(device, IO_FLAG_RW, &io); + retval = io_ptr->open(device, IO_FLAG_RW, &io); if (retval) { com_err(device, 0, "while opening device file"); exit(1); diff --git a/misc/e2initrd_helper.c b/misc/e2initrd_helper.c index 8b8a00c9..df09aa1d 100644 --- a/misc/e2initrd_helper.c +++ b/misc/e2initrd_helper.c @@ -24,7 +24,7 @@ #include <utime.h> #ifdef HAVE_GETOPT_H #include <getopt.h> -#else +#else extern int optind; extern char *optarg; #endif @@ -67,7 +67,7 @@ static void usage(void) exit (1); } -static errcode_t get_file(ext2_filsys fs, const char * filename, +static errcode_t get_file(ext2_filsys fs, const char * filename, struct mem_file *ret_file) { errcode_t retval; @@ -81,7 +81,7 @@ static errcode_t get_file(ext2_filsys fs, const char * filename, ret_file->size = 0; ret_file->ptr = 0; - retval = ext2fs_namei(fs, EXT2_ROOT_INO, EXT2_ROOT_INO, + retval = ext2fs_namei(fs, EXT2_ROOT_INO, EXT2_ROOT_INO, filename, &ino); if (retval) return retval; @@ -103,7 +103,7 @@ static errcode_t get_file(ext2_filsys fs, const char * filename, return retval; retval = ext2fs_file_read(e2_file, buf, inode.i_size, &got); - if (retval) + if (retval) goto errout; retval = ext2fs_file_close(e2_file); @@ -246,7 +246,7 @@ static int parse_fstab_line(char *line, struct fs_info *fs) if (!device) return -1; /* Allow blank lines */ - + if (!mntpnt || !type) return -1; @@ -275,7 +275,7 @@ static int parse_fstab_line(char *line, struct fs_info *fs) if (dev) free(dev); - + return 0; } @@ -311,7 +311,7 @@ static void PRS(int argc, char **argv) break; case 'v': - printf("%s %s (%s)\n", program_name, + printf("%s %s (%s)\n", program_name, E2FSPROGS_VERSION, E2FSPROGS_DATE); break; default: @@ -322,7 +322,7 @@ static void PRS(int argc, char **argv) usage(); device_name = blkid_get_devname(NULL, argv[optind], NULL); if (!device_name) { - com_err("tune2fs", 0, _("Unable to resolve '%s'"), + com_err("tune2fs", 0, _("Unable to resolve '%s'"), argv[optind]); exit(1); } @@ -342,9 +342,9 @@ static void get_root_type(ext2_filsys fs) buf = get_line(&file); if (!buf) continue; - + ret = parse_fstab_line(buf, &fs_info); - if (ret < 0) + if (ret < 0) goto next_line; if (!strcmp(fs_info.mountpt, "/")) @@ -368,7 +368,7 @@ int main (int argc, char ** argv) blkid_get_cache(&cache, NULL); PRS(argc, argv); - + #ifdef CONFIG_TESTIO_DEBUG io_ptr = test_io_manager; test_io_backing_manager = unix_io_manager; @@ -379,7 +379,7 @@ int main (int argc, char ** argv) if (retval) exit(1); - if (root_type) + if (root_type) get_root_type(fs); remove_error_table(&et_ext2_error_table); diff --git a/misc/e2label.c b/misc/e2label.c index cf655135..e96101ae 100644 --- a/misc/e2label.c +++ b/misc/e2label.c @@ -2,7 +2,7 @@ * e2label.c - Print or change the volume label on an ext2 fs * * Written by Andries Brouwer (aeb@cwi.nl), 970714 - * + * * Copyright 1997, 1998 by Theodore Ts'o. * * %Begin-Header% diff --git a/misc/filefrag.c b/misc/filefrag.c index 27675b19..79f8fafe 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -1,6 +1,6 @@ /* * filefrag.c -- report if a particular file is fragmented - * + * * Copyright 2003 by Theodore Ts'o. * * %Begin-Header% @@ -106,16 +106,16 @@ static void frag_report(const char *filename) printf("%s: Not a regular file\n", filename); return; } - if ((fsinfo.f_type == 0xef51) || (fsinfo.f_type == 0xef52) || + if ((fsinfo.f_type == 0xef51) || (fsinfo.f_type == 0xef52) || (fsinfo.f_type == 0xef53)) is_ext2++; if (verbose) { - printf("Filesystem type is: %lx\n", + printf("Filesystem type is: %lx\n", (unsigned long) fsinfo.f_type); } cylgroups = div_ceil(fsinfo.f_blocks, fsinfo.f_bsize*8); if (verbose) { - printf("Filesystem cylinder groups is approximately %ld\n", + printf("Filesystem cylinder groups is approximately %ld\n", cylgroups); } #ifdef HAVE_OPEN64 @@ -143,7 +143,7 @@ static void frag_report(const char *filename) bpib = bs / 4; numblocks = (fileinfo.st_size + (bs-1)) / bs; if (verbose) { - printf("File size of %s is %lld (%ld blocks)\n", filename, + printf("File size of %s is %lld (%ld blocks)\n", filename, (long long) fileinfo.st_size, numblocks); printf("First block: %lu\nLast block: %lu\n", get_bmap(fd, 0), get_bmap(fd, numblocks - 1)); diff --git a/misc/findsuper.c b/misc/findsuper.c index 5eade889..fbc28a37 100644 --- a/misc/findsuper.c +++ b/misc/findsuper.c @@ -6,7 +6,7 @@ * using gpart program. * * Portions Copyright 1998-2000, Theodore Ts'o. - * + * * Well, here's my linux version of findsuper. * I'm sure you coulda done it faster. :) * IMHO there isn't as much interesting data to print in the @@ -18,7 +18,7 @@ * * I wanted to add msdos support, but I couldn't make heads or tails * of the kernel include files to find anything I could look for in msdos. - * + * * Reading every block of a Sun partition is fairly quick. Doing the * same under linux (slower hardware I suppose) just isn't the same. * It might be more useful to default to reading the first (second?) block @@ -59,26 +59,26 @@ /* * Documentation addendum added by Andreas dwguest@win.tue.nl/aeb@cwi.nl - * + * * The program findsuper is a utility that scans a disk and finds * copies of ext2 superblocks (by checking for the ext2 signature). - * + * * For each superblock found, it prints the offset in bytes, the * offset in 1024-byte blocks, the size of the ext2 partition in fs * blocks, the filesystem blocksize (in bytes), the block group number * (always 0 for older ext2 systems), and a timestamp (s_mtime). - * + * * This program can be used to retrieve partitions that have been * lost. The superblock for block group 0 is found 1 block (2 * sectors) after the partition start. - * + * * For new systems that have a block group number in the superblock it * is immediately clear which superblock is the first of a partition. * For old systems where no group numbers are given, the first * superblock can be recognised by the timestamp: all superblock * copies have the creation time in s_mtime, except the first, which * has the last time e2fsck or tune2fs wrote to the filesystem. - * + * */ #define _FILE_OFFSET_BITS 64 @@ -102,9 +102,9 @@ #define WHY(fmt, arg...) { continue; } #endif -static void usage(void) +static void usage(void) { - fprintf(stderr, + fprintf(stderr, _("Usage: findsuper device [skipbytes [startkb]]\n")); exit(1); } @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) fprintf(stderr, _("startkb should be positive, not %Lu\n"), sk); exit(1); } - + fd = open(device_name, O_RDONLY); if (fd < 0) { perror(device_name); diff --git a/misc/fsck.c b/misc/fsck.c index 28c8d6c4..ea8f0e2d 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -7,7 +7,7 @@ * parallel execution. * * Written by Theodore Ts'o, <tytso@mit.edu> - * + * * Miquel van Smoorenburg (miquels@drinkel.ow.org) 20-Oct-1994: * o Changed -t fstype to behave like with mount when -A (all file * systems) or -M (like mount) is specified. @@ -16,7 +16,7 @@ * can be added without changing this front-end. * o -R flag skip root file system. * - * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. * * %Begin-Header% @@ -244,7 +244,7 @@ static void free_instance(struct fsck_instance *i) } static struct fs_info *create_fs_device(const char *device, const char *mntpnt, - const char *type, const char *opts, + const char *type, const char *opts, int freq, int passno) { struct fs_info *fs; @@ -312,7 +312,7 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) passno ? atoi(passno) : -1); if (dev) free(dev); - + if (!fs) return -1; *ret_fs = fs; @@ -322,7 +322,7 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) static void interpret_type(struct fs_info *fs) { char *t; - + if (strcmp(fs->type, "auto") != 0) return; t = blkid_get_tag_value(cache, "TYPE", fs->device); @@ -365,21 +365,21 @@ static void load_fs_info(const char *filename) else old_fstab = 0; } - + fclose(f); - + if (old_fstab && filesys_info) { fputs(_("\007\007\007" "WARNING: Your /etc/fstab does not contain the fsck passno\n" " field. I will kludge around things for you, but you\n" " should fix your /etc/fstab file as soon as you can.\n\n"), stderr); - + for (fs = filesys_info; fs; fs = fs->next) { fs->passno = 1; } } } - + /* Lookup filesys in /etc/fstab and return the corresponding entry. */ static struct fs_info *lookup(char *filesys) { @@ -451,7 +451,7 @@ static int execute(const char *type, const char *device, const char *mntpt, sprintf(prog, "fsck.%s", type); argv[0] = string_copy(prog); argc = 1; - + for (i=0; i <num_args; i++) argv[argc++] = string_copy(args[i]); @@ -490,7 +490,7 @@ static int execute(const char *type, const char *device, const char *mntpt, printf("%s ", argv[i]); printf("\n"); } - + /* Fork and execute the correct program. */ if (noexecute) pid = -1; @@ -509,7 +509,7 @@ static int execute(const char *type, const char *device, const char *mntpt, for (i=0; i < argc; i++) free(argv[i]); - + inst->pid = pid; inst->prog = string_copy(prog); inst->type = string_copy(type); @@ -527,7 +527,7 @@ static int execute(const char *type, const char *device, const char *mntpt, p->next = inst; else instance_list = inst; - + return 0; } @@ -580,7 +580,7 @@ static struct fsck_instance *wait_one(int flags) * (inst and prev are thought to be uninitialized variables) */ inst = prev = NULL; - + do { pid = waitpid(-1, &status, flags); if (cancel_requested && !kill_sent) { @@ -609,7 +609,7 @@ static struct fsck_instance *wait_one(int flags) } } while (!inst); - if (WIFEXITED(status)) + if (WIFEXITED(status)) status = WEXITSTATUS(status); else if (WIFSIGNALED(status)) { sig = WTERMSIG(status); @@ -694,11 +694,11 @@ static int wait_many(int flags) /* * Run the fsck program on a particular device - * + * * If the type is specified using -t, and it isn't prefixed with "no" * (as in "noext2") and only one filesystem type is specified, then * use that type regardless of what is specified in /etc/fstab. - * + * * If the type isn't specified by the user, then use either the type * specified in /etc/fstab, or DEFAULT_FSTYPE. */ @@ -712,7 +712,7 @@ static void fsck_device(struct fs_info *fs, int interactive) if (strcmp(fs->type, "auto") != 0) type = fs->type; else if (fstype && strncmp(fstype, "no", 2) && - strncmp(fstype, "opts=", 5) && strncmp(fstype, "loop", 4) && + strncmp(fstype, "opts=", 5) && strncmp(fstype, "loop", 4) && !strchr(fstype, ',')) type = fstype; else @@ -761,7 +761,7 @@ static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) cmp->list = malloc(num * sizeof(char *)); cmp->type = malloc(num * sizeof(int)); if (!cmp->list || !cmp->type) { - fputs(_("Couldn't allocate memory for filesystem types\n"), + fputs(_("Couldn't allocate memory for filesystem types\n"), stderr); exit(EXIT_ERROR); } @@ -771,7 +771,7 @@ static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) if (!fs_type) return; - + list = string_copy(fs_type); num = 0; s = strtok(list, ","); @@ -822,7 +822,7 @@ static int opt_in_list(const char *opt, char *optlist) if (!optlist) return 0; list = string_copy(optlist); - + s = strtok(list, ","); while(s) { if (strcmp(s, opt) == 0) { @@ -896,7 +896,7 @@ static int ignore(struct fs_info *fs) * ignore it. */ if (!fs_match(fs, &fs_type_compiled)) return 1; - + /* Are we ignoring this type? */ for(ip = ignored_types; *ip; ip++) if (strcmp(fs->type, *ip) == 0) return 1; @@ -945,7 +945,7 @@ static int device_already_active(char *device) * If we don't know the base device, assume that the device is * already active if there are any fsck instances running. */ - if (!base) + if (!base) return (instance_list != 0); for (inst = instance_list; inst; inst = inst->next) { if (!inst->base_device || !strcmp(base, inst->base_device)) { @@ -978,7 +978,7 @@ static int check_all(NOARGS) if (ignore(fs)) fs->flags |= FLAG_DONE; } - + /* * Find and check the root filesystem. */ @@ -1062,7 +1062,7 @@ static int check_all(NOARGS) status |= wait_many(pass_done ? FLAG_WAIT_ALL : FLAG_WAIT_ATLEAST_ONE); if (pass_done) { - if (verbose > 1) + if (verbose > 1) printf("----------------------------------\n"); passno++; } else @@ -1107,7 +1107,7 @@ static void PRS(int argc, char *argv[]) sigaction(SIGINT, &sa, 0); sigaction(SIGTERM, &sa, 0); #endif - + num_devices = 0; num_args = 0; instance_list = 0; @@ -1177,7 +1177,7 @@ static void PRS(int argc, char *argv[]) progress_fd = 0; else goto next_arg; - } else if ((i+1) < argc && + } else if ((i+1) < argc && !strncmp(argv[i+1], "-", 1) == 0) { progress_fd = string_to_int(argv[i]); if (progress_fd < 0) @@ -1295,7 +1295,7 @@ int main(int argc, char *argv[]) } else { fsck_path = string_copy(fsck_prefix_path); } - + if ((num_devices == 1) || (serialize)) interactive = 1; @@ -1335,7 +1335,7 @@ int main(int argc, char *argv[]) status |= inst->exit_status; free_instance(inst); } - if (verbose > 1) + if (verbose > 1) printf("----------------------------------\n"); } } diff --git a/misc/logsave.c b/misc/logsave.c index aa3235ee..f0011f81 100644 --- a/misc/logsave.c +++ b/misc/logsave.c @@ -52,10 +52,10 @@ static void usage(char *progname) static void send_output(const char *buffer, int c, int flag) { char *n; - + if (c == 0) c = strlen(buffer); - + if (flag & SEND_CONSOLE) write(1, buffer, c); if (!(flag & SEND_LOG)) @@ -147,7 +147,7 @@ static int run_program(char **argv) dup2(fds[1],1); /* fds[1] replaces stdout */ dup2(fds[1],2); /* fds[1] replaces stderr */ close(fds[0]); /* don't need this here */ - + execvp(argv[0], argv); perror(argv[0]); exit(1); @@ -201,8 +201,8 @@ static int copy_from_stdin(void) bad_read = 0; } return 0; -} - +} + int main(int argc, char **argv) @@ -213,7 +213,7 @@ int main(int argc, char **argv) int send_flag = SEND_LOG; int do_stdin; time_t t; - + while ((c = getopt(argc, argv, "+asv")) != EOF) { switch (c) { case 'a': @@ -238,7 +238,7 @@ int main(int argc, char **argv) outfd = open(outfn, openflags, 0644); do_stdin = !strcmp(argv[0], "-"); - + send_output("Log of ", 0, send_flag); if (do_stdin) send_output("stdin", 0, send_flag); @@ -257,7 +257,7 @@ int main(int argc, char **argv) rc = copy_from_stdin(); else rc = run_program(argv); - + send_output("\n", 0, send_flag); t = time(0); send_output(ctime(&t), 0, send_flag); @@ -279,11 +279,11 @@ int main(int argc, char **argv) while (outfd < 0) { outfd = open(outfn, openflags, 0644); sleep(1); - } + } write(outfd, outbuf, outbufsize); free(outbuf); } close(outfd); - + exit(rc); } diff --git a/misc/lsattr.c b/misc/lsattr.c index 093f50f4..254ebb4a 100644 --- a/misc/lsattr.c +++ b/misc/lsattr.c @@ -120,7 +120,7 @@ static void lsattr_args (const char * name) } } -static int lsattr_dir_proc (const char * dir_name, struct dirent * de, +static int lsattr_dir_proc (const char * dir_name, struct dirent * de, void * private EXT2FS_ATTR((unused))) { STRUCT_STAT st; diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 9cba3b5d..c1850a4d 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1,6 +1,6 @@ /* * mke2fs.c - Make a ext2fs filesystem. - * + * * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, * 2003, 2004, 2005 by Theodore Ts'o. * @@ -11,9 +11,9 @@ */ /* Usage: mke2fs [options] device - * + * * The device may be a block device or a image of one, but this isn't - * enforced (but it's not much fun on a character device :-). + * enforced (but it's not much fun on a character device :-). */ #define _XOPEN_SOURCE 600 /* for inclusion of PATH_MAX in Solaris */ @@ -232,7 +232,7 @@ static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list) if (!bb_list) return; - + /* * The primary superblock and group descriptors *must* be * good; if not, abort. @@ -257,13 +257,13 @@ static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list) */ group_block = fs->super->s_first_data_block + fs->super->s_blocks_per_group; - + for (i = 1; i < fs->group_desc_count; i++) { group_bad = 0; for (j=0; j < fs->desc_blocks+1; j++) { if (ext2fs_badblocks_list_test(bb_list, group_block + j)) { - if (!group_bad) + if (!group_bad) fprintf(stderr, _("Warning: the backup superblock/group descriptors at block %u contain\n" " bad blocks.\n\n"), @@ -277,7 +277,7 @@ _("Warning: the backup superblock/group descriptors at block %u contain\n" } group_block += fs->super->s_blocks_per_group; } - + /* * Mark all the bad blocks as used... */ @@ -287,7 +287,7 @@ _("Warning: the backup superblock/group descriptors at block %u contain\n" _("while marking bad blocks as used")); exit(1); } - while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) + while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) ext2fs_mark_block_bitmap(fs->block_map, blk); ext2fs_badblocks_list_iterate_end(bb_iter); } @@ -361,7 +361,7 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag) for (i = 0; i < fs->group_desc_count; i++) { progress_update(&progress, i); - + blk = fs->group_desc[i].bg_inode_table; num = fs->inode_blocks_per_group; @@ -452,7 +452,7 @@ static void create_lost_and_found(ext2_filsys fs) _("while looking up /lost+found")); exit(1); } - + for (i=1; i < EXT2_NDIR_BLOCKS; i++) { /* Ensure that lost+found is at least 2 blocks, so we always * test large empty blocks for big-block filesystems. */ @@ -471,7 +471,7 @@ static void create_lost_and_found(ext2_filsys fs) static void create_bad_block_inode(ext2_filsys fs, badblocks_list bb_list) { errcode_t retval; - + ext2fs_mark_inode_bitmap(fs->inode_map, EXT2_BAD_INO); ext2fs_inode_alloc_stats2(fs, EXT2_BAD_INO, +1, 0); retval = ext2fs_update_bb_inode(fs, bb_list); @@ -595,7 +595,7 @@ static void show_stats(ext2_filsys fs) blk_t group_block; dgrp_t i; int need, col_left; - + if (fs_param.s_blocks_count != s->s_blocks_count) fprintf(stderr, _("warning: %u blocks unused.\n\n"), fs_param.s_blocks_count - s->s_blocks_count); @@ -678,7 +678,7 @@ static int set_os(struct ext2_super_block *sb, char *os) #define PATH_SET "PATH=/sbin" -static void parse_extended_opts(struct ext2_super_block *param, +static void parse_extended_opts(struct ext2_super_block *param, const char *opts) { char *buf, *token, *next, *p, *arg, *badopt = 0; @@ -746,18 +746,18 @@ static void parse_extended_opts(struct ext2_super_block *param, continue; } - resize = parse_num_blocks(arg, + resize = parse_num_blocks(arg, param->s_log_block_size); if (resize == 0) { - fprintf(stderr, + fprintf(stderr, _("Invalid resize parameter: %s\n"), arg); r_usage++; continue; } if (resize <= param->s_blocks_count) { - fprintf(stderr, + fprintf(stderr, _("The resize maximum must be greater " "than the filesystem size.\n")); r_usage++; @@ -769,19 +769,19 @@ static void parse_extended_opts(struct ext2_super_block *param, if (!bpg) bpg = blocksize * 8; gdpb = EXT2_DESC_PER_BLOCK(param); - group_desc_count = + group_desc_count = ext2fs_div_ceil(param->s_blocks_count, bpg); desc_blocks = (group_desc_count + gdpb - 1) / gdpb; rsv_groups = ext2fs_div_ceil(resize, bpg); - rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) - + rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) - desc_blocks; if (rsv_gdb > (int) EXT2_ADDR_PER_BLOCK(param)) rsv_gdb = EXT2_ADDR_PER_BLOCK(param); if (rsv_gdb > 0) { if (param->s_rev_level == EXT2_GOOD_OLD_REV) { - fprintf(stderr, + fprintf(stderr, _("On-line resizing not supported with revision 0 filesystems\n")); free(buf); exit(1); @@ -825,7 +825,7 @@ static void parse_extended_opts(struct ext2_super_block *param, param->s_raid_stripe_width, param->s_raid_stride); free(buf); -} +} static __u32 ok_features[3] = { /* Compat */ @@ -851,7 +851,7 @@ static __u32 ok_features[3] = { static void syntax_err_report(const char *filename, long err, int line_num) { - fprintf(stderr, + fprintf(stderr, _("Syntax error in mke2fs config file (%s, line #%d)\n\t%s\n"), filename, line_num, error_message(err)); exit(1); @@ -859,13 +859,13 @@ static void syntax_err_report(const char *filename, long err, int line_num) static const char *config_fn[] = { ROOT_SYSCONFDIR "/mke2fs.conf", 0 }; -static void edit_feature(const char *str, __u32 *compat_array) +static void edit_feature(const char *str, __u32 *compat_array) { if (!str) return; if (e2p_edit_feature(str, compat_array, ok_features)) { - fprintf(stderr, _("Invalid filesystem option set: %s\n"), + fprintf(stderr, _("Invalid filesystem option set: %s\n"), str); exit(1); } @@ -1135,7 +1135,7 @@ static void PRS(int argc, char *argv[]) profile_init(default_files, &profile); profile_set_default(profile, mke2fs_default_profile); } - + setbuf(stdout, NULL); setbuf(stderr, NULL); add_error_table(&et_ext2_error_table); @@ -1177,7 +1177,7 @@ static void PRS(int argc, char *argv[]) fprintf(stderr, _("Warning: blocksize %d not " "usable on most systems.\n"), blocksize); - if (blocksize > 0) + if (blocksize > 0) fs_param.s_log_block_size = int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE); @@ -1341,11 +1341,11 @@ static void PRS(int argc, char *argv[]) device_name = argv[optind++]; if (!quiet || show_version_only) - fprintf (stderr, "mke2fs %s (%s)\n", E2FSPROGS_VERSION, + fprintf (stderr, "mke2fs %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE); if (show_version_only) { - fprintf(stderr, _("\tUsing %s\n"), + fprintf(stderr, _("\tUsing %s\n"), error_message(EXT2_ET_BASE)); exit(0); } @@ -1399,7 +1399,7 @@ static void PRS(int argc, char *argv[]) blocksize, sys_page_size); } if (optind < argc) { - fs_param.s_blocks_count = parse_num_blocks(argv[optind++], + fs_param.s_blocks_count = parse_num_blocks(argv[optind++], fs_param.s_log_block_size); if (!fs_param.s_blocks_count) { com_err(program_name, 0, _("invalid blocks count - %s"), @@ -1425,14 +1425,14 @@ static void PRS(int argc, char *argv[]) EXT2_BLOCK_SIZE(&fs_param), &dev_size); if ((retval == EFBIG) && - (blocksize == 0) && + (blocksize == 0) && (fs_param.s_log_block_size == 0)) { fs_param.s_log_block_size = 2; blocksize = 4096; goto retry; } } - + if (retval == EFBIG) { fprintf(stderr, _("%s: Size of device %s too big " "to be expressed in 32 bits\n\t" @@ -1470,7 +1470,7 @@ static void PRS(int argc, char *argv[]) fs_param.s_blocks_count &= ~((sys_page_size / EXT2_BLOCK_SIZE(&fs_param))-1); } - + } else if (!force && (fs_param.s_blocks_count > dev_size)) { com_err(program_name, 0, _("Filesystem larger than apparent device size.")); @@ -1519,7 +1519,7 @@ static void PRS(int argc, char *argv[]) print_str_list(fs_types); } - if (r_opt == EXT2_GOOD_OLD_REV && + if (r_opt == EXT2_GOOD_OLD_REV && (fs_param.s_feature_compat || fs_param.s_feature_incompat || fs_param.s_feature_ro_compat)) { fprintf(stderr, _("Filesystem features not supported " @@ -1545,11 +1545,11 @@ static void PRS(int argc, char *argv[]) "with revision 0 filesystems\n")); exit(1); } - fs_param.s_feature_compat |= + fs_param.s_feature_compat |= EXT3_FEATURE_COMPAT_HAS_JOURNAL; } - if (fs_param.s_feature_incompat & + if (fs_param.s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) { reserved_ratio = 0; fs_param.s_feature_incompat = EXT3_FEATURE_INCOMPAT_JOURNAL_DEV; @@ -1582,7 +1582,7 @@ static void PRS(int argc, char *argv[]) if ((tmp = getenv("MKE2FS_DEVICE_SECTSIZE")) != NULL) sector_size = atoi(tmp); - + if (blocksize <= 0) { use_bsize = get_int_from_profile(fs_types, "blocksize", 4096); @@ -1612,9 +1612,9 @@ static void PRS(int argc, char *argv[]) blocksize = EXT2_BLOCK_SIZE(&fs_param); - lazy_itable_init = get_bool_from_profile(fs_types, + lazy_itable_init = get_bool_from_profile(fs_types, "lazy_itable_init", 0); - + /* Get options from profile */ for (cpp = fs_types; *cpp; cpp++) { tmp = NULL; @@ -1696,13 +1696,13 @@ static void PRS(int argc, char *argv[]) /* * Calculate number of inodes based on the inode ratio */ - fs_param.s_inodes_count = num_inodes ? num_inodes : + fs_param.s_inodes_count = num_inodes ? num_inodes : ((__u64) fs_param.s_blocks_count * blocksize) / inode_ratio; if ((((long long)fs_param.s_inodes_count) * (inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE)) >= - (((long long)fs_param.s_blocks_count) * + (((long long)fs_param.s_blocks_count) * EXT2_BLOCK_SIZE(&fs_param))) { com_err(program_name, 0, _("inode_size (%u) * inodes_count " "(%u) too big for a\n\t" @@ -1710,7 +1710,7 @@ static void PRS(int argc, char *argv[]) "specify higher inode_ratio (-i)\n\t" "or lower inode count (-N).\n"), inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE, - fs_param.s_inodes_count, + fs_param.s_inodes_count, (unsigned long) fs_param.s_blocks_count); exit(1); } @@ -1927,7 +1927,7 @@ int main (int argc, char *argv[]) strncpy(fs->super->s_last_mounted, mount_dir, sizeof(fs->super->s_last_mounted)); } - + if (!quiet || noaction) show_stats(fs); @@ -1989,7 +1989,7 @@ int main (int argc, char *argv[]) create_lost_and_found(fs); reserve_inodes(fs); create_bad_block_inode(fs, bb_list); - if (fs->super->s_feature_compat & + if (fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE) { retval = ext2fs_create_resize_inode(fs); if (retval) { @@ -2002,9 +2002,9 @@ int main (int argc, char *argv[]) if (journal_device) { ext2_filsys jfs; - + if (!force) - check_plausibility(journal_device); + check_plausibility(journal_device); check_mount(journal_device, force, _("journal")); retval = ext2fs_open(journal_device, EXT2_FLAG_RW| @@ -2017,14 +2017,14 @@ int main (int argc, char *argv[]) exit(1); } if (!quiet) { - printf(_("Adding journal to device %s: "), + printf(_("Adding journal to device %s: "), journal_device); fflush(stdout); } retval = ext2fs_add_journal_device(fs, jfs); if(retval) { - com_err (program_name, retval, - _("\n\twhile trying to add journal to device %s"), + com_err (program_name, retval, + _("\n\twhile trying to add journal to device %s"), journal_device); exit(1); } @@ -2033,7 +2033,7 @@ int main (int argc, char *argv[]) ext2fs_close(jfs); free(journal_device); } else if ((journal_size) || - (fs_param.s_feature_compat & + (fs_param.s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { journal_blocks = figure_journal_size(journal_size, fs); diff --git a/misc/mklost+found.c b/misc/mklost+found.c index a0e71f00..8d5fa7be 100644 --- a/misc/mklost+found.c +++ b/misc/mklost+found.c @@ -53,7 +53,7 @@ int main (int argc, char ** argv) perror ("mkdir"); exit(1); } - + i = 0; memset (name, 'x', 246); do { diff --git a/misc/partinfo.c b/misc/partinfo.c index 149a193b..48b395f6 100644 --- a/misc/partinfo.c +++ b/misc/partinfo.c @@ -4,7 +4,7 @@ * Originally written by Alain Knaff, <alknaff@innet.lu>. * * Cleaned up by Theodore Ts'o, <tytso@mit.edu>. - * + * */ #include <sys/types.h> @@ -41,7 +41,7 @@ int main(int argc, char **argv) "For example: %s /dev/hda\n\n"), argv[0], argv[0]); exit(1); } - + for (i=1; i < argc; i++) { fd = open(argv[i], O_RDONLY); @@ -50,24 +50,24 @@ int main(int argc, char **argv) argv[i], strerror(errno)); continue; } - + if (ioctl(fd, HDIO_GETGEO, &loc) < 0) { fprintf(stderr, _("Cannot get geometry of %s: %s"), argv[i], strerror(errno)); close(fd); continue; } - - + + if (ioctl(fd, BLKGETSIZE, &size) < 0) { fprintf(stderr, _("Cannot get size of %s: %s"), argv[i], strerror(errno)); close(fd); continue; } - + printf(_("%s: h=%3d s=%3d c=%4d start=%8d size=%8lu end=%8d\n"), - argv[i], + argv[i], loc.heads, (int)loc.sectors, loc.cylinders, (int)loc.start, size, (int) loc.start + size -1); close(fd); diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 50b033d5..a1fa57b7 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -213,7 +213,7 @@ static void remove_journal_device(ext2_filsys fs) break; } if (i >= nr_users) { - fputs(_("Filesystem's UUID not found on journal device.\n"), + fputs(_("Filesystem's UUID not found on journal device.\n"), stderr); commit_remove_journal = 1; goto no_valid_journal; @@ -246,7 +246,7 @@ no_valid_journal: /* Helper function for remove_journal_inode */ static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, - int blockcnt EXT2FS_ATTR((unused)), + int blockcnt EXT2FS_ATTR((unused)), void *private EXT2FS_ATTR((unused))) { blk_t block; @@ -269,7 +269,7 @@ static void remove_journal_inode(ext2_filsys fs) struct ext2_inode inode; errcode_t retval; ino_t ino = fs->super->s_journal_inum; - + retval = ext2fs_read_inode(fs, ino, &inode); if (retval) { com_err(program_name, retval, @@ -542,7 +542,7 @@ static void parse_e2label_options(int argc, char ** argv) *io_options++ = 0; device_name = blkid_get_devname(NULL, argv[1], NULL); if (!device_name) { - com_err("e2label", 0, _("Unable to resolve '%s'"), + com_err("e2label", 0, _("Unable to resolve '%s'"), argv[1]); exit(1); } @@ -551,7 +551,7 @@ static void parse_e2label_options(int argc, char ** argv) open_flag |= EXT2_FLAG_RW; L_flag = 1; new_label = argv[2]; - } else + } else print_label++; } @@ -740,7 +740,7 @@ static void parse_tune2fs_options(int argc, char **argv) mntopts_cmd = optarg; open_flag = EXT2_FLAG_RW; break; - + case 'O': if (features_cmd) { com_err (program_name, 0, @@ -827,7 +827,7 @@ static void parse_tune2fs_options(int argc, char **argv) *io_options++ = 0; device_name = blkid_get_devname(NULL, argv[optind], NULL); if (!device_name) { - com_err("tune2fs", 0, _("Unable to resolve '%s'"), + com_err("tune2fs", 0, _("Unable to resolve '%s'"), argv[optind]); exit(1); } @@ -844,7 +844,7 @@ void do_findfs(int argc, char **argv) } dev = blkid_get_devname(NULL, argv[1], NULL); if (!dev) { - com_err("findfs", 0, _("Unable to resolve '%s'"), + com_err("findfs", 0, _("Unable to resolve '%s'"), argv[1]); exit(1); } @@ -915,7 +915,7 @@ static void parse_extended_opts(ext2_filsys fs, const char *opts) continue; } stripe_width_set = 1; - } else + } else r_usage++; } if (r_usage) { @@ -932,7 +932,7 @@ static void parse_extended_opts(ext2_filsys fs, const char *opts) exit(1); } free(buf); -} +} static int get_move_bitmap(ext2_filsys fs, int new_ino_blks_per_grp, ext2fs_block_bitmap bmap) @@ -1414,7 +1414,7 @@ int main (int argc, char ** argv) parse_e2label_options(argc, argv); else parse_tune2fs_options(argc, argv); - + #ifdef CONFIG_TESTIO_DEBUG io_ptr = test_io_manager; test_io_backing_manager = unix_io_manager; @@ -1423,7 +1423,7 @@ int main (int argc, char ** argv) #endif retry_open: - retval = ext2fs_open2(device_name, io_options, open_flag, + retval = ext2fs_open2(device_name, io_options, open_flag, 0, 0, io_ptr, &fs); if (retval) { com_err (program_name, retval, _("while trying to open %s"), @@ -1562,7 +1562,7 @@ retry_open: } if (L_flag) { if (strlen(new_label) > sizeof(sb->s_volume_name)) - fputs(_("Warning: label too long, truncating.\n"), + fputs(_("Warning: label too long, truncating.\n"), stderr); memset(sb->s_volume_name, 0, sizeof(sb->s_volume_name)); strncpy(sb->s_volume_name, new_label, @@ -1583,7 +1583,7 @@ retry_open: parse_extended_opts(fs, extended_cmd); if (journal_size || journal_device) add_journal(fs); - + if (U_flag) { if ((strcasecmp(new_UUID, "null") == 0) || (strcasecmp(new_UUID, "clear") == 0)) { diff --git a/misc/util.c b/misc/util.c index 8185d207..837d60fc 100644 --- a/misc/util.c +++ b/misc/util.c @@ -1,6 +1,6 @@ /* * util.c --- helper functions used by tune2fs and mke2fs - * + * * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. * * %Begin-Header% @@ -81,14 +81,14 @@ void check_plausibility(const char *device) int val; #ifdef HAVE_OPEN64 struct stat64 s; - + val = stat64(device, &s); #else struct stat s; - + val = stat(device, &s); #endif - + if(val == -1) { fprintf(stderr, _("Could not stat %s --- %s\n"), device, error_message(errno)); @@ -194,7 +194,7 @@ void parse_journal_opts(const char *opts) if (p) { *p = 0; next = p+1; - } + } arg = strchr(token, '='); if (arg) { *arg = 0; @@ -238,13 +238,13 @@ void parse_journal_opts(const char *opts) exit(1); } free(buf); -} +} /* * Determine the number of journal blocks to use, either via * user-specified # of megabytes, or via some intelligently selected * defaults. - * + * * Find a reasonable journal file size (in blocks) given the number of blocks * in the filesystem. For very small filesystems, it is not reasonable to * have a journal that fills more than half of the filesystem. @@ -258,7 +258,7 @@ unsigned int figure_journal_size(int size, ext2_filsys fs) fputs(_("\nFilesystem too small for a journal\n"), stderr); return 0; } - + if (size > 0) { j_blocks = size * 1024 / (fs->blocksize / 1024); if (j_blocks < 1024 || j_blocks > 10240000) { diff --git a/misc/util.h b/misc/util.h index 0df2aacf..e0c99f6c 100644 --- a/misc/util.h +++ b/misc/util.h @@ -1,7 +1,7 @@ /* * util.h --- header file defining prototypes for helper functions * used by tune2fs and mke2fs - * + * * Copyright 2000 by Theodore Ts'o. * * %Begin-Header% diff --git a/misc/uuidd.c b/misc/uuidd.c index 1af8c863..3a855bcf 100644 --- a/misc/uuidd.c +++ b/misc/uuidd.c @@ -477,7 +477,7 @@ int main(int argc, char **argv) if (setregid(gid, gid) < 0) die("setregid"); #endif - + #ifdef HAVE_SETRESUID if (setresuid(uid, uid, uid) < 0) die("setresuid"); diff --git a/misc/uuidgen.c b/misc/uuidgen.c index 5e7eef3e..7385a5c4 100644 --- a/misc/uuidgen.c +++ b/misc/uuidgen.c @@ -58,7 +58,7 @@ main (int argc, char *argv[]) default: usage(argv[0]); } - + switch (do_type) { case DO_TYPE_TIME: uuid_generate_time(uu); @@ -70,7 +70,7 @@ main (int argc, char *argv[]) uuid_generate(uu); break; } - + uuid_unparse(uu, str); printf("%s\n", str); |