From: Tao Bao via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: linux-f2fs-devel@lists.sourceforge.net, tbao@google.com
Cc: jaegeuk@google.com
Subject: [PATCH] libf2fs: Track AOSP libsparse API change.
Date: Thu, 26 Apr 2018 00:40:09 -0700 [thread overview]
Message-ID: <20180426074009.36270-1-tbao@google.com> (raw)
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 <tbao@google.com>
---
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.17.0.484.g0c8726318c-goog
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
next reply other threads:[~2018-04-26 8:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 7:40 Tao Bao via Linux-f2fs-devel [this message]
2018-04-30 20:45 ` [PATCH] libf2fs: Track AOSP libsparse API change Jaegeuk Kim
2018-05-04 8:52 ` Chao Yu
2018-05-04 19:16 ` Jaegeuk Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180426074009.36270-1-tbao@google.com \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=jaegeuk@google.com \
--cc=tbao@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).