1use libc::{mode_t, time_t, FILE};
4
5#[doc = " typedef used for indexing"]
6pub type sqsh_index_t = usize;
7#[repr(transparent)]
8#[doc = " The compression used in the archive."]
9#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
10pub struct SqshSuperblockCompressionId(pub ::core::ffi::c_uint);
11#[repr(transparent)]
12#[doc = " The flags used in the superblock."]
13#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
14pub struct SqshSuperblockFlags(pub ::core::ffi::c_uint);
15#[repr(transparent)]
16#[doc = " definitions of gzip strategies"]
17#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
18pub struct SqshGzipStrategies(pub ::core::ffi::c_uint);
19#[repr(transparent)]
20#[doc = " definitions xz filters"]
21#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
22pub struct SqshXzFilters(pub ::core::ffi::c_uint);
23#[repr(transparent)]
24#[doc = " definitions of lz4 flags"]
25#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
26pub struct SqshLz4Flags(pub ::core::ffi::c_uint);
27#[repr(transparent)]
28#[doc = " definitions of Lzo algorithms"]
29#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
30pub struct SqshLzoAlgorithm(pub ::core::ffi::c_uint);
31#[repr(transparent)]
32#[doc = " The type of an external attribute."]
33#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
34pub struct SqshXattrType(pub ::core::ffi::c_uint);
35#[repr(C)]
36#[derive(Debug, Copy, Clone)]
37pub struct SqshInodeMap {
38 _unused: [u8; 0],
39}
40#[doc = " table/id_table.c"]
41#[repr(C)]
42#[derive(Debug, Copy, Clone)]
43pub struct SqshIdTable {
44 _unused: [u8; 0],
45}
46#[doc = " table/export_table.c"]
47#[repr(C)]
48#[derive(Debug, Copy, Clone)]
49pub struct SqshExportTable {
50 _unused: [u8; 0],
51}
52#[repr(C)]
53#[derive(Debug, Copy, Clone)]
54pub struct SqshXattrTable {
55 _unused: [u8; 0],
56}
57#[repr(C)]
58#[derive(Debug, Copy, Clone)]
59pub struct SqshFragmentTable {
60 _unused: [u8; 0],
61}
62#[doc = " archive/trailing_context.c"]
63#[repr(C)]
64#[derive(Debug, Copy, Clone)]
65pub struct SqshTrailingContext {
66 _unused: [u8; 0],
67}
68#[doc = " archive/superblock_context.c"]
69#[repr(C)]
70#[derive(Debug, Copy, Clone)]
71pub struct SqshSuperblock {
72 _unused: [u8; 0],
73}
74#[doc = " The SqshConfig struct contains all the configuration options for\n a sqsh session."]
75#[repr(C)]
76#[derive(Debug, Copy, Clone)]
77pub struct SqshConfig {
78 #[doc = " represents the offset in bytes where the sqsh_archive\n will start."]
79 pub archive_offset: u64,
80 #[doc = " represents the addressable size of the source in bytes.\n\n Please note that this is not the size of the archive, but the size of the\n source. So that the maximal size of the archive is `source_size -\n archive_offset`.\n\n This field is only used when the source_mapper is unable to determine the\n size of the source itself. This is the case for the following mappers:\n\n - `sqsh_mapper_impl_static`"]
81 pub source_size: u64,
82 #[doc = " source_mapper is the memory mapper implementation that will be\n used to map the archive.\n\n - `sqsh_mapper_impl_mmap`: the archive will be loaded from a file. The\n source will be interpreted as a file path. this is the default.\n - `sqsh_mapper_impl_static`: the archive will be interpreted from a\n static buffer.\n - `sqsh_mapper_impl_curl`: the archive will be loaded from a remote\n location. The source will be interpreted as a URL."]
83 pub source_mapper: *const SqshMemoryMapperImpl,
84 #[doc = " the block size used to retrieve chunks of data from the mapper.\n If unset or 0, the block size will be determined by the mapper."]
85 pub mapper_block_size: ::core::ffi::c_int,
86 #[doc = " the size of the LRU cache used to cache chunks of data from the\n mapper. If unset or 0, the LRU defaults to 32. if set to -1, the LRU\n will be disabled."]
87 pub mapper_lru_size: ::core::ffi::c_int,
88 #[doc = " the size of the LRU cache used to cache chunks of data from the\n compression algorithm. If unset or 0, the LRU defaults to 128. if set to\n -1, the LRU will be disabled."]
89 pub compression_lru_size: ::core::ffi::c_int,
90 #[doc = " the maximum depth of symlinks that will be followed. If unset or\n 0, the max symlink depth will be 100."]
91 pub max_symlink_depth: usize,
92 #[doc = "<div class=\"warning\">PRIVATE</div>"]
93 pub _reserved: [::core::ffi::c_char; 128usize],
94}
95#[doc = " The Sqsh struct contains all information about the current\n sqsh session."]
96#[repr(C)]
97#[derive(Debug, Copy, Clone)]
98pub struct SqshArchive {
99 _unused: [u8; 0],
100}
101#[repr(C)]
102#[derive(Debug, Copy, Clone)]
103pub struct SqshMapManager {
104 _unused: [u8; 0],
105}
106#[repr(C)]
107#[derive(Debug, Copy, Clone)]
108pub struct SqshCompressionOptions {
109 _unused: [u8; 0],
110}
111#[repr(C)]
112#[derive(Debug, Copy, Clone)]
113pub struct SqshFile {
114 _unused: [u8; 0],
115}
116#[doc = " The file reader allows to read user defined byte ranges from a file\n inside of a SqshArchive."]
117#[repr(C)]
118#[derive(Debug, Copy, Clone)]
119pub struct SqshFileReader {
120 _unused: [u8; 0],
121}
122#[doc = " file/file_iterator.c"]
123#[repr(C)]
124#[derive(Debug, Copy, Clone)]
125pub struct SqshFileIterator {
126 _unused: [u8; 0],
127}
128#[repr(transparent)]
129#[doc = " enum that represents the file type."]
130#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
131pub struct SqshFileType(pub ::core::ffi::c_int);
132#[doc = " iterator/directory_iterator.c"]
133#[repr(C)]
134#[derive(Debug, Copy, Clone)]
135pub struct SqshDirectoryIterator {
136 _unused: [u8; 0],
137}
138#[repr(transparent)]
139#[doc = " Error codes for sqsh."]
140#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
141pub struct SqshError(pub ::core::ffi::c_uint);
142#[doc = " mapper/mapper.c"]
143#[repr(C)]
144#[derive(Debug, Copy, Clone)]
145pub struct SqshMapper {
146 _unused: [u8; 0],
147}
148#[doc = " The implementation of a memory mapper."]
149#[repr(C)]
150#[derive(Debug, Copy, Clone)]
151pub struct SqshMemoryMapperImpl {
152 #[doc = " A hint to libsqsh to use this block size if the user did not\n specify one."]
153 pub block_size_hint: usize,
154 #[doc = " The initialization function for the mapper. Use\n sqsh_mapper_set_user_data() to set custom user data."]
155 pub init: ::core::option::Option<
156 unsafe extern "C" fn(
157 mapper: *mut SqshMapper,
158 input: *const ::core::ffi::c_void,
159 size: *mut usize,
160 ) -> ::core::ffi::c_int,
161 >,
162 #[doc = " The function that maps a block of data into memory."]
163 pub map: ::core::option::Option<
164 unsafe extern "C" fn(
165 mapper: *const SqshMapper,
166 offset: sqsh_index_t,
167 size: usize,
168 data: *mut *mut u8,
169 ) -> ::core::ffi::c_int,
170 >,
171 #[doc = " The function that unmaps a block of data from memory."]
172 pub unmap: ::core::option::Option<
173 unsafe extern "C" fn(
174 mapper: *const SqshMapper,
175 data: *mut u8,
176 size: usize,
177 ) -> ::core::ffi::c_int,
178 >,
179 #[doc = " The cleanup function for the mapper."]
180 pub cleanup:
181 ::core::option::Option<unsafe extern "C" fn(mapper: *mut SqshMapper) -> ::core::ffi::c_int>,
182}
183#[doc = " table/table.c"]
184#[repr(C)]
185#[derive(Debug, Copy, Clone)]
186pub struct SqshTable {
187 _unused: [u8; 0],
188}
189#[doc = " tree/path_resolver.c"]
190#[repr(C)]
191#[derive(Debug, Copy, Clone)]
192pub struct SqshPathResolver {
193 _unused: [u8; 0],
194}
195#[doc = " tree/walker.c"]
196#[repr(C)]
197#[derive(Debug, Copy, Clone)]
198pub struct SqshTreeWalker {
199 _unused: [u8; 0],
200}
201#[repr(transparent)]
202#[doc = " The state of the tree traversal."]
203#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
204pub struct SqshTreeTraversalState(pub ::core::ffi::c_uint);
205#[repr(C)]
206#[derive(Debug, Copy, Clone)]
207pub struct SqshTreeTraversal {
208 _unused: [u8; 0],
209}
210#[doc = " xattr/xattr_iterator.c"]
211#[repr(C)]
212#[derive(Debug, Copy, Clone)]
213pub struct SqshXattrIterator {
214 _unused: [u8; 0],
215}
216pub const SQSH_INODE_NO_FRAGMENT: u32 = 4294967295;
217pub const SQSH_INODE_NO_XATTR: u32 = 4294967295;
218impl SqshSuperblockCompressionId {
219 pub const SQSH_COMPRESSION_GZIP: SqshSuperblockCompressionId = SqshSuperblockCompressionId(1);
220}
221impl SqshSuperblockCompressionId {
222 pub const SQSH_COMPRESSION_LZMA: SqshSuperblockCompressionId = SqshSuperblockCompressionId(2);
223}
224impl SqshSuperblockCompressionId {
225 pub const SQSH_COMPRESSION_LZO: SqshSuperblockCompressionId = SqshSuperblockCompressionId(3);
226}
227impl SqshSuperblockCompressionId {
228 pub const SQSH_COMPRESSION_XZ: SqshSuperblockCompressionId = SqshSuperblockCompressionId(4);
229}
230impl SqshSuperblockCompressionId {
231 pub const SQSH_COMPRESSION_LZ4: SqshSuperblockCompressionId = SqshSuperblockCompressionId(5);
232}
233impl SqshSuperblockCompressionId {
234 pub const SQSH_COMPRESSION_ZSTD: SqshSuperblockCompressionId = SqshSuperblockCompressionId(6);
235}
236impl SqshSuperblockFlags {
237 pub const SQSH_SUPERBLOCK_UNCOMPRESSED_INODES: SqshSuperblockFlags = SqshSuperblockFlags(1);
238}
239impl SqshSuperblockFlags {
240 pub const SQSH_SUPERBLOCK_UNCOMPRESSED_DATA: SqshSuperblockFlags = SqshSuperblockFlags(2);
241}
242impl SqshSuperblockFlags {
243 pub const SQSH_SUPERBLOCK_CHECK: SqshSuperblockFlags = SqshSuperblockFlags(4);
244}
245impl SqshSuperblockFlags {
246 pub const SQSH_SUPERBLOCK_UNCOMPRESSED_FRAGMENTS: SqshSuperblockFlags = SqshSuperblockFlags(8);
247}
248impl SqshSuperblockFlags {
249 pub const SQSH_SUPERBLOCK_NO_FRAGMENTS: SqshSuperblockFlags = SqshSuperblockFlags(16);
250}
251impl SqshSuperblockFlags {
252 pub const SQSH_SUPERBLOCK_ALWAYS_FRAGMENTS: SqshSuperblockFlags = SqshSuperblockFlags(32);
253}
254impl SqshSuperblockFlags {
255 pub const SQSH_SUPERBLOCK_DUPLICATES: SqshSuperblockFlags = SqshSuperblockFlags(64);
256}
257impl SqshSuperblockFlags {
258 pub const SQSH_SUPERBLOCK_EXPORTABLE: SqshSuperblockFlags = SqshSuperblockFlags(128);
259}
260impl SqshSuperblockFlags {
261 pub const SQSH_SUPERBLOCK_UNCOMPRESSED_XATTRS: SqshSuperblockFlags = SqshSuperblockFlags(256);
262}
263impl SqshSuperblockFlags {
264 pub const SQSH_SUPERBLOCK_NO_XATTRS: SqshSuperblockFlags = SqshSuperblockFlags(512);
265}
266impl SqshSuperblockFlags {
267 pub const SQSH_SUPERBLOCK_COMPRESSOR_OPTIONS: SqshSuperblockFlags = SqshSuperblockFlags(1024);
268}
269impl SqshSuperblockFlags {
270 pub const SQSH_SUPERBLOCK_UNCOMPRESSED_IDS: SqshSuperblockFlags = SqshSuperblockFlags(2048);
271}
272impl SqshGzipStrategies {
273 pub const SQSH_GZIP_STRATEGY_NONE: SqshGzipStrategies = SqshGzipStrategies(0);
274}
275impl SqshGzipStrategies {
276 pub const SQSH_GZIP_STRATEGY_DEFAULT: SqshGzipStrategies = SqshGzipStrategies(1);
277}
278impl SqshGzipStrategies {
279 pub const SQSH_GZIP_STRATEGY_FILTERED: SqshGzipStrategies = SqshGzipStrategies(2);
280}
281impl SqshGzipStrategies {
282 pub const SQSH_GZIP_STRATEGY_HUFFMAN_ONLY: SqshGzipStrategies = SqshGzipStrategies(4);
283}
284impl SqshGzipStrategies {
285 pub const SQSH_GZIP_STRATEGY_RLE: SqshGzipStrategies = SqshGzipStrategies(8);
286}
287impl SqshGzipStrategies {
288 pub const SQSH_GZIP_STRATEGY_FIXED: SqshGzipStrategies = SqshGzipStrategies(16);
289}
290impl SqshXzFilters {
291 pub const SQSH_XZ_FILTER_NONE: SqshXzFilters = SqshXzFilters(0);
292}
293impl SqshXzFilters {
294 pub const SQSH_XZ_FILTER_X86: SqshXzFilters = SqshXzFilters(1);
295}
296impl SqshXzFilters {
297 pub const SQSH_XZ_FILTER_POWERPC: SqshXzFilters = SqshXzFilters(2);
298}
299impl SqshXzFilters {
300 pub const SQSH_XZ_FILTER_IA64: SqshXzFilters = SqshXzFilters(4);
301}
302impl SqshXzFilters {
303 pub const SQSH_XZ_FILTER_ARM: SqshXzFilters = SqshXzFilters(8);
304}
305impl SqshXzFilters {
306 pub const SQSH_XZ_FILTER_ARMTHUMB: SqshXzFilters = SqshXzFilters(16);
307}
308impl SqshXzFilters {
309 pub const SQSH_XZ_FILTER_SPARC: SqshXzFilters = SqshXzFilters(32);
310}
311impl SqshLz4Flags {
312 pub const SQS_LZ4_FLAG_NONE: SqshLz4Flags = SqshLz4Flags(0);
313}
314impl SqshLz4Flags {
315 pub const SQSH_LZ4_HIGH_COMPRESSION: SqshLz4Flags = SqshLz4Flags(1);
316}
317impl SqshLzoAlgorithm {
318 pub const SQSH_LZO_ALGORITHM_LZO1X_1: SqshLzoAlgorithm = SqshLzoAlgorithm(0);
319}
320impl SqshLzoAlgorithm {
321 pub const SQSH_LZO_ALGORITHM_LZO1X_1_11: SqshLzoAlgorithm = SqshLzoAlgorithm(1);
322}
323impl SqshLzoAlgorithm {
324 pub const SQSH_LZO_ALGORITHM_LZO1X_1_12: SqshLzoAlgorithm = SqshLzoAlgorithm(2);
325}
326impl SqshLzoAlgorithm {
327 pub const SQSH_LZO_ALGORITHM_LZO1X_1_15: SqshLzoAlgorithm = SqshLzoAlgorithm(3);
328}
329impl SqshLzoAlgorithm {
330 pub const SQSH_LZO_ALGORITHM_LZO1X_999: SqshLzoAlgorithm = SqshLzoAlgorithm(4);
331}
332impl SqshXattrType {
333 pub const SQSH_XATTR_USER: SqshXattrType = SqshXattrType(0);
334}
335impl SqshXattrType {
336 pub const SQSH_XATTR_TRUSTED: SqshXattrType = SqshXattrType(1);
337}
338impl SqshXattrType {
339 pub const SQSH_XATTR_SECURITY: SqshXattrType = SqshXattrType(2);
340}
341impl SqshFileType {
342 pub const SQSH_FILE_TYPE_UNKNOWN: SqshFileType = SqshFileType(-1);
343}
344impl SqshFileType {
345 pub const SQSH_FILE_TYPE_DIRECTORY: SqshFileType = SqshFileType(257);
346}
347impl SqshFileType {
348 pub const SQSH_FILE_TYPE_FILE: SqshFileType = SqshFileType(258);
349}
350impl SqshFileType {
351 pub const SQSH_FILE_TYPE_SYMLINK: SqshFileType = SqshFileType(259);
352}
353impl SqshFileType {
354 pub const SQSH_FILE_TYPE_BLOCK: SqshFileType = SqshFileType(260);
355}
356impl SqshFileType {
357 pub const SQSH_FILE_TYPE_CHAR: SqshFileType = SqshFileType(261);
358}
359impl SqshFileType {
360 pub const SQSH_FILE_TYPE_FIFO: SqshFileType = SqshFileType(262);
361}
362impl SqshFileType {
363 pub const SQSH_FILE_TYPE_SOCKET: SqshFileType = SqshFileType(263);
364}
365impl SqshError {
366 pub const SQSH_SUCCESS: SqshError = SqshError(0);
367}
368impl SqshError {
369 pub const SQSH_ERROR_SECTION_START: SqshError = SqshError(256);
370}
371impl SqshError {
372 pub const SQSH_ERROR_SUPERBLOCK_TOO_SMALL: SqshError = SqshError(257);
373}
374impl SqshError {
375 pub const SQSH_ERROR_WRONG_MAGIC: SqshError = SqshError(258);
376}
377impl SqshError {
378 pub const SQSH_ERROR_BLOCKSIZE_MISMATCH: SqshError = SqshError(259);
379}
380impl SqshError {
381 pub const SQSH_ERROR_SIZE_MISMATCH: SqshError = SqshError(260);
382}
383impl SqshError {
384 pub const SQSH_ERROR_COMPRESSION_INIT: SqshError = SqshError(261);
385}
386impl SqshError {
387 pub const SQSH_ERROR_COMPRESSION_UNSUPPORTED: SqshError = SqshError(262);
388}
389impl SqshError {
390 pub const SQSH_ERROR_COMPRESSION_DECOMPRESS: SqshError = SqshError(263);
391}
392impl SqshError {
393 pub const SQSH_ERROR_UNKNOWN_FILE_TYPE: SqshError = SqshError(264);
394}
395impl SqshError {
396 #[deprecated]
397 #[doc = " Since 1.1.0. Use SQSH_ERROR_UNKNOWN_FILE_TYPE instead."]
398 pub const SQSH_ERROR_UNKOWN_FILE_TYPE: SqshError = SqshError(264);
399}
400impl SqshError {
401 pub const SQSH_ERROR_NOT_A_DIRECTORY: SqshError = SqshError(265);
402}
403impl SqshError {
404 pub const SQSH_ERROR_NOT_A_FILE: SqshError = SqshError(266);
405}
406impl SqshError {
407 pub const SQSH_ERROR_MALLOC_FAILED: SqshError = SqshError(267);
408}
409impl SqshError {
410 pub const SQSH_ERROR_MUTEX_INIT_FAILED: SqshError = SqshError(268);
411}
412impl SqshError {
413 pub const SQSH_ERROR_MUTEX_LOCK_FAILED: SqshError = SqshError(269);
414}
415impl SqshError {
416 pub const SQSH_ERROR_MUTEX_DESTROY_FAILED: SqshError = SqshError(270);
417}
418impl SqshError {
419 pub const SQSH_ERROR_OUT_OF_BOUNDS: SqshError = SqshError(271);
420}
421impl SqshError {
422 pub const SQSH_ERROR_INTEGER_OVERFLOW: SqshError = SqshError(272);
423}
424impl SqshError {
425 pub const SQSH_ERROR_NO_SUCH_FILE: SqshError = SqshError(273);
426}
427impl SqshError {
428 pub const SQSH_ERROR_NO_SUCH_XATTR: SqshError = SqshError(274);
429}
430impl SqshError {
431 pub const SQSH_ERROR_NO_FRAGMENT_TABLE: SqshError = SqshError(275);
432}
433impl SqshError {
434 pub const SQSH_ERROR_NO_EXTENDED_DIRECTORY: SqshError = SqshError(276);
435}
436impl SqshError {
437 pub const SQSH_ERROR_NO_EXPORT_TABLE: SqshError = SqshError(277);
438}
439impl SqshError {
440 pub const SQSH_ERROR_NO_XATTR_TABLE: SqshError = SqshError(278);
441}
442impl SqshError {
443 pub const SQSH_ERROR_NO_COMPRESSION_OPTIONS: SqshError = SqshError(279);
444}
445impl SqshError {
446 pub const SQSH_ERROR_MAPPER_INIT: SqshError = SqshError(280);
447}
448impl SqshError {
449 pub const SQSH_ERROR_MAPPER_MAP: SqshError = SqshError(281);
450}
451impl SqshError {
452 pub const SQSH_ERROR_CURL_INVALID_RANGE_HEADER: SqshError = SqshError(282);
453}
454impl SqshError {
455 pub const SQSL_ERROR_ELEMENT_NOT_FOUND: SqshError = SqshError(283);
456}
457impl SqshError {
458 pub const SQSH_ERROR_INVALID_ARGUMENT: SqshError = SqshError(284);
459}
460impl SqshError {
461 pub const SQSH_ERROR_WALKER_CANNOT_GO_UP: SqshError = SqshError(285);
462}
463impl SqshError {
464 pub const SQSH_ERROR_WALKER_CANNOT_GO_DOWN: SqshError = SqshError(286);
465}
466impl SqshError {
467 pub const SQSH_ERROR_CORRUPTED_INODE: SqshError = SqshError(287);
468}
469impl SqshError {
470 pub const SQSH_ERROR_CORRUPTED_DIRECTORY_ENTRY: SqshError = SqshError(288);
471}
472impl SqshError {
473 pub const SQSH_ERROR_INTERNAL: SqshError = SqshError(289);
474}
475impl SqshError {
476 pub const SQSH_ERROR_INODE_MAP_IS_INCONSISTENT: SqshError = SqshError(290);
477}
478impl SqshError {
479 pub const SQSH_ERROR_XATTR_SIZE_MISMATCH: SqshError = SqshError(291);
480}
481impl SqshError {
482 pub const SQSH_ERROR_UNSUPPORTED_VERSION: SqshError = SqshError(292);
483}
484impl SqshError {
485 pub const SQSH_ERROR_TOO_MANY_SYMLINKS_FOLLOWED: SqshError = SqshError(293);
486}
487impl SqshError {
488 pub const SQSH_ERROR_CORRUPTED_DIRECTORY_HEADER: SqshError = SqshError(294);
489}
490impl SqshError {
491 pub const SQSH_ERROR_COMPRESSION_FINISHED: SqshError = SqshError(295);
492}
493impl SqshError {
494 pub const SQSH_ERROR_NO_SUCH_ELEMENT: SqshError = SqshError(296);
495}
496impl SqshError {
497 pub const SQSH_ERROR_DIRECTORY_RECURSION: SqshError = SqshError(297);
498}
499impl SqshError {
500 pub const SQSH_ERROR_INODE_PARENT_MISMATCH: SqshError = SqshError(298);
501}
502impl SqshError {
503 pub const SQSH_ERROR_INODE_PARENT_UNSET: SqshError = SqshError(299);
504}
505impl SqshError {
506 pub const SQSH_ERROR_NOT_A_SYMLINK: SqshError = SqshError(300);
507}
508impl SqshTreeTraversalState {
509 #[doc = " The traversal is in the initial state, right after initialization."]
510 pub const SQSH_TREE_TRAVERSAL_STATE_INIT: SqshTreeTraversalState = SqshTreeTraversalState(0);
511}
512impl SqshTreeTraversalState {
513 #[doc = " The traversal iterator is currently pointing at a file object. This\n includes special files like named pipes, symlinks, or devices but not\n directories."]
514 pub const SQSH_TREE_TRAVERSAL_STATE_FILE: SqshTreeTraversalState = SqshTreeTraversalState(1);
515}
516impl SqshTreeTraversalState {
517 #[doc = " The traversal iterator is currently pointing at a directory object, right\n before SqshTreeTraversal is about to descend into it."]
518 pub const SQSH_TREE_TRAVERSAL_STATE_DIRECTORY_BEGIN: SqshTreeTraversalState =
519 SqshTreeTraversalState(2);
520}
521impl SqshTreeTraversalState {
522 #[doc = " The traversal iterator is currently pointing at a directory object, after\n SqshTreeTraversal has finised iterating over it."]
523 pub const SQSH_TREE_TRAVERSAL_STATE_DIRECTORY_END: SqshTreeTraversalState =
524 SqshTreeTraversalState(3);
525}
526extern "C" {
527 #[doc = "\n Retrieves the size of the trailing data in a context.\n\n# Arguments\n- context The context to retrieve the size from.\n\n# Returns\n The size of the trailing data in the context."]
528 pub fn sqsh_trailing_size(context: *const SqshTrailingContext) -> usize;
529 #[doc = "\n Retrieves the trailing data in a context.\n\n# Arguments\n- context The context to retrieve the data from.\n\n# Returns\n The trailing data in the context."]
530 pub fn sqsh_trailing_data(context: *const SqshTrailingContext) -> *const u8;
531 #[must_use]
532 #[deprecated]
533 #[doc = " Since 1.2.0. Use sqsh_inode_map_get2() instead.\n\n Gets the inode reference for a given inode number.\n\n# Arguments\n- map The context to use.\n- inode_number The inode number to get the reference for.\n\n# Returns\n The inode reference on success, 0 on error."]
534 pub fn sqsh_inode_map_get(map: *const SqshInodeMap, inode_number: u64) -> u64;
535 #[must_use]
536 #[doc = "\n Gets the inode reference for a given inode number.\n\n# Arguments\n- map The context to use.\n- inode_number The inode number to get the reference for.\n- err Pointer to an int where the error code will be\n stored.\n\n# Returns\n The inode reference on success, 0 on error."]
537 pub fn sqsh_inode_map_get2(
538 map: *const SqshInodeMap,
539 inode_number: u32,
540 err: *mut ::core::ffi::c_int,
541 ) -> u64;
542 #[must_use]
543 #[deprecated]
544 #[doc = " Since 1.2.0. Use sqsh_inode_map_set2() instead.\n\n Sets the inode reference for a given inode number.\n\n# Arguments\n- map The context to use.\n- inode_number The inode number to set the reference for.\n- inode_ref The inode reference to set.\n\n# Returns\n 0 on success, a negative value on error."]
545 pub fn sqsh_inode_map_set(
546 map: *mut SqshInodeMap,
547 inode_number: u64,
548 inode_ref: u64,
549 ) -> ::core::ffi::c_int;
550 #[must_use]
551 #[doc = "\n Sets the inode reference for a given inode number.\n\n# Arguments\n- map The context to use.\n- inode_number The inode number to set the reference for.\n- inode_ref The inode reference to set.\n\n# Returns\n 0 on success, a negative value on error."]
552 pub fn sqsh_inode_map_set2(
553 map: *mut SqshInodeMap,
554 inode_number: u32,
555 inode_ref: u64,
556 ) -> ::core::ffi::c_int;
557 #[doc = "\n Retrieves the compression id of a superblock context.\n\n# Arguments\n- context The superblock context to retrieve the compression id\n from.\n\n# Returns\n The compression id of the superblock context."]
558 pub fn sqsh_superblock_compression_id(
559 context: *const SqshSuperblock,
560 ) -> SqshSuperblockCompressionId;
561 #[doc = "\n Retrieves the start offset of the directory table in a superblock\n context.\n\n# Arguments\n- context The superblock context to retrieve the directory table\n start offset from.\n\n# Returns\n The start offset of the directory table in the superblock context."]
562 pub fn sqsh_superblock_directory_table_start(context: *const SqshSuperblock) -> u64;
563 #[doc = "\n Retrieves the start offset of the fragment table in a superblock\n context.\n\n# Arguments\n- context The superblock context to retrieve the fragment table\n start offset from.\n\n# Returns\n The start offset of the fragment table in the superblock context."]
564 pub fn sqsh_superblock_fragment_table_start(context: *const SqshSuperblock) -> u64;
565 #[doc = "\n Retrieves the number of inodes in an archive.\n\n# Arguments\n- context The superblock context to retrieve the inode count from.\n\n# Returns\n The number of inodes in the superblock context."]
566 pub fn sqsh_superblock_inode_count(context: *const SqshSuperblock) -> u32;
567 #[doc = "\n Retrieves the major version of an archive.\n\n# Arguments\n- superblock The superblock context to retrieve the major version\n from.\n\n# Returns\n The major version of this archive."]
568 pub fn sqsh_superblock_version_major(superblock: *const SqshSuperblock) -> u16;
569 #[doc = "\n Retrieves the minor version of an archive.\n\n# Arguments\n- superblock The superblock context to retrieve the minor version\n from.\n\n# Returns\n The minor version of this archive."]
570 pub fn sqsh_superblock_version_minor(superblock: *const SqshSuperblock) -> u16;
571 #[doc = "\n Retrieves the start offset of the inode table in an archive.\n\n# Arguments\n- context The superblock context to retrieve the inode table start\n offset from.\n\n# Returns\n The start offset of the inode table in the superblock context."]
572 pub fn sqsh_superblock_inode_table_start(context: *const SqshSuperblock) -> u64;
573 #[doc = "\n Retrieves the start offset of the id table in an archive.\n\n# Arguments\n- context The superblock context to retrieve the id table start\n offset from.\n\n# Returns\n The start offset of the id table in the superblock context."]
574 pub fn sqsh_superblock_id_table_start(context: *const SqshSuperblock) -> u64;
575 #[doc = "\n Retrieves the number of ids in an archive.\n\n# Arguments\n- context The superblock context to retrieve the ids count from.\n\n# Returns\n The number of inodes in the superblock context."]
576 pub fn sqsh_superblock_id_count(context: *const SqshSuperblock) -> u16;
577 #[doc = "\n Retrieves the start offset of the export table in an archive.\n\n# Arguments\n- context The superblock context to retrieve the export table start\n offset from.\n\n# Returns\n The start offset of the export table in the superblock context."]
578 pub fn sqsh_superblock_export_table_start(context: *const SqshSuperblock) -> u64;
579 #[doc = "\n Retrieves the start offset of the xattr id table in an archive.\n\n# Arguments\n- context The superblock context to retrieve the xattr id table\n start offset from.\n\n# Returns\n The start offset of the xattr id table in the superblock context."]
580 pub fn sqsh_superblock_xattr_id_table_start(context: *const SqshSuperblock) -> u64;
581 #[doc = "\n Retrieves the reference of the root inode in a superblock context.\n\n# Arguments\n- context The superblock context to retrieve the root inode\n reference from.\n\n# Returns\n The reference of the root inode in the superblock context."]
582 pub fn sqsh_superblock_inode_root_ref(context: *const SqshSuperblock) -> u64;
583 #[doc = "\n Checks if a superblock context has fragment table.\n\n# Arguments\n- context The superblock context to check.\n\n# Returns\n True if the superblock context has a fragment table, false otherwise."]
584 pub fn sqsh_superblock_has_fragments(context: *const SqshSuperblock) -> bool;
585 #[doc = "\n Checks if a superblock context has an export table.\n\n# Arguments\n- context The superblock context to check.\n\n# Returns\n True if the superblock context has an export table, false otherwise."]
586 pub fn sqsh_superblock_has_export_table(context: *const SqshSuperblock) -> bool;
587 #[doc = "\n Checks if a superblock context has an xattr table.\n\n# Arguments\n- context The superblock context to check.\n\n# Returns\n True if the superblock context has an xattr table, false otherwise."]
588 pub fn sqsh_superblock_has_xattr_table(context: *const SqshSuperblock) -> bool;
589 #[doc = "\n Checks if a superblock context has compression options.\n\n# Arguments\n- context The superblock context to check.\n\n# Returns\n True if the superblock context has compression options, false\n otherwise."]
590 pub fn sqsh_superblock_has_compression_options(context: *const SqshSuperblock) -> bool;
591 #[doc = "\n Retrieves the block size of a superblock context.\n\n# Arguments\n- context The superblock context to retrieve the block size from.\n\n# Returns\n The block size of the superblock context."]
592 pub fn sqsh_superblock_block_size(context: *const SqshSuperblock) -> u32;
593 #[doc = "\n Retrieves the modification time of a superblock context.\n\n# Arguments\n- context The superblock context to retrieve the modification time\n from.\n\n# Returns\n The modification time of the superblock context."]
594 pub fn sqsh_superblock_modification_time(context: *const SqshSuperblock) -> u32;
595 #[doc = "\n Retrieves the number of fragment entries in a superblock context.\n\n# Arguments\n- context The superblock context to retrieve the fragment entry\n count from.\n\n# Returns\n The number of fragment entries in the superblock context."]
596 pub fn sqsh_superblock_fragment_entry_count(context: *const SqshSuperblock) -> u32;
597 #[doc = "\n Retrieves the number of bytes used in a superblock context.\n\n# Arguments\n- context The superblock context to retrieve the bytes used from.\n\n# Returns\n The number of bytes used in the superblock context."]
598 pub fn sqsh_superblock_bytes_used(context: *const SqshSuperblock) -> u64;
599 #[must_use]
600 #[doc = "\n initializes a archive context in heap.\n\n# Arguments\n- source the source to retrieve the archive from\n- config the configuration for the archive context.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n a pointer to the archive context or NULL if an error occurred."]
601 pub fn sqsh_archive_open(
602 source: *const ::core::ffi::c_void,
603 config: *const SqshConfig,
604 err: *mut ::core::ffi::c_int,
605 ) -> *mut SqshArchive;
606 #[doc = "\n sqsh_superblock returns the configuration object of the archive\n context.\n\n# Arguments\n- archive the SqshArchive structure.\n\n# Returns\n the superblock context."]
607 pub fn sqsh_archive_config(archive: *const SqshArchive) -> *const SqshConfig;
608 #[doc = "\n sqsh_superblock returns the superblock context.\n\n# Arguments\n- archive the Sqsh structure.\n\n# Returns\n the superblock context."]
609 pub fn sqsh_archive_superblock(archive: *const SqshArchive) -> *const SqshSuperblock;
610 #[doc = "\n sqsh_mapper returns the map manager to retrieve chunks of the archive\n file.\n\n# Arguments\n- archive the Sqsh structure.\n\n# Returns\n the mapper context."]
611 pub fn sqsh_archive_map_manager(archive: *mut SqshArchive) -> *mut SqshMapManager;
612 #[must_use]
613 #[doc = "\n Retrieves the id table of a Sqsh instance.\n\n# Arguments\n- archive The Sqsh instance to retrieve the id table from.\n- id_table Pointer to a struct SqshTable where the id table will\n be stored.\n\n# Returns\n 0 on success, a negative value on error."]
614 pub fn sqsh_archive_id_table(
615 archive: *mut SqshArchive,
616 id_table: *mut *mut SqshIdTable,
617 ) -> ::core::ffi::c_int;
618 #[must_use]
619 #[doc = "\n Retrieves the export table of a Sqsh instance.\n\n# Arguments\n- archive The Sqsh instance to retrieve the inode cache\n from.\n- inode_map Pointer to a struct SqshInodeMap where the\n inode cache will be stored.\n\n# Returns\n 0 on success, a negative value on error."]
620 pub fn sqsh_archive_inode_map(
621 archive: *mut SqshArchive,
622 inode_map: *mut *mut SqshInodeMap,
623 ) -> ::core::ffi::c_int;
624 #[must_use]
625 #[doc = "\n Retrieves the export table of a Sqsh instance.\n\n# Arguments\n- archive The Sqsh instance to retrieve the export table\n from.\n- export_table Pointer to a struct SqshTable where the export\n table will be stored.\n\n# Returns\n 0 on success, a negative value on error."]
626 pub fn sqsh_archive_export_table(
627 archive: *mut SqshArchive,
628 export_table: *mut *mut SqshExportTable,
629 ) -> ::core::ffi::c_int;
630 #[must_use]
631 #[doc = "\n Retrieves the fragment table of a Sqsh instance.\n\n# Arguments\n- archive The Sqsh instance to retrieve the fragment table\n from.\n- fragment_table Pointer to a struct SqshTable where the export\n table will be stored.\n\n# Returns\n 0 on success, a negative value on error."]
632 pub fn sqsh_archive_fragment_table(
633 archive: *mut SqshArchive,
634 fragment_table: *mut *mut SqshFragmentTable,
635 ) -> ::core::ffi::c_int;
636 #[must_use]
637 #[doc = "\n Retrieves the xattr table of a Sqsh instance.\n\n# Arguments\n- archive The Sqsh instance to retrieve the xattr table\n from.\n- xattr_table Pointer to a struct SqshTable where the export\n table will be stored.\n\n# Returns\n 0 on success, a negative value on error."]
638 pub fn sqsh_archive_xattr_table(
639 archive: *mut SqshArchive,
640 xattr_table: *mut *mut SqshXattrTable,
641 ) -> ::core::ffi::c_int;
642 #[doc = "\n Frees the resources used by a Sqsh instance.\n\n# Arguments\n- archive The Sqsh instance to free.\n\n# Returns\n 0 on success, a negative value on error."]
643 pub fn sqsh_archive_close(archive: *mut SqshArchive) -> ::core::ffi::c_int;
644 #[must_use]
645 #[doc = "\n Initializes a SqshCompressionOptions struct.\n\n# Arguments\n- sqsh Sqsh context\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The Initialized file context"]
646 pub fn sqsh_compression_options_new(
647 sqsh: *mut SqshArchive,
648 err: *mut ::core::ffi::c_int,
649 ) -> *mut SqshCompressionOptions;
650 #[doc = "\n returns the compression level of gzip\n\n# Arguments\n- context the compression options context\n\n# Returns\n the compression level of gzip"]
651 pub fn sqsh_compression_options_gzip_compression_level(
652 context: *const SqshCompressionOptions,
653 ) -> u32;
654 #[doc = "\n returns the compression window size of gzip\n\n# Arguments\n- context the compression options context\n\n# Returns\n the compression window size of gzip"]
655 pub fn sqsh_compression_options_gzip_window_size(context: *const SqshCompressionOptions)
656 -> u16;
657 #[doc = "\n returns the compression strategy of gzip\n\n# Arguments\n- context the compression options context\n\n# Returns\n the compression strategy of gzip"]
658 pub fn sqsh_compression_options_gzip_strategies(
659 context: *const SqshCompressionOptions,
660 ) -> SqshGzipStrategies;
661 #[doc = "\n returns the dictionary size of xz\n\n# Arguments\n- context the compression options context\n\n# Returns\n the dictionary size of xz"]
662 pub fn sqsh_compression_options_xz_dictionary_size(
663 context: *const SqshCompressionOptions,
664 ) -> u32;
665 #[doc = "\n returns the compression options of xz\n\n# Arguments\n- context the compression options context\n\n# Returns\n the compression options of xz"]
666 pub fn sqsh_compression_options_xz_filters(
667 context: *const SqshCompressionOptions,
668 ) -> SqshXzFilters;
669 #[doc = "\n returns the version of lz4 used\n\n# Arguments\n- context the compression options context\n\n# Returns\n the version of lz4 used"]
670 pub fn sqsh_compression_options_lz4_version(context: *const SqshCompressionOptions) -> u32;
671 #[doc = "\n returns the flags of lz4\n\n# Arguments\n- context the compression options context\n\n# Returns\n the flags of lz4"]
672 pub fn sqsh_compression_options_lz4_flags(context: *const SqshCompressionOptions) -> u32;
673 #[doc = "\n returns the compression level of zstd\n\n# Arguments\n- context the compression options context\n\n# Returns\n the compression level of zstd"]
674 pub fn sqsh_compression_options_zstd_compression_level(
675 context: *const SqshCompressionOptions,
676 ) -> u32;
677 #[doc = "\n returns the algorithm of lzo\n\n# Arguments\n- context the compression options context\n\n# Returns\n the algorithm of lzo"]
678 pub fn sqsh_compression_options_lzo_algorithm(
679 context: *const SqshCompressionOptions,
680 ) -> SqshLzoAlgorithm;
681 #[doc = "\n returns the compression level of lzo\n\n# Arguments\n- context the compression options context\n\n# Returns\n the compression level of lzo"]
682 pub fn sqsh_compression_options_lzo_compression_level(
683 context: *const SqshCompressionOptions,
684 ) -> u32;
685 #[doc = "\n returns the size of the compression options struct\n\n# Arguments\n- context the compression options context\n\n# Returns\n the size of the compression options struct"]
686 pub fn sqsh_compression_options_size(context: *const SqshCompressionOptions) -> usize;
687 #[doc = "\n Frees a SqshCompressionOptions struct.\n\n# Arguments\n- context The file context to free.\n\n# Returns\n 0 on success, less than 0 on error"]
688 pub fn sqsh_compression_options_free(
689 context: *mut SqshCompressionOptions,
690 ) -> ::core::ffi::c_int;
691 #[doc = " Initializes a SqshFileReader struct.\n\n\n# Arguments\n- file The file context to retrieve the file contents from.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n a new file reader."]
692 pub fn sqsh_file_reader_new(
693 file: *const SqshFile,
694 err: *mut ::core::ffi::c_int,
695 ) -> *mut SqshFileReader;
696 #[doc = " Advances the file reader by a certain amount of data and presents\n `size` bytes of data to the user.\n\n\n# Arguments\n- reader The file reader to skip data in.\n- offset The offset to skip.\n- size The size of the data to skip.\n\n# Returns\n 0 on success, less than 0 on error."]
697 pub fn sqsh_file_reader_advance(
698 reader: *mut SqshFileReader,
699 offset: sqsh_index_t,
700 size: usize,
701 ) -> ::core::ffi::c_int;
702 #[doc = " Gets a pointer to the current data in the file reader.\n\n\n# Arguments\n- reader The file reader to get data from.\n\n# Returns\n A pointer to the current data in the file reader."]
703 pub fn sqsh_file_reader_data(reader: *const SqshFileReader) -> *const u8;
704 #[doc = " Gets the size of the current data in the file reader.\n\n\n# Arguments\n- reader The file reader to get data from.\n\n# Returns\n The size of the current data in the file reader."]
705 pub fn sqsh_file_reader_size(reader: *const SqshFileReader) -> usize;
706 #[doc = " Cleans up resources used by a SqshFileReader struct.\n\n\n# Arguments\n- reader The file reader struct to clean up.\n\n# Returns\n 0 on success, less than 0 on error."]
707 pub fn sqsh_file_reader_free(reader: *mut SqshFileReader) -> ::core::ffi::c_int;
708 #[must_use]
709 #[doc = " Creates a new SqshFileIterator struct and initializes it.\n\n\n# Arguments\n- file The file context to retrieve the file contents from.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n A pointer to the newly created and initialized SqshFileIterator\n struct."]
710 pub fn sqsh_file_iterator_new(
711 file: *const SqshFile,
712 err: *mut ::core::ffi::c_int,
713 ) -> *mut SqshFileIterator;
714 #[must_use]
715 #[doc = " Reads a certain amount of data from the file iterator.\n\n\n# Arguments\n- iterator The file iterator to read data from.\n- desired_size The desired size of the data to read. May be more or\n less than the actual size of the data read.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n- true When the iterator was advanced\n- false When the iterator is at the end and no more entries are\n available or if an error occured."]
716 pub fn sqsh_file_iterator_next(
717 iterator: *mut SqshFileIterator,
718 desired_size: usize,
719 err: *mut ::core::ffi::c_int,
720 ) -> bool;
721 #[must_use]
722 #[doc = "\n Skips blocks until the block containing the offset is reached.\n Note that calling this function will invalidate the data pointer returned by\n sqsh_file_iterator_data().\n\n The offset is relative to the beginning of the current block or, if the\n iterator hasn't been forwarded with previous calls to\n sqsh_file_iterator_skip() or sqsh_file_iterator_next() the beginning of the\n first block.\n\n After calling this function `offset` is updated to the same position relative\n to the new block. See this visualisation:\n\n ```\n current_block: |<--- block 8000 --->|\n offset = 10000 --^\n --> sqsh_file_iterator_skip(i, &offset, 1)\n current_block: |<--- block 8000 --->|\n offset = 2000 --^\n ```\n\n If libsqsh can map more than one block at once, it will do so until\n `desired_size` is reached. Note that `desired_size` is only a hint and\n libsqsh may return more or less data than requested.\n\n# Arguments\n- iterator The file iterator to skip data in.\n- offset The offset that is contained in the block to\n skip to.\n- desired_size The desired size of the data to read.\n\n# Returns\n 0 on success, less than 0 on error."]
723 pub fn sqsh_file_iterator_skip(
724 iterator: *mut SqshFileIterator,
725 offset: *mut sqsh_index_t,
726 desired_size: usize,
727 ) -> ::core::ffi::c_int;
728 #[must_use]
729 #[doc = " Gets a pointer to the current data in the file iterator.\n\n\n# Arguments\n- iterator The file iterator to get data from.\n\n# Returns\n A pointer to the current data in the file iterator."]
730 pub fn sqsh_file_iterator_data(iterator: *const SqshFileIterator) -> *const u8;
731 #[must_use]
732 #[doc = " Returns the block size of the file iterator.\n\n\n# Arguments\n- iterator The file iterator to get the size from.\n\n# Returns\n The size of the data currently in the file iterator."]
733 pub fn sqsh_file_iterator_block_size(iterator: *const SqshFileIterator) -> usize;
734 #[must_use]
735 #[doc = " Gets the size of the data currently in the file iterator.\n\n\n# Arguments\n- iterator The file iterator to get the size from.\n\n# Returns\n The size of the data currently in the file iterator."]
736 pub fn sqsh_file_iterator_size(iterator: *const SqshFileIterator) -> usize;
737 #[doc = " Frees the resources used by a SqshFileIterator struct.\n\n\n# Arguments\n- iterator The file iterator to free.\n\n# Returns\n 0 on success, less than 0 on error."]
738 pub fn sqsh_file_iterator_free(iterator: *mut SqshFileIterator) -> ::core::ffi::c_int;
739 #[must_use]
740 #[doc = "\n Initialize the file context from a path.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n 0 on success, less than 0 on error."]
741 pub fn sqsh_open(
742 archive: *mut SqshArchive,
743 path: *const ::core::ffi::c_char,
744 err: *mut ::core::ffi::c_int,
745 ) -> *mut SqshFile;
746 #[must_use]
747 #[doc = "\n Initialize the file context from a path. This function is identical to\n `sqsh_open()` but if the path is a symlink, the symlink target not resolved.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n 0 on success, less than 0 on error."]
748 pub fn sqsh_lopen(
749 archive: *mut SqshArchive,
750 path: *const ::core::ffi::c_char,
751 err: *mut ::core::ffi::c_int,
752 ) -> *mut SqshFile;
753 #[must_use]
754 #[doc = "\n Initializes a file context in heap\n\n# Arguments\n- archive The sqsh context to use.\n- inode_ref The inode reference to initialize the context with.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n a pointer to the sqsh context or NULL if an error occurred."]
755 pub fn sqsh_open_by_ref(
756 archive: *mut SqshArchive,
757 inode_ref: u64,
758 err: *mut ::core::ffi::c_int,
759 ) -> *mut SqshFile;
760 #[doc = "\n returns whether the file is an extended structure.\n\n# Arguments\n- context The file context.\n\n# Returns\n true if the file is an extended structure."]
761 pub fn sqsh_file_is_extended(context: *const SqshFile) -> bool;
762 #[doc = "\n Getter for the inode hard link count.\n\n# Arguments\n- context The file context.\n\n# Returns\n the amount of hard links to the inode."]
763 pub fn sqsh_file_hard_link_count(context: *const SqshFile) -> u32;
764 #[doc = "\n Getter for the file size. 0 if the file has no size.\n\n# Arguments\n- context The file context.\n\n# Returns\n the file type."]
765 pub fn sqsh_file_size(context: *const SqshFile) -> u64;
766 #[doc = "\n Getter for the permissions of the file.\n\n# Arguments\n- context The file context.\n\n# Returns\n the permissions of the file."]
767 pub fn sqsh_file_permission(context: *const SqshFile) -> u16;
768 #[doc = "\n Getter for the inode number.\n\n# Arguments\n- context The file context.\n\n# Returns\n the inode number."]
769 pub fn sqsh_file_inode(context: *const SqshFile) -> u32;
770 #[doc = "\n Getter for the file modification time in seconds since epoch.\n\n# Arguments\n- context The file context.\n\n# Returns\n the file modification time."]
771 pub fn sqsh_file_modified_time(context: *const SqshFile) -> u32;
772 #[doc = "\n Getter for the start block of the file content. This is only\n internally used and will be used while retrieving the file content.\n\n# Arguments\n- context The file context.\n\n# Returns\n the start block of the file content or UINT64_MAX if the type\n is not SQSH_FILE_TYPE_FILE."]
773 pub fn sqsh_file_blocks_start(context: *const SqshFile) -> u64;
774 #[doc = "\n Getter for the amount of blocks of the file content. This is only\n internally used and will be used while retrieving the file content.\n\n# Arguments\n- context The file context.\n\n# Returns\n the amount of blocks of the file content. If the file is not of\n of type SQSH_FILE_TYPE_FILE, UINT32_MAX will be returned."]
775 pub fn sqsh_file_block_count(context: *const SqshFile) -> u32;
776 #[doc = "\n Getter the size of a block of the file content. This is only\n internally used and will be used while retrieving the file content.\n\n# Arguments\n- context The file context.\n- index The index of the block.\n\n# Returns\n the size of the block with the index."]
777 pub fn sqsh_file_block_size(context: *const SqshFile, index: u32) -> u32;
778 #[doc = "\n Checks whether a certain block is compressed.\n\n# Arguments\n- context The file context.\n- index The index of the block.\n\n# Returns\n true if the block is compressed, false otherwise."]
779 pub fn sqsh_file_block_is_compressed(context: *const SqshFile, index: u32) -> bool;
780 #[doc = "\n retrieve the fragment block index. This is only internally used\n\n and will be used while retrieving the file content.\n# Arguments\n- context The file context.\n\n# Returns\n the fragment block index."]
781 pub fn sqsh_file_fragment_block_index(context: *const SqshFile) -> u32;
782 #[doc = "\n retrieve the fragment block offset. This is only internally used\n and will be used while retrieving the file content.\n\n# Arguments\n- context The file context.\n\n# Returns\n the offset inside of the fragment block."]
783 pub fn sqsh_file_fragment_block_offset(context: *const SqshFile) -> u32;
784 #[doc = "\n retrieve the directory block start. This is only internally used\n and will be used while iterating over the directory entries.\n\n# Arguments\n- context The file context.\n\n# Returns\n the directory block start."]
785 pub fn sqsh_file_directory_block_start(context: *const SqshFile) -> u32;
786 #[deprecated]
787 #[doc = " Since 1.3.0. Use sqsh_file_directory_block_offset2() instead.\n\n retrieve the directory block offset. This is only internally used\n and will be used while iterating over the directory entries.\n\n# Arguments\n- context The file context.\n\n# Returns\n the directory block offset."]
788 pub fn sqsh_file_directory_block_offset(context: *const SqshFile) -> u32;
789 #[doc = "\n retrieve the directory block offset. This is only internally used\n and will be used while iterating over the directory entries.\n\n# Arguments\n- context The file context.\n\n# Returns\n the directory block offset."]
790 pub fn sqsh_file_directory_block_offset2(context: *const SqshFile) -> u16;
791 #[doc = "\n retrieve the parent inode of the directory.\n\n# Arguments\n- context The file context.\n\n# Returns\n the directory block offset."]
792 pub fn sqsh_file_directory_parent_inode(context: *const SqshFile) -> u32;
793 #[doc = "\n returns true if the file has a fragment block.\n\n# Arguments\n- context The file context.\n\n# Returns\n true if the file has a fragment block, false otherwise."]
794 pub fn sqsh_file_has_fragment(context: *const SqshFile) -> bool;
795 #[doc = "\n returns the type of the file.\n\n# Arguments\n- context The file context.\n\n# Returns\n the type of the file."]
796 pub fn sqsh_file_type(context: *const SqshFile) -> SqshFileType;
797 #[doc = "\n resolves the symlink target. After calling this function the file is\n in place changed to the target of the symlink.\n\n# Arguments\n- context The file context.\n\n# Returns\n int 0 on success, less than 0 on error."]
798 pub fn sqsh_file_symlink_resolve(context: *mut SqshFile) -> ::core::ffi::c_int;
799 #[doc = "\n resolves all symlink target targets until a file is hit. This function\n is similar to sqsh_file_symlink_resolve() but resolves symlinks recursively\n until a file is hit.\n\n# Arguments\n- context The file context.\n\n# Returns\n int 0 on success, less than 0 on error."]
800 pub fn sqsh_file_symlink_resolve_all(context: *mut SqshFile) -> ::core::ffi::c_int;
801 #[doc = "\n returns the target of a symbolic link. Be aware that the returned\n value is not zero terminated.\n\n To get the length of the target use sqsh_file_symlink_size().\n\n If you need a zero terminated string use sqsh_file_symlink_dup().\n\n# Arguments\n- context The file context.\n\n# Returns\n the target of a symbolic link, NULL if the file is not a symbolic\n link."]
802 pub fn sqsh_file_symlink(context: *const SqshFile) -> *const ::core::ffi::c_char;
803 #[must_use]
804 #[doc = "\n creates a heap allocated copy of the target of a symbolic link.\n\n The caller is responsible for calling free() on the returned pointer.\n\n The returned string is 0 terminated.\n\n# Arguments\n- context The file context.\n\n# Returns\n the target of a symbolic link, NULL if the file is not a symbolic\n link."]
805 pub fn sqsh_file_symlink_dup(context: *const SqshFile) -> *mut ::core::ffi::c_char;
806 #[doc = "\n returns the length of the target of a symbolic link in bytes.\n\n# Arguments\n- context The file context.\n\n# Returns\n the length of the target of a symbolic link in bytes or 0 if the\n file is not a symbolic link."]
807 pub fn sqsh_file_symlink_size(context: *const SqshFile) -> u32;
808 #[doc = "\n\n returns the device id of the device inode.\n\n# Arguments\n- context The file context.\n\n# Returns\n the device id of the device inode or 0 if the file is not a device."]
809 pub fn sqsh_file_device_id(context: *const SqshFile) -> u32;
810 #[doc = "\n returns the owner user id of the file.\n\n# Arguments\n- context The file context.\n\n# Returns\n the owner uid of the file."]
811 pub fn sqsh_file_uid(context: *const SqshFile) -> u32;
812 #[doc = "\n returns the owner group id of the file.\n\n# Arguments\n- context The file context.\n\n# Returns\n the owner gid of the file."]
813 pub fn sqsh_file_gid(context: *const SqshFile) -> u32;
814 #[doc = "\n returns the inode reference to this file.\n\n The owner reference is an encoded physical location of the inode inside of\n the archive.\n\n To decode this value use the following code:\n\n ```\n uint64_t ref = sqsh_file_ref(context);\n uint64_t outer_address = ref >> 16;\n uint64_t inner_address = ref & 0xffff;\n ```\n\n The outer address is the physical location of the metablock within the\n archive.\n\n The inner address is the physical location of the inode inside of the\n decompressed metablock.\n\n# Arguments\n- context The file context.\n\n# Returns\n the reference to this file."]
815 pub fn sqsh_file_inode_ref(context: *const SqshFile) -> u64;
816 #[doc = "\n returns index of the extended attribute inside of the xattr table.\n\n# Arguments\n- context The file context.\n\n# Returns\n the index of the extended attribute inside of the xattr table."]
817 pub fn sqsh_file_xattr_index(context: *const SqshFile) -> u32;
818 #[doc = "\n cleans up an file context and frees the memory.\n\n# Arguments\n- file The file context.\n\n# Returns\n int 0 on success, less than 0 on error."]
819 pub fn sqsh_close(file: *mut SqshFile) -> ::core::ffi::c_int;
820 #[must_use]
821 #[doc = "\n Allocates and initializes a new directory iterator.\n\n# Arguments\n- file file context of a directory to iterate over.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The new iterator on success, NULL on error."]
822 pub fn sqsh_directory_iterator_new(
823 file: *const SqshFile,
824 err: *mut ::core::ffi::c_int,
825 ) -> *mut SqshDirectoryIterator;
826 #[must_use]
827 #[doc = "\n Advances the iterator to the next entry.\n\n# Arguments\n- iterator The iterator to advance.\n- err Pointer to an int where the error code will be\n stored.\n\n# Returns\n- true When the iterator has been advanced\n- false When the iterator has reached the end of the directory or if an\n error occured."]
828 pub fn sqsh_directory_iterator_next(
829 iterator: *mut SqshDirectoryIterator,
830 err: *mut ::core::ffi::c_int,
831 ) -> bool;
832 #[must_use]
833 #[doc = "\n Looks up an entry by name.\n\n# Arguments\n- iterator The iterator to use.\n- name The name of the entry to look up.\n- name_len The length of the name.\n\n# Returns\n 0 on success, a negative value on error."]
834 pub fn sqsh_directory_iterator_lookup(
835 iterator: *mut SqshDirectoryIterator,
836 name: *const ::core::ffi::c_char,
837 name_len: usize,
838 ) -> ::core::ffi::c_int;
839 #[deprecated]
840 #[doc = " Since 1.3.0. Use sqsh_directory_iterator_name2() instead.\n\n Retrieves the size of the name of the current entry.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The size of the name on success, a negative value on error."]
841 pub fn sqsh_directory_iterator_name_size(iterator: *const SqshDirectoryIterator) -> u16;
842 #[doc = "\n Retrieves the inode number of the current entry.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The inode number."]
843 pub fn sqsh_directory_iterator_inode(iterator: *const SqshDirectoryIterator) -> u32;
844 #[deprecated]
845 #[doc = " Since 1.2.0. Use sqsh_directory_iterator_inode() instead.\n\n Retrieves the inode number of the current entry.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The inode number."]
846 pub fn sqsh_directory_iterator_inode_number(iterator: *const SqshDirectoryIterator) -> u64;
847 #[doc = "\n Retrieves the inode reference of the current entry.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The inode reference."]
848 pub fn sqsh_directory_iterator_inode_ref(iterator: *const SqshDirectoryIterator) -> u64;
849 #[doc = "\n Retrieves the inode type of the current entry.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The inode type on success, SQSH_INODE_TYPE_UNKNOWN on error."]
850 pub fn sqsh_directory_iterator_file_type(
851 iterator: *const SqshDirectoryIterator,
852 ) -> SqshFileType;
853 #[must_use]
854 #[doc = "\n Loads the inode of the current entry.\n\n# Arguments\n- iterator The iterator to use.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The loaded inode on success, NULL on error."]
855 pub fn sqsh_directory_iterator_open_file(
856 iterator: *const SqshDirectoryIterator,
857 err: *mut ::core::ffi::c_int,
858 ) -> *mut SqshFile;
859 #[doc = "\n Retrieves the name of the current entry.\n\n The returned pointer is allocated internally and only valid until the next\n call of sqsh_directory_iterator_next(). It must not be freed. The returned\n string is not 0 terminated.\n\n# Arguments\n- iterator The iterator to use.\n- len Pointer to a size_t where the length of the name will\n be stored.\n\n# Returns\n The name of the current entry."]
860 pub fn sqsh_directory_iterator_name2(
861 iterator: *const SqshDirectoryIterator,
862 len: *mut usize,
863 ) -> *const ::core::ffi::c_char;
864 #[deprecated]
865 #[doc = " Since 1.3.0. Use sqsh_directory_iterator_name2() instead.\n\n Retrieves the name of the current entry.\n\n The returned pointer is allocated internally and only valid until the next\n call of sqsh_directory_iterator_next(). It must not be freed. The returned\n string is not 0 terminated. Use sqsh_directory_iterator_name_size() to get\n the size of the value.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The name of the current entry."]
866 pub fn sqsh_directory_iterator_name(
867 iterator: *const SqshDirectoryIterator,
868 ) -> *const ::core::ffi::c_char;
869 #[must_use]
870 #[doc = "\n creates a heap allocated copy of the name of the current entry.\n\n The caller is responsible for calling free() on the returned pointer.\n\n The returned string is 0 terminated.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The name of the current entry."]
871 pub fn sqsh_directory_iterator_name_dup(
872 iterator: *const SqshDirectoryIterator,
873 ) -> *mut ::core::ffi::c_char;
874 #[doc = "\n Frees the resources used by a directory iterator.\n\n# Arguments\n- iterator The iterator to free.\n\n# Returns\n The file name of the current directory entry, NULL if the allocation\n fails. The user is responsible for freeing the memory."]
875 pub fn sqsh_directory_iterator_free(iterator: *mut SqshDirectoryIterator)
876 -> ::core::ffi::c_int;
877 #[doc = " checks if a file exists.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n true if the file exists, false otherwise."]
878 pub fn sqsh_easy_file_exists(
879 archive: *mut SqshArchive,
880 path: *const ::core::ffi::c_char,
881 err: *mut ::core::ffi::c_int,
882 ) -> bool;
883 #[doc = " retrieves the content of a file.\n\n The content is not null terminated. The size of the content can be retrieved\n with sqsh_file_size. The returned pointer needs to be released with `free()`.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The content of the file on success, NULL on error."]
884 pub fn sqsh_easy_file_content(
885 archive: *mut SqshArchive,
886 path: *const ::core::ffi::c_char,
887 err: *mut ::core::ffi::c_int,
888 ) -> *mut u8;
889 #[doc = " retrieves the size of a file.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The size of the file on success, 0 on error."]
890 pub fn sqsh_easy_file_size(
891 archive: *mut SqshArchive,
892 path: *const ::core::ffi::c_char,
893 err: *mut ::core::ffi::c_int,
894 ) -> usize;
895 #[doc = " retrieves unix permissions of a file.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The unix permissions of the file on success, 0 on error."]
896 pub fn sqsh_easy_file_permission(
897 archive: *mut SqshArchive,
898 path: *const ::core::ffi::c_char,
899 err: *mut ::core::ffi::c_int,
900 ) -> mode_t;
901 #[doc = " retrieves the modification time of a file.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The modification time of the file on success, 0 on error."]
902 pub fn sqsh_easy_file_mtime(
903 archive: *mut SqshArchive,
904 path: *const ::core::ffi::c_char,
905 err: *mut ::core::ffi::c_int,
906 ) -> time_t;
907 #[doc = " retrieves the contents of a directory as a list of file names\n\n The returned list needs to be released with `free()`.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n A list of files and directories on success, NULL on error."]
908 pub fn sqsh_easy_directory_list(
909 archive: *mut SqshArchive,
910 path: *const ::core::ffi::c_char,
911 err: *mut ::core::ffi::c_int,
912 ) -> *mut *mut ::core::ffi::c_char;
913 #[doc = " retrieves the contents of a directory as a list of file paths\n\n The returned list needs to be released with `free()`.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n A list of files and directories on success, NULL on error."]
914 pub fn sqsh_easy_directory_list_path(
915 archive: *mut SqshArchive,
916 path: *const ::core::ffi::c_char,
917 err: *mut ::core::ffi::c_int,
918 ) -> *mut *mut ::core::ffi::c_char;
919 #[doc = " easy/traversal.c"]
920 pub fn sqsh_easy_tree_traversal(
921 archive: *mut SqshArchive,
922 path: *const ::core::ffi::c_char,
923 err: *mut ::core::ffi::c_int,
924 ) -> *mut *mut ::core::ffi::c_char;
925 #[doc = " retrieves all xattr keys of a file or directory.\n\n The returned list needs to be released with `free()`.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n A list of xattr keys on success, NULL on error."]
926 pub fn sqsh_easy_xattr_keys(
927 archive: *mut SqshArchive,
928 path: *const ::core::ffi::c_char,
929 err: *mut ::core::ffi::c_int,
930 ) -> *mut *mut ::core::ffi::c_char;
931 #[doc = " retrieves the value of a xattr key of a file or directory.\n\n The returned pointer needs to be released with `free()`.\n\n# Arguments\n- archive The sqsh archive context.\n- path The path the file or directory.\n- key The xattr key.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The value of the given xattr key on success, NULL on error."]
932 pub fn sqsh_easy_xattr_get(
933 archive: *mut SqshArchive,
934 path: *const ::core::ffi::c_char,
935 key: *const ::core::ffi::c_char,
936 err: *mut ::core::ffi::c_int,
937 ) -> *mut ::core::ffi::c_char;
938 #[doc = " Print the error message for the given error code.\n\n# Arguments\n- error_code The error code.\n- msg The message to print before the error message."]
939 pub fn sqsh_perror(error_code: ::core::ffi::c_int, msg: *const ::core::ffi::c_char);
940 #[must_use]
941 #[doc = " Get the error message for the given error code.\n\n This function is thread safe, but the returned string may be overwritten by\n the next call to this function on this thread.\n\n# Arguments\n- error_code The error code.\n# Returns\n The error message."]
942 pub fn sqsh_error_str(error_code: ::core::ffi::c_int) -> *const ::core::ffi::c_char;
943 #[doc = "\n Sets the user data for a mapper.\n\n# Arguments\n- mapper The mapper to set the user data for.\n- user_data The user data to set."]
944 pub fn sqsh_mapper_set_user_data(mapper: *mut SqshMapper, user_data: *mut ::core::ffi::c_void);
945 #[doc = "\n Retrieves the user data from a mapper.\n\n# Arguments\n- mapper The mapper to retrieve the user data from.\n\n# Returns\n The user data from the mapper."]
946 pub fn sqsh_mapper_user_data(mapper: *const SqshMapper) -> *mut ::core::ffi::c_void;
947 #[doc = "<div class=\"warning\">INTERNAL API</div>\n\n Retrieves the size of the input data in a mapper.\n\n# Arguments\n- mapper The mapper to retrieve the size from.\n\n# Returns\n The size of the input data in the mapper."]
948 pub fn sqsh_mapper_size(mapper: *const SqshMapper) -> usize;
949 #[doc = "<div class=\"warning\">INTERNAL API</div>\n\n Retrieves the block size for a mapper.\n\n# Arguments\n- mapper The mapper to retrieve the size from.\n\n# Returns\n The size of the input data in the mapper."]
950 pub fn sqsh_mapper_block_size(mapper: *const SqshMapper) -> usize;
951 #[doc = " a mapper that uses curl to download the file."]
952 pub static sqsh_mapper_impl_curl: *const SqshMemoryMapperImpl;
953 #[doc = " a mapper that uses mmap to map the file into memory."]
954 pub static sqsh_mapper_impl_mmap: *const SqshMemoryMapperImpl;
955 #[doc = " a mapper that uses a static buffer."]
956 pub static sqsh_mapper_impl_static: *const SqshMemoryMapperImpl;
957 #[doc = "\n writes data to a file descriptor.\n\n# Arguments\n- file The file context.\n- stream The descriptor to write the file contents to.\n\n# Returns\n The number of bytes read on success, less than 0 on error."]
958 pub fn sqsh_file_to_stream(file: *const SqshFile, stream: *mut FILE) -> ::core::ffi::c_int;
959 #[doc = "\n Retrieves an element from the table.\n\n# Arguments\n- table The table to retrieve the element from.\n- index The index of the element to retrieve.\n- target The buffer to store the element in.\n\n# Returns\n 0 on success, a negative value on error."]
960 pub fn sqsh_table_get(
961 table: *const SqshTable,
962 index: sqsh_index_t,
963 target: *mut ::core::ffi::c_void,
964 ) -> ::core::ffi::c_int;
965 #[doc = "\n Retrieves an element from the table.\n\n# Arguments\n- table The table to retrieve the element from.\n- index The index of the element to retrieve.\n- id The buffer to store the element in.\n\n# Returns\n 0 on success, a negative value on error."]
966 pub fn sqsh_id_table_get(
967 table: *const SqshIdTable,
968 index: sqsh_index_t,
969 id: *mut u32,
970 ) -> ::core::ffi::c_int;
971 #[doc = "\n Retrieves an element from the table.\n\n# Arguments\n- table The table to retrieve the element from.\n- inode The index of the element to retrieve.\n- inode_ref A pointer to a uint64_t to store the inode reference\n\n# Returns\n 0 on success, a negative value on error."]
972 pub fn sqsh_export_table_resolve_inode(
973 table: *const SqshExportTable,
974 inode: u64,
975 inode_ref: *mut u64,
976 ) -> ::core::ffi::c_int;
977 #[doc = " Creates a new SqshPathResolver object at the root inode.\n\n\n# Arguments\n- archive The archive to use\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n a new file reader."]
978 pub fn sqsh_path_resolver_new(
979 archive: *mut SqshArchive,
980 err: *mut ::core::ffi::c_int,
981 ) -> *mut SqshPathResolver;
982 #[must_use]
983 #[doc = " Moves the walker one level up\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
984 pub fn sqsh_path_resolver_up(walker: *mut SqshPathResolver) -> ::core::ffi::c_int;
985 #[must_use]
986 #[doc = "\n Moves the walker to the next entry int the current directory.\n\n# Arguments\n- walker The walker to use\n- err Pointer to an int where the error code will be\n stored.\n\n# Returns\n- true if the walker was moved to the next entry.\n- false if the walker has no more entries to move to or an error\n occured."]
987 pub fn sqsh_path_resolver_next(
988 walker: *mut SqshPathResolver,
989 err: *mut ::core::ffi::c_int,
990 ) -> bool;
991 #[doc = " Returns the inode type of the current entry.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the inode type of the current entry."]
992 pub fn sqsh_path_resolver_type(walker: *const SqshPathResolver) -> SqshFileType;
993 #[doc = " Returns the name of the current entry. This entry is not zero\n terminated.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the name of the current entry."]
994 pub fn sqsh_path_resolver_name(walker: *const SqshPathResolver) -> *const ::core::ffi::c_char;
995 #[doc = "\n Returns the size of the name of the current entry.\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the size of the name of the current entry."]
996 pub fn sqsh_path_resolver_name_size(walker: *const SqshPathResolver) -> u16;
997 #[must_use]
998 #[doc = "\n creates a heap allocated copy of the name of the current entry.\n\n The caller is responsible for calling free() on the returned pointer.\n\n The returned string is 0 terminated.\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the name of the current entry."]
999 pub fn sqsh_path_resolver_name_dup(walker: *const SqshPathResolver)
1000 -> *mut ::core::ffi::c_char;
1001 #[must_use]
1002 #[doc = " reverts the walker to the begining of the current directory.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1003 pub fn sqsh_path_resolver_revert(walker: *mut SqshPathResolver) -> ::core::ffi::c_int;
1004 #[must_use]
1005 #[doc = " Looks up an entry in the current directory.\n\n\n# Arguments\n- walker The walker to use\n- name The name of the entry to look up.\n- name_size The size of the name.\n\n# Returns\n 0 on success, less than 0 on error."]
1006 pub fn sqsh_path_resolver_lookup(
1007 walker: *mut SqshPathResolver,
1008 name: *const ::core::ffi::c_char,
1009 name_size: usize,
1010 ) -> ::core::ffi::c_int;
1011 #[must_use]
1012 #[doc = " Lets the walker enter the current entry.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1013 pub fn sqsh_path_resolver_down(walker: *mut SqshPathResolver) -> ::core::ffi::c_int;
1014 #[must_use]
1015 #[doc = " Moves the walker to the root directory.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1016 pub fn sqsh_path_resolver_to_root(walker: *mut SqshPathResolver) -> ::core::ffi::c_int;
1017 #[must_use]
1018 #[doc = " Returns the inode of the current entry.\n\n\n# Arguments\n- walker The walker to use\n- err Pointer to an int where the error code will be\n\n# Returns\n the inode of the current entry."]
1019 pub fn sqsh_path_resolver_open_file(
1020 walker: *const SqshPathResolver,
1021 err: *mut ::core::ffi::c_int,
1022 ) -> *mut SqshFile;
1023 #[doc = " Returns the inode of the current working directory.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the inode of the current entry."]
1024 pub fn sqsh_path_resolver_dir_inode(walker: *const SqshPathResolver) -> u32;
1025 #[doc = " Returns the inode reference of the current entry.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the inode reference of the current item the resolver is pointing to."]
1026 pub fn sqsh_path_resolver_inode_ref(walker: *const SqshPathResolver) -> u64;
1027 #[must_use]
1028 #[doc = "\n Resolve a path with the tree walker.\n\n This function will resolve the given path with the tree walker. The base is\n the current directory.\n\n# Arguments\n- walker The walker to use\n- path The path to resolve.\n- follow_symlinks Whether to follow symlinks.\n\n# Returns\n the inode of the current entry."]
1029 pub fn sqsh_path_resolver_resolve(
1030 walker: *mut SqshPathResolver,
1031 path: *const ::core::ffi::c_char,
1032 follow_symlinks: bool,
1033 ) -> ::core::ffi::c_int;
1034 #[doc = " Cleans up resources used by a SqshPathResolver struct.\n\n\n# Arguments\n- reader The file reader struct to clean up.\n\n# Returns\n 0 on success, less than 0 on error."]
1035 pub fn sqsh_path_resolver_free(reader: *mut SqshPathResolver) -> ::core::ffi::c_int;
1036 #[deprecated]
1037 #[doc = " Since 1.2.0. Use sqsh_path_resolver_new() instead.\n Creates a new SqshTreeWalker object at the root inode.\n\n\n# Arguments\n- archive The archive to use\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n a new file reader."]
1038 pub fn sqsh_tree_walker_new(
1039 archive: *mut SqshArchive,
1040 err: *mut ::core::ffi::c_int,
1041 ) -> *mut SqshTreeWalker;
1042 #[must_use]
1043 #[deprecated]
1044 #[doc = " Since 1.2.0. Use sqsh_path_resolver_up() instead.\n Moves the walker one level up\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1045 pub fn sqsh_tree_walker_up(walker: *mut SqshTreeWalker) -> ::core::ffi::c_int;
1046 #[must_use]
1047 #[deprecated]
1048 #[doc = " Since 1.2.0. Use sqsh_path_resolver_next() instead.\n\n Moves the walker to the next entry int the current directory.\n\n This function was deprecated to align the API with other iterator APIs. The\n `sqsh_tree_walker_next2()` uses the same signature as the other iterator.\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1049 pub fn sqsh_tree_walker_next(walker: *mut SqshTreeWalker) -> ::core::ffi::c_int;
1050 #[deprecated]
1051 #[doc = " Since 1.2.0. Use sqsh_path_resolver_type() instead.\n Returns the inode type of the current entry.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the inode type of the current entry."]
1052 pub fn sqsh_tree_walker_type(walker: *const SqshTreeWalker) -> SqshFileType;
1053 #[deprecated]
1054 #[doc = " Since 1.2.0. Use sqsh_path_resolver_name() instead.\n Returns the name of the current entry. This entry is not zero\n terminated.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the name of the current entry."]
1055 pub fn sqsh_tree_walker_name(walker: *const SqshTreeWalker) -> *const ::core::ffi::c_char;
1056 #[deprecated]
1057 #[doc = " Since 1.2.0. Use sqsh_path_resolver_name_size() instead.\n\n Returns the size of the name of the current entry.\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the size of the name of the current entry."]
1058 pub fn sqsh_tree_walker_name_size(walker: *const SqshTreeWalker) -> u16;
1059 #[must_use]
1060 #[deprecated]
1061 #[doc = " Since 1.2.0. Use sqsh_path_resolver_name_dup() instead.\n\n creates a heap allocated copy of the name of the current entry.\n\n The caller is responsible for calling free() on the returned pointer.\n\n The returned string is 0 terminated.\n\n# Arguments\n- walker The walker to use\n\n# Returns\n the name of the current entry."]
1062 pub fn sqsh_tree_walker_name_dup(walker: *const SqshTreeWalker) -> *mut ::core::ffi::c_char;
1063 #[must_use]
1064 #[deprecated]
1065 #[doc = " Since 1.2.0. Use sqsh_path_resolver_revert() instead.\n reverts the walker to the begining of the current directory.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1066 pub fn sqsh_tree_walker_revert(walker: *mut SqshTreeWalker) -> ::core::ffi::c_int;
1067 #[must_use]
1068 #[deprecated]
1069 #[doc = " Since 1.2.0. Use sqsh_path_resolver_lookup() instead.\n Looks up an entry in the current directory.\n\n\n# Arguments\n- walker The walker to use\n- name The name of the entry to look up.\n- name_size The size of the name.\n\n# Returns\n 0 on success, less than 0 on error."]
1070 pub fn sqsh_tree_walker_lookup(
1071 walker: *mut SqshTreeWalker,
1072 name: *const ::core::ffi::c_char,
1073 name_size: usize,
1074 ) -> ::core::ffi::c_int;
1075 #[must_use]
1076 #[deprecated]
1077 #[doc = " Since 1.2.0. Use sqsh_path_resolver_down() instead.\n Lets the walker enter the current entry.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1078 pub fn sqsh_tree_walker_down(walker: *mut SqshTreeWalker) -> ::core::ffi::c_int;
1079 #[must_use]
1080 #[deprecated]
1081 #[doc = " Since 1.2.0. Use sqsh_path_resolver_to_root() instead.\n Moves the walker to the root directory.\n\n\n# Arguments\n- walker The walker to use\n\n# Returns\n 0 on success, less than 0 on error."]
1082 pub fn sqsh_tree_walker_to_root(walker: *mut SqshTreeWalker) -> ::core::ffi::c_int;
1083 #[must_use]
1084 #[deprecated]
1085 #[doc = " Since 1.2.0. Use sqsh_path_resolver_open_file() instead.\n Returns the inode of the current entry.\n\n\n# Arguments\n- walker The walker to use\n- err Pointer to an int where the error code will be\n\n# Returns\n the inode of the current entry."]
1086 pub fn sqsh_tree_walker_open_file(
1087 walker: *const SqshTreeWalker,
1088 err: *mut ::core::ffi::c_int,
1089 ) -> *mut SqshFile;
1090 #[must_use]
1091 #[deprecated]
1092 #[doc = " Since 1.2.0. Use sqsh_path_resolver_open_file() instead.\n\n Resolve a path with the tree walker.\n\n This function will resolve the given path with the tree walker. The base is\n the current directory.\n\n# Arguments\n- walker The walker to use\n- path The path to resolve.\n- follow_symlinks Whether to follow symlinks.\n\n# Returns\n the inode of the current entry."]
1093 pub fn sqsh_tree_walker_resolve(
1094 walker: *mut SqshTreeWalker,
1095 path: *const ::core::ffi::c_char,
1096 follow_symlinks: bool,
1097 ) -> ::core::ffi::c_int;
1098 #[deprecated]
1099 #[doc = " Since 1.2.0. Use sqsh_path_resolver_free() instead.\n Cleans up resources used by a SqshTreeWalker struct.\n\n\n# Arguments\n- reader The file reader struct to clean up.\n\n# Returns\n 0 on success, less than 0 on error."]
1100 pub fn sqsh_tree_walker_free(reader: *mut SqshTreeWalker) -> ::core::ffi::c_int;
1101 #[doc = " Creates a new SqshTreeTraversal object at the root inode.\n\n\n# Arguments\n- file the base inode to start from.\n- err Pointer to an int where the error code will be\n stored.\n\n# Returns\n a new file reader."]
1102 pub fn sqsh_tree_traversal_new(
1103 file: *const SqshFile,
1104 err: *mut ::core::ffi::c_int,
1105 ) -> *mut SqshTreeTraversal;
1106 #[doc = " Sets the maximum depth of the traversal.\n\n\n# Arguments\n- traversal The traversal to use\n- max_depth The maximum depth to traverse."]
1107 pub fn sqsh_tree_traversal_set_max_depth(traversal: *mut SqshTreeTraversal, max_depth: usize);
1108 #[must_use]
1109 #[doc = "\n Moves the traversal to the next entry int the current directory.\n\n# Arguments\n- traversal The traversal to use\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n 0 on success, less than 0 on error."]
1110 pub fn sqsh_tree_traversal_next(
1111 traversal: *mut SqshTreeTraversal,
1112 err: *mut ::core::ffi::c_int,
1113 ) -> bool;
1114 #[doc = " Returns the inode type of the current entry.\n\n\n# Arguments\n- traversal The traversal to use\n\n# Returns\n the inode type of the current entry."]
1115 pub fn sqsh_tree_traversal_type(traversal: *const SqshTreeTraversal) -> SqshFileType;
1116 #[doc = "\n returns the state of the traversal.\n\n# Arguments\n- traversal The traversal to use\n\n# Returns\n 0 on success, less than 0 on error."]
1117 pub fn sqsh_tree_traversal_state(traversal: *const SqshTreeTraversal)
1118 -> SqshTreeTraversalState;
1119 #[doc = "\n Returns the name of the current entry. This entry is not zero\n terminated. The function will return an emptry string for the uppermost\n object.\n\n# Arguments\n- traversal The traversal to use\n- len Pointer to a size_t where the length of the name will\n be stored.\n\n# Returns\n the name of the current entry."]
1120 pub fn sqsh_tree_traversal_name(
1121 traversal: *const SqshTreeTraversal,
1122 len: *mut usize,
1123 ) -> *const ::core::ffi::c_char;
1124 #[doc = " Returns the name of the current entry. This entry is not zero\n terminated.\n\n\n# Arguments\n- traversal The traversal to use\n\n# Returns\n the name of the current entry."]
1125 pub fn sqsh_tree_traversal_path_dup(
1126 traversal: *const SqshTreeTraversal,
1127 ) -> *mut ::core::ffi::c_char;
1128 #[must_use]
1129 #[doc = "\n creates a heap allocated copy of the name of the current entry.\n\n The caller is responsible for calling free() on the returned pointer.\n\n The returned string is 0 terminated.\n\n# Arguments\n- traversal The traversal to use\n\n# Returns\n the name of the current entry."]
1130 pub fn sqsh_tree_traversal_name_dup(
1131 traversal: *const SqshTreeTraversal,
1132 ) -> *mut ::core::ffi::c_char;
1133 #[doc = " Returns the path segment at a given index.\n\n\n# Arguments\n- traversal The traversal to use\n\n# Returns\n the inode of the current entry."]
1134 pub fn sqsh_tree_traversal_depth(traversal: *const SqshTreeTraversal) -> usize;
1135 #[doc = " Returns the length of the path segment at a given index.\n\n\n# Arguments\n- traversal The traversal to use\n- len Pointer to a size_t where the length of the name\n will be stored.\n- index The index of the path segment.\n\n# Returns\n the inode of the current entry."]
1136 pub fn sqsh_tree_traversal_path_segment(
1137 traversal: *const SqshTreeTraversal,
1138 len: *mut usize,
1139 index: sqsh_index_t,
1140 ) -> *const ::core::ffi::c_char;
1141 #[doc = " Gets the underlying directory iterator pointing to the current entry.\n\n# Arguments\n- traversal The traversal to use\n\n# Returns\n the inode of the current entry."]
1142 pub fn sqsh_tree_traversal_iterator(
1143 traversal: *const SqshTreeTraversal,
1144 ) -> *const SqshDirectoryIterator;
1145 #[must_use]
1146 #[doc = " Returns the inode of the current entry.\n\n\n# Arguments\n- traversal The traversal to use\n- err Pointer to an int where the error code will be\n\n# Returns\n the inode of the current entry."]
1147 pub fn sqsh_tree_traversal_open_file(
1148 traversal: *const SqshTreeTraversal,
1149 err: *mut ::core::ffi::c_int,
1150 ) -> *mut SqshFile;
1151 #[doc = "\n\n# Arguments\n- traversal The file traversal struct to clean up.\n\n# Returns\n 0 on success, less than 0 on error."]
1152 pub fn sqsh_tree_traversal_free(traversal: *mut SqshTreeTraversal) -> ::core::ffi::c_int;
1153 #[must_use]
1154 #[doc = "\n Allocates and initializes a new xattr iterator.\n\n# Arguments\n- file The file context to iterate through xattrs.\n- err Pointer to an int where the error code will be stored.\n\n# Returns\n The new iterator on success, NULL on error."]
1155 pub fn sqsh_xattr_iterator_new(
1156 file: *const SqshFile,
1157 err: *mut ::core::ffi::c_int,
1158 ) -> *mut SqshXattrIterator;
1159 #[must_use]
1160 #[doc = "\n Advances the iterator to the next xattr.\n\n# Arguments\n- iterator The iterator to advance.\n- err Pointer to an int where the error code will be\n stored.\n\n# Returns\n- true When the iterator was advanced.\n- false When the end of the xattrs list was reached or an error\n occured."]
1161 pub fn sqsh_xattr_iterator_next(
1162 iterator: *mut SqshXattrIterator,
1163 err: *mut ::core::ffi::c_int,
1164 ) -> bool;
1165 #[doc = "\n Retrieves the type of the current xattr.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The type of the current xattr."]
1166 pub fn sqsh_xattr_iterator_type(iterator: *const SqshXattrIterator) -> u16;
1167 #[doc = "\n Checks if the current xattr is indirect.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n true if the xattr is indirect, false otherwise."]
1168 pub fn sqsh_xattr_iterator_is_indirect(iterator: *const SqshXattrIterator) -> bool;
1169 #[doc = "\n Retrieves the prefix of the current xattr.\n\n There are three possible prefixes that can be returned:\n\n - \"user.\"\n - \"trusted.\"\n - \"security.\"\n\n The returned pointer is staticly allocated and must not be freed.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The null terminated prefix of the current xattr. The returned pointer\n is staticly allocated and must not be freed."]
1170 pub fn sqsh_xattr_iterator_prefix(
1171 iterator: *const SqshXattrIterator,
1172 ) -> *const ::core::ffi::c_char;
1173 #[doc = "\n Retrieves the size of the prefix of the current xattr.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The size of the prefix of the current xattr."]
1174 pub fn sqsh_xattr_iterator_prefix_size(iterator: *const SqshXattrIterator) -> u16;
1175 #[doc = "\n Retrieves the name of the current xattr excluding the prefix.\n\n The returned pointer is allocated internally and only valid until the next\n call to sqsh_xattr_iterator_next(). It must not be freed. The string is not 0\n terminated. Use sqsh_xattr_iterator_name_size() to get the size of the name.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The name of the current xattr."]
1176 pub fn sqsh_xattr_iterator_name(
1177 iterator: *const SqshXattrIterator,
1178 ) -> *const ::core::ffi::c_char;
1179 #[doc = "\n Retrieves the size of the name of the current xattr.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The size of the name of the current xattr."]
1180 pub fn sqsh_xattr_iterator_name_size(iterator: *const SqshXattrIterator) -> u16;
1181 #[must_use]
1182 #[doc = "\n Looks up an xattr by name.\n\n# Arguments\n- iterator The iterator to use.\n- name The name to lookup\n\n# Returns\n 0 if the xattr was found, a negative value otherwise."]
1183 pub fn sqsh_xattr_iterator_lookup(
1184 iterator: *mut SqshXattrIterator,
1185 name: *const ::core::ffi::c_char,
1186 ) -> ::core::ffi::c_int;
1187 #[must_use]
1188 #[doc = "\n Compares the full name of the current xattr with a given 0-terminated\n name.\n\n# Arguments\n- iterator The iterator to use.\n- name The name to compare with.\n\n# Returns\n 0 if the names match, a negative value if the current xattr's name\n is less than the given name, a positive value if the current xattr's\n name is greater than the given name."]
1189 pub fn sqsh_xattr_iterator_fullname_cmp(
1190 iterator: *const SqshXattrIterator,
1191 name: *const ::core::ffi::c_char,
1192 ) -> ::core::ffi::c_int;
1193 #[must_use]
1194 #[doc = "\n creates a heap allocated copy of the full name of the current entry.\n\n The caller is responsible for calling free() on the returned pointer.\n\n The returned string is 0 terminated.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The full name of the current xattr on success, NULL if the allocation\n fails."]
1195 pub fn sqsh_xattr_iterator_fullname_dup(
1196 iterator: *const SqshXattrIterator,
1197 ) -> *mut ::core::ffi::c_char;
1198 #[must_use]
1199 #[doc = "\n creates a heap allocated copy of the value of the current entry.\n\n The caller is responsible for calling free() on the returned pointer.\n\n The returned string is 0 terminated.\n\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The value of the current xattr on success, NULL if the allocation\n fails."]
1200 pub fn sqsh_xattr_iterator_value_dup(
1201 iterator: *const SqshXattrIterator,
1202 ) -> *mut ::core::ffi::c_char;
1203 #[doc = "\n Retrieves the value of the current xattr.\n\n The returned pointer is allocated internally and only valid until the next\n call to sqsh_xattr_iterator_next(). It must not be freed. The string is not 0\n terminated. Use sqsh_xattr_iterator_value_size() to get the size of the\n value.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The value of the current xattr. The returned pointer is allocated\n internally and only valid until the next call to sqsh_xattr_iterator_next().\n It must not be freed."]
1204 pub fn sqsh_xattr_iterator_value(
1205 iterator: *const SqshXattrIterator,
1206 ) -> *const ::core::ffi::c_char;
1207 #[doc = "\n Retrieves the size of the value of the current xattr.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The size of the value of the current xattr."]
1208 pub fn sqsh_xattr_iterator_value_size2(iterator: *const SqshXattrIterator) -> u32;
1209 #[deprecated]
1210 #[doc = "\n Retrieves the size of the value of the current xattr.\n Since 1.3.0. Use sqsh_xattr_iterator_value_size2() instead.\n\n# Arguments\n- iterator The iterator to use.\n\n# Returns\n The size of the value of the current xattr."]
1211 pub fn sqsh_xattr_iterator_value_size(iterator: *const SqshXattrIterator) -> u16;
1212 #[doc = "\n Frees the resources used by an xattr iterator.\n\n# Arguments\n- iterator The iterator to free.\n\n# Returns\n 0 on success, a negative value on error."]
1213 pub fn sqsh_xattr_iterator_free(iterator: *mut SqshXattrIterator) -> ::core::ffi::c_int;
1214}