haiku-website/static/legacy-docs/bebook/BSymLink.html

78 lines
15 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Storage Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheStorageKit.html" title="The Storage Kit" /><link rel="prev" href="BStatable.html" title="BStatable" /><link rel="next" href="BVolume.html" title="BVolume" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BStatable.html" title="BStatable"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheStorageKit.html" title="The Storage Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BVolume.html" title="BVolume"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Storage Kit</div></div><div id="headerB">Prev: <a href="BStatable.html">BStatable</a>  Up: <a href="TheStorageKit.html">The Storage Kit</a>  Next: <a href="BVolume.html">BVolume</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink"></a>BSymLink</h2></div></div></div><a id="id1253767" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td><a class="link" href="BNode.html" title="BNode"><code class="classname">BNode</code></a></td></tr><tr><td>Mix-in Classes:</td><td>None</td></tr><tr><td>Declared In:</td><td><code class="filename">storage/SymLink.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td></td></tr></tbody></table></td><td>
<a class="link overview" href="BSymLink_Overview.html" title="BSymLink">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BSymLink.html#BSymLink_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BSymLink.html#BSymLink_Member_Functions">Member Functions</a></span></li></ul></div>
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink_Constructor"></a>BSymLink()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BSymLink</span>();</code>
<code class="constructorsynopsis cpp"><span class="methodname">BSymLink</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">entry_ref* </span><span class="parameter">ref</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BSymLink</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BEntry.html" title="BEntry"><code class="classname">BEntry</code></a>* </span><span class="parameter">entry</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BSymLink</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">path</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BSymLink</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BDirectory.html" title="BDirectory"><code class="classname">BDirectory</code></a>* </span><span class="parameter">dir</span></span>,<br />         <span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">path</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BSymLink</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><span class="classname">BSymLink</span>&amp; </span><span class="parameter">link</span></span>);</code>
</div><p>
Creates a new <code class="classname">BSymLink</code> object, initializes it according to the arguments,
and sets <a class="link" href="BNode.html#BNode_InitCheck" title="InitCheck()"><code class="methodname">InitCheck()</code></a>
to return the status of the initialization.
</p><ul class="itemizedlist"><li><p>
The default constructor does nothing and sets
<a class="link" href="BNode.html#BNode_InitCheck" title="InitCheck()"><code class="methodname">InitCheck()</code></a> to
<code class="constant">B_NO_INIT</code>. To initialize the object, call
<a class="link" href="BNode.html#BNode_SetTo" title="SetTo(), Unset()"><code class="methodname">SetTo()</code></a>.
</p></li><li><p>
The copy constructor creates a new <code class="classname">BSymLink</code> that's open on the same
node as that of the argument.
</p></li><li><p>
For information on the other constructors, see the analogous
<a class="link" href="BNode.html#BNode_SetTo" title="SetTo(), Unset()"><code class="methodname">SetTo()</code></a>
functions in the
<a class="link" href="BNode.html" title="BNode"><code class="classname">BNode</code></a> class;
<code class="classname">BSymLink</code> inherits them without change.
</p></li></ul></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink_Destructor"></a>~BSymLink()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BSymLink</span>();</code><p>
Closes the object's file descriptor and destroys the object.
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink_Member_Functions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink_IsAbsolute"></a>IsAbsolute()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsAbsolute</span>();</code><p>
Returns <code class="constant">true</code> if the symlink contains an absolute pathname.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink_MakeLinkedPath"></a>MakeLinkedPath()</h4></div></div></div><div class="synopsisgroup">
<code class="methodsynopsis cpp"><span class="type">ssize_t </span><span class="methodname">MakeLinkedPath</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BDirectory.html" title="BDirectory"><code class="classname">BDirectory</code></a>* </span><span class="parameter">dir</span></span>,<br />                       <span class="methodparam"><span class="type"><a class="link" href="BPath.html" title="BPath"><code class="classname">BPath</code></a>* </span><span class="parameter">path</span></span>) <span class="modifier">const</span>;</code>
<code class="methodsynopsis cpp"><span class="type">ssize_t </span><span class="methodname">MakeLinkedPath</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">dirPath</span></span>,<br />                       <span class="methodparam"><span class="type"><a class="link" href="BPath.html" title="BPath"><code class="classname">BPath</code></a>* </span><span class="parameter">path</span></span>) <span class="modifier">const</span>;</code>
</div><p>
This function creates an absolute pathname to the linked-to entry and
returns it as a <a class="link" href="BPath.html" title="BPath"><code class="classname">BPath</code></a> object. For this to work you have to tell the
object which directory you want to reckon off of (in case the symlink
specifies a relative path). This should be the directory in which the
symlink itself lives.
</p><div class="admonition note"><div class="title">Note</div><div class="graphic"><img class="icon" alt="Note" width="32" src="./images/admonitions/Info_32.png" /><div class="text"><p>Remember—a <code class="classname">BSymLink</code> is a node, and nodes don't know what
directory they live in. That's why you have to tell it here.</p></div></div></div><p>
If the symlink contains an absolute path, then the <code class="parameter">dir</code> or <code class="parameter">dirPath</code>
arguments are ignored. Nonetheless, they must be supplied.
</p><p>
The function returns the length of the pathname that's set in
<a class="link" href="BPath.html" title="BPath"><code class="classname">BPath</code></a> (or
an error).
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_FILE_ERROR</code>.</span></p></td><td><p>The object is uninitialized.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>The object doesn't refer to a symlink, or
<code class="parameter">dir</code>/<code class="parameter">dirPath</code> is
<code class="constant">NULL</code>.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_NAME_TOO_LONG</code>.</span></p></td><td><p>They concatenated pathname is too long.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BSymLink_ReadLink"></a>ReadLink()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">ssize_t </span><span class="methodname">ReadLink</span>(<span class="methodparam"><span class="type">char* </span><span class="parameter">buf</span></span>,<br />                 <span class="methodparam"><span class="type">size_t </span><span class="parameter">length</span></span>);</code><p>
Copies the contents of the symlink into <code class="parameter">buf</code>. <code class="parameter">length</code> is the size of the
buffer; to be perfectly safe, the buffer should be <code class="constant">B_PATH_NAME_LENGTH</code>
characters long. The function returns the number of bytes that were
copied (or it returns an error).
</p><p>
The symlink's contents is the pathname (relative or absolute) to the
linked-to entry. Note that since the pathname might be relative,
<code class="methodname">ReadLink()</code> can't give you a
<a class="link" href="BPath.html" title="BPath"><code class="classname">BPath</code></a> object. If you want a
<a class="link" href="BPath.html" title="BPath"><code class="classname">BPath</code></a> to the
linked-to entry, see
<a class="link" href="BSymLink.html#BSymLink_MakeLinkedPath" title="MakeLinkedPath()"><code class="methodname">MakeLinkedPath()</code></a>.
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_FILE_ERROR</code>.</span></p></td><td><p>The object is uninitialized.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>The object doesn't refer to a symlink.</p></td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BStatable.html">BStatable</a>  Up: <a href="TheStorageKit.html">The Storage Kit</a>  Next: <a href="BVolume.html">BVolume</a> </div><div id="footerB"><div id="footerBL"><a href="BStatable.html" title="BStatable"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheStorageKit.html" title="The Storage Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BVolume.html" title="BVolume"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>