C wrapper for I/O interfaces.
More...
#include "any.h"
#include "dmlite.h"
Go to the source code of this file.
Functions |
dmlite_fd * | dmlite_fopen (dmlite_context *context, const char *path, int flags, const dmlite_any_dict *extra) |
| Opens a file.
|
int | dmlite_fclose (dmlite_fd *fd) |
| Closes a file.
|
int | dmlite_fseek (dmlite_fd *fd, long offset, int whence) |
| Sets the file position.
|
long | dmlite_ftell (dmlite_fd *fd) |
| Returns the cursor position.
|
size_t | dmlite_fread (dmlite_fd *fd, void *buffer, size_t count) |
| Reads from a file.
|
size_t | dmlite_fwrite (dmlite_fd *fd, const void *buffer, size_t count) |
| Writes to a file.
|
int | dmlite_feof (dmlite_fd *fd) |
| Returns 1 if EOF.
|
int | dmlite_donewriting (dmlite_context *context, const char *pfn, const dmlite_any_dict *extra) |
| Finishes a PUT.
|
Detailed Description
C wrapper for I/O interfaces.
- Author
- Alejandro Álvarez Ayllon aalva.nosp@m.rez@.nosp@m.cern..nosp@m.ch
Typedef Documentation
Handle for a file descriptor.
Function Documentation
Finishes a PUT.
- Parameters
-
context | The DM context. |
pfn | The replica file name. |
extra | The extra parameters as returned by dmlite_put. |
- Returns
- 0 on success, error code otherwise.
Closes a file.
- Parameters
-
fd | The file descriptor as returned by dmlite_open. |
- Returns
- 0 on sucess, error code otherwise.
Returns 1 if EOF.
- Parameters
-
- Returns
- 0 if there is more to read. 1 if EOF.
Opens a file.
- Parameters
-
context | The DM context. |
path | The path to open. |
flags | See open() |
extra | The key-value pairs. |
- Returns
- An opaque handler for the file, NULL on failure.
size_t dmlite_fread |
( |
dmlite_fd * |
fd, |
|
|
void * |
buffer, |
|
|
size_t |
count |
|
) |
| |
Reads from a file.
- Parameters
-
fd | The file descriptor. |
buffer | Where to put the data. |
count | Number of bytes to read. |
- Returns
- Number of bytes actually read on success. -1 on failure.
int dmlite_fseek |
( |
dmlite_fd * |
fd, |
|
|
long |
offset, |
|
|
int |
whence |
|
) |
| |
Sets the file position.
- Parameters
-
fd | The file descriptor. |
offset | The offset. |
whence | See fseek() |
- Returns
- 0 on sucess, error code otherwise.
Returns the cursor position.
- Parameters
-
- Returns
- The cursor position, or -1 on error.
size_t dmlite_fwrite |
( |
dmlite_fd * |
fd, |
|
|
const void * |
buffer, |
|
|
size_t |
count |
|
) |
| |
Writes to a file.
- Parameters
-
fd | The file descriptor. |
buffer | A pointer to the data. |
count | Number of bytes to write. |
- Returns
- Number of bytes actually written. -1 on failure.