libsquashfs: include/sqfs/meta_writer.h Source File

libsquashfs 1.3.2 A new set of tools and libraries for working with SquashFS images

Loading...
Searching...
No Matches
meta_writer.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-3.0-or-later */
2/*
3 * meta_writer.h - This file is part of libsquashfs
4 *
5 * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20#ifndef SQFS_META_WRITER_H
21#define SQFS_META_WRITER_H
22
23#include "sqfs/predef.h"
24
30
52
58 typedef enum {
65 SQFS_META_WRITER_KEEP_IN_MEMORY = 0x01,
66
67 SQFS_META_WRITER_ALL_FLAGS = 0x01,
68} SQFS_META_WRITER_FLAGS;
69
70#ifdef __cplusplus
71extern "C" {
72#endif
73
90SQFS_API sqfs_meta_writer_t *sqfs_meta_writer_create(sqfs_file_t *file,
91 sqfs_compressor_t *cmp,
92 sqfs_u32 flags);
93
108SQFS_API int sqfs_meta_writer_flush(sqfs_meta_writer_t *m);
109
126SQFS_API int sqfs_meta_writer_append(sqfs_meta_writer_t *m, const void *data,
127 size_t size);
128
144SQFS_API void sqfs_meta_writer_get_position(const sqfs_meta_writer_t *m,
145 sqfs_u64 *block_start,
146 sqfs_u32 *offset);
147
159SQFS_API void sqfs_meta_writer_reset(sqfs_meta_writer_t *m);
160
172SQFS_API int sqfs_meta_write_write_to_file(sqfs_meta_writer_t *m);
173
189SQFS_API int sqfs_meta_writer_write_inode(sqfs_meta_writer_t *iw,
190 const sqfs_inode_generic_t *n);
191
192#ifdef __cplusplus
193}
194#endif
195
196#endif /* SQFS_META_WRITER_H */
SQFS_META_WRITER_FLAGS
SQFS_META_WRITER_FLAGS
Possible flags for sqfs_meta_writer_create.
Definition meta_writer.h:58
SQFS_META_WRITER_KEEP_IN_MEMORY
@ SQFS_META_WRITER_KEEP_IN_MEMORY
If set, keep finished blocks in memory.
Definition meta_writer.h:65
predef.h
Includes forward declarations of data structures, macros and integer types.
sqfs_compressor_t
Encapsultes a compressor with a simple interface to compress or extract chunks of data.
Definition compressor.h:40
sqfs_file_t
Abstracts file I/O to make it easy to embedd SquashFS.
Definition io.h:94
sqfs_inode_generic_t
A generic inode structure that combines all others and provides additional information.
Definition inode.h:488
sqfs_meta_writer_t
Abstracts generating of meta data blocks, either in memory or directly on disk.
sqfs_meta_writer_t::sqfs_meta_writer_get_position
SQFS_API void sqfs_meta_writer_get_position(const sqfs_meta_writer_t *m, sqfs_u64 *block_start, sqfs_u32 *offset)
Query the current block start position and offset within the block.
sqfs_meta_writer_t::sqfs_meta_writer_create
SQFS_API sqfs_meta_writer_t * sqfs_meta_writer_create(sqfs_file_t *file, sqfs_compressor_t *cmp, sqfs_u32 flags)
Create a meta data writer.
sqfs_meta_writer_t::sqfs_meta_writer_write_inode
SQFS_API int sqfs_meta_writer_write_inode(sqfs_meta_writer_t *iw, const sqfs_inode_generic_t *n)
A convenience function for encoding and writing an inode.
sqfs_meta_writer_t::sqfs_meta_writer_append
SQFS_API int sqfs_meta_writer_append(sqfs_meta_writer_t *m, const void *data, size_t size)
Finish the current block, even if it isn't full yet.
sqfs_meta_writer_t::sqfs_meta_writer_flush
SQFS_API int sqfs_meta_writer_flush(sqfs_meta_writer_t *m)
Finish the current block, even if it isn't full yet.
sqfs_meta_writer_t::sqfs_meta_write_write_to_file
SQFS_API int sqfs_meta_write_write_to_file(sqfs_meta_writer_t *m)
Write all blocks collected in memory to disk.
sqfs_meta_writer_t::sqfs_meta_writer_reset
SQFS_API void sqfs_meta_writer_reset(sqfs_meta_writer_t *m)
Reset all internal state, including the current block start position.