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
|
2009-10-05 02:02:24 +04:00
|
|
|
* %B <blkcount> interpret blkcount as blkcount
|
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
|
2001-08-04 11:47:01 +04:00
|
|
|
* %Di <dirent>->ino inode number
|
|
|
|
* %Dn <dirent>->name string
|
|
|
|
* %Dr <dirent>->rec_len
|
|
|
|
* %Dl <dirent>->name_len
|
|
|
|
* %Dt <dirent>->filetype
|
|
|
|
* %d <dir> inode number
|
1997-04-29 20:15:03 +04:00
|
|
|
* %g <group> integer
|
|
|
|
* %i <ino> inode number
|
|
|
|
* %Is <inode> -> i_size
|
2005-03-21 21:15:45 +03:00
|
|
|
* %IS <inode> -> i_extra_isize
|
1997-04-29 20:15:03 +04:00
|
|
|
* %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
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
* %Iu <inode> -> i_uid
|
|
|
|
* %Ig <inode> -> i_gid
|
2007-04-01 03:53:53 +04:00
|
|
|
* %It <inode type>
|
1997-04-29 20:15:03 +04:00
|
|
|
* %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.
|
2009-10-05 02:02:24 +04:00
|
|
|
* %r <blkcount> interpret blkcount as refcount
|
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:
|
|
|
|
*
|
2001-07-02 19:54:09 +04:00
|
|
|
* @a extended attribute
|
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
|
|
|
|
* @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
|
2002-06-26 07:26:34 +04:00
|
|
|
* @h HTREE directory inode
|
2001-01-03 22:38:04 +03:00
|
|
|
* @i inode
|
|
|
|
* @I illegal
|
|
|
|
* @j journal
|
1997-04-29 20:15:03 +04:00
|
|
|
* @l lost+found
|
|
|
|
* @L is a link
|
2005-06-19 17:45:36 +04:00
|
|
|
* @m multiply-claimed
|
|
|
|
* @n invalid
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
* @o orphaned
|
2002-06-26 07:26:34 +04:00
|
|
|
* @p problem in
|
2011-07-20 22:40:06 +04:00
|
|
|
* @q quota
|
1997-04-29 20:15:03 +04:00
|
|
|
* @r root inode
|
2008-08-28 07:07:54 +04:00
|
|
|
* @s should be
|
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 superblock
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
* @u unattached
|
2001-01-03 22:38:04 +03:00
|
|
|
* @v device
|
2007-08-21 05:31:11 +04:00
|
|
|
* @x extent
|
1997-04-29 20:15:03 +04:00
|
|
|
* @z zero-length
|
|
|
|
*/
|
|
|
|
|
2011-09-19 01:34:37 +04:00
|
|
|
#include "config.h"
|
1997-04-29 20:15:03 +04:00
|
|
|
#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[] = {
|
2001-07-02 19:54:09 +04:00
|
|
|
N_("aextended attribute"),
|
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"),
|
2001-01-03 18:34:20 +03:00
|
|
|
N_("jjournal"),
|
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_("Ddeleted"),
|
|
|
|
N_("ddirectory"),
|
|
|
|
N_("eentry"),
|
|
|
|
N_("E@e '%Dn' in %p (%i)"),
|
|
|
|
N_("ffilesystem"),
|
|
|
|
N_("Ffor @i %i (%Q) is"),
|
|
|
|
N_("ggroup"),
|
2002-06-26 07:26:34 +04:00
|
|
|
N_("hHTREE @d @i"),
|
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_("llost+found"),
|
|
|
|
N_("Lis a link"),
|
2005-06-19 17:45:36 +04:00
|
|
|
N_("mmultiply-claimed"),
|
|
|
|
N_("ninvalid"),
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
N_("oorphaned"),
|
2002-06-26 07:26:34 +04:00
|
|
|
N_("pproblem in"),
|
2011-07-20 22:40:06 +04:00
|
|
|
N_("qquota"),
|
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_("rroot @i"),
|
|
|
|
N_("sshould be"),
|
|
|
|
N_("Ssuper@b"),
|
Many files:
Makefile.in: Update the make dependencies
problem.c, problem.h: Add the problem codes:
PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
PR_0_ORPHAN_ILLEGAL_HEAD_INODE, PR_0_ORPHAN_ILLEGAL_INODE,
PR_0_ORPHAN_INODE_INUSE
super.c (release_inode_blocks, release_orphan_inodes,
check_super_block): Add support for clearing orphaned inodes from the
unmounted filesystem.
journal.c (e2fsck_recover_ext3_journal): Remove the last orphan check;
this is now handled in check_super_block --- non-journaled filesystems
can use the orphan list in the future. Also, move the the re-opening
of the filesystem to e2fsck_run_ext3_journal().
debugfs.c:
debugfs.c (finish_range): Make sure the pager FILE pointer to use.
configure, configure.in, ChangeLog:
configure.in (JFS_DEBUG): Add support for --enable-jfs-debug
2000-08-18 19:08:37 +04:00
|
|
|
N_("uunattached"),
|
2001-01-03 22:38:04 +03:00
|
|
|
N_("vdevice"),
|
2007-08-21 05:31:11 +04:00
|
|
|
N_("xextent"),
|
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_("zzero-length"),
|
1997-04-29 20:15:03 +04:00
|
|
|
"@@",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Give more user friendly names to the "special" inodes.
|
|
|
|
*/
|
2001-01-13 00:05:57 +03:00
|
|
|
#define num_special_inodes 11
|
1997-04-29 20:15:03 +04:00
|
|
|
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 */
|
2011-02-16 01:27:27 +03:00
|
|
|
N_("<The user quota inode>"), /* 3 */
|
|
|
|
N_("<The group quota inode>"), /* 4 */
|
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 boot loader inode>"), /* 5 */
|
2001-01-13 00:05:57 +03:00
|
|
|
N_("<The undelete directory inode>"), /* 6 */
|
|
|
|
N_("<The group descriptor inode>"), /* 7 */
|
|
|
|
N_("<The journal inode>"), /* 8 */
|
|
|
|
N_("<Reserved inode 9>"), /* 9 */
|
|
|
|
N_("<Reserved inode 10>"), /* 10 */
|
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.
|
|
|
|
*/
|
2012-03-18 07:21:00 +04:00
|
|
|
static void safe_print(FILE *f, 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) {
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs("M-", f);
|
1999-01-09 19:32:31 +03:00
|
|
|
ch -= 128;
|
|
|
|
}
|
1999-11-19 21:52:36 +03:00
|
|
|
if ((ch < 32) || (ch == 0x7f)) {
|
2012-03-18 07:21:00 +04:00
|
|
|
fputc('^', f);
|
1999-11-19 21:52:36 +03:00
|
|
|
ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
|
1999-01-09 19:32:31 +03:00
|
|
|
}
|
2012-03-18 07:21:00 +04:00
|
|
|
fputc(ch, f);
|
1999-01-09 19:32:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
/*
|
|
|
|
* This function prints a pathname, using the ext2fs_get_pathname
|
|
|
|
* function
|
|
|
|
*/
|
2012-03-18 07:21:00 +04:00
|
|
|
static void print_pathname(FILE *f, ext2_filsys fs, ext2_ino_t dir,
|
|
|
|
ext2_ino_t ino)
|
1997-04-29 20:15:03 +04:00
|
|
|
{
|
2012-11-29 16:47:53 +04:00
|
|
|
errcode_t retval = 0;
|
1997-04-29 20:15:03 +04:00
|
|
|
char *path;
|
|
|
|
|
|
|
|
if (!dir && (ino < num_special_inodes)) {
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_(special_inode_name[ino]), f);
|
1997-04-29 20:15:03 +04:00
|
|
|
return;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
|
2011-09-17 00:49:22 +04:00
|
|
|
if (fs)
|
|
|
|
retval = ext2fs_get_pathname(fs, dir, ino, &path);
|
|
|
|
if (!fs || retval)
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs("???", f);
|
1997-04-29 20:15:03 +04:00
|
|
|
else {
|
2012-03-18 07:21:00 +04:00
|
|
|
safe_print(f, path, -1);
|
2003-08-01 17:41:07 +04:00
|
|
|
ext2fs_free_mem(&path);
|
1997-04-29 20:15:03 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-18 07:21:00 +04:00
|
|
|
static void print_time(FILE *f, time_t t)
|
2009-08-08 18:14:48 +04:00
|
|
|
{
|
|
|
|
const char * time_str;
|
|
|
|
static int do_gmt = -1;
|
|
|
|
|
|
|
|
#ifdef __dietlibc__
|
|
|
|
/* The diet libc doesn't respect the TZ environemnt variable */
|
|
|
|
if (do_gmt == -1) {
|
|
|
|
time_str = getenv("TZ");
|
|
|
|
if (!time_str)
|
|
|
|
time_str = "";
|
|
|
|
do_gmt = !strcmp(time_str, "GMT0");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
time_str = asctime((do_gmt > 0) ? gmtime(&t) : localtime(&t));
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%.24s", time_str);
|
2009-08-08 18:14:48 +04:00
|
|
|
}
|
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
/*
|
|
|
|
* This function handles the '@' expansion. We allow recursive
|
|
|
|
* expansion; an @ expression can contain further '@' and '%'
|
2008-08-28 07:07:54 +04:00
|
|
|
* expressions.
|
1997-04-29 20:15:03 +04:00
|
|
|
*/
|
2012-03-18 07:21:00 +04:00
|
|
|
static _INLINE_ void expand_at_expression(FILE *f, e2fsck_t ctx, char ch,
|
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
|
|
|
struct problem_context *pctx,
|
2007-07-03 03:04:31 +04:00
|
|
|
int *first, int recurse)
|
1997-04-29 20:15:03 +04:00
|
|
|
{
|
|
|
|
const char **cpp, *str;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
/* Search for the abbreviation */
|
|
|
|
for (cpp = abbrevs; *cpp; cpp++) {
|
|
|
|
if (ch == *cpp[0])
|
|
|
|
break;
|
|
|
|
}
|
2007-07-03 03:04:31 +04:00
|
|
|
if (*cpp && recurse < 10) {
|
2003-04-28 01:34:14 +04:00
|
|
|
str = _(*cpp) + 1;
|
1997-04-29 20:15:03 +04:00
|
|
|
if (*first && islower(*str)) {
|
|
|
|
*first = 0;
|
2012-03-18 07:21:00 +04:00
|
|
|
fputc(toupper(*str++), f);
|
1997-04-29 20:15:03 +04:00
|
|
|
}
|
2012-03-18 07:21:00 +04:00
|
|
|
print_e2fsck_message(f, ctx, str, pctx, *first, recurse+1);
|
1997-04-29 20:15:03 +04:00
|
|
|
} else
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "@%c", ch);
|
1997-04-29 20:15:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
* This function expands '%IX' expressions
|
1997-04-29 20:15:03 +04:00
|
|
|
*/
|
2012-03-18 07:21:00 +04:00
|
|
|
static _INLINE_ void expand_inode_expression(FILE *f, ext2_filsys fs, char ch,
|
2004-12-01 03:57:20 +03:00
|
|
|
struct problem_context *ctx)
|
1997-04-29 20:15:03 +04:00
|
|
|
{
|
|
|
|
struct ext2_inode *inode;
|
2005-03-21 21:15:45 +03:00
|
|
|
struct ext2_inode_large *large_inode;
|
1997-04-29 20:15:03 +04:00
|
|
|
|
|
|
|
if (!ctx || !ctx->inode)
|
|
|
|
goto no_inode;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
inode = ctx->inode;
|
2005-03-21 21:15:45 +03:00
|
|
|
large_inode = (struct ext2_inode_large *) inode;
|
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
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))
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", inode->i_size);
|
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 {
|
|
|
|
#ifdef EXT2_NO_64_TYPE
|
|
|
|
if (inode->i_size_high)
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "0x%x%08x", inode->i_size_high,
|
|
|
|
inode->i_size);
|
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
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", inode->i_size);
|
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
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%llu", EXT2_I_SIZE(inode));
|
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
|
|
|
#endif
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
2005-03-21 21:15:45 +03:00
|
|
|
case 'S':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", large_inode->i_extra_isize);
|
2005-03-21 21:15:45 +03:00
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
case 'b':
|
2009-10-13 05:59:37 +04:00
|
|
|
if (fs->super->s_feature_ro_compat &
|
|
|
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%llu", inode->i_blocks +
|
|
|
|
(((long long) inode->osd2.linux2.l_i_blocks_hi)
|
|
|
|
<< 32));
|
2008-04-09 19:39:11 +04:00
|
|
|
else
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", inode->i_blocks);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'l':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%d", inode->i_links_count);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'm':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "0%o", inode->i_mode);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'M':
|
2012-03-18 07:21:00 +04:00
|
|
|
print_time(f, inode->i_mtime);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'F':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", inode->i_faddr);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'f':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%llu", ext2fs_file_acl_block(fs, inode));
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'd':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", (LINUX_S_ISDIR(inode->i_mode) ?
|
|
|
|
inode->i_dir_acl : 0));
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
case 'u':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%d", inode_uid(*inode));
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
break;
|
|
|
|
case 'g':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%d", inode_gid(*inode));
|
ChangeLog, journal.c, message.c, problem.c, problem.h, super.c:
journal.c (e2fsck_journal_load): Fix **nasty** bug which caused
e2fsck_check_ext3_journal to smash the journal because
journal->j_transaction_sequence wasn't getting initialized.
journal.c: (recover_ext3_journal, e2fsck_run_ext3_journal): Move call
to e2fsck_clear_recover from recover_ext3_journal to after the
filesystem has been closed and reopened. Otherwise, the superblock in
the filesystem handle will probably be stale, and will overwrite the
newer version of the superblock written by the log recovery.
message.c (expand_inode_expression): Add support for %Iu and %Ig
problem.h (PR_0_CLEAR_ORPHAN_INODE): Add new problem code.
super.c (release_orphan_inodes, release_inode_block,
release_inode_blocks): Update the block group descriptor counts when
freeing the orphan inode. Use PR_0_CLEAR_ORPHAN_INODE to report when
we clear an orphan.
journal.c (e2fsck_run_ext3_journal): Fix a bug where we attempted to
reopen the filesystem using the device name instead of the filesystem
name.
2000-08-21 02:06:31 +04:00
|
|
|
break;
|
2007-04-01 03:53:53 +04:00
|
|
|
case 't':
|
2008-08-28 07:07:54 +04:00
|
|
|
if (LINUX_S_ISREG(inode->i_mode))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_("regular file"), f);
|
2008-08-28 07:07:54 +04:00
|
|
|
else if (LINUX_S_ISDIR(inode->i_mode))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_("directory"), f);
|
2008-08-28 07:07:54 +04:00
|
|
|
else if (LINUX_S_ISCHR(inode->i_mode))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_("character device"), f);
|
2008-08-28 07:07:54 +04:00
|
|
|
else if (LINUX_S_ISBLK(inode->i_mode))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_("block device"), f);
|
2008-08-28 07:07:54 +04:00
|
|
|
else if (LINUX_S_ISFIFO(inode->i_mode))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_("named pipe"), f);
|
2008-08-28 07:07:54 +04:00
|
|
|
else if (LINUX_S_ISLNK(inode->i_mode))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_("symbolic link"), f);
|
2007-04-01 03:53:53 +04:00
|
|
|
else if (LINUX_S_ISSOCK(inode->i_mode))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputs(_("socket"), f);
|
2007-04-01 03:53:53 +04:00
|
|
|
else
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, _("unknown file type with mode 0%o"),
|
|
|
|
inode->i_mode);
|
2007-04-01 03:53:53 +04:00
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
default:
|
|
|
|
no_inode:
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%%I%c", ch);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function expands '%dX' expressions
|
|
|
|
*/
|
2012-03-18 07:21:00 +04:00
|
|
|
static _INLINE_ void expand_dirent_expression(FILE *f, ext2_filsys fs, char ch,
|
1997-04-29 20:15:03 +04:00
|
|
|
struct problem_context *ctx)
|
|
|
|
{
|
|
|
|
struct ext2_dir_entry *dirent;
|
2009-06-22 05:07:38 +04:00
|
|
|
unsigned int rec_len;
|
1997-04-29 20:15:03 +04:00
|
|
|
int len;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
if (!ctx || !ctx->dirent)
|
|
|
|
goto no_dirent;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
dirent = ctx->dirent;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
switch (ch) {
|
|
|
|
case 'i':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", dirent->inode);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'n':
|
1998-03-09 16:10:37 +03:00
|
|
|
len = dirent->name_len & 0xFF;
|
2009-06-22 05:07:38 +04:00
|
|
|
if ((ext2fs_get_rec_len(fs, dirent, &rec_len) == 0) &&
|
|
|
|
(len > rec_len))
|
|
|
|
len = rec_len;
|
2012-03-18 07:21:00 +04:00
|
|
|
safe_print(f, 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':
|
2009-06-22 05:07:38 +04:00
|
|
|
(void) ext2fs_get_rec_len(fs, dirent, &rec_len);
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", rec_len);
|
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;
|
|
|
|
case 'l':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%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':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", dirent->name_len >> 8);
|
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
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
default:
|
|
|
|
no_dirent:
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%%D%c", ch);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-18 07:21:00 +04:00
|
|
|
static _INLINE_ void expand_percent_expression(FILE *f, ext2_filsys fs,
|
|
|
|
char ch, int width, int *first,
|
1997-04-29 20:15:03 +04:00
|
|
|
struct problem_context *ctx)
|
|
|
|
{
|
2009-08-08 18:14:48 +04:00
|
|
|
e2fsck_t e2fsck_ctx = fs ? (e2fsck_t) fs->priv_data : NULL;
|
2009-10-05 02:02:24 +04:00
|
|
|
const char *m;
|
2009-08-08 18:14:48 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
if (!ctx)
|
|
|
|
goto no_context;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
switch (ch) {
|
|
|
|
case '%':
|
2012-03-18 07:21:00 +04:00
|
|
|
fputc('%', f);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'b':
|
2007-08-21 05:31:11 +04:00
|
|
|
#ifdef EXT2_NO_64_TYPE
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*u", width, (unsigned long) ctx->blk);
|
2007-08-21 05:31:11 +04:00
|
|
|
#else
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*llu", width, (unsigned long long) ctx->blk);
|
2007-08-21 05:31:11 +04:00
|
|
|
#endif
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'B':
|
2009-10-05 02:02:24 +04:00
|
|
|
if (ctx->blkcount == BLOCK_COUNT_IND)
|
|
|
|
m = _("indirect block");
|
|
|
|
else if (ctx->blkcount == BLOCK_COUNT_DIND)
|
|
|
|
m = _("double indirect block");
|
|
|
|
else if (ctx->blkcount == BLOCK_COUNT_TIND)
|
|
|
|
m = _("triple indirect block");
|
|
|
|
else if (ctx->blkcount == BLOCK_COUNT_TRANSLATOR)
|
|
|
|
m = _("translator block");
|
|
|
|
else
|
|
|
|
m = _("block #");
|
|
|
|
if (*first && islower(m[0]))
|
2012-03-18 07:21:00 +04:00
|
|
|
fputc(toupper(*m++), f);
|
|
|
|
fputs(m, f);
|
2009-10-05 02:02:24 +04:00
|
|
|
if (ctx->blkcount >= 0) {
|
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
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%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
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%lld", (long long) 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
|
|
|
#endif
|
2009-10-05 02:02:24 +04:00
|
|
|
}
|
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':
|
2007-08-21 05:31:11 +04:00
|
|
|
#ifdef EXT2_NO_64_TYPE
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*u", width, (unsigned long) ctx->blk2);
|
2007-08-21 05:31:11 +04:00
|
|
|
#else
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*llu", width, (unsigned long long) ctx->blk2);
|
2007-08-21 05:31:11 +04:00
|
|
|
#endif
|
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;
|
1997-04-29 20:15:03 +04:00
|
|
|
case 'd':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*u", width, ctx->dir);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'g':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*d", width, ctx->group);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'i':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*u", width, ctx->ino);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'j':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*u", width, ctx->ino2);
|
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 'm':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*s", width, error_message(ctx->errcode));
|
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;
|
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
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*u", width, 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
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*llu", width, (long long)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
|
|
|
#endif
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'p':
|
2012-03-18 07:21:00 +04:00
|
|
|
print_pathname(f, fs, ctx->ino, 0);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'P':
|
2012-03-18 07:21:00 +04:00
|
|
|
print_pathname(f, fs, ctx->ino2,
|
1997-04-29 20:15:03 +04:00
|
|
|
ctx->dirent ? ctx->dirent->inode : 0);
|
|
|
|
break;
|
|
|
|
case 'q':
|
2012-03-18 07:21:00 +04:00
|
|
|
print_pathname(f, fs, ctx->dir, 0);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
case 'Q':
|
2012-03-18 07:21:00 +04:00
|
|
|
print_pathname(f, fs, ctx->dir, ctx->ino);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
2009-10-05 02:02:24 +04:00
|
|
|
case 'r':
|
|
|
|
#ifdef EXT2_NO_64_TYPE
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*d", width, ctx->blkcount);
|
2009-10-05 02:02:24 +04:00
|
|
|
#else
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*lld", width, (long long) ctx->blkcount);
|
2009-10-05 02:02:24 +04:00
|
|
|
#endif
|
|
|
|
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':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%u", get_backup_sb(NULL, fs, NULL, NULL));
|
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;
|
|
|
|
case 's':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%*s", width, ctx->str ? ctx->str : "NULL");
|
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;
|
2009-08-08 18:14:48 +04:00
|
|
|
case 't':
|
2012-03-18 07:21:00 +04:00
|
|
|
print_time(f, (time_t) ctx->num);
|
2009-08-08 18:14:48 +04:00
|
|
|
break;
|
|
|
|
case 'T':
|
2012-03-18 07:21:00 +04:00
|
|
|
print_time(f, e2fsck_ctx ? e2fsck_ctx->now : time(0));
|
2009-08-08 18:14:48 +04:00
|
|
|
break;
|
2012-03-16 03:29:19 +04:00
|
|
|
case 'x':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "0x%0*x", width, ctx->csum1);
|
2012-03-16 03:29:19 +04:00
|
|
|
break;
|
2000-08-14 18:25:19 +04:00
|
|
|
case 'X':
|
|
|
|
#ifdef EXT2_NO_64_TYPE
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "0x%0*x", width, ctx->num);
|
2000-08-14 18:25:19 +04:00
|
|
|
#else
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "0x%0*llx", width, (long long)ctx->num);
|
2000-08-14 18:25:19 +04:00
|
|
|
#endif
|
|
|
|
break;
|
2012-03-16 03:29:19 +04:00
|
|
|
case 'y':
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "0x%0*x", width, ctx->csum2);
|
2012-03-16 03:29:19 +04:00
|
|
|
break;
|
1997-04-29 20:15:03 +04:00
|
|
|
default:
|
|
|
|
no_context:
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%%%c", ch);
|
1997-04-29 20:15:03 +04:00
|
|
|
break;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
|
2012-03-18 07:21:00 +04:00
|
|
|
void print_e2fsck_message(FILE *f, e2fsck_t ctx, const char *msg,
|
2007-07-03 03:04:31 +04:00
|
|
|
struct problem_context *pctx, int first,
|
|
|
|
int recurse)
|
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;
|
2012-03-16 02:24:42 +04:00
|
|
|
int i, width;
|
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++;
|
2012-03-18 07:21:00 +04:00
|
|
|
expand_at_expression(f, ctx, *cp, pctx, &first,
|
|
|
|
recurse);
|
2012-03-16 02:24:42 +04:00
|
|
|
} else if (cp[0] == '%') {
|
1997-04-29 20:15:03 +04:00
|
|
|
cp++;
|
2012-03-16 02:24:42 +04:00
|
|
|
width = 0;
|
|
|
|
while (isdigit(cp[0])) {
|
|
|
|
width = (width * 10) + cp[0] - '0';
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
if (cp[0] == 'I') {
|
|
|
|
cp++;
|
2012-03-18 07:21:00 +04:00
|
|
|
expand_inode_expression(f, fs, *cp, pctx);
|
2012-03-16 02:24:42 +04:00
|
|
|
} else if (cp[0] == 'D') {
|
|
|
|
cp++;
|
2012-03-18 07:21:00 +04:00
|
|
|
expand_dirent_expression(f, fs, *cp, pctx);
|
2012-03-16 02:24:42 +04:00
|
|
|
} else {
|
2012-03-18 07:21:00 +04:00
|
|
|
expand_percent_expression(f, fs, *cp, width,
|
2012-03-16 02:24:42 +04:00
|
|
|
&first, pctx);
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
} else {
|
|
|
|
for (i=0; cp[i]; i++)
|
|
|
|
if ((cp[i] == '@') || cp[i] == '%')
|
|
|
|
break;
|
2012-03-18 07:21:00 +04:00
|
|
|
fprintf(f, "%.*s", i, cp);
|
1997-04-29 20:15:03 +04:00
|
|
|
cp += i-1;
|
|
|
|
}
|
|
|
|
first = 0;
|
|
|
|
}
|
|
|
|
}
|