Veritas™ File System 5.0.1 Programmer's Reference Guide

To list named data streams
1
To list the named data streams, create code similar to the following:
fd = open("foo", O_RDWR); /* open file foo */
afd = vxfs_nattr_open(fd, "stream1",
O_RDWR|O_CREAT, 0777);/* create named data stream
stream1 for file foo */
write(afd, buf, 1024); /* writes to named stream file */
read(afd, buf, 1024); /* reads from named stream file */
dfd = vxfs_nattr_open(fd, ".", O_RDONLY);
/* opens named stream directory
for file foo */
getdents(dfd, buf, 1024);/* reads directory entries for
named stream directory */
2
Use the reverse name lookup call to resolve a stream file to a pathname. The
resulting pathnames format is similar to the following:
/mount_point/file_with_data_stream/./data_stream_file_name
Namespace for named data streams
Names starting with $vxfs: are reserved for future use. Creating a data stream
in which the name starts with $vxfs: fails with an EINVAL error.
Behavior changes in other system calls
Although the named data stream directory is hidden from the namespace, it is
possible to open the name data stream directory inode with a fchdir() or fchroot()
call. Some of the attributes, such as .., are not defined for a named data streams
directory. Any operation that accesses these fields can fail. Attempts to create
directories, symbolic links, or device files on a named data stream directory fail.
VOP_SETATTR() called on a named data stream directory or named data stream
inode also fails.
The following is an alternative method for reading the hidden directory using the
fchdir() call:
fd = open(filename, O_RDONLY)
dfd = vxfs_nattr_open(fd, ".", O_RDONLY, mode)
fchdir(dfd);
67Named data streams
Namespace for named data streams