dmlite  0.4
Typedefs | Functions
io.h File Reference

C wrapper for I/O interfaces. More...

#include "any.h"
#include "dmlite.h"
Include dependency graph for io.h:

Go to the source code of this file.

Typedefs

typedef struct dmlite_fd dmlite_fd

Functions

dmlite_fddmlite_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

typedef struct dmlite_fd dmlite_fd

Handle for a file descriptor.

Function Documentation

int dmlite_donewriting ( dmlite_context context,
const char *  pfn,
const dmlite_any_dict extra 
)

Finishes a PUT.

Parameters
contextThe DM context.
pfnThe replica file name.
extraThe extra parameters as returned by dmlite_put.
Returns
0 on success, error code otherwise.
int dmlite_fclose ( dmlite_fd fd)

Closes a file.

Parameters
fdThe file descriptor as returned by dmlite_open.
Returns
0 on sucess, error code otherwise.
int dmlite_feof ( dmlite_fd fd)

Returns 1 if EOF.

Parameters
fdThe file descriptor.
Returns
0 if there is more to read. 1 if EOF.
dmlite_fd* dmlite_fopen ( dmlite_context context,
const char *  path,
int  flags,
const dmlite_any_dict extra 
)

Opens a file.

Parameters
contextThe DM context.
pathThe path to open.
flagsSee open()
extraThe 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
fdThe file descriptor.
bufferWhere to put the data.
countNumber 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
fdThe file descriptor.
offsetThe offset.
whenceSee fseek()
Returns
0 on sucess, error code otherwise.
long dmlite_ftell ( dmlite_fd fd)

Returns the cursor position.

Parameters
fdThe file descriptor.
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
fdThe file descriptor.
bufferA pointer to the data.
countNumber of bytes to write.
Returns
Number of bytes actually written. -1 on failure.