<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Transitional//EN">
<HTML>
<HEAD>
  <!--
    *************************************************************************************
    * Copyright (c) 2005 VERITAS Software Corporation. All rights reserved. *

      For third-party license citations, please see the bottom of this file.
    *************************************************************************************
  -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="TEMPLATEBASE" content="vx_vxhelp_2005c">
<meta name="LASTUPDATED" content="06/13/05 10:02:07">
<meta name="PRODUCTNAME" content="VERITAS Software Documentation">
<meta name="FILENAME" content="04.app_interface.fm">
     
<title>Named Data Streams Programmatic Interface</title>

</HEAD>

<BODY bgcolor="#FFFFFF" link="#000066" vlink="#0000ff" marginheight="0" topmargin="0">
<basefont=1>

<a name="126087"></a>

<div align="left">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
   <td height="2" border="0" cellspacing="0" cellpadding="0" colspan="2" bgcolor="#000000">
   </td>
 </tr>
 <tr>
   <td height="15" width="50%" border="0" cellspacing="0" cellpadding="0" bgcolor="#cccccc">
    <img src="images/vxsymbol.gif" height="20" width="31" border="0" cellspacing="0" cellpadding="0" align="left">
     
     
   </td>
   <td align="right" width="50%" bgcolor="#cccccc">

<!-- Header Breadcrumbs -->
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">&lt;&nbsp;<a href="04_app_interface_vxfs43_126071.html" title="Previous - Named Data Streams">Previous</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="05_checkpoints_vxfs45_124786.html" title="Next - Storage Checkpoints">Next</a>
&nbsp;&gt;&nbsp;&nbsp;</font>
   </td>
 </tr>

 <tr>
  <td bgcolor="#CCCCCC" colspan="2" height="15" align="right">
  <font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Product:  
<a href="vxfs_splashpage_docCD_vxfs1_103036.vxhd" title="File System Guides title page ">File System Guides</a>
  &nbsp;&nbsp;
  </font>
  </td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC" colspan="2" height="15" align="right">
  <font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Manual:  
<a href="vxfs_admin_titlepage_docCD_vxfs2_73700.vxhd" title="File System 4.1 Administrator's Guide title page ">File System 4.1 Administrator's Guide</a>
  &nbsp;&nbsp;
  </font>
  </td>
 </tr>


</table>
</div>

<div align="left">
 <table border="0" width="100%" bgcolor="#FFFFFF">
  <tr>
   <td width="100%" valign="top" bgcolor="#FFFFFF">

<!-- Start Main Topic Content -->
        <a name="startcontent"></a>
	
<h1><font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="+1" color="#000000"><a name="126087"></a> Named Data Streams Programmatic Interface</font>
</h1>
         
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126965"></a>VxFS named data stream functionality is available only through the following application programming interface (API) functions:
<blockquote>
<Table width="100%" border="0" cellpadding="1" cellspacing="0" >
<tr valign="top"><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126968"></a>vxfs_nattr_link</font>
</p>

</td><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126970"></a>Links to a named data stream.</font>
</p>

</td></tr><tr valign="top"><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126972"></a>vxfs_nattr_open</font>
</p>

</td><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126974"></a>Open a named data stream.</font>
</p>

</td></tr><tr valign="top"><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126976"></a>vxfs_nattr_rename</font>
</p>

</td><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126978"></a>Renames a named data stream.</font>
</p>

</td></tr><tr valign="top"><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126980"></a>vxfs_nattr_unlink</font>
</p>

</td><td><p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126982"></a>Removes a named data stream.</font>
</p>

</td></tr>
</Table>

</blockquote>

<blockquote>
<Table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr><td>
</Table>
</blockquote></font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126091"></a>The <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_</font><font face="Courier New, Courier, sansserif, sans serif" size="2">nattr_open</font>() function works similarly to the <font face="Courier New, Courier, sansserif, sans serif" size="2">open</font>() system call, except that the path is interpreted as a named data stream to a file descriptor. If the <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_</font>n<font face="Courier New, Courier, sansserif, sans serif" size="2">attr_open</font>() 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 &quot;<font face="Courier New, Courier, sansserif, sans serif" size="2"><b>.</b></font>&quot; the file descriptor returned points to the named data stream directory vnode.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126101"></a>The <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_</font><font face="Courier New, Courier, sansserif, sans serif" size="2">nattr_link</font>() 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.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126109"></a>The <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_</font><font face="Courier New, Courier, sansserif, sans serif" size="2">nattr_unlink</font>() 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.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="127100"></a>The <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_</font><font face="Courier New, Courier, sansserif, sans serif" size="2">nattr_rename</font>() function changes a specified namespace entry at <font face="Courier New, Courier, sansserif, sans serif" size="2">path1</font> to a second specified namespace at <font face="Courier New, Courier, sansserif, sans serif" size="2">path2</font>. The specified paths are resolved relative to a pointer to the named data stream directory vnodes.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="127101"></a>See the <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_nattr_open</font>(3), <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_nattr_link</font>(3), <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_nattr_unlink</font>(3), and <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfs_nattr_rename</font>(3) manual pages for more information. </font>
</p>




<h2><font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="3" color="#000000"><a name="126122"></a>Listing Named Data Streams</font>
</h2>
 
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126123"></a>The named data streams for a file can be listed by calling <font face="Courier New, Courier, sansserif, sans serif" size="2">getdents</font>() on the named data stream directory inode. For example:</font>
</p>

<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="126295"></a>&nbsp;fd&nbsp;=&nbsp;open(&quot;foo&quot;,&nbsp;O_RDWR);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;open&nbsp;file&nbsp;foo&nbsp;*/
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127243"></a>&nbsp;afd&nbsp;=&nbsp;vxfs_nattr_open(fd,&nbsp;&quot;attribute1&quot;,
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127244"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;O_RDWR|O_CREAT,&nbsp;0777);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;create&nbsp;attribute
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127245"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attribute1&nbsp;for&nbsp;file&nbsp;foo&nbsp;*/
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127254"></a>&nbsp;write(afd,&nbsp;buf,&nbsp;1024);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;writes&nbsp;to&nbsp;attribute&nbsp;file&nbsp;*/
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127255"></a>&nbsp;read(afd,&nbsp;buf,&nbsp;1024);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;reads&nbsp;from&nbsp;attribute&nbsp;file&nbsp;*/
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127256"></a>&nbsp;dfd&nbsp;=&nbsp;vxfs_nattr_open(fd,&nbsp;&quot;.&quot;,&nbsp;O_RDONLY);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;opens&nbsp;attribute
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="145289"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directory&nbsp;for&nbsp;file&nbsp;foo&nbsp;*/
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127250"></a>&nbsp;getdents(dfd,&nbsp;buf,&nbsp;1024);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;reads&nbsp;directory&nbsp;entries&nbsp;for
</font>
<br>
<font face="Courier New, Courier, sansserif, sans serif" size="2"><a name="127259"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attribute&nbsp;directory&nbsp;*/
</font>



<h2><font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="3" color="#000000"><a name="126139"></a>Namespace for Named Data Streams</font>
</h2>
 
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126141"></a>Names starting with &quot;<font face="Courier New, Courier, sansserif, sans serif" size="2">$vxfs:</font>&quot; are reserved for future use. Creating a data stream where the name starts with &quot;<font face="Courier New, Courier, sansserif, sans serif" size="2">$vxfs:</font>&quot; fail with an EINVAL error.</font>
</p>




<h2><font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="3" color="#000000"><a name="126147"></a>Behavior Changes in Other System Calls</font>
</h2>
 
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="126149"></a>Though the named data stream directory is hidden from the namespace, it is possible to open the name data stream directory inode with a <font face="Courier New, Courier, sansserif, sans serif" size="2">fchdir</font>() or <font face="Courier New, Courier, sansserif, sans serif" size="2">fchroot</font>() call. Some of the attributes (such as &quot;<font face="Courier New, Courier, sansserif, sans serif" size="2"><b>..</b></font>&quot;) 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.</font>
</p>


<!-- End Main Topic Content -->

   </td>
  </tr>
 </table>
</div>

<div>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
  <td height="18" border="0" cellspacing="0" cellpadding="0" colspan="2" bgcolor="#FFFFFF">
  </td>
 </tr>
  <td align="left"><font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">&nbsp;&#94;&nbsp;<a href="04_app_interface_vxfs44_126087.html" title="Named Data Streams Programmatic Interface">Return to Top</a></font>

  </td>
  <td align="right"><font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">&lt;&nbsp;<a href="04_app_interface_vxfs43_126071.html" title="Previous - Named Data Streams">Previous</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="05_checkpoints_vxfs45_124786.html" title="Next - Storage Checkpoints">Next</a>
&nbsp;&gt;&nbsp;&nbsp;</font>
  </td>
 <tr>
   <td height="9" border="0" cellspacing="0" cellpadding="0" colspan="2" bgcolor="#FFFFFF">
   </td>
 </tr>

<!-- Footer Breadcrumbs -->
<tr>
<td bgcolor="#FFFFFF" colspan="2" height="15" align="right">
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Product:  
<a href="vxfs_splashpage_docCD_vxfs1_103036.vxhd" title="File System Guides title page ">File System Guides</a>&nbsp;&nbsp;</font></td>
</tr>

<tr>
<td bgcolor="#FFFFFF" colspan="2" height="15" align="right">
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Manual:  
<a href="vxfs_admin_titlepage_docCD_vxfs2_73700.vxhd" title="File System 4.1 Administrator's Guide title page ">File System 4.1 Administrator's Guide</a>&nbsp;&nbsp;</font></td>
</tr>


 <tr>
  <td colspan="2" align="left"><font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" color="#000000" align="right" size="-2">
<em>VERITAS Software Corporation
</em></font><br>

<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">www.veritas.com</font><br>
  </td>
 </tr>
</table>
</div>

</BODY>
  <!--
    *************************************************************************************
    * Copyright (c) 2005 VERITAS Software Corporation. All rights reserved. *

    VERITAS, VERITAS SOFTWARE, the VERITAS Logo, and VERITAS Software Documentation 
    are trademarks or registered trademarks of VERITAS Software Corporation 
    or its affiliates in the U.S. and other countries. Other names may be 
    trademarks of their respective owners. 

    Apache Jakarta Lucene:
    Apache Software License
    Version 1.1

    Copyright (c) 2000 The Apache Software Foundation. All rights reserved.

    Redistribution and use in source and binary forms, with or without modification, 
    are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this 
    list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright notice, this 
    list of conditions and the following disclaimer in the documentation and/or other 
    materials provided with the distribution.

    3. The end-user documentation included with the redistribution, if any, must include 
    the following acknowledgment: "This product includes software developed by the Apache 
    Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may 
    appear in the software itself, if and wherever such third-party acknowledgments 
    normally appear.

    4. The names "Apache" and "Apache Software Foundation" must not be used to endorse or 
    promote products derived from this software without prior written permission. For 
    written permission, please contact apache@apache.org.

    5. Products derived from this software may not be called "Apache", nor may "Apache" 
    appear in their name, without prior written permission of the Apache Software Foundation.

    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, 
    BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION 
    OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    This software consists of voluntary contributions made by many individuals on behalf 
    of the Apache Software Foundation. For more information on the Apache Software Foundation, 
    please see <http://www.apache.org/>. Portions of this software are based upon public domain 
    software originally written at the National Center for Supercomputing Applications, University 
    of Illinois, Urbana-Champaign.
    
    This product includes WebWindow Software developed by Horst Heistermann.
    *************************************************************************************
  -->
</HTML>
