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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Parameters<br />

fileDesc The file descriptor identifying the file to which <strong>GPFS</strong> applies the hints <strong>and</strong> directives.<br />

fcntlArgP A pointer to the list of operations to be passed to <strong>GPFS</strong>.<br />

Exit status<br />

If the gpfs_fcntl() subroutine is successful, it returns a value of 0.<br />

If the gpfs_fcntl() 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 />

EBADF The file descriptor is not valid.<br />

EINVAL The file descriptor does not refer to a <strong>GPFS</strong> file or a regular file.<br />

The system call is not valid.<br />

ENOSYS The gpfs_fcntl() subroutine is not supported under the current file system format.<br />

E2BIG An argument is longer than <strong>GPFS</strong>_MAX_FCNTL_LENGTH.<br />

Examples<br />

1. This programming segment releases all cache data held by the file h<strong>and</strong>le <strong>and</strong> tell <strong>GPFS</strong> that the<br />

subroutine will write the portion of the file with file offsets between 2 GB <strong>and</strong> 3 GB minus one:<br />

struct<br />

{<br />

gpfsFcntlHeader_t hdr;<br />

gpfsClearFileCache_t rel;<br />

gpfsAccessRange_t acc;<br />

} arg;<br />

arg.hdr.totalLength = sizeof(arg);<br />

arg.hdr.fcntlVersion = <strong>GPFS</strong>_FCNTL_CURRENT_VERSION;<br />

arg.hdr.fcntlReserved = 0;<br />

arg.rel.structLen = sizeof(arg.rel);<br />

arg.rel.structType = <strong>GPFS</strong>_CLEAR_FILE_CACHE;<br />

arg.acc.structLen = sizeof(arg.acc);<br />

arg.acc.structType = <strong>GPFS</strong>_ACCESS_RANGE;<br />

arg.acc.start = 2LL * 1024LL * 1024LL * 1024LL;<br />

arg.acc.length = 1024 * 1024 * 1024;<br />

arg.acc.isWrite = 1;<br />

rc = gpfs_fcntl(h<strong>and</strong>le, &arg);<br />

2. This programming segment gets the storage pool name <strong>and</strong> fileset name of a file from <strong>GPFS</strong>.<br />

struct {<br />

gpfsFcntlHeader_t hdr;<br />

gpfsGetStoragePool_t pool;<br />

gpfsGetFilesetName_t fileset;<br />

} fcntlArg;<br />

fcntlArg.hdr.totalLength = sizeof(fcntlArg.hdr) + sizeof(fcntlArg.pool) + sizeof(fcntlArg.fileset);<br />

fcntlArg.hdr.fcntlVersion = <strong>GPFS</strong>_FCNTL_CURRENT_VERSION;<br />

fcntlArg.hdr.fcntlReserved = 0;<br />

fcntlArg.pool.structLen = sizeof(fcntlArg.pool);<br />

gpfs_fcntl() Subroutine<br />

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

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

Saved successfully!

Ooh no, something went wrong!