From d9853557a25bcf5340c978ea95f2bbb9da18879c Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 26 Apr 2018 00:40:09 -0700 Subject: [PATCH] libf2fs: Track AOSP libsparse API change. The libsparse in AOSP is updating the type for 'len', from 'int' to 'size_t', in the callback parameter of sparse_file_foreach_chunk(). The value represents a chunk size, which could be legitimately larger than INT_MAX. This patch tracks the libsparse API change. The change is guarded with SPARSE_CALLBACK_USES_SIZE_T that's exposed as part of the libsparse change. This allows f2fs-tools to keep working against older libsparse versions. Signed-off-by: Tao Bao Signed-off-by: Jaegeuk Kim --- lib/libf2fs_io.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c index 4781517..76d283d 100644 --- a/lib/libf2fs_io.c +++ b/lib/libf2fs_io.c @@ -114,8 +114,13 @@ static int sparse_write_blk(__u64 block, int count, const void *buf) return 0; } +#ifdef SPARSE_CALLBACK_USES_SIZE_T +static int sparse_import_segment(void *UNUSED(priv), const void *data, + size_t len, unsigned int block, unsigned int nr_blocks) +#else static int sparse_import_segment(void *UNUSED(priv), const void *data, int len, unsigned int block, unsigned int nr_blocks) +#endif { /* Ignore chunk headers, only write the data */ if (!nr_blocks || len % F2FS_BLKSIZE) -- 2.7.4