diff options
author | Bart Van Assche <bvanassche@acm.org> | 2022-04-21 15:18:23 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-04-22 11:54:20 -0700 |
commit | 2e59ab8fa6519e1169631189bd50810cb6b49426 (patch) | |
tree | df4d932a7bbf62a51884c169f73f7fea02effa53 | |
parent | 1790203deed19a93c60813f75956f2788ac96c95 (diff) | |
download | f2fs-tools-2e59ab8fa6519e1169631189bd50810cb6b49426.tar.gz |
configure.ac: Detect the sparse/sparse.h header
The <sparse/sparse.h> header is available in Android but not in the
Android NDK. Hence this patch that only includes the sparse header file
if it is available.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | include/android_config.h | 1 | ||||
-rw-r--r-- | lib/libf2fs_io.c | 10 | ||||
-rw-r--r-- | mkfs/f2fs_format_main.c | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index 06aaed9..317030d 100644 --- a/configure.ac +++ b/configure.ac @@ -109,6 +109,7 @@ AC_CHECK_HEADERS(m4_flatten([ pthread_time.h scsi/sg.h selinux/selinux.h + sparse/sparse.h stdlib.h string.h sys/acl.h diff --git a/include/android_config.h b/include/android_config.h index 0a03d35..3e62fe4 100644 --- a/include/android_config.h +++ b/include/android_config.h @@ -29,6 +29,7 @@ #define HAVE_LSEEK64 1 #define HAVE_MEMSET 1 #define HAVE_SETMNTENT 1 +#define HAVE_SPARSE_SPARSE_H 1 #ifdef WITH_SLOAD #define HAVE_LIBSELINUX 1 diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c index bf6dfe2..2871993 100644 --- a/lib/libf2fs_io.c +++ b/lib/libf2fs_io.c @@ -39,7 +39,7 @@ struct f2fs_configuration c; -#ifdef WITH_ANDROID +#ifdef HAVE_SPARSE_SPARSE_H #include <sparse/sparse.h> struct sparse_file *f2fs_sparse_file; static char **blocks; @@ -398,7 +398,7 @@ int dev_read_version(void *buf, __u64 offset, size_t len) return 0; } -#ifdef WITH_ANDROID +#ifdef HAVE_SPARSE_SPARSE_H static int sparse_read_blk(__u64 block, int count, void *buf) { int i; @@ -649,7 +649,7 @@ int f2fs_fsync_device(void) int f2fs_init_sparse_file(void) { -#ifdef WITH_ANDROID +#ifdef HAVE_SPARSE_SPARSE_H if (c.func == MKFS) { f2fs_sparse_file = sparse_file_new(F2FS_BLKSIZE, c.device_size); if (!f2fs_sparse_file) @@ -691,7 +691,7 @@ int f2fs_init_sparse_file(void) void f2fs_release_sparse_resource(void) { -#ifdef WITH_ANDROID +#ifdef HAVE_SPARSE_SPARSE_H int j; if (c.sparse_mode) { @@ -716,7 +716,7 @@ int f2fs_finalize_device(void) int i; int ret = 0; -#ifdef WITH_ANDROID +#ifdef HAVE_SPARSE_SPARSE_H if (c.sparse_mode) { int64_t chunk_start = (blocks[0] == NULL) ? -1 : 0; uint64_t j; diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c index 88b2674..4d4fad9 100644 --- a/mkfs/f2fs_format_main.c +++ b/mkfs/f2fs_format_main.c @@ -37,7 +37,7 @@ #ifdef HAVE_SYS_UTSNAME_H #include <sys/utsname.h> #endif -#ifdef WITH_ANDROID +#ifdef HAVE_SPARSE_SPARSE_H #include <sparse/sparse.h> extern struct sparse_file *f2fs_sparse_file; #endif |