summaryrefslogtreecommitdiff
path: root/ext4_utils
AgeCommit message (Collapse)Author
2023-03-30Don't use _LARGEFILE64_SOURCE in ext4_utils.hColin Cross
Defining _LARGEFILE64_SOURCE in ext4_utils.h is problematic because ext4_utils.h is included by system/core/fs_mgr after system headers, which could cause inconsistent definitions. _LARGEFILE64_SOURCE was only being used for lseek64, which is unnecessary when _FILE_OFFSET_BITS=64 is set. Remove _LARGEFILE64_SOURCE and switch lseek64 to lseek. Also move _FILE_OFFSET_BITS=64 to the Android.bp file, the functions defined in ext4_utils.h don't use off_t. Remove _GNU_SOURCE, it is already set by the default -std=gnu11. This is a step towards removing usage of _LARGEFILE64_SOURCE in favor of setting _FILE_OFFSET_BITS=64 globally. Test: builds Change-Id: I14c7e0ca0fd85920aa0b1d1a18fc5a11d352a4c5
2022-12-08Fix sizeof warnings on callocChih-Hung Hsieh
Although sizeof(char*) and sizeof(struct ext4_super_block*) should have the same value; use the correct type to suppress the warning. Bug: 261919363 Test: make tidy-system-extras_subset Change-Id: Ib6e17a3ef5010aa01d7fdb4f8e804f4714574edd
2022-06-29Merge "Remove Android.mk file"Treehugger Robot
2022-06-28ext4.h: add EXT4_FEATURE_COMPAT_STABLE_INODESjiajia tang
fs_mgr needs to know the value of the EXT4_FEATURE_COMPAT_STABLE_INODES feature flag so it can enable it. Signed-off-by: jiajia tang <tangjiajia@xiaomi.com> Change-Id: I9f7cd9cb2a342d1b2e065e46fb230593f3f33e30 Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
2022-05-26Remove Android.mk fileCole Faust
The module in it appears to be unused now that there's also a mk2fs.conf module in the Android.bp file. Test: Presubmits Change-Id: I5472158d169795b73f02650175857ce46b9c7d8a
2022-04-05Convert build_verify_metadata to python 3Cole Faust
Also update some python 3 issues in mkuserimg_mke2fs. Bug: 203436762 Test: Presubmits Change-Id: Ib919d40c96d3c26d29d8c1b4af67300c4130ec42
2021-11-23Merge "Convert mkuserimg_mke2fs to python3"Treehugger Robot
2021-11-22Convert mkuserimg_mke2fs to python3Kelvin Zhang
1. Use // to ensure division output is integer 2. Specify text=True so that output of subprocess is str not bytes Test: th Change-Id: I7b99598e96d460318c0a65853816b1c8fba899ce
2021-10-12Expose mke2fs.conf to platform-tools sdk-repo buildDan Willemsen
It either needs to use this file this filegroup, or we'd need to move the host definition to Android.bp (but it installs in the "wrong" directory according to Soong). Bug: 187222815 Change-Id: I5098f77d04738999c3ddba2b647678e6aff22eb1
2021-08-23Add OWNERS to ext4_utils and f2fs_utils.David Anderson
Bug: N/A Test: N/A Change-Id: I5883a69efe6485f7efa107ee7b2aa9e54b05ba02
2021-07-23Make libfs_mgr dependencies vendor_ramdisk_available.David Anderson
This is needed to link libfs_mgr into snapuserd. Bug: 193833730 Test: builds Change-Id: I41aec802503f8c4bd0ddcf36140afdf02f68536e
2021-06-14Add ramdisk_available to init_first_stage's depsInseob Kim
Bug: 187196593 Test: boot Change-Id: I3b4b8c4758d5e710d3c98dd138b0893a7b320601
2021-02-19[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: alloc-stress/Android.bp app-launcher/Android.bp boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp brillo_config/Android.mk checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioblame/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp partition_tools/aidl/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp pssbench/Android.mk puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp zram-perf/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ia559848af903a7b6746d9b12b7de8b83bc57f99d
2021-02-16Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/extras"Bob Badour
This reverts commit 044d055c842a5750359ed71dfe50a6a4bf5f4cc3. Reason for revert: Needs to run as multiple roots. Change-Id: I8e06e7eb19e0f634f52fbd8a1c6662f43e347dd5
2021-02-12[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_notice to: Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Added legacy_notice to: alloc-stress/Android.bp app-launcher/Android.bp brillo_config/Android.mk ioblame/Android.bp partition_tools/aidl/Android.bp pssbench/Android.mk zram-perf/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ie7c022a4d7f828a89d0cda663684a497af37006e
2020-11-20mkuserimg_mke2fs finds its sub tools in the same directoryJiyong Park
So far, mkuserimg_mke2fs ran only in the Make world. Now, it will be run in the Soong world via the new android_filesystem module. But the problem is that, when running in Soong, the PATH environment variable doesn't point to the host binary directory (e.g. out/soong/host/linux-x86/bin). This is a problem for this script because sub tools like mke2fs and e2fsdroid have been invoked just by their names expecting that they will be under PATH. To fix this problem, the tool now tries to find the sub tools in the same directory as this script is located at, which would be the host binary directory. Bug: 172414391 Test: m Change-Id: Ia42d0b2533357f20c4dcf1cb7d2587c35165b799
2020-10-27Make the mke2fs.conf can be included by the othersFelka Chang
apexer use mke2fs, e2fsdroid and resize2fs to package image files. And, all of mke2fs, e2fsdroid and resize2fs depend on MKE2FS_CONF environment variable. The pack process should make sure the whole process use the same configuration. Test: atest --host apexer_test Test: out/host/linux-x86/nativetest64/apexer_test/apexer_test Bug: 148659029 Change-Id: I1ae673e324e7ea5e43ace43d120c4c46b8b3d041 Merged-In: I1ae673e324e7ea5e43ace43d120c4c46b8b3d041 (cherry picked from commit 836032e26dd96aa8b3c3dc9f99304350e1a7424f)
2020-10-26ext4_utils: format filesThiƩbaud Weksteen
Format *.cpp according to the new .clang-format. The following command was used to generate this change: $ find . \( -name \*.cpp -o -name \*.h \) -exec clang-format \ --style=file -i {} \; Test: mm Bug: 171699326 Change-Id: I2514746ad3fe3d0c14f7efcf3868997a3a31be6f
2020-10-20ext4_utils: correctly read block group descriptors on 64bit filesystemsEric Biggers
ext4_utils isn't aware of filesystems with the "64bit" feature. The 64bit feature changes the filesystem-wide block numbers to be 64-bit instead of 32-bit, and it increases the size of the block group descriptors. Apparently we've gotten away with this until now since ext4 filesystems in Android haven't been using the 64bit feature. However, change I618a65d7afc63a617f5f2582c93002af7f8e7234 added support for the metadata_csum feature, and Android enables 64bit whenever metadata_csum is enabled because it improves the usefulness of metadata_csum. Separately, when Cuttlefish is configured to use ext4 and 'launch_cvd -data_policy always_create' is used, the filesystem ends up with the 64bit feature because the host's mke2fs.conf is used. vold's encrypt-in-place code doesn't work correctly on 64bit filesystems, since it uses the block group descriptors to identify in-use blocks, and ext4_utils mis-reads the descriptors such that descriptor 'i' gets read into the structs for descriptors 2*i and 2*i+1. Note that this is a problem even if the filesystem doesn't contain more than 2^32 blocks (which can still be assumed to be true on Android). So, fix ext4_utils to correctly read the block group descriptors on both 64bit and !64bit filesystems. Test: Booted Cuttlefish with ext4 + metadata encryption, both with and without the 64bit feature. Before, it only worked with !64bit. Change-Id: I0682971e022407f43ccb3b08c997b787d1a9e649
2020-08-05ext4_utils: add declaration for ext4_bg_has_super_block()Will Shiu
Add a declaration for ext4_bg_has_super_block() so that the encrypt-in-place code in vold can use it to determine whether a backup superblock is present in a block group. Bug: 162479411 Bug: 161871210 Change-Id: Ic090bf4e88193b289b04c5254ddf661ef40b037e
2020-07-08ext4_utils: Don't #define error in a major include.David Anderson
Including ext4_utils.h breaks in some files because it defines common identifiers (like "error"). Move these into the only .cpp files that use them. Bug: N/A Test: manual test Change-Id: I4605b560d09ec46c24a2c42a463f563cfe438356
2020-02-21Merge "Add metadata_csum in ext4.h"Jaegeuk Kim
2020-02-12mke2fs.conf: Don't include resize_inode by default.David Anderson
This flag cause mke2fs to reserve a percentage of blocks as metadata for resizing the filesystem. This wastes a small amount of space (a few hundred KB), but more importantly, makes incremental diffs worse when using BaseFS. Since the number of reserved blocks can change with small differences to the image size, this can cause off-by-one issues leading to large sequences of moves. In a sample Virtual A/B simulation, this reduces the snapshot size by 200MB. Bug: 139201772 Test: debugfs -R stats <image> Change-Id: I57c1456356975dddbb5bcc12ea25ded189848568
2020-02-12Add metadata_csum in ext4.hJaegeuk Kim
It needs to add feature definition. Bug: 149039306 Change-Id: I0b32ecb43cf9ef250a2a86650dca53e749006c15 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-01-08ext4.h: add EXT4_FEATURE_INCOMPAT_CASEFOLDDaniel Rosenberg
fs_mgr needs to know the value of the casefold feature flag so it can enable it. Bug: 138322712 Test: Compiles Change-Id: I6acca568622174a4b15a6bfa101fcc676c12dca7
2019-09-18mkuserimg_mke2fs.py: Package mke2fs.confDaniel Mentz
Depending on the environment where mkuserimg_mke2fs.py is used, it's difficult to locate the configuration file mke2fs.conf. To avoid potential issues, let's just package mke2fs.conf with mkuserimg_mke2fs.py. Bug: 112937752 Change-Id: I9eb911fc9357e65a666bafd3089461cac8289008
2019-07-11libext4_utils: remove unused depsSteven Moreland
Bug: 137311188 Test: library still builds Change-Id: Iee71887bc0f969c349369b7d70c981c3f89ce23a
2019-02-14Merge changes from topic "wipe"Jaegeuk Kim
* changes: wipe: guarantee zeros after wipe out partitions ext4_utils: build by C++
2019-02-13wipe: guarantee zeros after wipe out partitionsJaegeuk Kim
Stale data in the partition can bypass formatting by fs_mgr and cause filesystem unmountable. Bug: 122989894 Change-Id: Id2aa4baefeb8308ce14eeaa7790a1aab35e522aa Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-02-13ext4_utils: build by C++Jaegeuk Kim
With this patch, we can use many library functions. Bug: 122989894 Change-Id: I761a93d3f6460529a99086e33803e96f1a307079 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-01-22ext4.h: add EXT4_FEATURE_RO_COMPAT_VERITYLeo Liou
Add VERITY constant to ext4_utils. Bug: 117437571 Test: bootable for phone projects Change-Id: I77cab3594223df860345266fdbf568c02734c1a8
2019-01-09mkuserimg_mke2fs: pass mount point to mkext2fsMark Salyzyn
When we construct an ext4 system filesystem image, tune2fs reports: Last mounted on=<not available> With this change, it will now report: Last mounted on=/system (or /vendor etc) This is a cosmetic administrative change. Test: manual Bug: 122328872 Change-Id: Ia5370c0b222ee6ad5ee1db10a2810e99b7d01186
2019-01-08mkuserimg_mke2fs: Add -I <inode-size> flagMark Salyzyn
Caller should be able to add stability to the inode-size based on system requirements. For example we may wish to select an inode-size that will absorb all the xattr inline. Test: manual Bug: 122328872 Change-Id: I07ce400b6482646f9b5b353a00f592410aad13b7
2018-11-19Convert blk_alloc_to_base_fs to Android.bpDan Willemsen
See build/soong/README.md for more information. Also remove a useless HOST_OS check -- HOST_OS will always be either linux or darwin, we don't support building directly on windows. Test: m blk_alloc_to_base_fs Change-Id: I13927de82ff769cf3692b58b9432fb79c856b8d3
2018-10-25Refactor "ext4 encryption" code into libfscryptEric Biggers
File-based encryption related code no longer belongs in ext4_utils, as it is now used on both ext4 and f2fs, since both filesystems share the same kernel API for encryption. Refactor it into its own library, libfscrypt. Note that the keyring is renamed from "e4crypt" to "fscrypt", which is technically a user-visible change, but as far as I know nothing depends on it other than vold which is being updated too. Test: built, booted device with f2fs encryption Change-Id: I3c302564262412a5d5e672bd213e7cfada5f49cc
2018-10-03Add /data/apex to directories that don't need to be encrypted.Martijn Coenen
There's no user data there, just code. Bug: 112455435 Test: Using an APEX with Direct I/O in /data/apex works again Change-Id: I5e5557445ea5d638d2dfc4db7d782ee2da207bc1
2018-09-10Remove the mkuserimg_mke2fs.shTianjie Xu
The shell script is not used as we have switched to the python binary. Test: mma Bug: 112555072 Change-Id: I8849fc91a6d62b58a01b29544f2bc5b24c7df89e
2018-08-27Clean up the global -Wno- in system/extras.Elliott Hughes
Bug: N/A Test: builds Change-Id: Idde3d0dafba08ffcd12cc9aa3540550e2601a227
2018-08-24Merge "ext4_utils: Build ext4_crypt_init_extensions.cpp into shared lib."Tao Bao
2018-08-20Build mke2fs.conf with Android.bp.Tao Bao
Bug: 112780007 Test: Build with other changes in the topic (aosp_taimen-userdebug). Test: Boot into recovery. Verify basic functionalities (`adb shell` and `adb sideload`, factory reset). Change-Id: Ic72c5bebf6c72373e67a483062dc160638c68a4e
2018-08-15Convert mkuserimg_mke2fs.sh to pythonTianjie Xu
The mkuserimg_mke2fs.sh was a shell script, which expects all the arguments in order. This cl changes the script to python which leverages python's argumentparser and unittest modules. The script usage is unchanged; and this tool will be packed into the otatools.zip in the follow up cls. Then we'll change the caller site gradually; and remove the old shell script after that. Bug: 112555072 Bug: 63866463 Test: run unit tests & build a userdata image Change-Id: Ie6b687da3de31a3481363f01d2b5c12df91ca5ce
2018-08-12ext4_utils: Build ext4_crypt_init_extensions.cpp into shared lib.Tao Bao
This allows second stage init using libext4_utils.so. Bug: 112494634 Test: `m dist checkbuild` with aosp_marlin-userdebug Change-Id: I72141cff901c7a124c9b791535b66884eae747fb
2018-08-07Revert "Support Speck encryption."Greg Kaiser
This is a partial revert of commit 6a0fa62dc71157f85b24ed15e39ada277f9b5201. Remove the Speck encryption support. It was eventually decided not to allow Speck in Android P, so this code is no longer needed and wasn't used outside of testing. We retain the e4crypt_get_policy_flags() changes from original commit, though. Bug: 112009351 Test: Confirmed AES continues to work with FBE. Change-Id: I53b091dd4c5392de7a00a8c168919fb55e527eaf
2018-08-03Merge "fgetc(3) returns int."Elliott Hughes
am: 3dafe0b635 Change-Id: I68145812813f157121f6f9ca17a14edba0d4fafe
2018-08-02fgetc(3) returns int.Elliott Hughes
The real WTF here might be that we copy an entire file byte-by-byte if we ever take this path... Bug: http://b/112146629 Bug: https://www.viva64.com/en/b/0579/ Test: builds Change-Id: I8bfe6befa3851a839b499ac222c30d26a82bc075
2018-06-26Merge "ext4_utils: Fix FS creation for filesystems with exactly 32768 blocks."Danny Baumann
am: 39e0ab1477 Change-Id: I8060a1cf1e2b3424f2f703cd07484a6f086ce694
2018-06-26Merge "ext4_utils: Fix FS creation for filesystems with exactly 32768 blocks."Treehugger Robot
2018-06-20ext4_utils: delete make_ext4fs relavant code and scriptJin Qian
make_ext4fs has been replaced with mke2fs. Bug: 64395169 Change-Id: Iad3a8346ca211e4d5a5ab7046c2bdd199292a867 Merged-In: Iad3a8346ca211e4d5a5ab7046c2bdd199292a867 (cherry picked from commit 7c2d21b4c28360f5e058e1632d87028f6b43e90a) Test: m native-host-cross with clang (added during cherry-pick to get past repo upload hook).
2018-06-14Merge "EXT4_UTIL: remove ext4 flex_bg from default feature"Denis Hsu
am: 9e00d29710 Change-Id: I6a1cb94f0f3fec3511838ebb809fa3029d94d0fc
2018-06-08ext4_utils: Fix FS creation for filesystems with exactly 32768 blocks.Danny Baumann
In that case, total block count matches number of blocks per group, which yields precisely 1 group. last_group_size in that case was calculated as 0, which together with group count 1 incorrectly triggered the file size check. Special case that scenario by assigning last_group_size as 32768 in that case. Change-Id: I3b6e236a4d6951aca732324b85e46b8c4b5757b7