Table of Contents

NAME

gfs_read, gfs_nb_read, gfs_write, gfs_nb_write, - access the data within a fork.

SYNOPSIS

#include <gfs.h>

int gfs_read(int fork_id, char *buf, ulong_t offset, ulong_t size);

int gfs_nb_read(gfs_handle handle, int fork_id, char *buf, ulong_t offset, ulong_t size);

int gfs_write(int fork_id, char *buf, ulong_t offset, ulong_t size);

int gfs_nb_write(gfs_handle handle, int fork_id, char *buf, ulong_t offset, ulong_t size);

DESCRIPTION

gfs_read() and gfs_nb_read() read up to size bytes from fork fork_id, starting at offset offset, and storing the data into the buffer starting at buf. gfs_write() and gfs_nb_write() write up to size bytes to fork fork_id, starting at offset offset, and taking the data from the buffer starting at buf.

gfs_read and gfs_write are blocking calls, so they will not return until all the data has been transferred from the local buffer.

gfs_nb_read and gfs_nb_write are non-blocking calls, so they will return immediately. The application can call gfs_test(handle) to determine whether or not all the data has been transferred. The application must call gfs_wait(handle) before handle may be used in another nonblocking call.

RETURN VALUE

On a successful blocking call, the number of bytes read or written are returned. On a successful non-blocking call, 0 is returned. On error, -1 is returned, and gfs_errno is set appropriately.

ERRORS

GFS_EBADF
fork_id is not a valid fork.

GFS_EINVAL

handle is not a valid gfs_handle.

GFS_EIO A failure occurred at the server. This should not happen.

GFS_EBUSY
Can only occur on a non-blocking request. handle is already attached to an outstanding request, and needs to be "cleared" by calling gfs_wait(handle).


Table of Contents