Whamcloud - gitweb
ChangeLog, e2fsck.h, message.c, pass1.c, pass2.c, problem.c, problem.h:
authorTheodore Ts'o <tytso@mit.edu>
Thu, 14 Aug 1997 17:17:16 +0000 (17:17 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 14 Aug 1997 17:17:16 +0000 (17:17 +0000)
  message.c: Add compression for the word "Illegal"
  problem.c: Added entries for PR_2_BAD_CHAR_DEV and PR_2_BAD_BLOCK_DEV
  pass1.c (pass1, check_device_inode), pass2.c (process_bad_inode): Use
   a more stringent test for a valid device.
ChangeLog, Makefile.in:
  Makefile.in (install): Fix rm command to use $(DESTDIR) appropriately.

e2fsck/ChangeLog
e2fsck/e2fsck.h
e2fsck/message.c
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/problem.c
e2fsck/problem.h
lib/ss/ChangeLog
lib/ss/Makefile.in

index e8b3e0a..9fceacd 100644 (file)
@@ -1,3 +1,16 @@
+Thu Aug 14 10:55:21 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * message.c: Add compression for the word "Illegal"
+
+       * problem.c: Added entries for PR_2_BAD_CHAR_DEV and
+               PR_2_BAD_BLOCK_DEV
+
+Wed Aug 13 09:55:57 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * pass1.c (pass1, check_device_inode), pass2.c
+               (process_bad_inode): Use a more stringent test for a valid
+               device.
+
 Sun Aug 10 18:58:02 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * e2fsck.c (check_mount): Add stronger warning message about the
index 9efefa3..c6dbd57 100644 (file)
@@ -160,6 +160,7 @@ extern errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino,
                                  struct ext2_inode *inode);
 extern errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino,
                                   struct ext2_inode *inode);
+extern int e2fsck_pass1_check_device_inode(struct ext2_inode *inode);
 
 /* badblock.c */
 extern void read_bad_blocks_file(ext2_filsys fs, const char *bad_blocks_file,
index c5f2593..b9f9dea 100644 (file)
@@ -44,6 +44,7 @@
  *     @B      bitmap
  *     @C      conflicts with some other fs block
  *     @i      inode
+ *     @I      illegal
  *     @D      deleted
  *     @d      directory
  *     @e      entry
@@ -84,6 +85,7 @@ static const char *abbrevs[] = {
        "Bbitmap",
        "Cconflicts with some other fs @b",
        "iinode",
+       "Iillegal",
        "Ddeleted",
        "ddirectory",
        "eentry",
index 1e83759..2f1d67e 100644 (file)
@@ -166,6 +166,20 @@ static void unwind_pass1(ext2_filsys fs)
        fs_fragmented = 0;
 }
 
+/*
+ * Check to make sure a device inode is real.  Returns 1 if the device
+ * checks out, 0 if not.
+ */
+int e2fsck_pass1_check_device_inode(struct ext2_inode *inode)
+{
+       int     i;
+
+       for (i=4; i < EXT2_N_BLOCKS; i++) 
+               if (inode->i_block[i])
+                       return 0;
+       return 1;
+}
+
 void pass1(ext2_filsys fs)
 {
        ino_t   ino;
@@ -402,9 +416,11 @@ void pass1(ext2_filsys fs)
                        fs_directory_count++;
                } else if (LINUX_S_ISREG (inode.i_mode))
                        fs_regular_count++;
-               else if (LINUX_S_ISCHR (inode.i_mode))
+               else if (LINUX_S_ISCHR (inode.i_mode) &&
+                        e2fsck_pass1_check_device_inode(&inode))
                        fs_chardev_count++;
-               else if (LINUX_S_ISBLK (inode.i_mode))
+               else if (LINUX_S_ISBLK (inode.i_mode) &&
+                        e2fsck_pass1_check_device_inode(&inode))
                        fs_blockdev_count++;
                else if (LINUX_S_ISLNK (inode.i_mode)) {
                        fs_symlinks_count++;
index 4c987f3..2c52944 100644 (file)
@@ -556,6 +556,24 @@ static int process_bad_inode(ext2_filsys fs, ino_t dir, ino_t ino)
                        return 1;
                }
        }
+
+       if (LINUX_S_ISCHR(inode.i_mode)
+           && !e2fsck_pass1_check_device_inode(&inode)) {
+               if (fix_problem(fs, PR_2_BAD_CHAR_DEV, &pctx)) {
+                       deallocate_inode(fs, ino, 0);
+                       return 1;
+               }
+       }
+               
+       if (LINUX_S_ISBLK(inode.i_mode)
+           && !e2fsck_pass1_check_device_inode(&inode)) {
+               if (fix_problem(fs, PR_2_BAD_BLOCK_DEV, &pctx)) {
+                       deallocate_inode(fs, ino, 0);
+                       return 1;
+               }
+       }
+
+               
        if (inode.i_faddr &&
            fix_problem(fs, PR_2_FADDR_ZERO, &pctx)) {
                inode.i_faddr = 0;
index 573b840..512e2c6 100644 (file)
@@ -150,7 +150,7 @@ static struct e2fsck_problem problem_table[] = {
 
        /* Illegal block number in inode */
        { PR_1_ILLEGAL_BLOCK_NUM,
-         "Illegal @b #%B (%b) in @i %i.  ",
+         "@I @b #%B (%b) in @i %i.  ",
          PROMPT_CLEAR, PR_LATCH_BLOCK },
 
        /* Block number overlaps fs metadata */
@@ -170,7 +170,7 @@ static struct e2fsck_problem problem_table[] = {
 
        /* Illegal block number in bad block inode */
        { PR_1_BB_ILLEGAL_BLOCK_NUM,
-         "Illegal @b #%B (%b) in bad @b @i.  ",
+         "@I @b #%B (%b) in bad @b @i.  ",
          PROMPT_CLEAR, PR_LATCH_BBLOCK },
 
        /* Bad block inode has illegal blocks (latch question) */
@@ -313,6 +313,16 @@ static struct e2fsck_problem problem_table[] = {
          "'..' directory entry in @d @i %i is not NULL terminated\n",
          PROMPT_FIX, 0 },
 
+       /* Illegal character device inode */
+       { PR_2_BAD_CHAR_DEV,
+         "@i %i (%Q) is an @I character device.\n",
+         PROMPT_CLEAR, 0 },
+
+       /* Illegal block device inode */
+       { PR_2_BAD_BLOCK_DEV,
+         "@i %i (%Q) is an @I @b device.\n",
+         PROMPT_CLEAR, 0 },
+
          /* Pass 3 errors */
 
        /* Root inode not allocated */
index e41cee1..5e1fd9b 100644 (file)
@@ -201,6 +201,12 @@ struct e2fsck_problem {
 /* '..' is not NULL terminated */
 #define PR_2_DOT_DOT_NULL_TERM 0x020017
 
+/* Illegal character device in inode */
+#define PR_2_BAD_CHAR_DEV      0x020018
+
+/* Illegal block device in inode */
+#define PR_2_BAD_BLOCK_DEV     0x020019
+
 /*
  * Pass 3 errors
  */
index 52820ca..1448246 100644 (file)
@@ -1,3 +1,8 @@
+Thu Aug 14 08:17:22 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * Makefile.in (install): Fix rm command to use $(DESTDIR)
+               appropriately.
+
 Tue Jun 17 01:33:20 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * Release of E2fsprogs 1.11
index fb81372..e3c3571 100644 (file)
@@ -137,7 +137,7 @@ install:: libss.a $(INSTALL_HFILES) copyright.h installdirs ss_err.h
        $(CHMOD) 644 $(DESTDIR)$(ulibdir)/libss.a
        -$(RANLIB) $(DESTDIR)$(ulibdir)/libss.a
        $(CHMOD) $(LIBMODE) $(DESTDIR)$(ulibdir)/libss.a
-       $(RM) -f $(includedir)/ss/*
+       $(RM) -f $(DESTDIR)$(includedir)/ss/*
        for i in $(INSTALL_HFILES) copyright.h; do \
                $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/ss/$$i; \
        done