Commit Graph

145 Commits (master)

Author SHA1 Message Date
Theodore Ts'o b0258cbcd8 e2fsck: Fix warn_unused_result warnings from gcc
Fixed a potential bug where by partial returns from the write(2)
system call could lost characters to be sent to external progress bar
display program.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-04-22 15:09:41 -04:00
Theodore Ts'o 7dca4c88f1 e2fsck: When repacking directories, leave slack space for more efficiency
If the directory is packed with no slack space, as soon as any new
directory entries are added, leaf nodes end up getting split and
directory ends up getting very inefficient.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-25 17:59:36 -05:00
Theodore Ts'o ce44d8cafa e2fsck: In verbose mode, distinguish between fragmented directories/files
Track the number of non-contiguous files and directories so we can
give more detailed information in verbose mode.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-08 21:33:11 -05:00
Theodore Ts'o 80875db58a e2fsck: Offer to clear the test_fs flag if ext4 is available
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-10-12 23:12:23 -04:00
Eric Sandeen 79cc336282 e2fsck: exit from preenhalt if IO errors were encountered
If a block device is read-only, e2fsck -p gets into an infinite loop
trying to preenhalt, closing and flushing the fs, which tries to flush
the cache, which gets a write error and calls preenhalt which tries to
close and flush the fs ... ad infinitum.

Per Ted's suggestion just flag the ctx as "exiting" and short-circuit
the infinite loop.

Tested by running e2fsck -p on a block device set read-only by BLKROSET.

Thanks to Vlado Potisk for reporting this.

Addresses-Red-Hat-Bugzilla: #465679

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-10-12 23:12:22 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o 8da6d1a18a e2fsck: Fix ind/dind/tind statistics and add extent depth statistics
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-14 09:48:07 -04:00
Theodore Ts'o 63b5e354d9 e2fsck: Fix check to see if an extent-based file is fragmented
Also added support for "e2fsck -E fragcheck" which issues a
comprehensive report of discontiguous file extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-10 22:43:24 -04:00
Theodore Ts'o 51d12cebb6 Add CRC32 (big-endian) routine for use by journal checksums
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-06 23:38:38 -04:00
Jose R. Santos 49a7360ba6 Make e2fsck uninit block group aware
This patch has all the necesary pieces to open and fix filesystems created
with the uninit block group feature.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20 15:33:12 -04:00
Theodore Ts'o 7cadc57780 e2fsck: Support long symlinks which use extents
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 23:05:00 -04:00
Andreas Dilger fefaef39e0 Improve support for in-inode EA's
Add vertificaton of the in-inode EA information, and allow in-inode
EA's to have a checksum.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 21:20:26 -05:00
Theodore Ts'o e3df15abdb e2fsck: factor out code to clear an inode into e2fsck_clear_inode()
Factor out code to clear a bogus inode and update e2fsck's internal
data structures accordingly into a common routine,
e2fsck_clear_inode().  This saves about 200 bytes in the compiled x86
e2fsck executable, and makes the code more maintainable in the
long-term.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 15:27:04 -05:00
Theodore Ts'o 2628a1d3e1 Merge branch 'maint' 2007-10-06 12:41:26 -04:00
Theodore Ts'o 0c37f456d9 e2fsck: backup superblocks if key constants have changed
If the primary superblock differs from the backup superblock in
certain key respects, force a full check (if e2fsck was invoked in
preen mode).  If the filesystem check passes cleanly, and the
filesystem was opened in read/write mode, then write the primary
superblock to all of the backups.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-10-06 12:39:57 -04:00
Theodore Ts'o 60702c267d Work around lame Ubuntu init scripts / installer bugs
The Ubuntu init scripts don't properly set the system time correctly
from hardware clock if the hardware clock is configured to tick local
time instead of GMT time.

Work around this as best as we can by providing an option in
/etc/e2fsck.conf which can be set on Ubuntu systems:

[options]
	buggy_init_scripts = 1

Addresses-Debian-Bug: #441093
Addresses-Ubuntu-Bug: #131201

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-22 20:43:11 -04:00
Theodore Ts'o 1a855cb21f Remove e2fsck's -s and -S options to byte-swap ancient PPC filesystems
The need for fixing byte-swapped filesystems is long-gone, and this is
getting in the way of cleaning up e2fsprogs's bitmaps code.  So let's
get rid of it; modern kernels haven't been able to deal with a
byte-swapped filesystem in in about 9 years.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-11 01:58:21 -04:00
Theodore Ts'o aef2283196 Merge branch 'maint' 2007-08-03 23:21:34 -04:00
Theodore Ts'o 9f0288d3bb e2fsck: Allow i_size to be rounded up to the size of a VM page
Allow files to be preallocated on-disk up to the next multiple of the
system's page size without complaining about extra blocks.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 20:43:37 -04:00
Theodore Ts'o 6d96b00d57 Add I/O statistics to e2fsck
This patch instruments the libext2fs unix I/O manager and adds bytes
read/written and data rate to e2fsck -tt pass/overall timing output.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 20:07:09 -04:00
Theodore Ts'o d2af1bdd05 Fix e2fsck's get_size logic so it will work with the Linux floppy driver
The Linux floppy driver is a bit different from the other block device
drivers, in that if the device has been opened with O_EXCL, it disallows
another open(), even if the second open() does not have the O_EXCL flag.
So this patch moves the call to ext2fs_get_device_size() so that if it
returns EBUSY, e2fsck can close the filesystem, retry the device size,
and then reopen it.  This rather complicated approach is required since
we need to know the blocksize of the filesystem before we can call
ext2fs_get_device_size().

Addresses Debian Bug: #410569

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-04 01:14:52 -04:00
Theodore Ts'o 34b9f79639 Enable e2fsck to use the tdb library for the inode count abstraction
If e2fsck.conf configures a scratch_files directory which is available,
and the number of directories exceeds scratch_files.numdirs_threshold,
then try to use the tdb library to store the inode count abstraction.
This allows us to check very large filesystems without needing as much
physical memory.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-06 18:43:11 -04:00
Theodore Ts'o 28db82a84a Rework e2fsck's dirinfo abstraction to be more friendly for databases
Change the iterator abstraction and replace e2fsck_get_dir_info() with
e2fsck_dir_info_{set,get}_{parent,dotdot} so that we can support an
on-disk dirinfo implementation.  This allows e2fsck to check very large
filesystems on systems with smaller amounts of memory and/or address
space.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-04 22:33:31 -04:00
Eric Sandeen d0ff90d520 Fix signed vs unsigned printf format strings for block and inode numbers
There were still some %d's lurking when we print blocks & inodes; also
many of the counters in the e2fsck_struct were signed, and probably
need to be unsigned to avoid overflows.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:15 -04:00
Andreas Dilger 5656612910 Minor fix to prevent e2fsck.h being included twice:
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2006-06-28 11:26:42 -04:00
Matthias Andree 9e0cbba89b Add prototype for e2fsck_write_inode_full.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 16:29:15 +02:00
Theodore Ts'o b1c52b26a4 Enhance e2fsck so it can fix external journal hint in the superblock
Check to see if the superblock hint for the external journal needs to
be updated, and if so, offer to update it.  (Addresses Debian Bug:
#355644)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-10 15:25:59 -05:00
Theodore Ts'o 1017f65179 Read in /etc/e2fsck.conf configuration file at startup
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31 00:00:10 -05:00
Theodore Ts'o 1f3ad14a5a Use a centrally stored current time for "now" which
can be overridden using the E2FSCK_TIME environment 
variable, for better reproducibility for regression tests.
2005-04-14 14:07:53 -04:00
Theodore Ts'o c3ffaf833b Add support to detect corrupted resize_inode's to e2fsck. 2004-12-24 01:42:22 -05:00
Theodore Ts'o 2e8ca9a26b Add support for passing options to the io layer using the URL syntax. For
example, /tmp/test.img?offset=1024.  Multiple options can separated using
the & character, although at the moment the only option implemented is
the offset option in the unix_io layer.
2004-11-30 14:07:11 -05:00
Theodore Ts'o 6c7d61da00 e2fsck.h (E2F_FLAG_RESTARTED): Assign a unique flag bitfield to
E2F_FLAG_RESTARTED.  This fixes a bug where if the user
	specifies an alternate superblock, and the journal needs
	to be replayed, e2fsck would erroneously assume that
	journal had been run already without clearing the
	NEEDS_RECOVERY flag, and bomb out with an error.
2003-12-11 01:00:21 -05:00
Theodore Ts'o 3ddf2f662e When testing a disk using e2fsck -c, use the list
of new bad blocks to replace the current list of bad
blocks.  This way "e2fsck -c" can be used to recover from
a corrupted bad block inode.
2003-12-02 07:56:42 -05:00
Theodore Ts'o 54a31a3b2e e2fsck.h, unix.c (PRS, e2fsck_clear_progbar,
e2fsck_simple_progress): Don't print the ^A and ^B
	characters which bracket the progress bar when the e2fsck
	program is talking directly to a tty, but only when it is
	being piped to another program.  (Addresses Debian bug
	#204137)
unix.c: Move some initialized variables to the BSS segment to 
	shrink the size of the e2fsck executable.
2003-08-19 10:08:34 -04:00
Theodore Ts'o 113e405bb6 unix.c (show_stats), e2fsck.h: Use ngettext (abbreivated with
the macro P_(str1, str2, n)) to simplify the statistics
	reporting.
2003-05-17 21:00:46 -04:00
Theodore Ts'o a04eba3f88 Update to gettext 0.11.5. We now enable NLS support by default.
Fixed up support for using the internal intl library.
2003-05-03 16:35:17 -04:00
Theodore Ts'o 520ead378e Fix gcc -Wall warnings. 2003-04-19 13:48:27 -04:00
Theodore Ts'o b0700a1b60 Change e2fsck to detect and offer to delete or rename duplicate
filenames in directories when rebuilding directories using
"e2fsck -fD /dev/XXX"
2003-03-14 01:43:56 -05:00
Theodore Ts'o f364093b19 Update debugfs and e2fsck to use the blkid library. 2003-03-01 19:47:44 -05:00
Theodore Ts'o b92ae1535c Detect if there is an attempt to run the journal twice, and
abort the e2fsck run with an error if this is the case.
(Address IBM Bugzilla bug #1226)
2003-01-02 16:53:54 -05:00
Theodore Ts'o ee895139d7 e2fsck.h, unix.c (main, check_mount): Fix e2fsck so that it
returns the appropriate exit code, so that the boot
	scripts will be told that they need to automatically
	reboot.
2002-11-07 16:16:55 -05:00
Theodore Ts'o ad4fa46604 Avoid counting directory entries during a directory salvage.
Add additional checks to HTREE directories.  We now check the count
and limit fields in the htree header, as well as assuring that the
hash table in each interior node is in ascending order.  We also
check to make sure all leaf nodes are have the expected depth in 
the tree.

Updated test cases to deal with all of the above.
2002-09-30 11:19:19 -04:00
Theodore Ts'o 0684a4f33b Overhaul extended attribute handling. Should now be correct with
respect to the latest V2 bestbits ACL code.
2002-08-17 10:19:44 -04:00
Theodore Ts'o 850d05e9aa Add e2fsck -D option which optimizes/compresses directories.
General cleanup of rehash code.  (Fixed a few bugs, reformatted
code to make it more maintainable, etc.)
2002-07-25 00:00:08 -04:00
Theodore Ts'o 4cae04529e Add SIGINT and SIGTERM handling to fsck and e2fsck. For e2fsck,
make sure we gracefully clean up and only exit at safe points.
For fsck, we pass the SIGINT/SIGTERM signal to the child processes,
so they can do their own cleanup.
2002-07-21 14:14:03 -04:00
Theodore Ts'o b7a00563b2 Add support to e2fsck to reindex directories to use hash trees. 2002-07-20 00:28:07 -04:00
Theodore Ts'o 8fdc9985c1 Add initial support for htree directories. 2002-06-25 23:26:34 -04:00
Theodore Ts'o bcf9c5d401 Fix up Andreas' changeset. Avoid use of dynamic automatic arrays,
and check for EXT2_INDEX_FL for special devices, and consider them to
be invalid if they are set.
2002-05-21 09:14:17 -04:00
Theodore Ts'o 3ed57c27df In mke2fs and e2fsck, specifying the -c option twice will now do
a read/write test on the disk.  Update the man pages to encourage
using the -c option, and to discouraging running badblocks separately,
since users tend to forget to set the blocksize when running 
badblocks.
2001-12-24 15:01:59 -05:00
Theodore Ts'o f1a1761d67 Enhnaced the get backup superblock function so that it does
the right thing if the filesystem superblock is unavailable; 
it will search for the superblock by iterating over possible
blocksizes.
2001-12-23 22:27:52 -05:00
Theodore Ts'o d37066a9fa Give the opportunity for e2fsck to run the journal even if
recovery flag is cleared.  If we're using a backup
superblock, run the journal by default.
2001-12-21 23:28:54 -05:00
Theodore Ts'o 4ea7bd0439 Fix various gcc -Wall nits. Fixed a bug in mke2fs where a bogus
error message could be printed on an malloc() failure, and e2image
was optimized to avoid needless system calls by using the stashed
inode functions.
2001-12-16 23:23:37 -05:00
Theodore Ts'o 773fd8a1d4 e2fsck.h, journal.c (e2fsck_move_ext3_journal): Add new function
which will automatically relocate the ext3 journal from a
	visible file to an invisible journal file if the
	filesystem has been opened read/write.

super.c (check_super_block): Add call to e2fsck_move_ext3_journal

problem.c, problem.h (PR_0_MOVE_JOURNAL, PR_0_ERR_MOVE_JOURNAL):
	Add new problem codes.
2001-10-06 21:26:27 -04:00
Theodore Ts'o ae6cdcf74a e2fsck: If a superblock is specified explicitly by the
user, don't try to automatically fall back to an
	alternate superblock.
2001-09-19 15:17:25 -04:00
Andreas Dilger 67052a8aee Add extra checks for bad symlinks, including zero length symlinks,
too long i_size for slow and fast symlinks, i_size_high set, multiple
blocks for slow symlinks.
2001-08-04 00:51:18 -06:00
Theodore Ts'o adee8d75db Add support for use of an external journal (so long as the external
journal only has one filesystem).
2001-07-23 00:17:49 -04:00
Theodore Ts'o 55fd07ed0a This patch completes the initial extended attribute/ACL support for
e2fsck.  We now check the entire EA block to make sure that the all
of the EA entries look sane.
2001-07-19 16:31:25 -04:00
Theodore Ts'o 342d847db3 Add initial support for extended attribute blocks 2001-07-02 11:54:09 -04:00
Theodore Ts'o 54c637d4d2 Many files:
badblocks.c, chattr.c, dumpe2fs.c, e2image.c, findsuper.c, lsattr.c,
  	mke2fs.c, mklost+found.c, tune2fs.c, util.c: Change location of
  	ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, resize2fs.h:
  resize2fs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, debugfs.h:
  debugfs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, e2fsck.h, scantest.c:
  e2fsck.h, scantest.c: Change location of ext2_fs.h to be
  	ext2fs/ext2_fs.h
ChangeLog, Makefile.in, tst_uuid.c, uuid_time.c:
  tst_uuid.c, uuid_time.c: Remove unneeded #include of ext2_fs.h
ChangeLog, Makefile.in, e2p.h:
  e2p.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, test_icount.c, test_rel.c:
  test_icount.c, test_rel.c: Change location of ext2_fs.h to be
  	ext2fs/ext2_fs.h
2001-05-14 11:45:38 +00:00
Theodore Ts'o 424cd2beb7 ChangeLog, e2fsck.h, journal.c, problem.c, problem.h, super.c:
super.c (check_super_block): Be more strict on checking
  	s_r_blocks_count superblock field.
  problem.c, problem.h (PR_0_JOURNAL_UNSUPP_ROCOMPAT,
  	PR_0_JOURNAL_UNSUPP_INCOMPAT, PR_0_JOURNAL_RESET_COMPAT): New problem
  	codes.
  journal.c (e2fsck_journal_load): Use a problem code to report
  	unsupported feature flags.  There is code to clear unsupported flags,
  	but since this is dangerous, it's not allowed in the problem code
  	table.
  journal.c (e2fsck_journal_reset_super): initialize the journal
  	sequence number to a random value to avoid recovering bad transactions
  	from a corrupt journal.
2001-05-14 04:06:56 +00:00
Theodore Ts'o 5ba23cb149 ChangeLog, e2fsck.h, flushb.c, iscan.c, unix.c:
iscan.c, unix.c, e2fsck.h: Don't use NOARGS, and use
  	ext2fs_sync_device() instead of using BLKFLSBUF.
  flushb.c: Don't use NOARGS anymore; everything is STDC these days.
ChangeLog, pass1.c:
  pass1.c (process_block): Remove dead code which was never getting
  	executed.
2001-01-11 19:15:02 +00:00
Theodore Ts'o 86c627ec11 Many files:
dirinfo.c, e2fsck.h, emptydir.c, iscan.c, jfs_user.h, journal.c,
  	message.c, pass1.c, pass1b.c, pass2.c, pass3.c, pass4.c, pass5.c,
  	problem.h, scantest.c, super.c, swapfs.c: Change ino_t to ext2_ino_t.
2001-01-11 15:12:14 +00:00
Theodore Ts'o 3b5386dca8 Many files:
journal.c: implement loading of ext3 journal for recovery code
  problem.c (fix_problem): return answer from PR_AFTER_CODE to caller.
  	Add journal problems.
  recovery.c (journal_recover): user-space ext3 journal recovery code
  unix.c (main) : check journal and do recovery in separate steps
  jfs.h, recovery.c: Files ext3 kernel code.
  jfs_compat.h: Compatibility header file to allow kernel code to be
  	linked to e2fsck.
2000-08-14 14:25:19 +00:00
Theodore Ts'o 17390c047f ChangeLog, Makefile.in, e2fsck.h, journal.c, unix.c:
unix.c (check_if_skip): Modify algorithm for checking s_max_mnt_count
  	to match with the kernel.  (If s_max_mnt_count is negative, ignore the
  	mnt_count check.)
  unix.c (e2fsck_update_progress): Adjust the width of the progress bar
  	dynamically, based on the filesystem name that we need to display.
  unix.c (main): If the ext3 needs_recovery flag is set, call
  	e2fsck_run_ext3_journal() and then restart the e2fsck run.
  journal.c (e2fsck_run_ext3_journal): New file which contains logic to
  	recover the ext3 journal.  This version relies on the kernel being
  	able to mount the filesystem in order to run the journal.
2000-07-07 04:13:21 +00:00
Theodore Ts'o 0601232332 ChangeLog, e2fsck.h, unix.c:
unix.c (e2fsck_update_progress): Limit the number of updates to the
  	progress bars to 8 times a second.  This allows a 9600 baud console
  	link to keep up.
2000-02-12 20:12:43 +00:00
Theodore Ts'o 80c5d7e45f ChangeLog, e2fsck.h, pass1.c, pass1b.c:
e2fsck.h:
  pass1.c (mark_table_blocks, e2fsck_pass1): Remove
  	ctx->block_illegal_map, since it's not needed by pass1, and pass1b has
  	been modified to calculate it manually if needed.  This reduces the
  	memory footprint needed by e2fsck.
  pass1b.c (check_if_fs_block): New static function which returns
  	whether or not a block overlaps with filesystem metadata.  This
  	replaces consulting the block_illegal_map bitmap.
util.c:
  Make resource tracking message more concise.
2000-02-08 23:19:32 +00:00
Theodore Ts'o 28ffafb09c ChangeLog, bitops.h:
bitops.h (ext2fs_mark_generic_bitmap, ext2fs_unmark_generic_bitmap,
  	ext2fs_mark_block_bitmap, ext2fs_unmark_block_bitmap,
  	ext2fs_mark_inode_bitmap, ext2fs_unmark_inode_bitmap): Change to
  	return the previous state of the bit that is being marked or unmarked.
  	For speed optimization.
ChangeLog, pass3.c:
  pass3.c (check_directory): Only do the loop detection algorithm if
  	we've searched over 2048 parent directories and haven't found the end
  	yet.  This means that in the common case, we don't allocate or clear
  	the inode_loop_detection bitmap, which for large systems, merely
  	clearing the bitmap for each directory was turning out to be quite
  	expensive.  Thanks to Jani Jaakkola (jjaakkol@cs.helsinki.fi) for
  	identifying this problem.
ChangeLog, Makefile.in, e2fsck.h, unix.c:
  Makefile.in: Call sync after finishing building all in this directory.
  unix.c (PRS): sync the filesystem before trying to use BLKFLSBUF, to
  	minimize the chance of causing dirty blocks to get dropped.
  e2fsck.h: Manually define BLKFLSBUF if not defined, and we're on a
  	Linux/i386 system.
2000-02-08 19:14:02 +00:00
Theodore Ts'o 0c4a07264e 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 03:11:03 +00:00
Theodore Ts'o 80e808fceb ChangeLog, debugfs.c:
debugfs.c (dump_inode): Remove #ifdef for i_version vs. i_generation
  	since we know it will always be i_generation now.
ChangeLog, e2fsck.h, flushb.c, scantest.c:
  e2fsck.h, flushb.c, scantest.c: Remove uneeded include of linux/fs.h
bmap.c:
  Fix silly spelling typo.
ChangeLog, getsize.c, ismounted.c, swapfs.c:
  getsize.c, ismounted.c: Remove unneeded include of linux/fs.h
  swapfs.c: Remove #ifdef HAVE_EXT2_INODE_VERSION since it's not needed
  	any more; we know it will always be i_generation.  Add support for
  	swapping the high bits of the uid and gid.
2000-02-02 16:19:59 +00:00
Theodore Ts'o 6fdc7a325c ChangeLog, e2fsck.h, pass1.c, pass2.c, pass3.c, problem.c, problem.h, util.c:
pass1.c (e2fsck_pass1): If the filesystem does not support imagic
  	inodes, if an inode has the imagic flag set, offer to clear the imagic
  	flag.  If a valid device/fifo/socket has the immutable flag set, call
  	the new helper function check_immutable() to offerto clear the
  	immutable flag.
  pass2.c (check_filetype): Use the new ext2_file_type() helper function
  	instead of calculating the file_type information manually.
  pass3.c (e2fsck_reconnect_file): When adding a link to lost+found,
  	calculate the filetype information so that ext2fs_link() can use the
  	information if applicable.  (get_lost_and_found): Create the
  	/lost+found directory with the correct filetype information if
  	applicable.
  util.c (ext2_file_type), e2fsck.h: New function which returns the
  	directory entry file type information given the inode's mode bits.
  problem.c, problem.h: Added new problem codes PR_1_SET_IMAGIC and
  	PR_1_SET_IMMUTABLE.
ChangeLog, mke2fs.8.in:
  mke2fs.8.in: Update manual page so that the sparse_option filesystem
  	option is properly named.
1999-11-10 13:34:40 +00:00
Theodore Ts'o aa4115a47c 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 19:33:18 +00:00
Theodore Ts'o 5596defa1e Many files:
unix.c: Add support for calculating a progress bar if the -C0 option
  	is given.  The function e2fsck_clear_progbar() clears the progress bar
  	and must be called before any message is issued.  SIGUSR1 will enable
  	the progress bar, and SIGUSR2 will disable the progress bar.  This is
  	used by fsck to handle parallel filesystem checks.  Also, set the
  	device_name from the filesystem label if it is available.
  e2fsck.h: Add new flags E2F_FLAG_PROG_BAR and E2F_FLAG_PROG_SUPRESS.
  	Add new field in the e2fsck structure which contains the last tenth of
  	a percent printed for the user.
  message.c (print_e2fsck_message): Add call to e2fsck_clear_progbar().
  pass1.c (e2fsck_pass1):
  pass2.c (e2fsck_pass2):
  pass3.c (e2fsck_pass3):
  pass4.c (e2fsck_pass4):
  pass5.c (e2fsck_pass5): Add call to e2fsck_clear_progbar when printing
  	the resource tracking information.
  pass5.c (check_block_bitmaps, check_inode_bitmaps): If there is an
  	error in the bitmaps, suppress printing the progress bar using the
  	suppression flag for the remainder of the check, in order to clean up
  	the display.
1999-07-19 15:27:37 +00:00
Theodore Ts'o e72a9ba394 ChangeLog, e2fsck.h, pass1.c, pass2.c, pass4.c, swapfs.c:
e2fsck.h:
  pass1.c (pass1_get_blocks, pass1_read_inode, pass1_write_inode,
  	pass1_check_directory, e2fsck_use_inode_shortcuts): Make pass1_* be
  	private static functions, and create new function
  	e2fsck_use_inode_shortcuts which sets and clears the inode shortcut
  	functions in the fs structure.
  e2fsck.h:
  pass2.c (e2fsck_process_bad_inode): Make process_bad_inode() an
  	exported function.
  pass4.c (e2fsck_pass4): Call e2fsck_process_bad_inode to check if a
  	disconnected inode has any problems before connecting it to
  	/lost+found.  Bug and suggested fix by Pavel Machek <pavel@bug.ucw.cz>
ChangeLog, swapfs.c:
  swapfs.c (ext2fs_swap_inode): Add compatibility for Linux 2.3 kernels
  	that use i_generation instead of i_version.  Patch supplied by Jon
  	Bright <sircus@sircus.demon.co.uk>.
ChangeLog, mke2fs.8.in:
  mke2fs.8.in: Fix typo in man page which caused the badblocks command
  	to not show up in the "SEE ALSO" section.
ChangeLog, expect.1, expect.2, image.gz, name:
  f_recnect_bad: New test which checks the case where a disconnect inode
  	also bad inode fields; we need to make sure e2fsck offers to fix the
  	inode (or clear the inode, as necessary).
1999-06-25 15:40:18 +00:00
Theodore Ts'o efac9a1b8d ChangeLog, e2fsck.8.in, e2fsck.h, pass5.c, unix.c:
unix.c (PRS): Added new option -C, which causes e2fsck to print
  	progress updates so that callers can keep track of the completion
  	progress of e2fsck.  Designed for use by progress, except for -C 0,
  	which prints a spinning report which may be useful for some users.
  pass5.c (e2fsck_pass5): Use a finer-grained progress reporting scheme
  	(useful for larger filesystems).
  e2fsck.h: Add progress_fd and progress_pos, for use by the Unix
  	progress reporting functions.
1998-05-07 05:02:00 +00:00
Theodore Ts'o 4c77fe50d9 ChangeLog, e2fsck.h, pass1.c, super.c:
pass1.c (process_inode_cmp): Use EXT2_QSORT_TYPE to define the
  	appropriate return type for comparison functions for qsort.
  e2fsck.h: Add #ifdef protection for unistd.h
  super.c: Remove header files already included by e2fsck.h
ChangeLog, dblist.c, ext2fs.h:
  ext2fs.h: Define EXT2_QSORT_TYPE appropriately for the return type for
  	comparison functions for qsort.
  dblist.c (dir_block_cmp): Use EXT2_QSORT_TYPE in function declaration.
ChangeLog, extent.c:
  extent.c (ext2fs_create_extent_table): Use ext2fs_free_mem instead of
  	free().
  (extent_cmp): Use EXT2_QSORT_TYPE to define the appropriate return
  	type for comparison functions for qsort.
1998-04-30 17:35:59 +00:00
Theodore Ts'o 17dba281a0 ChangeLog, e2fsck.h, pass4.c, super.c:
super.c, e2fsck.h: Always declare e2fsck_get_device_size() as an
  	extern in e2fsck.h to prevent -Wall warnings.
  pass4.c (e2fsck_pass4): Remove unused variable 'j'.
  super.c (check_super_block): Fix broken superblock sanity check when
  	calculating blocks_per_group if s_log_frag_size != s_log_block_size.
  	Since we don't support fragments, this isn't a bug deal, but it's good
  	to get it fixed.
ChangeLog, Makefile.elf-lib:
  Makefile.elf-lib (installdirs): Change use of DLL_INSTALL_DIR to
  	ELF_INSTALL_DIR.  (Doesn't make a difference currently, but it's
  	correct this way.)
ChangeLog, fgetversion.c, getversion.c:
  getversion.c (getversion): Return 0 if there's no error.
  fgetversion.c (fgetversion): Pass the address of the temporary
  	variable instead of the unitialized variable to the
  	EXT2_IOC_GETVERSION ioctl.
1998-03-30 01:16:26 +00:00
Theodore Ts'o 246501c612 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 16:22:38 +00:00
Theodore Ts'o 2df1f6aa07 ChangeLog, e2fsck.c, e2fsck.h, pass1.c:
e2fsck.c (e2fsck_run): Since E2F_FLAG_SIGNAL_MASK doesn't
  	include EXT2_FLAG_RESTART anymore, we need to adjust this
  	routine so that it *does* return in the case of it seeing
  	EXT2_FLAG_RESTART.
  pass1.c (e2fsck_pass1): ext2_get_next_inode() may call the group done
  	callback function, which may set context abort flags.  So we need to
  	test the context abort flags after we call ext2_get_next_inode().
  	(process_inodes): If we abort due out of process_inodes, do a clean
  	exit by breaking out of the for loop instead of just returning.
  e2fsck.h (E2F_FLAG_SIGNAL_MASK): EXT2_FLAG_RESTART shouldn't be
  	considered a SIGNAL mask (i.e., requiring an immediate abort of
  	processing to restart).  FLAG_RESTART just means that we want to
  	restart once pass 1 is complete.
1998-02-27 05:03:48 +00:00
Theodore Ts'o a02ce9df5f Many files:
Change the progress function to return an integer; if returns 1, then
  the progress function is expected to have set the e2fsck context flag
  signalling a user abort, and the caller should also initiate a user
  abort.
1998-02-24 20:22:23 +00:00
Theodore Ts'o 4313932cd7 ChangeLog, e2fsck.8.in, e2fsck.h, pass3.c, pass4.c, super.c:
e2fsck.h: Add new field, priv_data to the e2fsck context structure.
  	It should be used by callers of the e2fsck functions only, and not by
  	anything in e2fsck itself.
  super.c: Instead of call ext2fs_get_device_size(), define and call
  	e2fsck_get_device_size().  (This function may be stubbed out in
  	special versions of e2fsck.)
  pass3.c, pass4.c: Remove extra calls to the progress function that
  	weren't needed.
  mke2fs.8.in: Update man page to note that the format of the bad block
  	file is the same as the one generated by badblocks.
1998-02-16 22:34:46 +00:00
Theodore Ts'o 54be2ccc22 ChangeLog, dirinfo.c, e2fsck.c, e2fsck.h, super.c:
dirinfo.c, e2fsck.c: Don't include com_err.h; it isn't needed.
  e2fsck.h: Include <time.h> since it is needed
  super.c: If EXT2_SKIP_UUID is defined, then skip the UUID processing.
1998-02-01 12:58:48 +00:00
Theodore Ts'o 54dc7ca286 Many files:
e2fsck.h: If EXT2_FLAT_INCLUDES is defined, then assume all of
  	the ext2-specific header files are in a flat directory.
  dirinfo.c, ehandler.c, pass1.c, pass1b.c, pass2.c, pass5.c,
  	super.c, swapfs.c, unix.c: Explicitly cast all assignments
  	from void * to be compatible with C++.
  unix.c (sync_disk): Remove sync_disk and calls to that function,
  	since ext2fs_close() now takes care of this.
  pass1.c, pass1b.c, pass2.c, pass3.c, swapfs, badblocks.c,
  	ehandler.c, unix.c: Change use of private to be priv_data, to
  	avoid C++ reserved name clash.
1998-01-19 14:50:49 +00:00
Theodore Ts'o f8188fff23 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 05:23:04 +00:00
Theodore Ts'o 08b213017f Many files:
Change ext2fs_read_inode, ext2fs_write_inode to take the e2fsck
  context as their first argument.
  Change dir_info.c routines to take an e2fsck_context, renamed them to
  start with e2fsck_ to avoid namespace issues, and changed them to
  store the directory information inside the e2fsck context.
  Added e2fsck_run() which calls all of the e2fsck passes in the correct
  order, and which handles the return of abort codes.
  Added abort processing, both via setjmp/longjmp and via flags in the
  e2fsck context.
  Use a flag in the e2fsck context instead of the restart_e2fsck global
  variable.
  Change uses of free and malloc to ext2fs_free_mem and ext2fs_get_mem.
1997-11-03 19:42:40 +00:00
Theodore Ts'o 8bf191e866 Many files:
Place #ifdef RESOURCE_TRACK around code which uses init_resource_track
  and print_resource_track.  (Not all systems have timeval)
1997-10-20 01:38:32 +00:00
Theodore Ts'o b2da22d14b ChangeLog, e2fsck.h, super.c:
super.c: Remove excess #includes which are not necessary.
  e2fsck.h: Add #ifdef's for HAVE_SYS_TYPES_H and HAVE_SYS_TIME_H
1997-10-20 01:16:35 +00:00
Theodore Ts'o 1b6bf1759a 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 17:48:10 +00:00
Theodore Ts'o 7cf73dcd3d ChangeLog, e2fsck.h, message.c, pass1.c, pass2.c, problem.c, problem.h:
message.c: Add compression for the word "Illegal"
  problem.c: Added entries for PR_2_BAD_CHAR_DEV and PR_2_BAD_BLOCK_DEV
  pass1.c (pass1, check_device_inode), pass2.c (process_bad_inode): Use
  	a more stringent test for a valid device.
ChangeLog, Makefile.in:
  Makefile.in (install): Fix rm command to use $(DESTDIR) appropriately.
1997-08-14 17:17:16 +00:00
Theodore Ts'o 521e368572 Many files:
Checked in e2fsprogs 1.08.
1997-04-29 17:48:10 +00:00
Theodore Ts'o 21c84b71e2 Many files:
Checked in e2fsprogs-1.07
1997-04-29 16:15:03 +00:00
Theodore Ts'o 1e3472c5f3 Many files:
Checked in e2fsprogs 1.05
1997-04-29 14:53:37 +00:00
Theodore Ts'o 74becf3c0a Many files:
Checkin of e2fsprogs 1.02.
1997-04-26 14:37:06 +00:00
Theodore Ts'o 50e1e10fa0 Many files:
Checked in e2fsprogs 0.5c
1997-04-26 13:58:21 +00:00
Theodore Ts'o f3db3566b5 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:34:30 +00:00
Theodore Ts'o 3839e65723 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:21:57 +00:00