Whamcloud - gitweb
Many files:
authorTheodore Ts'o <tytso@mit.edu>
Mon, 3 Nov 1997 19:46:49 +0000 (19:46 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 3 Nov 1997 19:46:49 +0000 (19:46 +0000)
  resize2fs.c, ext2_block_move.c ext2_inode_move.c: Only include printf
   statements if RESIZE2FS_DEBUG is defined.
  main.c: Don't read in the bitmaps since resize2fs.c does that.
e2label.c, mke2fs.c:
  Adjust header files.

misc/e2label.c
misc/mke2fs.c
resize/ChangeLog
resize/Makefile.pq
resize/ext2_block_move.c
resize/ext2_inode_move.c
resize/main.c
resize/resize2fs.c

index 2b4f171..928a896 100644 (file)
@@ -5,8 +5,24 @@
  *
  */
 
-#include <fcntl.h>
 #include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <termios.h>
+#include <time.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 
 #define EXT2_SUPER_MAGIC 0xEF53
 
index 81a0262..47dfc42 100644 (file)
 #ifdef HAVE_MNTENT_H
 #include <mntent.h>
 #endif
-#include <malloc.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <stdio.h>
 
 #ifdef HAVE_LINUX_FS_H
 #include <linux/fs.h>
index bb559ee..3a957f9 100644 (file)
@@ -1,3 +1,10 @@
+Mon Nov  3 14:45:06 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * resize2fs.c, ext2_block_move.c ext2_inode_move.c: Only include
+               printf statements if RESIZE2FS_DEBUG is defined.
+
+       * main.c: Don't read in the bitmaps since resize2fs.c does that.
+
 Sun Oct 19 20:40:42 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * resize2fs.h: Add #ifdef's for HAVE_SYS_TYPES_H and HAVE_SYS_TIME_H.
index c383c87..5421c6d 100644 (file)
@@ -5,8 +5,7 @@ OBJFILE=RESIZE.LST
 OBJS= extent.obj \
        ext2_block_move.obj \
        ext2_inode_move.obj \
-       resize2fs.obj \
-       sim_progress.obj
+       resize2fs.obj
 
 ALL:: $(OBJS)
 
index ec60edf..3170e95 100644 (file)
@@ -34,9 +34,11 @@ static int process_block(ext2_filsys fs, blk_t       *block_nr,
        if (new) {
                *block_nr = new;
                ret |= BLOCK_CHANGED;
+#ifdef RESIZE2FS_DEBUG
                if (pb->flags & RESIZE_DEBUG_BMOVE)
                        printf("ino=%ld, blockcnt=%d, %u->%u\n", pb->ino,
                               blockcnt, block, new);
+#endif
        }
 
        if (pb->is_dir) {
@@ -125,9 +127,11 @@ errcode_t ext2fs_block_move(ext2_resize_t rfs)
                if (retval) goto errout;
                if (!size)
                        break;
+#ifdef RESIZE2FS_DEBUG
                if (rfs->flags & RESIZE_DEBUG_BMOVE)
                        printf("Moving %d blocks %u->%u\n", size,
                               old, new);
+#endif
                do {
                        c = size;
                        if (c > fs->inode_blocks_per_group)
index 5d26b15..3ec74b8 100644 (file)
@@ -56,10 +56,12 @@ static int check_and_change_inodes(ino_t dir, int entry,
 
        if (!new)
                return 0;
+#ifdef RESIZE2FS_DEBUG
        if (is->flags & RESIZE_DEBUG_INODEMAP)
                printf("Inode translate (dir=%ld, name=%.*s, %u->%ld)\n",
                       dir, dirent->name_len, dirent->name,
                       dirent->inode, new);
+#endif
 
        dirent->inode = new;
 
@@ -251,8 +253,10 @@ errcode_t ext2fs_inode_move(ext2_resize_t rfs)
                if (LINUX_S_ISDIR(inode.i_mode))
                        rfs->new_fs->group_desc[group].bg_used_dirs_count++;
                
+#ifdef RESIZE2FS_DEBUG
                if (rfs->flags & RESIZE_DEBUG_INODEMAP)
                        printf("Inode moved %ld->%ld\n", ino, new);
+#endif
 
                ext2fs_add_extent_entry(imap, ino, new);
        }
index b5e5a7f..7765052 100644 (file)
@@ -104,13 +104,6 @@ void main (int argc, char ** argv)
                printf ("Couldn't find valid filesystem superblock.\n");
                exit (1);
        }
-       retval = ext2fs_read_bitmaps(fs);
-       if (retval) {
-               com_err (program_name, retval,
-                        "while trying to read the bitmaps", device_name);
-               ext2fs_close (fs);
-               exit (1);
-       }
        retval = resize_fs(fs, new_size, flags);
        if (retval) {
                com_err(program_name, retval, "while trying to resize %s",
index 66e0b20..1345708 100644 (file)
@@ -574,10 +574,12 @@ static errcode_t move_itables(ext2_resize_t rfs)
                new = fs->group_desc[i].bg_inode_table;
                diff = new - old;
                
+#ifdef RESIZE2FS_DEBUG
                if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE) 
                        printf("Itable move group %d block "
                               "%u->%u (diff %d)\n", 
                               i, old, new, diff);
+#endif
                
                if (!diff)
                        continue;
@@ -596,8 +598,10 @@ static errcode_t move_itables(ext2_resize_t rfs)
                        if (*cp)
                                break;
                n = n >> EXT2_BLOCK_SIZE_BITS(fs->super);
+#ifdef RESIZE2FS_DEBUG
                if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE) 
                        printf("%d blocks of zeros...\n", n);
+#endif
                num = fs->inode_blocks_per_group;
                if (n > diff)
                        num -= n;
@@ -622,8 +626,10 @@ static errcode_t move_itables(ext2_resize_t rfs)
        }
        ext2fs_flush(rfs->new_fs);
        io_channel_flush(fs->io);
+#ifdef RESIZE2FS_DEBUG
        if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE) 
                printf("Inode table move finished.\n");
+#endif
        if (progress)
                ext2fs_progress_close(progress);
        return 0;
@@ -631,11 +637,15 @@ static errcode_t move_itables(ext2_resize_t rfs)
 backout:
        if (progress)
                ext2fs_progress_close(progress);
+#ifdef RESIZE2FS_DEBUG
        if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE) 
                printf("Error: %s; now backing out!\n", error_message(retval));
+#endif
        while (--i >= 0) {
+#ifdef RESIZE2FS_DEBUG
                if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE) 
                        printf("Group %d block %u->%u\n", i, new, old);
+#endif
                old = rfs->old_fs->group_desc[i].bg_inode_table;
                new = fs->group_desc[i].bg_inode_table;
                
@@ -746,11 +756,13 @@ errcode_t resize_fs(ext2_filsys fs, blk_t new_size, int flags)
        if (retval)
                goto errout;
 
+#ifdef RESIZE2FS_DEBUG
        if (rfs->flags & RESIZE_DEBUG_BMOVE)
                printf("Number of free blocks: %d/%d, Needed: %d\n",
                       rfs->old_fs->super->s_free_blocks_count,
                       rfs->new_fs->super->s_free_blocks_count,
                       rfs->needed_blocks);
+#endif
        
        retval = ext2fs_block_move(rfs);
        if (retval)