libsquashfs: include/sqfs/dir_writer.h Source File

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

Loading...
Searching...
No Matches
dir_writer.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-3.0-or-later */
2/*
3 * dir_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_DIR_WRITER_H
21#define SQFS_DIR_WRITER_H
22
23#include "sqfs/predef.h"
24
30
64
70 typedef enum {
84 SQFS_DIR_WRITER_CREATE_EXPORT_TABLE = 0x01,
85
86 SQFS_DIR_WRITER_CREATE_ALL_FLAGS = 0x01
87} SQFS_DIR_WRITER_CREATE_FLAGS;
88
89#ifdef __cplusplus
90extern "C" {
91#endif
92
105SQFS_API sqfs_dir_writer_t *sqfs_dir_writer_create(sqfs_meta_writer_t *dm,
106 sqfs_u32 flags);
107
119SQFS_API int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer, sqfs_u32 flags);
120
137SQFS_API int sqfs_dir_writer_add_entry(sqfs_dir_writer_t *writer,
138 const char *name,
139 sqfs_u32 inode_num, sqfs_u64 inode_ref,
140 sqfs_u16 mode);
141
152SQFS_API int sqfs_dir_writer_end(sqfs_dir_writer_t *writer);
153
173SQFS_API size_t sqfs_dir_writer_get_size(const sqfs_dir_writer_t *writer);
174
187SQFS_API
188 size_t sqfs_dir_writer_get_entry_count(const sqfs_dir_writer_t *writer);
189
203SQFS_API sqfs_u64
204sqfs_dir_writer_get_dir_reference(const sqfs_dir_writer_t *writer);
205
218SQFS_API size_t sqfs_dir_writer_get_index_size(const sqfs_dir_writer_t *writer);
219
244SQFS_API sqfs_inode_generic_t
245*sqfs_dir_writer_create_inode(const sqfs_dir_writer_t *writer, size_t hlinks,
246 sqfs_u32 xattr, sqfs_u32 parent_ino);
247
277SQFS_API int sqfs_dir_writer_write_export_table(sqfs_dir_writer_t *writer,
278 sqfs_file_t *file,
279 sqfs_compressor_t *cmp,
280 sqfs_u32 root_inode_num,
281 sqfs_u64 root_inode_ref,
282 sqfs_super_t *super);
283
284#ifdef __cplusplus
285}
286#endif
287
288#endif /* SQFS_DIR_WRITER_H */
SQFS_DIR_WRITER_CREATE_FLAGS
SQFS_DIR_WRITER_CREATE_FLAGS
Flags that can be set for sqfs_dir_writer_create.
Definition dir_writer.h:70
SQFS_DIR_WRITER_CREATE_EXPORT_TABLE
@ SQFS_DIR_WRITER_CREATE_EXPORT_TABLE
Record all inode locations to create an export table.
Definition dir_writer.h:84
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_dir_writer_t
Abstracts generating of directory entries.
sqfs_dir_writer_t::sqfs_dir_writer_add_entry
SQFS_API int sqfs_dir_writer_add_entry(sqfs_dir_writer_t *writer, const char *name, sqfs_u32 inode_num, sqfs_u64 inode_ref, sqfs_u16 mode)
Add add a directory entry.
sqfs_dir_writer_t::sqfs_dir_writer_write_export_table
SQFS_API int sqfs_dir_writer_write_export_table(sqfs_dir_writer_t *writer, sqfs_file_t *file, sqfs_compressor_t *cmp, sqfs_u32 root_inode_num, sqfs_u64 root_inode_ref, sqfs_super_t *super)
Write an export table to a SquashFS image.
sqfs_dir_writer_t::sqfs_dir_writer_get_size
SQFS_API size_t sqfs_dir_writer_get_size(const sqfs_dir_writer_t *writer)
Get the total, uncompressed size of the last written directory in bytes.
sqfs_dir_writer_t::sqfs_dir_writer_begin
SQFS_API int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer, sqfs_u32 flags)
Begin writing a directory, i.e. reset and initialize all internal state neccessary.
sqfs_dir_writer_t::sqfs_dir_writer_end
SQFS_API int sqfs_dir_writer_end(sqfs_dir_writer_t *writer)
Finish writing a directory listing and write everything out to the meta data writer.
sqfs_dir_writer_t::sqfs_dir_writer_get_entry_count
SQFS_API size_t sqfs_dir_writer_get_entry_count(const sqfs_dir_writer_t *writer)
Get the numer of entries written to the last directory.
sqfs_dir_writer_t::sqfs_dir_writer_get_dir_reference
SQFS_API sqfs_u64 sqfs_dir_writer_get_dir_reference(const sqfs_dir_writer_t *writer)
Get the location of the last written directory.
sqfs_dir_writer_t::sqfs_dir_writer_get_index_size
SQFS_API size_t sqfs_dir_writer_get_index_size(const sqfs_dir_writer_t *writer)
Get the size of the index of the last written directory.
sqfs_dir_writer_t::sqfs_dir_writer_create_inode
SQFS_API sqfs_inode_generic_t * sqfs_dir_writer_create_inode(const sqfs_dir_writer_t *writer, size_t hlinks, sqfs_u32 xattr, sqfs_u32 parent_ino)
Helper function for creating an inode from the last directory.
sqfs_dir_writer_t::sqfs_dir_writer_create
SQFS_API sqfs_dir_writer_t * sqfs_dir_writer_create(sqfs_meta_writer_t *dm, sqfs_u32 flags)
Create a directory writer.
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_super_t
The SquashFS super block, located at the beginning of the file system to describe the layout of the f...
Definition super.h:47