libsquashfs: include/sqfs/block_writer.h Source File

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

Loading...
Searching...
No Matches
block_writer.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-3.0-or-later */
2/*
3 * block_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_BLOCK_WRITER_H
21#define SQFS_BLOCK_WRITER_H
22
23#include "sqfs/predef.h"
24
30
42 struct sqfs_block_writer_t {
43 sqfs_object_t base;
44
76 int (*write_data_block)(sqfs_block_writer_t *wr, void *user,
77 sqfs_u32 size, sqfs_u32 checksum,
78 sqfs_u32 flags, const sqfs_u8 *data,
79 sqfs_u64 *location);
80
90 sqfs_u64 (*get_block_count)(const sqfs_block_writer_t *wr);
91};
92
98 typedef enum {
111 SQFS_BLOCK_WRITER_HASH_COMPARE_ONLY = 0x01,
112
116 SQFS_BLOCK_WRITER_ALL_FLAGS = 0x01
117} SQFS_BLOCK_WRITER_FLAGS;
118
119#ifdef __cplusplus
120extern "C" {
121#endif
122
136SQFS_API sqfs_block_writer_t *sqfs_block_writer_create(sqfs_file_t *file,
137 size_t devblksz,
138 sqfs_u32 flags);
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* SQFS_BLOCK_WRITER_H */
SQFS_BLOCK_WRITER_FLAGS
SQFS_BLOCK_WRITER_FLAGS
Flags that can be passed to sqfs_block_writer_create.
Definition block_writer.h:98
SQFS_BLOCK_WRITER_HASH_COMPARE_ONLY
@ SQFS_BLOCK_WRITER_HASH_COMPARE_ONLY
If set, only compare checksums when deduplicating blocks.
Definition block_writer.h:111
SQFS_BLOCK_WRITER_ALL_FLAGS
@ SQFS_BLOCK_WRITER_ALL_FLAGS
A combination of all valid flags.
Definition block_writer.h:116
predef.h
Includes forward declarations of data structures, macros and integer types.
sqfs_block_writer_t
Abstracts writing and deduplicating of data and fragment blocks.
Definition block_writer.h:42
sqfs_block_writer_t::get_block_count
sqfs_u64(* get_block_count)(const sqfs_block_writer_t *wr)
Get the number of blocks actually written to disk.
Definition block_writer.h:90
sqfs_block_writer_t::sqfs_block_writer_create
SQFS_API sqfs_block_writer_t * sqfs_block_writer_create(sqfs_file_t *file, size_t devblksz, sqfs_u32 flags)
Create an instance of a default block writer implementation.
sqfs_block_writer_t::write_data_block
int(* write_data_block)(sqfs_block_writer_t *wr, void *user, sqfs_u32 size, sqfs_u32 checksum, sqfs_u32 flags, const sqfs_u8 *data, sqfs_u64 *location)
Submit a data block to a block writer.
Definition block_writer.h:76
sqfs_file_t
Abstracts file I/O to make it easy to embedd SquashFS.
Definition io.h:94
sqfs_object_t
Base interface for all libsquashfs in-memory data structures.
Definition predef.h:126