1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* e2fsck.h
|
2008-08-28 07:07:54 +04:00
|
|
|
*
|
1997-04-26 17:21:57 +04:00
|
|
|
* Copyright (C) 1993, 1994 Theodore Ts'o. This file may be
|
|
|
|
* redistributed under the terms of the GNU Public License.
|
2008-08-28 07:07:54 +04:00
|
|
|
*
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
|
2006-06-28 19:26:42 +04:00
|
|
|
#ifndef _E2FSCK_H
|
|
|
|
#define _E2FSCK_H
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1998-04-30 21:35:59 +04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <unistd.h>
|
1998-04-30 21:35:59 +04:00
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <stdlib.h>
|
1998-02-01 15:58:48 +03:00
|
|
|
#include <time.h>
|
1997-10-20 05:16:35 +04:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <sys/types.h>
|
1997-10-20 05:16:35 +04:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <sys/time.h>
|
1997-10-20 05:16:35 +04:00
|
|
|
#endif
|
1997-11-03 22:42:40 +03:00
|
|
|
#ifdef HAVE_SETJMP_H
|
|
|
|
#include <setjmp.h>
|
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
|
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 17:50:49 +03:00
|
|
|
#if EXT2_FLAT_INCLUDES
|
|
|
|
#include "ext2_fs.h"
|
|
|
|
#include "ext2fs.h"
|
2003-03-02 03:47:44 +03:00
|
|
|
#include "blkid.h"
|
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 17:50:49 +03:00
|
|
|
#else
|
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 15:45:38 +04:00
|
|
|
#include "ext2fs/ext2_fs.h"
|
1997-04-26 17:21:57 +04:00
|
|
|
#include "ext2fs/ext2fs.h"
|
2003-03-02 03:47:44 +03:00
|
|
|
#include "blkid/blkid.h"
|
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 17:50:49 +03:00
|
|
|
#endif
|
|
|
|
|
2005-12-31 08:00:10 +03:00
|
|
|
#include "profile.h"
|
|
|
|
#include "prof_err.h"
|
|
|
|
|
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
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
#include <libintl.h>
|
|
|
|
#include <locale.h>
|
|
|
|
#define _(a) (gettext (a))
|
|
|
|
#ifdef gettext_noop
|
|
|
|
#define N_(a) gettext_noop (a)
|
|
|
|
#else
|
|
|
|
#define N_(a) (a)
|
|
|
|
#endif
|
2003-05-18 05:00:46 +04:00
|
|
|
#define P_(singular, plural, n) (ngettext (singular, plural, n))
|
2003-05-04 00:35:17 +04:00
|
|
|
#ifndef NLS_CAT_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
|
|
|
#define NLS_CAT_NAME "e2fsprogs"
|
2003-05-04 00:35:17 +04:00
|
|
|
#endif
|
|
|
|
#ifndef LOCALEDIR
|
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
|
|
|
#define LOCALEDIR "/usr/share/locale"
|
2003-05-04 00:35:17 +04:00
|
|
|
#endif
|
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
|
|
|
#else
|
|
|
|
#define _(a) (a)
|
|
|
|
#define N_(a) a
|
2003-05-18 05:00:46 +04:00
|
|
|
#define P_(singular, plural, n) ((n) == 1 ? (singular) : (plural))
|
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
|
|
|
#endif
|
|
|
|
|
2012-03-18 07:21:00 +04:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define E2FSCK_ATTR(x) __attribute__(x)
|
|
|
|
#else
|
|
|
|
#define E2FSCK_ATTR(x)
|
|
|
|
#endif
|
|
|
|
|
2014-05-11 02:55:20 +04:00
|
|
|
#include "quota/quotaio.h"
|
2011-07-20 22:40:06 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* Exit codes used by fsck-type programs
|
|
|
|
*/
|
|
|
|
#define FSCK_OK 0 /* No errors */
|
|
|
|
#define FSCK_NONDESTRUCT 1 /* File system errors corrected */
|
|
|
|
#define FSCK_REBOOT 2 /* System should be rebooted */
|
|
|
|
#define FSCK_UNCORRECTED 4 /* File system errors left uncorrected */
|
|
|
|
#define FSCK_ERROR 8 /* Operational error */
|
|
|
|
#define FSCK_USAGE 16 /* Usage or syntax error */
|
2002-07-21 22:14:03 +04:00
|
|
|
#define FSCK_CANCELED 32 /* Aborted with a signal or ^C */
|
1997-04-26 17:21:57 +04:00
|
|
|
#define FSCK_LIBRARY 128 /* Shared library error */
|
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
/*
|
|
|
|
* The last ext2fs revision level that this version of e2fsck is able to
|
|
|
|
* support
|
|
|
|
*/
|
1997-04-29 18:53:37 +04:00
|
|
|
#define E2FSCK_CURRENT_REV 1
|
1997-04-26 17:34:30 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* The directory information structure; stores directory information
|
|
|
|
* collected in earlier passes, to avoid disk i/o in fetching the
|
1997-04-29 20:15:03 +04:00
|
|
|
* directory information.
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
struct dir_info {
|
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 18:12:14 +03:00
|
|
|
ext2_ino_t ino; /* Inode number */
|
|
|
|
ext2_ino_t dotdot; /* Parent according to '..' */
|
|
|
|
ext2_ino_t parent; /* Parent according to treewalk */
|
1997-04-26 17:21:57 +04:00
|
|
|
};
|
|
|
|
|
2002-06-26 07:26:34 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The indexed directory information structure; stores information for
|
|
|
|
* directories which contain a hash tree index.
|
|
|
|
*/
|
|
|
|
struct dx_dir_info {
|
|
|
|
ext2_ino_t ino; /* Inode number */
|
|
|
|
int numblocks; /* number of blocks */
|
|
|
|
int hashversion;
|
2002-09-30 19:19:19 +04:00
|
|
|
short depth; /* depth of tree */
|
2002-06-26 07:26:34 +04:00
|
|
|
struct dx_dirblock_info *dx_block; /* Array of size numblocks */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DX_DIRBLOCK_ROOT 1
|
|
|
|
#define DX_DIRBLOCK_LEAF 2
|
|
|
|
#define DX_DIRBLOCK_NODE 3
|
|
|
|
#define DX_DIRBLOCK_CORRUPT 4
|
|
|
|
#define DX_DIRBLOCK_CLEARED 8
|
|
|
|
|
|
|
|
struct dx_dirblock_info {
|
|
|
|
int type;
|
2013-10-07 17:51:48 +04:00
|
|
|
blk64_t phys;
|
2002-06-26 07:26:34 +04:00
|
|
|
int flags;
|
2013-10-07 17:51:48 +04:00
|
|
|
blk64_t parent;
|
2008-08-28 07:07:54 +04:00
|
|
|
ext2_dirhash_t min_hash;
|
2002-06-26 07:26:34 +04:00
|
|
|
ext2_dirhash_t max_hash;
|
2008-08-28 07:07:54 +04:00
|
|
|
ext2_dirhash_t node_min_hash;
|
2002-06-26 07:26:34 +04:00
|
|
|
ext2_dirhash_t node_max_hash;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DX_FLAG_REFERENCED 1
|
|
|
|
#define DX_FLAG_DUP_REF 2
|
|
|
|
#define DX_FLAG_FIRST 4
|
|
|
|
#define DX_FLAG_LAST 8
|
|
|
|
|
2011-09-19 01:34:37 +04:00
|
|
|
#define RESOURCE_TRACK
|
|
|
|
|
1997-10-20 05:38:32 +04:00
|
|
|
#ifdef RESOURCE_TRACK
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* This structure is used for keeping track of how much resources have
|
|
|
|
* been used for a particular pass of e2fsck.
|
|
|
|
*/
|
|
|
|
struct resource_track {
|
|
|
|
struct timeval time_start;
|
|
|
|
struct timeval user_start;
|
|
|
|
struct timeval system_start;
|
|
|
|
void *brk_start;
|
2007-08-04 04:07:09 +04:00
|
|
|
unsigned long long bytes_read;
|
|
|
|
unsigned long long bytes_written;
|
1997-04-26 17:21:57 +04:00
|
|
|
};
|
1997-10-20 05:38:32 +04:00
|
|
|
#endif
|
1997-04-26 17:21:57 +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
|
|
|
* E2fsck options
|
1997-04-26 17:21:57 +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
|
|
|
#define E2F_OPT_READONLY 0x0001
|
|
|
|
#define E2F_OPT_PREEN 0x0002
|
|
|
|
#define E2F_OPT_YES 0x0004
|
|
|
|
#define E2F_OPT_NO 0x0008
|
|
|
|
#define E2F_OPT_TIME 0x0010
|
|
|
|
#define E2F_OPT_TIME2 0x0020
|
|
|
|
#define E2F_OPT_CHECKBLOCKS 0x0040
|
|
|
|
#define E2F_OPT_DEBUG 0x0080
|
2001-12-22 07:28:54 +03:00
|
|
|
#define E2F_OPT_FORCE 0x0100
|
2001-12-24 23:01:59 +03:00
|
|
|
#define E2F_OPT_WRITECHECK 0x0200
|
2002-07-25 08:00:08 +04:00
|
|
|
#define E2F_OPT_COMPRESS_DIRS 0x0400
|
2008-08-11 06:43:24 +04:00
|
|
|
#define E2F_OPT_FRAGCHECK 0x0800
|
2010-11-13 02:09:07 +03:00
|
|
|
#define E2F_OPT_JOURNAL_ONLY 0x1000 /* only replay the journal */
|
2010-12-17 07:20:11 +03:00
|
|
|
#define E2F_OPT_DISCARD 0x2000
|
1997-04-26 17:21:57 +04:00
|
|
|
|
1997-11-03 22:42:40 +03:00
|
|
|
/*
|
|
|
|
* E2fsck flags
|
|
|
|
*/
|
|
|
|
#define E2F_FLAG_ABORT 0x0001 /* Abort signaled */
|
|
|
|
#define E2F_FLAG_CANCEL 0x0002 /* Cancel signaled */
|
1998-02-27 08:03:48 +03:00
|
|
|
#define E2F_FLAG_SIGNAL_MASK 0x0003
|
1997-11-03 22:42:40 +03:00
|
|
|
#define E2F_FLAG_RESTART 0x0004 /* Restart signaled */
|
2009-05-28 10:39:49 +04:00
|
|
|
#define E2F_FLAG_RESTART_LATER 0x0008 /* Restart after all iterations done */
|
1997-11-03 22:42:40 +03:00
|
|
|
|
|
|
|
#define E2F_FLAG_SETJMP_OK 0x0010 /* Setjmp valid for abort */
|
|
|
|
|
1999-07-19 19:27:37 +04:00
|
|
|
#define E2F_FLAG_PROG_BAR 0x0020 /* Progress bar on screen */
|
|
|
|
#define E2F_FLAG_PROG_SUPPRESS 0x0040 /* Progress suspended */
|
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 08:06:56 +04:00
|
|
|
#define E2F_FLAG_JOURNAL_INODE 0x0080 /* Create a new ext3 journal inode */
|
2008-08-28 07:07:54 +04:00
|
|
|
#define E2F_FLAG_SB_SPECIFIED 0x0100 /* The superblock was explicitly
|
2001-09-19 23:17:25 +04:00
|
|
|
* specified by the user */
|
2003-12-11 09:00:21 +03:00
|
|
|
#define E2F_FLAG_RESTARTED 0x0200 /* E2fsck has been restarted */
|
2004-12-24 09:42:22 +03:00
|
|
|
#define E2F_FLAG_RESIZE_INODE 0x0400 /* Request to recreate resize inode */
|
2007-06-04 09:14:52 +04:00
|
|
|
#define E2F_FLAG_GOT_DEVSIZE 0x0800 /* Device size has been fetched */
|
2008-10-11 02:14:08 +04:00
|
|
|
#define E2F_FLAG_EXITING 0x1000 /* E2fsck exiting due to errors */
|
2010-05-14 01:36:36 +04:00
|
|
|
#define E2F_FLAG_TIME_INSANE 0x2000 /* Time is insane */
|
2014-04-27 07:14:47 +04:00
|
|
|
#define E2F_FLAG_PROBLEMS_FIXED 0x4000 /* At least one problem was fixed */
|
2010-05-14 01:36:36 +04:00
|
|
|
|
2014-04-27 07:14:47 +04:00
|
|
|
#define E2F_RESET_FLAGS (E2F_FLAG_TIME_INSANE | E2F_FLAG_PROBLEMS_FIXED)
|
1999-07-19 19:27:37 +04:00
|
|
|
|
1997-11-03 22:42:40 +03:00
|
|
|
/*
|
|
|
|
* Defines for indicating the e2fsck pass number
|
|
|
|
*/
|
|
|
|
#define E2F_PASS_1 1
|
|
|
|
#define E2F_PASS_2 2
|
|
|
|
#define E2F_PASS_3 3
|
|
|
|
#define E2F_PASS_4 4
|
|
|
|
#define E2F_PASS_5 5
|
|
|
|
#define E2F_PASS_1B 6
|
|
|
|
|
2001-07-02 19:54:09 +04:00
|
|
|
/*
|
|
|
|
* Define the extended attribute refcount structure
|
|
|
|
*/
|
|
|
|
typedef struct ea_refcount *ext2_refcount_t;
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* This is the global e2fsck structure.
|
|
|
|
*/
|
1997-11-03 22:42:40 +03:00
|
|
|
typedef struct e2fsck_struct *e2fsck_t;
|
|
|
|
|
2008-08-14 17:48:07 +04:00
|
|
|
#define MAX_EXTENT_DEPTH_COUNT 5
|
|
|
|
|
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 e2fsck_struct {
|
|
|
|
ext2_filsys fs;
|
|
|
|
const char *program_name;
|
2003-03-02 03:47:44 +03:00
|
|
|
char *filesystem_name;
|
|
|
|
char *device_name;
|
2004-11-30 22:07:11 +03:00
|
|
|
char *io_options;
|
2012-03-18 07:21:00 +04:00
|
|
|
FILE *logf;
|
|
|
|
char *log_fn;
|
1997-11-03 22:42:40 +03:00
|
|
|
int flags; /* E2fsck internal flags */
|
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
|
|
|
int options;
|
2011-06-16 09:13:42 +04:00
|
|
|
int blocksize; /* blocksize */
|
2010-06-14 01:00:00 +04:00
|
|
|
blk64_t use_superblock; /* sb requested by user */
|
|
|
|
blk64_t superblock; /* sb used to open fs */
|
2010-03-15 02:26:48 +03:00
|
|
|
blk64_t num_blocks; /* Total number of blocks */
|
2011-06-16 09:13:42 +04:00
|
|
|
blk64_t free_blocks;
|
|
|
|
ino_t free_inodes;
|
2002-11-08 00:16:55 +03:00
|
|
|
int mount_flags;
|
2014-07-06 06:53:29 +04:00
|
|
|
int openfs_flags;
|
2003-03-02 03:47:44 +03:00
|
|
|
blkid_cache blkid; /* blkid cache */
|
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
|
|
|
|
1997-11-03 22:42:40 +03:00
|
|
|
#ifdef HAVE_SETJMP_H
|
|
|
|
jmp_buf abort_loc;
|
|
|
|
#endif
|
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
|
|
|
unsigned long abort_code;
|
1997-11-03 22:42:40 +03:00
|
|
|
|
1998-02-24 23:22:23 +03:00
|
|
|
int (*progress)(e2fsck_t ctx, int pass, unsigned long cur,
|
|
|
|
unsigned long max);
|
1997-11-03 22:42:40 +03: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
|
|
|
ext2fs_inode_bitmap inode_used_map; /* Inodes which are in use */
|
|
|
|
ext2fs_inode_bitmap inode_bad_map; /* Inodes which are bad somehow */
|
|
|
|
ext2fs_inode_bitmap inode_dir_map; /* Inodes which are directories */
|
|
|
|
ext2fs_inode_bitmap inode_bb_map; /* Inodes which are in bad blocks */
|
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
|
|
|
ext2fs_inode_bitmap inode_imagic_map; /* AFS inodes */
|
|
|
|
ext2fs_inode_bitmap inode_reg_map; /* Inodes which are regular files*/
|
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
|
|
|
|
|
|
|
ext2fs_block_bitmap block_found_map; /* Blocks which are in use */
|
|
|
|
ext2fs_block_bitmap block_dup_map; /* Blks referenced more than once */
|
2001-07-02 19:54:09 +04:00
|
|
|
ext2fs_block_bitmap block_ea_map; /* Blocks which are used by EA's */
|
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
|
|
|
|
|
|
|
/*
|
|
|
|
* Inode count arrays
|
|
|
|
*/
|
|
|
|
ext2_icount_t inode_count;
|
|
|
|
ext2_icount_t inode_link_info;
|
|
|
|
|
2001-07-02 19:54:09 +04:00
|
|
|
ext2_refcount_t refcount;
|
|
|
|
ext2_refcount_t refcount_extra;
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Array of flags indicating whether an inode bitmap, block
|
|
|
|
* bitmap, or inode table is invalid
|
|
|
|
*/
|
|
|
|
int *invalid_inode_bitmap_flag;
|
|
|
|
int *invalid_block_bitmap_flag;
|
|
|
|
int *invalid_inode_table_flag;
|
|
|
|
int invalid_bitmaps; /* There are invalid bitmaps/itable */
|
|
|
|
|
1997-11-03 22:42:40 +03:00
|
|
|
/*
|
|
|
|
* Block buffer
|
|
|
|
*/
|
|
|
|
char *block_buf;
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* For pass1_check_directory and pass1_get_blocks
|
|
|
|
*/
|
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 18:12:14 +03:00
|
|
|
ext2_ino_t stashed_ino;
|
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 ext2_inode *stashed_inode;
|
|
|
|
|
2002-07-25 08:00:08 +04:00
|
|
|
/*
|
|
|
|
* Location of the lost and found directory
|
|
|
|
*/
|
|
|
|
ext2_ino_t lost_and_found;
|
|
|
|
int bad_lost_and_found;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-11-03 22:42:40 +03:00
|
|
|
/*
|
|
|
|
* Directory information
|
|
|
|
*/
|
2007-04-05 06:33:31 +04:00
|
|
|
struct dir_info_db *dir_info;
|
1997-11-03 22:42:40 +03:00
|
|
|
|
2002-06-26 07:26:34 +04:00
|
|
|
/*
|
|
|
|
* Indexed directory information
|
|
|
|
*/
|
|
|
|
int dx_dir_info_count;
|
|
|
|
int dx_dir_info_size;
|
|
|
|
struct dx_dir_info *dx_dir_info;
|
|
|
|
|
2002-07-20 08:28:07 +04:00
|
|
|
/*
|
|
|
|
* Directories to hash
|
|
|
|
*/
|
|
|
|
ext2_u32_list dirs_to_hash;
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Tuning parameters
|
|
|
|
*/
|
|
|
|
int process_inode_size;
|
|
|
|
int inode_buffer_blocks;
|
2008-12-24 03:10:43 +03:00
|
|
|
unsigned int htree_slack_percentage;
|
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
|
|
|
|
2001-07-23 08:17:49 +04:00
|
|
|
/*
|
|
|
|
* ext3 journal support
|
|
|
|
*/
|
|
|
|
io_channel journal_io;
|
2003-03-02 03:47:44 +03:00
|
|
|
char *journal_name;
|
2001-07-23 08:17:49 +04:00
|
|
|
|
2011-07-20 22:40:06 +04:00
|
|
|
/*
|
|
|
|
* Ext4 quota support
|
|
|
|
*/
|
|
|
|
quota_ctx_t qctx;
|
1997-10-20 05:38:32 +04:00
|
|
|
#ifdef RESOURCE_TRACK
|
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
|
|
|
/*
|
|
|
|
* For timing purposes
|
|
|
|
*/
|
|
|
|
struct resource_track global_rtrack;
|
1997-10-20 05:38:32 +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
|
|
|
|
1998-05-07 09:02:00 +04:00
|
|
|
/*
|
|
|
|
* How we display the progress update (for unix)
|
|
|
|
*/
|
|
|
|
int progress_fd;
|
|
|
|
int progress_pos;
|
1999-07-19 19:27:37 +04:00
|
|
|
int progress_last_percent;
|
2000-02-12 23:12:43 +03:00
|
|
|
unsigned int progress_last_time;
|
2003-08-19 18:08:34 +04:00
|
|
|
int interactive; /* Are we connected directly to a tty? */
|
|
|
|
char start_meta[2], stop_meta[2];
|
2008-08-28 07:07:54 +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
|
|
|
/* File counts */
|
2006-09-12 22:56:15 +04:00
|
|
|
__u32 fs_directory_count;
|
|
|
|
__u32 fs_regular_count;
|
|
|
|
__u32 fs_blockdev_count;
|
|
|
|
__u32 fs_chardev_count;
|
|
|
|
__u32 fs_links_count;
|
|
|
|
__u32 fs_symlinks_count;
|
|
|
|
__u32 fs_fast_symlinks_count;
|
|
|
|
__u32 fs_fifo_count;
|
|
|
|
__u32 fs_total_count;
|
|
|
|
__u32 fs_badblocks_count;
|
|
|
|
__u32 fs_sockets_count;
|
|
|
|
__u32 fs_ind_count;
|
|
|
|
__u32 fs_dind_count;
|
|
|
|
__u32 fs_tind_count;
|
|
|
|
__u32 fs_fragmented;
|
2008-12-09 05:33:11 +03:00
|
|
|
__u32 fs_fragmented_dir;
|
2006-09-12 22:56:15 +04:00
|
|
|
__u32 large_files;
|
|
|
|
__u32 fs_ext_attr_inodes;
|
|
|
|
__u32 fs_ext_attr_blocks;
|
2008-08-14 17:48:07 +04:00
|
|
|
__u32 extent_depth_count[MAX_EXTENT_DEPTH_COUNT];
|
1998-02-17 01:34:46 +03:00
|
|
|
|
2007-08-04 04:43:37 +04:00
|
|
|
/* misc fields */
|
2005-04-14 22:07:53 +04:00
|
|
|
time_t now;
|
2007-09-23 04:42:04 +04:00
|
|
|
time_t time_fudge; /* For working around buggy init scripts */
|
2002-08-17 18:19:44 +04:00
|
|
|
int ext_attr_ver;
|
2005-12-31 08:00:10 +03:00
|
|
|
profile_t profile;
|
2007-08-04 04:43:37 +04:00
|
|
|
int blocks_per_page;
|
2005-12-31 08:00:10 +03:00
|
|
|
|
2014-07-26 04:33:45 +04:00
|
|
|
/* Reserve blocks for root and l+f re-creation */
|
|
|
|
blk64_t root_repair_block, lnf_repair_block;
|
|
|
|
|
1998-02-17 01:34:46 +03:00
|
|
|
/*
|
|
|
|
* For the use of callers of the e2fsck functions; not used by
|
|
|
|
* e2fsck functions themselves.
|
|
|
|
*/
|
|
|
|
void *priv_data;
|
e2fsck: don't clobber critical metadata during check_blocks
If we encounter an inode with IND/DIND/TIND blocks or internal extent
tree blocks that point into critical FS metadata such as the
superblock, the group descriptors, the bitmaps, or the inode table,
it's quite possible that the validation code for those blocks is not
going to like what it finds, and it'll ask to try to fix the block.
Unfortunately, this happens before duplicate block processing (pass
1b), which means that we can end up doing stupid things like writing
extent blocks into the inode table, which multiplies e2fsck'
destructive effect and can render a filesystem unfixable.
To solve this, create a bitmap of all the critical FS metadata. If
before pass1b runs (basically check_blocks) we find a metadata block
that points into these critical regions, continue processing that
block, but avoid making any modifications, because we could be
misinterpreting inodes as block maps. Pass 1b will find the
multiply-owned blocks and fix that situation, which means that we can
then restart e2fsck from the beginning and actually fix whatever
problems we find.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-23 20:11:23 +04:00
|
|
|
ext2fs_block_bitmap block_metadata_map; /* Metadata blocks */
|
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
|
|
|
};
|
1997-04-26 17:34:30 +04:00
|
|
|
|
2001-07-20 00:31:25 +04:00
|
|
|
/* Used by the region allocation code */
|
2014-09-19 05:29:19 +04:00
|
|
|
typedef __u64 region_addr_t;
|
2001-07-20 00:31:25 +04:00
|
|
|
typedef struct region_struct *region_t;
|
1997-04-29 18:53:37 +04:00
|
|
|
|
2003-03-02 03:47:44 +03:00
|
|
|
#ifndef HAVE_STRNLEN
|
|
|
|
#define strnlen(str, x) e2fsck_strnlen((str),(x))
|
|
|
|
extern int e2fsck_strnlen(const char * s, int count);
|
|
|
|
#endif
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* Procedure declarations
|
|
|
|
*/
|
|
|
|
|
1997-11-03 22:42:40 +03:00
|
|
|
extern void e2fsck_pass1(e2fsck_t ctx);
|
|
|
|
extern void e2fsck_pass1_dupblocks(e2fsck_t ctx, char *block_buf);
|
|
|
|
extern void e2fsck_pass2(e2fsck_t ctx);
|
|
|
|
extern void e2fsck_pass3(e2fsck_t ctx);
|
|
|
|
extern void e2fsck_pass4(e2fsck_t ctx);
|
|
|
|
extern void e2fsck_pass5(e2fsck_t ctx);
|
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
|
|
|
|
|
|
|
/* e2fsck.c */
|
1997-11-03 22:42:40 +03:00
|
|
|
extern errcode_t e2fsck_allocate_context(e2fsck_t *ret);
|
|
|
|
extern errcode_t e2fsck_reset_context(e2fsck_t ctx);
|
|
|
|
extern void e2fsck_free_context(e2fsck_t ctx);
|
|
|
|
extern int e2fsck_run(e2fsck_t ctx);
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* badblock.c */
|
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
|
|
|
extern void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
|
1997-04-26 17:21:57 +04:00
|
|
|
int replace_bad_blocks);
|
|
|
|
|
|
|
|
/* dirinfo.c */
|
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 18:12:14 +03:00
|
|
|
extern void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent);
|
1997-11-03 22:42:40 +03:00
|
|
|
extern void e2fsck_free_dir_info(e2fsck_t ctx);
|
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
|
|
|
extern int e2fsck_get_num_dirinfo(e2fsck_t ctx);
|
2007-04-05 06:33:31 +04:00
|
|
|
extern struct dir_info_iter *e2fsck_dir_info_iter_begin(e2fsck_t ctx);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx,
|
2007-04-05 06:33:31 +04:00
|
|
|
struct dir_info_iter *);
|
|
|
|
extern void e2fsck_dir_info_iter_end(e2fsck_t ctx, struct dir_info_iter *);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern int e2fsck_dir_info_set_parent(e2fsck_t ctx, ext2_ino_t ino,
|
2007-04-05 06:33:31 +04:00
|
|
|
ext2_ino_t parent);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern int e2fsck_dir_info_set_dotdot(e2fsck_t ctx, ext2_ino_t ino,
|
2007-04-05 06:33:31 +04:00
|
|
|
ext2_ino_t dotdot);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern int e2fsck_dir_info_get_parent(e2fsck_t ctx, ext2_ino_t ino,
|
2007-04-05 06:33:31 +04:00
|
|
|
ext2_ino_t *parent);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern int e2fsck_dir_info_get_dotdot(e2fsck_t ctx, ext2_ino_t ino,
|
2007-04-05 06:33:31 +04:00
|
|
|
ext2_ino_t *dotdot);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2002-06-26 07:26:34 +04:00
|
|
|
/* dx_dirinfo.c */
|
|
|
|
extern void e2fsck_add_dx_dir(e2fsck_t ctx, ext2_ino_t ino, int num_blocks);
|
|
|
|
extern struct dx_dir_info *e2fsck_get_dx_dir_info(e2fsck_t ctx, ext2_ino_t ino);
|
|
|
|
extern void e2fsck_free_dx_dir_info(e2fsck_t ctx);
|
|
|
|
extern int e2fsck_get_num_dx_dirinfo(e2fsck_t ctx);
|
|
|
|
extern struct dx_dir_info *e2fsck_dx_dir_info_iter(e2fsck_t ctx, int *control);
|
|
|
|
|
2001-07-02 19:54:09 +04:00
|
|
|
/* ea_refcount.c */
|
|
|
|
extern errcode_t ea_refcount_create(int size, ext2_refcount_t *ret);
|
|
|
|
extern void ea_refcount_free(ext2_refcount_t refcount);
|
2013-12-03 08:07:32 +04:00
|
|
|
extern errcode_t ea_refcount_fetch(ext2_refcount_t refcount, blk64_t blk, int *ret);
|
2001-07-02 19:54:09 +04:00
|
|
|
extern errcode_t ea_refcount_increment(ext2_refcount_t refcount,
|
2013-12-03 08:07:32 +04:00
|
|
|
blk64_t blk, int *ret);
|
2001-07-02 19:54:09 +04:00
|
|
|
extern errcode_t ea_refcount_decrement(ext2_refcount_t refcount,
|
2013-12-03 08:07:32 +04:00
|
|
|
blk64_t blk, int *ret);
|
2001-07-02 19:54:09 +04:00
|
|
|
extern errcode_t ea_refcount_store(ext2_refcount_t refcount,
|
2013-12-03 08:07:32 +04:00
|
|
|
blk64_t blk, int count);
|
2001-12-17 07:23:37 +03:00
|
|
|
extern blk_t ext2fs_get_refcount_size(ext2_refcount_t refcount);
|
2001-07-02 19:54:09 +04:00
|
|
|
extern void ea_refcount_intr_begin(ext2_refcount_t refcount);
|
2013-12-03 08:07:32 +04:00
|
|
|
extern blk64_t ea_refcount_intr_next(ext2_refcount_t refcount, int *ret);
|
2001-07-02 19:54:09 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* ehandler.c */
|
|
|
|
extern const char *ehandler_operation(const char *op);
|
|
|
|
extern void ehandler_init(io_channel channel);
|
|
|
|
|
2000-07-07 08:13:21 +04:00
|
|
|
/* journal.c */
|
2013-12-03 06:37:10 +04:00
|
|
|
extern errcode_t e2fsck_check_ext3_journal(e2fsck_t ctx);
|
|
|
|
extern errcode_t e2fsck_run_ext3_journal(e2fsck_t ctx);
|
2001-10-07 05:26:27 +04:00
|
|
|
extern void e2fsck_move_ext3_journal(e2fsck_t ctx);
|
2006-03-10 23:25:59 +03:00
|
|
|
extern int e2fsck_fix_ext3_journal_hint(e2fsck_t ctx);
|
2000-07-07 08:13:21 +04:00
|
|
|
|
2012-03-18 07:21:00 +04:00
|
|
|
/* logfile.c */
|
|
|
|
extern void set_up_logging(e2fsck_t ctx);
|
|
|
|
|
2011-07-20 22:40:06 +04:00
|
|
|
/* quota.c */
|
|
|
|
extern void e2fsck_hide_quota(e2fsck_t ctx);
|
|
|
|
|
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 19:40:18 +04:00
|
|
|
/* pass1.c */
|
2008-08-28 07:07:54 +04:00
|
|
|
extern void e2fsck_setup_tdb_icount(e2fsck_t ctx, int flags,
|
2007-04-07 02:43:11 +04:00
|
|
|
ext2_icount_t *ret);
|
2012-07-06 05:44:20 +04:00
|
|
|
extern void e2fsck_use_inode_shortcuts(e2fsck_t ctx, int use_shortcuts);
|
2002-08-17 18:19:44 +04:00
|
|
|
extern int e2fsck_pass1_check_device_inode(ext2_filsys fs,
|
|
|
|
struct ext2_inode *inode);
|
2008-03-14 06:05:00 +03:00
|
|
|
extern int e2fsck_pass1_check_symlink(ext2_filsys fs, ext2_ino_t ino,
|
2002-05-21 17:14:17 +04:00
|
|
|
struct ext2_inode *inode, char *buf);
|
2007-09-15 22:10:47 +04:00
|
|
|
extern void e2fsck_clear_inode(e2fsck_t ctx, ext2_ino_t ino,
|
|
|
|
struct ext2_inode *inode, int restart_flag,
|
|
|
|
const char *source);
|
2014-07-19 02:53:41 +04:00
|
|
|
extern void e2fsck_intercept_block_allocations(e2fsck_t ctx);
|
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 19:40:18 +04:00
|
|
|
|
|
|
|
/* pass2.c */
|
2002-05-21 17:14:17 +04:00
|
|
|
extern int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
|
|
|
|
ext2_ino_t ino, char *buf);
|
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 19:40:18 +04:00
|
|
|
|
|
|
|
/* pass3.c */
|
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 18:12:14 +03:00
|
|
|
extern int e2fsck_reconnect_file(e2fsck_t ctx, ext2_ino_t inode);
|
2002-07-20 08:28:07 +04:00
|
|
|
extern errcode_t e2fsck_expand_directory(e2fsck_t ctx, ext2_ino_t dir,
|
|
|
|
int num, int gauranteed_size);
|
2002-07-25 08:00:08 +04:00
|
|
|
extern ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t e2fsck_adjust_inode_count(e2fsck_t ctx, ext2_ino_t ino,
|
2003-03-14 09:43:56 +03:00
|
|
|
int adj);
|
2002-07-20 08:28:07 +04:00
|
|
|
|
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 19:40:18 +04:00
|
|
|
|
2001-07-20 00:31:25 +04:00
|
|
|
/* region.c */
|
|
|
|
extern region_t region_create(region_addr_t min, region_addr_t max);
|
|
|
|
extern void region_free(region_t region);
|
|
|
|
extern int region_allocate(region_t region, region_addr_t start, int n);
|
|
|
|
|
2002-07-20 08:28:07 +04:00
|
|
|
/* rehash.c */
|
2012-08-03 01:27:30 +04:00
|
|
|
void e2fsck_rehash_dir_later(e2fsck_t ctx, ext2_ino_t ino);
|
|
|
|
int e2fsck_dir_will_be_rehashed(e2fsck_t ctx, ext2_ino_t ino);
|
2002-07-20 08:28:07 +04:00
|
|
|
errcode_t e2fsck_rehash_dir(e2fsck_t ctx, ext2_ino_t ino);
|
|
|
|
void e2fsck_rehash_directories(e2fsck_t ctx);
|
|
|
|
|
2011-08-11 22:56:49 +04:00
|
|
|
/* sigcatcher.c */
|
|
|
|
void sigcatcher_setup(void);
|
|
|
|
|
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
|
|
|
/* super.c */
|
|
|
|
void check_super_block(e2fsck_t ctx);
|
2007-10-01 17:18:54 +04:00
|
|
|
int check_backup_super_block(e2fsck_t ctx);
|
2009-04-23 08:39:06 +04:00
|
|
|
void check_resize_inode(e2fsck_t ctx);
|
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
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* util.c */
|
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
|
|
|
extern void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size,
|
|
|
|
const char *description);
|
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
|
|
|
extern int ask(e2fsck_t ctx, const char * string, int def);
|
2012-03-18 07:21:00 +04:00
|
|
|
extern int ask_yn(e2fsck_t ctx, const char * string, int def);
|
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
|
|
|
extern void fatal_error(e2fsck_t ctx, const char * fmt_string);
|
2012-03-18 07:21:00 +04:00
|
|
|
extern void log_out(e2fsck_t ctx, const char *fmt, ...)
|
|
|
|
E2FSCK_ATTR((format(printf, 2, 3)));
|
|
|
|
extern void log_err(e2fsck_t ctx, const char *fmt, ...)
|
|
|
|
E2FSCK_ATTR((format(printf, 2, 3)));
|
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
|
|
|
extern void e2fsck_read_bitmaps(e2fsck_t ctx);
|
|
|
|
extern void e2fsck_write_bitmaps(e2fsck_t ctx);
|
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
|
|
|
extern void preenhalt(e2fsck_t ctx);
|
2003-03-02 03:47:44 +03:00
|
|
|
extern char *string_copy(e2fsck_t ctx, const char *str, int len);
|
2008-10-13 07:09:26 +04:00
|
|
|
extern int fs_proc_check(const char *fs_name);
|
|
|
|
extern int check_for_modules(const char *fs_name);
|
1997-10-20 05:38:32 +04:00
|
|
|
#ifdef RESOURCE_TRACK
|
2009-05-28 17:55:10 +04:00
|
|
|
extern void print_resource_track(e2fsck_t ctx,
|
|
|
|
const char *desc,
|
2007-08-04 04:07:09 +04:00
|
|
|
struct resource_track *track,
|
|
|
|
io_channel channel);
|
|
|
|
extern void init_resource_track(struct resource_track *track,
|
|
|
|
io_channel channel);
|
2009-05-28 17:55:10 +04:00
|
|
|
#else
|
|
|
|
#define print_resource_track(ctx, desc, track, channel) do { } while (0)
|
|
|
|
#define init_resource_track(track, channel) do { } while (0)
|
1997-10-20 05:38:32 +04:00
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
extern int inode_has_valid_blocks(struct ext2_inode *inode);
|
1997-11-03 22:42:40 +03:00
|
|
|
extern void e2fsck_read_inode(e2fsck_t ctx, unsigned long ino,
|
1997-04-26 17:34:30 +04:00
|
|
|
struct ext2_inode * inode, const char * proc);
|
2008-02-02 11:16:32 +03:00
|
|
|
extern void e2fsck_read_inode_full(e2fsck_t ctx, unsigned long ino,
|
|
|
|
struct ext2_inode *inode,
|
|
|
|
const int bufsize, const char *proc);
|
1997-11-03 22:42:40 +03:00
|
|
|
extern void e2fsck_write_inode(e2fsck_t ctx, unsigned long ino,
|
1997-04-26 17:34:30 +04:00
|
|
|
struct ext2_inode * inode, const char * proc);
|
2006-05-30 18:29:15 +04:00
|
|
|
extern void e2fsck_write_inode_full(e2fsck_t ctx, unsigned long ino,
|
|
|
|
struct ext2_inode * inode, int bufsize,
|
|
|
|
const char *proc);
|
1997-04-26 17:21:57 +04:00
|
|
|
#ifdef MTRACE
|
|
|
|
extern void mtrace_print(char *mesg);
|
|
|
|
#endif
|
2013-10-07 17:51:48 +04:00
|
|
|
extern blk64_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs,
|
2001-12-24 06:27:52 +03:00
|
|
|
const char *name, io_manager manager);
|
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 16:34:40 +03:00
|
|
|
extern int ext2_file_type(unsigned int mode);
|
2009-04-22 23:09:41 +04:00
|
|
|
extern int write_all(int fd, char *buf, size_t count);
|
2011-09-24 21:48:55 +04:00
|
|
|
void dump_mmp_msg(struct mmp_struct *mmp, const char *msg);
|
|
|
|
errcode_t e2fsck_mmp_update(ext2_filsys fs);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2011-12-16 23:55:50 +04:00
|
|
|
extern void e2fsck_set_bitmap_type(ext2_filsys fs,
|
|
|
|
unsigned int default_type,
|
|
|
|
const char *profile_name,
|
|
|
|
unsigned int *old_type);
|
|
|
|
extern errcode_t e2fsck_allocate_inode_bitmap(ext2_filsys fs,
|
|
|
|
const char *descr,
|
|
|
|
int default_type,
|
|
|
|
const char *profile_name,
|
|
|
|
ext2fs_inode_bitmap *ret);
|
|
|
|
extern errcode_t e2fsck_allocate_block_bitmap(ext2_filsys fs,
|
|
|
|
const char *descr,
|
|
|
|
int default_type,
|
|
|
|
const char *profile_name,
|
|
|
|
ext2fs_block_bitmap *ret);
|
|
|
|
extern errcode_t e2fsck_allocate_subcluster_bitmap(ext2_filsys fs,
|
|
|
|
const char *descr,
|
|
|
|
int default_type,
|
|
|
|
const char *profile_name,
|
|
|
|
ext2fs_block_bitmap *ret);
|
|
|
|
|
1999-07-19 19:27:37 +04:00
|
|
|
/* unix.c */
|
|
|
|
extern void e2fsck_clear_progbar(e2fsck_t ctx);
|
2003-04-19 21:48:27 +04:00
|
|
|
extern int e2fsck_simple_progress(e2fsck_t ctx, const char *label,
|
2003-03-14 09:43:56 +03:00
|
|
|
float percent, unsigned int dpynum);
|
2006-06-28 19:26:42 +04:00
|
|
|
#endif /* _E2FSCK_H */
|