Commit Graph

82 Commits

Author SHA1 Message Date
张文迪
461b8536e1 adapt the modification of e2fsprog switching to OpenEuler
Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
2023-05-20 16:59:34 +08:00
Jaegeuk Kim
fbbd3511f3 mkfs.f2fs: check uuid library
commit eee3969d7dcf3be9c3b831d993fcf49f55855a35
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:51 +08:00
Bart Van Assche
25d83da964 Fix PowerPC format string warnings
commit c491657c0eb68d01dee5cc66ee3909dba5523540
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

__SANE_USERSPACE_TYPES__ must be defined before <linux/types.h> is
included. Hence this patch that moves the definition of that macro into
the source files that need it.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:50 +08:00
Bart Van Assche
094b306b3b Annotate switch/case fallthrough
commit 7a1206adf33595a50b669d4027b72ad0786fb12f
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Just like in the Linux kernel source code, annotate switch/case
fallthrough.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:50 +08:00
Bart Van Assche
1fa72eed97 tools/f2fs_io: Fix the type of 'ret'
commit 28de4d1334d4519c1a64659245dfd84cc2ddfa6c
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Make it possible to check whether the return value of ioctl() is negative.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:50 +08:00
Bart Van Assche
989594261b tools/f2fscrypt.c: Fix build without uuid/uuid.h header file
commit 93c6483b85141551e6a5fea339ab4c6cc1f9cc8c
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:50 +08:00
Bart Van Assche
1d9cbf3c83 Fix the MinGW build
commit 1790203deed19a93c60813f75956f2788ac96c95
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Fix multiple compiler warnings and build errors reported by the MinGW
cross-compiler.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:49 +08:00
Bart Van Assche
ed86f575e9 Remove unnecessary __attribute__((packed)) annotations
commit 1612bf99de322e2554a90dced7337ff2d8d1ded6
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Applying the __attribute__((packed)) annotation to members that do not
need it impacts performance negatively on architectures that do not
support efficient unaligned accesses (e.g. ARMv7). Hence minimize the
__attribute__((packed)) annotations.

See also CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS in the Linux kernel.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:49 +08:00
Bart Van Assche
a86f797930 Verify structure sizes at compile time
commit 9425b47b897e690c71a337c0c93477bfd6fa1997
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Before modifying the __attribute__((packed)) annotations, let the
compiler verify the sizes of on-disk data structures.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:48 +08:00
Bart Van Assche
a8c6a6d93f Switch from the u_int to the uint types
commit 87d7a95e3134b668e9f1e8519a19f390509fac60
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Many format strings use one of the PRI* macros. These macros are compatible
with the uint types but not with the u_int types. Hence this patch
that switches from the u_int to the uint types.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:48 +08:00
Bart Van Assche
d29305ee15 configure.ac: Enable cross-compilation
commit c48335416a09b881d2309b8f88c9b3d1441f4a9c
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Stop using PKG_CHECK_MODULES() since that macro is not compatible with
cross-compilation.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:48 +08:00
Daeho Jeong
2ecd0c220f f2fs-tools: add atomic write related options to f2fs_io write command
commit 1de1db84d2a4a0ddfe90362d07dbec1dbc423323
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Added two option to f2fs_io "write" command.
 - atomic_commit : atomic write & commit
 - atomic_abort  : atomic write & abort
Also, added an optional option {delay}, which is in ms unit and optional
only for atomic_commit and atomic_abort.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:46 +08:00
Daeho Jeong
4f5e79faa8 f2fs-tools: change fiemap print out format
commit 49159df049
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Given fiemap way to print out extents in the kernel, we can correctly
print the layout of each file in a unit of extent, not block. So, I
changed fiemap print out way like below.

Fiemap: offset = 0 len = 60
        logical addr.    physical addr.   length           flags
0       0000000000000000 00000020032df000 0000000000004000 00001008
1       0000000000004000 00000020032e0000 0000000000004000 00001008
2       0000000000008000 00000020032e1000 0000000000004000 00001008
3       000000000000c000 00000020032e2000 0000000000004000 00001008

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:46 +08:00
Jaegeuk Kim
c7ee479e92 f2fs_io: add rename w/ fsync option
commit 8bcb58ec90
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

e.g., f2fs_io rename source dest 1
      1. open(source)
      2. rename(source, dest)
      3. fsync(source)
      4. close(source)

Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:46 +08:00
Daeho Jeong
025371e721 f2fs-tools: make fiemap command in accordance with uapi
commit 529967eac0
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Made "fiemap" command in accordance with user api manual. So, eliminated
NEW_ADDR print out and made it ends in the last extent.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:46 +08:00
Jaegeuk Kim
9e137d7f15 f2fs_io: add to show immutable bit
commit 38e3115c7f
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:45 +08:00
Jaegeuk Kim
024521aefb f2fs_io: split definition check for crypto ioctl
commit 870915f282
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

This patch fixes undefined FSCRYPT_POLICY_V1 in old distribution.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:45 +08:00
Robin Hsu
8d2dfb7edd f2fs_io: Add get file name encryption mode
commit 1531853eb7
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

This patch add an ioctl to get filename encryption mode.

Signed-off-by: Robin Hsu <robinhsu@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Daeho Jeong
a1879e5af8 f2fs_io: add compress/decompress commands
commit 7b63f7b399
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Added new commands, compress and decompress, to support
F2FS_IOC_COMPRESS_FILE and F2FS_IOC_DECOMPRESS_FILE.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Victor Westerhuis
e67b93cdc9 f2fs-tools: fix a few spelling errors in f2fs-tools
commit d322d47fa4
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

typo fix.

Signed-off-by: Victor Westerhuis <victor@westerhu.is>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Daeho Jeong
2b7016042a f2fs_io: add get/set compression option
commit 1d4c7e7ce5
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Added new commands, get_coption and set_coption, to support
F2FS_IOC_GET_COMPRESS_OPTION and F2FS_IOC_SET_COMPRESS_OPTION.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Ocean Chen
2fc80b9e32 f2fs_io: add erase option
commit 1bfc17340d
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

f2fs_io erase [block_device_path]

Signed-off-by: Ocean Chen <oceanchen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:44 +08:00
Daeho Jeong
851e19eb16 f2fs_io: change fibmap to fiemap
commit 717d70db60
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Currently we support fiemap command using fibmap. It's simple and
easy to use, but we cannot use this for compressed file. To support
more different types of files, we need to change this to use fiemap.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
[Jaegeuk Kim: add Android build]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
2023-04-13 14:13:43 +08:00
张文迪
f8224a8bdc f2fs_tools部件化
Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
2022-08-23 10:40:59 +08:00
jiahaoluo
567e0db420 change part name to storage_service
Signed-off-by: jiahaoluo <luojiahao5@huawei.com>
2022-02-09 15:01:50 +08:00
xlfeng
a48316a6e8 BUILD,gn文件中subsystem_name的值改为filemanagement,路径/e2fsprogs/f2fs-tools-1.14.0改为/f2fs-tools/,config名称e2fsprogs-defaults改为f2fs-defaults。fsck/BUILD.gn增加symlink_target_name。
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2022-01-12 17:11:18 +08:00
xlfeng
a2b0c9daf5 BUILD.gn delete comment lines and uncompiled items.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-21 15:27:01 +08:00
xlfeng
059d1b3f4c BUILD.gn and config.h modify Huawei license to GPL-2.0 license.Add #ifndef CONFIG_H #define CONFIG_H on the head of file and #endif on the end of config.h. Modify the value of Name in README.OpenSource.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-20 21:44:20 +08:00
xlfeng
81c31712a5 Build successful,add one config.h and four BUILD.gn, modify seven files to relsove macro redefined,.Delete two Android.bp files.Add OAT related files,OAT.xml,README.OpenSource and README.md.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-15 10:45:47 +08:00
Jaegeuk Kim
1e3dd7ae5d f2fs_io: measure performance of write()
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-08-20 09:08:31 -07:00
Jaegeuk Kim
334047bdca f2fs_io: add OSYNC option
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-08-20 09:08:07 -07:00
Daeho Jeong
5c92399f8f f2fs_io: open file in read only mode for pinning file
To use "pinfile" command even with read only file, changed open
mode for it.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-08-04 17:52:56 -07:00
Jaegeuk Kim
17463f9c42 f2fs_io: add mmap read operation
This patch adds an option, mmap, when reading data.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-07-20 17:39:02 -07:00
Rolf Eike Beer
4b55c43828 lib: use ${libuuid_LIBS} instead of -luuid everywhere
Otherwise linking will fail if the library is in an uncommon location or has a
non-standard name.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-06-18 12:34:23 -07:00
Rolf Eike Beer
59a37413f8 lib: fix include path for uuid.h
$ pkg-config --cflags uuid
-I/usr/include/uuid

The "uuid/" directory is actually part of the include path. This usually still
works because most people have the path one level up in their default include
path.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-06-18 12:34:03 -07:00
Daeho Jeong
b23b2b97a6 f2fs_io: add randread
I've added a new command to evaluate random read.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-27 13:59:25 -07:00
Jaegeuk Kim
42f739c4c7 f2fs_io: show more flags
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-06 07:37:55 -07:00
Jaegeuk Kim
d21dd9aaca f2fs_io: don't give garbage data in upper 32bits
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-06 07:37:50 -07:00
Jaegeuk Kim
850861988f f2fs_io: add fsync
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-01 17:29:07 -07:00
Chao Yu
596408fd82 f2fs_io: support compress blocks ioctls
Adds to support below three commands to operate reserved blocks
in compressed inode.
- get_cblocks
- release_cblocks
- reserve_cblocks

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-03-18 18:07:18 -07:00
Jaegeuk Kim
f0f29da924 f2fs_io: add set_fsverity
f2fs_io set_verity [file]

Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-01-14 07:42:02 -08:00
Santiago Hormazabal
59478d343a sg_write_buffer: fix sg_write_buffer build outside the source dir
Current Makefile.am included the 'include' directory
directly as -I./include, but this doesn't guarantee that
said directory exists when building outside of the source
directory.
By adding $(srcdir) instead of '.' this gets fixed automatically.

Signed-off-by: Santiago Hormazabal <santiagohssl@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-01-14 07:41:05 -08:00
Jaegeuk Kim
e6cd27722a f2fs_io: accept fallocate to have bigger size
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-12-18 10:20:23 -08:00
Jaegeuk Kim
e0e1c2a790 tools/fibmap: fix build error
fibmap.c:28:10: fatal error: 'sys/sysmacros.h' file not found
         ^~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [fibmap.o] Error 1
make[3]: *** Waiting for unfinished jobs....

Fixes: ce64ea0815 ("f2fs-tools: Add support for Casefolding")
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-10-22 09:33:13 -07:00
Eric Biggers
d5bc55f7c7 f2fs_io: add copy command
Add a copy command to f2fs_io, to allow testing direct I/O writes where
the source page is from a different file (mmap) or an internal kernel
page (sendfile).  It could be useful for other tests in the future too.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-10-07 09:24:50 -07:00
Eric Biggers
7a9422f092 f2fs_io: add helper functions for handling errors
Add and use helper functions for:

- Printing an error message (optionally with errno) and exiting.
- Allocating memory, exiting on error.
- Opening a file, exiting on error.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-10-07 09:24:44 -07:00
Jaegeuk Kim
ab72bb1a42 f2fs_io: add get/setflags
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-08-27 14:51:05 -07:00
Chao Yu
5eb2d84559 f2fs_io: support defrag_file
Support 'defrag_file' sub command to trigger file based defragment via
ioctl in f2fs.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-27 14:51:05 -07:00
Daniel Rosenberg
ce64ea0815 f2fs-tools: Add support for Casefolding
This adds support for f2fs casefolding. Similarly to ext4 casefolding,
this is controlled per-folder via the +F attribute. It can be toggled on
empty directories only. It is not currently compatible with encryption,
but that will likely change.

When enabling the casefold feature, use the -C flag. The format is:
-C encoding[:flag1,flag2,etc]

Signed-off-by: Daniel Rosenberg <drosen@google.com>
[Jaegeuk Kim: print "casefold" in sb->feature]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-27 14:51:05 -07:00
Jaegeuk Kim
7c8df9e026 f2fs_io: add fallocate
This simply supports keep_size.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-20 11:23:51 -07:00