libsquashfs  1.3.2
A new set of tools and libraries for working with SquashFS images
io.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later */
2 /*
3  * io.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_IO_H
21 #define SQFS_IO_H
22 
23 #include "sqfs/predef.h"
24 
36 typedef enum {
47 
56 
78 
79  SQFS_FILE_OPEN_ALL_FLAGS = 0x07,
81 
94 struct sqfs_file_t {
95  sqfs_object_t base;
96 
109  int (*read_at)(sqfs_file_t *file, sqfs_u64 offset,
110  void *buffer, size_t size);
111 
124  int (*write_at)(sqfs_file_t *file, sqfs_u64 offset,
125  const void *buffer, size_t size);
126 
132  sqfs_u64 (*get_size)(const sqfs_file_t *file);
133 
144  int (*truncate)(sqfs_file_t *file, sqfs_u64 size);
145 };
146 
147 #ifdef __cplusplus
148 extern "C" {
149 #endif
150 
168 SQFS_API sqfs_file_t *sqfs_open_file(const char *filename, sqfs_u32 flags);
169 
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 #endif /* SQFS_IO_H */
If set, do not try to apply any character set transformations to the file path.
Definition: io.h:77
int(* write_at)(sqfs_file_t *file, sqfs_u64 offset, const void *buffer, size_t size)
Write a chunk of data at an absolute position.
Definition: io.h:124
SQFS_FILE_OPEN_FLAGS
Flags for sqfs_open_file.
Definition: io.h:36
int(* truncate)(sqfs_file_t *file, sqfs_u64 size)
Extend or shrink a file to a specified size.
Definition: io.h:144
Abstracts file I/O to make it easy to embedd SquashFS.
Definition: io.h:94
int(* read_at)(sqfs_file_t *file, sqfs_u64 offset, void *buffer, size_t size)
Read a chunk of data from an absolute position.
Definition: io.h:109
SQFS_API sqfs_file_t * sqfs_open_file(const char *filename, sqfs_u32 flags)
Open a file through the operating systems filesystem API.
Base interface for all libsquashfs in-memory data structures.
Definition: predef.h:126
If set, access the file for reading only.
Definition: io.h:46
sqfs_u64(* get_size)(const sqfs_file_t *file)
Get the number of bytes currently stored in the file.
Definition: io.h:132
Includes forward declarations of data structures, macros and integer types.
If the read only flag is not set, overwrite any existing file.
Definition: io.h:55