dmlite
0.6
|
C wrapper for I/O interfaces. More...
Go to the source code of this file.
Macros | |
#define | O_INSECURE 010 |
Typedefs | |
typedef struct dmlite_fd | dmlite_fd |
Functions | |
dmlite_fd * | dmlite_fopen (dmlite_context *context, const char *path, int flags, const dmlite_any_dict *extra,...) |
Opens a file. More... | |
int | dmlite_fclose (dmlite_fd *fd) |
Closes a file. More... | |
int | dmlite_fstat (dmlite_fd *fd, struct stat *buf) |
Gets information about a file descriptor. More... | |
int | dmlite_fseek (dmlite_fd *fd, off_t offset, int whence) |
Sets the file position. More... | |
off_t | dmlite_ftell (dmlite_fd *fd) |
Returns the cursor position. More... | |
ssize_t | dmlite_fread (dmlite_fd *fd, void *buffer, size_t count) |
Reads from a file. More... | |
ssize_t | dmlite_fwrite (dmlite_fd *fd, const void *buffer, size_t count) |
Writes to a file. More... | |
ssize_t | dmlite_freadv (dmlite_fd *fd, const struct iovec *vector, size_t count) |
Reads from a file into multiple buffers. More... | |
ssize_t | dmlite_fwritev (dmlite_fd *fd, const struct iovec *vector, size_t count) |
Reads from a file into multiple buffers. More... | |
ssize_t | dmlite_fpread (dmlite_fd *fd, void *buffer, size_t count, off_t offset) |
Reads up to count bytes starting at the given offset. Does not change internal offset. More... | |
ssize_t | dmlite_fpwrite (dmlite_fd *fd, const void *buffer, size_t count, off_t offset) |
Writes count bytes starting at the given offset. Does not change internal offset. More... | |
int | dmlite_feof (dmlite_fd *fd) |
Returns 1 if EOF. More... | |
int | dmlite_ferrno (dmlite_fd *fd) |
Returns the last errror code. More... | |
const char * | dmlite_ferror (dmlite_fd *fd) |
Returns the last error message. More... | |
int | dmlite_donewriting (dmlite_context *context, const dmlite_location *loc) |
Finishes a PUT. More... | |
int | dmlite_fileno (dmlite_fd *fd) |
Returns the system file descriptor if available. More... | |
C wrapper for I/O interfaces.
#define O_INSECURE 010 |
Use this flag in addition to the standard ones to skip any security check (i.e. token validation)
int dmlite_donewriting | ( | dmlite_context * | context, |
const dmlite_location * | loc | ||
) |
Finishes a PUT.
context | The DM context. |
loc | The location as returned by dmlite_put. |
int dmlite_fclose | ( | dmlite_fd * | fd | ) |
Closes a file.
fd | The file descriptor as returned by dmlite_open. |
int dmlite_feof | ( | dmlite_fd * | fd | ) |
Returns 1 if EOF.
fd | The file descriptor. |
int dmlite_ferrno | ( | dmlite_fd * | fd | ) |
Returns the last errror code.
fd | The file descriptor. |
const char* dmlite_ferror | ( | dmlite_fd * | fd | ) |
Returns the last error message.
fd | The file descriptor. |
int dmlite_fileno | ( | dmlite_fd * | fd | ) |
Returns the system file descriptor if available.
fd | The file descriptor. |
dmlite_fd* dmlite_fopen | ( | dmlite_context * | context, |
const char * | path, | ||
int | flags, | ||
const dmlite_any_dict * | extra, | ||
... | |||
) |
Opens a file.
context | The DM context. |
path | The path to open. |
flags | See open() |
extra | The key-value pairs. |
... | Should be mode_t when called with O_CREAT. |
ssize_t dmlite_fpread | ( | dmlite_fd * | fd, |
void * | buffer, | ||
size_t | count, | ||
off_t | offset | ||
) |
Reads up to count bytes starting at the given offset. Does not change internal offset.
fd | File descriptor. |
buffer | Buffer where to put the data. |
count | Number of bytes to read. |
offset | Read offset. |
ssize_t dmlite_fpwrite | ( | dmlite_fd * | fd, |
const void * | buffer, | ||
size_t | count, | ||
off_t | offset | ||
) |
Writes count bytes starting at the given offset. Does not change internal offset.
fd | File descriptor. |
buffer | Data to write. |
count | Number of bytes to read. |
offset | Write offset. |
ssize_t dmlite_fread | ( | dmlite_fd * | fd, |
void * | buffer, | ||
size_t | count | ||
) |
Reads from a file.
fd | The file descriptor. |
buffer | Where to put the data. |
count | Number of bytes to read. |
ssize_t dmlite_freadv | ( | dmlite_fd * | fd, |
const struct iovec * | vector, | ||
size_t | count | ||
) |
Reads from a file into multiple buffers.
fd | The file descriptor. |
vector | Array of buffers. |
count | Number of elements in the array of buffers. |
int dmlite_fseek | ( | dmlite_fd * | fd, |
off_t | offset, | ||
int | whence | ||
) |
Sets the file position.
fd | The file descriptor. |
offset | The offset. |
whence | See fseek() |
int dmlite_fstat | ( | dmlite_fd * | fd, |
struct stat * | buf | ||
) |
Gets information about a file descriptor.
fd | The file descriptor. |
buf | Where to put the information. |
off_t dmlite_ftell | ( | dmlite_fd * | fd | ) |
Returns the cursor position.
fd | The file descriptor. |
ssize_t dmlite_fwrite | ( | dmlite_fd * | fd, |
const void * | buffer, | ||
size_t | count | ||
) |
Writes to a file.
fd | The file descriptor. |
buffer | A pointer to the data. |
count | Number of bytes to write. |
ssize_t dmlite_fwritev | ( | dmlite_fd * | fd, |
const struct iovec * | vector, | ||
size_t | count | ||
) |
Reads from a file into multiple buffers.
fd | The file descriptor. |
vector | Array of buffers. |
count | Number of elements in the array of buffers. |