diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-06-07 23:38:06 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-06-09 06:04:08 +0200 |
commit | 1f210bab667a540379243050b5ce3465086e1124 (patch) | |
tree | 2f3aafe42326cc47a6f5952d3e4bb980ce41e4a1 /lib/sqfs/xattr/xattr_writer.h | |
parent | 04be64583149515f774bf01f03b1be6121649668 (diff) |
Cleanup: split libsquashfs xattr writer code
This commit moves the libsquashfs xattr related code into a sub
directory and splits the xattr writer code up into several files.
No actual code is changed.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/xattr/xattr_writer.h')
-rw-r--r-- | lib/sqfs/xattr/xattr_writer.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/sqfs/xattr/xattr_writer.h b/lib/sqfs/xattr/xattr_writer.h new file mode 100644 index 0000000..826b6f6 --- /dev/null +++ b/lib/sqfs/xattr/xattr_writer.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: LGPL-3.0-or-later */ +/* + * xattr_writer.h + * + * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> + */ +#ifndef XATTR_WRITER_H +#define XATTR_WRITER_H + +#define SQFS_BUILDING_DLL +#include "config.h" + +#include "sqfs/xattr_writer.h" +#include "sqfs/meta_writer.h" +#include "sqfs/super.h" +#include "sqfs/xattr.h" +#include "sqfs/error.h" +#include "sqfs/block.h" +#include "sqfs/io.h" + +#include "str_table.h" +#include "util.h" + +#include <stdlib.h> +#include <string.h> +#include <assert.h> + + +#define XATTR_KEY_BUCKETS 31 +#define XATTR_VALUE_BUCKETS 511 +#define XATTR_INITIAL_PAIR_CAP 128 + +#define MK_PAIR(key, value) (((sqfs_u64)(key) << 32UL) | (sqfs_u64)(value)) +#define GET_KEY(pair) ((pair >> 32UL) & 0x0FFFFFFFFUL) +#define GET_VALUE(pair) (pair & 0x0FFFFFFFFUL) + + +typedef struct kv_block_desc_t { + struct kv_block_desc_t *next; + size_t start; + size_t count; + + sqfs_u64 start_ref; + size_t size_bytes; +} kv_block_desc_t; + +struct sqfs_xattr_writer_t { + sqfs_object_t base; + + str_table_t keys; + str_table_t values; + + sqfs_u64 *kv_pairs; + size_t max_pairs; + size_t num_pairs; + + size_t kv_start; + + kv_block_desc_t *kv_blocks; + size_t num_blocks; +}; + +#endif /* XATTR_WRITER_H */ |