Listing named data streams

The named data streams for a file can be listed by calling getdents() on the named data stream directory inode, as shown in the following example.

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 pathname's format is similar to the following: