Go to the source code of this file.
Detailed Description
Function Documentation
- Parameters:
-
Close and destroy a GslHFile. This function is MT-safe and may be called from any thread.
- Parameters:
-
file_name | name of the file to open |
- Returns:
- a new opened GslHFile or NULL if an error occoured (errno set)
Open a file for reading and return the associated GSL hashed file. The motivation for using a GslHFile over normal unix file descriptors is to reduce the amount of opened unix file descriptors and to ensure thread safety upon reading offset relative byte blocks. Multiple open GslHFiles with equal file names will share a single unix file descriptor as long as the file wasn't modified meanwhile. This function is MT-safe and may be called from any thread.
- Parameters:
-
hfile | valid GslHFile |
offset | offset in bytes within 0 and file end |
n_bytes | number of bytes to read |
bytes | buffer to store read bytes |
- Returns:
- amount of bytes read or -1 if an error occoured (errno set)
Read a block of bytes from a GslHFile. This function is MT-safe and may be called from any thread.
- Parameters:
-
- Returns:
- offset of first zero byte or -1
Find the offset of the first zero byte in a GslHFile. This function is MT-safe and may be called from any thread.
- Parameters:
-
Close and destroy a GslRFile.
- Parameters:
-
- Returns:
- total length of the GslRFile in bytes
Retrieve the file length of rfile in bytes.
- Parameters:
-
- Returns:
- the file name used to open this file
Retrieve the file name used to open rfile.
- Parameters:
-
file_name | name of the file to open |
- Returns:
- a new opened GslRFile or NULL if an error occoured (errno set)
Open a file for reading and create a GSL read only file handle for it. The motivation for using a GslRFile over normal unix files is to reduce the amount of opened unix file descriptors by using a GslHFile for the actual IO.
- Parameters:
-
rfile | valid GslRFile |
offset | offset in bytes within 0 and gsl_rfile_length() |
n_bytes | number of bytes to read |
bytes | buffer to store read bytes |
- Returns:
- amount of bytes read or -1 if an error occoured (errno set)
Read a block of bytes from a GslRFile at a specified position.
- Parameters:
-
rfile | valid GslRFile |
n_bytes | number of bytes to read |
bytes | buffer to store read bytes |
- Returns:
- amount of bytes read or -1 if an error occoured (errno set)
Read a block of bytes from a GslRFile from the current seek position and advance the seek position.