Skip to contentSkip to conversation

libf2fs: Track AOSP libsparse API change.

PATCH In review Tao Bao via Linux-f2fs-devel 3 participants 4 messages Apr 26, 2018 – May 4, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 lib/libf2fs_io.c | 5 +++++
 1 file changed, 5 insertions(+)
lib/libf2fs_io.c +5 -0
index 4781517..76d283d 100644
@@ -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)
Signature · 6 lines
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
#1 lore raw

Merged.
Thanks,

Quoted 43 lines · On 04/26, Tao Bao via Linux-f2fs-devel wrote:

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.

---
 lib/libf2fs_io.c | 5 +++++
 1 file changed, 5 insertions(+)
lib/libf2fs_io.c +5 -0
index 4781517..76d283d 100644
@@ -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)
Signature · 10 lines
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
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Reviewed-by on v1 1/1
#2 lore raw
In reply to Tao Bao via Linux-f2fs-devel
Quoted 10 lines · On 2018/4/26 15:40, Tao Bao via Linux-f2fs-devel wrote:

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.

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#3 lore raw
Quoted 6 lines · Chao Yu
Quoted 5 lines · On 2018/4/26 15:40, Tao Bao via Linux-f2fs-devel wrote:

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.

Quoted 7 lines
Quoted 5 lines

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.

Merged already.

Quoted 11 lines

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot