libsquashfs 1.3.0
A new set of tools and libraries for working with SquashFS images
|
Contains the sqfs_file_t interface for abstracting file I/O. More...
#include "sqfs/predef.h"
Go to the source code of this file.
Data Structures | |
interface | sqfs_file_t |
Abstracts file I/O to make it easy to embedd SquashFS. More... | |
Enumerations | |
enum | SQFS_FILE_OPEN_FLAGS { SQFS_FILE_OPEN_READ_ONLY = 0x01 , SQFS_FILE_OPEN_OVERWRITE = 0x02 , SQFS_FILE_OPEN_NO_CHARSET_XFRM = 0x04 , SQFS_FILE_OPEN_ALL_FLAGS = 0x07 } |
Flags for sqfs_open_file. More... | |
Functions | |
SQFS_API sqfs_file_t * | sqfs_open_file (const char *filename, sqfs_u32 flags) |
Open a file through the operating systems filesystem API. | |
Contains the sqfs_file_t interface for abstracting file I/O.
Definition in file io.h.
enum SQFS_FILE_OPEN_FLAGS |
Flags for sqfs_open_file.
Enumerator | |
---|---|
SQFS_FILE_OPEN_READ_ONLY | If set, access the file for reading only. If not set, the file is expected to have a zero size after opening which can be grown with successive writes to end of the file. Opening an existing file with this flag cleared results in failure, unless the SQFS_FILE_OPEN_OVERWRITE flag is also set. |
SQFS_FILE_OPEN_OVERWRITE | If the read only flag is not set, overwrite any existing file. If the file alrady exists, it is truncated to zero bytes size and overwritten. |
SQFS_FILE_OPEN_NO_CHARSET_XFRM | If set, do not try to apply any character set transformations to the file path. This flag instructs the sqfs_open_file API to pass the file path to the OS dependent API as-is and not to attempt any character set transformation. By default, if the underlying OS has a concept of locale dependent file paths, the input path is UTF-8 and it is transformed as needed, in order to retain a level of portabillity and sanity. This flag currently only affects the Windows implementation. On Unix-like systems, the path is always passed to the OS API as-is and this flag has no effect. On Windows, the input path is converted from UTF-8 to UTF-16 and then passed on to the wide-char based file API. If this flag is set, the path is used as-is and passed on to the 8-bit codepage-whatever API instead. |
SQFS_API sqfs_file_t * sqfs_open_file | ( | const char * | filename, |
sqfs_u32 | flags | ||
) |
Open a file through the operating systems filesystem API.
This function internally creates an instance of a reference implementation of the sqfs_file_t interface that uses the operating systems native API for file I/O.
On Unix-like systems, if the open call fails, this function makes sure to preserves the value in errno indicating the underlying problem. Similarly, on Windows, the implementation tries to preserve the GetLastError value.
filename | The name of the file to open. |
flags | A set of SQFS_FILE_OPEN_FLAGS. |