gpfs_ireaddir() subroutine

Reads the next directory entry.

Library

GPFS Library (libgpfs.a for AIX®, libgpfs.so for Linux®)

Synopsis

#include <gpfs.h>
int gpfs_ireaddir(gpfs_ifile_t *idir,
                  const gpfs_direntx_t **dirent);

Description

The gpfs_ireaddir() subroutine returns the next directory entry in a file system. For an overview of using gpfs_ireaddir() in a backup application, see Using APIs to develop backup applications.

Note: Compile any program that uses this subroutine with the -lgpfs flag from the following library:
  • libgpfs.a for AIX
  • libgpfs.so for Linux

Parameters

idir
Pointer to gpfs_ifile_t from gpfs_iopen().
dirent
Pointer to returned pointer to directory entry.

Exit status

If the gpfs_ireaddir() subroutine is successful, it returns a value of 0 and sets the dirent parameter to point to the returned directory entry. If there are no more GPFS directory entries, gpfs_ireaddir() returns a value of 0 and sets the dirent parameter to NULL.

If the gpfs_ireaddir() subroutine is unsuccessful, it returns a value of -1 and sets the global error variable errno to indicate the nature of the error.

Exceptions

None.

Error status

Error codes include but are not limited to the following:

ENOMEM
Unable to allocate memory for the request.
ENOSYS
The gpfs_ireaddir() subroutine is not available.
ENOTDIR
File is not a directory.
EPERM
The caller does not have superuser privileges.
ESTALE
The cached file system information was not valid.
GPFS_E_INVAL_IFILE
Incorrect ifile parameter.

Examples

For an example using gpfs_ireaddir(), 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