Whamcloud - gitweb
ChangeLog, mke2fs.c, tune2fs.8.in:
authorTheodore Ts'o <tytso@mit.edu>
Sat, 14 Nov 1998 04:18:28 +0000 (04:18 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 14 Nov 1998 04:18:28 +0000 (04:18 +0000)
  tune2fs.8.in: Fix minor display bug in the nroff.
  mke2fs.c (show_stats, write_inode_tables): Use the log10 function to
   calculate the display of block numbers so that things look nice on an
   80 character display.
  mke2fs.c (usage): Add the sparse-super-flag to the usage message.
ChangeLog, e2fsck.c, pass1.c, pass2.c, problem.c, problem.h, unix.c:
  unix.c (main): Move ext2fs_close() after e2fsck_free_context() since
   e2fsck_free_context may reference data in ctx->fs.
  e2fsck.c (e2fsck_reset_context): Make sure ctx->fs is non-NULL before
   checking ctx->fs->dblist.
  pass1.c (e2fsck_pass1): Use the device check subroutine on FIFO's and
   Socket's, so that we catch bogus immutable inodes.
  pass2.c (process_bad_inode): Process bad socket and fifo's.
  problem.h, problem.c: Define new problem codes PR_2_BAD_FIFO and
   PR_2_BAD_SOCKET.

e2fsck/ChangeLog
e2fsck/e2fsck.c
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/problem.c
e2fsck/problem.h
e2fsck/unix.c
misc/ChangeLog
misc/mke2fs.c
misc/tune2fs.8.in

index 7ef240e..0e651f5 100644 (file)
@@ -1,3 +1,21 @@
+1998-10-28  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * unix.c (main): Move ext2fs_close() after e2fsck_free_context()
+               since e2fsck_free_context may reference data in ctx->fs.
+
+       * e2fsck.c (e2fsck_reset_context): Make sure ctx->fs is non-NULL
+               before checking ctx->fs->dblist.
+
+1998-10-09  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * pass1.c (e2fsck_pass1): Use the device check subroutine on
+               FIFO's and Socket's, so that we catch bogus immutable inodes.
+
+       * pass2.c (process_bad_inode): Process bad socket and fifo's.
+
+       * problem.h, problem.c: Define new problem codes PR_2_BAD_FIFO and
+               PR_2_BAD_SOCKET.
+
 1998-09-02  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * problem.c: Add PR_3_NO_DIRINFO error code.
index 77e0e2e..3cfca69 100644 (file)
@@ -58,7 +58,7 @@ errcode_t e2fsck_reset_context(e2fsck_t ctx)
                ext2fs_free_icount(ctx->inode_link_info);
                ctx->inode_link_info = 0;
        }
-       if (ctx->fs->dblist) {
+       if (ctx->fs && ctx->fs->dblist) {
                ext2fs_free_dblist(ctx->fs->dblist);
                ctx->fs->dblist = 0;
        }
index c834a11..6766f41 100644 (file)
@@ -110,6 +110,10 @@ static void unwind_pass1(ext2_filsys fs)
 /*
  * Check to make sure a device inode is real.  Returns 1 if the device
  * checks out, 0 if not.
+ *
+ * Note: this routine is now also used to check FIFO's and Sockets,
+ * since they have the same requirement; the i_block fields should be
+ * zero. 
  */
 int e2fsck_pass1_check_device_inode(struct ext2_inode *inode)
 {
@@ -424,9 +428,11 @@ void e2fsck_pass1(e2fsck_t ctx)
                                goto next;
                        }
                }
-               else if (LINUX_S_ISFIFO (inode.i_mode))
+               else if (LINUX_S_ISFIFO (inode.i_mode) &&
+                         e2fsck_pass1_check_device_inode(&inode))
                        ctx->fs_fifo_count++;
-               else if (LINUX_S_ISSOCK (inode.i_mode))
+               else if ((LINUX_S_ISSOCK (inode.i_mode)) &&
+                        e2fsck_pass1_check_device_inode(&inode))
                        ctx->fs_sockets_count++;
                else {
                        if (!ctx->inode_bad_map)
index 1767d00..5453c61 100644 (file)
@@ -615,6 +615,14 @@ static int process_bad_inode(e2fsck_t ctx, ino_t dir, ino_t ino)
            && !e2fsck_pass1_check_device_inode(&inode))
                problem = PR_2_BAD_BLOCK_DEV;
 
+       if (LINUX_S_ISFIFO(inode.i_mode)
+           && !e2fsck_pass1_check_device_inode(&inode))
+               problem = PR_2_BAD_FIFO;
+               
+       if (LINUX_S_ISSOCK(inode.i_mode)
+           && !e2fsck_pass1_check_device_inode(&inode))
+               problem = PR_2_BAD_SOCKET;
+
        if (problem) {
                if (fix_problem(ctx, problem, &pctx)) {
                        deallocate_inode(ctx, ino, 0);
index d6f6774..e9ef1cf 100644 (file)
@@ -675,6 +675,16 @@ static const struct e2fsck_problem problem_table[] = {
          "@d @e for '.' is big.  ",
          PROMPT_SPLIT, PR_NO_OK },
 
+       /* Illegal FIFO inode */
+       { PR_2_BAD_FIFO,
+         "@i %i (%Q) is an @I FIFO.\n",
+         PROMPT_CLEAR, 0 },
+
+       /* Illegal socket inode */
+       { PR_2_BAD_SOCKET,
+         "@i %i (%Q) is an @I socket.\n",
+         PROMPT_CLEAR, 0 },
+
        /* Pass 3 errors */
 
        /* Pass 3: Checking directory connectivity */
index 0f16ba6..d5f5ed0 100644 (file)
@@ -402,6 +402,12 @@ struct problem_context {
 /* Directory entry for '.' is big.  Split? */
 #define PR_2_SPLIT_DOT         0x0200024
 
+/* Illegal FIFO */
+#define PR_2_BAD_FIFO          0x020025
+
+/* Illegal socket */
+#define PR_2_BAD_SOCKET                0x020026
+
 /*
  * Pass 3 errors
  */
index d9d86dc..e17d5a3 100644 (file)
@@ -693,7 +693,6 @@ restart:
        show_stats(ctx);
 
        e2fsck_write_bitmaps(ctx);
-       ext2fs_close(fs);
        
 #ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME)
@@ -701,6 +700,7 @@ restart:
 #endif
 
        e2fsck_free_context(ctx);
+       ext2fs_close(fs);
        
        return exit_value;
 }
index 1dd8113..d802b12 100644 (file)
@@ -1,3 +1,16 @@
+1998-11-13  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * tune2fs.8.in: Fix minor display bug in the nroff.
+
+       * mke2fs.c (show_stats, write_inode_tables): Use the log10
+               function to calculate the display of block numbers so that
+               things look nice on an 80 character display.
+
+1998-10-12  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * mke2fs.c (usage): Add the sparse-super-flag to the usage
+               message. 
+
 1998-07-09  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * Release of E2fsprogs 1.12
index 5eacdad..d6eb6fb 100644 (file)
@@ -91,7 +91,7 @@ static void usage(NOARGS)
        "[-m reserved-blocks-percentage] [-qvSV]\n\t"
        "[-o creator-os] [-g blocks-per-group] [-L volume-label]\n\t"
        "[-M last-mounted-directory] [-r fs-revision] [-R raid_opts]\n\t"
-       "device [blocks-count]\n",
+       "[-s sparse-super-flag] device [blocks-count]\n",
                program_name);
        exit(1);
 }
@@ -108,6 +108,15 @@ static int log2(int arg)
        return l;
 }
 
+static int log10(unsigned int arg)
+{
+       int     l;
+
+       for (l=0; arg ; l++)
+               arg = arg / 10;
+       return l;
+}
+
 static void proceed_question(NOARGS)
 {
        fflush(stdout);
@@ -139,8 +148,8 @@ static void check_plausibility(NOARGS)
                return;
        } else if ((MAJOR(s.st_rdev) == HD_MAJOR &&
                    MINOR(s.st_rdev)%64 == 0) ||
-                  (MAJOR(s.st_rdev) == SCSI_DISK_MAJOR &&
-                   MINOR(s.st_rdev)%16 == 0)) {
+                  (SCSI_BLK_MAJOR(MAJOR(s.st_rdev)) &&
+                      MINOR(s.st_rdev)%16 == 0)) {
                printf("%s is entire device, not just one partition!\n", 
                       device_name);
                proceed_question();
@@ -308,6 +317,7 @@ static void write_inode_tables(ext2_filsys fs)
        blk_t           blk;
        int             i, j, num, count;
        char            *buf;
+       char            format[20], backup[80];
 
        buf = malloc(fs->blocksize * STRIDE_LENGTH);
        if (!buf) {
@@ -315,12 +325,22 @@ static void write_inode_tables(ext2_filsys fs)
                exit(1);
        }
        memset(buf, 0, fs->blocksize * STRIDE_LENGTH);
-       
+
+       /*
+        * Figure out how many digits we need
+        */
+       i = log10(fs->group_desc_count);
+       sprintf(format, "%%%dd/%%%dld", i, i);
+       memset(backup, '\b', sizeof(backup)-1);
+       backup[sizeof(backup)-1] = 0;
+       if ((2*i)+1 < sizeof(backup))
+               backup[(2*i)+1] = 0;
+
        if (!quiet)
                printf("Writing inode tables: ");
        for (i = 0; i < fs->group_desc_count; i++) {
                if (!quiet)
-                       printf("%4d/%4ld", i, fs->group_desc_count);
+                       printf(format, i, fs->group_desc_count);
                
                blk = fs->group_desc[i].bg_inode_table;
                num = fs->inode_blocks_per_group;
@@ -337,11 +357,11 @@ static void write_inode_tables(ext2_filsys fs)
                                       count, blk, error_message(retval));
                }
                if (!quiet) 
-                       printf("\b\b\b\b\b\b\b\b\b");
+                       fputs(backup, stdout);
        }
        free(buf);
        if (!quiet)
-               printf("done     \n");
+               fputs("done                            \n", stdout);
 }
 
 static void create_root_dir(ext2_filsys fs)
@@ -453,7 +473,7 @@ static void show_stats(ext2_filsys fs)
        struct ext2fs_sb        *s = (struct ext2fs_sb *) fs->super;
        char                    buf[80];
        blk_t                   group_block;
-       int                     i, col_left;
+       int                     i, need, col_left;
        
        if (param.s_blocks_count != s->s_blocks_count)
                printf("warning: %d blocks unused.\n\n",
@@ -497,10 +517,12 @@ static void show_stats(ext2_filsys fs)
                group_block += s->s_blocks_per_group;
                if (!ext2fs_bg_has_super(fs, i))
                        continue;
-               if (!col_left--) {
+               need = log10(group_block) + 2;
+               if (need > col_left) {
                        printf("\n\t");
-                       col_left = 6;
+                       col_left = 72;
                }
+               col_left -= need;
                printf("%u", group_block);
                if (i != fs->group_desc_count - 1)
                        printf(", ");
index 7afba25..73d16fc 100644 (file)
@@ -112,7 +112,7 @@ doing!
 set the user who can benefit from the reserved blocks.
 .I user
 can be a numerical uid or a user name.
-.IP
+.TP
 .I -C mount-count
 set the number of times the filesystem has been mounted.
 .TP