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 <aalvarez@cern.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:
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.
int dmlite_fclose ( dmlite_fd fd  ) 

Closes a file.

Parameters:
fd The 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:
fd The 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:
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.
long dmlite_ftell ( dmlite_fd fd  ) 

Returns the cursor position.

Parameters:
fd The 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:
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.

Generated on 6 Mar 2013 for dmlite by  doxygen 1.6.1