Veritas File System 4.1 Administrator's Guide (HP-UX 11i v3, February 2007)
Application Interface
Named Data Streams Programmatic Interface
Chapter 470
Named Data Streams Programmatic Interface
VxFS named data stream functionality is available only through the following application programming
interface (API) functions:
vxfs_nattr_link Links to a named data stream.
vxfs_nattr_open Open a named data stream.
vxfs_nattr_rename Renames a named data stream.
vxfs_nattr_unlink Removes a named data stream.
The vxfs_nattr_open() function works similar to the open() system call, except that the path is
interpreted as a named data stream to a file descriptor. If the vxfs_nattr_open() operation completes
successfully, the return value is the file descriptor associated with the named data stream. The file descriptor
can be used by other input/output functions to refer to that named data stream. If the path of the named
datastream is set to "." the file descriptor returned points to the named data stream directory vnode.
The vxfs_nattr_link() function creates a new directory entry for the existing named data stream and
increments its link count by one. There is a pointer to an existing named data stream in the named data
stream namespace and a pointer to the new directory entry created in the named data stream namespace.
The vxfs_nattr_unlink() function removes the named data stream at a specified path. The calling
function must have write permission to remove the directory entry for the named data stream.
The vxfs_nattr_rename() function changes a specified namespace entry at path1 to a second specified
namespace at path2. The specified paths are resolved relative to a pointer to the named data stream directory
vnodes.
See the vxfs_nattr_open(3), vxfs_nattr_link(3), vxfs_nattr_unlink(3), and
vxfs_nattr_rename(3) manual pages for more information.
Listing Named Data Streams
The named data streams for a file can be listed by calling getdents() on the named data
stream directory inode. For example:
fd = open("foo", O_RDWR); /* open file foo */
afd = vxfs_nattr_open(fd, "attribute1",
O_RDWR|O_CREAT, 0777); /* create attribute
attribute1 for file foo */