summaryrefslogtreecommitdiff
path: root/e2fsck/unix.c
AgeCommit message (Collapse)AuthorFilesLines
2001-01-01ChangeLog, journal.c, pass1.c, super.c, unix.c:Theodore Ts'o1-20/+18
journal.c, pass1.c, super.c, unix.c: Replace use of struct ext2fs_sb with struct ext2_super_block. ChangeLog, debugfs.c: debugfs.c Replace use of struct ext2fs_sb with struct ext2_super_block.
2000-12-13ChangeLog, super.c:Theodore Ts'o1-2/+5
super.c (release_orphan_inodes): Fix spelling typo in error message. ChangeLog, unix.c: unix.c (main): Clarify coments (no code changes) ChangeLog, journal.c: journal.c (e2fsck_check_ext3_journal): Check to make sure the journal fields are consistent if any of the superblock fields are set. (Backs out erroneous change made by sct, pointed out by Andreas.)
2000-08-22ChangeLog, unix.c:Theodore Ts'o1-8/+15
unix.c (main): If we're doing a read-only check, skip the journal playback, but don't abort the e2fsck run.
2000-08-22ChangeLog, unix.c:Theodore Ts'o1-24/+22
unix.c: Use fatal_error() instead of exit() whenever possible. Also fix the fsck exit codes so that we use FSCK_USAGE when it is appropriate. Rename global_signal_ctx to e2fsck_global_ctx and let it be exported globally.
2000-08-18Many files:Theodore Ts'o1-0/+2
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-14Many files:Theodore Ts'o1-20/+33
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-08ChangeLog, unix.c:Theodore Ts'o1-1/+1
unix.c (calc_percent): Make sure that we don't take a floating exception if the max value is zero. (should normally never happen, but...)
2000-07-07ChangeLog, Makefile.in, e2fsck.h, journal.c, unix.c:Theodore Ts'o1-5/+30
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-05ChangeLog, Makefile.in:Theodore Ts'o1-4/+21
Makefile.in (install): Install resize2fs in /sbin, not /usr/sbin. ChangeLog, unix.c: unix.c: Also, re-arrange the logic so that we do the time check only after doing the percentage check, and we only advance the spinner if we're about to display it. ChangeLog: Fix minor wording error in Chagelog.
2000-07-05ChangeLog, unix.c:Theodore Ts'o1-2/+2
unix.c (e2fsck_update_progress): Only save and check the last percentage after multiplying it by 10, nor 1000, since we only need to save values to a tenth of a percent (and the percentage is already from 0 .. 100%, not 0 .. 1).
2000-04-03Many files:Theodore Ts'o1-0/+3
badblocks.c, dumpe2fs.c, e2label.c, mke2fs.c, tune2fs.c, uuidgen.c: For platforms that don't define optarg.h, manually define optarg and optind. ChangeLog, main.c: main.c: For platforms that don't define optarg.h, manually define optarg and optind. ChangeLog, unix.c: unix.c: For platforms that don't define optarg.h, manually define optarg and optind.
2000-02-12ChangeLog, e2fsck.h, unix.c:Theodore Ts'o1-0/+8
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-11Many files:Theodore Ts'o1-0/+5
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-08ChangeLog, bitops.h:Theodore Ts'o1-4/+8
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-07Many files:Theodore Ts'o1-57/+105
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>.
1999-11-08ChangeLog, e2fsck.c, pass4.c, problem.h, unix.c:Theodore Ts'o1-1/+2
pass4.c (e2fsck_pass4): Clear inode_imagic_map after freeing it, to prevent it from getting freed twice. unix.c (main): Close the filesystem before freeing the context, so that in the event of a free()-related segmentation violation, the filesystem is properly closed and written out. e2fsck.c (e2fsck_reset_context): When freeing ctx->inode_reg_map, we weren't zero'ing ctx->inode_reg_map, which could cause a segfault later on in the e2fsck run. problem.h (PR_2_SPLIT_DOT): Fix excess zero in problem code (now matches the standard convention).
1999-10-20ChangeLog, unix.c, util.c:Theodore Ts'o1-3/+8
unix.c (PRS), util.c (ask_yn): Add #ifdef's to make e2fsprogs easier to port to non-Unix platforms.
1999-07-19ChangeLog, unix.c:Theodore Ts'o1-0/+14
unix.c (usage): Add minimalist emergency help to the usage message.
1999-07-19Many files:Theodore Ts'o1-7/+113
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-01ChangeLog, unix.c:Theodore Ts'o1-7/+9
unix.c (check_mount): Clean up the abort message displayed when the filesystem is mounted and either stdout or stdin isn't a tty.
1999-06-22ChangeLog, dir_iterate.c:Theodore Ts'o1-2/+3
dir_iterate.c (ext2fs_process_dir_block): Check for corrupted directory entry before calling the callback function. This should prevent some core dumps of insufficiently paranoid callback functions. ChangeLog, unix.c: unix.c (main): Add missing space in the disk write-protected message.
1999-05-18unix.c, ChangeLog:Theodore Ts'o1-0/+5
unix.c (reserve_stdio_fds): Add safety check in case reserve_stdio_fds couldn't open /dev/null.
1999-01-04ChangeLog, unix.c:Theodore Ts'o1-1/+1
unix.c (main): Reset the context before calling ext2fs_close(), to avoid referencing already freed memory. ChangeLog, llseek.c: llseek.c (ext2fs_llseek): Change ext2fs_llseek() in the non-Linux case to use EINVAL by default, unless it isn't defined, in which case we use EXT2_ET_INVALID_ARGUMENT instead. ChangeLog, mk_cmds.sh.in: mk_cmds.sh.in: Fixed portability bug in shell script; we were depending on a bash'ism. ChangeLog, uuid.c: uuid.c: Use asm/types.h instead of linux/types.h, to be consistent with other locations where we've had to do this to work around glibc.
1998-11-14ChangeLog, mke2fs.c, tune2fs.8.in:Theodore Ts'o1-1/+1
tune2fs.8.in: Fix minor display bug in the nroff. mke2fs.c (show_stats, write_inode_tables): Use the log10 function to calculate the display of block numbers so that things look nice on an 80 character display. mke2fs.c (usage): Add the sparse-super-flag to the usage message. ChangeLog, e2fsck.c, pass1.c, pass2.c, problem.c, problem.h, unix.c: unix.c (main): Move ext2fs_close() after e2fsck_free_context() since e2fsck_free_context may reference data in ctx->fs. e2fsck.c (e2fsck_reset_context): Make sure ctx->fs is non-NULL before checking ctx->fs->dblist. pass1.c (e2fsck_pass1): Use the device check subroutine on FIFO's and Socket's, so that we catch bogus immutable inodes. pass2.c (process_bad_inode): Process bad socket and fifo's. problem.h, problem.c: Define new problem codes PR_2_BAD_FIFO and PR_2_BAD_SOCKET.
1998-08-26ChangeLog, unix.c:Theodore Ts'o1-3/+16
unix.c (check_if_skip): Move the "not cleanly mounted" check ahead of the maximal mount and too long since checked tests. (reserve_stdio_fds): Make sure 0,1,2 file descriptors are open, so that we don't open the filesystem using the same file descriptor as stdout or stderr.
1998-08-01ChangeLog, e2fsck.c, pass2.c, pass3.c, unix.c:Theodore Ts'o1-0/+3
pass2.c (e2fsck_pass2): Fix the progress accounting so that we get to 100%. pass3.c (e2fsck_pass3): Change progress accounting to be consistent with the other e2fsck passes. e2fsck.c (e2fsck_run): At the end of each pass, call the progress function with the pass number set to zero. unix.c (e2fsck_update_progress): If the pass number is zero, ignore the call, since that indicates that we just want to deallocate any progress structures. emptydir.c: Commit partially done file. ChangeLog, badblocks.c: badblocks.c (ext2fs_badblocks_list_add): Use a bigger increment than 10 blocks when we need to expand the size of the badblocks list.
1998-07-09ChangeLog, unix.c:Theodore Ts'o1-1/+1
unix.c (main): Fix typo in checking the incompat feature set; it should be checked against EXT2_LIB_FEATURE_INCOMPAT_SUPP.
1998-06-27ChangeLog, debugfs.8.in, debugfs.c:Theodore Ts'o1-2/+0
Add a -V option which displays the current version. ChangeLog, unix.c: unix.c (e2fsck_update_progress): Remove unused variables. ChangeLog, inode.c: inode.c (get_next_blockgroup): Fix bug where if get_next_blockgroup() is called early because of a missing inode table in a block group, the current_inode counter wasn't incremented correctly. ChangeLog, tst_uuid.c: tst_uuid.c (main): Fixed bogus declaration of the main's argv parameter. ChangeLog, test_icount.c: test_icount.c (main): Fix main() declaration so that it returns int, not void. Many files: fsck.c (ignore): Remove unused variable cp. chattr.c (fatal_error): tune2fs.c (usage): lsattr.c (usage): dumpe2fs.c (usage): badblocks.c (usage): Remove volatile from declaration. fsck.c: Change use of strdup to be string_copy, since we don't trust what glibc is doing with strdup. (Whatever it is, it isn't pretty.)
1998-05-07ChangeLog, e2fsck.8.in, e2fsck.h, pass5.c, unix.c:Theodore Ts'o1-1/+27
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-03-24Many files:Theodore Ts'o1-1/+1
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-02-24Many files:Theodore Ts'o1-4/+4
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-01ChangeLog, e2fsck.8.in, unix.c:Theodore Ts'o1-5/+8
unix.c (main): In the case where the filesystem revision is too high, print the message about the superblock possibly being corrupt. e2fsck.8.in: Add expanded comments about how the -b option works.
1998-01-19Many files:Theodore Ts'o1-13/+4
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.
1997-11-14Many files:Theodore Ts'o1-16/+24
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-04ChangeLog, unix.c:Theodore Ts'o1-0/+7
Add a special case check for the error code EROFS and display an appropriate error message for this case.
1997-11-03Many files:Theodore Ts'o1-12/+9
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-10-25Many files:Theodore Ts'o1-1/+1
fsck.c: chattr.c: Remove #include of getopt.h, since it's not needed. tune2fs.c (main): lsattr.c (main): badblocks.c (main): dumpe2fs.c (main): mke2fs.c (PRS): Make the variable which getopt returns into be an int, so that it won't lose on platforms where char is unsigned. ChangeLog, unix.c: Make the variable which getopt returns into be an int, so that it won't lose on platforms where char is unsigned.
1997-10-20Many files:Theodore Ts'o1-0/+9
Place #ifdef RESOURCE_TRACK around code which uses init_resource_track and print_resource_track. (Not all systems have timeval)
1997-10-03Many files:Theodore Ts'o1-0/+651
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.