libisofs  1.4.8
Data Fields
IsoFileSource_Iface Struct Reference

Interface definition for an IsoFileSource. More...

#include <libisofs.h>

Data Fields

int version
 Tells the version of the interface: Version 0 provides functions up to (*lseek)(). More...
 
char *(* get_path )(IsoFileSource *src)
 Get the absolute path in the filesystem this file source belongs to. More...
 
char *(* get_name )(IsoFileSource *src)
 Get the name of the file, with the dir component of the path. More...
 
int(* lstat )(IsoFileSource *src, struct stat *info)
 Get information about the file. More...
 
int(* stat )(IsoFileSource *src, struct stat *info)
 Get information about the file. More...
 
int(* access )(IsoFileSource *src)
 Check if the process has access to read file contents. More...
 
int(* open )(IsoFileSource *src)
 Opens the source. More...
 
int(* close )(IsoFileSource *src)
 Close a previuously openned file. More...
 
int(* read )(IsoFileSource *src, void *buf, size_t count)
 Attempts to read up to count bytes from the given source into the buffer starting at buf. More...
 
int(* readdir )(IsoFileSource *src, IsoFileSource **child)
 Read a directory. More...
 
int(* readlink )(IsoFileSource *src, char *buf, size_t bufsiz)
 Read the destination of a symlink. More...
 
IsoFilesystem *(* get_filesystem )(IsoFileSource *src)
 Get the filesystem for this source. More...
 
void(* free )(IsoFileSource *src)
 Free implementation specific data. More...
 
off_t(* lseek )(IsoFileSource *src, off_t offset, int flag)
 Repositions the offset of the IsoFileSource (must be opened) to the given offset according to the value of flag. More...
 
int(* get_aa_string )(IsoFileSource *src, unsigned char **aa_string, int flag)
 Valid only if .version is > 0. More...
 
int(* clone_src )(IsoFileSource *old_src, IsoFileSource **new_src, int flag)
 Produce a copy of a source. More...
 

Detailed Description

Interface definition for an IsoFileSource.

Defines the POSIX-like function to access files and abstract underlying source.

Since
0.6.2

Definition at line 633 of file libisofs.h.

Field Documentation

◆ access

int(* IsoFileSource_Iface::access) (IsoFileSource *src)

Check if the process has access to read file contents.

Note that this is not necessarily related with (l)stat functions. For example, in a filesystem implementation to deal with an ISO image, if the user has read access to the image it will be able to read all files inside it, despite of the particular permission of each file in the RR tree, that are what the above functions return.

Returns
1 if process has read access, < 0 on error (has to be a valid libisofs error code) Error codes: ISO_FILE_ACCESS_DENIED ISO_FILE_BAD_PATH ISO_FILE_DOESNT_EXIST ISO_OUT_OF_MEM ISO_FILE_ERROR ISO_NULL_POINTER

Definition at line 713 of file libisofs.h.

◆ clone_src

int(* IsoFileSource_Iface::clone_src) (IsoFileSource *old_src, IsoFileSource **new_src, int flag)

Produce a copy of a source.

It must be possible to operate both source objects concurrently.

Parameters
old_srcThe existing source object to be copied
new_streamWill return a pointer to the copy
flagBitfield for control purposes. Submit 0 for now. The function shall return ISO_STREAM_NO_CLONE on unknown flag bits.
Since
1.0.2 Present if .version is 2 or higher.

Definition at line 892 of file libisofs.h.

◆ close

int(* IsoFileSource_Iface::close) (IsoFileSource *src)

Close a previuously openned file.

Returns
1 on success, < 0 on error Error codes: ISO_FILE_ERROR ISO_NULL_POINTER ISO_FILE_NOT_OPENED

Definition at line 737 of file libisofs.h.

◆ free

void(* IsoFileSource_Iface::free) (IsoFileSource *src)

Free implementation specific data.

Should never be called by user. Use iso_file_source_unref() instead.

Definition at line 823 of file libisofs.h.

◆ get_aa_string

int(* IsoFileSource_Iface::get_aa_string) (IsoFileSource *src, unsigned char **aa_string, int flag)

Valid only if .version is > 0.

See above. Get the AAIP string with encoded ACL and xattr. (Not to be confused with ECMA-119 Extended Attributes).

bit1 and bit2 of flag should be implemented so that freshly fetched info does not include the undesired ACL or xattr. Nevertheless if the aa_string is cached, then it is permissible that ACL and xattr are still delivered.

Parameters
flagBitfield for control purposes bit0= Transfer ownership of AAIP string data. src will free the eventual cached data and might not be able to produce it again. bit1= No need to get ACL (no guarantee of exclusion) bit2= No need to get xattr (no guarantee of exclusion)
aa_stringReturns a pointer to the AAIP string data. If no AAIP string is available, aa_string becomes NULL. (See doc/susp_aaip__*.txt for the meaning of AAIP and libisofs/aaip_0_2.h for encoding and decoding.) The caller is responsible for finally calling free() on non-NULL results.
Returns
1 means success (*aa_string == NULL is possible) <0 means failure and must b a valid libisofs error code (e.g. ISO_FILE_ERROR if no better one can be found).
Since
0.6.14

Definition at line 874 of file libisofs.h.

◆ get_filesystem

IsoFilesystem*(* IsoFileSource_Iface::get_filesystem) (IsoFileSource *src)

Get the filesystem for this source.

No extra ref is added, so you musn't unref the IsoFilesystem.

Returns
The filesystem, NULL on error

Definition at line 817 of file libisofs.h.

◆ get_name

char*(* IsoFileSource_Iface::get_name) (IsoFileSource *src)

Get the name of the file, with the dir component of the path.

Returns
the name of the file, it should be freed when no more needed.

Definition at line 661 of file libisofs.h.

◆ get_path

char*(* IsoFileSource_Iface::get_path) (IsoFileSource *src)

Get the absolute path in the filesystem this file source belongs to.

Returns
the path of the FileSource inside the filesystem, it should be freed when no more needed.

Definition at line 653 of file libisofs.h.

◆ lseek

off_t(* IsoFileSource_Iface::lseek) (IsoFileSource *src, off_t offset, int flag)

Repositions the offset of the IsoFileSource (must be opened) to the given offset according to the value of flag.

Parameters
offsetin bytes
flag0 The offset is set to offset bytes (SEEK_SET) 1 The offset is set to its current location plus offset bytes (SEEK_CUR) 2 The offset is set to the size of the file plus offset bytes (SEEK_END).
Returns
Absolute offset position of the file, or < 0 on error. Cast the returning value to int to get a valid libisofs error.
Since
0.6.4

Definition at line 843 of file libisofs.h.

◆ lstat

int(* IsoFileSource_Iface::lstat) (IsoFileSource *src, struct stat *info)

Get information about the file.

It is equivalent to lstat(2).

Returns
1 success, < 0 error (has to be a valid libisofs error code) Error codes: ISO_FILE_ACCESS_DENIED ISO_FILE_BAD_PATH ISO_FILE_DOESNT_EXIST ISO_OUT_OF_MEM ISO_FILE_ERROR ISO_NULL_POINTER

Definition at line 676 of file libisofs.h.

◆ open

int(* IsoFileSource_Iface::open) (IsoFileSource *src)

Opens the source.

Returns
1 on success, < 0 on error (has to be a valid libisofs error code) Error codes: ISO_FILE_ALREADY_OPENED ISO_FILE_ACCESS_DENIED ISO_FILE_BAD_PATH ISO_FILE_DOESNT_EXIST ISO_OUT_OF_MEM ISO_FILE_ERROR ISO_NULL_POINTER

Definition at line 727 of file libisofs.h.

◆ read

int(* IsoFileSource_Iface::read) (IsoFileSource *src, void *buf, size_t count)

Attempts to read up to count bytes from the given source into the buffer starting at buf.

The file src must be open() before calling this, and close() when no more needed. Not valid for dirs. On symlinks it reads the destination file.

Returns
number of bytes read, 0 if EOF, < 0 on error (has to be a valid libisofs error code) Error codes: ISO_FILE_ERROR ISO_NULL_POINTER ISO_FILE_NOT_OPENED ISO_WRONG_ARG_VALUE -> if count == 0 ISO_FILE_IS_DIR ISO_OUT_OF_MEM ISO_INTERRUPTED

Definition at line 759 of file libisofs.h.

◆ readdir

int(* IsoFileSource_Iface::readdir) (IsoFileSource *src, IsoFileSource **child)

Read a directory.

Each call to this function will return a new children, until we reach the end of file (i.e, no more children), in that case it returns 0.

The dir must be open() before calling this, and close() when no more needed. Only valid for dirs.

Note that "." and ".." children MUST NOT BE returned.

Parameters
childpointer to be filled with the given child. Undefined on error or OEF
Returns
1 on success, 0 if EOF (no more children), < 0 on error (has to be a valid libisofs error code) Error codes: ISO_FILE_ERROR ISO_NULL_POINTER ISO_FILE_NOT_OPENED ISO_FILE_IS_NOT_DIR ISO_OUT_OF_MEM

Definition at line 784 of file libisofs.h.

◆ readlink

int(* IsoFileSource_Iface::readlink) (IsoFileSource *src, char *buf, size_t bufsiz)

Read the destination of a symlink.

You don't need to open the file to call this.

Parameters
bufallocated buffer of at least bufsiz bytes. The dest. will be copied there, and it will be NULL-terminated
bufsizcharacters to be copied. Destination link will be truncated if it is larger than given size. This include the 0x0 character.
Returns
1 on success, < 0 on error (has to be a valid libisofs error code) Error codes: ISO_FILE_ERROR ISO_NULL_POINTER ISO_WRONG_ARG_VALUE -> if bufsiz <= 0 ISO_FILE_IS_NOT_SYMLINK ISO_OUT_OF_MEM ISO_FILE_BAD_PATH ISO_FILE_DOESNT_EXIST

Definition at line 808 of file libisofs.h.

◆ stat

int(* IsoFileSource_Iface::stat) (IsoFileSource *src, struct stat *info)

Get information about the file.

If the file is a symlink, the info returned refers to the destination. It is equivalent to stat(2).

Returns
1 success, < 0 error Error codes: ISO_FILE_ACCESS_DENIED ISO_FILE_BAD_PATH ISO_FILE_DOESNT_EXIST ISO_OUT_OF_MEM ISO_FILE_ERROR ISO_NULL_POINTER

Definition at line 692 of file libisofs.h.

◆ version

int IsoFileSource_Iface::version

Tells the version of the interface: Version 0 provides functions up to (*lseek)().

Since
0.6.2 Version 1 additionally provides function *(get_aa_string)().
0.6.14 Version 2 additionally provides function *(clone_src)().
1.0.2

Definition at line 644 of file libisofs.h.


The documentation for this struct was generated from the following file:

Generated for libisofs by  doxygen 1.8.14