libsquashfs  1.3.2
A new set of tools and libraries for working with SquashFS images
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 
70 typedef enum {
85 
86  SQFS_DIR_WRITER_CREATE_ALL_FLAGS = 0x01
88 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 
106  sqfs_u32 flags);
107 
119 SQFS_API int sqfs_dir_writer_begin(sqfs_dir_writer_t *writer, sqfs_u32 flags);
120 
137 SQFS_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 
152 SQFS_API int sqfs_dir_writer_end(sqfs_dir_writer_t *writer);
153 
173 SQFS_API size_t sqfs_dir_writer_get_size(const sqfs_dir_writer_t *writer);
174 
187 SQFS_API
189 
203 SQFS_API sqfs_u64
205 
218 SQFS_API size_t sqfs_dir_writer_get_index_size(const sqfs_dir_writer_t *writer);
219 
244 SQFS_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 
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_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_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.
Encapsultes a compressor with a simple interface to compress or extract chunks of data...
Definition: compressor.h:40
The SquashFS super block, located at the beginning of the file system to describe the layout of the f...
Definition: super.h:47
SQFS_DIR_WRITER_CREATE_FLAGS
Flags that can be set for sqfs_dir_writer_create.
Definition: dir_writer.h:70
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.
Abstracts file I/O to make it easy to embedd SquashFS.
Definition: io.h:94
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.
Abstracts generating of meta data blocks, either in memory or directly on disk.
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_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_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_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.
Record all inode locations to create an export table.
Definition: dir_writer.h:84
Abstracts generating of directory entries.
SQFS_API sqfs_u64 sqfs_dir_writer_get_dir_reference(const sqfs_dir_writer_t *writer)
Get the location of the last written directory.
Includes forward declarations of data structures, macros and integer types.
SQFS_API sqfs_dir_writer_t * sqfs_dir_writer_create(sqfs_meta_writer_t *dm, sqfs_u32 flags)
Create a directory writer.
A generic inode structure that combines all others and provides additional information.
Definition: inode.h:488