From a68eb730558fb90bc8d9524564d8f9e58f3ccac1 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 7 Oct 2019 11:20:55 +0200 Subject: Improve ABI backward & forward compatibillity - Padd the compressor config union - 128 bytes aught to be enough for everyone, i.e. future compressors. - Insist that the padding space is initialized to 0. If a field gets added to an existing compressor, it can test for 0 as a sentinel value. - Add a size field to the hook structure, aka "the Microsoft way". - The explanation is in the comment. - Don't make the Microsoft mistake of checking for >=, insist on *exact* size match. Future users will need a fallback if their hooks are rejected. But at least they will be rejected instead of silently not being used. - Add an unsupported flag check to the dir tree reader. - Add a basic abi unit test that, for now, checks the size of the compressor config struct fields. Signed-off-by: David Oberhollenzer --- lib/sqfshelper/statistics.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/sqfshelper') diff --git a/lib/sqfshelper/statistics.c b/lib/sqfshelper/statistics.c index 3f9f595..fb70615 100644 --- a/lib/sqfshelper/statistics.c +++ b/lib/sqfshelper/statistics.c @@ -55,6 +55,7 @@ static void notify_fragment_discard(void *user, const sqfs_block_t *block) } static const sqfs_block_hooks_t hooks = { + .size = sizeof(hooks), .post_block_write = post_block_write, .pre_fragment_store = pre_fragment_store, .notify_blocks_erased = notify_blocks_erased, -- cgit v1.2.3