Compare commits

...

118 Commits

Author SHA1 Message Date
Vitaliy Filippov 6e4fa6e281 Fix ea remapping 2016-09-29 01:51:04 +03:00
Vitaliy Filippov b331d80fba Fix itable_unused adjustment - fixes shrink FS + shrink inode tables and some other cases 2016-09-27 23:53:58 +03:00
Vitaliy Filippov f99c7a2e12 One way to fix non-contiguous inode table allocations... 2016-09-26 00:02:00 +03:00
Vitaliy Filippov b9b963d427 Fix the rest of block bitmap differences 2016-09-26 00:02:00 +03:00
Vitaliy Filippov f58c260dc4 Remap blocks before moving inode tables (fixes big flex_bg extend),
check blocks to move even when shrinking inode tables (fixes big flex_bg shrink),
mark inode tables during allocation (fixes bigalloc shrink)
2016-09-25 23:48:01 +03:00
Vitaliy Filippov 152890aa45 Split inode_scan_and_fix into two parts.
- Basic extend and shrink works
- Extend on bigalloc fs works
- Shrink on bigalloc fs gives errors
- Extend on big flex_bg gives errors
2016-09-25 23:48:01 +03:00
Vitaliy Filippov 63039f4bac Implement inode table resizing (not done yet, should split inode_scan_and_fix()) 2016-09-25 23:47:54 +03:00
Vitaliy Filippov 7e0136332c Add patch_io manager support to resize2fs and e2fsck 2016-09-25 23:47:26 +03:00
Vitaliy Filippov b3782b2e5b Add e2patch utility 2016-09-16 11:54:35 +03:00
Vitaliy Filippov 460c0af190 Add patch_io manager 2016-09-16 11:38:14 +03:00
Vitaliy Filippov 2051d63a83 misc: Return error if file is too big for FIBMAP 2016-09-16 11:02:45 +03:00
Theodore Ts'o e703ba4b42 Fix reversed FORCE_NATIVE_MAKE test in acinclude.m4
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-11 23:12:07 -04:00
Theodore Ts'o d6cad379eb libext2fs: fix unaligned, multiblock writes in the unix_io handler
The read-modify-write code for the unaligned fallback code wasn't
working for multi-block writes.  This was unmasked by FreeBSD 11-rc2,
since its malloc() is returning unaligned memory regions for large
memory regions.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-11 00:25:48 -04:00
Theodore Ts'o 4e52870eeb Update release notes, etc., for 1.43.3 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-04 21:31:21 -04:00
Theodore Ts'o 047d5d774f e2fsck: enforce that the extra isize fields in the superblock are sane
Invalid extra isize fields can cause crashes in e2fsprogs and possibly
in the kernel for some architectures due to unaligned accesses.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-04 17:41:20 -04:00
Theodore Ts'o a7b27f11a1 e2fsck: enforce that extra_isize must be a multiple of four
We need to prevent unaligned accesses, so treat any extra_isize which
is not a multiple of four as an bug.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-04 16:34:49 -04:00
Theodore Ts'o 8d7a63921f Avoid crashing on unaligned pointers from corrupted file systems
On platforms that don't permit unaligned pointer dereferences,
corrupted file systems will as used by the regression test suite can
cause e2fsck and debugfs to crash.  Avoid those crashes caused by
corrupted file systems.  With this commit the full set of regression
test suites will pass on the sparc64 platform.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-04 15:06:32 -04:00
Theodore Ts'o f3bc1561c8 Fix FreeBSD pmake support
Fix a typo in the @ifNotGNUmake@ case of MCONFIG.in.

Also allow the FORCE_NATIVE_MAKE to force the use of the non-GNU make
optimized Makefile.  The resulting makefile will work with GNU Make
4.2.1, although "make V=1" won't be honored.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-04 00:16:35 -04:00
Theodore Ts'o 254195627f e2fsck: fix timestamps logic for 32-bit systems
Commit 35a4e1b1c5 introduced a regression which caused e2fsck on
32-bit systems to think all timestamps were legacy pre-1970
timestamps.  Fix the bug.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-03 23:33:11 -04:00
Theodore Ts'o 7b714fe277 debian: update changelog
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-02 00:49:31 -04:00
Theodore Ts'o cd0567982b debian: don't hide the linker flags for e2fsck.static
The linker command needs to be visible so the blhc scanner can work
correctly.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 23:48:03 -04:00
Theodore Ts'o 98e858bf9d debian: fix build reproducibility problems in the rules file
The configure file needs to be run using a relative pathname so that
when $(srcdir) gets introduced into binary file, the location of the
build directory doesn't find its way into the binaries.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 23:13:04 -04:00
Theodore Ts'o a2143b5160 Fix build reproducibility for mk_cmds and compile_et
The mk_cmds and compile_et scripts include the build directory, which
breaks the build reproducibility goal of Debian.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 22:25:22 -04:00
Theodore Ts'o f6acc1212d Update release notes, etc. for 1.43.2 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 15:46:32 -04:00
Theodore Ts'o a7c023f4df config: update config.{guess,sub}
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 15:35:17 -04:00
Theodore Ts'o bbd2f78cf6 libext2fs: allow the default journal size to go as large as a gigabyte
Recent research has shown that for a metadata-heavy workload, a 128 MB
is journal be a bottleneck on HDD's, and that the optimal journal size
is proportional to number of unique metadata blocks that can be
modified (and written into the journal) in a 30 second window.  One
gigabyte should be sufficient for most workloads, which will be used
for file systems larger than 128 gigabytes.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 11:37:59 -04:00
Theodore Ts'o 35a4e1b1c5 e2fsck: fix logic for deciding when to repair legacy timestamp encodings
A static code checker noticed that we had a redundant condition:

    if (((sizeof(time_t) <= 4) ||
         ((sizeof(time_t) > 4) &&

which was caused by the parenthesis were in the wrong place.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:54 -04:00
Theodore Ts'o abae029024 po: Add Hugarian and Serbian translations
Also update the .gmo files.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:54 -04:00
Tianze Wang 57d6927dc8 po: update zh_CN.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:54 -04:00
Yuri Chornoivan 935fdb9935 po: update uk.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:54 -04:00
Göran Uddeborg 57bbbb813d po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Jakub Bogusz d0c9ac4886 po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Benno Schulenberg b9e09a9d02 po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Samuel Thibault 7ef3cf2489 po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Philipp Thomas a4670b9e78 po: update de.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Joe Hansen 1e000f89d3 po: update da.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Angel Mompo 60836c6361 po: update ca.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Theodore Ts'o 4d4335323e tune2fs: tell the user that e2fsck -f is required
The message requesting that the user run e2fsck doesn't include the -f
option, and this is needed to force a file system check.

Addresses-Debian-Bug: #828022

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Theodore Ts'o c4d54aa2f7 e2fsck: fix an alignment problem which causes sparc64 in the journal code
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:53 -04:00
Theodore Ts'o 22137497fa debugfs: fix typo when printing out the dtime label
If the inode has extended timestamps, the dtime was printed with a
label of "crtime".  Fix this.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-09-01 01:01:48 -04:00
Theodore Ts'o b199291909 debugfs: add the debugfs copy_inode subcommand
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-08-31 18:13:16 -04:00
Theodore Ts'o 9a23fa8334 Merge branch 'maint' into next 2016-08-10 18:53:14 -04:00
Andreas Dilger 713edbd082 fsck: fix strange logic
llvm warns about the confusingly written comparison:

                              !strncmp(argv[i+1], "-", 1) == 0) {
    misc/fsck.c:1178 col 9: warning: logical not is only applied to
      the left hand side of comparison [-Wlogical-not-parentheses]
    misc/fsck.c:1178 col 9: note: add parentheses after the '!' to
      evaluate the comparison first
    misc/fsck.c:1178 col 9: note: add parentheses around left hand
      side expression to silence this warning

It makes sense to simplify this to a character comparison rather
than using strncmp() to check only one character.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-08-10 18:21:19 -04:00
Adrien Schildknecht 4ccf9e4fe1 libext2fs: add unixfd_io_manager
This new manager is similar to the unix_io_manager except it takes a
file descriptor as first argument instead of a filename.

Some programs may want libext2fs to directly use a fd instead of
letting it opening the file.
The use case for such a io_manager would be to let programs use
a fd even if the filename is unknown:
  - the fd comes from a temporary file (O_TMPFILE);
  - the fd comes from a unix socket...

Refactoring unix_open() also fix a bug when the IO_DIRECT flag was
specified: ext2fs_get_dio_alignment() was called before the file was
actually opened, resulting in an alignment of 0.

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-08-10 17:08:16 -04:00
Adrien Schildknecht d4e5abfb1b libext2fs: replace 'unsigned long' by 'uintptr_t'
This is needed for win64:
    sizeof(unsigned long) != sizeof(void*)

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-08-10 17:07:00 -04:00
Adrien Schildknecht 5cc6db0c82 libext2fs: reset the size of the zeroing buffer
When a ext2_filsys is freed, ext2fs_zero_blocks2() frees the buffer but
does not reset its size.
If this function is later called with a new ext2_filsys, the code
assumes that the buffer is still valid and return a NULL pointer.

Valgrind output:
==188948== Syscall param pwrite64(buf) points to unaddressable byte(s)
==188948==    at 0x4E46D03: __pwrite_nocancel (syscall-template.S:81)
==188948==    by 0x1254EC: raw_write_blk (unix_io.c:240)
==188948==    by 0x124AAB: unix_write_blk64 (unix_io.c:850)
==188948==    by 0x122893: ext2fs_zero_blocks2 (mkjournal.c:204)

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-08-10 16:43:25 -04:00
Theodore Ts'o 3d6fc97483 resize2fs: fix crash when there is an ea block and no blocks to migrate
This fixes a bug introduced in 1.43 by commit fb47b94fffc: "resize2fs:
rewrite extent/dir/ea block checksums when migrating".  If there is an
extended attribute block and there are no blocks that need to migrate,
we will crash.

The bug was caused by a botched De Morgan's transformation.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-08-10 16:00:17 -04:00
Matthias Andree c2c5c58593 libext2fs: fix infinite loop if copying in an empty directory
In m_minrootdir, on FreeBSD 9.3, try_lseek_copy() fails on an empty file
because errcode is uninitialized and the while() loop never executes,
and the errcode garbage is returned.

Initialize errcode = 0 in try_lseek_copy() to avoid a "fail" result when
there was nothing to copy.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-07-23 12:40:17 -04:00
Daeho Jeong 32448f50df e2fsck: update j_tail_sequence after recovery
When journal is released, s_sequence is set to j_tail_sequence.
But, currently, even if the recovery process is successfully completed,
the j_tail_sequence and, finally, s_sequence are never changed. By this,
when we repeat doing power-off the device suddenly and executing e2fsck
without full scan before mount, the s_sequence number will never change
and, in a very rare case, newly generated journal logs will be
surprisingly grafted to the old journal logs. In this case, out-of-date
metadata log can be replayed on the filesystem area and the filesystem
can be crashed unintentionally by journal recovery process. Therefore,
we need to update j_tail_sequence after recovery process is successfully
completed in e2fsck.

Youngjin had repeated this test and found the problem. With our test,
the filesystem crash occurred within 4 hours.

Signed-off-by: Youngjin Gil <youngjin.gil@samsung.com>
Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-07-05 23:10:21 -04:00
Gustavo Zacarias 49aa3ff1f1 fuse2fs: needs SYSLIBS
It otherwise leads to build failure when using an unbundled libintl.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-07-05 22:59:45 -04:00
Theodore Ts'o c94da0475a Update configure script to reflect changes from commit 62bc243f1b
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-21 23:16:39 -04:00
Eric Sandeen 32bf36dc0f e2undo: fix endian issues
Two new e2undo issues exist in the latest release on big endian
machines.

From sparse check:

undo_io.c:157:26: warning: invalid assignment: |=
undo_io.c:157:26:    left side has type restricted __le32
undo_io.c:157:26:    right side has type int
undo_io.c:161:26: warning: invalid assignment: &=
undo_io.c:161:26:    left side has type restricted __le32
undo_io.c:161:26:    right side has type int

e2undo.c:211:16: warning: cast to restricted __le64
e2undo.c:211:16: warning: cast from restricted blk64_t
e2undo.c:212:16: warning: cast to restricted __le64
e2undo.c:212:16: warning: cast from restricted blk64_t

Addresses-RedHat-Bugzilla: 1344636
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-21 23:10:40 -04:00
Theodore Ts'o 5eca88c1dc debugfs: fix logdump to work on files > 2GB
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-12 21:42:47 -04:00
Ingo Brückl 7bd03cf6a1 misc: don't unconditionally install manual page for fuse2fs
Only install the manual page if fuse2fs itself will be installed.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-09 16:56:50 -04:00
Gustavo Zacarias 62bc243f1b fuse2fs: might need librt
It uses clock_gettime() which in older glibc versions is in librt.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-09 16:56:15 -04:00
Theodore Ts'o 48203a389d Update release notes, etc. for 1.43.1 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-08 15:45:26 -04:00
Matthias Andree 434413ccde libblkid: avoid DIOCGDINFO where missing.
FreeBSD 11 will remove the DIOCGINFO ioctl(), so check if it is defined
before referencing it.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-08 14:26:38 -04:00
Theodore Ts'o c0495d96fd Remove the last of behaviour-specific checks on EXT2_OS_LINUX
If there is a feature check, we can just depend on the feature check.
If it is something that can't be checked via a feature flag, then
instead of checking for EXT2_OS_LINUX, we should instead check for
*NOT* EXT2_OS_HURD. since HURD is the special case.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 13:36:47 -04:00
Theodore Ts'o 726b21b5d2 tests: suppress use of libmagic when running the regression test suite
How libmagic will behave is not necessarily stable across different
operating systems of versions of libmagic (or the magic number
database).  So suppress it to avoid false test failures.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 12:46:24 -04:00
Theodore Ts'o 55e8032363 tests: disable some tests for FreeBSD
Unfortunately, FreeBSD doesn't support sparse files in their tmpfs,
and they generlaly don't mount a tmpfs on /tmp anyway.  As a result
certain tests will either OOM kill a FreeBSD (if tmpfs is in use) or
will take forever (if it is not in use).

So let's turn off some tests for FreeBSD (m_hugefile is disabled on
MacOS already, for similar reasons).  We need to find a better
solution in the long term, but for now, these tests are guaranteed to
be a disaster on FreeBSD, so suppress them for now.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 11:52:25 -04:00
Theodore Ts'o 81f965a04d tune2fs,resize2fs: special case HURD only when testing s_creator_os
The s_creator_os field was a mistake, given how Hurd has been
ab(using) certain file system fields.  We should skip support for
certain advanced features (64-bit support, metadata checksums) for
file systems created on the Hurd OS only, instead of only supporting
them for file systems created on Linux.  This fixes various regression
test failures for FreeBSD.

(The regression tests are probably mostly hopeless for Hurd anyway,
but given the HURD abuse's of various file system fields, the HURD is
going to have to be given second-class treatment in any case, given
what they decided to do with ext2 support, which locks them out of the
more advanced file system features, anyway.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 11:47:40 -04:00
Theodore Ts'o 43b7b054cd libext2fs: fix EXT2FS_PRETEND_* on non-Linux systems
The debugging environment variables EXT2FS_PRETEND_* were implemented
in check_mntent_file(), and this function isn't called on all
operating systems.  Lift this code up to ext2fs_check_mount_point(),
so that these environment variables (which are used in the regression
test suite) will work on all platforms.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 11:44:54 -04:00
Matthias Andree afaf6db69f Fix dbg_print() format for unsigned long long.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 10:50:12 -04:00
Theodore Ts'o ded919125a tests: teach test_script the --failed option
Teach test_script the --failed option, which asks it to rerun the
tests that had previously failed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 10:47:20 -04:00
Theodore Ts'o 3166e2e540 libext2fs: don't use $(LDFLAGS_STATIC) when linking test programs
The tst_* progams aren't intended to be linked 100% stically; they
just link against some of the static libraries.  So use $(ALL_LDFLAGS)
and not $(LDFLAGS_STATIC).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 01:01:45 -04:00
Theodore Ts'o 32179ce25b configure: fix detection of dlopen() for BSD systems
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-07 01:01:37 -04:00
Theodore Ts'o 770d9f5e28 Merge branch 'maint' into next 2016-06-07 01:01:22 -04:00
Theodore Ts'o 127e2291bf libext2fs: fix Direct I/O fallback code so it implements RMW correctly
There is a bug in Unix I/O manager where if an aligned I/O is
required, it does not correctly do the read-modify-write cycle
correctly.  Specifically, it was not doing an lseek between the read
and the write calls, so the update was going to block N+1 instead of
block N.  Oops.

Fortunately in practice we almost never use this fallback path, so
file systems weren't getting horribly corrupted, because (a) we almost
never use Direct I/O in e2fsprogs, at least not by default, and (b)
when we do the buffers end up being aligned anyway, so it's OK.

We only noticed this because the new Undo I/O manager in e2fsprogs
1.43 was doing unaligned I/O and FreeBSD requires that I/O requests be
aligned even if you are not doing Direct I/O, and the e2undo
regression tests were all failing as a result.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-06 23:04:43 -04:00
Theodore Ts'o be05f60ecf tests,debugfs: ea_set's "-f <value_file" needs to be before the other args
For systems that don't use GNU's getopt(3), options have to be before
all non-option arguments.  So change the usage message for debugfs's
ea_set command, and then fix the d_xattr_sorting test.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-06 16:49:37 -04:00
Theodore Ts'o 7618802123 e2undo: #include <libgen.h> since we use basename()
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-06 16:19:11 -04:00
Matthias Andree 254c50ff5f tests: use tar xf -, some tars default to tape dev.
FreeBSD's tar defaults to reading from /dev/sa0 when no -f option is
given, so turn "tar x" into "tar xf -" on j_corrupt_ext_jnl_sb_*.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-06 00:54:11 -04:00
Theodore Ts'o 2832fd8b8f mke2fs: warn if user provides a label which is too long
Addresses-Debian-Bug: #791630

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-05 23:18:30 -04:00
Theodore Ts'o edc7b0988a debugfs: clarify man page for the -b and -s options
Addresses-Debian-Bug: #766379

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-03 23:37:28 -04:00
Theodore Ts'o 97b7a94679 Add clarifications to the e4defrag and resize2fs man pages
Addresses-Debian-Bug: #761144
Addresses-Debian-Bug: #770750

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

by 1 commit.
2016-06-03 23:28:33 -04:00
Theodore Ts'o 50a6f4a2cf Document when ext2/3/4 features were added to the kernel
Document when ext2/3/4 features were added to the kernel in the
ext4(5) man page.

Addresses-Debian-Bug: #428361

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-03 23:09:58 -04:00
Pete Haddow f8a801d05f Clarify and clean up the ext4(5) man page
Signed-off-by: Pete Haddow <pete@leptonyx.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-03 13:44:41 -04:00
Theodore Ts'o a9a81b1f2f debugfs.8, e2fsck.8: clarify man pages these programs can operate on files
Addresses-Debian-Bug: #766127

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-02 23:29:12 -04:00
Theodore Ts'o ebb8b1aa04 debugfs: fix rdump so it can start from the root directory
Previously "rdump / /tmp/out" would fail with the error message:

rdump: File exists while making directory /tmp/out/

Also fix the fast symlink detection logic so that it works when a
symlink has one or more extended attributes.

Addresses-Debian-Bug: #766125

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-02 23:29:07 -04:00
Theodore Ts'o 377e3a9657 misc: fix gcc -Wall complaints
Especially when compiling for a 32-bit architecture.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-06-02 22:40:41 -04:00
Theodore Ts'o 3dcb760f2a debian: disable tdb when building the binaries for the udebs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-31 02:08:50 -04:00
Theodore Ts'o 7f62f07577 debian: change e2fsprogs to Suggests, instead of Recommends fuse2fs
Recommends is too strong of a dependency to use here.

Addresses-Debian-Bug: #825868

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-31 02:08:42 -04:00
Theodore Ts'o d3c0595704 debian: don't build the fuse2fs package for the Hurd OS
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-31 02:05:30 -04:00
Theodore Ts'o 04f34e7182 debian: adjust how we build hardened binaries to avoid blhc complaints
Avoid false positives for blhc.  Also, build the object files for the
static library using -fPIE so they can be linked with a shared
executable linked with -pie.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-31 01:54:16 -04:00
Theodore Ts'o 0eb9fb99da lib: build elf shared libraries using -fPIC -shared
Make sure we use "-fPIC -shared" consistently on linker and compiler
command lines when building or linking the shared objects for the ELF
shared library.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-31 01:54:09 -04:00
Theodore Ts'o 478360f50b Fix Android build warnings
Also fix some additional gcc -Wall build warnings in a traditional
Linux environment.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 23:51:08 -04:00
Theodore Ts'o 749f07121d Add configure --disable-tdb which disables e2fsck's scratch_files feature
The scratch_files feature is not really needed except on 32-bit
platforms, since tdb's performance is pretty awful given how we are
using it.  Maybe SQLite would be faster, but for 64-bit platforms,
enabling swap works fairly well, especially using the rbtree for the
bitmap abstraction.

We leave tdb for Android since it's unlikely that someone will be
trying to connect petabyte+ sized file systems to a mobile handset.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 21:52:52 -04:00
Theodore Ts'o a701823a31 libsupport: fix gcc -Wall nits
Also add better error checking to mke2fs and e2fsck's calls to quota
functions in libsupport.a.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 17:36:43 -04:00
Theodore Ts'o c2ff6bac50 Fix "make gcc-wall" for library code
Commit fd1677e80: "Add --enable-hardening which builds e2fsprogs with
security hardening" broken the gcc warnings mode by changing how
CFLAGS were used to build static and shared library objects.

Also shut up GCC's whining about casting the return value from
dlsym(2) to function pointers --- since due to conflicing standards,
there is no way to use dlsym() without causing gcc to whine one way or
another.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 17:07:17 -04:00
Theodore Ts'o 62f9bd0e4f e2fsck,resize2fs: fix gcc -Wall nits
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 13:36:20 -04:00
Theodore Ts'o 9a316fe73e Android.mk: add parse_qtype.c the list of source files
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 13:33:58 -04:00
Theodore Ts'o 2dd680f3b9 tests: fix f_pre_1970_date_encoding on systems with a 32-bit time_t
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 01:07:40 -04:00
Theodore Ts'o c40c832b4c e2fsck: always fix invalid extra field in timestamps if time_t is 32-bits
Systems with 32-bit time_t's can be used past 2038, so we should
always modify dates with extra_time=3.  (On systems with 64-bit
time_t's we will fix these dates before the year 2242.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 01:05:06 -04:00
Filipe Brandenburger c64313084e libe2p: apply LDFLAGS when building tests
This was previously addressed by Michael Forney on commit 53904ae543
but it seems the test cases from lib/e2p (tst_ostype and tst_feature)
were missed.

Fix them by adding the same $(ALL_LDFLAGS) to those two targets.

Tested by building it on a system that depends on LDFLAGS to produce
working binaries and confirming that `make check` succeeds.

Reported-by: Eric Christopher <echristo@google.com>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-28 11:20:10 -04:00
Theodore Ts'o e2406b990c debian: update changelog with changes made to date
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-25 00:30:42 -04:00
Theodore Ts'o 612f775362 debugfs: fix "set_bg <bg num> checksum calc" on 64-bit file systems
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-25 00:24:25 -04:00
Theodore Ts'o d37026ea07 e2fsck: improve error messages when the journal sb is corrupt
If the journal superblock is corrupt and the user declines to fix it
(or runs e2fsck -n), make sure the error messages are clear and
explain that e2fsck cannot (safely) proceed.

Addresses-Debian-Bug: #768162

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-24 23:11:32 -04:00
Theodore Ts'o bf26fae372 debian: use e2fsck.static from BUILD-STD
Now that we are no longer trying to use dietlibc, there's no point
creating a separate build tree for e2fsck.static.  So just use
e2fsck.static from the standard build tree.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-24 23:11:12 -04:00
Theodore Ts'o e1ada17169 debian: simplify rules file
Modern versions of debhelper understand how to build udeb, so we can
remove a lot of special case rules in the debain/rules file.  Also use
dh_lintian instead of open-coding the rules to copy in the Lintian
overrides files.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-24 23:06:54 -04:00
Theodore Ts'o d133561994 debian: package fuse2fs in its own separate package
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-24 15:38:01 -04:00
Theodore Ts'o 93715de136 debian: update changelog with changes made to date
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-22 20:57:32 -04:00
Theodore Ts'o 8fb86b46b8 debian: loosen up dependency on debhelper
In order to allow this package to be built on jessie, just depend on
debhelper >= 9.0.  We will test to see if dh_update_autotools_config
exists and only use it if it is present.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-22 03:20:25 -04:00
Theodore Ts'o 697e21fa61 debian: build with hardening set to "all"
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-22 03:19:30 -04:00
Theodore Ts'o fd1677e801 Add --enable-hardening which builds e2fsprogs with security hardening
Enable the following security features: stack protection, fortify,
read-only relocation tables, immediate dynamic symbol binding, and
text segment ASLR by enabling position independent executable
(PIE).

Special handling is provided for shared library and statically linked
executables.  For all the gory details please see:

   https://lists.debian.org/debian-devel/2016/05/msg00302.html

Distributions who want to do their own special thing can set CFLAGS,
CFLAGS_SHLIB, CLFAGS_STLIB, LDFLAGS, LDFLAGS_SHLIB and LDFLAGS_STATIC
as appropriate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-22 01:58:09 -04:00
Theodore Ts'o bc1ec4b459 e2fsck: fix project quota support
Use a large_inode so that when e2fsck is fixing a file system with
project quota enabled, the correct project id's quota is adjusted when
a corrupted inode is deleted.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 22:18:16 -04:00
Theodore Ts'o 4bfb35e1e6 mke2fs: fix project quota creation
Creating a file system with project quotas can fail if mke2fs is built
using hardening options.  This is because quota_compute_usage() used
ext2fs_get_next_inode() instead of ext2fs_get_inode_full(), and a
small inode was passed into quota_data_add, when a large inode needs
to be used.  As a result get_dq() would end up dereferencing undefined
space in the stack.  Without the hardening options, this would be
zero, so "mke2fs -t ext4 -O project.quota -I 256 test.img" would work
essentially by accident.

Fix this by using ext2fs_get_inode_full() so that a large inode is
available to quota_data_inodes().

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 20:31:59 -04:00
Theodore Ts'o 3a50a3eaf2 debian: Use Package-Type instead of XC-Package-Type
XC-Package-Type was deprecated and replaced with Package-Type starting
in dpkg-dev 1.15.7.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 14:13:34 -04:00
Theodore Ts'o b41a4ffa50 e2fsck: use com_err error codes instead of EBADMSG and EUCLEAN
Some operating systems may not define EBADMSG and EUCLEAN, so for
better portability use our own private error code numbers.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 13:44:41 -04:00
Theodore Ts'o 78b7cd3b1e Clean up spelling errors and other nits in man pages
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 13:40:49 -04:00
Theodore Ts'o eba83bd3ce debian: fix spelling mistakes in copyright files
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 12:43:37 -04:00
Theodore Ts'o 77e9d989f4 debian: fix packaging nits
Fix bad date in debian/changelog, as well as a dropped entry for
1.43~WIP.2016.03.15-2.

Tighted dependency version for debhelper to reflect use of
dh_update_autotools_config.

Removed unused source Lintian overrides.

Thanks to Mattia Rizzolo for pointing these out.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 10:54:36 -04:00
Theodore Ts'o a4d77554fe debian: remove unused and deprecated substitution variables
Replace "Source-Version" with "binary:Version" in
e2fsprogs.shlibs.local, and e2fsck-static doesn't have any shared
libraries dependency so remove the ${shlibs:Depends} from the Depends.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-21 00:15:46 -04:00
Theodore Ts'o 2c0e8c7aac debian: backup/restore the po files which get modified during the build
Before running "make update-gmo", backup the po/*.gmo and po/*.po
files so they can be restored when "make -f debian/rules clean" is
run.  This allows the Debian source tree to built and rebuilt.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-20 23:43:29 -04:00
Theodore Ts'o e7d848266a tests: fix filter.sed to filter out version numbers of the form 1.43
The regular expression worked for version numbers such as 1.42.12, but
not if there isn't a third component in the version number.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-20 21:02:09 -04:00
Theodore Ts'o 6d8f698171 debian: update changelog for 1.43-2
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-20 15:38:36 -04:00
Theodore Ts'o a67286396e debian: create dbgsym packages if debhelper supports them
Starting with Debian Stretch, we now have support for dbgsym packages
which are uploaded to a separate package archive.  Since some people
might want to try to backport e2fsprogs 1.43 for Jessie set things up
so that the package can be built on older Debiain systems (where the
legacy dbg packages will be created) as well as newer (as of this
writing, Debian Sid or Stretch).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-20 15:38:31 -04:00
Theodore Ts'o 01995578ed debian: only try to execute update-initramfs if it exists
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-20 13:37:20 -04:00
Theodore Ts'o 43e6c79a73 debian: use dh_update_autotools_config to update config.{guess,sub}
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-20 13:14:09 -04:00
Theodore Ts'o 74428c9ba7 debian: update watch file to check the GPG signed tar files
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-19 18:24:29 -04:00
198 changed files with 38072 additions and 16653 deletions

2
.gitignore vendored
View File

@ -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

View File

@ -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
View File

@ -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

View File

@ -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.

View File

@ -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 ;

138
config/config.guess vendored
View File

@ -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

43
config/config.sub vendored
View File

@ -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)
;;
*)

174
configure vendored
View File

@ -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

View File

@ -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

99
debian/changelog vendored
View File

@ -1,3 +1,94 @@
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
* Use dh_update_autotools_control to update config.{guess,sub}
automatically when building the package.
* Only try to run update-initramfs if it exists
* Transition to dbgsym packages
-- Theodore Y. Ts'o <tytso@mit.edu> Fri, 20 May 2016 14:07:40 -0400
e2fsprogs (1.43-1) unstable; urgency=medium
* New upstream version
@ -6,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
@ -230,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

2
debian/compat vendored
View File

@ -1 +1 @@
7
9

39
debian/control.in vendored
View File

@ -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 (>= 7.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
@ -259,7 +270,7 @@ Description: ext2/ext3/ext4 file system utilities
This package contains programs for creating, checking, and maintaining
ext2/3/4-based file systems. It also includes the "badblocks" program,
which can be used to scan for bad blocks on a disk or other storage device.
ifdef(`USE_DBGSYM',,``
Package: e2fsprogs-dbg
Section: debug
Priority: extra
@ -269,8 +280,9 @@ Description: debugging information for e2fsprogs
This package includes the debug information useful for debugging e2fsprogs
and its libraries, contained in the e2fsprogs and e2fsck-static packages.
The debug information is used for execution tracing and core
dump analysis.
ifdef(`UTIL_LINUX_NG',,``
dump analysis.
'')
ifdef(`USE_DBGSYM',,ifdef(`UTIL_LINUX_NG',,``
Package: uuid-runtime-dbg
Section: debug
Priority: extra
@ -281,8 +293,8 @@ Description: debugging information for uuid-runtime
uuid runtime programs, contained in the uuid-runtime package.
The debugging information is used for execution tracing and core
dump analysis.
'')dnl
''))dnl
ifdef(`USE_DBGSYM',,``
Package: e2fslibs-dbg
Section: debug
Priority: extra
@ -312,7 +324,8 @@ Description: debugging information for libss2
This package includes the debug information useful for debugging the
ss library, contained in the libss2 package. The debug information
is used for execution tracing and core dump analysis.
ifdef(`UTIL_LINUX_NG',,``
'')dnl
ifdef(`USE_DBGSYM',,ifdef(`UTIL_LINUX_NG',,``
Package: libblkid1-dbg
Section: debug
Priority: extra
@ -332,4 +345,4 @@ Description: debugging information for libuuid1
This package includes the debug information useful for debugging the
UUID library, contained in the libuuid1 package. The debug
information is used for execution tracing and core dump analysis.
'')dnl
''))dnl

10
debian/copyright vendored
View File

@ -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

View File

@ -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

View File

@ -3,7 +3,10 @@
# Abort on error.
set -e
update-initramfs -u
if [ -x /usr/sbin/update-initramfs -a \
-e /etc/initramfs-tools/initramfs.conf ]; then
update-initramfs -u
fi
#DEBHELPER#

View File

@ -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})

2
debian/fuse2fs.files vendored Normal file
View File

@ -0,0 +1,2 @@
/usr/sbin/fuse2fs
/usr/share/man/man1/fuse2fs.1

View File

@ -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".

239
debian/rules vendored
View File

@ -9,6 +9,8 @@
-include debian/rules.custom
export DEB_BUILD_MAINT_OPTIONS ?= hardening=+all
# be paranoid
export LC_ALL ?= C
@ -25,6 +27,22 @@ 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 :=
USE_DBGSYM ?= $(shell if dpkg --compare-versions $(DH_VERSION) ">=" 9.20160114 ; then echo yes ; fi)
ifeq ($(USE_DBGSYM),yes)
dh_strip_args = -p$(1) --dbgsym-migration='$(1)-dbg (<= 1.43-1)'
dh_strip_args2 = -p$(1) --dbgsym-migration='$(2)-dbg (<= 1.43-1)'
else
dh_strip_args = -p$(1) --dbg-package=$(1)-dbg
dh_strip_args2 = -p$(1) --dbg-package=$(2)-dbg
endif
# find the version for the main package, from changelog file
MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
# find versions for libraries going into their own packages, from their Makefile.in's,
@ -78,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}
@ -99,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
@ -122,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)
@ -134,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
@ -168,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
@ -191,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 \
@ -211,9 +222,19 @@ endif
endif
M4_ARGS=
DBG_PACKAGES=
ifeq ($(USE_DBGSYM),yes)
M4_ARGS+=-DUSE_DBGSYM
else
DBG_PACKAGES += -pe2fsprogs-dbg -pe2fslibs-dbg -plibcomerr2-dbg -plibss2-dbg
M4_ARGS+=-UUSE_DBGSYM
endif
ifeq ($(UTIL_LINUX_NG),yes)
M4_ARGS+=-DUTIL_LINUX_NG
else
DBG_PACKAGES += -puuid-runtime-dbg -plibuuid1-dbg -plibblkid1-dbg
M4_ARGS+=-UUTIL_LINUX_NG
endif
@ -236,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
@ -267,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}
@ -301,49 +343,46 @@ ${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}
dh_testdir
if which dh_update_autotools_config > /dev/null 2>&1 ; then \
dh_update_autotools_config ;\
fi
$(MAKE) -C ${stdbuilddir} V=1 all
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 )
@ -372,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
@ -474,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
@ -541,38 +570,22 @@ 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 \
-pe2fsprogs-dbg -pe2fslibs-dbg \
-plibcomerr2-dbg -plibss2-dbg
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 -puuid-runtime-dbg -plibuuid1-dbg \
-plibblkid${BLKID_SOVERSION} -plibblkid1-dbg
endif
dh_installchangelogs
dh_fixperms
dh_strip -pe2fsprogs --dbg-package=e2fsprogs-dbg
dh_strip $(call dh_strip_args,e2fsprogs)
ifneq ($(BUILD_E2FSCK_STATIC),no)
dh_strip -pe2fsck-static --dbg-package=e2fsprogs-dbg
dh_strip $(call dh_strip_args2,e2fsck-static,e2fsprogs)
endif
ifneq ($(ismips),)
dh_strip -pe2fslibs --dbg-package=e2fslibs-dbg -Xlib64ext2fs-nopic.a
dh_strip $(call dh_strip_args,e2fslibs) -Xlib64ext2fs-nopic.a
else
dh_strip -pe2fslibs --dbg-package=e2fslibs-dbg
dh_strip $(call dh_strip_args,e2fslibs)
endif
dh_strip -plibss${SS_SOVERSION} --dbg-package=libss${SS_SOVERSION}-dbg
dh_strip -plibcomerr${COMERR_SOVERSION} \
--dbg-package=libcomerr${COMERR_SOVERSION}-dbg
dh_strip $(call dh_strip_args,libss${SS_SOVERSION})
dh_strip $(call dh_strip_args,libcomerr${COMERR_SOVERSION})
ifneq ($(UTIL_LINUX_NG),yes)
dh_strip -plibblkid${BLKID_SOVERSION} \
--dbg-package=libblkid${BLKID_SOVERSION}-dbg
dh_strip -plibuuid${UUID_SOVERSION} --dbg-package=libuuid${UUID_SOVERSION}-dbg
dh_strip $(call dh_strip_args,libblkid${BLKID_SOVERSION})
dh_strip $(call dh_strip_args,libuuid${UUID_SOVERSION})
endif
dh_strip
@ -586,38 +599,11 @@ endif
/bin/rm debian/$$i.tmp-patch; \
done
for i in e2fsprogs e2fsprogs-dbg e2fslibs e2fslibs-dbg; do \
$(INSTALL) -p -m 0644 debian/copyright \
${debdir}/$$i/usr/share/doc/$$i/copyright; \
done
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
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
@ -632,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
@ -658,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

View File

@ -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

156
debian/upstream/signing-key.asc vendored Normal file
View File

@ -0,0 +1,156 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
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
=oRMW
-----END PGP PUBLIC KEY BLOCK-----

5
debian/watch vendored
View File

@ -1,4 +1,5 @@
version=3
http://sf.net/e2fsprogs/e2fsprogs-([0-9].+)\.tar\.gz
version=4
opts="pgpsigurlmangle=s%$%.asc%" \
http://sf.net/e2fsprogs/e2fsprogs-([0-9].+)\.tar\.gz
#ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/e2fsprogs-([0-9].+)\.tar\.gz

View File

@ -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 \

View File

@ -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;

View File

@ -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

View File

@ -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[])

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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::

View File

@ -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 $<"

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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 */

View File

@ -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();

View File

@ -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) &&

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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");
}
}
}

View File

@ -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;

View File

@ -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 }
};

View File

@ -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
*/

View File

@ -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;

View File

@ -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");

View File

@ -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) &&

View File

@ -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);
}

View File

@ -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

View File

@ -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*

View File

@ -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) \

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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; \

View File

@ -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$//`

View File

@ -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 \

View File

@ -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 \

View File

@ -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--;
}

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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 &&

View File

@ -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

View File

@ -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 */
/*

View File

@ -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)

View File

@ -166,6 +166,8 @@ typedef long __s64;
#endif /* _*_TYPES_H */
#include <stdint.h>
/* endian checking stuff */
#ifndef EXT2_ENDIAN_H_
#define EXT2_ENDIAN_H_

View File

@ -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

View File

@ -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 +

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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)

228
lib/ext2fs/patch.c Normal file
View File

@ -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);
}

64
lib/ext2fs/patch.h Normal file
View File

@ -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

375
lib/ext2fs/patch_io.c Normal file
View File

@ -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;
}

View File

@ -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;

View File

@ -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))

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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"

View File

@ -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 \

View File

@ -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 \

View File

@ -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

View File

@ -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__ */

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

Some files were not shown because too many files have changed in this diff Show More