gpfs_next_xattr() subroutine

Returns individual attributes and their values.

Library

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

Synopsis

#include <gpfs.h>
int gpfs_next_xattr(gpfs_iscan_t *iscan,
                    const char **xattrBuf,
                    unsigned int *xattrBufLen,
                    const char **name,
                    unsigned int *valueLen,
                    const char **value);    

Description

The gpfs_next_xattr() subroutine iterates over the extended attributes buffer returned by the gpfs_next_inode_with_xattrs() or gpfs_next_inode_with_xattrs64() subroutine to return the individual attributes and their values. The attribute names are null-terminated strings, whereas the attribute value contains binary data.
Note: The caller is not allowed to modify the returned attribute names or values. The data returned by gpfs_next_xattr() might be overwritten by subsequent calls to gpfs_next_xattr() or other GPFS library calls.

Parameters

iscan
A pointer to the inode descriptor.
xattrBuf
A pointer to the pointer to the attribute buffer.
xattrBufLen
A pointer to the attribute buffer length.
name
A pointer to the attribute name.
valueLen
A pointer to the length of the attribute value.
value
A pointer to the attribute value.

Exit status

If the gpfs_next_xattr() subroutine is successful, it returns a value of 0 and a pointer to the attribute name. It also sets:
  • The valueLen parameter to the length of the attribute value
  • The value parameter to point to the attribute value
  • The xattrBufLen parameter to the remaining length of buffer
  • The xattrBuf parameter to index the next attribute in buffer
If the gpfs_next_xattr() subroutine is successful, but there are no more attributes in the buffer, it returns a value of 0 and the attribute name is set to NULL. It also sets:
  • The valueLen parameter to 0
  • The value parameter to NULL
  • The xattrBufLen parameter to 0
  • The xattrBuf parameter to NULL

If the gpfs_next_xattr() 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:

EINVAL
Incorrect parameters.
ENOSYS
The gpfs_next_xattr() subroutine is not available.

Examples

For an example using gpfs_next_xattr(), see /usr/lpp/mmfs/samples/util/tsinode.c.

Location

/usr/lpp/mmfs/lib/libgpfs.a for AIX

/usr/lpp/mmfs/lib/libgpfs.so for Linux