29.01.2013 Views

GPFS: Administration and Programming Reference - IRA Home

GPFS: Administration and Programming Reference - IRA Home

GPFS: Administration and Programming Reference - IRA Home

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

gpfs_iread() Subroutine<br />

Name<br />

gpfs_iread() - Reads a file opened by gpfs_iopen().<br />

Library<br />

<strong>GPFS</strong> Library (libgpfs.a for AIX, libgpfs.so for Linux)<br />

Synopsis<br />

#include <br />

int gpfs_iread(gpfs_ifile_t *ifile,<br />

void *buffer,<br />

int bufferSize,<br />

gpfs_off64_t *offset);<br />

Description<br />

The gpfs_iread() subroutine reads data from the file indicated by the ifile parameter returned from<br />

gpfs_iopen(). This subroutine reads data beginning at parameter offset <strong>and</strong> continuing for bufferSize<br />

bytes into the buffer specified by buffer. If successful, the subroutine returns a value that is the length of<br />

the data read, <strong>and</strong> sets parameter offset to the offset of the next byte to be read. A return value of 0<br />

indicates end-of-file.<br />

For an overview of using gpfs_iread() in a backup application, see “Using APIs to develop backup<br />

applications” on page 24.<br />

Notes:<br />

1. Compile any program that uses this subroutine with the -lgpfs flag from the following library:<br />

v libgpfs.a for AIX<br />

v libgpfs.so for Linux<br />

Parameters<br />

ifile Pointer to gpfs_ifile_t from gpfs_iopen().<br />

buffer Buffer for the data to be read.<br />

bufferSize Size of the buffer (that is, the amount of data to be read).<br />

offset Offset of where within the file to read. If gpfs_iread() is successful, offset is updated to<br />

the next byte after the last one that was read.<br />

Exit status<br />

If the gpfs_iread() subroutine is successful, it returns the number of bytes read.<br />

If the gpfs_iread() subroutine is unsuccessful, it returns a value of -1 <strong>and</strong> sets the global error variable<br />

errno to indicate the nature of the error.<br />

Exceptions<br />

None.<br />

Error status<br />

EISDIR The specified file is a directory.<br />

ENOSYS The gpfs_iread() subroutine is not available.<br />

Chapter 9. <strong>GPFS</strong> programming interfaces 319

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!