mirror of https://github.com/vitalif/e2fsprogs
Compare commits
113 Commits
debian-1.4
...
master
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | 6e4fa6e281 | |
Vitaliy Filippov | b331d80fba | |
Vitaliy Filippov | f99c7a2e12 | |
Vitaliy Filippov | b9b963d427 | |
Vitaliy Filippov | f58c260dc4 | |
Vitaliy Filippov | 152890aa45 | |
Vitaliy Filippov | 63039f4bac | |
Vitaliy Filippov | 7e0136332c | |
Vitaliy Filippov | b3782b2e5b | |
Vitaliy Filippov | 460c0af190 | |
Vitaliy Filippov | 2051d63a83 | |
Theodore Ts'o | e703ba4b42 | |
Theodore Ts'o | d6cad379eb | |
Theodore Ts'o | 4e52870eeb | |
Theodore Ts'o | 047d5d774f | |
Theodore Ts'o | a7b27f11a1 | |
Theodore Ts'o | 8d7a63921f | |
Theodore Ts'o | f3bc1561c8 | |
Theodore Ts'o | 254195627f | |
Theodore Ts'o | 7b714fe277 | |
Theodore Ts'o | cd0567982b | |
Theodore Ts'o | 98e858bf9d | |
Theodore Ts'o | a2143b5160 | |
Theodore Ts'o | f6acc1212d | |
Theodore Ts'o | a7c023f4df | |
Theodore Ts'o | bbd2f78cf6 | |
Theodore Ts'o | 35a4e1b1c5 | |
Theodore Ts'o | abae029024 | |
Tianze Wang | 57d6927dc8 | |
Yuri Chornoivan | 935fdb9935 | |
Göran Uddeborg | 57bbbb813d | |
Jakub Bogusz | d0c9ac4886 | |
Benno Schulenberg | b9e09a9d02 | |
Samuel Thibault | 7ef3cf2489 | |
Philipp Thomas | a4670b9e78 | |
Joe Hansen | 1e000f89d3 | |
Angel Mompo | 60836c6361 | |
Theodore Ts'o | 4d4335323e | |
Theodore Ts'o | c4d54aa2f7 | |
Theodore Ts'o | 22137497fa | |
Theodore Ts'o | b199291909 | |
Theodore Ts'o | 9a23fa8334 | |
Andreas Dilger | 713edbd082 | |
Adrien Schildknecht | 4ccf9e4fe1 | |
Adrien Schildknecht | d4e5abfb1b | |
Adrien Schildknecht | 5cc6db0c82 | |
Theodore Ts'o | 3d6fc97483 | |
Matthias Andree | c2c5c58593 | |
Daeho Jeong | 32448f50df | |
Gustavo Zacarias | 49aa3ff1f1 | |
Theodore Ts'o | c94da0475a | |
Eric Sandeen | 32bf36dc0f | |
Theodore Ts'o | 5eca88c1dc | |
Ingo Brückl | 7bd03cf6a1 | |
Gustavo Zacarias | 62bc243f1b | |
Theodore Ts'o | 48203a389d | |
Matthias Andree | 434413ccde | |
Theodore Ts'o | c0495d96fd | |
Theodore Ts'o | 726b21b5d2 | |
Theodore Ts'o | 55e8032363 | |
Theodore Ts'o | 81f965a04d | |
Theodore Ts'o | 43b7b054cd | |
Matthias Andree | afaf6db69f | |
Theodore Ts'o | ded919125a | |
Theodore Ts'o | 3166e2e540 | |
Theodore Ts'o | 32179ce25b | |
Theodore Ts'o | 770d9f5e28 | |
Theodore Ts'o | 127e2291bf | |
Theodore Ts'o | be05f60ecf | |
Theodore Ts'o | 7618802123 | |
Matthias Andree | 254c50ff5f | |
Theodore Ts'o | 2832fd8b8f | |
Theodore Ts'o | edc7b0988a | |
Theodore Ts'o | 97b7a94679 | |
Theodore Ts'o | 50a6f4a2cf | |
Pete Haddow | f8a801d05f | |
Theodore Ts'o | a9a81b1f2f | |
Theodore Ts'o | ebb8b1aa04 | |
Theodore Ts'o | 377e3a9657 | |
Theodore Ts'o | 3dcb760f2a | |
Theodore Ts'o | 7f62f07577 | |
Theodore Ts'o | d3c0595704 | |
Theodore Ts'o | 04f34e7182 | |
Theodore Ts'o | 0eb9fb99da | |
Theodore Ts'o | 478360f50b | |
Theodore Ts'o | 749f07121d | |
Theodore Ts'o | a701823a31 | |
Theodore Ts'o | c2ff6bac50 | |
Theodore Ts'o | 62f9bd0e4f | |
Theodore Ts'o | 9a316fe73e | |
Theodore Ts'o | 2dd680f3b9 | |
Theodore Ts'o | c40c832b4c | |
Filipe Brandenburger | c64313084e | |
Theodore Ts'o | e2406b990c | |
Theodore Ts'o | 612f775362 | |
Theodore Ts'o | d37026ea07 | |
Theodore Ts'o | bf26fae372 | |
Theodore Ts'o | e1ada17169 | |
Theodore Ts'o | d133561994 | |
Theodore Ts'o | 93715de136 | |
Theodore Ts'o | 8fb86b46b8 | |
Theodore Ts'o | 697e21fa61 | |
Theodore Ts'o | fd1677e801 | |
Theodore Ts'o | bc1ec4b459 | |
Theodore Ts'o | 4bfb35e1e6 | |
Theodore Ts'o | 3a50a3eaf2 | |
Theodore Ts'o | b41a4ffa50 | |
Theodore Ts'o | 78b7cd3b1e | |
Theodore Ts'o | eba83bd3ce | |
Theodore Ts'o | 77e9d989f4 | |
Theodore Ts'o | a4d77554fe | |
Theodore Ts'o | 2c0e8c7aac | |
Theodore Ts'o | e7d848266a |
|
@ -161,6 +161,8 @@ misc/e2initrd_helper
|
|||
misc/e2label.8
|
||||
misc/e2undo
|
||||
misc/e2undo.8
|
||||
misc/e2patch
|
||||
misc/e2patch.8
|
||||
misc/e4defrag
|
||||
misc/e4defrag.8
|
||||
misc/ext4.5
|
||||
|
|
15
MCONFIG.in
15
MCONFIG.in
|
@ -68,17 +68,22 @@ pkgconfigdir = $(libdir)/pkgconfig
|
|||
@ifGNUmake@ endif
|
||||
@ifGNUmake@ endif
|
||||
|
||||
@ifNotGNUmake@ CHECK_CMD=@true
|
||||
@ifNotGNUmake@ CPPHECK_CMD=@true
|
||||
@ifNotGNUmake@ CHECK_CMD=true
|
||||
@ifNotGNUmake@ CPPCHECK_CMD=true
|
||||
|
||||
CC = @CC@
|
||||
BUILD_CC = @BUILD_CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_SHLIB = @CFLAGS_SHLIB@
|
||||
CFLAGS_STLIB = @CFLAGS_STLIB@
|
||||
CPPFLAGS = @INCLUDES@
|
||||
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) @DEFS@ $(LOCAL_CFLAGS)
|
||||
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
|
||||
ALL_CFLAGS_SHLIB = $(CPPFLAGS) $(CFLAGS_SHLIB) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
|
||||
ALL_CFLAGS_STLIB = $(CPPFLAGS) $(CFLAGS_STLIB) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
|
||||
ALL_LDFLAGS = $(LDFLAGS) @LDFLAG_DYNAMIC@
|
||||
LDFLAGS_STATIC = $(LDFLAGS) @LDFLAG_STATIC@
|
||||
LDFLAGS_STATIC = @LDFLAGS_STATIC@
|
||||
BUILD_CFLAGS = @BUILD_CFLAGS@
|
||||
BUILD_LDFLAGS = @BUILD_LDFLAGS@
|
||||
RDYNAMIC = @RDYNAMIC@
|
||||
|
@ -198,7 +203,7 @@ WFLAGS= -std=gnu99 -D_XOPEN_SOURCE=600 -D_GNU_SOURCE \
|
|||
-UENABLE_NLS
|
||||
|
||||
gcc-wall-new:
|
||||
($(MAKE) CFLAGS="$(ALL_CFLAGS) $(WFLAGS)" > /dev/null) 2>&1 | sed -f $(top_srcdir)/util/gcc-wall-cleanup
|
||||
($(MAKE) CFLAGS_WARN="$(WFLAGS)" > /dev/null) 2>&1 | sed -f $(top_srcdir)/util/gcc-wall-cleanup
|
||||
|
||||
gcc-wall:
|
||||
$(MAKE) clean > /dev/null
|
||||
|
|
2
README
2
README
|
@ -1,4 +1,4 @@
|
|||
This is the new version (1.43) of the second extended file
|
||||
This is the new version (1.43.3) of the second extended file
|
||||
system management programs.
|
||||
|
||||
From time to time, I release new versions of e2fsprogs, to fix
|
||||
|
|
184
RELEASE-NOTES
184
RELEASE-NOTES
|
@ -1,3 +1,185 @@
|
|||
E2fsprogs 1.43.3 (September 4, 2016)
|
||||
====================================
|
||||
|
||||
Fix e2fsck's handling of timestamps on 32-bit systems.
|
||||
|
||||
E2fsck will now check, and if necessary repair the extra isize fields
|
||||
in the inode and superblock.
|
||||
|
||||
Fix crashes on architectures such as sparc64 that are sensitive to
|
||||
unaligned pointer derferences in the journal recovery code when
|
||||
journal checksums are enabled.
|
||||
|
||||
Programming notes
|
||||
-----------------
|
||||
|
||||
Support reproducible builds by not capturing the build directory into
|
||||
the mk_cmds and compile_et scripts. Also fix debian build rules to
|
||||
ensure build reproducibility.
|
||||
|
||||
Fix debian build rules to ensure build reproducibility and to avoid
|
||||
hiding the linker flags for e2fsck.static so the build hardening log
|
||||
scanner can properly audit the build.
|
||||
|
||||
Fix compatibility with FreeBSD's pmake and teach the configure script
|
||||
to force the creation of pmake-compatible Makefiles if the
|
||||
FORCE_NATIVE_MAKE environment variable is set to a non-empty value.
|
||||
|
||||
|
||||
E2fsprogs 1.43.2 (September 1, 2016)
|
||||
====================================
|
||||
|
||||
Fix resize2fs so it will not crash if there is an extended attribute
|
||||
block but it doesn't need to migate any blocks during an off-line
|
||||
resize
|
||||
|
||||
Fix a crash when mke2fs or debugfs tries to copy in a directory
|
||||
hierarchy containing an empty directory
|
||||
|
||||
Mke2fs will now use a larger journal by default for filesystems
|
||||
greater than 128 GB. (1GB instead of 128 MB.)
|
||||
|
||||
Fix an alignment bug in e2fsck which caused sparc64 architectures to
|
||||
crash when replaying the journal on file systems with a 64-bit block
|
||||
number.
|
||||
|
||||
Clarify the message printed by tune2fs message when the user needs to
|
||||
run e2fsck so it's clear that the -f flag to e2fsck is needed to
|
||||
force a full e2fsck scan. (Addresses Debian Bug: #828022)
|
||||
|
||||
Fix a bug in e2fsck caused by a power failure during e2fsck's journal
|
||||
replay could leave the file system in a state where if the file system
|
||||
is mounted without doing a full e2fsck scan, the file system could get
|
||||
corrupted
|
||||
|
||||
Fix the logic in e2fsck which decides when to repair legacy negative
|
||||
timestamp encodings.
|
||||
|
||||
Add a command to debugfs to copy the inode structure from one inode to
|
||||
another.
|
||||
|
||||
Fix a typo in debugfs's stat command when printing out the dtime field
|
||||
on file systems with an extended timestamp.
|
||||
|
||||
Fix big endian bugs in the e2undo program. (Addresses Red Hat Bug
|
||||
#1344636)
|
||||
|
||||
Debugfs's logdump can now properly handle journals larger than 2GB.
|
||||
|
||||
Avoid installing the man page for fuse2fs if it has not been built.
|
||||
|
||||
Update the Catalan, Chinese, Danish, Dutch, French, German, Polish,
|
||||
Swedish, Ukrainian translations and added new translations for
|
||||
Hugarian and Serbian.
|
||||
|
||||
|
||||
Programming notes
|
||||
-----------------
|
||||
|
||||
Fix portability problems in fuse2fs. Previously it wouldn't build on
|
||||
systems with older glibc versions where clock_gettime() is only
|
||||
available in the librt library, and if libintl is not bundled into the
|
||||
C library.
|
||||
|
||||
Remove complicated logic which caused a static code analyzer to flag a
|
||||
false positive. (A static code analyzer also found a valid bug in
|
||||
deciding when to repair a legacy negative timestamp encoding, so
|
||||
eliminating false positives is important.)
|
||||
|
||||
Fixed a bug where the ext2fs library cloud provoke when a
|
||||
extfs2_zero_blocks() is used (via fallocation, initializing a file
|
||||
system, uninitialized uninitialized inode table blocks) after a
|
||||
different file system which also used ext2fs_zero_blocks().
|
||||
|
||||
Enable the unix_io manager in the ext2fs library so it can accept the
|
||||
use of a file descriptor. This is helpful in cases where the file
|
||||
descriptor comes from temporary file created using O_TMPFILE, or
|
||||
passed in from a unix domain socket.
|
||||
|
||||
Fix a Windows64 portability bug.
|
||||
|
||||
|
||||
E2fsprogs 1.43.1 (June 8, 2016)
|
||||
===============================
|
||||
|
||||
Fixed e2fsck so that it would correctly update the project quota usage
|
||||
when deleting a corrupted and inode, and fixed mke2fs so it wouldn't
|
||||
dereference memory beyond the small inode structure (which was wrong,
|
||||
but worked mostly by accident unless hardening or some security malloc
|
||||
was in use).
|
||||
|
||||
Fixed a large number of FreeBSD portability problems. (To build on
|
||||
FreeBSD, however, we still need to use GNU Make and redirect dd to use
|
||||
GNU dd.)
|
||||
|
||||
The configure script now supports --enable-hardening, which enables
|
||||
stack protection, fortify, read-only relocation tables, immediate
|
||||
dynamic symbol binding, and text segment ASLR (if the kernel has
|
||||
userspace ASLR support enabled) by enabling position independent
|
||||
executable code. (Distributions who want to do their own special
|
||||
thing can set CFLAGS, CFLAGS_SHLIB, CLFAGS_STLIB, LDFLAGS,
|
||||
LDFLAGS_SHLIB and LDFLAGS_STATIC as appropriate.)
|
||||
|
||||
The configure script now supports --disable-tdb since on 64-bit
|
||||
systems, it's much faster to just enable additional swap space. The
|
||||
scratch_files feature in e2fsck.conf is mostly only useful on 32-bit
|
||||
systems.
|
||||
|
||||
Fixed the Direct I/O fallback codepath in the Unix I/O manager so that
|
||||
read/modify/write worked correctly. Fortunately in practice (with the
|
||||
exception of the Undo handler when running on FreeBSD) used this buggy
|
||||
codepath. so file systems weren't getting corrupted.
|
||||
|
||||
Mke2fs will now warn if the user provides a label which is too long.
|
||||
(Addresses Debian Bug: #791630)
|
||||
|
||||
Debugfs's rdump command now works correctly when dumping the root
|
||||
directory of a file system. (Addresses Debian Bug: #766125)
|
||||
|
||||
Fixed a bug in debugfs so it would correctly calculate a block group's
|
||||
checksum field field on 64-bit ssystems.
|
||||
|
||||
E2fsck now has a much more understandable error message when the
|
||||
journal superblock is corrupt and the user declines to fix it.
|
||||
(Addresses Debian Bug: #768162)
|
||||
|
||||
Fixed support of extended timestamps on 64-bit systems.
|
||||
|
||||
Updated/fixed various man pages. (Addresses Debian Bugs: #766379,
|
||||
#761144, #770750, #428361, #766127)
|
||||
|
||||
Fixed various Debian Packaging Issues. (Addresses Debian Bug: #825868)
|
||||
|
||||
|
||||
Programming notes
|
||||
-----------------
|
||||
|
||||
Fixed coverity, sparse, gcc -Wall, and clang warnings/nits.
|
||||
|
||||
Fixed Android build makefiles (which was missing a newly added file in
|
||||
lib/support).
|
||||
|
||||
In general, checks on s_creator_os have been removed in favor of
|
||||
feature flag specific checks; if there is something that can't be
|
||||
checked via the presence of a feature flag, we will simply check
|
||||
whether the creator OS is *not* EXT2_OS_HURD which is the one
|
||||
operating system where there has been extensive abuse of the
|
||||
s_creator_os flag.
|
||||
|
||||
The libmagic libary has been suppressed when running the regression
|
||||
test suite to avoid false test failures caused by differences between
|
||||
versions of libmagic (and/or the magic number database).
|
||||
|
||||
The tests/test_script progam now accepts the --failed option, which
|
||||
will run those tests that had previously failed.
|
||||
|
||||
Fixed tests build on those systems which require LDFLAGS to be set.
|
||||
|
||||
Fixed the regression test suite so it will properly filter out version
|
||||
numbers with two components (such as 1.43) from log files before
|
||||
comparing them with the expected golden output.
|
||||
|
||||
|
||||
E2fsprogs 1.43 (May 17, 2016)
|
||||
=============================
|
||||
|
||||
|
@ -177,7 +359,7 @@ Updated/fixed various man pages. (Addresses Debian Bug: #798425)
|
|||
Programmer's Notes
|
||||
------------------
|
||||
|
||||
Fixed coverity, sparce gcc -Wall, and clang warnings/nits.
|
||||
Fixed coverity, sparse gcc -Wall, and clang warnings/nits.
|
||||
|
||||
Added Android build files so that e2fsprogs can be built in the
|
||||
Android source tree.
|
||||
|
|
|
@ -108,7 +108,12 @@ AC_DEFUN(
|
|||
[CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
|
||||
_cv_gnu_make_command='' ;
|
||||
dnl Search all the common names for GNU make
|
||||
for a in "$MAKE" make gmake gnumake ; do
|
||||
if test -n "$FORCE_NATIVE_MAKE" ; then
|
||||
MAKES="make"
|
||||
else
|
||||
MAKES="make gmake gnumake"
|
||||
fi
|
||||
for a in "$MAKE" $MAKES ; do
|
||||
if test -z "$a" ; then continue ; fi ;
|
||||
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
|
||||
_cv_gnu_make_command=$a ;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2016 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2015-03-04'
|
||||
timestamp='2016-05-15'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -27,7 +27,7 @@ timestamp='2015-03-04'
|
|||
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
|
||||
#
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
|
||||
#
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
|
||||
|
@ -50,7 +50,7 @@ version="\
|
|||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
Copyright 1992-2016 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -186,9 +186,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||
esac
|
||||
# The Operating System including object format, if it has switched
|
||||
# to ELF recently, or will in the future.
|
||||
# to ELF recently (or will in the future) and ABI.
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
earm*)
|
||||
os=netbsdelf
|
||||
;;
|
||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ELF__
|
||||
|
@ -221,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
release='-gnu'
|
||||
;;
|
||||
*)
|
||||
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
|
||||
;;
|
||||
esac
|
||||
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
|
||||
|
@ -237,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:LibertyBSD:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:ekkoBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
|
@ -249,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
*:MirBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:Sortix:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-sortix
|
||||
exit ;;
|
||||
alpha:OSF1:*:*)
|
||||
case $UNAME_RELEASE in
|
||||
*4.0)
|
||||
|
@ -265,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
|
||||
case "$ALPHA_CPU_TYPE" in
|
||||
"EV4 (21064)")
|
||||
UNAME_MACHINE="alpha" ;;
|
||||
UNAME_MACHINE=alpha ;;
|
||||
"EV4.5 (21064)")
|
||||
UNAME_MACHINE="alpha" ;;
|
||||
UNAME_MACHINE=alpha ;;
|
||||
"LCA4 (21066/21068)")
|
||||
UNAME_MACHINE="alpha" ;;
|
||||
UNAME_MACHINE=alpha ;;
|
||||
"EV5 (21164)")
|
||||
UNAME_MACHINE="alphaev5" ;;
|
||||
UNAME_MACHINE=alphaev5 ;;
|
||||
"EV5.6 (21164A)")
|
||||
UNAME_MACHINE="alphaev56" ;;
|
||||
UNAME_MACHINE=alphaev56 ;;
|
||||
"EV5.6 (21164PC)")
|
||||
UNAME_MACHINE="alphapca56" ;;
|
||||
UNAME_MACHINE=alphapca56 ;;
|
||||
"EV5.7 (21164PC)")
|
||||
UNAME_MACHINE="alphapca57" ;;
|
||||
UNAME_MACHINE=alphapca57 ;;
|
||||
"EV6 (21264)")
|
||||
UNAME_MACHINE="alphaev6" ;;
|
||||
UNAME_MACHINE=alphaev6 ;;
|
||||
"EV6.7 (21264A)")
|
||||
UNAME_MACHINE="alphaev67" ;;
|
||||
UNAME_MACHINE=alphaev67 ;;
|
||||
"EV6.8CB (21264C)")
|
||||
UNAME_MACHINE="alphaev68" ;;
|
||||
UNAME_MACHINE=alphaev68 ;;
|
||||
"EV6.8AL (21264B)")
|
||||
UNAME_MACHINE="alphaev68" ;;
|
||||
UNAME_MACHINE=alphaev68 ;;
|
||||
"EV6.8CX (21264D)")
|
||||
UNAME_MACHINE="alphaev68" ;;
|
||||
UNAME_MACHINE=alphaev68 ;;
|
||||
"EV6.9A (21264/EV69A)")
|
||||
UNAME_MACHINE="alphaev69" ;;
|
||||
UNAME_MACHINE=alphaev69 ;;
|
||||
"EV7 (21364)")
|
||||
UNAME_MACHINE="alphaev7" ;;
|
||||
UNAME_MACHINE=alphaev7 ;;
|
||||
"EV7.9 (21364A)")
|
||||
UNAME_MACHINE="alphaev79" ;;
|
||||
UNAME_MACHINE=alphaev79 ;;
|
||||
esac
|
||||
# A Pn.n version is a patched version.
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
|
||||
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||
exitcode=$?
|
||||
trap '' 0
|
||||
|
@ -373,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
exit ;;
|
||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||
eval $set_cc_for_build
|
||||
SUN_ARCH="i386"
|
||||
SUN_ARCH=i386
|
||||
# If there is a compiler, see if it is configured for 64-bit objects.
|
||||
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
|
||||
# This test works for both compilers.
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
|
||||
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
SUN_ARCH="x86_64"
|
||||
SUN_ARCH=x86_64
|
||||
fi
|
||||
fi
|
||||
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
|
@ -407,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
exit ;;
|
||||
sun*:*:4.2BSD:*)
|
||||
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
|
||||
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
|
||||
test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
|
||||
case "`/bin/arch`" in
|
||||
sun3)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
|
@ -632,13 +642,13 @@ EOF
|
|||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
32) HP_ARCH=hppa2.0n ;;
|
||||
64) HP_ARCH=hppa2.0w ;;
|
||||
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
|
@ -677,11 +687,11 @@ EOF
|
|||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
(CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||
fi ;;
|
||||
esac
|
||||
if [ ${HP_ARCH} = "hppa2.0w" ]
|
||||
if [ ${HP_ARCH} = hppa2.0w ]
|
||||
then
|
||||
eval $set_cc_for_build
|
||||
|
||||
|
@ -694,12 +704,12 @@ EOF
|
|||
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
|
||||
# => hppa64-hp-hpux11.23
|
||||
|
||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
grep -q __LP64__
|
||||
then
|
||||
HP_ARCH="hppa2.0w"
|
||||
HP_ARCH=hppa2.0w
|
||||
else
|
||||
HP_ARCH="hppa64"
|
||||
HP_ARCH=hppa64
|
||||
fi
|
||||
fi
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
|
@ -804,14 +814,14 @@ EOF
|
|||
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
|
||||
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
5000:UNIX_System_V:4.*:*)
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
|
@ -893,7 +903,7 @@ EOF
|
|||
exit ;;
|
||||
*:GNU/*:*:*)
|
||||
# other systems with GNU libc and userland
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
|
||||
exit ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
|
@ -916,7 +926,7 @@ EOF
|
|||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
|
||||
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arc:Linux:*:* | arceb:Linux:*:*)
|
||||
|
@ -962,6 +972,9 @@ EOF
|
|||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
k1om:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
|
@ -1038,7 +1051,7 @@ EOF
|
|||
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
|
@ -1117,7 +1130,7 @@ EOF
|
|||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# Note: whatever this is, it MUST be the same as what config.sub
|
||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||
# prints for the "djgpp" host, or else GDB configure will decide that
|
||||
# this is a cross-build.
|
||||
echo i586-pc-msdosdjgpp
|
||||
exit ;;
|
||||
|
@ -1266,6 +1279,9 @@ EOF
|
|||
SX-8R:SUPER-UX:*:*)
|
||||
echo sx8r-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-ACE:SUPER-UX:*:*)
|
||||
echo sxace-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
Power*:Rhapsody:*:*)
|
||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||
exit ;;
|
||||
|
@ -1279,9 +1295,9 @@ EOF
|
|||
UNAME_PROCESSOR=powerpc
|
||||
fi
|
||||
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
|
@ -1303,7 +1319,7 @@ EOF
|
|||
exit ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
UNAME_PROCESSOR=`uname -p`
|
||||
if test "$UNAME_PROCESSOR" = "x86"; then
|
||||
if test "$UNAME_PROCESSOR" = x86; then
|
||||
UNAME_PROCESSOR=i386
|
||||
UNAME_MACHINE=pc
|
||||
fi
|
||||
|
@ -1334,7 +1350,7 @@ EOF
|
|||
# "uname -m" is not consistent, so use $cputype instead. 386
|
||||
# is converted to i386 for consistency with other x86
|
||||
# operating systems.
|
||||
if test "$cputype" = "386"; then
|
||||
if test "$cputype" = 386; then
|
||||
UNAME_MACHINE=i386
|
||||
else
|
||||
UNAME_MACHINE="$cputype"
|
||||
|
@ -1376,7 +1392,7 @@ EOF
|
|||
echo i386-pc-xenix
|
||||
exit ;;
|
||||
i*86:skyos:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
|
||||
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
|
||||
exit ;;
|
||||
i*86:rdos:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-rdos
|
||||
|
@ -1387,23 +1403,25 @@ EOF
|
|||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
amd64:Isilon\ OneFS:*:*)
|
||||
echo x86_64-unknown-onefs
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
cat >&2 <<EOF
|
||||
$0: unable to guess system type
|
||||
|
||||
This script, last modified $timestamp, has failed to recognize
|
||||
the operating system you are using. It is advised that you
|
||||
download the most up to date version of the config scripts from
|
||||
This script (version $timestamp), has failed to recognize the
|
||||
operating system you are using. If your script is old, overwrite
|
||||
config.guess and config.sub with the latest versions from:
|
||||
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
|
||||
and
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
|
||||
|
||||
If the version you run ($0) is already up to date, please
|
||||
send the following data and any information you think might be
|
||||
pertinent to <config-patches@gnu.org> in order to provide the needed
|
||||
information to handle your system.
|
||||
If $0 has already been updated, send the following data and any
|
||||
information you think might be pertinent to config-patches@gnu.org to
|
||||
provide the necessary information to handle your system.
|
||||
|
||||
config.guess timestamp = $timestamp
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2016 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2015-03-08'
|
||||
timestamp='2016-08-25'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -33,7 +33,7 @@ timestamp='2015-03-08'
|
|||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
|
@ -53,8 +53,7 @@ timestamp='2015-03-08'
|
|||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
|
@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
Copyright 1992-2016 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -255,6 +254,7 @@ case $basic_machine in
|
|||
| arc | arceb \
|
||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||
| avr | avr32 \
|
||||
| ba \
|
||||
| be32 | be64 \
|
||||
| bfin \
|
||||
| c4x | c8051 | clipper \
|
||||
|
@ -305,7 +305,7 @@ case $basic_machine in
|
|||
| riscv32 | riscv64 \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
|
@ -376,6 +376,7 @@ case $basic_machine in
|
|||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| ba-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
|
@ -428,12 +429,13 @@ case $basic_machine in
|
|||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pyramid-* \
|
||||
| riscv32-* | riscv64-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
|
@ -518,7 +520,7 @@ case $basic_machine in
|
|||
basic_machine=i386-pc
|
||||
os=-aros
|
||||
;;
|
||||
asmjs)
|
||||
asmjs)
|
||||
basic_machine=asmjs-unknown
|
||||
;;
|
||||
aux)
|
||||
|
@ -641,6 +643,14 @@ case $basic_machine in
|
|||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
e500v[12])
|
||||
basic_machine=powerpc-unknown
|
||||
os=$os"spe"
|
||||
;;
|
||||
e500v[12]-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=$os"spe"
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
|
@ -1020,7 +1030,7 @@ case $basic_machine in
|
|||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
ppcle | powerpclittle)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
|
@ -1030,7 +1040,7 @@ case $basic_machine in
|
|||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
ppc64le | powerpc64little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
;;
|
||||
ppc64le-* | powerpc64little-*)
|
||||
|
@ -1376,18 +1386,18 @@ case $os in
|
|||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* | -cloudabi* \
|
||||
| -aos* | -aros* | -cloudabi* | -sortix* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
|
@ -1396,7 +1406,8 @@ case $os in
|
|||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
|
||||
| -onefs* | -tirtos* | -phoenix*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
|
@ -1528,6 +1539,8 @@ case $os in
|
|||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-ios)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
|
|
|
@ -625,14 +625,15 @@ gl_use_threads_default=
|
|||
ac_func_list=
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
LDFLAGS_SHLIB
|
||||
CFLAGS_STLIB
|
||||
CFLAGS_SHLIB
|
||||
BUILD_LDFLAGS
|
||||
BUILD_CFLAGS
|
||||
MKINSTALLDIRS
|
||||
INCLUDES
|
||||
DO_TEST_SUITE
|
||||
ET_DIR
|
||||
SS_DIR
|
||||
LDFLAG_STATIC
|
||||
LDFLAGS_STATIC
|
||||
root_sysconfdir
|
||||
root_libdir
|
||||
root_sbindir
|
||||
|
@ -645,8 +646,10 @@ UNI_DIFF_OPTS
|
|||
SEM_INIT_LIB
|
||||
FUSE_CMT
|
||||
FUSE_LIB
|
||||
CLOCK_GETTIME_LIB
|
||||
MAGIC_LIB
|
||||
SOCKET_LIB
|
||||
SIZEOF_TIME_T
|
||||
SIZEOF_OFF_T
|
||||
SIZEOF_LONG_LONG
|
||||
SIZEOF_LONG
|
||||
|
@ -727,6 +730,8 @@ SET_MAKE
|
|||
VERSION
|
||||
PACKAGE
|
||||
GETTEXT_PACKAGE
|
||||
TDB_MAN_COMMENT
|
||||
TDB_CMT
|
||||
UUIDD_CMT
|
||||
E2INITRD_MAN
|
||||
E2INITRD_PROG
|
||||
|
@ -857,6 +862,7 @@ enable_elf_shlibs
|
|||
enable_bsd_shlibs
|
||||
enable_profile
|
||||
enable_gcov
|
||||
enable_hardening
|
||||
enable_jbd_debug
|
||||
enable_blkid_debug
|
||||
enable_testio_debug
|
||||
|
@ -872,6 +878,7 @@ enable_e2initrd_helper
|
|||
enable_tls
|
||||
enable_uuidd
|
||||
enable_mmp
|
||||
enable_tdb
|
||||
enable_bmap_stats
|
||||
enable_bmap_stats_ops
|
||||
enable_nls
|
||||
|
@ -1529,6 +1536,7 @@ Optional Features:
|
|||
--enable-bsd-shlibs select BSD shared libraries
|
||||
--enable-profile build profiling libraries
|
||||
--enable-gcov build for coverage testing using gcov
|
||||
--enable-hardening build for coverage testing using gcov
|
||||
--enable-jbd-debug enable journal debugging
|
||||
--enable-blkid-debug enable blkid debugging
|
||||
--disable-testio-debug disable the use of the test I/O manager for debugging
|
||||
|
@ -1544,6 +1552,7 @@ Optional Features:
|
|||
--disable-tls disable use of thread local support
|
||||
--disable-uuidd disable building the uuid daemon
|
||||
--disable-mmp disable support mmp, Multi Mount Protection
|
||||
--disable-tdb disable tdb support
|
||||
--disable-bmap-stats disable collection of bitmap stats.
|
||||
--enable-bmap-stats-ops enable collection of additional bitmap stats
|
||||
--disable-nls do not use Native Language Support
|
||||
|
@ -3718,9 +3727,6 @@ fi
|
|||
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
|
||||
if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
|
||||
DLOPEN_LIB=-ldl
|
||||
|
||||
$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
@ -5012,6 +5018,27 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
CFLAGS_SHLIB="${CFLAGS_SHLIB:-$CFLAGS}"
|
||||
CFLAGS_STLIB="${CFLAGS_STLIB:-$CFLAGS}"
|
||||
LDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
|
||||
LDFLAGS_STATIC=${LDFLAGS_STATIC:-$LDFLAGS}
|
||||
# Check whether --enable-hardening was given.
|
||||
if test "${enable_hardening+set}" = set; then :
|
||||
enableval=$enable_hardening; if test "$enableval" = "yes"
|
||||
then
|
||||
HARDEN_CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong"
|
||||
HARDEN_LDFLAGS="-Wl,-z,relro -Wl,-z,now"
|
||||
CFLAGS="$CFLAGS $HARDEN_CFLAGS -fPIE"
|
||||
CFLAGS_SHLIB="$CFLAGS_SHLIB $HARDEN_CFLAGS"
|
||||
CFLAGS_STLIB="$CFLAGS_STLIB $HARDEN_CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS $HARDEN_LDFLAGS -fPIE -pie"
|
||||
LDFLAGS_STATIC="$LDFLAGS_STATIC $HARDEN_LDFLAGS"
|
||||
LDFLAGS_SHLIB="$LDFLAGS_SHLIB $HARDEN_LDFLAGS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling hardening support" >&5
|
||||
$as_echo "Enabling hardening support" >&6; }
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
@ -5913,6 +5940,36 @@ $as_echo "#define CONFIG_MMP 1" >>confdefs.h
|
|||
fi
|
||||
|
||||
|
||||
# Check whether --enable-tdb was given.
|
||||
if test "${enable_tdb+set}" = set; then :
|
||||
enableval=$enable_tdb; if test "$enableval" = "no"
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling tdb support" >&5
|
||||
$as_echo "Disabling tdb support" >&6; }
|
||||
TDB_CMT="#"
|
||||
TDB_MAN_COMMENT='.\"'
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling tdb support" >&5
|
||||
$as_echo "Enabling tdb support" >&6; }
|
||||
$as_echo "#define CONFIG_TDB 1" >>confdefs.h
|
||||
|
||||
TDB_CMT=""
|
||||
TDB_MAN_COMMENT=""
|
||||
fi
|
||||
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling mmp support by default" >&5
|
||||
$as_echo "Enabling mmp support by default" >&6; }
|
||||
$as_echo "#define CONFIG_TDB 1" >>confdefs.h
|
||||
|
||||
TDB_CMT=""
|
||||
TDB_MAN_COMMENT=""
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-bmap-stats was given.
|
||||
if test "${enable_bmap_stats+set}" = set; then :
|
||||
enableval=$enable_bmap_stats; if test "$enableval" = "no"
|
||||
|
@ -11458,7 +11515,12 @@ if ${_cv_gnu_make_command+:} false; then :
|
|||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
_cv_gnu_make_command='' ;
|
||||
for a in "$MAKE" make gmake gnumake ; do
|
||||
if test -n "$FORCE_NATIVE_MAKE" ; then
|
||||
MAKES="make"
|
||||
else
|
||||
MAKES="make gmake gnumake"
|
||||
fi
|
||||
for a in "$MAKE" $MAKES ; do
|
||||
if test -z "$a" ; then continue ; fi ;
|
||||
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
|
||||
_cv_gnu_make_command=$a ;
|
||||
|
@ -12567,11 +12629,46 @@ cat >>confdefs.h <<_ACEOF
|
|||
_ACEOF
|
||||
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
# This bug is HP SR number 8606223364.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5
|
||||
$as_echo_n "checking size of time_t... " >&6; }
|
||||
if ${ac_cv_sizeof_time_t+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then :
|
||||
|
||||
else
|
||||
if test "$ac_cv_type_time_t" = yes; then
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error 77 "cannot compute sizeof (time_t)
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
else
|
||||
ac_cv_sizeof_time_t=0
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5
|
||||
$as_echo "$ac_cv_sizeof_time_t" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SIZEOF_TIME_T $ac_cv_sizeof_time_t
|
||||
_ACEOF
|
||||
|
||||
|
||||
SIZEOF_SHORT=$ac_cv_sizeof_short
|
||||
SIZEOF_INT=$ac_cv_sizeof_int
|
||||
SIZEOF_LONG=$ac_cv_sizeof_long
|
||||
SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
|
||||
SIZEOF_OFF_T=$ac_cv_sizeof_off_t
|
||||
SIZEOF_TIME_T=$ac_cv_sizeof_time_t
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -12973,7 +13070,10 @@ if test "$ac_res" != no; then :
|
|||
fi
|
||||
|
||||
fi
|
||||
for ac_func in __secure_getenv add_key backtrace blkid_probe_get_topology blkid_probe_enable_partitions chflags fadvise64 fallocate fallocate64 fchown fdatasync fstat64 ftruncate64 futimes getcwd getdtablesize getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc
|
||||
if test -n "$DLOPEN_LIB" ; then
|
||||
ac_cv_func_dlopen=yes
|
||||
fi
|
||||
for ac_func in __secure_getenv add_key backtrace blkid_probe_get_topology blkid_probe_enable_partitions chflags dlopen fadvise64 fallocate fallocate64 fchown fdatasync fstat64 ftruncate64 futimes getcwd getdtablesize getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
|
@ -13079,10 +13179,51 @@ done
|
|||
|
||||
fi
|
||||
|
||||
if test "$ac_cv_lib_dl_dlopen" = yes ; then
|
||||
if test "$ac_cv_func_dlopen" = yes ; then
|
||||
MAGIC_LIB=$DLOPEN_LIB
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
|
||||
$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
|
||||
if ${ac_cv_lib_rt_clock_gettime+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lrt $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char clock_gettime ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return clock_gettime ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_rt_clock_gettime=yes
|
||||
else
|
||||
ac_cv_lib_rt_clock_gettime=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
|
||||
$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
|
||||
if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
|
||||
CLOCK_GETTIME_LIB=-lrt
|
||||
fi
|
||||
|
||||
|
||||
FUSE_CMT=
|
||||
FUSE_LIB=
|
||||
# Check whether --enable-fuse2fs was given.
|
||||
|
@ -13625,7 +13766,7 @@ $as_echo_n "checking whether we can link with -static... " >&6; }
|
|||
if ${ac_cv_e2fsprogs_use_static+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
|
||||
SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS_STATIC -static"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <stdio.h>
|
||||
|
@ -13654,9 +13795,8 @@ solaris2.*)
|
|||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_e2fsprogs_use_static" >&5
|
||||
$as_echo "$ac_cv_e2fsprogs_use_static" >&6; }
|
||||
LDFLAG_STATIC=
|
||||
if test $ac_cv_e2fsprogs_use_static = yes; then
|
||||
LDFLAG_STATIC=-static
|
||||
LDFLAGS_STATIC="$LDFLAGS_STATIC -static"
|
||||
fi
|
||||
|
||||
case "$host_os" in
|
||||
|
@ -13668,10 +13808,6 @@ $as_echo "#define _INTL_REDIRECT_MACROS 1" >>confdefs.h
|
|||
|
||||
;;
|
||||
esac
|
||||
SS_DIR=`cd ${srcdir}/lib/ss; pwd`
|
||||
ET_DIR=`cd ${srcdir}/lib/et; pwd`
|
||||
|
||||
|
||||
if test "$cross_compiling" = yes ; then
|
||||
DO_TEST_SUITE=
|
||||
else
|
||||
|
@ -13708,6 +13844,12 @@ if test $cross_compiling = no; then
|
|||
fi
|
||||
|
||||
|
||||
CFLAGS_SHLIB=${CFLAGS_SHLIB:-$CFLAGS}
|
||||
CFLAGS_STLIB=${CFLAGS_STLIB:-$CFLAGS}
|
||||
LDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
|
||||
|
||||
|
||||
|
||||
test -d lib || mkdir lib
|
||||
test -d include || mkdir include
|
||||
test -d include/linux || mkdir include/linux
|
||||
|
|
89
configure.ac
89
configure.ac
|
@ -84,9 +84,7 @@ dnl
|
|||
dnl Check to see if libdl exists for the sake of dlopen
|
||||
dnl
|
||||
DLOPEN_LIB=''
|
||||
AC_CHECK_LIB(dl, dlopen,
|
||||
[DLOPEN_LIB=-ldl
|
||||
AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if dlopen/libdl exists])])
|
||||
AC_CHECK_LIB(dl, dlopen,DLOPEN_LIB=-ldl)
|
||||
AC_SUBST(DLOPEN_LIB)
|
||||
dnl
|
||||
AC_ARG_WITH([cc],
|
||||
|
@ -355,7 +353,28 @@ then
|
|||
AC_MSG_RESULT([Enabling gcov support])
|
||||
fi
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl handle --enable-hardening
|
||||
dnl
|
||||
CFLAGS_SHLIB="${CFLAGS_SHLIB:-$CFLAGS}"
|
||||
CFLAGS_STLIB="${CFLAGS_STLIB:-$CFLAGS}"
|
||||
LDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
|
||||
LDFLAGS_STATIC=${LDFLAGS_STATIC:-$LDFLAGS}
|
||||
AC_ARG_ENABLE([hardening],
|
||||
[ --enable-hardening build for coverage testing using gcov],
|
||||
if test "$enableval" = "yes"
|
||||
then
|
||||
HARDEN_CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong"
|
||||
HARDEN_LDFLAGS=["-Wl,-z,relro -Wl,-z,now"]
|
||||
CFLAGS="$CFLAGS $HARDEN_CFLAGS -fPIE"
|
||||
CFLAGS_SHLIB="$CFLAGS_SHLIB $HARDEN_CFLAGS"
|
||||
CFLAGS_STLIB="$CFLAGS_STLIB $HARDEN_CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS $HARDEN_LDFLAGS -fPIE -pie"
|
||||
LDFLAGS_STATIC="$LDFLAGS_STATIC $HARDEN_LDFLAGS"
|
||||
LDFLAGS_SHLIB="$LDFLAGS_SHLIB $HARDEN_LDFLAGS"
|
||||
AC_MSG_RESULT([Enabling hardening support])
|
||||
fi
|
||||
)
|
||||
dnl
|
||||
dnl Substitute library extensions
|
||||
dnl
|
||||
|
@ -756,6 +775,31 @@ AC_MSG_RESULT([Enabling mmp support by default])
|
|||
AC_DEFINE(CONFIG_MMP, 1)
|
||||
)
|
||||
dnl
|
||||
dnl handle --disable-tdb
|
||||
dnl
|
||||
AH_TEMPLATE([CONFIG_TDB], [Define to 1 to enable tdb support])
|
||||
AC_ARG_ENABLE([tdb],
|
||||
[ --disable-tdb disable tdb support],
|
||||
if test "$enableval" = "no"
|
||||
then
|
||||
AC_MSG_RESULT([Disabling tdb support])
|
||||
TDB_CMT="#"
|
||||
TDB_MAN_COMMENT='.\"'
|
||||
else
|
||||
AC_MSG_RESULT([Enabling tdb support])
|
||||
AC_DEFINE(CONFIG_TDB, 1)
|
||||
TDB_CMT=""
|
||||
TDB_MAN_COMMENT=""
|
||||
fi
|
||||
,
|
||||
AC_MSG_RESULT([Enabling mmp support by default])
|
||||
AC_DEFINE(CONFIG_TDB, 1)
|
||||
TDB_CMT=""
|
||||
TDB_MAN_COMMENT=""
|
||||
)
|
||||
AC_SUBST(TDB_CMT)
|
||||
AC_SUBST(TDB_MAN_COMMENT)
|
||||
dnl
|
||||
dnl handle --disable-bmap-stats
|
||||
dnl
|
||||
AH_TEMPLATE([ENABLE_BMAP_STATS], [Define to 1 to enable bitmap stats.])
|
||||
|
@ -950,16 +994,19 @@ AC_CHECK_SIZEOF(int)
|
|||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_SIZEOF(off_t)
|
||||
AC_CHECK_SIZEOF(time_t)
|
||||
SIZEOF_SHORT=$ac_cv_sizeof_short
|
||||
SIZEOF_INT=$ac_cv_sizeof_int
|
||||
SIZEOF_LONG=$ac_cv_sizeof_long
|
||||
SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
|
||||
SIZEOF_OFF_T=$ac_cv_sizeof_off_t
|
||||
SIZEOF_TIME_T=$ac_cv_sizeof_time_t
|
||||
AC_SUBST(SIZEOF_SHORT)
|
||||
AC_SUBST(SIZEOF_INT)
|
||||
AC_SUBST(SIZEOF_LONG)
|
||||
AC_SUBST(SIZEOF_LONG_LONG)
|
||||
AC_SUBST(SIZEOF_OFF_T)
|
||||
AC_SUBST(SIZEOF_TIME_T)
|
||||
AC_C_BIGENDIAN
|
||||
if test $cross_compiling = no; then
|
||||
BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
|
||||
|
@ -1032,6 +1079,9 @@ if test -n "$BLKID_CMT"; then
|
|||
AC_SEARCH_LIBS([blkid_probe_all], [blkid])
|
||||
fi
|
||||
dnl
|
||||
if test -n "$DLOPEN_LIB" ; then
|
||||
ac_cv_func_dlopen=yes
|
||||
fi
|
||||
AC_CHECK_FUNCS(m4_flatten([
|
||||
__secure_getenv
|
||||
add_key
|
||||
|
@ -1039,6 +1089,7 @@ AC_CHECK_FUNCS(m4_flatten([
|
|||
blkid_probe_get_topology
|
||||
blkid_probe_enable_partitions
|
||||
chflags
|
||||
dlopen
|
||||
fadvise64
|
||||
fallocate
|
||||
fallocate64
|
||||
|
@ -1106,11 +1157,16 @@ dnl See if libmagic exists
|
|||
dnl
|
||||
AC_CHECK_LIB(magic, magic_file, [MAGIC_LIB=-lmagic
|
||||
AC_CHECK_HEADERS([magic.h])])
|
||||
if test "$ac_cv_lib_dl_dlopen" = yes ; then
|
||||
if test "$ac_cv_func_dlopen" = yes ; then
|
||||
MAGIC_LIB=$DLOPEN_LIB
|
||||
fi
|
||||
AC_SUBST(MAGIC_LIB)
|
||||
dnl
|
||||
dnl Check to see if librt is required for clock_gettime() (glibc < 2.17)
|
||||
dnl
|
||||
AC_CHECK_LIB(rt, clock_gettime, [CLOCK_GETTIME_LIB=-lrt])
|
||||
AC_SUBST(CLOCK_GETTIME_LIB)
|
||||
dnl
|
||||
dnl Check to see if the FUSE library is -lfuse or -losxfuse
|
||||
dnl
|
||||
FUSE_CMT=
|
||||
|
@ -1310,7 +1366,7 @@ dnl in static form.
|
|||
dnl
|
||||
AC_MSG_CHECKING([whether we can link with -static])
|
||||
AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
|
||||
[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
|
||||
[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS_STATIC -static"
|
||||
AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
|
||||
ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
|
||||
LDFLAGS=$SAVE_LDFLAGS])
|
||||
|
@ -1327,11 +1383,10 @@ solaris2.*)
|
|||
;;
|
||||
esac
|
||||
AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
|
||||
LDFLAG_STATIC=
|
||||
if test $ac_cv_e2fsprogs_use_static = yes; then
|
||||
LDFLAG_STATIC=-static
|
||||
LDFLAGS_STATIC="$LDFLAGS_STATIC -static"
|
||||
fi
|
||||
AC_SUBST(LDFLAG_STATIC)
|
||||
AC_SUBST(LDFLAGS_STATIC)
|
||||
dnl
|
||||
dnl Work around mysterious Darwin / GNU libintl problem
|
||||
dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
|
||||
|
@ -1345,13 +1400,6 @@ darwin*)
|
|||
;;
|
||||
esac
|
||||
dnl
|
||||
dnl Make the ss and et directories work correctly.
|
||||
dnl
|
||||
SS_DIR=`cd ${srcdir}/lib/ss; pwd`
|
||||
ET_DIR=`cd ${srcdir}/lib/et; pwd`
|
||||
AC_SUBST(SS_DIR)
|
||||
AC_SUBST(ET_DIR)
|
||||
dnl
|
||||
dnl Only try to run the test suite if we're not cross compiling.
|
||||
dnl
|
||||
if test "$cross_compiling" = yes ; then
|
||||
|
@ -1385,6 +1433,15 @@ fi
|
|||
AC_SUBST(BUILD_CFLAGS)
|
||||
AC_SUBST(BUILD_LDFLAGS)
|
||||
dnl
|
||||
dnl Define CFLAGS and LDFLAGS for shared libraries
|
||||
dnl
|
||||
CFLAGS_SHLIB=${CFLAGS_SHLIB:-$CFLAGS}
|
||||
CFLAGS_STLIB=${CFLAGS_STLIB:-$CFLAGS}
|
||||
LDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
|
||||
AC_SUBST(CFLAGS_SHLIB)
|
||||
AC_SUBST(CFLAGS_STLIB)
|
||||
AC_SUBST(LDFLAGS_SHLIB)
|
||||
dnl
|
||||
dnl Make our output files, being sure that we create the some miscellaneous
|
||||
dnl directories
|
||||
dnl
|
||||
|
|
|
@ -1,3 +1,84 @@
|
|||
e2fsprogs (1.43.3-1) unstable; urgency=medium
|
||||
|
||||
* Fix e2fsck's handling of timestamps on 32-bit system (Closes: #836559)
|
||||
* E2fsck will sanity check and repair the extra isize fields in inodes
|
||||
and the superblock.
|
||||
* Fix sparc64 crashes when dereferencing unaligned integers in journal
|
||||
blocks when metdata checksums are enabled.
|
||||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Sun, 04 Sep 2016 20:41:21 -0400
|
||||
|
||||
e2fsprogs (1.43.2-2) unstable; urgency=medium
|
||||
|
||||
* Fix build reproducibility problems
|
||||
* Don't hide the linker flags for e2fsck.static
|
||||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Thu, 01 Sep 2016 23:30:55 -0400
|
||||
|
||||
e2fsprogs (1.43.2-1) unstable; urgency=medium
|
||||
|
||||
* Change the default journal size to be larger for file systems larger
|
||||
than 128 GB to improve performance on metadata-heavy workloads
|
||||
* Clarify tune2fs's message when the user needs to run e2fsck
|
||||
(Closes: #828022)
|
||||
* Fix an alignment bug in e2fsck which caused sparc64 architectures to
|
||||
crash when replaying the journal on file systems with a 64-bit block
|
||||
number
|
||||
* Fix a typo in debugfs when printing out the dtime field on file
|
||||
systems with an extended timestamp
|
||||
* Fix the logic in e2fsck which decides when to repair legacy negative
|
||||
timestamp encodings.
|
||||
* Add a command to debugfs to copy the inode structure from one inode
|
||||
to another
|
||||
* Fix resize2fs so it will not crash if there is an extended
|
||||
attribute block but it doesn't need to migate any blocks during
|
||||
an off-line resize
|
||||
* Fix a crash when mke2fs or debugfs tries to copy in a directory
|
||||
hierarchy containing an empty directory
|
||||
* Fix a bug in e2fsck caused by a power failure during e2fsck's journal
|
||||
replay could leave the file system in a state where if the file
|
||||
system is mounted without doing a full e2fsck scan, the file system
|
||||
could get corrupted
|
||||
* Fix big endian bugs in the e2undo program
|
||||
* Fix debugfs's logdump so command so it can correctly handle journals
|
||||
which are larger than 2GB
|
||||
* Add new translations: Hugarian and Serbian
|
||||
* Update the Catalan, Chinese, Danish, Dutch, French, German, Polish,
|
||||
Swedish, Ukrainian translations
|
||||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Thu, 01 Sep 2016 00:55:13 -0400
|
||||
|
||||
e2fsprogs (1.43.1-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version
|
||||
* Fix the Direct I/O fallback code in the Unix I/O manager so it
|
||||
implements read-modify-write correctly.
|
||||
* The mke2fs program will now warn if the user specifies a label which
|
||||
is too long. (Closes: #791630)
|
||||
* Clean up various man pages (Closes: #766379, #761144, #770750,
|
||||
#428361, #766127)
|
||||
* Fix bug so that debugfs's rdump command works on the root directory
|
||||
(Closes: #766125)
|
||||
* Fix various Debian packaging issues (Closes: #825868)
|
||||
* Build fully security hardened binaries
|
||||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Tue, 07 Jun 2016 23:09:55 -0400
|
||||
|
||||
e2fsprogs (1.43-3) unstable; urgency=medium
|
||||
|
||||
* Fix various debian packaging nits
|
||||
* Fix spelling mistakes in the copyright files
|
||||
* Fix various spelling mistakes in man pages
|
||||
* Fix project quota bugs in e2fsck and mke2fs
|
||||
* Build binaries with hardening support
|
||||
* Improve e2fsck messages when the journal superblock is corrupt and
|
||||
the user declines to fix the journal. (Closes: #768162)
|
||||
* Fix debugfs's handling of "set_bg <bg> checksum calc" on 64-bit file
|
||||
systems.
|
||||
* Simplify the debian rules file
|
||||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Wed, 25 May 2016 00:51:33 -0400
|
||||
|
||||
e2fsprogs (1.43-2) unstable; urgency=medium
|
||||
|
||||
* Update watch file to check for the GPG signatures
|
||||
|
@ -16,6 +97,12 @@ e2fsprogs (1.43-1) unstable; urgency=medium
|
|||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Tue, 17 May 2016 01:04:28 -0400
|
||||
|
||||
e2fsprogs (1.43~WIP.2016.03.15-2) sid; urgency=low
|
||||
|
||||
* Fix FTBFS on big-endian systems
|
||||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Thu, 17 Mar 2016 22:55:52 -0400
|
||||
|
||||
e2fsprogs (1.43~WIP.2016.05.12-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version
|
||||
|
@ -240,7 +327,7 @@ e2fsprogs (1.42.11-1) unstable; urgency=medium
|
|||
* Fixed cross-compilation support. (Closes: #753375)
|
||||
* Update/fix various man pages
|
||||
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Wed, 9 July 2014 23:43:27 -0400
|
||||
-- Theodore Y. Ts'o <tytso@mit.edu> Wed, 9 Jul 2014 23:43:27 -0400
|
||||
|
||||
e2fsprogs (1.42.10-1.1) unstable; urgency=medium
|
||||
|
||||
|
|
|
@ -7,14 +7,25 @@ Source: e2fsprogs
|
|||
Section: admin
|
||||
Priority: required
|
||||
Maintainer: Theodore Y. Ts'o <tytso@mit.edu>
|
||||
Build-Depends: gettext, texinfo, pkg-config, gcc-multilib [mips mipsel], libfuse-dev, libattr1-dev, debhelper (>= 9.0), UTIL_LINUX_NG_DEFINES m4
|
||||
Build-Depends: gettext, texinfo, pkg-config, gcc-multilib [mips mipsel], libfuse-dev [linux-any kfreebsd-any], libattr1-dev, debhelper (>= 9.0), UTIL_LINUX_NG_DEFINES m4
|
||||
Standards-Version: 3.9.8
|
||||
Homepage: http://e2fsprogs.sourceforge.net
|
||||
|
||||
ifdef(`FUSE2FS',``
|
||||
Package: fuse2fs
|
||||
Priority: optional
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Architecture: linux-any kfreebsd-any
|
||||
Description: ext2 / ext3 / ext4 file system driver for FUSE
|
||||
fuse2fs is a FUSE file system client that supports reading and
|
||||
writing from devices or image files containing ext2, ext3, and ext4
|
||||
file systems.
|
||||
'')dnl
|
||||
|
||||
ifdef(`E2FSCK_STATIC',``
|
||||
Package: e2fsck-static
|
||||
Priority: optional
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Depends: ${misc:Depends}
|
||||
Recommends: sash | bash-static | zsh-static | busybox-static | zsh30-static
|
||||
Architecture: any
|
||||
Description: statically-linked version of the ext2/ext3/ext4 filesystem checker
|
||||
|
@ -124,7 +135,7 @@ Description: runtime components for the Universally Unique ID library
|
|||
|
||||
ifdef(`UDEB_PKGS',``
|
||||
Package: libuuid1-udeb
|
||||
XC-Package-Type: udeb
|
||||
Package-Type: udeb
|
||||
Section: debian-installer
|
||||
Priority: optional
|
||||
Depends: ${shlibs:Depends}
|
||||
|
@ -161,7 +172,7 @@ Description: block device id library
|
|||
|
||||
ifdef(`UDEB_PKGS',``
|
||||
Package: libblkid1-udeb
|
||||
XC-Package-Type: udeb
|
||||
Package-Type: udeb
|
||||
Section: debian-installer
|
||||
Priority: optional
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
|
@ -193,7 +204,7 @@ Description: block device id library - headers and static libraries
|
|||
|
||||
ifdef(`UDEB_PKGS',``
|
||||
Package: e2fsprogs-udeb
|
||||
XC-Package-Type: udeb
|
||||
Package-Type: udeb
|
||||
Section: debian-installer
|
||||
Priority: optional
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
|
@ -247,7 +258,7 @@ ifdef(`UTIL_LINUX_NG',
|
|||
``Pre-Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
'')dnl
|
||||
Multi-Arch: foreign
|
||||
Suggests: gpart, parted, e2fsck-static
|
||||
Suggests: gpart, parted, fuse2fs, e2fsck-static
|
||||
Conflicts: dump (<< 0.4b4-4), quota (<< 1.55-8.1), initscripts (<< 2.85-4), sysvinit (<< 2.85-4)
|
||||
Replaces: hurd (<= 20040301-1), libblkid1 (<< 1.38+1.39-WIP-2005.12.10-2), libuuid1 (<< 1.38+1.39-WIP-2005.12.10-2)
|
||||
Architecture: any
|
||||
|
|
|
@ -15,11 +15,11 @@ Upstream Author: Theodore Ts'o <tytso@mit.edu>
|
|||
Copyright notice:
|
||||
|
||||
This package, the EXT2 filesystem utilities, are made available under
|
||||
the GNU Public License version 2, with the exception of the lib/ext2fs
|
||||
and lib/e2p libraries, which are made available under the GNU Library
|
||||
General Public License Version 2, the lib/uuid library which is made
|
||||
available under a BSD-style license and the lib/et and lib/ss
|
||||
libraries which are made available under an MIT-style license.
|
||||
the GNU General Public License version 2, with the exception of the
|
||||
lib/ext2fs and lib/e2p libraries, which are made available under the
|
||||
GNU Library General Public License Version 2, the lib/uuid library
|
||||
which is made available under a BSD-style license and the lib/et and
|
||||
lib/ss libraries which are made available under an MIT-style license.
|
||||
|
||||
Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Theodore Ts'o
|
||||
|
|
|
@ -637,3 +637,4 @@ libext2fs.so.2 e2fslibs #MINVER#
|
|||
test_io_manager@Base 1.37
|
||||
undo_io_manager@Base 1.41.0
|
||||
unix_io_manager@Base 1.37
|
||||
unixfd_io_manager@Base 1.43.2
|
||||
|
|
|
@ -4,5 +4,5 @@ ifdef(`UTIL_LINUX_NG',,
|
|||
``libuuid 1 libuuid1 (>= 1.34-1)
|
||||
libblkid 1 libblkid1 (>= 1.34-1)
|
||||
'')dnl
|
||||
libext2fs 2 e2fslibs (= ${Source-Version})
|
||||
libe2p 2 e2fslibs (= ${Source-Version})
|
||||
libext2fs 2 e2fslibs (= ${binary:Version})
|
||||
libe2p 2 e2fslibs (= ${binary:Version})
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/usr/sbin/fuse2fs
|
||||
/usr/share/man/man1/fuse2fs.1
|
|
@ -1,5 +1,5 @@
|
|||
This is the Debian GNU/Linux prepackaged version of the ss
|
||||
command-line interface parsing library library. It is currently
|
||||
command-line interface parsing library. It is currently
|
||||
distributed together with the EXT2 file system utilities, which are
|
||||
otherwise packaged as "e2fsprogs".
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
-include debian/rules.custom
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS ?= hardening=+all
|
||||
|
||||
# be paranoid
|
||||
export LC_ALL ?= C
|
||||
|
||||
|
@ -25,6 +27,10 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null
|
|||
DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian)
|
||||
UTIL_LINUX_NG ?= yes
|
||||
|
||||
ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu)
|
||||
SKIP_FUSE2FS=yes
|
||||
endif
|
||||
|
||||
DH_VERSION := $(shell dpkg-query -W -f '$${Version}' debhelper)
|
||||
|
||||
# USE_DBGSYM :=
|
||||
|
@ -90,7 +96,6 @@ maindir ?= ${debdir}/e2fsprogs
|
|||
e2fsckstaticdir ?= ${debdir}/e2fsck-static
|
||||
debugdir ?= ${debdir}/e2fsprogs-dbg
|
||||
stdbuilddir ?= ${debdir}/BUILD-STD
|
||||
staticbuilddir ?= ${debdir}/BUILD-STATIC
|
||||
mipsbuilddir ?= ${debdir}/BUILD-MIPS
|
||||
mipsbuilddir64 ?= ${debdir}/BUILD-MIPS-64
|
||||
# docdir ?= ${maindir}/usr/share/doc/${package}
|
||||
|
@ -111,10 +116,8 @@ endif
|
|||
STAMPSDIR ?= debian/stampdir
|
||||
CFGSTDSTAMP ?= ${STAMPSDIR}/configure-std-stamp
|
||||
CFGBFSTAMP ?= ${STAMPSDIR}/configure-bf-stamp
|
||||
CFGSTATICSTAMP ?= ${STAMPSDIR}/configure-static-stamp
|
||||
BUILDSTDSTAMP ?= ${STAMPSDIR}/build-std-stamp
|
||||
BUILDBFSTAMP ?= ${STAMPSDIR}/build-bf-stamp
|
||||
BUILDSTATICSTAMP ?=${STAMPSDIR}/build-static-stamp
|
||||
|
||||
INSTALL ?= install
|
||||
INSTALL_PROGRAM ?= $(INSTALL) -p -o root -g root -m 0755
|
||||
|
@ -134,10 +137,13 @@ DEFAULT_CFLAGS ?= -g -O2
|
|||
DEFAULT_LDFLAGS ?= -Wl,-Bsymbolic-functions
|
||||
|
||||
CFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \
|
||||
DEB_BUILD_MAINT_OPTIONS=$(DEB_BUILD_MAINT_OPTIONS) \
|
||||
dpkg-buildflags --get CFLAGS; else echo $(DEFAULT_CFLAGS) ; fi)
|
||||
LDFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \
|
||||
DEB_BUILD_MAINT_OPTIONS=$(DEB_BUILD_MAINT_OPTIONS) \
|
||||
dpkg-buildflags --get LDFLAGS; else echo $(DEFAULT_LDFLAGS) ; fi)
|
||||
CPPFLAGS ?= $(shell if dpkg-buildflags > /dev/null 2>&1 ; then \
|
||||
DEB_BUILD_MAINT_OPTIONS=$(DEB_BUILD_MAINT_OPTIONS) \
|
||||
dpkg-buildflags --get CPPFLAGS; fi)
|
||||
|
||||
ifeq (${DEB_HOST_ARCH},alpha)
|
||||
|
@ -146,17 +152,12 @@ else
|
|||
CFLAGS += -D__NO_STRING_INLINES
|
||||
endif
|
||||
|
||||
ifneq (${DEB_HOST_ARCH_OS},linux)
|
||||
SKIP_STATIC = yes
|
||||
endif
|
||||
|
||||
ifeq ($(SKIP_STATIC),yes)
|
||||
BUILD_STATIC =
|
||||
E2FSCK_STATIC = ${stdbuilddir}/e2fsck/e2fsck.static
|
||||
else
|
||||
BUILD_STATIC = build-static
|
||||
E2FSCK_STATIC = ${staticbuilddir}/e2fsck/e2fsck.static
|
||||
endif
|
||||
|
||||
CFLAGS_SHLIB = $(CFLAGS)
|
||||
CFLAGS_STLIB = $(CFLAGS)
|
||||
LDFLAGS_SHLIB = $(LDFLAGS)
|
||||
LDFLAGS_STATIC = $(filter-out -fPIE -fpie -pie,$(LDFLAGS))
|
||||
|
||||
ifneq ($(SKIP_UDEB),)
|
||||
SKIP_BF ?= yes
|
||||
|
@ -180,7 +181,7 @@ UTIL_CONF_FLAGS ?= --enable-fsck --enable-libblkid \
|
|||
--enable-libuuid --enable-uuidd
|
||||
endif
|
||||
|
||||
ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu)
|
||||
ifneq ($(SKIP_FUSE2FS),)
|
||||
UTIL_CONF_FLAGS += --disable-fuse2fs
|
||||
endif
|
||||
|
||||
|
@ -203,10 +204,8 @@ COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-quota \
|
|||
STD_CONF_FLAGS ?= --enable-elf-shlibs
|
||||
|
||||
BF_CONF_FLAGS ?= --enable-elf-shlibs --disable-nls --disable-imager \
|
||||
--disable-testio-debug --disable-uuidd --disable-tls --disable-debugfs
|
||||
|
||||
STATIC_CONF_FLAGS ?= --disable-nls --disable-imager \
|
||||
--disable-uuidd --disable-tls
|
||||
--disable-testio-debug --disable-uuidd --disable-tls \
|
||||
--disable-tdb --disable-debugfs
|
||||
|
||||
MIPS_NOPIC_CONF_FLAGS ?= --disable-nls --disable-imager \
|
||||
--disable-uuidd --disable-tls \
|
||||
|
@ -258,6 +257,12 @@ else
|
|||
M4_ARGS+=-UUDEB_PKGS
|
||||
endif
|
||||
|
||||
ifeq ($(SKIP_FUSE2FS),)
|
||||
M4_ARGS+=-DFUSE2FS
|
||||
else
|
||||
M4_ARGS+=-UFUSE2FS
|
||||
endif
|
||||
|
||||
FILES_FIXUP= libcomerr2.files comerr-dev.files libss2.files ss-dev.files \
|
||||
libuuid1.files uuid-dev.files libblkid1.files libblkid-dev.files \
|
||||
e2fslibs.files e2fslibs-dev.files
|
||||
|
@ -289,28 +294,43 @@ ${CFGSTDSTAMP}:
|
|||
mkdir -p ${stdbuilddir}
|
||||
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
|
||||
cd ${stdbuilddir} && AWK=/usr/bin/awk \
|
||||
${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
|
||||
../../configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
|
||||
${EXTRA_CONF_FLAGS} CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" \
|
||||
LDFLAGS="$(LDFLAGS)"
|
||||
LDFLAGS="$(LDFLAGS)" CFLAGS_SHLIB="$(CFLAGS_SHLIB)" \
|
||||
CFLAGS_STLIB="$(CFLAGS_STLIB)" \
|
||||
LDFLAGS_SHLIB="$(LDFLAGS_SHLIB)" \
|
||||
LDFLAGS_STATIC="$(LDFLAGS_STATIC)"
|
||||
else
|
||||
cd ${stdbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
|
||||
${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
|
||||
../../configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
|
||||
${EXTRA_CONF_FLAGS} --build=$(DEB_BUILD_GNU_TYPE) \
|
||||
--host=$(DEB_HOST_GNU_TYPE) CFLAGS="${CFLAGS}" \
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
|
||||
CPPFLAGS="$(CPPFLAGS)" CFLAGS_SHLIB="$(CFLAGS_SHLIB)" \
|
||||
CFLAGS_STLIB="$(CFLAGS_STLIB)" \
|
||||
LDFLAGS="$(LDFLAGS)" \
|
||||
LDFLAGS_SHLIB="$(LDFLAGS_SHLIB)" \
|
||||
LDFLAGS_STATIC="$(LDFLAGS_STATIC)"
|
||||
endif
|
||||
|
||||
# specially-built MIPS libs
|
||||
ifneq ($(ismips),)
|
||||
mkdir -p ${mipsbuilddir} ${mipsbuilddir64}
|
||||
cd ${mipsbuilddir} && AWK=/usr/bin/awk \
|
||||
${topdir}/configure ${COMMON_CONF_FLAGS} \
|
||||
../../configure ${COMMON_CONF_FLAGS} \
|
||||
${MIPS_NOPIC_CONF_FLAGS} CFLAGS="${CFLAGS}" \
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
CFLAGS_SHLIB="$(CFLAGS_SHLIB)" \
|
||||
CFLAGS_STLIB="$(CFLAGS_STLIB)" \
|
||||
LDFLAGS_SHLIB="$(LDFLAGS_SHLIB)" \
|
||||
LDFLAGS_STATIC="$(LDFLAGS_STATIC)"
|
||||
cd ${mipsbuilddir64} && AWK=/usr/bin/awk \
|
||||
${topdir}/configure ${COMMON_CONF_FLAGS} \
|
||||
../../configure ${COMMON_CONF_FLAGS} \
|
||||
${MIPS_NOPIC_CONF_FLAGS} CFLAGS="${CFLAGS}" \
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
CFLAGS_SHLIB="$(CFLAGS_SHLIB)" \
|
||||
CFLAGS_STLIB="$(CFLAGS_STLIB)" \
|
||||
LDFLAGS_SHLIB="$(LDFLAGS_SHLIB)" \
|
||||
LDFLAGS_STATIC="$(LDFLAGS_STATIC)"
|
||||
endif
|
||||
|
||||
mkdir -p ${STAMPSDIR}
|
||||
|
@ -323,41 +343,30 @@ ${CFGBFSTAMP}:
|
|||
mkdir -p ${bfbuilddir}
|
||||
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
|
||||
cd ${bfbuilddir} && AWK=/usr/bin/awk \
|
||||
${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
|
||||
../../configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
|
||||
${EXTRA_CONF_FLAGS} CFLAGS="${CFLAGS} ${BF_CFLAGS}" \
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
CFLAGS_SHLIB="$(CFLAGS_SHLIB)" \
|
||||
CFLAGS_STLIB="$(CFLAGS_STLIB)" \
|
||||
LDFLAGS_SHLIB="$(LDFLAGS_SHLIB)" \
|
||||
LDFLAGS_STATIC="$(LDFLAGS_STATIC)"
|
||||
else
|
||||
cd ${bfbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
|
||||
${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
|
||||
../../configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
|
||||
${EXTRA_CONF_FLAGS} --build=$(DEB_BUILD_GNU_TYPE) \
|
||||
--host=$(DEB_HOST_GNU_TYPE) CFLAGS="${CFLAGS}" \
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
CFLAGS_SHLIB="$(CFLAGS_SHLIB)" \
|
||||
CFLAGS_STLIB="$(CFLAGS_STLIB)" \
|
||||
LDFLAGS_SHLIB="$(LDFLAGS_SHLIB)" \
|
||||
LDFLAGS_STATIC="$(LDFLAGS_STATIC)"
|
||||
endif
|
||||
mkdir -p ${STAMPSDIR}
|
||||
touch ${CFGBFSTAMP}
|
||||
|
||||
${CFGSTATICSTAMP}:
|
||||
dh_testdir
|
||||
rm -f config.cache
|
||||
|
||||
mkdir -p ${staticbuilddir}
|
||||
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
|
||||
cd ${staticbuilddir} && AWK=/usr/bin/awk ${topdir}/configure \
|
||||
${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
|
||||
CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
|
||||
else
|
||||
cd ${staticbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
|
||||
${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} \
|
||||
${EXTRA_CONF_FLAGS} --build=$(DEB_BUILD_GNU_TYPE) \
|
||||
--host=$(DEB_HOST_GNU_TYPE) CFLAGS="${CFLAGS}" \
|
||||
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
|
||||
endif
|
||||
mkdir -p ${STAMPSDIR}
|
||||
touch ${CFGSTATICSTAMP}
|
||||
|
||||
build-arch: build
|
||||
build-indep: build
|
||||
build: build-std $(BUILD_BF) $(BUILD_STATIC)
|
||||
build: build-std $(BUILD_BF)
|
||||
|
||||
build-std: ${BUILDSTDSTAMP}
|
||||
${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
|
||||
|
@ -369,6 +378,11 @@ ${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
|
|||
ifneq ($(BUILD_E2FSCK_STATIC),no)
|
||||
$(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static
|
||||
endif
|
||||
if ! test -d debian/orig-gmo ; then \
|
||||
mkdir debian/orig-gmo ; \
|
||||
mv po/*.gmo po/*.po debian/orig-gmo ; \
|
||||
cp debian/orig-gmo/*.po po ; \
|
||||
fi
|
||||
$(MAKE) -C ${stdbuilddir}/po V=1 update-gmo
|
||||
|
||||
( cd ${stdbuilddir}/doc && $(MAKE) V=1 libext2fs.html )
|
||||
|
@ -397,17 +411,13 @@ ${BUILDBFSTAMP}: ${CFGBFSTAMP}
|
|||
$(MAKE) -C ${bfbuilddir}/resize V=1 all
|
||||
touch ${BUILDBFSTAMP}
|
||||
|
||||
build-static: ${BUILDSTATICSTAMP}
|
||||
${BUILDSTATICSTAMP}: ${CFGSTATICSTAMP}
|
||||
dh_testdir
|
||||
$(MAKE) -C ${staticbuilddir} V=1 libs
|
||||
ifneq ($(BUILD_E2FSCK_STATIC),no)
|
||||
$(MAKE) -C ${staticbuilddir}/e2fsck V=1 all e2fsck.static
|
||||
endif
|
||||
touch ${BUILDSTATICSTAMP}
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
if test -d debian/orig-gmo ; then \
|
||||
rm -f po/*.gmo po/*.po ; \
|
||||
mv debian/orig-gmo/* po ; \
|
||||
rmdir debian/orig-gmo ; \
|
||||
fi
|
||||
rm -rf ${STAMPSDIR}
|
||||
[ ! -f ${stdbuilddir}/Makefile ] || $(MAKE) -C ${stdbuilddir} V=1 distclean
|
||||
[ ! -f ${bfbuilddir}/Makefile ] || $(MAKE) -C ${bfbuilddir} V=1 distclean
|
||||
|
@ -499,13 +509,7 @@ binary-arch: install $(INSTALL_UDEB)
|
|||
dh_testdir
|
||||
dh_testroot
|
||||
|
||||
# lintian overrides
|
||||
for i in $$(cd debian && echo *.lintian-overrides); do \
|
||||
pkg=$${i%.lintian-overrides} ;\
|
||||
if test "$${pkg}" != source ; then \
|
||||
$(INSTALL) -m 0644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\
|
||||
fi ;\
|
||||
done
|
||||
dh_lintian
|
||||
|
||||
# symlinks to prepare dh_installdocs run
|
||||
|
||||
|
@ -566,18 +570,7 @@ endif
|
|||
dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
|
||||
dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
|
||||
|
||||
DH_OPTIONS= dh_installchangelogs -pe2fsprogs \
|
||||
-plibcomerr${COMERR_SOVERSION} \
|
||||
-plibss${SS_SOVERSION} \
|
||||
-pe2fslibs $(DBG_PACKAGES)
|
||||
ifneq ($(BUILD_E2FSCK_STATIC),no)
|
||||
DH_OPTIONS= dh_installchangelogs -pe2fsck-static
|
||||
endif
|
||||
ifneq ($(UTIL_LINUX_NG),yes)
|
||||
DH_OPTIONS= dh_installchangelogs -plibuuid${UUID_SOVERSION} \
|
||||
-puuid-dev -puuid-runtime -plibblkid${BLKID_SOVERSION}
|
||||
endif
|
||||
|
||||
dh_installchangelogs
|
||||
dh_fixperms
|
||||
dh_strip $(call dh_strip_args,e2fsprogs)
|
||||
ifneq ($(BUILD_E2FSCK_STATIC),no)
|
||||
|
@ -606,41 +599,11 @@ endif
|
|||
/bin/rm debian/$$i.tmp-patch; \
|
||||
done
|
||||
|
||||
for i in e2fsprogs e2fslibs \
|
||||
$(if $(filter $(USE_DBGSYM),yes),,e2fsprogs-dbg e2fslibs-dbg) ; \
|
||||
do \
|
||||
$(INSTALL) -p -m 0644 debian/copyright \
|
||||
${debdir}/$$i/usr/share/doc/$$i/copyright; \
|
||||
done
|
||||
|
||||
ifneq ($(USE_DBGSYM),yes)
|
||||
ifneq ($(UTIL_LINUX_NG),yes)
|
||||
$(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \
|
||||
${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright
|
||||
endif
|
||||
|
||||
$(INSTALL) -p -m 0644 debian/libcomerr2.copyright \
|
||||
${libcomerrdbgdir}/usr/share/doc/libcomerr2-dbg/copyright
|
||||
|
||||
$(INSTALL) -p -m 0644 debian/libss2.copyright \
|
||||
${libssdbgdir}/usr/share/doc/libss2-dbg/copyright
|
||||
|
||||
ifneq ($(UTIL_LINUX_NG),yes)
|
||||
$(INSTALL) -p -m 0644 debian/libblkid.copyright \
|
||||
${libblkiddbgdir}/usr/share/doc/libblkid1-dbg/copyright
|
||||
|
||||
$(INSTALL) -p -m 0644 debian/libuuid1.copyright \
|
||||
${libuuiddbgdir}/usr/share/doc/libuuid1-dbg/copyright
|
||||
endif
|
||||
endif
|
||||
dh_compress
|
||||
|
||||
dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
|
||||
dh_makeshlibs --add-udeb=e2fsprogs-udeb
|
||||
ifeq ($(SKIP_UDEB),)
|
||||
dh_makeshlibs --add-udeb=e2fsprogs-udeb -plibcomerr${COMERR_SOVERSION} \
|
||||
-V 'libcomerr2 (>= 1.33-3)'
|
||||
ifneq ($(UTIL_LINUX_NG),yes)
|
||||
dh_makeshlibs -plibblkid${BLKID_SOVERSION} -V 'libblkid1 (>= 1.39-1)'
|
||||
echo "udeb: libblkid 1 libblkid1-udeb" >> \
|
||||
debian/libblkid1/DEBIAN/shlibs
|
||||
echo "udeb: libuuid 1 libuuid1-udeb" >> debian/libuuid1/DEBIAN/shlibs
|
||||
|
@ -655,6 +618,10 @@ ifeq ($(SKIP_UDEB),)
|
|||
dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
|
||||
-u"-Ldebian/e2fsprogs-udeb.shlibs.local"
|
||||
endif
|
||||
ifeq ($(SKIP_FUSE2FS),)
|
||||
dh_shlibdeps -pfuse2fs -l${stdbuilddir}/lib \
|
||||
-u"-Ldebian/e2fsprogs.shlibs.local"
|
||||
endif
|
||||
|
||||
dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \
|
||||
-Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
|
||||
|
@ -681,15 +648,8 @@ ifneq ($(UTIL_LINUX_NG),yes)
|
|||
dpkg-distaddfile $(UUID_UDEB_NAME) debian-installer $(UUID_UDEB_PRIORITY)
|
||||
endif
|
||||
endif
|
||||
dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
|
||||
dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
|
||||
ifeq ($(SKIP_UDEB),)
|
||||
dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME)
|
||||
ifneq ($(UTIL_LINUX_NG),yes)
|
||||
dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME)
|
||||
dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME)
|
||||
endif
|
||||
endif
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
|
||||
|
@ -700,11 +660,3 @@ debug_flags:
|
|||
@echo CFLAGS is $(CFLAGS)
|
||||
@echo LDFLAGS is $(LDFLAGS)
|
||||
@echo CPPFLAGS is $(CPPFLAGS)
|
||||
|
||||
debug:
|
||||
echo $(DH_VERSION)
|
||||
echo $(USE_DBGSYM)
|
||||
echo $(call dh_strip_args,e2fsprogs)
|
||||
echo $(call dh_strip_args2,e2fsck-static,e2fsprogs)
|
||||
echo $(DBG_PACKAGES)
|
||||
echo $(if $(filter $(USE_DBGSYM),yes),,e2fsprogs-dbg e2fslibs-dbg)
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
e2fsprogs source: weak-library-dev-dependency ss-dev on libss2 (= ${mainBinary})
|
||||
e2fsprogs source: weak-library-dev-dependency comerr-dev on libcomerr2 (= ${mainBinary})
|
||||
e2fsprogs source: weak-library-dev-dependency uuid-dev on libuuid1 (= ${mainBinary})
|
||||
e2fsprogs source: source-is-missing misc/util.o
|
||||
|
|
|
@ -14,7 +14,7 @@ INSTALL = @INSTALL@
|
|||
PROGS= debugfs
|
||||
MANPAGES= debugfs.8
|
||||
|
||||
MK_CMDS= _SS_DIR_OVERRIDE=../lib/ss ../lib/ss/mk_cmds
|
||||
MK_CMDS= _SS_DIR_OVERRIDE=$(srcdir)/../lib/ss ../lib/ss/mk_cmds
|
||||
|
||||
DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o ls.o \
|
||||
lsdel.o dump.o set_fields.o logdump.o htree.o unused.o e2freefrag.o \
|
||||
|
|
|
@ -73,6 +73,9 @@ request do_rm, "Remove a file (unlink and kill_file, if appropriate)",
|
|||
request do_kill_file, "Deallocate an inode and its blocks",
|
||||
kill_file;
|
||||
|
||||
request do_copy_inode, "Copy the inode structure",
|
||||
copy_inode;
|
||||
|
||||
request do_clri, "Clear an inode's contents",
|
||||
clri;
|
||||
|
||||
|
|
|
@ -42,10 +42,9 @@ The
|
|||
.B debugfs
|
||||
program is an interactive file system debugger. It can be used to
|
||||
examine and change the state of an ext2, ext3, or ext4 file system.
|
||||
.br
|
||||
.PP
|
||||
.I device
|
||||
is the special file corresponding to the device containing the
|
||||
file system (e.g /dev/hdXX).
|
||||
is a block device (e.g., /dev/sdXX) or a file containing the file system.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I \-w
|
||||
|
@ -95,8 +94,10 @@ should be used when reading blocks not found in the ext2 image file.
|
|||
This includes data, directory, and indirect blocks.
|
||||
.TP
|
||||
.I -b blocksize
|
||||
Forces the use of the given block size for the file system, rather than
|
||||
detecting the correct block size as normal.
|
||||
Forces the use of the given block size (in bytes) for the file system,
|
||||
rather than detecting the correct block size automatically. (This
|
||||
option is rarely needed; it is used primarily when the file system is
|
||||
extremely badly damaged/corrupted.)
|
||||
.TP
|
||||
.I -s superblock
|
||||
Causes the file system superblock to be read from the given block
|
||||
|
@ -105,7 +106,9 @@ number, instead of using the primary superblock (located at an offset of
|
|||
.I -s
|
||||
option, you must also provide the blocksize of the filesystem via the
|
||||
.I -b
|
||||
option.
|
||||
option. (This
|
||||
option is rarely needed; it is used primarily when the file system is
|
||||
extremely badly damaged/corrupted.)
|
||||
.TP
|
||||
.I -f cmd_file
|
||||
Causes
|
||||
|
@ -222,6 +225,12 @@ master superblock.
|
|||
Clear the contents of the inode
|
||||
.IR filespec .
|
||||
.TP
|
||||
.BI copy_inode " source_inode destination_inode"
|
||||
Copy the conents of the inode structure in
|
||||
.I source_inode
|
||||
and use it to overwrite the inode structure at
|
||||
.IR destination_inode .
|
||||
.TP
|
||||
.BI dirsearch " filespec filename"
|
||||
Search the directory
|
||||
.I filespec
|
||||
|
|
|
@ -851,7 +851,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
|
|||
inode->i_file_acl | ((long long)
|
||||
(inode->osd2.linux2.l_i_file_acl_high) << 32),
|
||||
LINUX_S_ISDIR(inode->i_mode) ? inode->i_dir_acl : 0);
|
||||
if (os == EXT2_OS_LINUX)
|
||||
if (os != EXT2_OS_HURD)
|
||||
fprintf(out, "%sLinks: %d Blockcount: %llu\n",
|
||||
prefix, inode->i_links_count,
|
||||
(((unsigned long long)
|
||||
|
@ -888,7 +888,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
|
|||
inode_time_to_string(large_inode->i_crtime,
|
||||
large_inode->i_crtime_extra));
|
||||
if (inode->i_dtime)
|
||||
fprintf(out, "%scrtime: 0x%08x:(%08x) -- %s", prefix,
|
||||
fprintf(out, "%s dtime: 0x%08x:(%08x) -- %s", prefix,
|
||||
large_inode->i_dtime, large_inode->i_ctime_extra,
|
||||
inode_time_to_string(inode->i_dtime,
|
||||
large_inode->i_ctime_extra));
|
||||
|
@ -908,8 +908,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
|
|||
internal_dump_inode_extra(out, prefix, inode_num,
|
||||
(struct ext2_inode_large *) inode);
|
||||
dump_inode_attributes(out, inode_num);
|
||||
if (current_fs->super->s_creator_os == EXT2_OS_LINUX &&
|
||||
ext2fs_has_feature_metadata_csum(current_fs->super)) {
|
||||
if (ext2fs_has_feature_metadata_csum(current_fs->super)) {
|
||||
__u32 crc = inode->i_checksum_lo;
|
||||
if (is_large_inode &&
|
||||
large_inode->i_extra_isize >=
|
||||
|
@ -1585,6 +1584,35 @@ void do_unlink(int argc, char *argv[])
|
|||
|
||||
unlink_file_by_name(argv[1]);
|
||||
}
|
||||
|
||||
void do_copy_inode(int argc, char *argv[])
|
||||
{
|
||||
ext2_ino_t src_ino, dest_ino;
|
||||
struct ext2_inode inode;
|
||||
unsigned char buf[4096];
|
||||
int retval;
|
||||
|
||||
if (common_args_process(argc, argv, 3, 3, "copy_inode",
|
||||
"<source file> <dest_name>", CHECK_FS_RW))
|
||||
return;
|
||||
|
||||
src_ino = string_to_inode(argv[1]);
|
||||
if (!src_ino)
|
||||
return;
|
||||
|
||||
dest_ino = string_to_inode(argv[2]);
|
||||
if (!dest_ino)
|
||||
return;
|
||||
|
||||
if (debugfs_read_inode_full(src_ino, (struct ext2_inode *) buf,
|
||||
argv[0], sizeof(buf)))
|
||||
return;
|
||||
|
||||
if (debugfs_write_inode_full(dest_ino, (struct ext2_inode *) buf,
|
||||
argv[0], sizeof(buf)))
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* READ_ONLY */
|
||||
|
||||
void do_find_free_block(int argc, char *argv[])
|
||||
|
|
|
@ -165,7 +165,8 @@ static errcode_t journal_add_revoke_to_trans(journal_transaction_t *trans,
|
|||
void *buf;
|
||||
size_t i, offset;
|
||||
blk64_t curr_blk;
|
||||
int sz, csum_size = 0;
|
||||
unsigned int sz;
|
||||
unsigned csum_size = 0;
|
||||
struct buffer_head *bh;
|
||||
errcode_t err;
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ static void rdump_symlink(ext2_ino_t ino, struct ext2_inode *inode,
|
|||
|
||||
/* Apparently, this is the right way to detect and handle fast
|
||||
* symlinks; see do_stat() in debugfs.c. */
|
||||
if (inode->i_blocks == 0)
|
||||
if (ext2fs_inode_data_blocks2(current_fs, inode) == 0)
|
||||
strcpy(buf, (char *) inode->i_block);
|
||||
else {
|
||||
unsigned bytes = inode->i_size;
|
||||
|
@ -284,7 +284,7 @@ static void rdump_inode(ext2_ino_t ino, struct ext2_inode *inode,
|
|||
/* Create the directory with 0700 permissions, because we
|
||||
* expect to have to create entries it. Then fix its perms
|
||||
* once we've done the traversal. */
|
||||
if (mkdir(fullname, S_IRWXU) == -1) {
|
||||
if (name[0] && mkdir(fullname, S_IRWXU) == -1) {
|
||||
com_err("rdump", errno, "while making directory %s", fullname);
|
||||
goto errout;
|
||||
}
|
||||
|
|
|
@ -583,7 +583,7 @@ static errcode_t ext2fs_journal_load(journal_t *journal)
|
|||
case JFS_DESCRIPTOR_BLOCK:
|
||||
case JFS_COMMIT_BLOCK:
|
||||
case JFS_REVOKE_BLOCK:
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
/* If we don't understand the superblock major type, but there
|
||||
* is a magic number, then it is likely to be a new format we
|
||||
|
@ -600,15 +600,15 @@ static errcode_t ext2fs_journal_load(journal_t *journal)
|
|||
|
||||
/* Checksum v1-3 are mutually exclusive features. */
|
||||
if (jfs_has_feature_csum2(journal) && jfs_has_feature_csum3(journal))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
if (journal_has_csum_v2or3(journal) &&
|
||||
jfs_has_feature_checksum(journal))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
if (!ext2fs_journal_verify_csum_type(journal, jsb) ||
|
||||
!ext2fs_journal_sb_csum_verify(journal, jsb))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
if (journal_has_csum_v2or3(journal))
|
||||
journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid,
|
||||
|
@ -618,12 +618,12 @@ static errcode_t ext2fs_journal_load(journal_t *journal)
|
|||
* format to be able to proceed safely, so any other checks that
|
||||
* fail we should attempt to recover from. */
|
||||
if (jsb->s_blocksize != htonl(journal->j_blocksize))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
if (ntohl(jsb->s_maxlen) < journal->j_maxlen)
|
||||
journal->j_maxlen = ntohl(jsb->s_maxlen);
|
||||
else if (ntohl(jsb->s_maxlen) > journal->j_maxlen)
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
journal->j_tail_sequence = ntohl(jsb->s_sequence);
|
||||
journal->j_transaction_sequence = journal->j_tail_sequence;
|
||||
|
|
|
@ -277,7 +277,7 @@ print_usage:
|
|||
|
||||
|
||||
static int read_journal_block(const char *cmd, struct journal_source *source,
|
||||
off_t offset, char *buf, unsigned int size)
|
||||
ext2_loff_t offset, char *buf, unsigned int size)
|
||||
{
|
||||
int retval;
|
||||
unsigned int got;
|
||||
|
@ -295,8 +295,8 @@ static int read_journal_block(const char *cmd, struct journal_source *source,
|
|||
got = retval;
|
||||
retval = 0;
|
||||
} else {
|
||||
retval = ext2fs_file_lseek(source->file, offset,
|
||||
EXT2_SEEK_SET, NULL);
|
||||
retval = ext2fs_file_llseek(source->file, offset,
|
||||
EXT2_SEEK_SET, NULL);
|
||||
if (retval) {
|
||||
seek_err:
|
||||
com_err(cmd, retval, "while seeking in reading journal");
|
||||
|
@ -346,7 +346,6 @@ static void dump_journal(char *cmdname, FILE *out_file,
|
|||
int retval;
|
||||
__u32 magic, sequence, blocktype;
|
||||
journal_header_t *header;
|
||||
|
||||
tid_t transaction;
|
||||
unsigned int blocknr = 0;
|
||||
|
||||
|
@ -378,8 +377,8 @@ static void dump_journal(char *cmdname, FILE *out_file,
|
|||
}
|
||||
|
||||
/* Next, read the journal superblock */
|
||||
|
||||
retval = read_journal_block(cmdname, source, blocknr*blocksize,
|
||||
retval = read_journal_block(cmdname, source,
|
||||
((ext2_loff_t) blocknr) * blocksize,
|
||||
jsb_buffer, 1024);
|
||||
if (retval)
|
||||
return;
|
||||
|
@ -407,8 +406,8 @@ static void dump_journal(char *cmdname, FILE *out_file,
|
|||
|
||||
while (1) {
|
||||
retval = read_journal_block(cmdname, source,
|
||||
blocknr*blocksize, buf,
|
||||
blocksize);
|
||||
((ext2_loff_t) blocknr) * blocksize,
|
||||
buf, blocksize);
|
||||
if (retval)
|
||||
return;
|
||||
|
||||
|
@ -646,7 +645,7 @@ static void dump_metadata_block(FILE *out_file, struct journal_source *source,
|
|||
return;
|
||||
|
||||
retval = read_journal_block("logdump", source,
|
||||
blocksize * log_blocknr,
|
||||
((ext2_loff_t) log_blocknr) * blocksize,
|
||||
buf, blocksize);
|
||||
if (retval)
|
||||
return;
|
||||
|
|
|
@ -569,7 +569,6 @@ static errcode_t parse_time(struct field_set_info *info,
|
|||
__s64 t;
|
||||
__u32 t_low, t_high;
|
||||
__u32 *ptr_low, *ptr_high;
|
||||
int suffix = check_suffix(field);
|
||||
|
||||
if (check_suffix(field))
|
||||
return parse_uint(info, field, arg);
|
||||
|
@ -653,18 +652,13 @@ static errcode_t parse_bmap(struct field_set_info *info,
|
|||
static errcode_t parse_gd_csum(struct field_set_info *info, char *field,
|
||||
char *arg)
|
||||
{
|
||||
__u16 *checksum = info->ptr;
|
||||
|
||||
if (strcmp(arg, "calc") == 0) {
|
||||
ext2fs_group_desc_csum_set(current_fs, set_bg);
|
||||
memcpy(&set_gd, ext2fs_group_desc(current_fs,
|
||||
current_fs->group_desc,
|
||||
set_bg),
|
||||
sizeof(set_gd));
|
||||
printf("Checksum set to 0x%04x\n",
|
||||
ext2fs_bg_checksum(current_fs, set_bg));
|
||||
*checksum = ext2fs_group_desc_csum(current_fs, set_bg);
|
||||
printf("Checksum set to 0x%04x\n", *checksum);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return parse_uint(info, field, arg);
|
||||
}
|
||||
|
||||
|
|
|
@ -196,15 +196,14 @@ void do_set_xattr(int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
printf("%s: Usage: %s <file> <attr> [-f infile | "
|
||||
"value]\n", argv[0], argv[0]);
|
||||
goto out2;
|
||||
goto print_usage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(fp && optind == argc - 2) && !(!fp && optind == argc - 3)) {
|
||||
printf("%s: Usage: %s <file> <attr> [-f infile | value>]\n",
|
||||
argv[0], argv[0]);
|
||||
print_usage:
|
||||
printf("Usage:\t%s <file> <attr> <value>\n", argv[0]);
|
||||
printf("\t%s -f <value_file> <file> <attr>\n", argv[0]);
|
||||
goto out2;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename libext2fs.info
|
||||
@settitle The EXT2FS Library (version 1.43)
|
||||
@settitle The EXT2FS Library (version 1.43.3)
|
||||
@synindex tp fn
|
||||
@comment %**end of header
|
||||
|
||||
|
@ -60,8 +60,8 @@ by the author.
|
|||
|
||||
@title The EXT2FS Library
|
||||
@subtitle The EXT2FS Library
|
||||
@subtitle Version 1.43
|
||||
@subtitle May 2016
|
||||
@subtitle Version 1.43.3
|
||||
@subtitle September 2016
|
||||
|
||||
@author by Theodore Ts'o
|
||||
|
||||
|
@ -101,7 +101,7 @@ by the Foundation.
|
|||
|
||||
@top The EXT2FS Library
|
||||
|
||||
This manual documents the EXT2FS Library, version 1.43.
|
||||
This manual documents the EXT2FS Library, version 1.43.3.
|
||||
|
||||
@menu
|
||||
* Introduction to the EXT2FS Library::
|
||||
|
|
|
@ -34,7 +34,7 @@ PROFILED_DEPLIBS= $(DEPPROFILED_LIBSUPPORT) $(PROFILED_LIBEXT2FS) \
|
|||
$(DEPPROFILED_LIBCOM_ERR) $(DEPPROFILED_LIBBLKID) \
|
||||
$(DEPPROFILED_LIBUUID) $(DEPPROFILED_LIBE2P)
|
||||
|
||||
COMPILE_ET=$(top_builddir)/lib/et/compile_et --build-tree
|
||||
COMPILE_ET= _ET_DIR_OVERRIDE=$(srcdir)/../lib/et/et ../lib/et/compile_et
|
||||
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
|
|
|
@ -21,13 +21,17 @@ struct dir_info_db {
|
|||
int size;
|
||||
struct dir_info *array;
|
||||
struct dir_info *last_lookup;
|
||||
#ifdef CONFIG_TDB
|
||||
char *tdb_fn;
|
||||
TDB_CONTEXT *tdb;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct dir_info_iter {
|
||||
int i;
|
||||
#ifdef CONFIG_TDB
|
||||
TDB_DATA tdb_iter;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct dir_info_ent {
|
||||
|
@ -38,6 +42,7 @@ struct dir_info_ent {
|
|||
|
||||
static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir);
|
||||
|
||||
#ifdef CONFIG_TDB
|
||||
static void setup_tdb(e2fsck_t ctx, ext2_ino_t num_dirs)
|
||||
{
|
||||
struct dir_info_db *db = ctx->dir_info;
|
||||
|
@ -79,6 +84,7 @@ static void setup_tdb(e2fsck_t ctx, ext2_ino_t num_dirs)
|
|||
O_RDWR | O_CREAT | O_TRUNC, 0600);
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void setup_db(e2fsck_t ctx)
|
||||
{
|
||||
|
@ -98,6 +104,7 @@ static void setup_db(e2fsck_t ctx)
|
|||
if (retval)
|
||||
num_dirs = 1024; /* Guess */
|
||||
|
||||
#ifdef CONFIG_TDB
|
||||
setup_tdb(ctx, num_dirs);
|
||||
|
||||
if (db->tdb) {
|
||||
|
@ -106,6 +113,7 @@ static void setup_db(e2fsck_t ctx)
|
|||
#endif
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
db->size = num_dirs + 10;
|
||||
db->array = (struct dir_info *)
|
||||
|
@ -121,8 +129,7 @@ static void setup_db(e2fsck_t ctx)
|
|||
*/
|
||||
void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
|
||||
{
|
||||
struct dir_info_db *db;
|
||||
struct dir_info *dir, ent, *old_array;
|
||||
struct dir_info *dir, *old_array;
|
||||
int i, j;
|
||||
errcode_t retval;
|
||||
unsigned long old_size;
|
||||
|
@ -132,7 +139,6 @@ void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
|
|||
#endif
|
||||
if (!ctx->dir_info)
|
||||
setup_db(ctx);
|
||||
db = ctx->dir_info;
|
||||
|
||||
if (ctx->dir_info->count >= ctx->dir_info->size) {
|
||||
old_size = ctx->dir_info->size * sizeof(struct dir_info);
|
||||
|
@ -153,14 +159,17 @@ void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
|
|||
ctx->dir_info->last_lookup = NULL;
|
||||
}
|
||||
|
||||
ent.ino = ino;
|
||||
ent.parent = parent;
|
||||
ent.dotdot = parent;
|
||||
#ifdef CONFIG_TDB
|
||||
if (ctx->dir_info->tdb) {
|
||||
struct dir_info ent;
|
||||
|
||||
if (db->tdb) {
|
||||
ent.ino = ino;
|
||||
ent.parent = parent;
|
||||
ent.dotdot = parent;
|
||||
e2fsck_put_dir_info(ctx, &ent);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Normally, add_dir_info is called with each inode in
|
||||
|
@ -196,8 +205,6 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
|
|||
{
|
||||
struct dir_info_db *db = ctx->dir_info;
|
||||
int low, high, mid;
|
||||
struct dir_info_ent *buf;
|
||||
static struct dir_info ret_dir_info;
|
||||
|
||||
if (!db)
|
||||
return 0;
|
||||
|
@ -206,8 +213,11 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
|
|||
printf("e2fsck_get_dir_info %d...", ino);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TDB
|
||||
if (db->tdb) {
|
||||
static struct dir_info ret_dir_info;
|
||||
TDB_DATA key, data;
|
||||
struct dir_info_ent *buf;
|
||||
|
||||
key.dptr = (unsigned char *) &ino;
|
||||
key.dsize = sizeof(ext2_ino_t);
|
||||
|
@ -230,6 +240,7 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
|
|||
free(data.dptr);
|
||||
return &ret_dir_info;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (db->last_lookup && db->last_lookup->ino == ino)
|
||||
return db->last_lookup;
|
||||
|
@ -273,17 +284,21 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir)
|
||||
static void e2fsck_put_dir_info(e2fsck_t ctx EXT2FS_NO_TDB_UNUSED,
|
||||
struct dir_info *dir EXT2FS_NO_TDB_UNUSED)
|
||||
{
|
||||
#ifdef CONFIG_TDB
|
||||
struct dir_info_db *db = ctx->dir_info;
|
||||
struct dir_info_ent buf;
|
||||
TDB_DATA key, data;
|
||||
#endif
|
||||
|
||||
#ifdef DIRINFO_DEBUG
|
||||
printf("e2fsck_put_dir_info (%d, %d, %d)...", dir->ino, dir->dotdot,
|
||||
dir->parent);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TDB
|
||||
if (!db->tdb)
|
||||
return;
|
||||
|
||||
|
@ -298,7 +313,7 @@ static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir)
|
|||
if (tdb_store(db->tdb, key, data, TDB_REPLACE) == -1) {
|
||||
printf("store failed: %s\n", tdb_errorstr(db->tdb));
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -307,12 +322,14 @@ static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir)
|
|||
void e2fsck_free_dir_info(e2fsck_t ctx)
|
||||
{
|
||||
if (ctx->dir_info) {
|
||||
#ifdef CONFIG_TDB
|
||||
if (ctx->dir_info->tdb)
|
||||
tdb_close(ctx->dir_info->tdb);
|
||||
if (ctx->dir_info->tdb_fn) {
|
||||
unlink(ctx->dir_info->tdb_fn);
|
||||
free(ctx->dir_info->tdb_fn);
|
||||
}
|
||||
#endif
|
||||
if (ctx->dir_info->array)
|
||||
ext2fs_free_mem(&ctx->dir_info->array);
|
||||
ctx->dir_info->array = 0;
|
||||
|
@ -334,13 +351,14 @@ int e2fsck_get_num_dirinfo(e2fsck_t ctx)
|
|||
struct dir_info_iter *e2fsck_dir_info_iter_begin(e2fsck_t ctx)
|
||||
{
|
||||
struct dir_info_iter *iter;
|
||||
struct dir_info_db *db = ctx->dir_info;
|
||||
|
||||
iter = e2fsck_allocate_memory(ctx, sizeof(struct dir_info_iter),
|
||||
"dir_info iterator");
|
||||
|
||||
if (db->tdb)
|
||||
iter->tdb_iter = tdb_firstkey(db->tdb);
|
||||
#ifdef CONFIG_TDB
|
||||
if (ctx->dir_info->tdb)
|
||||
iter->tdb_iter = tdb_firstkey(ctx->dir_info->tdb);
|
||||
#endif
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
@ -348,7 +366,9 @@ struct dir_info_iter *e2fsck_dir_info_iter_begin(e2fsck_t ctx)
|
|||
void e2fsck_dir_info_iter_end(e2fsck_t ctx EXT2FS_ATTR((unused)),
|
||||
struct dir_info_iter *iter)
|
||||
{
|
||||
#ifdef CONFIG_TDB
|
||||
free(iter->tdb_iter.dptr);
|
||||
#endif
|
||||
ext2fs_free_mem(&iter);
|
||||
}
|
||||
|
||||
|
@ -357,33 +377,34 @@ void e2fsck_dir_info_iter_end(e2fsck_t ctx EXT2FS_ATTR((unused)),
|
|||
*/
|
||||
struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx, struct dir_info_iter *iter)
|
||||
{
|
||||
TDB_DATA data, key;
|
||||
struct dir_info_db *db = ctx->dir_info;
|
||||
struct dir_info_ent *buf;
|
||||
static struct dir_info ret_dir_info;
|
||||
|
||||
if (!ctx->dir_info || !iter)
|
||||
return 0;
|
||||
|
||||
if (db->tdb) {
|
||||
#ifdef CONFIG_TDB
|
||||
if (ctx->dir_info->tdb) {
|
||||
static struct dir_info ret_dir_info;
|
||||
struct dir_info_ent *buf;
|
||||
TDB_DATA data, key;
|
||||
|
||||
if (iter->tdb_iter.dptr == 0)
|
||||
return 0;
|
||||
key = iter->tdb_iter;
|
||||
data = tdb_fetch(db->tdb, key);
|
||||
data = tdb_fetch(ctx->dir_info->tdb, key);
|
||||
if (!data.dptr) {
|
||||
printf("iter fetch failed: %s\n",
|
||||
tdb_errorstr(db->tdb));
|
||||
tdb_errorstr(ctx->dir_info->tdb));
|
||||
return 0;
|
||||
}
|
||||
buf = (struct dir_info_ent *) data.dptr;
|
||||
ret_dir_info.ino = *((ext2_ino_t *) iter->tdb_iter.dptr);
|
||||
ret_dir_info.dotdot = buf->dotdot;
|
||||
ret_dir_info.parent = buf->parent;
|
||||
iter->tdb_iter = tdb_nextkey(db->tdb, key);
|
||||
iter->tdb_iter = tdb_nextkey(ctx->dir_info->tdb, key);
|
||||
free(key.dptr);
|
||||
free(data.dptr);
|
||||
return &ret_dir_info;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (iter->i >= ctx->dir_info->count)
|
||||
return 0;
|
||||
|
|
|
@ -51,8 +51,9 @@ will normally replay the journal and exit, unless its superblock
|
|||
indicates that further checking is required.
|
||||
.PP
|
||||
.I device
|
||||
is the device file where the filesystem is stored (e.g.
|
||||
.IR /dev/hdc1 ).
|
||||
is a block device (e.g.,
|
||||
.IR /dev/sdc1 )
|
||||
or file containing the file system.
|
||||
.PP
|
||||
Note that in general it is not safe to run
|
||||
.B e2fsck
|
||||
|
@ -344,6 +345,12 @@ or
|
|||
.B \-p
|
||||
options.
|
||||
.TP
|
||||
.BI \-T " patch_file"
|
||||
Do not apply changes to the real filesystem; write updates into a sparse file
|
||||
named 'patch_file' to safely apply them later with e2patch(8) utility.
|
||||
You'll also be able to create a backup before applying patch and safely
|
||||
restore it in case of power outage or system crash.
|
||||
.TP
|
||||
.BI \-z " undo_file"
|
||||
Before overwriting a file system block, write the old contents of the block to
|
||||
an undo file. This undo file can be used with e2undo(8) to restore the old
|
||||
|
|
|
@ -72,10 +72,10 @@ behavior.
|
|||
.I [problems]
|
||||
This stanza allows the administrator to reconfigure how e2fsck handles
|
||||
various filesystem inconsistencies.
|
||||
.TP
|
||||
.I [scratch_files]
|
||||
This stanza controls when e2fsck will attempt to use scratch files to
|
||||
reduce the need for memory.
|
||||
@TDB_MAN_COMMENT@.TP
|
||||
@TDB_MAN_COMMENT@.I [scratch_files]
|
||||
@TDB_MAN_COMMENT@This stanza controls when e2fsck will attempt to use
|
||||
@TDB_MAN_COMMENT@scratch files to reduce the need for memory.
|
||||
.SH THE [options] STANZA
|
||||
The following relations are defined in the
|
||||
.I [options]
|
||||
|
@ -179,7 +179,7 @@ or
|
|||
are not available or are not yet writeable, e2fsck will save the output
|
||||
in a memory buffer, and a child process will periodically test to see if
|
||||
the log directory has become available after the boot sequence has
|
||||
mounted the requiste filesytem for reading/writing. This implements the
|
||||
mounted the requiste file system for reading/writing. This implements the
|
||||
functionality provided by
|
||||
.BR logsave (8)
|
||||
for e2fsck log files.
|
||||
|
@ -303,29 +303,33 @@ of 'should this problem be fixed?'. The
|
|||
option even overrides the
|
||||
.B -y
|
||||
option given on the command-line (just for the specific problem, of course).
|
||||
.SH THE [scratch_files] STANZA
|
||||
The following relations are defined in the
|
||||
.I [scratch_files]
|
||||
stanza.
|
||||
.TP
|
||||
.I directory
|
||||
If the directory named by this relation exists and is writeable, then
|
||||
e2fsck will attempt to use this directory to store scratch files instead
|
||||
of using in-memory data structures.
|
||||
.TP
|
||||
.I numdirs_threshold
|
||||
If this relation is set, then in-memory data structures be used if the
|
||||
number of directories in the filesystem are fewer than amount specified.
|
||||
.TP
|
||||
.I dirinfo
|
||||
This relation controls whether or not the scratch file directory is used
|
||||
instead of an in-memory data structure for directory information. It
|
||||
defaults to true.
|
||||
.TP
|
||||
.I icount
|
||||
This relation controls whether or not the scratch file directory is used
|
||||
instead of an in-memory data structure when tracking inode counts. It
|
||||
defaults to true.
|
||||
@TDB_MAN_COMMENT@.SH THE [scratch_files] STANZA
|
||||
@TDB_MAN_COMMENT@The following relations are defined in the
|
||||
@TDB_MAN_COMMENT@.I [scratch_files]
|
||||
@TDB_MAN_COMMENT@stanza.
|
||||
@TDB_MAN_COMMENT@.TP
|
||||
@TDB_MAN_COMMENT@.I directory
|
||||
@TDB_MAN_COMMENT@If the directory named by this relation exists and is
|
||||
@TDB_MAN_COMMENT@writeable, then e2fsck will attempt to use this
|
||||
@TDB_MAN_COMMENT@directory to store scratch files instead of using
|
||||
@TDB_MAN_COMMENT@in-memory data structures.
|
||||
@TDB_MAN_COMMENT@.TP
|
||||
@TDB_MAN_COMMENT@.I numdirs_threshold
|
||||
@TDB_MAN_COMMENT@If this relation is set, then in-memory data structures
|
||||
@TDB_MAN_COMMENT@be used if the number of directories in the filesystem
|
||||
@TDB_MAN_COMMENT@are fewer than amount specified.
|
||||
@TDB_MAN_COMMENT@.TP
|
||||
@TDB_MAN_COMMENT@.I dirinfo
|
||||
@TDB_MAN_COMMENT@This relation controls whether or not the scratch file
|
||||
@TDB_MAN_COMMENT@directory is used instead of an in-memory data
|
||||
@TDB_MAN_COMMENT@structure for directory information. It defaults to
|
||||
@TDB_MAN_COMMENT@true.
|
||||
@TDB_MAN_COMMENT@.TP
|
||||
@TDB_MAN_COMMENT@.I icount
|
||||
@TDB_MAN_COMMENT@This relation controls whether or not the scratch file
|
||||
@TDB_MAN_COMMENT@directory is used instead of an in-memory data
|
||||
@TDB_MAN_COMMENT@structure when tracking inode counts. It defaults to
|
||||
@TDB_MAN_COMMENT@true.
|
||||
.SH LOGGING
|
||||
E2fsck has the facility to save the information from an e2fsck run in a
|
||||
directory so that a system administrator can review its output at their
|
||||
|
|
|
@ -391,6 +391,9 @@ struct e2fsck_struct {
|
|||
*/
|
||||
ext2fs_inode_bitmap inodes_to_rebuild;
|
||||
|
||||
/* Patch file */
|
||||
char *patch_file;
|
||||
|
||||
/* Undo file */
|
||||
char *undo_file;
|
||||
};
|
||||
|
@ -506,8 +509,9 @@ extern void set_up_logging(e2fsck_t ctx);
|
|||
extern void e2fsck_hide_quota(e2fsck_t ctx);
|
||||
|
||||
/* pass1.c */
|
||||
extern void e2fsck_setup_tdb_icount(e2fsck_t ctx, int flags,
|
||||
ext2_icount_t *ret);
|
||||
extern errcode_t e2fsck_setup_icount(e2fsck_t ctx, const char *icount_name,
|
||||
int flags, ext2_icount_t hint,
|
||||
ext2_icount_t *ret);
|
||||
extern void e2fsck_use_inode_shortcuts(e2fsck_t ctx, int use_shortcuts);
|
||||
extern int e2fsck_pass1_check_device_inode(ext2_filsys fs,
|
||||
struct ext2_inode *inode);
|
||||
|
|
|
@ -38,10 +38,10 @@ struct buffer_head {
|
|||
#endif
|
||||
io_channel b_io;
|
||||
int b_size;
|
||||
unsigned long long b_blocknr;
|
||||
int b_dirty;
|
||||
int b_uptodate;
|
||||
int b_err;
|
||||
unsigned int b_dirty:1;
|
||||
unsigned int b_uptodate:1;
|
||||
unsigned long long b_blocknr;
|
||||
char b_data[1024];
|
||||
};
|
||||
|
||||
|
@ -182,10 +182,10 @@ extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */
|
|||
#endif /* DEBUGFS */
|
||||
|
||||
#ifndef EFSBADCRC
|
||||
#define EFSBADCRC EBADMSG /* Bad CRC detected */
|
||||
#define EFSBADCRC EXT2_ET_BAD_CRC
|
||||
#endif
|
||||
#ifndef EFSCORRUPTED
|
||||
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
|
||||
#define EFSCORRUPTED EXT2_ET_FILESYSTEM_CORRUPTED
|
||||
#endif
|
||||
|
||||
/* recovery.c */
|
||||
|
|
|
@ -550,7 +550,7 @@ static errcode_t e2fsck_journal_fix_bad_inode(e2fsck_t ctx,
|
|||
e2fsck_clear_recover(ctx, 1);
|
||||
return 0;
|
||||
}
|
||||
return EXT2_ET_BAD_INODE_NUM;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
} else if (recover) {
|
||||
if (fix_problem(ctx, PR_0_JOURNAL_RECOVER_SET, pctx)) {
|
||||
e2fsck_clear_recover(ctx, 1);
|
||||
|
@ -627,7 +627,7 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
|
|||
case JFS_DESCRIPTOR_BLOCK:
|
||||
case JFS_COMMIT_BLOCK:
|
||||
case JFS_REVOKE_BLOCK:
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
/* If we don't understand the superblock major type, but there
|
||||
* is a magic number, then it is likely to be a new format we
|
||||
|
@ -644,15 +644,15 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
|
|||
|
||||
/* Checksum v1-3 are mutually exclusive features. */
|
||||
if (jfs_has_feature_csum2(journal) && jfs_has_feature_csum3(journal))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
if (journal_has_csum_v2or3(journal) &&
|
||||
jfs_has_feature_checksum(journal))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
if (!e2fsck_journal_verify_csum_type(journal, jsb) ||
|
||||
!e2fsck_journal_sb_csum_verify(journal, jsb))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
if (journal_has_csum_v2or3(journal))
|
||||
journal->j_csum_seed = jbd2_chksum(journal, ~0, jsb->s_uuid,
|
||||
|
@ -662,19 +662,19 @@ static errcode_t e2fsck_journal_load(journal_t *journal)
|
|||
* format to be able to proceed safely, so any other checks that
|
||||
* fail we should attempt to recover from. */
|
||||
if (jsb->s_blocksize != htonl(journal->j_blocksize)) {
|
||||
com_err(ctx->program_name, EXT2_ET_CORRUPT_SUPERBLOCK,
|
||||
com_err(ctx->program_name, EXT2_ET_CORRUPT_JOURNAL_SB,
|
||||
_("%s: no valid journal superblock found\n"),
|
||||
ctx->device_name);
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
}
|
||||
|
||||
if (ntohl(jsb->s_maxlen) < journal->j_maxlen)
|
||||
journal->j_maxlen = ntohl(jsb->s_maxlen);
|
||||
else if (ntohl(jsb->s_maxlen) > journal->j_maxlen) {
|
||||
com_err(ctx->program_name, EXT2_ET_CORRUPT_SUPERBLOCK,
|
||||
com_err(ctx->program_name, EXT2_ET_CORRUPT_JOURNAL_SB,
|
||||
_("%s: journal too short\n"),
|
||||
ctx->device_name);
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
}
|
||||
|
||||
journal->j_tail_sequence = ntohl(jsb->s_sequence);
|
||||
|
@ -746,9 +746,9 @@ static errcode_t e2fsck_journal_fix_corrupt_super(e2fsck_t ctx,
|
|||
e2fsck_clear_recover(ctx, recover);
|
||||
return 0;
|
||||
}
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
} else if (e2fsck_journal_fix_bad_inode(ctx, pctx))
|
||||
return EXT2_ET_CORRUPT_SUPERBLOCK;
|
||||
return EXT2_ET_CORRUPT_JOURNAL_SB;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -820,7 +820,7 @@ errcode_t e2fsck_check_ext3_journal(e2fsck_t ctx)
|
|||
|
||||
retval = e2fsck_journal_load(journal);
|
||||
if (retval) {
|
||||
if ((retval == EXT2_ET_CORRUPT_SUPERBLOCK) ||
|
||||
if ((retval == EXT2_ET_CORRUPT_JOURNAL_SB) ||
|
||||
((retval == EXT2_ET_UNSUPP_FEATURE) &&
|
||||
(!fix_problem(ctx, PR_0_JOURNAL_UNSUPP_INCOMPAT,
|
||||
&pctx))) ||
|
||||
|
@ -948,6 +948,8 @@ static errcode_t recover_ext3_journal(e2fsck_t ctx)
|
|||
mark_buffer_dirty(journal->j_sb_buffer);
|
||||
}
|
||||
|
||||
journal->j_tail_sequence = journal->j_transaction_sequence;
|
||||
|
||||
errout:
|
||||
journal_destroy_revoke(journal);
|
||||
journal_destroy_revoke_caches();
|
||||
|
|
|
@ -87,7 +87,7 @@ struct process_block_struct {
|
|||
inode_modified:1;
|
||||
blk64_t num_blocks;
|
||||
blk64_t max_blocks;
|
||||
e2_blkcnt_t last_block;
|
||||
blk64_t last_block;
|
||||
e2_blkcnt_t last_init_lblock;
|
||||
e2_blkcnt_t last_db_block;
|
||||
int num_illegal_blocks;
|
||||
|
@ -488,10 +488,14 @@ static void check_inode_extra_space(e2fsck_t ctx, struct problem_context *pctx)
|
|||
* implementations should never allow i_extra_isize to be 0
|
||||
*/
|
||||
if (inode->i_extra_isize &&
|
||||
(inode->i_extra_isize < min || inode->i_extra_isize > max)) {
|
||||
(inode->i_extra_isize < min || inode->i_extra_isize > max ||
|
||||
inode->i_extra_isize & 3)) {
|
||||
if (!fix_problem(ctx, PR_1_EXTRA_ISIZE, pctx))
|
||||
return;
|
||||
inode->i_extra_isize = min;
|
||||
if (inode->i_extra_isize < min || inode->i_extra_isize > max)
|
||||
inode->i_extra_isize = sb->s_want_extra_isize;
|
||||
else
|
||||
inode->i_extra_isize = (inode->i_extra_isize + 3) & ~3;
|
||||
e2fsck_write_inode_full(ctx, pctx->ino, pctx->inode,
|
||||
EXT2_INODE_SIZE(sb), "pass1");
|
||||
return;
|
||||
|
@ -512,7 +516,9 @@ static void check_inode_extra_space(e2fsck_t ctx, struct problem_context *pctx)
|
|||
* If the inode's extended atime (ctime, crtime, mtime) is stored in
|
||||
* the old, invalid format, repair it.
|
||||
*/
|
||||
if (sizeof(time_t) > 4 && ctx->now < EXT4_EXTRA_NEGATIVE_DATE_CUTOFF &&
|
||||
if (((sizeof(time_t) <= 4) ||
|
||||
(((sizeof(time_t) > 4) &&
|
||||
ctx->now < EXT4_EXTRA_NEGATIVE_DATE_CUTOFF))) &&
|
||||
(CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, atime) ||
|
||||
CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, ctime) ||
|
||||
CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, crtime) ||
|
||||
|
@ -695,10 +701,12 @@ isdir:
|
|||
}
|
||||
}
|
||||
|
||||
void e2fsck_setup_tdb_icount(e2fsck_t ctx, int flags,
|
||||
ext2_icount_t *ret)
|
||||
extern errcode_t e2fsck_setup_icount(e2fsck_t ctx, const char *icount_name,
|
||||
int flags, ext2_icount_t hint,
|
||||
ext2_icount_t *ret)
|
||||
{
|
||||
unsigned int threshold;
|
||||
unsigned int save_type;
|
||||
ext2_ino_t num_dirs;
|
||||
errcode_t retval;
|
||||
char *tdb_dir;
|
||||
|
@ -717,13 +725,18 @@ void e2fsck_setup_tdb_icount(e2fsck_t ctx, int flags,
|
|||
if (retval)
|
||||
num_dirs = 1024; /* Guess */
|
||||
|
||||
if (!enable || !tdb_dir || access(tdb_dir, W_OK) ||
|
||||
(threshold && num_dirs <= threshold))
|
||||
return;
|
||||
|
||||
retval = ext2fs_create_icount_tdb(ctx->fs, tdb_dir, flags, ret);
|
||||
if (retval)
|
||||
*ret = 0;
|
||||
if (enable && tdb_dir && !access(tdb_dir, W_OK) &&
|
||||
(!threshold || num_dirs > threshold)) {
|
||||
retval = ext2fs_create_icount_tdb(ctx->fs, tdb_dir,
|
||||
flags, ret);
|
||||
if (retval == 0)
|
||||
return 0;
|
||||
}
|
||||
e2fsck_set_bitmap_type(ctx->fs, EXT2FS_BMAP64_RBTREE, icount_name,
|
||||
&save_type);
|
||||
retval = ext2fs_create_icount2(ctx->fs, flags, 0, hint, ret);
|
||||
ctx->fs->default_bitmap_type = save_type;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t recheck_bad_inode_checksum(ext2_filsys fs, ext2_ino_t ino,
|
||||
|
@ -1047,7 +1060,6 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
struct scan_callback_struct scan_struct;
|
||||
struct ext2_super_block *sb = ctx->fs->super;
|
||||
const char *old_op;
|
||||
unsigned int save_type;
|
||||
int imagic_fs, extent_fs, inlinedata_fs;
|
||||
int low_dtime_check = 1;
|
||||
int inode_size = EXT2_INODE_SIZE(fs->super);
|
||||
|
@ -1143,15 +1155,8 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
ctx->flags |= E2F_FLAG_ABORT;
|
||||
return;
|
||||
}
|
||||
e2fsck_setup_tdb_icount(ctx, 0, &ctx->inode_link_info);
|
||||
if (!ctx->inode_link_info) {
|
||||
e2fsck_set_bitmap_type(fs, EXT2FS_BMAP64_RBTREE,
|
||||
"inode_link_info", &save_type);
|
||||
pctx.errcode = ext2fs_create_icount2(fs, 0, 0, 0,
|
||||
&ctx->inode_link_info);
|
||||
fs->default_bitmap_type = save_type;
|
||||
}
|
||||
|
||||
pctx.errcode = e2fsck_setup_icount(ctx, "inode_link_info", 0, NULL,
|
||||
&ctx->inode_link_info);
|
||||
if (pctx.errcode) {
|
||||
fix_problem(ctx, PR_1_ALLOCATE_ICOUNT, &pctx);
|
||||
ctx->flags |= E2F_FLAG_ABORT;
|
||||
|
@ -1709,11 +1714,11 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
if (inode->i_faddr || frag || fsize ||
|
||||
(LINUX_S_ISDIR(inode->i_mode) && inode->i_dir_acl))
|
||||
mark_inode_bad(ctx, ino);
|
||||
if ((fs->super->s_creator_os == EXT2_OS_LINUX) &&
|
||||
if ((fs->super->s_creator_os != EXT2_OS_HURD) &&
|
||||
!ext2fs_has_feature_64bit(fs->super) &&
|
||||
inode->osd2.linux2.l_i_file_acl_high != 0)
|
||||
mark_inode_bad(ctx, ino);
|
||||
if ((fs->super->s_creator_os == EXT2_OS_LINUX) &&
|
||||
if ((fs->super->s_creator_os != EXT2_OS_HURD) &&
|
||||
!ext2fs_has_feature_huge_file(fs->super) &&
|
||||
(inode->osd2.linux2.l_i_blocks_hi != 0))
|
||||
mark_inode_bad(ctx, ino);
|
||||
|
@ -2512,7 +2517,7 @@ void e2fsck_clear_inode(e2fsck_t ctx, ext2_ino_t ino,
|
|||
* line up.
|
||||
*/
|
||||
static int has_unaligned_cluster_map(e2fsck_t ctx,
|
||||
blk64_t last_pblk, e2_blkcnt_t last_lblk,
|
||||
blk64_t last_pblk, blk64_t last_lblk,
|
||||
blk64_t pblk, blk64_t lblk)
|
||||
{
|
||||
blk64_t cluster_mask;
|
||||
|
@ -2612,7 +2617,7 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
|
|||
problem = PR_1_EXTENT_ENDS_BEYOND;
|
||||
else if (is_leaf && is_dir &&
|
||||
((extent.e_lblk + extent.e_len) >
|
||||
(1 << (21 - ctx->fs->super->s_log_block_size))))
|
||||
(1U << (21 - ctx->fs->super->s_log_block_size))))
|
||||
problem = PR_1_TOOBIG_DIR;
|
||||
|
||||
if (is_leaf && problem == 0 && extent.e_len > 0 &&
|
||||
|
@ -2781,7 +2786,7 @@ report_problem:
|
|||
* pass 3 allocating empty directory blocks to fill the hole.
|
||||
*/
|
||||
if (try_repairs && is_dir &&
|
||||
pb->last_block + 1 < (e2_blkcnt_t)extent.e_lblk) {
|
||||
pb->last_block + 1 < extent.e_lblk) {
|
||||
blk64_t new_lblk;
|
||||
|
||||
new_lblk = pb->last_block + 1;
|
||||
|
@ -3049,7 +3054,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
|
|||
|
||||
pb.ino = ino;
|
||||
pb.num_blocks = 0;
|
||||
pb.last_block = -1;
|
||||
pb.last_block = ~0;
|
||||
pb.last_init_lblock = -1;
|
||||
pb.last_db_block = -1;
|
||||
pb.num_illegal_blocks = 0;
|
||||
|
@ -3165,9 +3170,10 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
|
|||
|
||||
if (ino != quota_type2inum(PRJQUOTA, fs->super) &&
|
||||
(ino == EXT2_ROOT_INO || ino >= EXT2_FIRST_INODE(ctx->fs->super))) {
|
||||
quota_data_add(ctx->qctx, inode, ino,
|
||||
pb.num_blocks * fs->blocksize);
|
||||
quota_data_inodes(ctx->qctx, inode, ino, +1);
|
||||
quota_data_add(ctx->qctx, (struct ext2_inode_large *) inode,
|
||||
ino, pb.num_blocks * fs->blocksize);
|
||||
quota_data_inodes(ctx->qctx, (struct ext2_inode_large *) inode,
|
||||
ino, +1);
|
||||
}
|
||||
|
||||
if (!ext2fs_has_feature_huge_file(fs->super) ||
|
||||
|
@ -3175,29 +3181,28 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
|
|||
pb.num_blocks *= (fs->blocksize / 512);
|
||||
pb.num_blocks *= EXT2FS_CLUSTER_RATIO(fs);
|
||||
#if 0
|
||||
printf("inode %u, i_size = %u, last_block = %lld, i_blocks=%llu, num_blocks = %llu\n",
|
||||
printf("inode %u, i_size = %u, last_block = %llu, i_blocks=%llu, num_blocks = %llu\n",
|
||||
ino, inode->i_size, pb.last_block, ext2fs_inode_i_blocks(fs, inode),
|
||||
pb.num_blocks);
|
||||
#endif
|
||||
if (pb.is_dir) {
|
||||
int nblock = inode->i_size >> EXT2_BLOCK_SIZE_BITS(fs->super);
|
||||
unsigned nblock = inode->i_size >> EXT2_BLOCK_SIZE_BITS(fs->super);
|
||||
if (inode->i_flags & EXT4_INLINE_DATA_FL) {
|
||||
int flags;
|
||||
size_t size;
|
||||
size_t sz = 0;
|
||||
errcode_t err;
|
||||
|
||||
size = 0;
|
||||
flags = ctx->fs->flags;
|
||||
ctx->fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS;
|
||||
err = ext2fs_inline_data_size(ctx->fs, pctx->ino,
|
||||
&size);
|
||||
&sz);
|
||||
ctx->fs->flags = (flags &
|
||||
EXT2_FLAG_IGNORE_CSUM_ERRORS) |
|
||||
(ctx->fs->flags &
|
||||
~EXT2_FLAG_IGNORE_CSUM_ERRORS);
|
||||
if (err || size != inode->i_size) {
|
||||
if (err || sz != inode->i_size) {
|
||||
bad_size = 7;
|
||||
pctx->num = size;
|
||||
pctx->num = sz;
|
||||
}
|
||||
} else if (inode->i_size & (fs->blocksize - 1))
|
||||
bad_size = 5;
|
||||
|
@ -3252,7 +3257,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
|
|||
if (LINUX_S_ISREG(inode->i_mode) &&
|
||||
ext2fs_needs_large_file_feature(EXT2_I_SIZE(inode)))
|
||||
ctx->large_files++;
|
||||
if ((fs->super->s_creator_os == EXT2_OS_LINUX) &&
|
||||
if ((fs->super->s_creator_os != EXT2_OS_HURD) &&
|
||||
((pb.num_blocks != ext2fs_inode_i_blocks(fs, inode)) ||
|
||||
(ext2fs_has_feature_huge_file(fs->super) &&
|
||||
(inode->i_flags & EXT4_HUGE_FILE_FL) &&
|
||||
|
|
|
@ -79,7 +79,7 @@ struct dup_cluster {
|
|||
struct dup_inode {
|
||||
ext2_ino_t dir;
|
||||
int num_dupblocks;
|
||||
struct ext2_inode inode;
|
||||
struct ext2_inode_large inode;
|
||||
struct cluster_el *cluster_list;
|
||||
};
|
||||
|
||||
|
@ -118,7 +118,7 @@ static int dict_int_cmp(const void *a, const void *b)
|
|||
* Add a duplicate block record
|
||||
*/
|
||||
static void add_dupe(e2fsck_t ctx, ext2_ino_t ino, blk64_t cluster,
|
||||
struct ext2_inode *inode)
|
||||
struct ext2_inode_large *inode)
|
||||
{
|
||||
dnode_t *n;
|
||||
struct dup_cluster *db;
|
||||
|
@ -263,7 +263,7 @@ struct process_block_struct {
|
|||
int dup_blocks;
|
||||
blk64_t cur_cluster, phys_cluster;
|
||||
blk64_t last_blk;
|
||||
struct ext2_inode *inode;
|
||||
struct ext2_inode_large *inode;
|
||||
struct problem_context *pctx;
|
||||
};
|
||||
|
||||
|
@ -271,7 +271,7 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
|
|||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
ext2_ino_t ino = 0;
|
||||
struct ext2_inode inode;
|
||||
struct ext2_inode_large inode;
|
||||
ext2_inode_scan scan;
|
||||
struct process_block_struct pb;
|
||||
struct problem_context pctx;
|
||||
|
@ -288,7 +288,7 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
|
|||
ctx->flags |= E2F_FLAG_ABORT;
|
||||
return;
|
||||
}
|
||||
ctx->stashed_inode = &inode;
|
||||
ctx->stashed_inode = EXT2_INODE(&inode);
|
||||
pb.ctx = ctx;
|
||||
pb.pctx = &pctx;
|
||||
pctx.str = "pass1b";
|
||||
|
@ -297,7 +297,8 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
|
|||
if (e2fsck_mmp_update(fs))
|
||||
fatal_error(ctx, 0);
|
||||
}
|
||||
pctx.errcode = ext2fs_get_next_inode(scan, &ino, &inode);
|
||||
pctx.errcode = ext2fs_get_next_inode_full(scan, &ino,
|
||||
EXT2_INODE(&inode), sizeof(inode));
|
||||
if (pctx.errcode == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE)
|
||||
continue;
|
||||
if (pctx.errcode) {
|
||||
|
@ -321,18 +322,18 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
|
|||
pb.last_blk = 0;
|
||||
pb.pctx->blk = pb.pctx->blk2 = 0;
|
||||
|
||||
if (ext2fs_inode_has_valid_blocks2(fs, &inode) ||
|
||||
if (ext2fs_inode_has_valid_blocks2(fs, EXT2_INODE(&inode)) ||
|
||||
(ino == EXT2_BAD_INO))
|
||||
pctx.errcode = ext2fs_block_iterate3(fs, ino,
|
||||
BLOCK_FLAG_READ_ONLY, block_buf,
|
||||
process_pass1b_block, &pb);
|
||||
/* If the feature is not set, attrs will be cleared later anyway */
|
||||
if (ext2fs_has_feature_xattr(fs->super) &&
|
||||
ext2fs_file_acl_block(fs, &inode)) {
|
||||
blk64_t blk = ext2fs_file_acl_block(fs, &inode);
|
||||
ext2fs_file_acl_block(fs, EXT2_INODE(&inode))) {
|
||||
blk64_t blk = ext2fs_file_acl_block(fs, EXT2_INODE(&inode));
|
||||
process_pass1b_block(fs, &blk,
|
||||
BLOCK_COUNT_EXTATTR, 0, 0, &pb);
|
||||
ext2fs_file_acl_block_set(fs, &inode, blk);
|
||||
ext2fs_file_acl_block_set(fs, EXT2_INODE(&inode), blk);
|
||||
}
|
||||
if (pb.dup_blocks) {
|
||||
if (ino != EXT2_BAD_INO) {
|
||||
|
@ -548,7 +549,7 @@ static void pass1d(e2fsck_t ctx, char *block_buf)
|
|||
/*
|
||||
* Report the inode that we are working on
|
||||
*/
|
||||
pctx.inode = &p->inode;
|
||||
pctx.inode = EXT2_INODE(&p->inode);
|
||||
pctx.ino = ino;
|
||||
pctx.dir = p->dir;
|
||||
pctx.blkcount = p->num_dupblocks;
|
||||
|
@ -568,7 +569,7 @@ static void pass1d(e2fsck_t ctx, char *block_buf)
|
|||
/*
|
||||
* Report the inode that we are sharing with
|
||||
*/
|
||||
pctx.inode = &t->inode;
|
||||
pctx.inode = EXT2_INODE(&t->inode);
|
||||
pctx.ino = shared[i];
|
||||
pctx.dir = t->dir;
|
||||
fix_problem(ctx, PR_1D_DUP_FILE_LIST, &pctx);
|
||||
|
@ -668,7 +669,7 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
pctx.str = "delete_file";
|
||||
pb.cur_cluster = ~0;
|
||||
|
||||
if (ext2fs_inode_has_valid_blocks2(fs, &dp->inode))
|
||||
if (ext2fs_inode_has_valid_blocks2(fs, EXT2_INODE(&dp->inode)))
|
||||
pctx.errcode = ext2fs_block_iterate3(fs, ino,
|
||||
BLOCK_FLAG_READ_ONLY,
|
||||
block_buf,
|
||||
|
@ -683,20 +684,23 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
quota_data_inodes(ctx->qctx, &dp->inode, ino, -1);
|
||||
|
||||
/* Inode may have changed by block_iterate, so reread it */
|
||||
e2fsck_read_inode(ctx, ino, &dp->inode, "delete_file");
|
||||
e2fsck_clear_inode(ctx, ino, &dp->inode, 0, "delete_file");
|
||||
if (ext2fs_file_acl_block(fs, &dp->inode) &&
|
||||
e2fsck_read_inode_full(ctx, ino, EXT2_INODE(&dp->inode),
|
||||
sizeof(dp->inode), "delete_file");
|
||||
e2fsck_clear_inode(ctx, ino, EXT2_INODE(&dp->inode), 0, "delete_file");
|
||||
if (ext2fs_file_acl_block(fs, EXT2_INODE(&dp->inode)) &&
|
||||
ext2fs_has_feature_xattr(fs->super)) {
|
||||
blk64_t file_acl_block = ext2fs_file_acl_block(fs,
|
||||
EXT2_INODE(&dp->inode));
|
||||
|
||||
count = 1;
|
||||
pctx.errcode = ext2fs_adjust_ea_refcount3(fs,
|
||||
ext2fs_file_acl_block(fs, &dp->inode),
|
||||
pctx.errcode = ext2fs_adjust_ea_refcount3(fs, file_acl_block,
|
||||
block_buf, -1, &count, ino);
|
||||
if (pctx.errcode == EXT2_ET_BAD_EA_BLOCK_NUM) {
|
||||
pctx.errcode = 0;
|
||||
count = 1;
|
||||
}
|
||||
if (pctx.errcode) {
|
||||
pctx.blk = ext2fs_file_acl_block(fs, &dp->inode);
|
||||
pctx.blk = file_acl_block;
|
||||
fix_problem(ctx, PR_1B_ADJ_EA_REFCOUNT, &pctx);
|
||||
}
|
||||
/*
|
||||
|
@ -707,12 +711,13 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
*/
|
||||
if ((count == 0) ||
|
||||
ext2fs_test_block_bitmap2(ctx->block_dup_map,
|
||||
ext2fs_file_acl_block(fs, &dp->inode))) {
|
||||
blk64_t blk = ext2fs_file_acl_block(fs, &dp->inode);
|
||||
delete_file_block(fs, &blk,
|
||||
file_acl_block)) {
|
||||
delete_file_block(fs, &file_acl_block,
|
||||
BLOCK_COUNT_EXTATTR, 0, 0, &pb);
|
||||
ext2fs_file_acl_block_set(fs, &dp->inode, blk);
|
||||
quota_data_sub(ctx->qctx, &dp->inode, ino, fs->blocksize);
|
||||
ext2fs_file_acl_block_set(fs, EXT2_INODE(&dp->inode),
|
||||
file_acl_block);
|
||||
quota_data_sub(ctx->qctx, &dp->inode, ino,
|
||||
fs->blocksize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -724,7 +729,7 @@ struct clone_struct {
|
|||
ext2_ino_t dir, ino;
|
||||
char *buf;
|
||||
e2fsck_t ctx;
|
||||
struct ext2_inode *inode;
|
||||
struct ext2_inode_large *inode;
|
||||
|
||||
struct dup_cluster *save_dup_cluster;
|
||||
blk64_t save_blocknr;
|
||||
|
@ -800,7 +805,8 @@ static int clone_file_block(ext2_filsys fs,
|
|||
* mapped to multiple physical clusters.
|
||||
*/
|
||||
new_block = 0;
|
||||
retval = ext2fs_map_cluster_block(fs, cs->ino, cs->inode,
|
||||
retval = ext2fs_map_cluster_block(fs, cs->ino,
|
||||
EXT2_INODE(cs->inode),
|
||||
blockcnt, &new_block);
|
||||
if (retval == 0 && new_block != 0 &&
|
||||
EXT2FS_B2C(ctx->fs, new_block) !=
|
||||
|
@ -882,7 +888,7 @@ static errcode_t clone_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
|
||||
pctx.ino = ino;
|
||||
pctx.str = "clone_file";
|
||||
if (ext2fs_inode_has_valid_blocks2(fs, &dp->inode))
|
||||
if (ext2fs_inode_has_valid_blocks2(fs, EXT2_INODE(&dp->inode)))
|
||||
pctx.errcode = ext2fs_block_iterate3(fs, ino, 0, block_buf,
|
||||
clone_file_block, &cs);
|
||||
deferred_dec_badcount(&cs);
|
||||
|
@ -899,14 +905,16 @@ static errcode_t clone_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
goto errout;
|
||||
}
|
||||
/* The inode may have changed on disk, so we have to re-read it */
|
||||
e2fsck_read_inode(ctx, ino, &dp->inode, "clone file EA");
|
||||
blk = ext2fs_file_acl_block(fs, &dp->inode);
|
||||
e2fsck_read_inode_full(ctx, ino, EXT2_INODE(&dp->inode),
|
||||
sizeof(dp->inode), "clone file EA");
|
||||
blk = ext2fs_file_acl_block(fs, EXT2_INODE(&dp->inode));
|
||||
new_blk = blk;
|
||||
if (blk && (clone_file_block(fs, &new_blk,
|
||||
BLOCK_COUNT_EXTATTR, 0, 0, &cs) ==
|
||||
BLOCK_CHANGED)) {
|
||||
ext2fs_file_acl_block_set(fs, &dp->inode, new_blk);
|
||||
e2fsck_write_inode(ctx, ino, &dp->inode, "clone file EA");
|
||||
ext2fs_file_acl_block_set(fs, EXT2_INODE(&dp->inode), new_blk);
|
||||
e2fsck_write_inode_full(ctx, ino, EXT2_INODE(&dp->inode),
|
||||
sizeof(dp->inode), "clone file EA");
|
||||
/*
|
||||
* If we cloned the EA block, find all other inodes
|
||||
* which refered to that EA block, and modify
|
||||
|
@ -935,11 +943,14 @@ static errcode_t clone_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
goto errout;
|
||||
}
|
||||
di = (struct dup_inode *) dnode_get(n);
|
||||
if (ext2fs_file_acl_block(fs, &di->inode) == blk) {
|
||||
ext2fs_file_acl_block_set(fs, &di->inode,
|
||||
ext2fs_file_acl_block(fs, &dp->inode));
|
||||
e2fsck_write_inode(ctx, ino_el->inode,
|
||||
&di->inode, "clone file EA");
|
||||
if (ext2fs_file_acl_block(fs,
|
||||
EXT2_INODE(&di->inode)) == blk) {
|
||||
ext2fs_file_acl_block_set(fs,
|
||||
EXT2_INODE(&di->inode),
|
||||
ext2fs_file_acl_block(fs, EXT2_INODE(&dp->inode)));
|
||||
e2fsck_write_inode_full(ctx, ino_el->inode,
|
||||
EXT2_INODE(&di->inode),
|
||||
sizeof(di->inode), "clone file EA");
|
||||
decrement_badcount(ctx, blk, dc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,6 @@ void e2fsck_pass2(e2fsck_t ctx)
|
|||
struct check_dir_struct cd;
|
||||
struct dx_dir_info *dx_dir;
|
||||
struct dx_dirblock_info *dx_db, *dx_parent;
|
||||
unsigned int save_type;
|
||||
int b;
|
||||
int i, depth;
|
||||
problem_t code;
|
||||
|
@ -116,19 +115,9 @@ void e2fsck_pass2(e2fsck_t ctx)
|
|||
if (!(ctx->options & E2F_OPT_PREEN))
|
||||
fix_problem(ctx, PR_2_PASS_HEADER, &cd.pctx);
|
||||
|
||||
e2fsck_setup_tdb_icount(ctx, EXT2_ICOUNT_OPT_INCREMENT,
|
||||
&ctx->inode_count);
|
||||
if (ctx->inode_count)
|
||||
cd.pctx.errcode = 0;
|
||||
else {
|
||||
e2fsck_set_bitmap_type(fs, EXT2FS_BMAP64_RBTREE,
|
||||
"inode_count", &save_type);
|
||||
cd.pctx.errcode = ext2fs_create_icount2(fs,
|
||||
EXT2_ICOUNT_OPT_INCREMENT,
|
||||
0, ctx->inode_link_info,
|
||||
&ctx->inode_count);
|
||||
fs->default_bitmap_type = save_type;
|
||||
}
|
||||
cd.pctx.errcode = e2fsck_setup_icount(ctx, "inode_count",
|
||||
EXT2_ICOUNT_OPT_INCREMENT,
|
||||
ctx->inode_link_info, &ctx->inode_count);
|
||||
if (cd.pctx.errcode) {
|
||||
fix_problem(ctx, PR_2_ALLOCATE_ICOUNT, &cd.pctx);
|
||||
ctx->flags |= E2F_FLAG_ABORT;
|
||||
|
@ -779,11 +768,11 @@ static errcode_t insert_dirent_tail(ext2_filsys fs, void *dirbuf)
|
|||
d = NEXT_DIRENT(d);
|
||||
|
||||
if (d != top) {
|
||||
size_t min_size = EXT2_DIR_REC_LEN(
|
||||
unsigned int min_size = EXT2_DIR_REC_LEN(
|
||||
ext2fs_dirent_name_len(dirbuf));
|
||||
if (min_size > top - (void *)d)
|
||||
if (min_size > (char *)top - (char *)d)
|
||||
return EXT2_ET_DIR_NO_SPACE_FOR_CSUM;
|
||||
d->rec_len = top - (void *)d;
|
||||
d->rec_len = (char *)top - (char *)d;
|
||||
}
|
||||
|
||||
t = (struct ext2_dir_entry_tail *)top;
|
||||
|
@ -1148,7 +1137,7 @@ skip_checksum:
|
|||
if ((offset + rec_len > max_block_size) ||
|
||||
(rec_len < 12) ||
|
||||
((rec_len % 4) != 0) ||
|
||||
((ext2fs_dirent_name_len(dirent) + EXT2_DIR_ENTRY_HEADER_LEN) > rec_len)) {
|
||||
(((unsigned) ext2fs_dirent_name_len(dirent) + EXT2_DIR_ENTRY_HEADER_LEN) > rec_len)) {
|
||||
if (fix_problem(ctx, PR_2_DIR_CORRUPTED,
|
||||
&cd->pctx)) {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
|
@ -1908,7 +1897,7 @@ static int allocate_dir_block(e2fsck_t ctx,
|
|||
* Update the inode block count
|
||||
*/
|
||||
ext2fs_iblk_add_blocks(fs, &inode, 1);
|
||||
if (EXT2_I_SIZE(&inode) < (db->blockcnt+1) * fs->blocksize) {
|
||||
if (EXT2_I_SIZE(&inode) < ((__u64) db->blockcnt+1) * fs->blocksize) {
|
||||
pctx->errcode = ext2fs_inode_size_set(fs, &inode,
|
||||
(db->blockcnt+1) * fs->blocksize);
|
||||
if (pctx->errcode) {
|
||||
|
|
|
@ -381,7 +381,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
|
|||
ext2_ino_t ino;
|
||||
blk64_t blk;
|
||||
errcode_t retval;
|
||||
struct ext2_inode inode;
|
||||
struct ext2_inode_large inode;
|
||||
char * block;
|
||||
static const char name[] = "lost+found";
|
||||
struct problem_context pctx;
|
||||
|
@ -406,7 +406,8 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
|
|||
return 0;
|
||||
if (!retval) {
|
||||
/* Lost+found shouldn't have inline data */
|
||||
retval = ext2fs_read_inode(fs, ino, &inode);
|
||||
retval = ext2fs_read_inode_full(fs, ino, EXT2_INODE(&inode),
|
||||
sizeof(inode));
|
||||
if (fix && retval)
|
||||
return 0;
|
||||
|
||||
|
@ -518,13 +519,13 @@ skip_new_block:
|
|||
inode.i_size = fs->blocksize;
|
||||
inode.i_atime = inode.i_ctime = inode.i_mtime = ctx->now;
|
||||
inode.i_links_count = 2;
|
||||
ext2fs_iblk_set(fs, &inode, 1);
|
||||
ext2fs_iblk_set(fs, EXT2_INODE(&inode), 1);
|
||||
inode.i_block[0] = blk;
|
||||
|
||||
/*
|
||||
* Next, write out the inode.
|
||||
*/
|
||||
pctx.errcode = ext2fs_write_new_inode(fs, ino, &inode);
|
||||
pctx.errcode = ext2fs_write_new_inode(fs, ino, EXT2_INODE(&inode));
|
||||
if (pctx.errcode) {
|
||||
pctx.str = "ext2fs_write_inode";
|
||||
fix_problem(ctx, PR_3_CREATE_LPF_ERROR, &pctx);
|
||||
|
@ -855,7 +856,7 @@ errcode_t e2fsck_expand_directory(e2fsck_t ctx, ext2_ino_t dir,
|
|||
ext2_filsys fs = ctx->fs;
|
||||
errcode_t retval;
|
||||
struct expand_dir_struct es;
|
||||
struct ext2_inode inode;
|
||||
struct ext2_inode_large inode;
|
||||
blk64_t sz;
|
||||
|
||||
if (!(fs->flags & EXT2_FLAG_RW))
|
||||
|
@ -888,18 +889,20 @@ errcode_t e2fsck_expand_directory(e2fsck_t ctx, ext2_ino_t dir,
|
|||
/*
|
||||
* Update the size and block count fields in the inode.
|
||||
*/
|
||||
retval = ext2fs_read_inode(fs, dir, &inode);
|
||||
retval = ext2fs_read_inode_full(fs, dir,
|
||||
EXT2_INODE(&inode), sizeof(inode));
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
sz = (es.last_block + 1) * fs->blocksize;
|
||||
retval = ext2fs_inode_size_set(fs, &inode, sz);
|
||||
retval = ext2fs_inode_size_set(fs, EXT2_INODE(&inode), sz);
|
||||
if (retval)
|
||||
return retval;
|
||||
ext2fs_iblk_add_blocks(fs, &inode, es.newblocks);
|
||||
ext2fs_iblk_add_blocks(fs, EXT2_INODE(&inode), es.newblocks);
|
||||
quota_data_add(ctx->qctx, &inode, dir, es.newblocks * fs->blocksize);
|
||||
|
||||
e2fsck_write_inode(ctx, dir, &inode, "expand_directory");
|
||||
e2fsck_write_inode_full(ctx, dir, EXT2_INODE(&inode),
|
||||
sizeof(inode), "expand_directory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,23 +26,21 @@
|
|||
* rest of the pass 4 tests.
|
||||
*/
|
||||
static int disconnect_inode(e2fsck_t ctx, ext2_ino_t i,
|
||||
struct ext2_inode *inode)
|
||||
struct ext2_inode_large *inode)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
struct problem_context pctx;
|
||||
__u32 eamagic = 0;
|
||||
int extra_size = 0;
|
||||
|
||||
if (EXT2_INODE_SIZE(fs->super) > EXT2_GOOD_OLD_INODE_SIZE) {
|
||||
e2fsck_read_inode_full(ctx, i, inode,EXT2_INODE_SIZE(fs->super),
|
||||
"pass4: disconnect_inode");
|
||||
extra_size = ((struct ext2_inode_large *)inode)->i_extra_isize;
|
||||
} else {
|
||||
e2fsck_read_inode(ctx, i, inode, "pass4: disconnect_inode");
|
||||
}
|
||||
e2fsck_read_inode_full(ctx, i, EXT2_INODE(inode),
|
||||
EXT2_INODE_SIZE(fs->super),
|
||||
"pass4: disconnect_inode");
|
||||
if (EXT2_INODE_SIZE(fs->super) > EXT2_GOOD_OLD_INODE_SIZE)
|
||||
extra_size = inode->i_extra_isize;
|
||||
clear_problem_context(&pctx);
|
||||
pctx.ino = i;
|
||||
pctx.inode = inode;
|
||||
pctx.inode = EXT2_INODE(inode);
|
||||
|
||||
if (EXT2_INODE_SIZE(fs->super) -EXT2_GOOD_OLD_INODE_SIZE -extra_size >0)
|
||||
eamagic = *(__u32 *)(((char *)inode) +EXT2_GOOD_OLD_INODE_SIZE +
|
||||
|
@ -56,7 +54,7 @@ static int disconnect_inode(e2fsck_t ctx, ext2_ino_t i,
|
|||
if (!inode->i_blocks && eamagic != EXT2_EXT_ATTR_MAGIC &&
|
||||
(LINUX_S_ISREG(inode->i_mode) || LINUX_S_ISDIR(inode->i_mode))) {
|
||||
if (fix_problem(ctx, PR_4_ZERO_LEN_INODE, &pctx)) {
|
||||
e2fsck_clear_inode(ctx, i, inode, 0,
|
||||
e2fsck_clear_inode(ctx, i, EXT2_INODE(inode), 0,
|
||||
"disconnect_inode");
|
||||
/*
|
||||
* Fix up the bitmaps...
|
||||
|
@ -92,7 +90,8 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
ext2_ino_t i;
|
||||
struct ext2_inode *inode;
|
||||
struct ext2_inode_large *inode;
|
||||
int inode_size = EXT2_INODE_SIZE(fs->super);
|
||||
#ifdef RESOURCE_TRACK
|
||||
struct resource_track rtrack;
|
||||
#endif
|
||||
|
@ -127,8 +126,7 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|||
if ((ctx->progress)(ctx, 4, 0, maxgroup))
|
||||
return;
|
||||
|
||||
inode = e2fsck_allocate_memory(ctx, EXT2_INODE_SIZE(fs->super),
|
||||
"scratch inode");
|
||||
inode = e2fsck_allocate_memory(ctx, inode_size, "scratch inode");
|
||||
|
||||
/* Protect loop from wrap-around if s_inodes_count maxed */
|
||||
for (i=1; i <= fs->super->s_inodes_count && i > 0; i++) {
|
||||
|
@ -171,9 +169,10 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|||
if (isdir && (link_counted > EXT2_LINK_MAX))
|
||||
link_counted = 1;
|
||||
if (link_counted != link_count) {
|
||||
e2fsck_read_inode(ctx, i, inode, "pass4");
|
||||
e2fsck_read_inode_full(ctx, i, EXT2_INODE(inode),
|
||||
inode_size, "pass4");
|
||||
pctx.ino = i;
|
||||
pctx.inode = inode;
|
||||
pctx.inode = EXT2_INODE(inode);
|
||||
if ((link_count != inode->i_links_count) && !isdir &&
|
||||
(inode->i_links_count <= EXT2_LINK_MAX)) {
|
||||
pctx.num = link_count;
|
||||
|
@ -188,7 +187,9 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|||
link_count == 1 && !(ctx->options & E2F_OPT_NO)) ||
|
||||
fix_problem(ctx, PR_4_BAD_REF_COUNT, &pctx)) {
|
||||
inode->i_links_count = link_counted;
|
||||
e2fsck_write_inode(ctx, i, inode, "pass4");
|
||||
e2fsck_write_inode_full(ctx, i,
|
||||
EXT2_INODE(inode),
|
||||
inode_size, "pass4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ redo_counts:
|
|||
* to do a discard operation.
|
||||
*/
|
||||
if (!first_block_in_bg ||
|
||||
(group == (int)fs->group_desc_count - 1) ||
|
||||
(group == fs->group_desc_count - 1) ||
|
||||
(ctx->options & E2F_OPT_DISCARD))
|
||||
goto no_optimize;
|
||||
|
||||
|
|
|
@ -472,6 +472,21 @@ static struct e2fsck_problem problem_table[] = {
|
|||
N_("@S metadata_csum_seed is not necessary without metadata_csum."),
|
||||
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
|
||||
|
||||
/* Error initializing quota context */
|
||||
{ PR_0_QUOTA_INIT_CTX,
|
||||
N_("Error initializing quota context in support library: %m\n"),
|
||||
PROMPT_NULL, PR_FATAL },
|
||||
|
||||
/* Bad s_min_extra_isize in superblock */
|
||||
{ PR_0_BAD_MIN_EXTRA_ISIZE,
|
||||
N_("Bad required extra isize in @S (%N). "),
|
||||
PROMPT_FIX, 0 },
|
||||
|
||||
/* Bad s_min_extra_isize in superblock */
|
||||
{ PR_0_BAD_WANT_EXTRA_ISIZE,
|
||||
N_("Bad desired extra isize in @S (%N). "),
|
||||
PROMPT_FIX, 0 },
|
||||
|
||||
/* Pass 1 errors */
|
||||
|
||||
/* Pass 1: Checking inodes, blocks, and sizes */
|
||||
|
@ -2006,6 +2021,11 @@ static struct e2fsck_problem problem_table[] = {
|
|||
N_("Error flushing writes to storage device: %m\n"),
|
||||
PROMPT_NULL, PR_FATAL },
|
||||
|
||||
/* Error writing quota information */
|
||||
{ PR_6_WRITE_QUOTAS,
|
||||
N_("Error writing quota info for quota type %N: %m\n"),
|
||||
PROMPT_NULL, 0 },
|
||||
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -271,6 +271,16 @@ struct problem_context {
|
|||
/* metadata_csum_seed means nothing without metadata_csum */
|
||||
#define PR_0_CSUM_SEED_WITHOUT_META_CSUM 0x00004B
|
||||
|
||||
/* Error initializing quota context */
|
||||
#define PR_0_QUOTA_INIT_CTX 0x00004C
|
||||
|
||||
/* Bad s_min_extra_isize in superblock */
|
||||
#define PR_0_BAD_MIN_EXTRA_ISIZE 0x00004D
|
||||
|
||||
/* Bad s_want_extra_isize in superblock */
|
||||
#define PR_0_BAD_WANT_EXTRA_ISIZE 0x00004E
|
||||
|
||||
|
||||
/*
|
||||
* Pass 1 errors
|
||||
*/
|
||||
|
@ -1212,6 +1222,10 @@ struct problem_context {
|
|||
/* Error flushing writes to storage device */
|
||||
#define PR_6_IO_FLUSH 0x060005
|
||||
|
||||
/* Error updating quota information */
|
||||
#define PR_6_WRITE_QUOTAS 0x060006
|
||||
|
||||
|
||||
/*
|
||||
* Function declarations
|
||||
*/
|
||||
|
|
|
@ -184,7 +184,7 @@ static int jbd2_descr_block_csum_verify(journal_t *j,
|
|||
if (!journal_has_csum_v2or3(j))
|
||||
return 1;
|
||||
|
||||
tail = (struct journal_block_tail *)(buf + j->j_blocksize -
|
||||
tail = (struct journal_block_tail *)((char *)buf + j->j_blocksize -
|
||||
sizeof(struct journal_block_tail));
|
||||
provided = tail->t_checksum;
|
||||
tail->t_checksum = 0;
|
||||
|
@ -338,12 +338,24 @@ int journal_skip_recovery(journal_t *journal)
|
|||
return err;
|
||||
}
|
||||
|
||||
static inline __u32 get_be32(__be32 *p)
|
||||
{
|
||||
unsigned char *cp = (unsigned char *) p;
|
||||
__u32 ret;
|
||||
|
||||
ret = *cp++;
|
||||
ret = (ret << 8) + *cp++;
|
||||
ret = (ret << 8) + *cp++;
|
||||
ret = (ret << 8) + *cp++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline unsigned long long read_tag_block(journal_t *journal,
|
||||
journal_block_tag_t *tag)
|
||||
{
|
||||
unsigned long long block = ext2fs_be32_to_cpu(tag->t_blocknr);
|
||||
unsigned long long block = get_be32(&tag->t_blocknr);
|
||||
if (jfs_has_feature_64bit(journal))
|
||||
block |= (u64)ext2fs_be32_to_cpu(tag->t_blocknr_high) << 32;
|
||||
block |= (u64)get_be32(&tag->t_blocknr_high) << 32;
|
||||
return block;
|
||||
}
|
||||
|
||||
|
@ -626,8 +638,9 @@ static int do_one_pass(journal_t *journal,
|
|||
memcpy(nbh->b_data, obh->b_data,
|
||||
journal->j_blocksize);
|
||||
if (flags & JFS_FLAG_ESCAPE) {
|
||||
*((__u32 *)nbh->b_data) =
|
||||
ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
|
||||
__u32 magic = ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
|
||||
memcpy(nbh->b_data, &magic,
|
||||
sizeof(magic));
|
||||
}
|
||||
|
||||
BUFFER_TRACE(nbh, "marking dirty");
|
||||
|
@ -818,7 +831,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j,
|
|||
if (!journal_has_csum_v2or3(j))
|
||||
return 1;
|
||||
|
||||
tail = (struct journal_revoke_tail *)(buf + j->j_blocksize -
|
||||
tail = (struct journal_revoke_tail *)((char *)buf + j->j_blocksize -
|
||||
sizeof(struct journal_revoke_tail));
|
||||
provided = tail->r_checksum;
|
||||
tail->r_checksum = 0;
|
||||
|
@ -835,7 +848,7 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
|
|||
{
|
||||
journal_revoke_header_t *header;
|
||||
int offset, max;
|
||||
int csum_size = 0;
|
||||
unsigned csum_size = 0;
|
||||
__u32 rcount;
|
||||
int record_len = 4;
|
||||
|
||||
|
|
|
@ -210,9 +210,8 @@ static EXT2_QSORT_TYPE name_cmp(const void *a, const void *b)
|
|||
{
|
||||
const struct hash_entry *he_a = (const struct hash_entry *) a;
|
||||
const struct hash_entry *he_b = (const struct hash_entry *) b;
|
||||
unsigned int he_a_len, he_b_len;
|
||||
unsigned int he_a_len, he_b_len, min_len;
|
||||
int ret;
|
||||
int min_len;
|
||||
|
||||
he_a_len = ext2fs_dirent_name_len(he_a->dir);
|
||||
he_b_len = ext2fs_dirent_name_len(he_b->dir);
|
||||
|
@ -309,7 +308,7 @@ static errcode_t get_next_block(ext2_filsys fs, struct out_dir *outdir,
|
|||
*/
|
||||
static void mutate_name(char *str, unsigned int *len)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
unsigned int l = *len;
|
||||
|
||||
/*
|
||||
|
@ -320,7 +319,7 @@ static void mutate_name(char *str, unsigned int *len)
|
|||
if (!isdigit(str[i]))
|
||||
break;
|
||||
}
|
||||
if ((i == l-1) || (str[i] != '~')) {
|
||||
if ((i == (int)l - 1) || (str[i] != '~')) {
|
||||
if (((l-1) & 3) < 2)
|
||||
l += 2;
|
||||
else
|
||||
|
@ -404,7 +403,7 @@ static int duplicate_search_and_fix(e2fsck_t ctx, ext2_filsys fs,
|
|||
for (j=0; j < fd->num_array; j++) {
|
||||
if ((i==j) ||
|
||||
(new_len !=
|
||||
ext2fs_dirent_name_len(fd->harray[j].dir)) ||
|
||||
(unsigned) ext2fs_dirent_name_len(fd->harray[j].dir)) ||
|
||||
strncmp(new_name, fd->harray[j].dir->name, new_len))
|
||||
continue;
|
||||
mutate_name(new_name, &new_len);
|
||||
|
@ -702,7 +701,6 @@ static int write_dir_block(ext2_filsys fs,
|
|||
void *priv_data)
|
||||
{
|
||||
struct write_dir_struct *wd = (struct write_dir_struct *) priv_data;
|
||||
blk64_t blk;
|
||||
char *dir, *buf = 0;
|
||||
|
||||
#ifdef REHASH_DEBUG
|
||||
|
@ -793,8 +791,9 @@ errcode_t e2fsck_rehash_dir(e2fsck_t ctx, ext2_ino_t ino,
|
|||
errcode_t retval;
|
||||
struct ext2_inode inode;
|
||||
char *dir_buf = 0;
|
||||
struct fill_dir_struct fd = { NULL };
|
||||
struct out_dir outdir = { 0 };
|
||||
struct fill_dir_struct fd = { NULL, NULL, 0, 0, 0, NULL,
|
||||
0, 0, 0, 0, 0, 0 };
|
||||
struct out_dir outdir = { 0, 0, 0, 0 };
|
||||
|
||||
e2fsck_read_inode(ctx, ino, &inode, "rehash_dir");
|
||||
|
||||
|
|
|
@ -578,7 +578,35 @@ void check_super_block(e2fsck_t ctx)
|
|||
ext2fs_mark_super_dirty(fs);
|
||||
}
|
||||
}
|
||||
|
||||
if (EXT2_INODE_SIZE(sb) > EXT2_GOOD_OLD_INODE_SIZE) {
|
||||
unsigned min =
|
||||
sizeof(((struct ext2_inode_large *) 0)->i_extra_isize) +
|
||||
sizeof(((struct ext2_inode_large *) 0)->i_checksum_hi);
|
||||
unsigned max = EXT2_INODE_SIZE(sb) - EXT2_GOOD_OLD_INODE_SIZE;
|
||||
pctx.num = sb->s_min_extra_isize;
|
||||
if (sb->s_min_extra_isize &&
|
||||
(sb->s_min_extra_isize < min ||
|
||||
sb->s_min_extra_isize > max ||
|
||||
sb->s_min_extra_isize & 3) &&
|
||||
fix_problem(ctx, PR_0_BAD_MIN_EXTRA_ISIZE, &pctx)) {
|
||||
sb->s_min_extra_isize =
|
||||
(sizeof(struct ext2_inode_large) -
|
||||
EXT2_GOOD_OLD_INODE_SIZE);
|
||||
ext2fs_mark_super_dirty(fs);
|
||||
}
|
||||
pctx.num = sb->s_want_extra_isize;
|
||||
if (sb->s_want_extra_isize &&
|
||||
(sb->s_want_extra_isize < min ||
|
||||
sb->s_want_extra_isize > max ||
|
||||
sb->s_want_extra_isize & 3) &&
|
||||
fix_problem(ctx, PR_0_BAD_WANT_EXTRA_ISIZE, &pctx)) {
|
||||
sb->s_want_extra_isize =
|
||||
(sizeof(struct ext2_inode_large) -
|
||||
EXT2_GOOD_OLD_INODE_SIZE);
|
||||
ext2fs_mark_super_dirty(fs);
|
||||
}
|
||||
}
|
||||
|
||||
/* Are metadata_csum and uninit_bg both set? */
|
||||
if (ext2fs_has_feature_metadata_csum(fs->super) &&
|
||||
ext2fs_has_feature_gdt_csum(fs->super) &&
|
||||
|
|
|
@ -76,7 +76,7 @@ static void usage(e2fsck_t ctx)
|
|||
fprintf(stderr,
|
||||
_("Usage: %s [-panyrcdfktvDFV] [-b superblock] [-B blocksize]\n"
|
||||
"\t\t[-l|-L bad_blocks_file] [-C fd] [-j external_journal]\n"
|
||||
"\t\t[-E extended-options] [-z undo_file] device\n"),
|
||||
"\t\t[-E extended-options] [-T patch_file] [-z undo_file] device\n"),
|
||||
ctx->program_name);
|
||||
|
||||
fprintf(stderr, "%s", _("\nEmergency help:\n"
|
||||
|
@ -92,6 +92,7 @@ static void usage(e2fsck_t ctx)
|
|||
" -j external_journal Set location of the external journal\n"
|
||||
" -l bad_blocks_file Add to badblocks list\n"
|
||||
" -L bad_blocks_file Set badblocks list\n"
|
||||
" -T patch_file Create a patch file instead of applying changes to real FS\n"
|
||||
" -z undo_file Create an undo file\n"
|
||||
));
|
||||
|
||||
|
@ -804,7 +805,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
|||
|
||||
phys_mem_kb = get_memory_size() / 1024;
|
||||
ctx->readahead_kb = ~0ULL;
|
||||
while ((c = getopt(argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDkz:")) != EOF)
|
||||
while ((c = getopt(argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDkT:z:")) != EOF)
|
||||
switch (c) {
|
||||
case 'C':
|
||||
ctx->progress = e2fsck_update_progress;
|
||||
|
@ -936,6 +937,9 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
|
|||
case 'k':
|
||||
keep_bad_blocks++;
|
||||
break;
|
||||
case 'T':
|
||||
ctx->patch_file = optarg;
|
||||
break;
|
||||
case 'z':
|
||||
ctx->undo_file = optarg;
|
||||
break;
|
||||
|
@ -1233,6 +1237,19 @@ check_error:
|
|||
return retval;
|
||||
}
|
||||
|
||||
static int e2fsck_setup_patch(e2fsck_t ctx, io_manager *io_ptr)
|
||||
{
|
||||
set_patch_io_backing_manager(*io_ptr);
|
||||
set_patch_io_patch_file(ctx->patch_file);
|
||||
*io_ptr = patch_io_manager;
|
||||
printf(_("To make backup before applying changes run:\n"
|
||||
" e2patch backup %s %s %s.backup\n"
|
||||
"Then, to apply the operation to the real filesystem run:\n"
|
||||
" e2patch apply %s %s\n"),
|
||||
ctx->device_name, ctx->patch_file, ctx->patch_file, ctx->device_name, ctx->patch_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int e2fsck_setup_tdb(e2fsck_t ctx, io_manager *io_ptr)
|
||||
{
|
||||
errcode_t retval = ENOMEM;
|
||||
|
@ -1430,7 +1447,11 @@ restart:
|
|||
flags &= ~EXT2_FLAG_EXCLUSIVE;
|
||||
}
|
||||
|
||||
if (ctx->undo_file) {
|
||||
if (ctx->patch_file) {
|
||||
retval = e2fsck_setup_patch(ctx, &io_ptr);
|
||||
if (retval)
|
||||
exit(FSCK_ERROR);
|
||||
} else if (ctx->undo_file) {
|
||||
retval = e2fsck_setup_tdb(ctx, &io_ptr);
|
||||
if (retval)
|
||||
exit(FSCK_ERROR);
|
||||
|
@ -1647,7 +1668,8 @@ failure:
|
|||
com_err(ctx->program_name, retval,
|
||||
_("while checking journal for %s"),
|
||||
ctx->device_name);
|
||||
fatal_error(ctx, 0);
|
||||
fatal_error(ctx,
|
||||
_("Cannot proceed with file system check"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1790,7 +1812,13 @@ print_unsupp_features:
|
|||
qtype_bits |= 1 << qtype;
|
||||
}
|
||||
|
||||
quota_init_context(&ctx->qctx, ctx->fs, qtype_bits);
|
||||
clear_problem_context(&pctx);
|
||||
pctx.errcode = quota_init_context(&ctx->qctx, ctx->fs,
|
||||
qtype_bits);
|
||||
if (pctx.errcode) {
|
||||
fix_problem(ctx, PR_0_QUOTA_INIT_CTX, &pctx);
|
||||
fatal_error(ctx, 0);
|
||||
}
|
||||
}
|
||||
|
||||
run_result = e2fsck_run(ctx);
|
||||
|
@ -1842,8 +1870,13 @@ no_journal:
|
|||
retval = quota_compare_and_update(ctx->qctx, qtype,
|
||||
&needs_writeout);
|
||||
if ((retval || needs_writeout) &&
|
||||
fix_problem(ctx, PR_6_UPDATE_QUOTAS, &pctx))
|
||||
quota_write_inode(ctx->qctx, 1 << qtype);
|
||||
fix_problem(ctx, PR_6_UPDATE_QUOTAS, &pctx)) {
|
||||
pctx.errcode = quota_write_inode(ctx->qctx,
|
||||
1 << qtype);
|
||||
if (pctx.errcode)
|
||||
(void) fix_problem(ctx,
|
||||
PR_6_WRITE_QUOTAS, &pctx);
|
||||
}
|
||||
}
|
||||
quota_release_context(&ctx->qctx);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
Begin3
|
||||
Title: EXT2 Filesystem utilities
|
||||
Version: 1.43
|
||||
Entered-date: 2016-05-17
|
||||
Version: 1.43.3
|
||||
Entered-date: 2016-09-04
|
||||
Description: The filesystem utilities for the EXT2, EXT3, and EXT4
|
||||
filesystems, including e2fsck, mke2fs, dumpe2fs, and others.
|
||||
Keywords: utilities, filesystem, Ext2fs, ext3, ext4
|
||||
Author: tytso@mit.edu (Theodore Tso)
|
||||
Maintained-by: tytso@mit.edu (Theodore Tso)
|
||||
Primary-site: ftp.kernel.org /pub/linux/kernel/people/tytso/e2fsprogs
|
||||
6856kB e2fsprogs-1.43.tar.gz
|
||||
588kB e2fsprogs-libs-1.43.tar.gz
|
||||
1kB e2fsprogs-1.43.lsm
|
||||
7224kB e2fsprogs-1.43.3.tar.gz
|
||||
644kB e2fsprogs-libs-1.43.3.tar.gz
|
||||
1kB e2fsprogs-1.43.3.lsm
|
||||
Alternate-site: download.sourceforge.net /pub/sourceforge/e2fsprogs
|
||||
Platforms: linux 1.2.x/1.3.x/2.0.x/2.1.x/2.2.x/2.3.x/2.4.x/2.5.x/2.6.x/3.x/4.x
|
||||
Copying-policy: GPL-2/LGPL-2
|
||||
|
|
|
@ -117,6 +117,7 @@ exit 0
|
|||
%{_root_sbindir}/e2image
|
||||
%{_root_sbindir}/e2label
|
||||
%{_root_sbindir}/e2undo
|
||||
%{_root_sbindir}/e2patch
|
||||
%{_root_sbindir}/findfs
|
||||
%{_root_sbindir}/fsck
|
||||
%{_root_sbindir}/fsck.ext2
|
||||
|
@ -168,6 +169,7 @@ exit 0
|
|||
%{_mandir}/man8/e2image.8*
|
||||
%{_mandir}/man8/e2label.8*
|
||||
%{_mandir}/man8/e2undo.8*
|
||||
%{_mandir}/man8/e2patch.8*
|
||||
%{_mandir}/man8/fsck.8*
|
||||
%{_mandir}/man8/logsave.8*
|
||||
%{_mandir}/man8/mke2fs.8*
|
||||
|
|
|
@ -22,7 +22,7 @@ BSDLIB_PIC_FLAG = -fpic
|
|||
image: $(BSD_LIB)
|
||||
|
||||
$(BSD_LIB): $(OBJS)
|
||||
(cd pic; ld -Bshareable -o $(BSD_LIB) $(LDFLAGS) $(OBJS))
|
||||
(cd pic; ld -Bshareable -o $(BSD_LIB) $(LDFLAGS_SHLIB) $(OBJS))
|
||||
$(MV) pic/$(BSD_LIB) .
|
||||
$(RM) -f ../$(BSD_LIB)
|
||||
(cd ..; $(LN) $(LINK_BUILD_FLAGS) \
|
||||
|
|
|
@ -24,8 +24,8 @@ image: $(ELF_LIB)
|
|||
|
||||
$(ELF_LIB): $(OBJS)
|
||||
$(E) " GEN_ELF_SOLIB $(ELF_LIB)"
|
||||
$(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) \
|
||||
-L$(top_builddir)/../lib $(LDFLAGS) \
|
||||
$(Q) (cd elfshared; $(CC) -o $(ELF_LIB) \
|
||||
-L$(top_builddir)/../lib $(LDFLAGS_SHLIB) -fPIC -shared \
|
||||
-Wl,-soname,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS))
|
||||
$(Q) $(MV) elfshared/$(ELF_LIB) .
|
||||
$(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME)
|
||||
|
|
|
@ -25,7 +25,7 @@ image: $(ELF_LIB)
|
|||
$(ELF_LIB): $(OBJS)
|
||||
$(E) " GEN_ELF_SOLIB $(ELF_LIB)"
|
||||
$(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) \
|
||||
-L$(top_builddir)/../lib $(LDFLAGS) \
|
||||
-L$(top_builddir)/../lib $(LDFLAGS_SHLIB) \
|
||||
-Wl,-h,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS))
|
||||
$(Q) $(MV) elfshared/$(ELF_LIB) .
|
||||
$(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME)
|
||||
|
|
|
@ -53,12 +53,12 @@ DEPLIBS_BLKID= $(DEPSTATIC_LIBBLKID) $(DEPSTATIC_LIBUUID)
|
|||
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
|
||||
$(Q) $(CC) $(ALL_CFLAGS_STLIB) -c $< -o $@
|
||||
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
|
||||
$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS_STLIB) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) -fPIC -shared -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
|
||||
all:: $(SMANPAGES) blkid.pc
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ struct dir_list {
|
|||
char *name;
|
||||
struct dir_list *next;
|
||||
};
|
||||
extern void blkid__scan_dir(char *, dev_t, struct dir_list **, char **);
|
||||
extern void blkid__scan_dir(const char *, dev_t, struct dir_list **, char **);
|
||||
|
||||
/* lseek.c */
|
||||
extern blkid_loff_t blkid_llseek(int fd, blkid_loff_t offset, int whence);
|
||||
|
|
|
@ -91,7 +91,7 @@ static void free_dirlist(struct dir_list **list)
|
|||
*list = NULL;
|
||||
}
|
||||
|
||||
void blkid__scan_dir(char *dirname, dev_t devno, struct dir_list **list,
|
||||
void blkid__scan_dir(const char *dirname, dev_t devno, struct dir_list **list,
|
||||
char **devname)
|
||||
{
|
||||
DIR *dir;
|
||||
|
|
|
@ -131,7 +131,7 @@ blkid_loff_t blkid_get_dev_size(int fd)
|
|||
return (blkid_loff_t)this_floppy.size << 9;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SYS_DISKLABEL_H
|
||||
#if defined(HAVE_SYS_DISKLABEL_H) && defined(DIOCGDINFO)
|
||||
{
|
||||
int part = -1;
|
||||
struct disklabel lab;
|
||||
|
@ -158,7 +158,7 @@ blkid_loff_t blkid_get_dev_size(int fd)
|
|||
return pp->p_size << 9;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_SYS_DISKLABEL_H */
|
||||
#endif /* defined(HAVE_SYS_DISKLABEL_H) && defined(DIOCGDINFO) */
|
||||
{
|
||||
#if defined(HAVE_FSTAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
|
||||
struct stat64 st;
|
||||
|
|
|
@ -857,10 +857,10 @@ static int probe_jfs(struct blkid_probe *probe,
|
|||
|
||||
js = (struct jfs_super_block *)buf;
|
||||
|
||||
if (blkid_le32(js->js_bsize) != (1 << blkid_le16(js->js_l2bsize)))
|
||||
if (blkid_le32(js->js_bsize) != (1U << blkid_le16(js->js_l2bsize)))
|
||||
return 1;
|
||||
|
||||
if (blkid_le32(js->js_pbsize) != (1 << blkid_le16(js->js_l2pbsize)))
|
||||
if (blkid_le32(js->js_pbsize) != (1U << blkid_le16(js->js_l2pbsize)))
|
||||
return 1;
|
||||
|
||||
if ((blkid_le16(js->js_l2bsize) - blkid_le16(js->js_l2pbsize)) !=
|
||||
|
@ -1393,7 +1393,7 @@ static int probe_btrfs(struct blkid_probe *probe,
|
|||
}
|
||||
|
||||
static int probe_f2fs(struct blkid_probe *probe,
|
||||
struct blkid_magic *id,
|
||||
struct blkid_magic *id __BLKID_ATTR((unused)),
|
||||
unsigned char *buf)
|
||||
{
|
||||
struct f2fs_super_block *bs;
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
/* Define to 1 to enable mmp support */
|
||||
#undef CONFIG_MMP
|
||||
|
||||
/* Define to 1 to enable tdb support */
|
||||
#undef CONFIG_TDB
|
||||
|
||||
/* Define to 1 if the testio I/O manager should be enabled */
|
||||
#undef CONFIG_TESTIO_DEBUG
|
||||
|
||||
|
@ -117,7 +120,7 @@
|
|||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if dlopen/libdl exists */
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
|
@ -657,6 +660,9 @@
|
|||
/* The size of `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* The size of `time_t', as computed by sizeof. */
|
||||
#undef SIZEOF_TIME_T
|
||||
|
||||
/* Define as the maximum value of type 'size_t', if the system doesn't define
|
||||
it. */
|
||||
#ifndef SIZE_MAX
|
||||
|
|
|
@ -54,12 +54,12 @@ BSDLIB_INSTALL_DIR = $(root_libdir)
|
|||
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
|
||||
$(Q) $(CC) $(ALL_CFLAGS_STLIB) -c $< -o $@
|
||||
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
|
||||
$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS_STLIB) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) -fPIC -shared -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
|
||||
e2p.pc: $(srcdir)/e2p.pc.in $(top_builddir)/config.status
|
||||
$(E) " CONFIG.STATUS $@"
|
||||
|
@ -68,12 +68,12 @@ e2p.pc: $(srcdir)/e2p.pc.in $(top_builddir)/config.status
|
|||
tst_ostype: $(srcdir)/ostype.c
|
||||
$(E) " LD $@"
|
||||
$(Q) $(CC) -DTEST_PROGRAM -I$(top_srcdir)/lib -o tst_ostype \
|
||||
$(srcdir)/ostype.c $(ALL_CFLAGS)
|
||||
$(srcdir)/ostype.c $(ALL_CFLAGS) $(ALL_LDFLAGS)
|
||||
|
||||
tst_feature: $(srcdir)/feature.c
|
||||
$(E) " LD $@"
|
||||
$(Q) $(CC) -DTEST_PROGRAM -I$(top_srcdir)/lib -o tst_feature \
|
||||
$(srcdir)/feature.c $(ALL_CFLAGS)
|
||||
$(srcdir)/feature.c $(ALL_CFLAGS) $(ALL_LDFLAGS)
|
||||
|
||||
check:: tst_ostype tst_feature
|
||||
./tst_ostype
|
||||
|
|
|
@ -42,12 +42,12 @@ BSDLIB_INSTALL_DIR = $(root_libdir)
|
|||
#
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
|
||||
$(Q) $(CC) $(ALL_CFLAGS_STLIB) -c $< -o $@
|
||||
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
|
||||
$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS_STLIB) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) -fPIC -shared -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
|
||||
@MAKEFILE_LIBRARY@
|
||||
@MAKEFILE_ELF@
|
||||
|
@ -140,7 +140,7 @@ uninstall::
|
|||
check:: compile_et
|
||||
for i in $(srcdir)/test_cases/*.et ; do \
|
||||
t=`basename $$i | sed -e 's/.et//'`; \
|
||||
./compile_et --build-tree $$i ; \
|
||||
_ET_DIR_OVERRIDE=$(srcdir) ./compile_et $$i ; \
|
||||
diff -c $(srcdir)/test_cases/$$t.c $$t.c > $$t.failed; \
|
||||
if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
|
||||
diff -c $(srcdir)/test_cases/$$t.h $$t.h >> $$t.failed; \
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
datarootdir=@datarootdir@
|
||||
AWK=@AWK@
|
||||
DIR="${DIR-@datadir@/et}"
|
||||
ET_DIR="${ET_DIR-@ET_DIR@}"
|
||||
DIR=@datadir@/et
|
||||
|
||||
if test "$1" = "--build-tree" ; then
|
||||
shift;
|
||||
|
@ -29,13 +28,13 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
if test -n "$_ET_DIR_OVERRIDE" ; then
|
||||
DIR="$_ET_DIR_OVERRIDE";
|
||||
fi
|
||||
|
||||
if test ! -f "$DIR/et_h.awk" || test ! -f "$DIR/et_c.awk" ; then
|
||||
DIR="$ET_DIR"
|
||||
# echo "Falling back to $DIR..."
|
||||
if test ! -f "$DIR/et_h.awk" || test ! -f "$DIR/et_c.awk" ; then
|
||||
echo "compile_et: Couldn't find compile_et's template files."
|
||||
exit 1
|
||||
fi
|
||||
echo "compile_et: Couldn't find compile_et's template files."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT=`echo $1 | sed -e s/.et$//`
|
||||
|
|
|
@ -74,8 +74,9 @@ libext2fs_src_files := \
|
|||
sha512.c \
|
||||
swapfs.c \
|
||||
symlink.c \
|
||||
tdb.c \
|
||||
undo_io.c \
|
||||
patch.c \
|
||||
patch_io.c \
|
||||
unix_io.c \
|
||||
unlink.c \
|
||||
valid_blk.c \
|
||||
|
|
|
@ -13,7 +13,8 @@ DEBUGFS_CFLAGS = -I$(srcdir)/../../e2fsck $(ALL_CFLAGS) -DDEBUGFS
|
|||
|
||||
@DEBUGFS_CMT@DEBUGFS_LIB_OBJS = bb_compat.o inode_io.o write_bb_file.o
|
||||
|
||||
MK_CMDS= _SS_DIR_OVERRIDE=../ss ../ss/mk_cmds
|
||||
MK_CMDS= _SS_DIR_OVERRIDE=$(srcdir)/../ss ../ss/mk_cmds
|
||||
COMPILE_ET= _ET_DIR_OVERRIDE=$(srcdir)/../et ../et/compile_et
|
||||
|
||||
@RESIZER_CMT@RESIZE_LIB_OBJS = dupfs.o
|
||||
@TEST_IO_CMT@TEST_IO_LIB_OBJS = test_io.o
|
||||
|
@ -49,6 +50,8 @@ DEBUG_SRCS= debug_cmds.c extent_cmds.c tst_cmds.c \
|
|||
$(top_srcdir)/e2fsck/recovery.c \
|
||||
$(top_srcdir)/debugfs/do_journal.c
|
||||
|
||||
@TDB_CMT@TDB_OBJ= tdb.o
|
||||
|
||||
OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \
|
||||
$(TEST_IO_LIB_OBJS) \
|
||||
ext2_err.o \
|
||||
|
@ -119,8 +122,10 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \
|
|||
sha512.o \
|
||||
swapfs.o \
|
||||
symlink.o \
|
||||
tdb.o \
|
||||
$(TDB_OBJ) \
|
||||
undo_io.o \
|
||||
patch.o \
|
||||
patch_io.o \
|
||||
unix_io.o \
|
||||
unlink.o \
|
||||
valid_blk.o \
|
||||
|
@ -208,6 +213,8 @@ SRCS= ext2_err.c \
|
|||
$(srcdir)/tst_getsize.c \
|
||||
$(srcdir)/tst_iscan.c \
|
||||
$(srcdir)/undo_io.c \
|
||||
$(srcdir)/patch.c \
|
||||
$(srcdir)/patch_io.c \
|
||||
$(srcdir)/unix_io.c \
|
||||
$(srcdir)/unlink.c \
|
||||
$(srcdir)/valid_blk.c \
|
||||
|
@ -245,14 +252,12 @@ all:: ext2fs.pc
|
|||
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
|
||||
$(Q) $(CC) $(ALL_CFLAGS_STLIB) -c $< -o $@
|
||||
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
|
||||
$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
|
||||
COMPILE_ET=../et/compile_et --build-tree
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS_STLIB) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) -fPIC -shared -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
|
||||
DISTFILES= Makefile *.c *.h image
|
||||
|
||||
|
@ -1098,6 +1103,18 @@ undo_io.o: $(srcdir)/undo_io.c $(top_builddir)/lib/config.h \
|
|||
$(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h
|
||||
patch.o: $(srcdir)/patch.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
|
||||
$(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h
|
||||
patch_io.o: $(srcdir)/patch_io.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
|
||||
$(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h
|
||||
unix_io.o: $(srcdir)/unix_io.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
|
||||
|
|
|
@ -138,7 +138,7 @@ unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes)
|
|||
const __u32 *p;
|
||||
unsigned int res = 0;
|
||||
|
||||
while (((((unsigned long) cp) & 3) != 0) && (nbytes > 0)) {
|
||||
while (((((uintptr_t) cp) & 3) != 0) && (nbytes > 0)) {
|
||||
res += popcount8(*cp++);
|
||||
nbytes--;
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ static errcode_t ba_find_first_zero(ext2fs_generic_bitmap bitmap,
|
|||
|
||||
pos = ((unsigned char *)bp->bitarray) + (bitpos >> 3);
|
||||
/* scan bytes until 8-byte (64-bit) aligned */
|
||||
while (count >= 8 && (((unsigned long)pos) & 0x07)) {
|
||||
while (count >= 8 && (((uintptr_t)pos) & 0x07)) {
|
||||
if (*pos != 0xff) {
|
||||
byte_found = 1;
|
||||
break;
|
||||
|
@ -423,7 +423,7 @@ static errcode_t ba_find_first_set(ext2fs_generic_bitmap bitmap,
|
|||
|
||||
pos = ((unsigned char *)bp->bitarray) + (bitpos >> 3);
|
||||
/* scan bytes until 8-byte (64-bit) aligned */
|
||||
while (count >= 8 && (((unsigned long)pos) & 0x07)) {
|
||||
while (count >= 8 && (((uintptr_t)pos) & 0x07)) {
|
||||
if (*pos != 0) {
|
||||
byte_found = 1;
|
||||
break;
|
||||
|
|
|
@ -185,8 +185,9 @@ struct ext2_group_desc *ext2fs_group_desc(ext2_filsys fs,
|
|||
struct opaque_ext2_group_desc *gdp,
|
||||
dgrp_t group)
|
||||
{
|
||||
return (struct ext2_group_desc *)((char *)gdp +
|
||||
group * EXT2_DESC_SIZE(fs->super));
|
||||
int desc_size = EXT2_DESC_SIZE(fs->super) & ~7;
|
||||
|
||||
return (struct ext2_group_desc *)((char *)gdp + group * desc_size);
|
||||
}
|
||||
|
||||
/* Do the same but as an ext4 group desc for internal use here */
|
||||
|
|
|
@ -97,10 +97,10 @@ crc32_body(uint32_t crc, unsigned char const *buf, size_t len,
|
|||
uint32_t q;
|
||||
|
||||
/* Align it */
|
||||
if (unlikely((long)buf & 3 && len)) {
|
||||
if (unlikely((uintptr_t)buf & 3 && len)) {
|
||||
do {
|
||||
DO_CRC(*buf++);
|
||||
} while ((--len) && ((long)buf)&3);
|
||||
} while ((--len) && ((uintptr_t)buf)&3);
|
||||
}
|
||||
|
||||
# if CRC_LE_BITS == 32
|
||||
|
|
|
@ -664,8 +664,7 @@ int ext2fs_inode_csum_verify(ext2_filsys fs, ext2_ino_t inum,
|
|||
unsigned int i, has_hi;
|
||||
char *cp;
|
||||
|
||||
if (fs->super->s_creator_os != EXT2_OS_LINUX ||
|
||||
!ext2fs_has_feature_metadata_csum(fs->super))
|
||||
if (!ext2fs_has_feature_metadata_csum(fs->super))
|
||||
return 1;
|
||||
|
||||
has_hi = (EXT2_INODE_SIZE(fs->super) > EXT2_GOOD_OLD_INODE_SIZE &&
|
||||
|
@ -707,8 +706,7 @@ errcode_t ext2fs_inode_csum_set(ext2_filsys fs, ext2_ino_t inum,
|
|||
__u32 crc;
|
||||
int has_hi;
|
||||
|
||||
if (fs->super->s_creator_os != EXT2_OS_LINUX ||
|
||||
!ext2fs_has_feature_metadata_csum(fs->super))
|
||||
if (!ext2fs_has_feature_metadata_csum(fs->super))
|
||||
return 0;
|
||||
|
||||
has_hi = (EXT2_INODE_SIZE(fs->super) > EXT2_GOOD_OLD_INODE_SIZE &&
|
||||
|
|
|
@ -530,4 +530,16 @@ ec EXT2_ET_UNDO_FILE_CORRUPT,
|
|||
ec EXT2_ET_UNDO_FILE_WRONG,
|
||||
"Wrong undo file for this filesystem"
|
||||
|
||||
ec EXT2_ET_FILESYSTEM_CORRUPTED,
|
||||
"File system is corrupted"
|
||||
|
||||
ec EXT2_ET_BAD_CRC,
|
||||
"Bad CRC detected in file system"
|
||||
|
||||
ec EXT2_ET_CORRUPT_JOURNAL_SB,
|
||||
"The journal superblock is corrupt"
|
||||
|
||||
ec EXT2_ET_INODE_CORRUPTED,
|
||||
"Inode is corrupted"
|
||||
|
||||
end
|
||||
|
|
|
@ -519,6 +519,12 @@ struct ext2_inode_large {
|
|||
#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x))
|
||||
#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x))
|
||||
|
||||
static inline
|
||||
struct ext2_inode *EXT2_INODE(struct ext2_inode_large *large_inode)
|
||||
{
|
||||
return (struct ext2_inode *) large_inode;
|
||||
}
|
||||
|
||||
/*
|
||||
* File system states
|
||||
*/
|
||||
|
@ -596,6 +602,8 @@ struct ext2_inode_large {
|
|||
#define EXT4_MAX_SALT_SIZE 256
|
||||
#define EXT4_PBKDF2_ITERATIONS 0xFFFF
|
||||
|
||||
#define EXT2_LABEL_LEN 16
|
||||
|
||||
/*
|
||||
* Policy provided via an ioctl on the topmost directory. This
|
||||
* structure is also in the kernel.
|
||||
|
@ -663,7 +671,7 @@ struct ext2_super_block {
|
|||
__u32 s_feature_incompat; /* incompatible feature set */
|
||||
__u32 s_feature_ro_compat; /* readonly-compatible feature set */
|
||||
__u8 s_uuid[16]; /* 128-bit uuid for volume */
|
||||
char s_volume_name[16]; /* volume name */
|
||||
char s_volume_name[EXT2_LABEL_LEN]; /* volume name */
|
||||
char s_last_mounted[64]; /* directory where last mounted */
|
||||
__u32 s_algorithm_usage_bitmap; /* For compression */
|
||||
/*
|
||||
|
|
|
@ -138,12 +138,18 @@ extern errcode_t io_channel_cache_readahead(io_channel io,
|
|||
|
||||
/* unix_io.c */
|
||||
extern io_manager unix_io_manager;
|
||||
extern io_manager unixfd_io_manager;
|
||||
|
||||
/* undo_io.c */
|
||||
extern io_manager undo_io_manager;
|
||||
extern errcode_t set_undo_io_backing_manager(io_manager manager);
|
||||
extern errcode_t set_undo_io_backup_file(char *file_name);
|
||||
|
||||
/* patch_io.c */
|
||||
extern io_manager patch_io_manager;
|
||||
extern errcode_t set_patch_io_backing_manager(io_manager manager);
|
||||
extern errcode_t set_patch_io_patch_file(char *file_name);
|
||||
|
||||
/* test_io.c */
|
||||
extern io_manager test_io_manager, test_io_backing_manager;
|
||||
extern void (*test_io_cb_read_blk)
|
||||
|
|
|
@ -166,6 +166,8 @@ typedef long __s64;
|
|||
|
||||
#endif /* _*_TYPES_H */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* endian checking stuff */
|
||||
#ifndef EXT2_ENDIAN_H_
|
||||
#define EXT2_ENDIAN_H_
|
||||
|
|
|
@ -18,6 +18,12 @@
|
|||
#define EXT2FS_ATTR(x)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TDB
|
||||
#define EXT2FS_NO_TDB_UNUSED
|
||||
#else
|
||||
#define EXT2FS_NO_TDB_UNUSED EXT2FS_ATTR((unused))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -554,6 +554,10 @@ errcode_t ext2fs_xattrs_write(struct ext2_xattr_handle *handle)
|
|||
memset(p + EXT2_GOOD_OLD_INODE_SIZE, 0, extra);
|
||||
inode->i_extra_isize = extra;
|
||||
}
|
||||
if (inode->i_extra_isize & 3) {
|
||||
err = EXT2_ET_INODE_CORRUPTED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Force the inlinedata attr to the front and the empty entries
|
||||
|
@ -806,6 +810,10 @@ errcode_t ext2fs_xattrs_read(struct ext2_xattr_handle *handle)
|
|||
inode->i_extra_isize +
|
||||
sizeof(__u32))
|
||||
goto read_ea_block;
|
||||
if (inode->i_extra_isize & 3) {
|
||||
err = EXT2_ET_INODE_CORRUPTED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Look for EA in the inode */
|
||||
memcpy(&ea_inode_magic, ((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE +
|
||||
|
|
|
@ -57,8 +57,10 @@ struct ext2_icount {
|
|||
ext2_ino_t cursor;
|
||||
struct ext2_icount_el *list;
|
||||
struct ext2_icount_el *last_lookup;
|
||||
#ifdef CONFIG_TDB
|
||||
char *tdb_fn;
|
||||
TDB_CONTEXT *tdb;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -82,12 +84,14 @@ void ext2fs_free_icount(ext2_icount_t icount)
|
|||
ext2fs_free_inode_bitmap(icount->single);
|
||||
if (icount->multiple)
|
||||
ext2fs_free_inode_bitmap(icount->multiple);
|
||||
#ifdef CONFIG_TDB
|
||||
if (icount->tdb)
|
||||
tdb_close(icount->tdb);
|
||||
if (icount->tdb_fn) {
|
||||
unlink(icount->tdb_fn);
|
||||
free(icount->tdb_fn);
|
||||
}
|
||||
#endif
|
||||
|
||||
ext2fs_free_mem(&icount);
|
||||
}
|
||||
|
@ -127,6 +131,7 @@ errout:
|
|||
return(retval);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TDB
|
||||
struct uuid {
|
||||
__u32 time_low;
|
||||
__u16 time_mid;
|
||||
|
@ -173,10 +178,14 @@ static void uuid_unparse(void *uu, char *out)
|
|||
uuid.node[0], uuid.node[1], uuid.node[2],
|
||||
uuid.node[3], uuid.node[4], uuid.node[5]);
|
||||
}
|
||||
#endif
|
||||
|
||||
errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
|
||||
int flags, ext2_icount_t *ret)
|
||||
errcode_t ext2fs_create_icount_tdb(ext2_filsys fs EXT2FS_NO_TDB_UNUSED,
|
||||
char *tdb_dir EXT2FS_NO_TDB_UNUSED,
|
||||
int flags EXT2FS_NO_TDB_UNUSED,
|
||||
ext2_icount_t *ret EXT2FS_NO_TDB_UNUSED)
|
||||
{
|
||||
#ifdef CONFIG_TDB
|
||||
ext2_icount_t icount;
|
||||
errcode_t retval;
|
||||
char *fn, uuid[40];
|
||||
|
@ -224,6 +233,9 @@ errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
|
|||
errout:
|
||||
ext2fs_free_icount(icount);
|
||||
return(retval);
|
||||
#else
|
||||
return EXT2_ET_UNIMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size,
|
||||
|
@ -401,6 +413,7 @@ static errcode_t set_inode_count(ext2_icount_t icount, ext2_ino_t ino,
|
|||
__u32 count)
|
||||
{
|
||||
struct ext2_icount_el *el;
|
||||
#ifdef CONFIG_TDB
|
||||
TDB_DATA key, data;
|
||||
|
||||
if (icount->tdb) {
|
||||
|
@ -419,7 +432,7 @@ static errcode_t set_inode_count(ext2_icount_t icount, ext2_ino_t ino,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
el = get_icount_el(icount, ino, 1);
|
||||
if (!el)
|
||||
return EXT2_ET_NO_MEMORY;
|
||||
|
@ -432,6 +445,7 @@ static errcode_t get_inode_count(ext2_icount_t icount, ext2_ino_t ino,
|
|||
__u32 *count)
|
||||
{
|
||||
struct ext2_icount_el *el;
|
||||
#ifdef CONFIG_TDB
|
||||
TDB_DATA key, data;
|
||||
|
||||
if (icount->tdb) {
|
||||
|
@ -448,6 +462,7 @@ static errcode_t get_inode_count(ext2_icount_t icount, ext2_ino_t ino,
|
|||
free(data.dptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
el = get_icount_el(icount, ino, 0);
|
||||
if (!el) {
|
||||
*count = 0;
|
||||
|
@ -761,6 +776,7 @@ int run_test(int flags, int size, char *dir, struct test_program *prog)
|
|||
int problem = 0;
|
||||
|
||||
if (dir) {
|
||||
#ifdef CONFIG_TDB
|
||||
retval = ext2fs_create_icount_tdb(test_fs, dir,
|
||||
flags, &icount);
|
||||
if (retval) {
|
||||
|
@ -768,6 +784,10 @@ int run_test(int flags, int size, char *dir, struct test_program *prog)
|
|||
"while creating icount using tdb");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
printf("Skipped\n");
|
||||
return 0;
|
||||
#endif
|
||||
} else {
|
||||
retval = ext2fs_create_icount2(test_fs, flags, size, 0,
|
||||
&icount);
|
||||
|
|
|
@ -70,7 +70,7 @@ errcode_t ext2fs_get_memalign(unsigned long size,
|
|||
else
|
||||
#endif
|
||||
*p = malloc(size);
|
||||
if ((unsigned long) *p & (align - 1)) {
|
||||
if ((uintptr_t) *p & (align - 1)) {
|
||||
free(*p);
|
||||
*p = 0;
|
||||
}
|
||||
|
|
|
@ -102,19 +102,6 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
|
|||
|
||||
*mount_flags = 0;
|
||||
|
||||
if (getenv("EXT2FS_PRETEND_RO_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED | EXT2_MF_READONLY;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
if (getenv("EXT2FS_PRETEND_RW_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((f = setmntent (mtab_file, "r")) == NULL) {
|
||||
if (errno == ENOENT) {
|
||||
if (getenv("EXT2FS_NO_MTAB_OK"))
|
||||
|
@ -377,6 +364,19 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
|
|||
{
|
||||
errcode_t retval = 0;
|
||||
|
||||
if (getenv("EXT2FS_PRETEND_RO_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED | EXT2_MF_READONLY;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
if (getenv("EXT2FS_PRETEND_RW_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_swap_device(device)) {
|
||||
*mount_flags = EXT2_MF_MOUNTED | EXT2_MF_SWAP;
|
||||
strncpy(mtpt, "<swap>", mtlen);
|
||||
|
|
|
@ -274,7 +274,12 @@ typedef struct journal_superblock_s
|
|||
JFS_FEATURE_INCOMPAT_CSUM_V2|\
|
||||
JFS_FEATURE_INCOMPAT_CSUM_V3)
|
||||
|
||||
|
||||
#ifdef NO_INLINE_FUNCS
|
||||
extern size_t journal_tag_bytes(journal_t *journal);
|
||||
extern int journal_has_csum_v2or3(journal_t *journal);
|
||||
extern int tid_gt(tid_t x, tid_t y) EXT2FS_ATTR((unused));
|
||||
extern int tid_geq(tid_t x, tid_t y) EXT2FS_ATTR((unused));
|
||||
#endif
|
||||
|
||||
#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
|
||||
#ifdef E2FSCK_INCLUDE_INLINE_FUNCS
|
||||
|
@ -297,17 +302,20 @@ typedef struct journal_superblock_s
|
|||
|
||||
/* journal feature predicate functions */
|
||||
#define JFS_FEATURE_COMPAT_FUNCS(name, flagname) \
|
||||
_INLINE_ int jfs_has_feature_##name(journal_t *j); \
|
||||
_INLINE_ int jfs_has_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
return ((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_compat & \
|
||||
ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_##flagname)) != 0); \
|
||||
} \
|
||||
_INLINE_ void jfs_set_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jfs_set_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_compat |= \
|
||||
ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_##flagname); \
|
||||
} \
|
||||
_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_compat &= \
|
||||
|
@ -315,17 +323,20 @@ _INLINE_ void jfs_clear_feature_##name(journal_t *j) \
|
|||
}
|
||||
|
||||
#define JFS_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
|
||||
_INLINE_ int jfs_has_feature_##name(journal_t *j) \
|
||||
_INLINE_ int jfs_has_feature_##name(journal_t *j); \
|
||||
_INLINE_ int jfs_has_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
return ((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_ro_compat & \
|
||||
ext2fs_cpu_to_be32(JFS_FEATURE_RO_COMPAT_##flagname)) != 0); \
|
||||
} \
|
||||
_INLINE_ void jfs_set_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jfs_set_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_ro_compat |= \
|
||||
ext2fs_cpu_to_be32(JFS_FEATURE_RO_COMPAT_##flagname); \
|
||||
} \
|
||||
_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_ro_compat &= \
|
||||
|
@ -333,23 +344,44 @@ _INLINE_ void jfs_clear_feature_##name(journal_t *j) \
|
|||
}
|
||||
|
||||
#define JFS_FEATURE_INCOMPAT_FUNCS(name, flagname) \
|
||||
_INLINE_ int jfs_has_feature_##name(journal_t *j); \
|
||||
_INLINE_ int jfs_has_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
return ((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_incompat & \
|
||||
ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname)) != 0); \
|
||||
} \
|
||||
_INLINE_ void jfs_set_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jfs_set_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_incompat |= \
|
||||
ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname); \
|
||||
} \
|
||||
_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_incompat &= \
|
||||
~ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname); \
|
||||
}
|
||||
|
||||
#else
|
||||
#define JFS_FEATURE_COMPAT_FUNCS(name, flagname) \
|
||||
extern int jfs_has_feature_##name(journal_t *j); \
|
||||
extern void jfs_set_feature_##name(journal_t *j); \
|
||||
extern void jfs_clear_feature_##name(journal_t *j);
|
||||
|
||||
#define JFS_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
|
||||
extern int jfs_has_feature_##name(journal_t *j); \
|
||||
extern void jfs_set_feature_##name(journal_t *j); \
|
||||
extern void jfs_clear_feature_##name(journal_t *j);
|
||||
|
||||
#define JFS_FEATURE_INCOMPAT_FUNCS(name, flagname) \
|
||||
extern int jfs_has_feature_##name(journal_t *j); \
|
||||
extern void jfs_set_feature_##name(journal_t *j); \
|
||||
extern void jfs_clear_feature_##name(journal_t *j);
|
||||
|
||||
#endif /* (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) */
|
||||
|
||||
JFS_FEATURE_COMPAT_FUNCS(checksum, CHECKSUM)
|
||||
|
||||
JFS_FEATURE_INCOMPAT_FUNCS(revoke, REVOKE)
|
||||
|
@ -358,6 +390,7 @@ JFS_FEATURE_INCOMPAT_FUNCS(async_commit, ASYNC_COMMIT)
|
|||
JFS_FEATURE_INCOMPAT_FUNCS(csum2, CSUM_V2)
|
||||
JFS_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3)
|
||||
|
||||
#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
|
||||
/*
|
||||
* helper functions to deal with 32 or 64bit block numbers.
|
||||
*/
|
||||
|
@ -387,9 +420,6 @@ _INLINE_ int journal_has_csum_v2or3(journal_t *journal)
|
|||
return 0;
|
||||
}
|
||||
|
||||
_INLINE_ int tid_gt(tid_t x, tid_t y) EXT2FS_ATTR((unused));
|
||||
_INLINE_ int tid_geq(tid_t x, tid_t y) EXT2FS_ATTR((unused));
|
||||
|
||||
/* Comparison functions for transaction IDs: perform comparisons using
|
||||
* modulo arithmetic so that they work over sequence number wraps. */
|
||||
|
||||
|
@ -404,9 +434,9 @@ _INLINE_ int tid_geq(tid_t x, tid_t y)
|
|||
int difference = (x - y);
|
||||
return (difference >= 0);
|
||||
}
|
||||
#endif /* (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) */
|
||||
|
||||
#undef _INLINE_
|
||||
#endif
|
||||
|
||||
extern int journal_blocks_per_page(struct inode *inode);
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@ errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num,
|
|||
if (buf) {
|
||||
free(buf);
|
||||
buf = 0;
|
||||
stride_length = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -333,20 +334,28 @@ out2:
|
|||
* Find a reasonable journal file size (in blocks) given the number of blocks
|
||||
* in the filesystem. For very small filesystems, it is not reasonable to
|
||||
* have a journal that fills more than half of the filesystem.
|
||||
*
|
||||
* n.b. comments assume 4k blocks
|
||||
*/
|
||||
int ext2fs_default_journal_size(__u64 num_blocks)
|
||||
{
|
||||
if (num_blocks < 2048)
|
||||
return -1;
|
||||
if (num_blocks < 32768)
|
||||
return (1024);
|
||||
if (num_blocks < 256*1024)
|
||||
return (4096);
|
||||
if (num_blocks < 512*1024)
|
||||
return (8192);
|
||||
if (num_blocks < 1024*1024)
|
||||
return (16384);
|
||||
return 32768;
|
||||
if (num_blocks < 32768) /* 128 MB */
|
||||
return (1024); /* 4 MB */
|
||||
if (num_blocks < 256*1024) /* 1 GB */
|
||||
return (4096); /* 16 MB */
|
||||
if (num_blocks < 512*1024) /* 2 GB */
|
||||
return (8192); /* 32 MB */
|
||||
if (num_blocks < 4096*1024) /* 16 GB */
|
||||
return (16384); /* 64 MB */
|
||||
if (num_blocks < 8192*1024) /* 32 GB */
|
||||
return (32768); /* 128 MB */
|
||||
if (num_blocks < 16384*1024) /* 64 GB */
|
||||
return (65536); /* 256 MB */
|
||||
if (num_blocks < 32768*1024) /* 128 GB */
|
||||
return (131072); /* 512 MB */
|
||||
return 262144; /* 1 GB */
|
||||
}
|
||||
|
||||
int ext2fs_journal_sb_start(int blocksize)
|
||||
|
|
|
@ -0,0 +1,228 @@
|
|||
/**
|
||||
* patch.c --- Common "patch" file functions
|
||||
*
|
||||
* Copyright (c) Vitaliy Filippov <vitalif@mail.ru> 2014
|
||||
* License: GNU GPLv2 or later
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "patch.h"
|
||||
|
||||
errcode_t ext2fs_patch_retry_read(int fd, ssize_t size, void *buf)
|
||||
{
|
||||
ssize_t r, done = 0;
|
||||
while (done < size)
|
||||
{
|
||||
r = read(fd, buf+done, size-done);
|
||||
if (!r || (r < 0 && errno != EAGAIN))
|
||||
break;
|
||||
done += r;
|
||||
}
|
||||
if (done < size)
|
||||
return errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_retry_write(int fd, ssize_t size, const void *buf)
|
||||
{
|
||||
ssize_t r, done = 0;
|
||||
while (done < size)
|
||||
{
|
||||
r = write(fd, buf+done, size-done);
|
||||
if (r <= 0 && errno != EAGAIN)
|
||||
break;
|
||||
done += r;
|
||||
}
|
||||
if (done < size)
|
||||
return errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_retry_read_at(int fd, unsigned long long offset, ssize_t size, void *buf)
|
||||
{
|
||||
if ((unsigned long long)ext2fs_llseek(fd, offset, SEEK_SET) != offset)
|
||||
return errno ? errno : EXT2_ET_LLSEEK_FAILED;
|
||||
return ext2fs_patch_retry_read(fd, size, buf);
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_retry_write_at(int fd, unsigned long long offset, ssize_t size, const void *buf)
|
||||
{
|
||||
if ((unsigned long long)ext2fs_llseek(fd, offset, SEEK_SET) != offset)
|
||||
return errno ? errno : EXT2_ET_LLSEEK_FAILED;
|
||||
return ext2fs_patch_retry_write(fd, size, buf);
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_read_bmap(struct ext2fs_patch_file *data)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
int bufsize = 65536;
|
||||
blk64_t i, r;
|
||||
void *buf = malloc(bufsize);
|
||||
if (!buf)
|
||||
return ENOMEM;
|
||||
ext2fs_llseek(data->patch_fd, data->block_size, SEEK_SET);
|
||||
for (i = 0; i < data->size/8; )
|
||||
{
|
||||
r = bufsize;
|
||||
if (data->size/8 - i < r)
|
||||
r = data->size/8 - i;
|
||||
retval = ext2fs_patch_retry_read(data->patch_fd, r, buf);
|
||||
if (retval)
|
||||
goto out;
|
||||
ext2fs_set_generic_bmap_range(data->bmap, i*8, r*8, buf);
|
||||
i += r;
|
||||
}
|
||||
out:
|
||||
free(buf);
|
||||
return retval;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_write_bmap(struct ext2fs_patch_file *data)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
int bufsize = 65536;
|
||||
blk64_t i, r;
|
||||
struct patchbd_super s;
|
||||
void *buf = malloc(bufsize);
|
||||
if (!buf)
|
||||
return ENOMEM;
|
||||
ext2fs_llseek(data->patch_fd, data->block_size, SEEK_SET);
|
||||
for (i = 0; i < data->size/8; )
|
||||
{
|
||||
r = bufsize;
|
||||
if (data->size/8 - i < r)
|
||||
r = data->size/8 - i;
|
||||
ext2fs_get_generic_bmap_range(data->bmap, i*8, r*8, buf);
|
||||
retval = ext2fs_patch_retry_write(data->patch_fd, r, buf);
|
||||
if (retval)
|
||||
goto out;
|
||||
i += r;
|
||||
}
|
||||
ext2fs_llseek(data->patch_fd, 0, SEEK_SET);
|
||||
s.magic = PATCHBD_MAGIC;
|
||||
s.patch_block = data->block_size;
|
||||
s.patch_size = data->size;
|
||||
write(data->patch_fd, &s, sizeof(struct patchbd_super));
|
||||
out:
|
||||
free(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_open(struct ext2fs_patch_file *data, char *patch_file, int flags)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
ext2_loff_t size;
|
||||
struct patchbd_super s;
|
||||
data->block_size = 0;
|
||||
data->size = 0;
|
||||
data->offset = 0;
|
||||
data->bmap = NULL;
|
||||
data->patch_file = strdup(patch_file);
|
||||
data->patch_fd = open(data->patch_file, flags|O_RDWR, 0666);
|
||||
if (data->patch_fd < 0)
|
||||
return errno;
|
||||
size = ext2fs_llseek(data->patch_fd, 0, SEEK_END);
|
||||
if (size < 0)
|
||||
return errno;
|
||||
if (size > 0)
|
||||
{
|
||||
size = ext2fs_llseek(data->patch_fd, 0, SEEK_SET);
|
||||
read(data->patch_fd, &s, sizeof(struct patchbd_super));
|
||||
if (s.magic != PATCHBD_MAGIC)
|
||||
return 0;
|
||||
data->block_size = s.patch_block;
|
||||
// if (data->block_size != 4096)
|
||||
// return EINVAL;
|
||||
data->size = s.patch_size;
|
||||
retval = ext2fs_patch_init_bmap(data, NULL);
|
||||
if (retval)
|
||||
return retval;
|
||||
retval = ext2fs_patch_read_bmap(data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_close(struct ext2fs_patch_file *data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
if (data->bmap)
|
||||
{
|
||||
if (data->patch_fd >= 0)
|
||||
ext2fs_patch_write_bmap(data);
|
||||
ext2fs_free_generic_bmap(data->bmap);
|
||||
data->bmap = NULL;
|
||||
}
|
||||
if (data->patch_fd >= 0)
|
||||
{
|
||||
close(data->patch_fd);
|
||||
data->patch_fd = -1;
|
||||
}
|
||||
if (data->patch_file)
|
||||
{
|
||||
free(data->patch_file);
|
||||
data->patch_file = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_init_bmap(struct ext2fs_patch_file *data, io_channel channel)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
if (!data->bmap)
|
||||
{
|
||||
if (channel)
|
||||
{
|
||||
// channel is optional parameter, if passed, means 'take size from channel'
|
||||
data->block_size = channel->block_size;
|
||||
// if (data->block_size != 4096)
|
||||
// return EINVAL;
|
||||
retval = ext2fs_get_device_size2(channel->name, data->block_size, &data->size);
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
else if (!data->block_size || !data->size)
|
||||
return EINVAL;
|
||||
retval = ext2fs_make_generic_bitmap(EXT2_ET_MAGIC_BLOCK_BITMAP, NULL,
|
||||
0, data->size, data->size, "overwritten blocks", 0, &data->bmap);
|
||||
data->offset = data->block_size + ((((data->size+7)>>3)+(data->block_size-1))&~(data->block_size-1));
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_patch_write_blk64(struct ext2fs_patch_file *data, unsigned long long block, int count, const void *buf)
|
||||
{
|
||||
ssize_t size;
|
||||
if (!data->bmap)
|
||||
return EINVAL;
|
||||
if (count < 0)
|
||||
{
|
||||
if ((unsigned)-count > data->block_size)
|
||||
return EINVAL;
|
||||
size = -count;
|
||||
count = 1;
|
||||
}
|
||||
else
|
||||
size = count*data->block_size;
|
||||
ext2fs_mark_block_bitmap_range2(data->bmap, block, count);
|
||||
return ext2fs_patch_retry_write_at(data->patch_fd, data->offset + block*data->block_size, size, buf);
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* patch.h --- Common "patch" file functions
|
||||
*
|
||||
* Patch file format:
|
||||
* 1) sparse data blocks - same size as the patched filesystem, but only changed blocks are written
|
||||
* 2) updated block bitmap - fs_size/block_size/8 bytes
|
||||
* 3) 4 byte FS block size
|
||||
* 4) 8 byte FS size in blocks
|
||||
*
|
||||
* Copyright (c) Vitaliy Filippov <vitalif@mail.ru> 2014
|
||||
* License: GNU GPLv2 or later
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef E2_PATCH_H
|
||||
#define E2_PATCH_H
|
||||
|
||||
#include "ext2_fs.h"
|
||||
#include "ext2fs.h"
|
||||
|
||||
#define PATCHBD_MAGIC 0x44623950 // P9bD
|
||||
|
||||
struct ext2fs_patch_file
|
||||
{
|
||||
char *patch_file;
|
||||
int patch_fd;
|
||||
__u32 block_size;
|
||||
blk64_t size;
|
||||
ext2_loff_t offset;
|
||||
ext2fs_generic_bitmap bmap;
|
||||
};
|
||||
|
||||
struct patchbd_super
|
||||
{
|
||||
__u32 magic;
|
||||
__u32 patch_block;
|
||||
__u64 patch_size;
|
||||
};
|
||||
|
||||
errcode_t ext2fs_patch_retry_read(int fd, ssize_t size, void *buf);
|
||||
errcode_t ext2fs_patch_retry_write(int fd, ssize_t size, const void *buf);
|
||||
errcode_t ext2fs_patch_retry_read_at(int fd, unsigned long long offset, ssize_t size, void *buf);
|
||||
errcode_t ext2fs_patch_retry_write_at(int fd, unsigned long long offset, ssize_t size, const void *buf);
|
||||
errcode_t ext2fs_patch_read_bmap(struct ext2fs_patch_file *data);
|
||||
errcode_t ext2fs_patch_write_bmap(struct ext2fs_patch_file *data);
|
||||
errcode_t ext2fs_patch_open(struct ext2fs_patch_file *data, char *patch_file, int flags);
|
||||
errcode_t ext2fs_patch_close(struct ext2fs_patch_file *data);
|
||||
errcode_t ext2fs_patch_init_bmap(struct ext2fs_patch_file *data, io_channel channel);
|
||||
errcode_t ext2fs_patch_write_blk64(struct ext2fs_patch_file *data, unsigned long long block, int count, const void *buf);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,375 @@
|
|||
/*
|
||||
* patch_io.c --- This is the "patch" io manager that writes the new data into
|
||||
* a separate sparse file to apply it later.
|
||||
*
|
||||
* Copyright (c) Vitaliy Filippov <vitalif@mail.ru> 2014
|
||||
* License: GNU GPLv2 or later
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "ext2_fs.h"
|
||||
#include "ext2fs.h"
|
||||
|
||||
#include "patch.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define ATTR(x) __attribute__(x)
|
||||
#else
|
||||
#define ATTR(x)
|
||||
#endif
|
||||
|
||||
#define EXT2_CHECK_MAGIC(struct, code) if ((struct)->magic != (code)) return (code)
|
||||
|
||||
struct patch_private_data
|
||||
{
|
||||
int magic;
|
||||
struct ext2fs_patch_file patch;
|
||||
/* The backing io channel */
|
||||
io_channel real;
|
||||
/* to support offset in unix I/O manager */
|
||||
ext2_loff_t offset;
|
||||
};
|
||||
|
||||
static errcode_t patch_open(const char *name, int flags, io_channel *channel);
|
||||
static errcode_t patch_close(io_channel channel);
|
||||
static errcode_t patch_set_blksize(io_channel channel, int blksize);
|
||||
static errcode_t patch_read_blk64(io_channel channel, unsigned long long block, int count, void *data);
|
||||
static errcode_t patch_write_blk64(io_channel channel, unsigned long long block, int count, const void *data);
|
||||
static errcode_t patch_read_blk(io_channel channel, unsigned long block, int count, void *data);
|
||||
static errcode_t patch_write_blk(io_channel channel, unsigned long block, int count, const void *data);
|
||||
static errcode_t patch_flush(io_channel channel);
|
||||
static errcode_t patch_write_byte(io_channel channel, unsigned long offset, int size, const void *data);
|
||||
static errcode_t patch_set_option(io_channel channel, const char *option, const char *arg);
|
||||
static errcode_t patch_get_stats(io_channel channel, io_stats *stats);
|
||||
|
||||
static struct struct_io_manager struct_patch_manager = {
|
||||
EXT2_ET_MAGIC_IO_MANAGER,
|
||||
"Patch I/O Manager",
|
||||
patch_open,
|
||||
patch_close,
|
||||
patch_set_blksize,
|
||||
patch_read_blk,
|
||||
patch_write_blk,
|
||||
patch_flush,
|
||||
patch_write_byte,
|
||||
patch_set_option,
|
||||
patch_get_stats,
|
||||
patch_read_blk64,
|
||||
patch_write_blk64,
|
||||
};
|
||||
|
||||
io_manager patch_io_manager = &struct_patch_manager;
|
||||
static char *patch_file;
|
||||
static io_manager patch_io_backing_manager;
|
||||
|
||||
errcode_t set_patch_io_backing_manager(io_manager manager)
|
||||
{
|
||||
patch_io_backing_manager = manager;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errcode_t set_patch_io_patch_file(char *file)
|
||||
{
|
||||
patch_file = file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static errcode_t patch_open(const char *name, int flags, io_channel *channel)
|
||||
{
|
||||
io_channel io = NULL;
|
||||
struct patch_private_data *data = NULL;
|
||||
errcode_t retval;
|
||||
|
||||
if (name == 0)
|
||||
return EXT2_ET_BAD_DEVICE_NAME;
|
||||
retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
memset(io, 0, sizeof(struct struct_io_channel));
|
||||
io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
|
||||
retval = ext2fs_get_mem(sizeof(struct patch_private_data), &data);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
|
||||
io->manager = patch_io_manager;
|
||||
retval = ext2fs_get_mem(strlen(name)+1, &io->name);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
|
||||
strcpy(io->name, name);
|
||||
io->private_data = data;
|
||||
io->block_size = 1024;
|
||||
io->read_error = 0;
|
||||
io->write_error = 0;
|
||||
io->refcount = 1;
|
||||
|
||||
memset(data, 0, sizeof(struct patch_private_data));
|
||||
data->magic = EXT2_ET_MAGIC_UNIX_IO_CHANNEL;
|
||||
|
||||
if (patch_io_backing_manager)
|
||||
{
|
||||
retval = patch_io_backing_manager->open(name, flags & ~IO_FLAG_RW, &data->real);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (patch_file)
|
||||
{
|
||||
retval = ext2fs_patch_open(&data->patch, patch_file, O_CREAT);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
if (data->patch.block_size)
|
||||
{
|
||||
retval = io_channel_set_blksize(data->real, data->patch.block_size);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
*channel = io;
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
if (data)
|
||||
{
|
||||
ext2fs_patch_close(&data->patch);
|
||||
if (data->real)
|
||||
io_channel_close(data->real);
|
||||
ext2fs_free_mem(&data);
|
||||
}
|
||||
if (io)
|
||||
{
|
||||
if (io->name)
|
||||
ext2fs_free_mem(&io->name);
|
||||
ext2fs_free_mem(&io);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t patch_close(io_channel channel)
|
||||
{
|
||||
struct patch_private_data *data;
|
||||
errcode_t retval = 0;
|
||||
|
||||
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
|
||||
data = (struct patch_private_data *) channel->private_data;
|
||||
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
|
||||
|
||||
if (--channel->refcount > 0)
|
||||
return 0;
|
||||
|
||||
ext2fs_patch_close(&data->patch);
|
||||
if (data->real)
|
||||
retval = io_channel_close(data->real);
|
||||
ext2fs_free_mem(&channel->private_data);
|
||||
if (channel->name)
|
||||
ext2fs_free_mem(&channel->name);
|
||||
ext2fs_free_mem(&channel);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t patch_set_blksize(io_channel channel, int blksize)
|
||||
{
|
||||
struct patch_private_data *data;
|
||||
errcode_t retval = 0;
|
||||
|
||||
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
|
||||
data = (struct patch_private_data *) channel->private_data;
|
||||
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
|
||||
|
||||
channel->block_size = (unsigned)blksize;
|
||||
if (data->patch.block_size && data->patch.block_size != (unsigned)blksize)
|
||||
return EINVAL;
|
||||
if (data->real)
|
||||
retval = io_channel_set_blksize(data->real, blksize);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t patch_read_blk64(io_channel channel, unsigned long long block, int count, void *buf)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
struct patch_private_data *data;
|
||||
int b, n;
|
||||
|
||||
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
|
||||
data = (struct patch_private_data *) channel->private_data;
|
||||
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
if (-count <= channel->block_size)
|
||||
{
|
||||
if (data->patch.bmap && ext2fs_test_generic_bitmap(data->patch.bmap, block))
|
||||
retval = ext2fs_patch_retry_read_at(data->patch.patch_fd, data->patch.offset + block*channel->block_size, -count, buf);
|
||||
else
|
||||
retval = io_channel_read_blk64(data->real, block, count, buf);
|
||||
return retval;
|
||||
}
|
||||
else
|
||||
return EINVAL;
|
||||
}
|
||||
for (b = 0; b < count; )
|
||||
{
|
||||
for (n = 0; (b+n < count) && data->patch.bmap && ext2fs_test_generic_bitmap(data->patch.bmap, block+b+n); n++) {}
|
||||
if (n > 0)
|
||||
{
|
||||
retval = ext2fs_patch_retry_read_at(data->patch.patch_fd, data->patch.offset + (block+b)*channel->block_size, n*channel->block_size, buf+b*channel->block_size);
|
||||
if (retval)
|
||||
break;
|
||||
b += n;
|
||||
}
|
||||
for (n = 0; (b+n < count) && (!data->patch.bmap || !ext2fs_test_generic_bitmap(data->patch.bmap, block+b+n)); n++) {}
|
||||
if (n > 0)
|
||||
{
|
||||
retval = io_channel_read_blk64(data->real, block+b, n, buf+b*channel->block_size);
|
||||
if (retval)
|
||||
break;
|
||||
b += n;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t patch_read_blk(io_channel channel, unsigned long block, int count, void *buf)
|
||||
{
|
||||
return patch_read_blk64(channel, block, count, buf);
|
||||
}
|
||||
|
||||
static errcode_t patch_write_blk64(io_channel channel, unsigned long long block, int count, const void *buf)
|
||||
{
|
||||
struct patch_private_data *data;
|
||||
errcode_t retval = 0;
|
||||
|
||||
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
|
||||
data = (struct patch_private_data *) channel->private_data;
|
||||
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
|
||||
|
||||
retval = ext2fs_patch_init_bmap(&data->patch, channel);
|
||||
if (retval)
|
||||
return retval;
|
||||
// libext2fs changes block size to 1024 in order to write the superblock, so we must support it...
|
||||
if ((__u32)channel->block_size < data->patch.block_size)
|
||||
{
|
||||
void *buf2 = NULL;
|
||||
unsigned long long block_real = block / (data->patch.block_size / channel->block_size);
|
||||
int count_real = ( (block % (data->patch.block_size / channel->block_size))
|
||||
+ (count > 0 ? count*channel->block_size : -count)
|
||||
+ data->patch.block_size - 1 ) / data->patch.block_size;
|
||||
retval = ext2fs_get_mem(count_real * data->patch.block_size, &buf2);
|
||||
if (retval)
|
||||
goto out;
|
||||
retval = patch_read_blk64(channel, block_real, count_real, buf2);
|
||||
if (retval)
|
||||
goto out;
|
||||
memcpy(buf2 + (block % (data->patch.block_size / channel->block_size)) * channel->block_size,
|
||||
buf, (count > 0 ? count*channel->block_size : -count));
|
||||
retval = ext2fs_patch_write_blk64(&data->patch, block_real, count_real, buf2);
|
||||
out:
|
||||
if (buf2)
|
||||
ext2fs_free_mem(&buf2);
|
||||
return retval;
|
||||
}
|
||||
else if ((__u32)channel->block_size > data->patch.block_size)
|
||||
{
|
||||
return EXT2_ET_UNIMPLEMENTED;
|
||||
}
|
||||
return ext2fs_patch_write_blk64(&data->patch, block, count, buf);
|
||||
}
|
||||
|
||||
static errcode_t patch_write_blk(io_channel channel, unsigned long block, int count, const void *buf)
|
||||
{
|
||||
return patch_write_blk64(channel, block, count, buf);
|
||||
}
|
||||
|
||||
static errcode_t patch_write_byte(io_channel channel, unsigned long offset, int size, const void *buf)
|
||||
{
|
||||
return EXT2_ET_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush data buffers to disk.
|
||||
*/
|
||||
static errcode_t patch_flush(io_channel channel)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
struct patch_private_data *data;
|
||||
|
||||
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
|
||||
data = (struct patch_private_data *) channel->private_data;
|
||||
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
|
||||
|
||||
if (data->real)
|
||||
retval = io_channel_flush(data->real);
|
||||
if (data->patch.patch_fd)
|
||||
fsync(data->patch.patch_fd);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t patch_set_option(io_channel channel, const char *option, const char *arg)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
struct patch_private_data *data;
|
||||
unsigned long tmp;
|
||||
char *end;
|
||||
|
||||
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
|
||||
data = (struct patch_private_data *) channel->private_data;
|
||||
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
|
||||
|
||||
/*
|
||||
* Need to support offset option to work with
|
||||
* Unix I/O manager
|
||||
*/
|
||||
if (data->real && data->real->manager->set_option)
|
||||
retval = data->real->manager->set_option(data->real, option, arg);
|
||||
if (!retval && !strcmp(option, "offset"))
|
||||
{
|
||||
if (!arg)
|
||||
return EXT2_ET_INVALID_ARGUMENT;
|
||||
|
||||
tmp = strtoul(arg, &end, 0);
|
||||
if (*end)
|
||||
return EXT2_ET_INVALID_ARGUMENT;
|
||||
data->offset = tmp;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t patch_get_stats(io_channel channel, io_stats *stats)
|
||||
{
|
||||
errcode_t retval = 0;
|
||||
struct patch_private_data *data;
|
||||
|
||||
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
|
||||
data = (struct patch_private_data *) channel->private_data;
|
||||
EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
|
||||
|
||||
if (data->real)
|
||||
retval = (data->real->manager->get_stats)(data->real, stats);
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -95,6 +95,7 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
|
|||
#define _LINUX_RBTREE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#undef offsetof
|
||||
#ifdef __compiler_offsetof
|
||||
|
@ -109,7 +110,7 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
|
|||
|
||||
struct rb_node
|
||||
{
|
||||
unsigned long rb_parent_color;
|
||||
uintptr_t rb_parent_color;
|
||||
#define RB_RED 0
|
||||
#define RB_BLACK 1
|
||||
struct rb_node *rb_right;
|
||||
|
@ -132,7 +133,7 @@ struct rb_root
|
|||
|
||||
static inline void ext2fs_rb_set_parent(struct rb_node *rb, struct rb_node *p)
|
||||
{
|
||||
rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
|
||||
rb->rb_parent_color = (rb->rb_parent_color & 3) | (uintptr_t)p;
|
||||
}
|
||||
static inline void ext2fs_rb_set_color(struct rb_node *rb, int color)
|
||||
{
|
||||
|
@ -182,7 +183,7 @@ static inline void ext2fs_rb_link_node(struct rb_node * node,
|
|||
struct rb_node * parent,
|
||||
struct rb_node ** rb_link)
|
||||
{
|
||||
node->rb_parent_color = (unsigned long )parent;
|
||||
node->rb_parent_color = (uintptr_t)parent;
|
||||
node->rb_left = node->rb_right = NULL;
|
||||
|
||||
*rb_link = node;
|
||||
|
|
|
@ -307,6 +307,8 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
|
|||
/* this is error case: i_extra_size is too large */
|
||||
return;
|
||||
}
|
||||
if (extra_isize & 3)
|
||||
return; /* Illegal inode extra_isize */
|
||||
|
||||
inode_size = EXT2_GOOD_OLD_INODE_SIZE + extra_isize;
|
||||
if (inode_includes(inode_size, i_checksum_hi))
|
||||
|
|
|
@ -154,11 +154,11 @@ struct undo_private_data {
|
|||
#define E2UNDO_FEATURE_COMPAT_FS_OFFSET 0x1 /* the filesystem offset */
|
||||
|
||||
static inline void e2undo_set_feature_fs_offset(struct undo_header *header) {
|
||||
header->f_compat |= E2UNDO_FEATURE_COMPAT_FS_OFFSET;
|
||||
header->f_compat |= ext2fs_le32_to_cpu(E2UNDO_FEATURE_COMPAT_FS_OFFSET);
|
||||
}
|
||||
|
||||
static inline void e2undo_clear_feature_fs_offset(struct undo_header *header) {
|
||||
header->f_compat &= ~E2UNDO_FEATURE_COMPAT_FS_OFFSET;
|
||||
header->f_compat &= ~ext2fs_le32_to_cpu(E2UNDO_FEATURE_COMPAT_FS_OFFSET);
|
||||
}
|
||||
|
||||
static io_manager undo_io_backing_manager;
|
||||
|
@ -419,7 +419,7 @@ static errcode_t undo_write_tdb(io_channel channel,
|
|||
block_num++;
|
||||
continue;
|
||||
}
|
||||
dbg_printf("Read %llu bytes from FS block %llu (blk=%llu cnt=%u)\n",
|
||||
dbg_printf("Read %llu bytes from FS block %llu (blk=%llu cnt=%llu)\n",
|
||||
data_size, backing_blk_num, block, data->tdb_data_size);
|
||||
if ((data_size % data->undo_file->block_size) == 0)
|
||||
sz = data_size / data->undo_file->block_size;
|
||||
|
|
|
@ -103,8 +103,8 @@ struct unix_private_data {
|
|||
struct struct_io_stats io_stats;
|
||||
};
|
||||
|
||||
#define IS_ALIGNED(n, align) ((((unsigned long) n) & \
|
||||
((unsigned long) ((align)-1))) == 0)
|
||||
#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
|
||||
((uintptr_t) ((align)-1))) == 0)
|
||||
|
||||
static errcode_t unix_get_stats(io_channel channel, io_stats *stats)
|
||||
{
|
||||
|
@ -291,11 +291,16 @@ static errcode_t raw_write_blk(io_channel channel,
|
|||
if (size > channel->block_size)
|
||||
actual = channel->block_size;
|
||||
memcpy(data->bounce, buf, actual);
|
||||
if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
|
||||
retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
|
||||
goto error_out;
|
||||
}
|
||||
actual = write(data->dev, data->bounce, channel->block_size);
|
||||
if (actual != channel->block_size)
|
||||
goto short_write;
|
||||
size -= actual;
|
||||
buf += actual;
|
||||
location += actual;
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
@ -478,20 +483,19 @@ int ext2fs_fstat(int fd, ext2fs_struct_stat *buf)
|
|||
#endif
|
||||
}
|
||||
|
||||
static errcode_t unix_open(const char *name, int flags, io_channel *channel)
|
||||
|
||||
static errcode_t unix_open_channel(const char *name, int fd,
|
||||
int flags, io_channel *channel,
|
||||
io_manager io_mgr)
|
||||
{
|
||||
io_channel io = NULL;
|
||||
struct unix_private_data *data = NULL;
|
||||
errcode_t retval;
|
||||
int open_flags;
|
||||
int f_nocache = 0;
|
||||
ext2fs_struct_stat st;
|
||||
#ifdef __linux__
|
||||
struct utsname ut;
|
||||
#endif
|
||||
|
||||
if (name == 0)
|
||||
return EXT2_ET_BAD_DEVICE_NAME;
|
||||
retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
|
@ -501,7 +505,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
|
|||
if (retval)
|
||||
goto cleanup;
|
||||
|
||||
io->manager = unix_io_manager;
|
||||
io->manager = io_mgr;
|
||||
retval = ext2fs_get_mem(strlen(name)+1, &io->name);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
|
@ -516,35 +520,16 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
|
|||
memset(data, 0, sizeof(struct unix_private_data));
|
||||
data->magic = EXT2_ET_MAGIC_UNIX_IO_CHANNEL;
|
||||
data->io_stats.num_fields = 2;
|
||||
data->dev = -1;
|
||||
|
||||
open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
|
||||
if (flags & IO_FLAG_EXCLUSIVE)
|
||||
open_flags |= O_EXCL;
|
||||
#if defined(O_DIRECT)
|
||||
if (flags & IO_FLAG_DIRECT_IO) {
|
||||
open_flags |= O_DIRECT;
|
||||
io->align = ext2fs_get_dio_alignment(data->dev);
|
||||
}
|
||||
#elif defined(F_NOCACHE)
|
||||
if (flags & IO_FLAG_DIRECT_IO) {
|
||||
f_nocache = F_NOCACHE;
|
||||
io->align = 4096;
|
||||
}
|
||||
#endif
|
||||
data->flags = flags;
|
||||
data->dev = fd;
|
||||
|
||||
data->dev = ext2fs_open_file(io->name, open_flags, 0);
|
||||
if (data->dev < 0) {
|
||||
retval = errno;
|
||||
goto cleanup;
|
||||
}
|
||||
if (f_nocache) {
|
||||
if (fcntl(data->dev, f_nocache, 1) < 0) {
|
||||
retval = errno;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
#if defined(O_DIRECT)
|
||||
if (flags & IO_FLAG_DIRECT_IO)
|
||||
io->align = ext2fs_get_dio_alignment(data->dev);
|
||||
#elif defined(F_NOCACHE)
|
||||
if (flags & IO_FLAG_DIRECT_IO)
|
||||
io->align = 4096;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the device is really a block device, then set the
|
||||
|
@ -553,7 +538,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
|
|||
* and if it succeed, subsequent read from sparse area returns
|
||||
* zero.
|
||||
*/
|
||||
if (ext2fs_stat(io->name, &st) == 0) {
|
||||
if (ext2fs_fstat(data->dev, &st) == 0) {
|
||||
if (S_ISBLK(st.st_mode))
|
||||
io->flags |= CHANNEL_FLAGS_BLOCK_DEVICE;
|
||||
else
|
||||
|
@ -616,7 +601,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
|
|||
(ut.release[2] == '4') && (ut.release[3] == '.') &&
|
||||
(ut.release[4] == '1') && (ut.release[5] >= '0') &&
|
||||
(ut.release[5] < '8')) &&
|
||||
(ext2fs_stat(io->name, &st) == 0) &&
|
||||
(ext2fs_fstat(data->dev, &st) == 0) &&
|
||||
(S_ISBLK(st.st_mode))) {
|
||||
struct rlimit rlim;
|
||||
|
||||
|
@ -649,6 +634,58 @@ cleanup:
|
|||
return retval;
|
||||
}
|
||||
|
||||
static errcode_t unixfd_open(const char *str_fd, int flags,
|
||||
io_channel *channel)
|
||||
{
|
||||
int fd;
|
||||
int fd_flags;
|
||||
|
||||
fd = atoi(str_fd);
|
||||
fd_flags = fcntl(fd, F_GETFD);
|
||||
if (fd_flags == -1)
|
||||
return -EBADF;
|
||||
|
||||
flags = 0;
|
||||
if (fd_flags & O_RDWR)
|
||||
flags |= IO_FLAG_RW;
|
||||
if (fd_flags & O_EXCL)
|
||||
flags |= IO_FLAG_EXCLUSIVE;
|
||||
#if defined(O_DIRECT)
|
||||
if (fd_flags & O_DIRECT)
|
||||
flags |= IO_FLAG_DIRECT_IO;
|
||||
#endif
|
||||
|
||||
return unix_open_channel(str_fd, fd, flags, channel, unixfd_io_manager);
|
||||
}
|
||||
|
||||
static errcode_t unix_open(const char *name, int flags,
|
||||
io_channel *channel)
|
||||
{
|
||||
int fd = -1;
|
||||
int open_flags;
|
||||
|
||||
if (name == 0)
|
||||
return EXT2_ET_BAD_DEVICE_NAME;
|
||||
|
||||
open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
|
||||
if (flags & IO_FLAG_EXCLUSIVE)
|
||||
open_flags |= O_EXCL;
|
||||
#if defined(O_DIRECT)
|
||||
if (flags & IO_FLAG_DIRECT_IO)
|
||||
open_flags |= O_DIRECT;
|
||||
#endif
|
||||
fd = ext2fs_open_file(name, open_flags, 0);
|
||||
if (fd < 0)
|
||||
return errno;
|
||||
#if defined(F_NOCACHE) && !defined(IO_DIRECT)
|
||||
if (flags & IO_FLAG_DIRECT_IO) {
|
||||
if (fcntl(fd, F_NOCACHE, 1) < 0)
|
||||
return errno;
|
||||
}
|
||||
#endif
|
||||
return unix_open_channel(name, fd, flags, channel, unix_io_manager);
|
||||
}
|
||||
|
||||
static errcode_t unix_close(io_channel channel)
|
||||
{
|
||||
struct unix_private_data *data;
|
||||
|
@ -699,7 +736,6 @@ static errcode_t unix_set_blksize(io_channel channel, int blksize)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static errcode_t unix_read_blk64(io_channel channel, unsigned long long block,
|
||||
int count, void *buf)
|
||||
{
|
||||
|
@ -1085,3 +1121,24 @@ static struct struct_io_manager struct_unix_manager = {
|
|||
};
|
||||
|
||||
io_manager unix_io_manager = &struct_unix_manager;
|
||||
|
||||
static struct struct_io_manager struct_unixfd_manager = {
|
||||
.magic = EXT2_ET_MAGIC_IO_MANAGER,
|
||||
.name = "Unix fd I/O Manager",
|
||||
.open = unixfd_open,
|
||||
.close = unix_close,
|
||||
.set_blksize = unix_set_blksize,
|
||||
.read_blk = unix_read_blk,
|
||||
.write_blk = unix_write_blk,
|
||||
.flush = unix_flush,
|
||||
.write_byte = unix_write_byte,
|
||||
.set_option = unix_set_option,
|
||||
.get_stats = unix_get_stats,
|
||||
.read_blk64 = unix_read_blk64,
|
||||
.write_blk64 = unix_write_blk64,
|
||||
.discard = unix_discard,
|
||||
.cache_readahead = unix_cache_readahead,
|
||||
.zeroout = unix_zeroout,
|
||||
};
|
||||
|
||||
io_manager unixfd_io_manager = &struct_unixfd_manager;
|
||||
|
|
|
@ -28,17 +28,17 @@ BSDLIB_MYDIR = ss
|
|||
BSDLIB_INSTALL_DIR = $(root_libdir)
|
||||
|
||||
TAGS=etags
|
||||
COMPILE_ET=../et/compile_et --build-tree
|
||||
MK_CMDS=_SS_DIR_OVERRIDE=. ./mk_cmds
|
||||
MK_CMDS= _SS_DIR_OVERRIDE=$(srcdir) ./mk_cmds
|
||||
COMPILE_ET= _ET_DIR_OVERRIDE=$(srcdir)/../et ../et/compile_et
|
||||
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
$(Q) $(CC) $(ALL_CFLAGS) -c $<
|
||||
$(Q) $(CC) $(ALL_CFLAGS_STLIB) -c $<
|
||||
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
|
||||
$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -DSHARED_ELF_LIB -fPIC -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS_STLIB) -g -pg -o profiled/$*.o -c $<
|
||||
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) -DSHARED_ELF_LIB -fPIC -shared -o elfshared/$*.o -c $<
|
||||
@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
|
||||
|
||||
# for the library
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
#
|
||||
|
||||
datarootdir=@datarootdir@
|
||||
DIR="${DIR-@datadir@/ss}"
|
||||
SS_DIR="@SS_DIR@"
|
||||
DIR=@datadir@/ss
|
||||
AWK=@AWK@
|
||||
SED=@SED@
|
||||
|
||||
|
@ -30,12 +29,8 @@ if test -n "$_SS_DIR_OVERRIDE" ; then
|
|||
fi
|
||||
|
||||
if test ! -f $DIR/ct_c.sed || test ! -f $DIR/ct_c.awk ; then
|
||||
DIR="$SS_DIR"
|
||||
# echo "Falling back to $DIR..."
|
||||
if test ! -f "$DIR/ct_c.sed" || test ! -f "$DIR/ct_c.awk" ; then
|
||||
echo "mk_cmds: Couldn't find mk_cmds's template files."
|
||||
exit 1
|
||||
fi
|
||||
echo "mk_cmds: Couldn't find mk_cmds's template files."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILE="$1"
|
||||
|
|
|
@ -3,6 +3,7 @@ LOCAL_PATH := $(call my-dir)
|
|||
libext2_quota_src_files := \
|
||||
dict.c \
|
||||
mkquota.c \
|
||||
parse_qtype.c \
|
||||
plausible.c \
|
||||
profile.c \
|
||||
profile_helpers.c \
|
||||
|
|
|
@ -41,7 +41,7 @@ LIBDIR= support
|
|||
@MAKEFILE_LIBRARY@
|
||||
@MAKEFILE_PROFILE@
|
||||
|
||||
COMPILE_ET=$(top_builddir)/lib/et/compile_et --build-tree
|
||||
COMPILE_ET= _ET_DIR_OVERRIDE=$(srcdir)/../et ../et/compile_et
|
||||
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
|
@ -126,7 +126,7 @@ profile.o: $(srcdir)/profile.c $(top_builddir)/lib/config.h \
|
|||
$(srcdir)/profile.h prof_err.h
|
||||
profile_helpers.o: $(srcdir)/profile_helpers.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(srcdir)/profile.h prof_err.h
|
||||
$(srcdir)/profile.h $(srcdir)/profile_helpers.h prof_err.h
|
||||
prof_err.o: prof_err.c
|
||||
quotaio.o: $(srcdir)/quotaio.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/common.h \
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
# Makefile for e2fsprog's internal support
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
top_builddir = ../..
|
||||
my_dir = lib/support
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
@MCONFIG@
|
||||
|
||||
all::
|
||||
|
||||
OBJS= mkquota.o \
|
||||
plausible.o \
|
||||
profile.o \
|
||||
parse_qtype.o \
|
||||
profile_helpers.o \
|
||||
prof_err.o \
|
||||
quotaio.o \
|
||||
quotaio_v2.o \
|
||||
quotaio_tree.o \
|
||||
dict.o
|
||||
|
||||
SRCS= $(srcdir)/argv_parse.c \
|
||||
$(srcdir)/mkquota.c \
|
||||
$(srcdir)/parse_qtype.c \
|
||||
$(srcdir)/plausible.c \
|
||||
$(srcdir)/profile.c \
|
||||
$(srcdir)/profile_helpers.c \
|
||||
prof_err.c \
|
||||
$(srcdir)/quotaio.c \
|
||||
$(srcdir)/quotaio_tree.c \
|
||||
$(srcdir)/quotaio_v2.c \
|
||||
$(srcdir)/dict.c
|
||||
|
||||
LIBRARY= libsupport
|
||||
LIBDIR= support
|
||||
|
||||
@MAKEFILE_LIBRARY@
|
||||
@MAKEFILE_PROFILE@
|
||||
|
||||
COMPILE_ET=$(top_builddir)/lib/et/compile_et --build-tree
|
||||
|
||||
.c.o:
|
||||
$(E) " CC $<"
|
||||
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
|
||||
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
|
||||
$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
|
||||
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
|
||||
|
||||
installdirs::
|
||||
|
||||
install:: all
|
||||
|
||||
uninstall::
|
||||
|
||||
prof_err.c prof_err.h: prof_err.et
|
||||
$(E) " COMPILE_ET prof_err.et"
|
||||
$(Q) $(COMPILE_ET) $(srcdir)/prof_err.et
|
||||
|
||||
test_profile: $(srcdir)/profile.c profile_helpers.o argv_parse.o \
|
||||
prof_err.o profile.h $(DEPSTATIC_LIBCOM_ERR)
|
||||
$(E) " LD $@"
|
||||
$(Q) $(CC) -o test_profile -DDEBUG_PROGRAM $(srcdir)/profile.c prof_err.o \
|
||||
profile_helpers.o argv_parse.o $(STATIC_LIBCOM_ERR) \
|
||||
$(ALL_CFLAGS)
|
||||
|
||||
clean::
|
||||
$(RM) -f \#* *.s *.o *.a *~ *.bak core profiled/* \
|
||||
../libsupport.a ../libsupport_p.a $(SMANPAGES) \
|
||||
prof_err.c prof_err.h test_profile
|
||||
|
||||
#check:: tst_uuid
|
||||
# LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_uuid
|
||||
|
||||
mostlyclean:: clean
|
||||
distclean:: clean
|
||||
$(RM) -f .depend Makefile \
|
||||
$(srcdir)/TAGS $(srcdir)/Makefile.in.old
|
||||
|
||||
#
|
||||
# Hack to parallel makes recognize dependencies correctly.
|
||||
#
|
||||
../../lib/libsupport.a: libsupport.a
|
||||
../../lib/libsupport.so: image
|
||||
../../lib/libsupport.dylib: image
|
||||
|
||||
$(OBJS):
|
||||
|
||||
# +++ Dependency line eater +++
|
||||
#
|
||||
# Makefile dependencies follow. This must be the last section in
|
||||
# the Makefile.in file
|
||||
#
|
||||
argv_parse.o: $(srcdir)/argv_parse.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/argv_parse.h
|
||||
mkquota.o: $(srcdir)/mkquota.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
|
||||
$(top_srcdir)/lib/e2p/e2p.h $(srcdir)/quotaio.h $(srcdir)/dqblk_v2.h \
|
||||
$(srcdir)/quotaio_tree.h $(srcdir)/quotaio_v2.h $(srcdir)/common.h \
|
||||
$(srcdir)/dict.h
|
||||
plausible.o: $(srcdir)/plausible.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/plausible.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \
|
||||
$(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
|
||||
$(srcdir)/nls-enable.h
|
||||
profile.o: $(srcdir)/profile.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(srcdir)/profile.h prof_err.h
|
||||
profile_helpers.o: $(srcdir)/profile_helpers.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(srcdir)/profile.h prof_err.h
|
||||
prof_err.o: prof_err.c
|
||||
quotaio.o: $(srcdir)/quotaio.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/common.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/quotaio.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
|
||||
$(srcdir)/dqblk_v2.h $(srcdir)/quotaio_tree.h
|
||||
quotaio_tree.o: $(srcdir)/quotaio_tree.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/common.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/quotaio_tree.h \
|
||||
$(srcdir)/quotaio.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \
|
||||
$(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
|
||||
$(srcdir)/dqblk_v2.h
|
||||
quotaio_v2.o: $(srcdir)/quotaio_v2.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/common.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/quotaio_v2.h \
|
||||
$(srcdir)/quotaio.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \
|
||||
$(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
|
||||
$(top_builddir)/lib/ext2fs/ext2_err.h \
|
||||
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
|
||||
$(srcdir)/dqblk_v2.h $(srcdir)/quotaio_tree.h
|
||||
dict.o: $(srcdir)/dict.c $(top_builddir)/lib/config.h \
|
||||
$(top_builddir)/lib/dirpaths.h $(srcdir)/dict.h
|
|
@ -30,7 +30,7 @@
|
|||
fprintf(stderr, "[DEBUG] %s:%d:%s:: " format "\n", \
|
||||
__FILE__, __LINE__, __func__, ## arg)
|
||||
#else
|
||||
# define log_debug(format, ...)
|
||||
# define log_debug(...)
|
||||
#endif
|
||||
|
||||
#endif /* __QUOTA_COMMON_H__ */
|
||||
|
|
|
@ -108,16 +108,19 @@ errcode_t quota_remove_inode(ext2_filsys fs, enum quota_type qtype)
|
|||
|
||||
retval = ext2fs_read_bitmaps(fs);
|
||||
if (retval) {
|
||||
log_err("Couldn't read bitmaps: %s", error_message(retval));
|
||||
log_debug("Couldn't read bitmaps: %s", error_message(retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
qf_ino = *quota_sb_inump(fs->super, qtype);
|
||||
if (qf_ino < EXT2_FIRST_INODE(fs->super)) {
|
||||
quota_inode_truncate(fs, qf_ino);
|
||||
} else {
|
||||
if (qf_ino == 0)
|
||||
return 0;
|
||||
retval = quota_inode_truncate(fs, qf_ino);
|
||||
if (retval)
|
||||
return retval;
|
||||
if (qf_ino >= EXT2_FIRST_INODE(fs->super)) {
|
||||
struct ext2_inode inode;
|
||||
|
||||
quota_inode_truncate(fs, qf_ino);
|
||||
retval = ext2fs_read_inode(fs, qf_ino, &inode);
|
||||
if (!retval) {
|
||||
memset(&inode, 0, sizeof(struct ext2_inode));
|
||||
|
@ -133,7 +136,7 @@ errcode_t quota_remove_inode(ext2_filsys fs, enum quota_type qtype)
|
|||
fs->flags &= ~EXT2_FLAG_SUPER_ONLY;
|
||||
retval = ext2fs_write_bitmaps(fs);
|
||||
if (retval) {
|
||||
log_err("Couldn't write bitmaps: %s", error_message(retval));
|
||||
log_debug("Couldn't write bitmaps: %s", error_message(retval));
|
||||
return retval;
|
||||
}
|
||||
return 0;
|
||||
|
@ -170,14 +173,14 @@ errcode_t quota_write_inode(quota_ctx_t qctx, unsigned int qtype_bits)
|
|||
fs = qctx->fs;
|
||||
retval = ext2fs_get_mem(sizeof(struct quota_handle), &h);
|
||||
if (retval) {
|
||||
log_err("Unable to allocate quota handle: %s",
|
||||
log_debug("Unable to allocate quota handle: %s",
|
||||
error_message(retval));
|
||||
goto out;
|
||||
}
|
||||
|
||||
retval = ext2fs_read_bitmaps(fs);
|
||||
if (retval) {
|
||||
log_err("Couldn't read bitmaps: %s", error_message(retval));
|
||||
log_debug("Couldn't read bitmaps: %s", error_message(retval));
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -191,7 +194,7 @@ errcode_t quota_write_inode(quota_ctx_t qctx, unsigned int qtype_bits)
|
|||
|
||||
retval = quota_file_create(h, fs, qtype, fmt);
|
||||
if (retval < 0) {
|
||||
log_err("Cannot initialize io on quotafile");
|
||||
log_debug("Cannot initialize io on quotafile");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -202,7 +205,7 @@ errcode_t quota_write_inode(quota_ctx_t qctx, unsigned int qtype_bits)
|
|||
strerror(errno));
|
||||
if (h->qh_qf.e2_file)
|
||||
ext2fs_file_close(h->qh_qf.e2_file);
|
||||
quota_inode_truncate(fs, h->qh_qf.ino);
|
||||
(void) quota_inode_truncate(fs, h->qh_qf.ino);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -215,7 +218,7 @@ errcode_t quota_write_inode(quota_ctx_t qctx, unsigned int qtype_bits)
|
|||
|
||||
retval = ext2fs_write_bitmaps(fs);
|
||||
if (retval) {
|
||||
log_err("Couldn't write bitmaps: %s", error_message(retval));
|
||||
log_debug("Couldn't write bitmaps: %s", error_message(retval));
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
|
@ -243,10 +246,9 @@ static int dict_uint_cmp(const void *a, const void *b)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static inline qid_t get_qid(struct ext2_inode *inode, enum quota_type qtype)
|
||||
static inline qid_t get_qid(struct ext2_inode_large *inode, enum quota_type qtype)
|
||||
{
|
||||
struct ext2_inode_large *large_inode;
|
||||
int inode_size;
|
||||
unsigned int inode_size;
|
||||
|
||||
switch (qtype) {
|
||||
case USRQUOTA:
|
||||
|
@ -254,11 +256,10 @@ static inline qid_t get_qid(struct ext2_inode *inode, enum quota_type qtype)
|
|||
case GRPQUOTA:
|
||||
return inode_gid(*inode);
|
||||
case PRJQUOTA:
|
||||
large_inode = (struct ext2_inode_large *)inode;
|
||||
inode_size = EXT2_GOOD_OLD_INODE_SIZE +
|
||||
large_inode->i_extra_isize;
|
||||
inode->i_extra_isize;
|
||||
if (inode_includes(inode_size, i_projid))
|
||||
return inode_projid(*large_inode);
|
||||
return inode_projid(*inode);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -288,7 +289,7 @@ errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs,
|
|||
|
||||
err = ext2fs_get_mem(sizeof(struct quota_ctx), &ctx);
|
||||
if (err) {
|
||||
log_err("Failed to allocate quota context");
|
||||
log_debug("Failed to allocate quota context");
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -299,7 +300,7 @@ errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs,
|
|||
continue;
|
||||
err = ext2fs_get_mem(sizeof(dict_t), &dict);
|
||||
if (err) {
|
||||
log_err("Failed to allocate dictionary");
|
||||
log_debug("Failed to allocate dictionary");
|
||||
quota_release_context(&ctx);
|
||||
return err;
|
||||
}
|
||||
|
@ -368,7 +369,7 @@ static struct dquot *get_dq(dict_t *dict, __u32 key)
|
|||
/*
|
||||
* Called to update the blocks used by a particular inode
|
||||
*/
|
||||
void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode,
|
||||
void quota_data_add(quota_ctx_t qctx, struct ext2_inode_large *inode,
|
||||
ext2_ino_t ino EXT2FS_ATTR((unused)),
|
||||
qsize_t space)
|
||||
{
|
||||
|
@ -395,7 +396,7 @@ void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode,
|
|||
/*
|
||||
* Called to remove some blocks used by a particular inode
|
||||
*/
|
||||
void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode,
|
||||
void quota_data_sub(quota_ctx_t qctx, struct ext2_inode_large *inode,
|
||||
ext2_ino_t ino EXT2FS_ATTR((unused)),
|
||||
qsize_t space)
|
||||
{
|
||||
|
@ -421,7 +422,7 @@ void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode,
|
|||
/*
|
||||
* Called to count the files used by an inode's user/group
|
||||
*/
|
||||
void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode,
|
||||
void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode_large *inode,
|
||||
ext2_ino_t ino EXT2FS_ATTR((unused)), int adjust)
|
||||
{
|
||||
struct dquot *dq;
|
||||
|
@ -448,7 +449,8 @@ errcode_t quota_compute_usage(quota_ctx_t qctx)
|
|||
ext2_filsys fs;
|
||||
ext2_ino_t ino;
|
||||
errcode_t ret;
|
||||
struct ext2_inode inode;
|
||||
struct ext2_inode_large *inode;
|
||||
int inode_size;
|
||||
qsize_t space;
|
||||
ext2_inode_scan scan;
|
||||
|
||||
|
@ -461,27 +463,33 @@ errcode_t quota_compute_usage(quota_ctx_t qctx)
|
|||
log_err("while opening inode scan. ret=%ld", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
inode_size = fs->super->s_inode_size;
|
||||
inode = malloc(inode_size);
|
||||
if (!inode)
|
||||
return ENOMEM;
|
||||
while (1) {
|
||||
ret = ext2fs_get_next_inode(scan, &ino, &inode);
|
||||
ret = ext2fs_get_next_inode_full(scan, &ino,
|
||||
EXT2_INODE(inode), inode_size);
|
||||
if (ret) {
|
||||
log_err("while getting next inode. ret=%ld", ret);
|
||||
ext2fs_close_inode_scan(scan);
|
||||
free(inode);
|
||||
return ret;
|
||||
}
|
||||
if (ino == 0)
|
||||
break;
|
||||
if (inode.i_links_count &&
|
||||
if (inode->i_links_count &&
|
||||
(ino == EXT2_ROOT_INO ||
|
||||
ino >= EXT2_FIRST_INODE(fs->super))) {
|
||||
space = ext2fs_inode_i_blocks(fs, &inode) << 9;
|
||||
quota_data_add(qctx, &inode, ino, space);
|
||||
quota_data_inodes(qctx, &inode, ino, +1);
|
||||
space = ext2fs_inode_i_blocks(fs,
|
||||
EXT2_INODE(inode)) << 9;
|
||||
quota_data_add(qctx, inode, ino, space);
|
||||
quota_data_inodes(qctx, inode, ino, +1);
|
||||
}
|
||||
}
|
||||
|
||||
ext2fs_close_inode_scan(scan);
|
||||
|
||||
free(inode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -581,13 +589,13 @@ errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
|
|||
|
||||
err = ext2fs_get_mem(sizeof(struct quota_handle), &qh);
|
||||
if (err) {
|
||||
log_err("Unable to allocate quota handle");
|
||||
log_debug("Unable to allocate quota handle");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = quota_file_open(qctx, qh, qf_ino, qtype, -1, 0);
|
||||
if (err) {
|
||||
log_err("Open quota file failed");
|
||||
log_debug("Open quota file failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -595,7 +603,7 @@ errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
|
|||
|
||||
err = quota_file_close(qctx, qh);
|
||||
if (err) {
|
||||
log_err("Cannot finish IO on new quotafile: %s",
|
||||
log_debug("Cannot finish IO on new quotafile: %s",
|
||||
strerror(errno));
|
||||
if (qh->qh_qf.e2_file)
|
||||
ext2fs_file_close(qh->qh_qf.e2_file);
|
||||
|
@ -625,7 +633,7 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, enum quota_type qtype,
|
|||
|
||||
err = quota_file_open(qctx, &qh, 0, qtype, -1, 0);
|
||||
if (err) {
|
||||
log_err("Open quota file failed");
|
||||
log_debug("Open quota file failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -635,7 +643,7 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, enum quota_type qtype,
|
|||
scan_data.usage_is_inconsistent = 0;
|
||||
err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data);
|
||||
if (err) {
|
||||
log_err("Error scanning dquots");
|
||||
log_debug("Error scanning dquots");
|
||||
goto out_close_qh;
|
||||
}
|
||||
|
||||
|
@ -654,7 +662,7 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, enum quota_type qtype,
|
|||
out_close_qh:
|
||||
err = quota_file_close(qctx, &qh);
|
||||
if (err) {
|
||||
log_err("Cannot close quotafile: %s", error_message(errno));
|
||||
log_debug("Cannot close quotafile: %s", error_message(errno));
|
||||
if (qh.qh_qf.e2_file)
|
||||
ext2fs_file_close(qh.qh_qf.e2_file);
|
||||
}
|
||||
|
@ -662,7 +670,7 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
int parse_quota_opts(const char *opts, int (*func)(char *, void *), void *data)
|
||||
int parse_quota_opts(const char *opts, int (*func)(char *))
|
||||
{
|
||||
char *buf, *token, *next, *p;
|
||||
int len;
|
||||
|
@ -683,7 +691,7 @@ int parse_quota_opts(const char *opts, int (*func)(char *, void *), void *data)
|
|||
*p = 0;
|
||||
next = p + 1;
|
||||
}
|
||||
ret = func(token, data);
|
||||
ret = func(token);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -55,10 +55,14 @@ static int magic_library_available(void)
|
|||
if (!magic_handle)
|
||||
return 0;
|
||||
|
||||
dl_magic_open = dlsym(magic_handle, "magic_open");
|
||||
dl_magic_file = dlsym(magic_handle, "magic_file");
|
||||
dl_magic_load = dlsym(magic_handle, "magic_load");
|
||||
dl_magic_close = dlsym(magic_handle, "magic_close");
|
||||
dl_magic_open = (magic_t (*)(int))
|
||||
dlsym(magic_handle, "magic_open");
|
||||
dl_magic_file = (const char *(*)(magic_t, const char *))
|
||||
dlsym(magic_handle, "magic_file");
|
||||
dl_magic_load = (int (*)(magic_t, const char *))
|
||||
dlsym(magic_handle, "magic_load");
|
||||
dl_magic_close = (void (*)(magic_t))
|
||||
dlsym(magic_handle, "magic_close");
|
||||
}
|
||||
|
||||
if (!dl_magic_open || !dl_magic_file ||
|
||||
|
@ -244,7 +248,9 @@ int check_plausibility(const char *device, int flags, int *ret_is_dev)
|
|||
}
|
||||
|
||||
#ifdef HAVE_MAGIC_H
|
||||
if ((flags & CHECK_FS_EXIST) && magic_library_available()) {
|
||||
if ((flags & CHECK_FS_EXIST) &&
|
||||
!getenv("E2FSPROGS_LIBMAGIC_SUPPRESS") &&
|
||||
magic_library_available()) {
|
||||
const char *msg;
|
||||
magic_t mag;
|
||||
int has_magic = 0;
|
||||
|
|
|
@ -301,9 +301,9 @@ errout:
|
|||
}
|
||||
|
||||
errcode_t
|
||||
profile_init(const char **files, profile_t *ret_profile)
|
||||
profile_init(const char * const *files, profile_t *ret_profile)
|
||||
{
|
||||
const char **fs;
|
||||
const char * const *fs;
|
||||
profile_t profile;
|
||||
prf_file_t new_file, *last;
|
||||
errcode_t retval = 0;
|
||||
|
|
|
@ -56,7 +56,7 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
long profile_init
|
||||
(const char * *files, profile_t *ret_profile);
|
||||
(const char * const *files, profile_t *ret_profile);
|
||||
|
||||
void profile_release
|
||||
(profile_t profile);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <et/com_err.h>
|
||||
#include "profile.h"
|
||||
#include "profile_helpers.h"
|
||||
#include "prof_err.h"
|
||||
|
||||
/*
|
||||
|
@ -305,7 +306,7 @@ profile_init_path(const char * filepath,
|
|||
/* cap the array */
|
||||
filenames[i] = 0;
|
||||
|
||||
retval = profile_init((const char **) filenames,
|
||||
retval = profile_init((const char * const *) filenames,
|
||||
ret_profile);
|
||||
|
||||
/* count back down and free the entries */
|
||||
|
|
|
@ -299,8 +299,11 @@ static errcode_t quota_inode_init_new(ext2_filsys fs, ext2_ino_t ino)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (EXT2_I_SIZE(&inode))
|
||||
quota_inode_truncate(fs, ino);
|
||||
if (EXT2_I_SIZE(&inode)) {
|
||||
err = quota_inode_truncate(fs, ino);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
memset(&inode, 0, sizeof(struct ext2_inode));
|
||||
ext2fs_iblk_set(fs, &inode, 0);
|
||||
|
@ -327,7 +330,7 @@ errcode_t quota_file_create(struct quota_handle *h, ext2_filsys fs,
|
|||
enum quota_type qtype, int fmt)
|
||||
{
|
||||
ext2_file_t e2_file;
|
||||
int err;
|
||||
errcode_t err;
|
||||
ext2_ino_t qf_inum = 0;
|
||||
|
||||
if (fmt == -1)
|
||||
|
@ -339,11 +342,11 @@ errcode_t quota_file_create(struct quota_handle *h, ext2_filsys fs,
|
|||
err = ext2fs_new_inode(fs, EXT2_ROOT_INO, LINUX_S_IFREG | 0600,
|
||||
0, &qf_inum);
|
||||
if (err)
|
||||
return -1;
|
||||
return err;
|
||||
ext2fs_inode_alloc_stats2(fs, qf_inum, +1, 0);
|
||||
ext2fs_mark_ib_dirty(fs);
|
||||
} else if (qf_inum == 0) {
|
||||
return -1;
|
||||
return EXT2_ET_BAD_INODE_NUM;
|
||||
}
|
||||
|
||||
err = ext2fs_read_bitmaps(fs);
|
||||
|
@ -363,7 +366,7 @@ errcode_t quota_file_create(struct quota_handle *h, ext2_filsys fs,
|
|||
log_debug("Creating quota ino=%lu, type=%d", qf_inum, type);
|
||||
err = ext2fs_file_open(fs, qf_inum, h->qh_file_flags, &e2_file);
|
||||
if (err) {
|
||||
log_err("ext2fs_file_open failed: %d", err);
|
||||
log_err("ext2fs_file_open failed: %ld", err);
|
||||
goto out_err;
|
||||
}
|
||||
h->qh_qf.e2_file = e2_file;
|
||||
|
@ -376,6 +379,7 @@ errcode_t quota_file_create(struct quota_handle *h, ext2_filsys fs,
|
|||
|
||||
if (h->qh_ops->new_io && (h->qh_ops->new_io(h) < 0)) {
|
||||
log_err("qh_ops->new_io failed");
|
||||
err = EIO;
|
||||
goto out_err1;
|
||||
}
|
||||
|
||||
|
@ -388,7 +392,7 @@ out_err:
|
|||
if (qf_inum)
|
||||
quota_inode_truncate(fs, qf_inum);
|
||||
|
||||
return -1;
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -217,12 +217,12 @@ const char *quota_get_qf_name(enum quota_type, int fmt, char *buf);
|
|||
/* In mkquota.c */
|
||||
errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs,
|
||||
unsigned int qtype_bits);
|
||||
void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
|
||||
int adjust);
|
||||
void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
|
||||
qsize_t space);
|
||||
void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
|
||||
qsize_t space);
|
||||
void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode_large *inode,
|
||||
ext2_ino_t ino, int adjust);
|
||||
void quota_data_add(quota_ctx_t qctx, struct ext2_inode_large *inode,
|
||||
ext2_ino_t ino, qsize_t space);
|
||||
void quota_data_sub(quota_ctx_t qctx, struct ext2_inode_large *inode,
|
||||
ext2_ino_t ino, qsize_t space);
|
||||
errcode_t quota_write_inode(quota_ctx_t qctx, enum quota_type qtype);
|
||||
errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino,
|
||||
enum quota_type type);
|
||||
|
@ -233,7 +233,7 @@ int quota_file_exists(ext2_filsys fs, enum quota_type qtype);
|
|||
void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, enum quota_type qtype);
|
||||
errcode_t quota_compare_and_update(quota_ctx_t qctx, enum quota_type qtype,
|
||||
int *usage_inconsistent);
|
||||
int parse_quota_opts(const char *opts, int (*func)(char *, void *), void *data);
|
||||
int parse_quota_opts(const char *opts, int (*func)(char *));
|
||||
|
||||
/* parse_qtype.c */
|
||||
int parse_quota_types(const char *in_str, unsigned int *qtype_bits,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue