1997-04-29 20:15:03 +04:00
|
|
|
/*
|
|
|
|
* message.c --- print e2fsck messages (with compression)
|
|
|
|
*
|
|
|
|
* Copyright 1996, 1997 by Theodore Ts'o
|
|
|
|
*
|
|
|
|
* %Begin-Header%
|
|
|
|
* This file may be redistributed under the terms of the GNU Public
|
|
|
|
* License.
|
|
|
|
* %End-Header%
|
|
|
|
*
|
|
|
|
* print_e2fsck_message() prints a message to the user, using
|
|
|
|
* compression techniques and expansions of abbreviations.
|
|
|
|
*
|
|
|
|
* The following % expansions are supported:
|
|
|
|
*
|
|
|
|
* %b <blk> block number
|
|
|
|
* %B <blkcount> integer
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
* %c <blk2> block number
|
1997-04-29 20:15:03 +04:00
|
|
|
* %di <dirent>->ino inode number
|
|
|
|
* %dn <dirent>->name string
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
* %dr <dirent>->rec_len
|
|
|
|
* %dl <dirent>->name_len
|
Many files:
pass4.c (e2fsck_pass4): If an inode is set in the inode_imagic_map
bitmap, don't check to see if it is disconnected from the inode tree
(because it almost certainly will be). Free inode_imagic_map at the
end of pass 4.
pass2.c (check_dir_block, check_filetype): If the FILETYPE feature is
set, check the directory entry's filetype information field, and
fix/set it if necessary. (e2fsck_pass2): Free the inode_reg_map
bitmap at the end of pass 2.
pass1.c (e2fsck_pass1, alloc_imagic_map): Allocate and fill in
information for inode_reg_map and inode_imagic_map, which indicates
which inodes are regular files and AFS inodes, respectively.
Since only the master superblock is written during a restart, force
that superblock to be used after a restart; otherwise changes to the
block group descriptors end up getting ignored.
problem.c, problemP.h: If e2fsck is run -n, make def_yn variable be 0
for "no". Add support for a new flag, PR_NO_NOMSG, which supresses
the problem message if e2fsck is run with the -n option.
problem.c, problem.h (PR_2_SET_FILETYPE, PR_2_BAD_FILETYPE): Add new
problem codes.
message.c (expand_dirent_expression): Add support for %dt which prints
the dirent type information.
e2fsck.c (e2fsck_reset_context): Free new bitmaps (inode_reg_map and
inode_imagic_map).
e2fsck.h (e2fsck_t): Add new inode_reg_map and inode_magic_map to the
context structure.
ChangeLog, nt_io.c:
nt_io.c: New file which supports I/O under Windows NT.
ChangeLog, gen_uuid_nt.c:
gen_uuid_nt.c: New file which creates a UUID under Windows NT.
Many files:
Add support for non-Unix compiles
1999-10-21 23:33:18 +04:00
|
|
|
* %dt <dirent>->filetype
|
1997-04-29 20:15:03 +04:00
|
|
|
* %D <dir> inode number
|
|
|
|
* %g <group> integer
|
|
|
|
* %i <ino> inode number
|
|
|
|
* %Is <inode> -> i_size
|
|
|
|
* %Ib <inode> -> i_blocks
|
|
|
|
* %Il <inode> -> i_links_count
|
|
|
|
* %Im <inode> -> i_mode
|
|
|
|
* %IM <inode> -> i_mtime
|
|
|
|
* %IF <inode> -> i_faddr
|
|
|
|
* %If <inode> -> i_file_acl
|
|
|
|
* %Id <inode> -> i_dir_acl
|
|
|
|
* %j <ino2> inode number
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
* %m <com_err error message>
|
1997-04-29 20:15:03 +04:00
|
|
|
* %N <num>
|
|
|
|
* %p ext2fs_get_pathname of directory <ino>
|
|
|
|
* %P ext2fs_get_pathname of <dirent>->ino with <ino2> as
|
|
|
|
* the containing directory. (If dirent is NULL
|
|
|
|
* then return the pathname of directory <ino2>)
|
|
|
|
* %q ext2fs_get_pathname of directory <dir>
|
|
|
|
* %Q ext2fs_get_pathname of directory <ino> with <dir> as
|
|
|
|
* the containing directory.
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
* %s <str> miscellaneous string
|
|
|
|
* %S backup superblock
|
2000-08-14 18:25:19 +04:00
|
|
|
* %X <num> hexadecimal format
|
1997-04-29 20:15:03 +04:00
|
|
|
*
|
|
|
|
* The following '@' expansions are supported:
|
|
|
|
*
|
Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
indicator function.
pass1.c (scan_callback): Add call to the progress feedback function
(if it exists).
super.c (check_super_block): Skip the device size check if the
get_device_size returns EXT2_EXT_UNIMPLEMENTED.
iscan.c (main): Don't use fatal_error() anymore.
pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
fatal_error(0).
problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
PR_3_NO_ROOT_INODE_ABORT): New problem codes.
problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
problemP.h: New file which separates out the private fix_problem data
structures.
util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
New file which contains the private problem abstraction definitions.
Makefile.pq:
Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 08:23:04 +03:00
|
|
|
* @A error allocating
|
1997-04-29 20:15:03 +04:00
|
|
|
* @b block
|
|
|
|
* @B bitmap
|
Many files:
unix.c (main): If compression is enabled on the filesystem, print a
warning message (for now).
message.c: Add new compression shortcut: @c == compress
problem.c, problem.h (PR_1_COMPR_SET): Add new error code.
pass1.c (check_blocks): If the inode has EXT2_COMPRBLK_FL flag set,
check to see if the filesystem supports compression. If it does pass
this information down to process_block() so it can treat the
compressed block flag words correctly. If not, offer to clear the
flag, since it shouldn't be set.
(process_block): If an inode has the compressed inode flag set, allow
EXT2FS_COMPRESSED_BLKADDR.
pass1b.c (process_pass1b_block, delete_file_block, clone_file_block):
pass2.c (deallocate_inode_block): Use HOLE_BLKADDR to check to see if
the block can be skipped.
ChangeLog, Makefile.in:
Makefile.in: Exclude the internationalization files from being
distributed.
ChangeLog, configure, configure.in:
configure.in: Add support for --enable-compression. This is
experimental code only for now, which is why it's under --enable test.
Once it's stable, it will always be compiled in.
TODO:
Commit additional TODO items.
2000-02-11 18:55:07 +03:00
|
|
|
* @c compress
|
1997-04-29 20:15:03 +04:00
|
|
|
* @C conflicts with some other fs block
|
|
|
|
* @i inode
|
1997-08-14 21:17:16 +04:00
|
|
|
* @I illegal
|
1997-04-29 20:15:03 +04:00
|
|
|
* @D deleted
|
|
|
|
* @d directory
|
|
|
|
* @e entry
|
|
|
|
* @E Entry '%Dn' in %p (%i)
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
* @f filesystem
|
1997-04-29 20:15:03 +04:00
|
|
|
* @F for @i %i (%Q) is
|
|
|
|
* @g group
|
|
|
|
* @l lost+found
|
|
|
|
* @L is a link
|
|
|
|
* @u unattached
|
|
|
|
* @r root inode
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
* @s should be
|
|
|
|
* @S superblock
|
1997-04-29 20:15:03 +04:00
|
|
|
* @z zero-length
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <termios.h>
|
|
|
|
|
|
|
|
#include "e2fsck.h"
|
|
|
|
|
|
|
|
#include "problem.h"
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define _INLINE_ __inline__
|
|
|
|
#else
|
|
|
|
#define _INLINE_
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure defines the abbreviations used by the text strings
|
|
|
|
* below. The first character in the string is the index letter. An
|
|
|
|
* abbreviation of the form '@<i>' is expanded by looking up the index
|
|
|
|
* letter <i> in the table below.
|
|
|
|
*/
|
|
|
|
static const char *abbrevs[] = {
|
Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
Internationalization support as suggested by Marco d'Itri
<md@linux.it>.
2000-02-07 06:11:03 +03:00
|
|
|
N_("Aerror allocating"),
|
|
|
|
N_("bblock"),
|
|
|
|
N_("Bbitmap"),
|
Many files:
unix.c (main): If compression is enabled on the filesystem, print a
warning message (for now).
message.c: Add new compression shortcut: @c == compress
problem.c, problem.h (PR_1_COMPR_SET): Add new error code.
pass1.c (check_blocks): If the inode has EXT2_COMPRBLK_FL flag set,
check to see if the filesystem supports compression. If it does pass
this information down to process_block() so it can treat the
compressed block flag words correctly. If not, offer to clear the
flag, since it shouldn't be set.
(process_block): If an inode has the compressed inode flag set, allow
EXT2FS_COMPRESSED_BLKADDR.
pass1b.c (process_pass1b_block, delete_file_block, clone_file_block):
pass2.c (deallocate_inode_block): Use HOLE_BLKADDR to check to see if
the block can be skipped.
ChangeLog, Makefile.in:
Makefile.in: Exclude the internationalization files from being
distributed.
ChangeLog, configure, configure.in:
configure.in: Add support for --enable-compression. This is
experimental code only for now, which is why it's under --enable test.
Once it's stable, it will always be compiled in.
TODO:
Commit additional TODO items.
2000-02-11 18:55:07 +03:00
|
|
|
N_("ccompress"),
|
Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
Internationalization support as suggested by Marco d'Itri
<md@linux.it>.
2000-02-07 06:11:03 +03:00
|
|
|
N_("Cconflicts with some other fs @b"),
|
|
|
|
N_("iinode"),
|
|
|
|
N_("Iillegal"),
|
|
|
|
N_("Ddeleted"),
|
|
|
|
N_("ddirectory"),
|
|
|
|
N_("eentry"),
|
|
|
|
N_("E@e '%Dn' in %p (%i)"),
|
|
|
|
N_("ffilesystem"),
|
|
|
|
N_("Ffor @i %i (%Q) is"),
|
|
|
|
N_("ggroup"),
|
|
|
|
N_("llost+found"),
|
|
|
|
N_("Lis a link"),
|
|
|
|
N_("uunattached"),
|
|
|
|
N_("rroot @i"),
|
|
|
|
N_("sshould be"),
|
|
|
|
N_("Ssuper@b"),
|
|
|
|
N_("zzero-length"),
|
1997-04-29 20:15:03 +04:00
|
|
|
"@@",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Give more user friendly names to the "special" inodes.
|
|
|
|
*/
|
|
|
|
#define num_special_inodes 7
|
|
|
|
static const char *special_inode_name[] =
|
|
|
|
{
|
Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
Internationalization support as suggested by Marco d'Itri
<md@linux.it>.
2000-02-07 06:11:03 +03:00
|
|
|
N_("<The NULL inode>"), /* 0 */
|
|
|
|
N_("<The bad blocks inode>"), /* 1 */
|
1997-04-29 20:15:03 +04:00
|
|
|
"/", /* 2 */
|
Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
Internationalization support as suggested by Marco d'Itri
<md@linux.it>.
2000-02-07 06:11:03 +03:00
|
|
|
N_("<The ACL index inode>"), /* 3 */
|
|
|
|
N_("<The ACL data inode>"), /* 4 */
|
|
|
|
N_("<The boot loader inode>"), /* 5 */
|
|
|
|
N_("<The undelete directory inode>") /* 6 */
|
1997-04-29 20:15:03 +04:00
|
|
|
};
|
|
|
|
|
1999-01-09 19:32:31 +03:00
|
|
|
/*
|
|
|
|
* This function does "safe" printing. It will convert non-printable
|
|
|
|
* ASCII characters using '^' and M- notation.
|
|
|
|
*/
|
1999-10-26 18:20:22 +04:00
|
|
|
static void safe_print(const char *cp, int len)
|
1999-01-09 19:32:31 +03:00
|
|
|
{
|
|
|
|
unsigned char ch;
|
|
|
|
|
|
|
|
if (len < 0)
|
|
|
|
len = strlen(cp);
|
|
|
|
|
|
|
|
while (len--) {
|
|
|
|
ch = *cp++;
|
|
|
|
if (ch > 128) {
|
|
|
|
fputs("M-", stdout);
|
|
|
|
ch -= 128;
|
|
|
|
}
|
1999-11-19 21:52:36 +03:00
|
|
|
if ((ch < 32) || (ch == 0x7f)) {
|
1999-01-09 19:32:31 +03:00
|
|
|
fputc('^', stdout);
|
1999-11-19 21:52:36 +03:00
|
|
|
ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
|
1999-01-09 19:32:31 +03:00
|
|
|
}
|
|
|
|
fputc(ch, stdout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
/*
|
|
|
|
* This function prints a pathname, using the ext2fs_get_pathname
|
|
|
|
* function
|
|
|
|
*/
|
|
|
|
static void print_pathname(ext2_filsys fs, ino_t dir, ino_t ino)
|
|
|
|
{
|
|
|
|
errcode_t retval;
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
if (!dir && (ino < num_special_inodes)) {
|
Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
Internationalization support as suggested by Marco d'Itri
<md@linux.it>.
2000-02-07 06:11:03 +03:00
|
|
|
fputs(_(special_inode_name[ino]), stdout);
|
1997-04-29 20:15:03 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = ext2fs_get_pathname(fs, dir, ino, &path);
|
|
|
|
if (retval)
|
|
|
|
fputs("???", stdout);
|
|
|
|
else {
|
1999-01-09 19:32:31 +03:00
|
|
|
safe_print(path, -1);
|
1997-11-03 22:42:40 +03:00
|
|
|
ext2fs_free_mem((void **) &path);
|
1997-04-29 20:15:03 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function handles the '@' expansion. We allow recursive
|
|
|
|
* expansion; an @ expression can contain further '@' and '%'
|
|
|
|
* expressions.
|
|
|
|
*/
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
static _INLINE_ void expand_at_expression(e2fsck_t ctx, char ch,
|
|
|
|
struct problem_context *pctx,
|
1997-04-29 20:15:03 +04:00
|
|
|
int *first)
|
|
|
|
{
|
|
|
|
const char **cpp, *str;
|
|
|
|
|
|
|
|
/* Search for the abbreviation */
|
|
|
|
for (cpp = abbrevs; *cpp; cpp++) {
|
|
|
|
if (ch == *cpp[0])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (*cpp) {
|
|
|
|
str = (*cpp) + 1;
|
|
|
|
if (*first && islower(*str)) {
|
|
|
|
*first = 0;
|
|
|
|
fputc(toupper(*str++), stdout);
|
|
|
|
}
|
Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
Internationalization support as suggested by Marco d'Itri
<md@linux.it>.
2000-02-07 06:11:03 +03:00
|
|
|
print_e2fsck_message(ctx, _(str), pctx, *first);
|
1997-04-29 20:15:03 +04:00
|
|
|
} else
|
|
|
|
printf("@%c", ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function expands '%kX' expressions
|
|
|
|
*/
|
|
|
|
static _INLINE_ void expand_inode_expression(char ch,
|
|
|
|
struct problem_context *ctx)
|
|
|
|
{
|
|
|
|
struct ext2_inode *inode;
|
|
|
|
char * time_str;
|
|
|
|
time_t t;
|
|
|
|
|
|
|
|
if (!ctx || !ctx->inode)
|
|
|
|
goto no_inode;
|
|
|
|
|
|
|
|
inode = ctx->inode;
|
|
|
|
|
|
|
|
switch (ch) {
|
|
|
|
case 's':
|
Many files:
unix.c: Fix bug in check of feature set, to make sure we can really
fix this filesystem.
problem.h: Make blkcount type to be of type blkcnt_t. Make the num
field be a 64 bit type. Add the problem code PR_1_FEATURE_LARGE_FILES
problem.c: Add table entry for the problem code PR_1_FEATURE_LARGE_FILES.
pass1.c (e2fsck_pass1): A non-zero i_dir_acl field is only a problem
for directory inodes. (Since it is also i_size_high now.) If there
are no large_files, then clear the LARGE_FLAG feature flag. If there
are large_files, but the LARGE_FLAG feature flag is not set, complain
and offer to fix it.
(check_blocks): Add support to deal with non-directory inodes that
have i_size_high set (i.e., large_files). Don't give an error if a
directory has preallocated blocks, to support the DIR_PREALLOC
feature.
(process_block, process_bad_block): The blockcnt variable is a type of
blkcnt_t, for conversion to the new block_iterate2.
pass2.c (process_bad_inode): A non-zero i_dir_acl field is only a
problem for directory inodes. (Since it is also i_size_high now.)
message.c (expand_inode_expression): Print a 64-bits of the inode size
for non-directory inodes. (Directory inodes can only use a 32-bit
directory acl size, since i_size_high is shared with i_dir_acl.) Add
sanity check so that trying to print out the directory acl on a
non-directory inode will print zero. (expand_percent_expression): %B
and %N, which print pctx->blkcount and pctx->num, can now be 64 bit
variables. Print them using the "%lld" format if EXT2_NO_64_TYPE is
not defined.
e2fsck.h: Add the large_flagsfield to the e2fsck context.
e2fsck.c (e2fsck_reset_context): Clear the large_flags field.
ChangeLog, expect.1:
f_messy_inode: Modify test to deal with changes to support 64-bit size
files. (/MAKEDEV had i_dir_acl, now i_size_high, set.)
1998-03-24 19:22:38 +03:00
|
|
|
if (LINUX_S_ISDIR(inode->i_mode))
|
|
|
|
printf("%u", inode->i_size);
|
|
|
|
else {
|
|
|
|
#ifdef EXT2_NO_64_TYPE
|
|
|
|
if (inode->i_size_high)
|
|
|
|
printf("0x%x%08x", inode->i_size_high,
|
|
|
|
inode->i_size);
|
|
|
|
else
|
|
|
|
printf("%u", inode->i_size);
|
|
|
|
#else
|
|
|
|
printf("%llu", (inode->i_size |
|
|
|
|
((__u64) inode->i_size_high << 32)));
|
|
|
|
#endif
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'b':
|
|
|
|
printf("%u", inode->i_blocks);
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
printf("%d", inode->i_links_count);
|
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
printf("0%o", inode->i_mode);
|
|
|
|
break;
|
|
|
|
case 'M':
|
|
|
|
t = inode->i_mtime;
|
|
|
|
time_str = ctime(&t);
|
|
|
|
printf("%.24s", time_str);
|
|
|
|
break;
|
|
|
|
case 'F':
|
|
|
|
printf("%u", inode->i_faddr);
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
printf("%u", inode->i_file_acl);
|
|
|
|
break;
|
|
|
|
case 'd':
|
Many files:
unix.c: Fix bug in check of feature set, to make sure we can really
fix this filesystem.
problem.h: Make blkcount type to be of type blkcnt_t. Make the num
field be a 64 bit type. Add the problem code PR_1_FEATURE_LARGE_FILES
problem.c: Add table entry for the problem code PR_1_FEATURE_LARGE_FILES.
pass1.c (e2fsck_pass1): A non-zero i_dir_acl field is only a problem
for directory inodes. (Since it is also i_size_high now.) If there
are no large_files, then clear the LARGE_FLAG feature flag. If there
are large_files, but the LARGE_FLAG feature flag is not set, complain
and offer to fix it.
(check_blocks): Add support to deal with non-directory inodes that
have i_size_high set (i.e., large_files). Don't give an error if a
directory has preallocated blocks, to support the DIR_PREALLOC
feature.
(process_block, process_bad_block): The blockcnt variable is a type of
blkcnt_t, for conversion to the new block_iterate2.
pass2.c (process_bad_inode): A non-zero i_dir_acl field is only a
problem for directory inodes. (Since it is also i_size_high now.)
message.c (expand_inode_expression): Print a 64-bits of the inode size
for non-directory inodes. (Directory inodes can only use a 32-bit
directory acl size, since i_size_high is shared with i_dir_acl.) Add
sanity check so that trying to print out the directory acl on a
non-directory inode will print zero. (expand_percent_expression): %B
and %N, which print pctx->blkcount and pctx->num, can now be 64 bit
variables. Print them using the "%lld" format if EXT2_NO_64_TYPE is
not defined.
e2fsck.h: Add the large_flagsfield to the e2fsck context.
e2fsck.c (e2fsck_reset_context): Clear the large_flags field.
ChangeLog, expect.1:
f_messy_inode: Modify test to deal with changes to support 64-bit size
files. (/MAKEDEV had i_dir_acl, now i_size_high, set.)
1998-03-24 19:22:38 +03:00
|
|
|
printf("%u", (LINUX_S_ISDIR(inode->i_mode) ?
|
|
|
|
inode->i_dir_acl : 0));
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
no_inode:
|
|
|
|
printf("%%I%c", ch);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function expands '%dX' expressions
|
|
|
|
*/
|
|
|
|
static _INLINE_ void expand_dirent_expression(char ch,
|
|
|
|
struct problem_context *ctx)
|
|
|
|
{
|
|
|
|
struct ext2_dir_entry *dirent;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!ctx || !ctx->dirent)
|
|
|
|
goto no_dirent;
|
|
|
|
|
|
|
|
dirent = ctx->dirent;
|
|
|
|
|
|
|
|
switch (ch) {
|
|
|
|
case 'i':
|
|
|
|
printf("%u", dirent->inode);
|
|
|
|
break;
|
|
|
|
case 'n':
|
1998-03-09 16:10:37 +03:00
|
|
|
len = dirent->name_len & 0xFF;
|
1997-04-29 20:15:03 +04:00
|
|
|
if (len > EXT2_NAME_LEN)
|
|
|
|
len = EXT2_NAME_LEN;
|
|
|
|
if (len > dirent->rec_len)
|
|
|
|
len = dirent->rec_len;
|
1999-01-09 19:32:31 +03:00
|
|
|
safe_print(dirent->name, len);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
case 'r':
|
|
|
|
printf("%u", dirent->rec_len);
|
|
|
|
break;
|
|
|
|
case 'l':
|
1998-03-09 16:10:37 +03:00
|
|
|
printf("%u", dirent->name_len & 0xFF);
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
break;
|
Many files:
pass4.c (e2fsck_pass4): If an inode is set in the inode_imagic_map
bitmap, don't check to see if it is disconnected from the inode tree
(because it almost certainly will be). Free inode_imagic_map at the
end of pass 4.
pass2.c (check_dir_block, check_filetype): If the FILETYPE feature is
set, check the directory entry's filetype information field, and
fix/set it if necessary. (e2fsck_pass2): Free the inode_reg_map
bitmap at the end of pass 2.
pass1.c (e2fsck_pass1, alloc_imagic_map): Allocate and fill in
information for inode_reg_map and inode_imagic_map, which indicates
which inodes are regular files and AFS inodes, respectively.
Since only the master superblock is written during a restart, force
that superblock to be used after a restart; otherwise changes to the
block group descriptors end up getting ignored.
problem.c, problemP.h: If e2fsck is run -n, make def_yn variable be 0
for "no". Add support for a new flag, PR_NO_NOMSG, which supresses
the problem message if e2fsck is run with the -n option.
problem.c, problem.h (PR_2_SET_FILETYPE, PR_2_BAD_FILETYPE): Add new
problem codes.
message.c (expand_dirent_expression): Add support for %dt which prints
the dirent type information.
e2fsck.c (e2fsck_reset_context): Free new bitmaps (inode_reg_map and
inode_imagic_map).
e2fsck.h (e2fsck_t): Add new inode_reg_map and inode_magic_map to the
context structure.
ChangeLog, nt_io.c:
nt_io.c: New file which supports I/O under Windows NT.
ChangeLog, gen_uuid_nt.c:
gen_uuid_nt.c: New file which creates a UUID under Windows NT.
Many files:
Add support for non-Unix compiles
1999-10-21 23:33:18 +04:00
|
|
|
case 't':
|
|
|
|
printf("%u", dirent->name_len >> 8);
|
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
default:
|
|
|
|
no_dirent:
|
|
|
|
printf("%%D%c", ch);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static _INLINE_ void expand_percent_expression(ext2_filsys fs, char ch,
|
|
|
|
struct problem_context *ctx)
|
|
|
|
{
|
|
|
|
if (!ctx)
|
|
|
|
goto no_context;
|
|
|
|
|
|
|
|
switch (ch) {
|
|
|
|
case '%':
|
|
|
|
fputc('%', stdout);
|
|
|
|
break;
|
|
|
|
case 'b':
|
|
|
|
printf("%u", ctx->blk);
|
|
|
|
break;
|
|
|
|
case 'B':
|
Many files:
unix.c: Fix bug in check of feature set, to make sure we can really
fix this filesystem.
problem.h: Make blkcount type to be of type blkcnt_t. Make the num
field be a 64 bit type. Add the problem code PR_1_FEATURE_LARGE_FILES
problem.c: Add table entry for the problem code PR_1_FEATURE_LARGE_FILES.
pass1.c (e2fsck_pass1): A non-zero i_dir_acl field is only a problem
for directory inodes. (Since it is also i_size_high now.) If there
are no large_files, then clear the LARGE_FLAG feature flag. If there
are large_files, but the LARGE_FLAG feature flag is not set, complain
and offer to fix it.
(check_blocks): Add support to deal with non-directory inodes that
have i_size_high set (i.e., large_files). Don't give an error if a
directory has preallocated blocks, to support the DIR_PREALLOC
feature.
(process_block, process_bad_block): The blockcnt variable is a type of
blkcnt_t, for conversion to the new block_iterate2.
pass2.c (process_bad_inode): A non-zero i_dir_acl field is only a
problem for directory inodes. (Since it is also i_size_high now.)
message.c (expand_inode_expression): Print a 64-bits of the inode size
for non-directory inodes. (Directory inodes can only use a 32-bit
directory acl size, since i_size_high is shared with i_dir_acl.) Add
sanity check so that trying to print out the directory acl on a
non-directory inode will print zero. (expand_percent_expression): %B
and %N, which print pctx->blkcount and pctx->num, can now be 64 bit
variables. Print them using the "%lld" format if EXT2_NO_64_TYPE is
not defined.
e2fsck.h: Add the large_flagsfield to the e2fsck context.
e2fsck.c (e2fsck_reset_context): Clear the large_flags field.
ChangeLog, expect.1:
f_messy_inode: Modify test to deal with changes to support 64-bit size
files. (/MAKEDEV had i_dir_acl, now i_size_high, set.)
1998-03-24 19:22:38 +03:00
|
|
|
#ifdef EXT2_NO_64_TYPE
|
1997-04-29 20:15:03 +04:00
|
|
|
printf("%d", ctx->blkcount);
|
Many files:
unix.c: Fix bug in check of feature set, to make sure we can really
fix this filesystem.
problem.h: Make blkcount type to be of type blkcnt_t. Make the num
field be a 64 bit type. Add the problem code PR_1_FEATURE_LARGE_FILES
problem.c: Add table entry for the problem code PR_1_FEATURE_LARGE_FILES.
pass1.c (e2fsck_pass1): A non-zero i_dir_acl field is only a problem
for directory inodes. (Since it is also i_size_high now.) If there
are no large_files, then clear the LARGE_FLAG feature flag. If there
are large_files, but the LARGE_FLAG feature flag is not set, complain
and offer to fix it.
(check_blocks): Add support to deal with non-directory inodes that
have i_size_high set (i.e., large_files). Don't give an error if a
directory has preallocated blocks, to support the DIR_PREALLOC
feature.
(process_block, process_bad_block): The blockcnt variable is a type of
blkcnt_t, for conversion to the new block_iterate2.
pass2.c (process_bad_inode): A non-zero i_dir_acl field is only a
problem for directory inodes. (Since it is also i_size_high now.)
message.c (expand_inode_expression): Print a 64-bits of the inode size
for non-directory inodes. (Directory inodes can only use a 32-bit
directory acl size, since i_size_high is shared with i_dir_acl.) Add
sanity check so that trying to print out the directory acl on a
non-directory inode will print zero. (expand_percent_expression): %B
and %N, which print pctx->blkcount and pctx->num, can now be 64 bit
variables. Print them using the "%lld" format if EXT2_NO_64_TYPE is
not defined.
e2fsck.h: Add the large_flagsfield to the e2fsck context.
e2fsck.c (e2fsck_reset_context): Clear the large_flags field.
ChangeLog, expect.1:
f_messy_inode: Modify test to deal with changes to support 64-bit size
files. (/MAKEDEV had i_dir_acl, now i_size_high, set.)
1998-03-24 19:22:38 +03:00
|
|
|
#else
|
|
|
|
printf("%lld", ctx->blkcount);
|
|
|
|
#endif
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
case 'c':
|
|
|
|
printf("%u", ctx->blk2);
|
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
case 'd':
|
|
|
|
printf("%lu", ctx->dir);
|
|
|
|
break;
|
|
|
|
case 'g':
|
|
|
|
printf("%d", ctx->group);
|
|
|
|
break;
|
|
|
|
case 'i':
|
|
|
|
printf("%lu", ctx->ino);
|
|
|
|
break;
|
|
|
|
case 'j':
|
|
|
|
printf("%lu", ctx->ino2);
|
|
|
|
break;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
case 'm':
|
|
|
|
printf("%s", error_message(ctx->errcode));
|
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
case 'N':
|
Many files:
unix.c: Fix bug in check of feature set, to make sure we can really
fix this filesystem.
problem.h: Make blkcount type to be of type blkcnt_t. Make the num
field be a 64 bit type. Add the problem code PR_1_FEATURE_LARGE_FILES
problem.c: Add table entry for the problem code PR_1_FEATURE_LARGE_FILES.
pass1.c (e2fsck_pass1): A non-zero i_dir_acl field is only a problem
for directory inodes. (Since it is also i_size_high now.) If there
are no large_files, then clear the LARGE_FLAG feature flag. If there
are large_files, but the LARGE_FLAG feature flag is not set, complain
and offer to fix it.
(check_blocks): Add support to deal with non-directory inodes that
have i_size_high set (i.e., large_files). Don't give an error if a
directory has preallocated blocks, to support the DIR_PREALLOC
feature.
(process_block, process_bad_block): The blockcnt variable is a type of
blkcnt_t, for conversion to the new block_iterate2.
pass2.c (process_bad_inode): A non-zero i_dir_acl field is only a
problem for directory inodes. (Since it is also i_size_high now.)
message.c (expand_inode_expression): Print a 64-bits of the inode size
for non-directory inodes. (Directory inodes can only use a 32-bit
directory acl size, since i_size_high is shared with i_dir_acl.) Add
sanity check so that trying to print out the directory acl on a
non-directory inode will print zero. (expand_percent_expression): %B
and %N, which print pctx->blkcount and pctx->num, can now be 64 bit
variables. Print them using the "%lld" format if EXT2_NO_64_TYPE is
not defined.
e2fsck.h: Add the large_flagsfield to the e2fsck context.
e2fsck.c (e2fsck_reset_context): Clear the large_flags field.
ChangeLog, expect.1:
f_messy_inode: Modify test to deal with changes to support 64-bit size
files. (/MAKEDEV had i_dir_acl, now i_size_high, set.)
1998-03-24 19:22:38 +03:00
|
|
|
#ifdef EXT2_NO_64_TYPE
|
1997-04-29 20:15:03 +04:00
|
|
|
printf("%u", ctx->num);
|
Many files:
unix.c: Fix bug in check of feature set, to make sure we can really
fix this filesystem.
problem.h: Make blkcount type to be of type blkcnt_t. Make the num
field be a 64 bit type. Add the problem code PR_1_FEATURE_LARGE_FILES
problem.c: Add table entry for the problem code PR_1_FEATURE_LARGE_FILES.
pass1.c (e2fsck_pass1): A non-zero i_dir_acl field is only a problem
for directory inodes. (Since it is also i_size_high now.) If there
are no large_files, then clear the LARGE_FLAG feature flag. If there
are large_files, but the LARGE_FLAG feature flag is not set, complain
and offer to fix it.
(check_blocks): Add support to deal with non-directory inodes that
have i_size_high set (i.e., large_files). Don't give an error if a
directory has preallocated blocks, to support the DIR_PREALLOC
feature.
(process_block, process_bad_block): The blockcnt variable is a type of
blkcnt_t, for conversion to the new block_iterate2.
pass2.c (process_bad_inode): A non-zero i_dir_acl field is only a
problem for directory inodes. (Since it is also i_size_high now.)
message.c (expand_inode_expression): Print a 64-bits of the inode size
for non-directory inodes. (Directory inodes can only use a 32-bit
directory acl size, since i_size_high is shared with i_dir_acl.) Add
sanity check so that trying to print out the directory acl on a
non-directory inode will print zero. (expand_percent_expression): %B
and %N, which print pctx->blkcount and pctx->num, can now be 64 bit
variables. Print them using the "%lld" format if EXT2_NO_64_TYPE is
not defined.
e2fsck.h: Add the large_flagsfield to the e2fsck context.
e2fsck.c (e2fsck_reset_context): Clear the large_flags field.
ChangeLog, expect.1:
f_messy_inode: Modify test to deal with changes to support 64-bit size
files. (/MAKEDEV had i_dir_acl, now i_size_high, set.)
1998-03-24 19:22:38 +03:00
|
|
|
#else
|
|
|
|
printf("%llu", ctx->num);
|
|
|
|
#endif
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'p':
|
|
|
|
print_pathname(fs, ctx->ino, 0);
|
|
|
|
break;
|
|
|
|
case 'P':
|
|
|
|
print_pathname(fs, ctx->ino2,
|
|
|
|
ctx->dirent ? ctx->dirent->inode : 0);
|
|
|
|
break;
|
|
|
|
case 'q':
|
|
|
|
print_pathname(fs, ctx->dir, 0);
|
|
|
|
break;
|
|
|
|
case 'Q':
|
|
|
|
print_pathname(fs, ctx->dir, ctx->ino);
|
|
|
|
break;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
case 'S':
|
|
|
|
printf("%d", get_backup_sb(fs));
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
printf("%s", ctx->str);
|
|
|
|
break;
|
2000-08-14 18:25:19 +04:00
|
|
|
case 'X':
|
|
|
|
#ifdef EXT2_NO_64_TYPE
|
|
|
|
printf("0x%x", ctx->num);
|
|
|
|
#else
|
|
|
|
printf("0x%llx", ctx->num);
|
|
|
|
#endif
|
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
default:
|
|
|
|
no_context:
|
|
|
|
printf("%%%c", ch);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
void print_e2fsck_message(e2fsck_t ctx, const char *msg,
|
|
|
|
struct problem_context *pctx, int first)
|
1997-04-29 20:15:03 +04:00
|
|
|
{
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
ext2_filsys fs = ctx->fs;
|
1997-04-29 20:15:03 +04:00
|
|
|
const char * cp;
|
|
|
|
int i;
|
1999-07-19 19:27:37 +04:00
|
|
|
|
|
|
|
e2fsck_clear_progbar(ctx);
|
1997-04-29 20:15:03 +04:00
|
|
|
for (cp = msg; *cp; cp++) {
|
|
|
|
if (cp[0] == '@') {
|
|
|
|
cp++;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
expand_at_expression(ctx, *cp, pctx, &first);
|
1997-04-29 20:15:03 +04:00
|
|
|
} else if (cp[0] == '%' && cp[1] == 'I') {
|
|
|
|
cp += 2;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
expand_inode_expression(*cp, pctx);
|
1997-04-29 20:15:03 +04:00
|
|
|
} else if (cp[0] == '%' && cp[1] == 'D') {
|
|
|
|
cp += 2;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
expand_dirent_expression(*cp, pctx);
|
1997-04-29 20:15:03 +04:00
|
|
|
} else if ((cp[0] == '%')) {
|
|
|
|
cp++;
|
Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
routines. All diagnostic messages are now routed through the
fix_problem interface.
pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
PR_2_DUP_DOT_DOT.
problem.c: Added new problem codes for some of the superblock
corruption checks, and for the pass header messages. ("Pass
1: xxxxx")
util.c (print_resource_track): Now takes a description argument.
super.c, unix.c, e2fsck.c: New files to separate out the
operating-specific operations out from e2fsck.c. e2fsck.c now
contains the global e2fsck context management routines, and
super.c contains the "pass 0" initial validation of the
superblock and global block group descriptors.
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
(nearly) all global variables and moved them to the e2fsck
context structure.
problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
Updated tests to align with e2fsck problem.c changes.
1997-10-03 21:48:10 +04:00
|
|
|
expand_percent_expression(fs, *cp, pctx);
|
1997-04-29 20:15:03 +04:00
|
|
|
} else {
|
|
|
|
for (i=0; cp[i]; i++)
|
|
|
|
if ((cp[i] == '@') || cp[i] == '%')
|
|
|
|
break;
|
|
|
|
printf("%.*s", i, cp);
|
|
|
|
cp += i-1;
|
|
|
|
}
|
|
|
|
first = 0;
|
|
|
|
}
|
|
|
|
}
|