aboutsummaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* f2fs-tools: release 1.11.0Jaegeuk Kim2018-07-281-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cherry-picked from: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git This release includes: - add sg_write_buffer for UFS firmware update in Android - wanted_sector_size to specify sector size explicity - support fsverity feature bit - support lost+found feature And, it includes some critical bug fixes. b98fab3 f2fs-tools: release 1.11.0 1c15c8d resize.f2fs: fix wrong nat_bits migration 154bf70 fsck.f2fs: add sanity check nat_bits 41149fb fsck.f2fs: simplify fsck_chk_quota_node in PREEN_MODE_1 eb61637 fsck.f2fs: reconnect unreachable files to lost+found ff37829 mkfs.f2fs: create lost+found directory 1325c93 dump.f2fs: fix a wrong report for dump an {d,id,did}node 7b73b6e mkfs.f2fs: treat db's data as hot one 6fdc37f mkfs.f2fs: support hot file extension 4d4a9f2 fibmap: include f2fs_fs.h before other header files c265813 fsck.f2fs: read nat block if nat entry is invalid fbcc3b1 fsck.f2fs: integrate sanity_check_inode to __check_inode_mode 5e91b36 mkfs.f2fs: introduce mkfs parameters in f2fs_configuration be4f9a6 fsck.f2fs: fix typo 822e1a1 f2fs-tools: init f2fs_configuration as 0 3e8c8d7 dump.f2fs: correct the seg type in ssa_dump f52987e mkfs.f2fs: fix to handle endianness in f2fs_write_check_point_pack 8a96b6a fsck.f2fs: fix to check all the types of current offsets baaa076 mkfs.f2fs: expand scalability of nat bitmap 06addd3 fsck.f2fs: reduce mem alloc during read sit block fffc395 fsck.f2fs: read ahead xattr & direct node blocks 10eea8a dump.f2fs: support to dump dirent from blkaddr c56821f fsck.f2fs: allow -p without value Change-Id: I6023b5faa3435b7b320b5ad8c531049586981efc Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: avoid selinux denial for unnecessary sysfs nodeJaegeuk Kim2018-07-281-1/+1
| | | | | | | | This avoids unnecessary sysfs node access causing selinux denial. Bug: 78358575 Change-Id: I0ab69ac785a92d1deca037c3401c5d6107c500c7 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* Merge remote-tracking branch 'aosp/master' into HEADLuca Stefani2018-04-061-8/+33
|\ | | | | | | Change-Id: I331d71f762c04991629312399d61f78e83442072
| * f2fs-tools: use pointer and memory alloaction instead of definingIris Chang2018-04-041-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "structure stat" in function stack Problem: Function f2fs_dev_is_unmounted() and get_device_info() define local variable "struct stat xxx". If the callstack is very deep and stack is smaller, it will result in stack corruption. Solution: It is better to use pointer and memory allocation instead of defining "structure stat" in function stack. Bug: 69641635 Test: Before GSI includes this patch, following cts-on-gsi test cases fail. We included this patch and built GSI to run the test by VTS 8.1 R3 and these cases can pass. android.appsecurity.cts.AdoptableHostTest#testApps android.appsecurity.cts.AdoptableHostTest#testEjected android.appsecurity.cts.AdoptableHostTest#testPackageInstaller android.appsecurity.cts.AdoptableHostTest#testPrimaryStorage Change-Id: I024ecbf00b618cde68ae2a4dc405f3525ec586c2 Signed-off-by: Iris Chang <iris.chang@mediatek.com> [Jaegeuk Kim: fix build errors.] Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
| * libf2fs,mkfs.f2fs: add wanted_sector_size for wanted_total_sectorskatao2018-04-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The wanted_total_sectors was determined by device sector size, but sometimes we don't know precise sector_size by default. So, let's give wanted_sector_size in such the ambiguous situation. Bug: 77306087 Signed-off-by: katao <katao@xiaomi.com> Signed-off-by: Junling Zheng <zhengjunling@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@google.com> (cherry picked from commit 74bd6a84699fa15662a16c484d70736a7b314107) Change-Id: I7ea4ace0684cc5360fb0177e44e7a78fd406d68c
* | Merge branch 'master' of ↵Luca Stefani2018-03-311-8/+1
|\| | | | | | | | | | | https://android.googlesource.com/platform/external/f2fs-tools into HEAD Change-Id: I6d7b25d0c4bda6d4735c4f0d9156ebefbfaf35dd
| * Revert "FROMLIST: libf2fs: reset wanted_total_sectors by new sector_size"Jaegeuk Kim2018-03-301-8/+1
| | | | | | | | | | | | This reverts commit 457c9920f0747f476d88a022203a88a16223088a. Change-Id: I957729026506899d018eb1fd22e7bc7aa2ed010f
* | Merge remote-tracking branch 'aosp/master' into HEADLuca Stefani2018-03-291-1/+8
|\| | | | | | | Change-Id: Ic3afff8a23eb33418925a5f156ca57c0a9ef5411
| * FROMLIST: libf2fs: reset wanted_total_sectors by new sector_sizekatao2018-03-271-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (am from https://sourceforge.net/p/linux-f2fs/mailman/message/36277204/) The args of wanted_total_sectors is calculated based on the DEFAULT_SECTOR_SIZE(512Bytes).get_device_info(i) may be reset dev_sector_size, we should reset the number of wanted_total_sectors. This bug was reported to Google Issue Tracker. Link: https://issuetracker.google.com/issues/76407663 Test: userdata use f2fs and enforce encryption.Boot after factory reset. Change-Id: I8550372f5d8c6ff88f9e242fd591e977107d03ed Signed-off-by: katao <katao@xiaomi.com> Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
* | f2fs-tools: Rename utf conversion symbolsTom Marshall2018-02-241-2/+2
|/ | | | | | These clash with libbase Change-Id: I74162d1fcbdb14dbfdfc8d7252a7d425a146bd4a
* mkfs.f2fs: Windows Android SDK supportHyojun Kim2017-12-023-3/+119
| | | | | | | This patch enables cross compilation for Windows Android SDK by using ANDROID_WINDOWS_HOST. Signed-off-by: Hyojun Kim <hyojun@google.com>
* f2fs-tools: enable sparse_file opeartionsJaegeuk Kim2017-12-022-45/+153
| | | | | | | This adds reading data from sparse_file. Change-Id: Icd8ec8f401a5ba87d6d9a26dd07062cc003de1e4 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* sload.f2fs: update build for androidJaegeuk Kim2017-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This patch updates sload.f2fs for android build. - do fsck() after sload() to update quota information. - return success, if there's no source directory -C fs_config -f source directory [path of the source directory] -p product out directory : path on fs_config file for uid/gid/mode -s file_contexts : selabel file -t mount point [prefix of target fs path, default:/] : path stored in selabel/fs_config files -T timestamp Change-Id: Ibb600411dac6081fc63c978cf3086092b89fe9f3 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: propagate error from f2fs_{finalize,fsync}_deviceChao Yu2017-12-021-5/+18
| | | | | | | | | | tests/generic/405 of fstest suit expects that mkfs will return error when it hits EIO, so let's propagate error from f2fs_{finalize,fsync}_device, then mkfs can be aware of fsync error. Signed-off-by: Chao Yu <yuchao0@huawei.com> [Jaegeuk Kim: initialize ret to zero] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: build binaries in MacJaegeuk Kim2017-11-162-8/+70
| | | | | | | This patch modifies f2fs-tools to be built in mac. Change-Id: Ib341e2255b86cb07a7809a83237d9af616fc8777 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* lib/libf2fs.c: include <sys/sysmacros.h>Anthony G. Basile2017-11-161-0/+1
| | | | | | | | | | The macros `major' and `minor' have been moved from <sys/types.h> to <sys/sysmacros.h>. We include the latter to avoid deprecated messages and future proof the code. Change-Id: Idec908d8d2e78d50838a63ad54ec8d1b90dd6f82 Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: add an option to preserve quota limitsJaegeuk Kim2017-11-131-0/+5
| | | | | | | If it detects quota file errors, we can see insane quota limits. In order to recover that, this patch adds an option to reset them as zeros. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: introduce new option --dry-runSheng Yong2017-11-132-0/+4
| | | | | | | | | With --dry-run enabled, fsck.f2fs will do all checks and "fixes" except that all fixes will not be written to storage at last. Signed-off-by: Sheng Yong <shengyong1@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: support flexible inline xattr sizeChao Yu2017-11-131-3/+1
| | | | | | | | | This patch makes mkfs to support flexible inline xattr feature, also this enables fsck to recognize new disk-layout of inode which be of flexible inline xattr size. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck: introduce generic function f2fs_fsync_deviceYunlei He2017-11-131-0/+10
| | | | | | | | | | | | We use f2fs_finalize_device to fsync previous data in checkpoint area before write last CP pack, in order to avoid cp corruption in sudden-power-off case. But this function will close the device, so this patch introduce a function to call fsync() only. Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: release 1.9.0Chao Yu2017-11-131-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | This release includes: - sparse support - inode checksum support - nat_bits option - encryption management - noheap allocation by default - add CP_TRIMMED_FLAG f2fs-tools: spread struct f2fs_dentry_ptr for inline path f2fs-tools: add atomic_write feature flag f2fs-tools: enhance on-disk inode structure scalability f2fs-tools: support project quota f2fs-tools: fix printing block adresses f2fs-tools: support inode checksum mkfs.f2fs: fix missing cpu_to_le64 for checkpoint version fsck.f2fs: write back last cp block in the end mkfs.f2fs: fix wrong curseg check f2fs-tools: add cscope files to .gitignore f2fs-tools: fix is_set_ckpt_flags for correct bool value f2fs-tools: move_curseg_info only if check_curseg_offset fails Change-Id: I28f6287977fe9bc1082da18d327f0a70ea1a9623 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* add sparse support for f2fsYang Jin2017-06-262-5/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | Description: modify I/O operations to support writing in sparse format build host executable for making sparse image Tests: Using host executable: ./make_f2fs_host -S2000000000 userdata.img fastboot flash userdata userdata.img Using target executable: adb push $OUT/system/bin/make_f2fs /system/bin fastboot erase userdata Analyzing the output image: ./make_f2fs_host -S2000000000 userdata.img ./make_f2fs_host test.img simg2img userdata.img output.img hexdump -C output.img >> output.txt hexdump -C test.img >> test.txt Bug: 62493641 Change-Id: I7589e1ee4ae597523d32c214944b40c8f7df07b6 Merged-In: I7589e1ee4ae597523d32c214944b40c8f7df07b6
* f2fs-tools: merge -next changesJaegeuk Kim2017-06-261-5/+8
| | | | | | | | | | | | | | | | | | | | | | | Changes include: mkfs.f2fs: drop initial spaces for feature string f2fs-tools: avoid build warnings (origin/dev, dev) mkfs.f2fs: avoid wrong discard of dnode f2fs-tools: fix the wrong message when errno is EBUSY f2fs-tools: support to set and recognize CP_TRIMMED_FLAG fsck.f2fs: sanity check segno and blk_off when building curseg array fsck.f2fs: sanity check cp_payload before reading checkpoint fsck.f2fs: sanity check blk_off for summary block entries mkfs.f2fs: fix wrong segment assignment f2fs-tools: sanity check segment count fsck.f2fs: fix cur_valid_map buffer overflow Fix mkfs out of tree builds mkfs.f2fs: use noheap by default libf2fs: avoid overwrite the c.start_sector by non-root device ... Change-Id: I27adc30ff4439e5b3f7a290d81a3a783bf916d4a Merged-In: I27adc30ff4439e5b3f7a290d81a3a783bf916d4a Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: initialize and avoid build warning for androidJaegeuk Kim2016-11-102-2/+3
| | | | | | | This patch initialize one variable for android build. In addition, it avoids there-in build warnings. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: support multiple devicesJaegeuk Kim2016-11-093-104/+212
| | | | | | | | This patch adds an option to specify multiple devices for an f2fs instance. Up to 7 devices in addition to the default device can be added. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: avoid build warningJaegeuk Kim2016-11-011-2/+10
| | | | | | | | | | | | | | This avoids the below warnings. libf2fs_zoned.c:39:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf(file, "%s", str); ^ libf2fs_zoned.c: In function 'f2fs_get_zone_blocks': libf2fs_zoned.c:72:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf(file, "%s", str); ^ Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: introduce support for zoned block devicesDamien Le Moal2016-11-015-1018/+322
| | | | | | | | | With the availability of the BLKREPORTZONE and BLKRESETZONE ioctls, there is no need for using SG_IO to discover zoned block devices characteristics. This simplifies the code. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: use zoned block device terminologyDamien Le Moal2016-10-311-3/+3
| | | | | | | | | | | | | SMR stands for "Shingled Magnetic Recording" which makes sense only for hard disk drives (spinning rust). The ZBC/ZAC standards enable management of SMR disks, but solid state drives may also support those standards. So replace "SMR" with "zoned block device" to avoid a HDD centric terminology. In particular, rename the HMSMR feature to BLKZONED. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: avoid garbage printoutJaegeuk Kim2016-10-131-2/+2
| | | | | | This patch avoids to print garbage data. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid AOSP build failureJaegeuk Kim2016-10-121-0/+10
| | | | | | SCSI-related operations are not permitted to AOSP biuld. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: increase robustness when called on root deviceTobias Jakobi2016-09-281-0/+66
| | | | | | | | | | | | | | | | | | | | | | On some systems '/proc/mounts' contains the entry '/dev/root' as alias for the root device, while that alias doesn't actually exist as symlink in /dev. /proc/mounts: /dev/root / f2fs rw,noatime,background_gc=on,user_xattr,acl,inline_data,extent_cache,active_logs=6 0 0 mount: /dev/mmcblk1p1 on / type f2fs (rw,noatime,background_gc=on,user_xattr,acl,inline_data,extent_cache,active_logs=6) If the root device is mounted RO, and we try to scan it, via 'fsck.f2fs /dev/mmcblk1p1', then fsck.f2fs exits because it can't find the entry in /proc/mounts. Try harder to identify the root device of the system first, and in case we are operating on it, check also for '/dev/root' in mounts. Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: use shorter config variable nameJaegeuk Kim2016-09-223-93/+93
| | | | | | This patch has no functional change. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: use dev_read_block and dev_write_blockJaegeuk Kim2016-09-221-6/+6
| | | | | | This patche tries to use dev_read_block and dev_write_block as much as possible. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: show disk informationJaegeuk Kim2016-08-041-1/+26
| | | | | | This adds to show disk information. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: ZBC device supportJaegeuk Kim2016-06-084-1/+1026
| | | | | | | | | This patch adds "-m" option to configure ZBC device. This is to support host-managed SMR device and configure some major features and on-disk layout in f2fs. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: limit the total size up to 16TJunling Zheng2016-02-241-0/+5
| | | | | | | | | F2FS can support 16T bytes at most. Limit the config.total_sectors so that most parameters calculated according to it in sb/cp can be limited correctly too. Signed-off-by: Junling Zheng <zhengjunling@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: check /proc/mounts first to detect readonlyJaegeuk Kim2016-02-181-6/+6
| | | | | | | Once f2fs_stop_checkpoint makes f2fs as readonly, only /proc/mounts shows RDONLY whereas /etc/mtab does not. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: avoid failure and warnings for android buildJaegeuk Kim2016-01-131-6/+7
| | | | | | | This patch fixes to resolve build failure and warnings when compiling it under AOSP. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* lib: use u8/u32/u64 for bit operationsJaegeuk Kim2015-12-151-11/+8
| | | | | | This cleans up the bit operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* lib: fix test_bit_le functionsJaegeuk Kim2015-12-151-16/+10
| | | | | | This patch fixes test_bit_le functions for dentry bit operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: fix storing volume label correctly in utf16Jaegeuk Kim2015-12-141-9/+168
| | | | | | | | This patch fixes to store volume label as utf16 correctly. Many conversion codes are copied from exfat-tools. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: enhance the bit operationsJaegeuk Kim2015-12-101-58/+46
| | | | | | This patch modifies the existing bit operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: add library version infoJaegeuk Kim2015-12-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch gives the version info for two libraries. mkfs/libf2fs_format.la lib/libf2fs.la The versioning rule should be: 1. Start with version information of '0:0:0' for each libtool library. 2. Update the version information only immediately before a public release of your software. More frequent updates are unnecessary, and only guarantee that the current interface number gets larger faster. 2. If the library source code has changed at all since the last update, then increment revision (c:r:a) becomes (c:r+1:a). 3. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0. 4. If any interfaces have been added since the last public release, then increment age. 5. If any interfaces have been removed or changed since the last public release, then set age to 0. quoted from: http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: show correct partition sizeJaegeuk Kim2015-12-081-1/+2
| | | | | | | It needs to consider different sector size when showing the total size. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: support a readonly filesystemJaegeuk Kim2015-11-221-6/+11
| | | | | | If f2fs is mounted as ro, we can do fsck.f2fs. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: don't need to limit MIN_VOLUME SIZEJaegeuk Kim2015-08-101-7/+0
| | | | | | The minimum volume size is determined while preparing superblock. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: set overprovision size more preciselyJaegeuk Kim2015-08-101-2/+2
| | | | | | | This patch introduces to set the default overprovision space according to the partition size in order to provide more space. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: show bytes for total_sectorsJaegeuk Kim2015-03-201-2/+2
| | | | | | This patch shows correct information about total_sectors. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: support large sector sizeChao Yu2015-02-051-9/+5
| | | | | | | | | | | | | | | | | | | | | | | Since f2fs support large sector size in commit 55cf9cb63f0e "f2fs: support large sector size", block device with sector size of 512/1024/2048/4096 bytes can be supported. But mkfs.f2fs still use default sector size: 512 bytes as sector size, let's fix this issue in this patch. v2: o remove unneeded printed message when sector size is large than 512 bytes suggested by Kinglong. o show correct sector size in printed message. o use config.sectors_per_blk instead of DEFAULT_SECTORS_PER_BLOCK suggested by Kinglong. v3: o remove another unneeded printed message when sector size is large than 512 bytes suggested by Kinglong. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Reviewed-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: readahead node blocks to speed upJaegeuk Kim2015-01-291-0/+14
| | | | | | This patch adds readahead system call to speed up node block reads. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>