Previous  |  Next  >  
Product: File System Guides   
Manual: File System 4.1 Administrator's Guide   

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 similarly 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 data stream 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 */
 write(afd, buf, 1024);                       /* writes to attribute file */
 read(afd, buf, 1024);                       /* reads from attribute file */
 dfd = vxfs_nattr_open(fd, ".", O_RDONLY);                       /* opens attribute
                           directory for file foo */
 getdents(dfd, buf, 1024);                       /* reads directory entries for
                         attribute directory */

Namespace for Named Data Streams

Names starting with "$vxfs:" are reserved for future use. Creating a data stream where the name starts with "$vxfs:" fail with an EINVAL error.

Behavior Changes in Other System Calls

Though 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 will fail. VOP_SETATTR() done on a named data stream directory or named data stream inode will also fail.

 ^ Return to Top Previous  |  Next  >  
Product: File System Guides  
Manual: File System 4.1 Administrator's Guide  
VERITAS Software Corporation
www.veritas.com