Age | Commit message (Collapse) | Author |
|
make_ext4fs crashes if size is less than block size or less than
header size (super block + descriptors + bitmaps). Check the size
and return errors.
Test: run make_ext4fs with small sizes
Bug: 36576677
Change-Id: I61d92e280cdf290054fadda5a045fc839c6fd8fe
|
|
If available, make_ext4fs will use flash erase & logical block
sizes to tune stride and stripe_width.
Test: Build userdata w/ make_ext4fs, flash, check stride & stripe values
Bug: 33243520
Change-Id: I54f95d822cc1ccc0ebb5edec023560cd9e30e259
Signed-off-by: Connor O'Brien <connoro@google.com>
|
|
Kernel will panic with below log after factory reset:
EXT4-fs error (device mmcblk1p4): ext4_validate_block_bitmap:380: comm init: bg 17: block 557056: invalid block bitmap
Aborting journal on device mmcblk1p4-8.
Kernel panic - not syncing: EXT4-fs (device mmcblk1p4): panic forced after error
Rebooting in 5 seconds.
The root cause is the data type conversion issue on 32 bit devices.
When a 32-bit data mutiply a 32-bit data, it will still get a 32-bit data.
The 64-bit offset will be cut to 32 bit.
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
|
|
So we can do "#include <ext4_utils/make_ext4fs.h>" without adding
"LOCAL_C_INCLUDES += system/extras/ext4_utils".
Also clean up the #include lines in system/extras/ext4_utils/.
Test: `m checkbuild` works.
Change-Id: I3c8b07c9b6f5996160e0cb6d9d069579b1609f60
|
|
Bug: http://b/23392815
Test: builds
Change-Id: Ide007c7ac8414a82548cc99fe384c7de9ba7494b
|
|
Allows passing a base fs mapping file through -d which preserves the
location of those mapping in existing files
Internal Design Doc: go/incremental-ext4
BUG: 26839493
Change-Id: I05e296693429d39466d257d1d0a3daf00510dc26
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
|
|
This reverts commit 3d960843a2260a98c8df5cc39ca0dbf3d675f1a2.
Change-Id: I0fb7d65f094feb4013924685270fc847693b6889
|
|
Allows passing a blk mapping file through -Z which preserves the
location of those mapping in existing files
Internal Design Doc: go/incremental-ext4
BUG: 26839493
Change-Id: I447873bf65ae66dab9923e5a11c497f0722750df
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
|
|
Set maximum mounts count before check and count of mounts
since last fsck when building filesystem.
Will affect host built filesystem and filesystem created in
recovery. This is strongly recommended by the tune2fs manual
page in the e2fsprogs, section about -i flag.
The value of 10 is tried out on field test, and is a
trade-off for start performance and reasonably frequency
of forced checks.
Change-Id: Id7248f1047b32e38c84bd7057c870bf190b04fa6
|
|
Address santizier caught a bug where we memcpy a full block size into
the backup super block, but the source may be offset 1024 bytes into
a block size allocation. The destination buffer is zeroed by calloc,
so just copy the super block size instead.
Change-Id: I87af8e3349a63940905697466f62532c50fab720
|
|
Change-Id: I93ee37a649aabff14464030efd88f79e1ae324f0
Signed-off-by: Eric Miao <emiao@nvidia.com>
|
|
For some unknown reason, we've always been generating the same UUID
for every single ext4 partition that we formatted. Yikes.
Add a flag to request that a real UUID be generated when creating
filesystem.
(cherry-picked from 7538cc97e1695608123739d6ef8ff2ee1572aaec)
Bug: 19993667
Change-Id: I6f3f6aa373021cb8b6779e5354ac36436c4d98d3
|
|
* commit 'fb0c62963b5fe1b4f36e281c4c02d98d737d08ee':
Ignore wipe operation on non-block devices.
|
|
The implementation of make_ext4fs() calls make_ext4fs_internal() by
forcing the |wipe| parameter to true, which is problematic when the
library is used within the emulator (the wipe operation will always
fail on non-Linux platforms).
This patch does the following:
- Add a 'is_block_device_fd()' function to check that a file descriptor
points to a real block device.
- Modify the implementation of wipe_block_device() uses it to return
silently when trying to wipe a non-block-device file.
- Add a WIPE_IS_SUPPORTED flag in wipe.h that indicates whether
block device wiping is supported on the current platform
(for now, this is only the case on Linux).
BUG=NONE
Change-Id: I62b62b7c3e99b465c3b876154231e7c2fe541b23
|
|
* commit 'c0f813afc35c1ca497f35b46181b37c9b837726e':
Set s_flags to 2 to prevent a write on first mount.
|
|
The s_flags field is used to indicate whether characters are signed
or unsigned, which differs between ARM and x86 targets. Setting
this value to 0 causes the correct value for the target to be
written back to the superblock on first mount, even if the fs is
marked read only.
Since this value is only used to ensure interoperability with 2.4
series kernels (which we don't need) in dirhash (which we don't
use), we'll just set it to 2 to prevent the write.
Change-Id: I92698235909791fb5f423cfd61ff5299307a8f97
|
|
Change-Id: I0a7745ecf65a2188c32e7bf2e89fe93259c71b83
|
|
Make read_ext an externally useable function. Use case is to
enable fast encryption by being able to look at whether each block
is in use or not.
Bug: 11985952
Change-Id: Ief71f408a55db7261c75ebe974620415ed8cfd29
|
|
Move ext4_parse_sb to its own compilation unit so it can be used
from fs_mgr without pulling in all of libext4_utils' dependencies
when compiling with ld.bfd.
Change-Id: I185352ecea0e0d577b8cdddfd519f2826d631277
|
|
Move the sparse file pointer out of the fs_info struct in
preparation for exporting fs_info without sparse file support.
Change-Id: I5a72147fe4fb24296e615cb82dbba91c6dc6f7f0
|
|
Move the kernel header includes into a single include file that
can deal with getting the kernel int types correct on all
platforms.
Change-Id: Ied3dc6a0f5cbb3ceb686aa3de72f16e10a36462a
|
|
Change-Id: I5d27f5f50275017134a48eed8d89e452353777f1
|
|
Add support for specifying filesystem capabilities when
creating a new filesystem.
The combination of SELinux extended attributes plus
filesystem capability extended attributes is too big
to fit inside one inode entry. Because of this, I added
support to ext4_utils to create an xattr block and link
the inode to that block. We continue to try to fit
everything inside the inode if possible, but fall over to
creating a block if the extended attribute is too big.
Change-Id: I40ebb63975b15ecd8c565486e171b4d50cd4dfaa
|
|
Block groups that have no used inodes have their inode table left
uninitialized, unless -t is specified, in which case they are
explicitly zeroed. When they are uninitialized, writing a sparse
ext4 image over existing data can cause e2fsck to confuse the
uninitialized data for lost inodes.
Set the EXT4_BG_INODE_UNINIT flags on block groups that have no
used inodes. This flag requires the block group checksum feature
to be enabled, so also enable the checksum feature in the superblock
and compute the checksum for the block group.
Since zeroing the inode tables is now useless, remove the code for
it and deprecate the -t command line option.
Change-Id: I4927c1d866d051547cf0dadc8c8703ded0163925
|
|
Replaces the libsparse API with a sane one based on an opaque
pointer.
Change-Id: I93bc9cf9a6b912a993ef554dbe6ffe2f0f723383
|
|
Minimal refactoring of output_file.c into libsparse in preparation
for completely separating libsparse from ext4_utils.
Moves output_file.c, backed_block.c, and parts of ext4_utils.c
into libsparse. The only changes to the remanining files in
ext4_utils are using the new sparse.h header, and moving the
wipe call out of output_file.c and into make_ext4fs.c.
Change-Id: I1f66f6c3e05230a350023c5b4ea4422f16a73c4b
|
|
Passing a file descriptor to make_ext4fs_internal() is more flexible.
We can use tmpfile() to create a temporary file.
tmpfile() is better than other solutions because it unlinks the file
right after creating it, so closing fd effectively removes temp file.
Thus we don't have to worry about large temp files accidently left
on the filesystem in case of the program crash.
Change-Id: Iba3758a0e13a898920d30d7fa5da696c22daa2b7
|
|
This is not a full port of ext4_utils for windows.
Instead it merely enables use to use the library
for the 'create an empty fs image' functionality
as used by 'fastboot format'.
Change-Id: Ia1ffacd64e4233c4fbb369c4ac5927ccd72ac526
|
|
This reverts commit 89ddaab97e9214cf331baffee2de4595ad14dc79
|
|
Passing a file descriptor to make_ext4fs_internal() is more flexible.
We can use tmpfile() to create a temporary file.
tmpfile() is better than other solutions because it unlinks the file
right after creating it, so closing fd effectively removes temp file.
Thus we don't have to worry about large temp files accidently left
on the filesystem in case of the program crash.
Change-Id: I44146704572c314e1d6cfca7ce918efa7fb92a7a
|
|
This reverts commit 93eb1dc9e68d2e9dea94f56d8bce478c1a52b354
|
|
Passing a file descriptor to make_ext4fs_internal() is more flexible.
We can use tmpfile() to create a temporary file.
tmpfile() is better than other solutions because it unlinks the file
right after creating it, so closing fd effectively removes temp file.
Thus we don't have to worry about large temp files accidently left
on the filesystem in case of the program crash.
Change-Id: I44109e98854c314e1d6cfca7ce918efa7fb92a7a
|
|
|
|
Fix definition of uuid struct.
Properly set the block_group number in each backup copy of the superblock.
Adjust the info.total_inodes field after rounding up the inodes per block group.
Add the option -t to initialize all the inode tables. If also specified with
the -s option, use the CHUNK_TYPE_FILL sparse records to initialize them.
Change-Id: Idd8bcee1b9bde3e82ad8da89ef974fbc12d7a6c6
|
|
Add check for filesystem that needs the journal run
Fix check for a cleanly unmounted filesystem.
Fix computation of new inode number
Fix check in two places for high bit being set on inode num
Only run sanity check pass if filesystem fixup state is unset
(i.e. not partway through the conversion)
Change-Id: Ib5521e7f3c04d32c02d9890644a99378e3a3659e
|
|
Change-Id: Ibee4d7000bce5bc8c2e45339d4d53a242569ae4e
|
|
make_ext4fs was originally designed to be a standalone program, and the
error() macro calls exit() after printing a diagnostic. However, when
it was turned into a library that recovery links against, calling exit()
kills the entire recovery process, which the kernel starts back up,
which dies, and the cycle continues.
This changes make_ext4fs to use setjmp() early, and changes error to
use longjmp to return to that point. When longjmp is called, the
error handler just returns an error. If it was invoked as a standalone
program, this causes the program to exit with an error. If it was
invoked as a library function, the error return is gracefully handled
by recovery.
Change-Id: Iad50f46cac0ac399b5cdfd083d5712f88a10e48e
|
|
Adds a -w option to make_ext4fs, which will attempt to use the
BLKSECDISCARD ioctl to erase the partition in order to avoid
leaving old data where it could be recovered, and to improve
wear levelling after a reformat.
Also causes factory reset through recovery to do a wipe.
Change-Id: Ibe34bbd84552e526be6bd041024a950806aca6b4
|
|
If you specify a negative length when making a filesystem, then the
filesystem size is the size of the partiton (or image file) minus
the absolute value of the negative length specified.
Change-Id: I53e3b6de2ea692f4678682c3f49ff36429d9ad31
|
|
Change-Id: I6c0d71d737be588d03018efdaed378349caa4f7a
|
|
Change-Id: Ibfcf1cdeab47ca13870350184abf83e530acbc07
|
|
Also removes the need to seek in the output file, allowing
stdin and stdout to be used for input and output.
Change-Id: I93cbe335d9cc83a6d21daa696af2cb54952dcc9f
|
|
Change-Id: I6af69d676610099d3912e90fcab3cbdc27ace4e2
|
|
Change-Id: Ic635afbb8819a00ca23ba2f93413fe707e2eec87
|
|
I'm seeing some weeeeird stuff with sparse ext4 images where
files sometimes seem to come back from the dead after reflashing,
etc. My crazy theory is they are hiding in the journal.
Colin humored me and pointed out how to ensure it's entirely
zero'd.
Change-Id: I4d14a2d4879c10540ef3c677ceb523bc061c1ec1
|
|
|