configure.ac: Detect the sparse/sparse.h header

commit 2e59ab8fa6519e1169631189bd50810cb6b49426
category: bugfix
issue: #I6VAS0
CVE: NA

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

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>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
Bart Van Assche 2022-04-21 15:18:23 -07:00 committed by dongsenhao
parent 1d9cbf3c83
commit 89274e8c32
4 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -41,7 +41,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;
@ -400,7 +400,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;
@ -651,7 +651,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)
@ -693,7 +693,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) {
@ -718,7 +718,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;

View File

@ -39,7 +39,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