gpfs_iopen() subroutine
Opens a file or directory by inode number.
Library
GPFS Library (libgpfs.a for AIX®, libgpfs.so for Linux®)
Synopsis
#include <gpfs.h>
gpfs_ifile_t *gpfs_iopen(gpfs_fssnap_handle_t *fssnapHandle,
gpfs_ino_t ino,
int open_flags,
const gpfs_iattr_t *statxbuf,
const char *symLink);
Description
The gpfs_iopen() subroutine opens a user file or directory for backup. The file is identified by its inode number ino within the file system or snapshot identified by the fssnapHandle. The fssnapHandle parameter must be the same one that was used to create the inode scan that returned the inode number ino.
To read the file or directory, the open_flags must be set to GPFS_O_BACKUP. The statxbuf and symLink parameters are reserved for future use and must be set to NULL.
For an overview of using gpfs_iopen() in a backup application, see Using APIs to develop backup applications.
- libgpfs.a for AIX
- libgpfs.so for Linux
Parameters
- fssnapHandle
- File system snapshot handle.
- ino
- The inode number.
- open_flags
-
- GPFS_O_BACKUP
- Read files for backup.
- O_RDONLY
- For gpfs_iread().
- statxbuf
- This parameter is reserved for future use and should always be set to NULL.
- symLink
- This parameter is reserved for future use and should always be set to NULL.
Exit status
If the gpfs_iopen() subroutine is successful, it returns a pointer to the inode's file handle.
If the gpfs_iopen() subroutine is unsuccessful, it returns NULL and the global error variable errno is set to indicate the nature of the error.
Exceptions
None.
Error status
Error codes include but are not limited to the following:
- EINVAL
- Missing or incorrect parameter.
- ENOENT
- The file does not exist in the file system.
- ENOMEM
- Unable to allocate memory for the request.
- ENOSYS
- The gpfs_iopen() subroutine is not available.
- EPERM
- The caller does not have superuser privileges.
- ESTALE
- Cached file system information was not valid.
- GPFS_E_INVAL_FSSNAPHANDLE
- The file system snapshot handle is not valid.
- GPFS_E_INVAL_INUM
- Users are not authorized to open the reserved inodes.
Examples
For an example using gpfs_iopen(), see /usr/lpp/mmfs/samples/util/tsreaddir.c.
Location
/usr/lpp/mmfs/lib/libgpfs.a for AIX
/usr/lpp/mmfs/lib/libgpfs.so for Linux