debugfs now links to a new libext2_support library, which only includes
cstring.c (Android separates other pieces of libsupport into separate
libraries).
e2fsck now builds with -Wno-unused-variable to work around an unused
variable introduced by cabde4999d.
libext_e2p builds the new ljs.c file, and links to ws2_32 on Windows for
ntohl().
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: I42edce0478f1529f44acdbef1495ec5270e3a61e
From AOSP commit: af14814afe0cb3389ecc4b9e9422bd7e8962e0ed
The two utilities are now converted to dynamic executables as shared
libraries are supported in recovery mode.
As part of the conversion, shared libraries that are depended from them
are also marked as recovery_available: true.
Bug: 79146551
Test: adb reboot recovery, and select 'Wipe data/factory reset'. The
data partition is formatted and there is no selinux denial.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: I22fbc83a4ff0496096efca90721b0db1237c32cd
From AOSP commit: df1f088849ed3336bb4f6f200c29b30682f15948
When assigning physical address for new data block, search sha
of existing blocks for match. If there's a match, reuse address
of the matched block.
Also set EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS in de-duped image.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Google-Bug-Id: 64109868
Change-Id: I8d2d22e9c301264413c1454c84d7bf6bb32ac5c0
From AOSP commit: 3d7abcc7843d6dfdfdafabf43f5e072cb7aaffbd
From AOSP commit: 2002d7f1fc: Use -Werror in external/e2fsprogs
... which got reverted and reapplied in a confusing way.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Hide unused parameters/variables warnings for mingw.
There are a lot of typedef redefinition errors (warnings) stemming from
linux/types.h being included after ext2_types.h
Bug: 69933068
Test: mmma external/e2fsprogs
Change-Id: Id0815e9e01f4c137fb57696f7afd37935ebd35a1
From AOSP commit: 5155fb404659d345ee4b536673ac83b0f822e8a3
* Remove description of and printing of h, which was never visible to
clients of the EXT4_IOC_GETFLAGS ioctl, including chattr and lsattr.
* Remove descriptions of X and Z, whose support was removed in
4a05268cf8 (Remove compression support).
* Update a brief description of E, whose meaning was changed in
22f22ab1d2 (Reserve the codepoints for the new INCOMPAT
feature ENCRYPT).
* Add P to symbolic mode format string.
Signed-off-by: Tyson Nottingham <tgnottingham@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Passing in a negative integer would lead to a segfault, and
a crafted filesystem image could trigger that.
Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The new kernel headers do:
#define __bitwise __bitwise__
However, the code redefines __bitwise without undef'ing it first.
This is a temporary fix, b/35721782 filed to fix this.
Change-Id: I2c6a64146966f1737835f012d24ccc844570d02b
Test: Builds without warningers/errors.
From AOSP commit: commit 91581e8f15b8a29aedea3e7c11162301c7e66ec3
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This patch also removes all the "-host" and "_static" suffix from all
the libraries adding "unique_host_soname: true". This prevents
confusions with the host installed libraries.
A new "libext2_misc" library is introduced to export some files from
the misc/ directory to other binaries in this project.
Bug: 34220783
Test: mmma external/e2fsprogs
Change-Id: Ia1b689991346b11f8cb38f7c6ee356e666e01d6d
From AOSP commit: 7a9e1a96766d31a41b88f0a539fcc3d532b5c530
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Don't run tests which take longer than 20 seconds to run (especially
f_large_dir, whose run time is well over ten minutes) for "make
check". The new "make fullcheck" will run all of the regression tests
for e2fsprogs.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Move the code to list the journal superblock information to libe2p, so
it can be used by debugfs, and so we don't have two copies of
substantially the same code in dumpe2fs.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
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>
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>
Allow the filesystem to store the metadata checksum seed in the
superblock and add an incompat feature to say that we're using it.
This enables tune2fs to change the UUID on a mounted metadata_csum
FS without having to (racy!) rewrite all disk metadata.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Li Xi's patch was missing the sources for fgetproject.c and
fsetproject.c. I've created replacement files which will service the
purpose.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Chattr and lsattr can be used to set or get project ID:
chattr -p <project id> file
lsattr -p file
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The EXT2_GETVERSION ioctl is defined to take a "long" parameter, but
fgetversion() calls ioctl() with an "int" parameter instead. This is
handled in the kernel correctly, but the generation is sign-extended
in fgetversion() before return on 64-bit systems and lsattr prints
it as a huge positive number for inode generation above 0x80000000:
1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
18446744073045131735 -------------e-- /mnt/ost0/O/0/d0/166240
782808861 -------------e-- /mnt/ost0/O/0/d0/31744
18446744072181134840 -------------e-- /mnt/ost0/O/0/d0/135008
Correctly assign the returned generation number as an unsigned value,
and print it with a 10-character field width. The version is printed
left-aligned for consistency with the old code and to ensure it is
always printed in the first column for use with tools like "cut":
1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
3630547415 -------------e-- /mnt/ost0/O/0/d0/166240
782808861 -------------e-- /mnt/ost0/O/0/d0/31744
2766550520 -------------e-- /mnt/ost0/O/0/d0/135008
Do not return a random value from the stack as the version on error.
Clean up some style issues and consolidate some duplicate code.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This patch add EXT4_PROJINHERIT_FL to enable inherit feature for
project ID. If an directory has its inherit flag set, all its
newly created children will inherit its project ID. Conversely,
new inodes will get a default project ID (i.e. zero). Also, no
hard link or rename is permitted if the directory and child has
different project ID.
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This patch adds project quota support. An new quota type PRJQUOTA(2)
is added. EXT4_PRJ_QUOTA_INO(11) is reserved for project quota inode.
The super block reservers an field s_prj_quota_inum for saving
project quota inode. And each inode adds an internal field i_projid
for saving its project ID.
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This patch add project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT.
Project feature is a read-only compat feature. Thus, an ext4 file
system with project feature enabled could only be read by ext4
kernel module without project feature support.
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Project quota related fields are reserved in Linux kernel.
As a preparation for it, this patch cleans up quota codes
of e2fsprogs so as to make it easier to add new quota type(s).
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros. Furthermore, clean out the
places where we open-coded feature tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
We will be using libsupport.a for e2fsprogs's internal support
functions. It will contain the quota support functions, but we will
also be moving code such as profile.c and plausible.c to libsupport.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
There were some generated files that weren't getting removed by the
clean and distclean targets; fix this.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Having multiple versions of jfs_user.h was confusing the Android
build. Clean up things by removing the lib/ext2fs/jfs_user.h and
misc/jfs_user.h and simplifying how we emulate the kernel
infrastructure needed by journal replay code and removing the
kernel-specific lines from kernel-jbd.h.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The compression patches were an out-of-kernel patch set that was (a)
only available for ext2, (b) something that was never could be
stablized due to file system corruption, and (c) the most recent
patches were for 3.1, last updated in 2011.
The history of the compression patches has been a bit checkered.
There is a long history here at http://e2compr.sourceforge.net which
lists the perspective of the people working on it from the e2compr
side.
From the ext2/3/4 mainline developers' perspective, initial
compression support was added to e2fsprogs in 2000 (in the Linux 2.2
era), but due to stability concerns the kernel patches were never
merged into the mainline kernel. While there were some sporadic
efforts to try to get the ext2 compression patches working in the 2.4
and 2.6 era, by that time mainline work had moved on to ext4, and the
e2compr approach could only work with 32-bit block numbers and
indirect mapped files.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Add missing new lib/ext2fs source files that were added for encryption
support. Also move configuration #define's from individual Android.mk
to the android_config.h file, since we've moved away from specifying
configuration #define's on the command-line upstream.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>