Current File : //proc/thread-self/root/usr/share/doc/python3-llfuse/html/operations.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Request Handlers &#8212; Python-LLFUSE 1.3.6 documentation</title>
    
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.3.6',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="author" title="About these documents" href="about.html" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Python-LLFUSE 1.3.6 documentation" href="index.html" />
    <link rel="next" title="Utility Functions" href="util.html" />
    <link rel="prev" title="The global lock" href="lock.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="util.html" title="Utility Functions"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="lock.html" title="The global lock"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Python-LLFUSE 1.3.6 documentation</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="request-handlers">
<h1>Request Handlers<a class="headerlink" href="#request-handlers" title="Permalink to this headline">¶</a></h1>
<p>(You can use the <a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a> to directly jump to a specific handler).</p>
<dl class="class">
<dt id="llfuse.Operations">
<em class="property">class </em><code class="descclassname">llfuse.</code><code class="descname">Operations</code><a class="headerlink" href="#llfuse.Operations" title="Permalink to this definition">¶</a></dt>
<dd><p>This class defines the general and request handler methods that an
Python-LLFUSE file system may implement. If a particular request handler has
not been implemented, it must raise <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a> with an errorcode of
<a class="reference external" href="https://docs.python.org/3/library/errno.html#errno.ENOSYS" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">errno.ENOSYS</span></code></a>. Further requests of this type will then be handled directly
by the FUSE kernel module without calling the handler again.</p>
<p>The only exception that request handlers are allowed to raise is
<a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a>. This will cause the specified errno to be returned by the
syscall that is being handled.</p>
<p>It is recommended that file systems are derived from this class and only
overwrite the handlers that they actually implement. (The methods defined in
this class all just raise <code class="docutils literal"><span class="pre">FUSEError(ENOSYS)</span></code> or do nothing).</p>
<dl class="method">
<dt id="llfuse.Operations.access">
<code class="descname">access</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>mode</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.access" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if requesting process has <em>mode</em> rights on <em>inode</em>.</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The method must return a boolean value.</p>
<p>If the <code class="docutils literal"><span class="pre">default_permissions</span></code> mount option is given, this method is not
called.</p>
<p>When implementing this method, the <a class="reference internal" href="util.html#llfuse.get_sup_groups" title="llfuse.get_sup_groups"><code class="xref py py-obj docutils literal"><span class="pre">get_sup_groups</span></code></a> function may be
useful.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.create">
<code class="descname">create</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode</em>, <em>name</em>, <em>mode</em>, <em>flags</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.create" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a file with permissions <em>mode</em> and open it with <em>flags</em></p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The method must return a tuple of the form <em>(fh, attr)</em>, where <em>fh</em> is a
file handle like the one returned by <a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> and <em>attr</em> is an
<a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance with the attributes of the newly created
directory entry.</p>
<p>(Successful) execution of this handler increases the lookup count for
the returned inode by one.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.destroy">
<code class="descname">destroy</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.destroy" title="Permalink to this definition">¶</a></dt>
<dd><p>Clean up operations.</p>
<p>This method will be called when <a class="reference internal" href="fuse_api.html#llfuse.close" title="llfuse.close"><code class="xref py py-obj docutils literal"><span class="pre">llfuse.close</span></code></a> has been called and the
file system is about to be unmounted.</p>
<p>This method must not raise any exceptions (not even <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a>), since
it is not handling a particular client request.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.flush">
<code class="descname">flush</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.flush" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle close() syscall.</p>
<p><em>fh</em> will by an integer filehandle returned by a prior <a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> or
<a class="reference internal" href="#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a> call.</p>
<p>This method is called whenever a file descriptor is closed. It may be
called multiple times for the same open file (e.g. if the file handle
has been duplicated).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.forget">
<code class="descname">forget</code><span class="sig-paren">(</span><em>self</em>, <em>inode_list</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.forget" title="Permalink to this definition">¶</a></dt>
<dd><p>Decrease lookup counts for inodes in <em>inode_list</em></p>
<p><em>inode_list</em> is a list of <code class="docutils literal"><span class="pre">(inode,</span> <span class="pre">nlookup)</span></code> tuples. This method
should reduce the lookup count for each <em>inode</em> by <em>nlookup</em>.</p>
<p>If the lookup count reaches zero, the inode is currently not known to
the kernel. In this case, the file system will typically check if there
are still directory entries referring to this inode and, if not, remove
the inode.</p>
<p>If the file system is unmounted, it may not have received <a class="reference internal" href="#llfuse.Operations.forget" title="llfuse.Operations.forget"><code class="xref py py-obj docutils literal"><span class="pre">forget</span></code></a> calls
to bring all lookup counts to zero. The <a class="reference internal" href="#llfuse.Operations.destroy" title="llfuse.Operations.destroy"><code class="xref py py-obj docutils literal"><span class="pre">destroy</span></code></a> method should be used
to clean up inodes that at that point still have non-zero lookup count
(e.g. by calling <a class="reference internal" href="#llfuse.Operations.forget" title="llfuse.Operations.forget"><code class="xref py py-obj docutils literal"><span class="pre">forget</span></code></a> with the current lookup count for every such
inode).</p>
<p>This method must not raise any exceptions (not even <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a>), since
it is not handling a particular client request.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.fsync">
<code class="descname">fsync</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em>, <em>datasync</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.fsync" title="Permalink to this definition">¶</a></dt>
<dd><p>Flush buffers for open file <em>fh</em></p>
<p>If <em>datasync</em> is true, only the file contents should be
flushed (in contrast to the metadata about the file).</p>
<p><em>fh</em> will by an integer filehandle returned by a prior <a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> or
<a class="reference internal" href="#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a> call.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.fsyncdir">
<code class="descname">fsyncdir</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em>, <em>datasync</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.fsyncdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Flush buffers for open directory <em>fh</em></p>
<p>If <em>datasync</em> is true, only the directory contents should be
flushed (in contrast to metadata about the directory itself).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.getattr">
<code class="descname">getattr</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.getattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Get attributes for <em>inode</em></p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>This method should return an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance with the
attributes of <em>inode</em>. The <a class="reference internal" href="data.html#llfuse.EntryAttributes.entry_timeout" title="llfuse.EntryAttributes.entry_timeout"><code class="xref py py-obj docutils literal"><span class="pre">entry_timeout</span></code></a> attribute is
ignored in this context.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.getxattr">
<code class="descname">getxattr</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>name</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.getxattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Return extended attribute <em>name</em> of <em>inode</em></p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>If the attribute does not exist, the method must raise <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a> with
an error code of <a class="reference internal" href="data.html#llfuse.ENOATTR" title="llfuse.ENOATTR"><code class="xref py py-obj docutils literal"><span class="pre">ENOATTR</span></code></a>. <em>name</em> will be of type <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">bytes</span></code></a>, but is
guaranteed not to contain zero-bytes (<code class="docutils literal"><span class="pre">\0</span></code>).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.init">
<code class="descname">init</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.init" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize operations</p>
<p>This method will be called just before the file system starts handling
requests. It must not raise any exceptions (not even <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a>), since
it is not handling a particular client request.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.link">
<code class="descname">link</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>new_parent_inode</em>, <em>new_name</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.link" title="Permalink to this definition">¶</a></dt>
<dd><p>Create directory entry <em>name</em> in <em>parent_inode</em> refering to <em>inode</em>.</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The method must return an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance with the
attributes of the newly created directory entry.</p>
<p>(Successful) execution of this handler increases the lookup count for
the returned inode by one.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.listxattr">
<code class="descname">listxattr</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.listxattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Get list of extended attributes for <em>inode</em></p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>This method must return an iterator over a sequence of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">bytes</span></code></a> objects.
The objects must not to include zero-bytes (<code class="docutils literal"><span class="pre">\0</span></code>).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.lookup">
<code class="descname">lookup</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode</em>, <em>name</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.lookup" title="Permalink to this definition">¶</a></dt>
<dd><p>Look up a directory entry by name and get its attributes.</p>
<p>This method should return an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance for the
directory entry <em>name</em> in the directory with inode <em>parent_inode</em>.</p>
<p>If there is no such entry, the method should either return an
<a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance with zero <code class="docutils literal"><span class="pre">st_ino</span></code> value (in which case
the negative lookup will be cached as specified by <code class="docutils literal"><span class="pre">entry_timeout</span></code>),
or it should raise <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a> with an errno of <a class="reference external" href="https://docs.python.org/3/library/errno.html#errno.ENOENT" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">errno.ENOENT</span></code></a> (in this
case the negative result will not be cached).</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The file system must be able to handle lookups for <code class="file docutils literal"><span class="pre">.</span></code> and
<code class="file docutils literal"><span class="pre">..</span></code>, no matter if these entries are returned by <a class="reference internal" href="#llfuse.Operations.readdir" title="llfuse.Operations.readdir"><code class="xref py py-obj docutils literal"><span class="pre">readdir</span></code></a> or not.</p>
<p>(Successful) execution of this handler increases the lookup count for
the returned inode by one.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.mkdir">
<code class="descname">mkdir</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode</em>, <em>name</em>, <em>mode</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a directory</p>
<p>This method must create a new directory <em>name</em> with mode <em>mode</em> in the
directory with inode <em>parent_inode</em>. <em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a>
instance.</p>
<p>This method must return an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance with the
attributes of the newly created directory entry.</p>
<p>(Successful) execution of this handler increases the lookup count for
the returned inode by one.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.mknod">
<code class="descname">mknod</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode</em>, <em>name</em>, <em>mode</em>, <em>rdev</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.mknod" title="Permalink to this definition">¶</a></dt>
<dd><p>Create (possibly special) file</p>
<p>This method must create a (special or regular) file <em>name</em> in the
directory with inode <em>parent_inode</em>. Whether the file is special or
regular is determined by its <em>mode</em>. If the file is neither a block nor
character device, <em>rdev</em> can be ignored. <em>ctx</em> will be a
<a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The method must return an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance with the attributes
of the newly created directory entry.</p>
<p>(Successful) execution of this handler increases the lookup count for
the returned inode by one.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.open">
<code class="descname">open</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>flags</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.open" title="Permalink to this definition">¶</a></dt>
<dd><p>Open a inode <em>inode</em> with <em>flags</em>.</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p><em>flags</em> will be a bitwise or of the open flags described in the
<em class="manpage">open(2)</em> manpage and defined in the <a class="reference external" href="https://docs.python.org/3/library/os.html#module-os" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">os</span></code></a> module (with the
exception of <code class="docutils literal"><span class="pre">O_CREAT</span></code>, <code class="docutils literal"><span class="pre">O_EXCL</span></code>, <code class="docutils literal"><span class="pre">O_NOCTTY</span></code> and <code class="docutils literal"><span class="pre">O_TRUNC</span></code>)</p>
<p>This method must return an integer file handle. The file handle will be
passed to the <a class="reference internal" href="#llfuse.Operations.read" title="llfuse.Operations.read"><code class="xref py py-obj docutils literal"><span class="pre">read</span></code></a>, <a class="reference internal" href="#llfuse.Operations.write" title="llfuse.Operations.write"><code class="xref py py-obj docutils literal"><span class="pre">write</span></code></a>, <a class="reference internal" href="#llfuse.Operations.flush" title="llfuse.Operations.flush"><code class="xref py py-obj docutils literal"><span class="pre">flush</span></code></a>, <a class="reference internal" href="#llfuse.Operations.fsync" title="llfuse.Operations.fsync"><code class="xref py py-obj docutils literal"><span class="pre">fsync</span></code></a> and <a class="reference internal" href="#llfuse.Operations.release" title="llfuse.Operations.release"><code class="xref py py-obj docutils literal"><span class="pre">release</span></code></a> methods to
identify the open file.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.opendir">
<code class="descname">opendir</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.opendir" title="Permalink to this definition">¶</a></dt>
<dd><p>Open the directory with inode <em>inode</em></p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>This method should return an integer file handle. The file handle will
be passed to the <a class="reference internal" href="#llfuse.Operations.readdir" title="llfuse.Operations.readdir"><code class="xref py py-obj docutils literal"><span class="pre">readdir</span></code></a>, <a class="reference internal" href="#llfuse.Operations.fsyncdir" title="llfuse.Operations.fsyncdir"><code class="xref py py-obj docutils literal"><span class="pre">fsyncdir</span></code></a> and <a class="reference internal" href="#llfuse.Operations.releasedir" title="llfuse.Operations.releasedir"><code class="xref py py-obj docutils literal"><span class="pre">releasedir</span></code></a> methods to
identify the directory.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.read">
<code class="descname">read</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em>, <em>off</em>, <em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read <em>size</em> bytes from <em>fh</em> at position <em>off</em></p>
<p><em>fh</em> will by an integer filehandle returned by a prior <a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> or
<a class="reference internal" href="#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a> call.</p>
<p>This function should return exactly the number of bytes requested except
on EOF or error, otherwise the rest of the data will be substituted with
zeroes.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.readdir">
<code class="descname">readdir</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em>, <em>off</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.readdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Read entries in open directory <em>fh</em>.</p>
<p>This method should return an iterator over the contents of directory
<em>fh</em> (as returned by a prior <a class="reference internal" href="#llfuse.Operations.opendir" title="llfuse.Operations.opendir"><code class="xref py py-obj docutils literal"><span class="pre">opendir</span></code></a> call), starting at the entry
identified by <em>off</em>.</p>
<p>The iterator must yield tuples of the form <code class="samp docutils literal"><span class="pre">(</span><em><span class="pre">name</span></em><span class="pre">,</span> <em><span class="pre">attr</span></em><span class="pre">,</span>
<em><span class="pre">next_</span></em><span class="pre">)</span></code>, where <em>attr</em> is an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance and <em>next_</em>
gives an offset that can be passed as <em>off</em> to start a successive
<a class="reference internal" href="#llfuse.Operations.readdir" title="llfuse.Operations.readdir"><code class="xref py py-obj docutils literal"><span class="pre">readdir</span></code></a> call at the right position.</p>
<p>Iteration may be stopped as soon as enough elements have been
retrieved. The method should be prepared for this case.</p>
<p>If entries are added or removed during a <a class="reference internal" href="#llfuse.Operations.readdir" title="llfuse.Operations.readdir"><code class="xref py py-obj docutils literal"><span class="pre">readdir</span></code></a> cycle, they may or
may not be returned. However, they must not cause other entries to be
skipped or returned more than once.</p>
<p><code class="file docutils literal"><span class="pre">.</span></code> and <code class="file docutils literal"><span class="pre">..</span></code> entries may be included but are not required.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.readlink">
<code class="descname">readlink</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.readlink" title="Permalink to this definition">¶</a></dt>
<dd><p>Return target of symbolic link <em>inode</em>.</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.release">
<code class="descname">release</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.release" title="Permalink to this definition">¶</a></dt>
<dd><p>Release open file</p>
<p>This method will be called when the last file descriptor of <em>fh</em> has
been closed, i.e. when the file is no longer opened by any client
process.</p>
<p><em>fh</em> will by an integer filehandle returned by a prior <a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> or
<a class="reference internal" href="#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a> call. Once <a class="reference internal" href="#llfuse.Operations.release" title="llfuse.Operations.release"><code class="xref py py-obj docutils literal"><span class="pre">release</span></code></a> has been called, no future requests for
<em>fh</em> will be received (until the value is re-used in the return value of
another <a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> or <a class="reference internal" href="#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a> call).</p>
<p>This method may return an error by raising <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a>, but the error
will be discarded because there is no corresponding client request.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.releasedir">
<code class="descname">releasedir</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.releasedir" title="Permalink to this definition">¶</a></dt>
<dd><p>Release open directory</p>
<p>This method will be called exactly once for each <a class="reference internal" href="#llfuse.Operations.opendir" title="llfuse.Operations.opendir"><code class="xref py py-obj docutils literal"><span class="pre">opendir</span></code></a> call. After
<em>fh</em> has been released, no further <a class="reference internal" href="#llfuse.Operations.readdir" title="llfuse.Operations.readdir"><code class="xref py py-obj docutils literal"><span class="pre">readdir</span></code></a> requests will be received
for it (until it is opened again with <a class="reference internal" href="#llfuse.Operations.opendir" title="llfuse.Operations.opendir"><code class="xref py py-obj docutils literal"><span class="pre">opendir</span></code></a>).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.removexattr">
<code class="descname">removexattr</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>name</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.removexattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove extended attribute <em>name</em> of <em>inode</em></p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>If the attribute does not exist, the method must raise <a class="reference internal" href="data.html#llfuse.FUSEError" title="llfuse.FUSEError"><code class="xref py py-obj docutils literal"><span class="pre">FUSEError</span></code></a> with
an error code of <a class="reference internal" href="data.html#llfuse.ENOATTR" title="llfuse.ENOATTR"><code class="xref py py-obj docutils literal"><span class="pre">ENOATTR</span></code></a>. <em>name</em> will be of type <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">bytes</span></code></a>, but is
guaranteed not to contain zero-bytes (<code class="docutils literal"><span class="pre">\0</span></code>).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.rename">
<code class="descname">rename</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode_old</em>, <em>name_old</em>, <em>parent_inode_new</em>, <em>name_new</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.rename" title="Permalink to this definition">¶</a></dt>
<dd><p>Rename a directory entry.</p>
<p>This method must rename <em>name_old</em> in the directory with inode
<em>parent_inode_old</em> to <em>name_new</em> in the directory with inode
<em>parent_inode_new</em>.  If <em>name_new</em> already exists, it should be
overwritten.  <em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>Let the inode associated with <em>name_old</em> in <em>parent_inode_old</em> be
<em>inode_moved</em>, and the inode associated with <em>name_new</em> in
<em>parent_inode_new</em> (if it exists) be called <em>inode_deref</em>.</p>
<p>If <em>inode_deref</em> exists and has a non-zero lookup count, or if there are
other directory entries referring to <em>inode_deref</em>), the file system
must update only the directory entry for <em>name_new</em> to point to
<em>inode_moved</em> instead of <em>inode_deref</em>.  (Potential) removal of
<em>inode_deref</em> (containing the previous contents of <em>name_new</em>) must be
deferred to the <a class="reference internal" href="#llfuse.Operations.forget" title="llfuse.Operations.forget"><code class="xref py py-obj docutils literal"><span class="pre">forget</span></code></a> method to be carried out when the lookup count
reaches zero (and of course only if at that point there are no more
directory entries associated with <em>inode_deref</em> either).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.rmdir">
<code class="descname">rmdir</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode</em>, <em>name</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.rmdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove directory <em>name</em></p>
<p>This method must remove the directory <em>name</em> from the direcory with
inode <em>parent_inode</em>. <em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance. If
there are still entries in the directory, the method should raise
<code class="docutils literal"><span class="pre">FUSEError(errno.ENOTEMPTY)</span></code>.</p>
<p>If the inode associated with <em>name</em> (i.e., not the <em>parent_inode</em>) has a
non-zero lookup count, the file system must remove only the directory
entry (so that future calls to <a class="reference internal" href="#llfuse.Operations.readdir" title="llfuse.Operations.readdir"><code class="xref py py-obj docutils literal"><span class="pre">readdir</span></code></a> for <em>parent_inode</em> will no
longer include <em>name</em>, but e.g. calls to <a class="reference internal" href="#llfuse.Operations.getattr" title="llfuse.Operations.getattr"><code class="xref py py-obj docutils literal"><span class="pre">getattr</span></code></a> for <em>file</em>&#8216;s inode
still succeed). Removal of the associated inode holding the directory
contents and metadata must be deferred to the <a class="reference internal" href="#llfuse.Operations.forget" title="llfuse.Operations.forget"><code class="xref py py-obj docutils literal"><span class="pre">forget</span></code></a> method to be
carried out when the lookup count reaches zero.</p>
<p>(Since hard links to directories are not allowed by POSIX, this method
is not required to check if there are still other directory entries
refering to the same inode. This conveniently avoids the ambigiouties
associated with the <code class="docutils literal"><span class="pre">.</span></code> and <code class="docutils literal"><span class="pre">..</span></code> entries).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.setattr">
<code class="descname">setattr</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>attr</em>, <em>fields</em>, <em>fh</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.setattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Change attributes of <em>inode</em></p>
<p><em>fields</em> will be an <a class="reference internal" href="data.html#llfuse.SetattrFields" title="llfuse.SetattrFields"><code class="xref py py-obj docutils literal"><span class="pre">SetattrFields</span></code></a> instance that specifies which
attributes are to be updated. <em>attr</em> will be an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a>
instance for <em>inode</em> that contains the new values for changed
attributes, and undefined values for all other attributes.</p>
<p>Most file systems will additionally set the
<a class="reference internal" href="data.html#llfuse.EntryAttributes.st_ctime_ns" title="llfuse.EntryAttributes.st_ctime_ns"><code class="xref py py-obj docutils literal"><span class="pre">st_ctime_ns</span></code></a> attribute to the current time (to
indicate that the inode metadata was changed).</p>
<p>If the syscall that is being processed received a file descriptor
argument (like e.g. <em class="manpage">ftruncate(2)</em> or <em class="manpage">fchmod(2)</em>),
<em>fh</em> will be the file handle returned by the corresponding call to the
<a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> handler. If the syscall was path based (like
e.g. <em class="manpage">truncate(2)</em> or <em class="manpage">chmod(2)</em>), <em>fh</em> will be
<a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">None</span></code></a>.</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The method should return an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance (containing both
the changed and unchanged values).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.setxattr">
<code class="descname">setxattr</code><span class="sig-paren">(</span><em>self</em>, <em>inode</em>, <em>name</em>, <em>value</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.setxattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Set extended attribute <em>name</em> of <em>inode</em> to <em>value</em>.</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The attribute may or may not exist already. Both <em>name</em> and <em>value</em> will
be of type <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#bytes" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">bytes</span></code></a>. <em>name</em> is guaranteed not to contain zero-bytes
(<code class="docutils literal"><span class="pre">\0</span></code>).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.stacktrace">
<code class="descname">stacktrace</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.stacktrace" title="Permalink to this definition">¶</a></dt>
<dd><p>Asynchronous debugging</p>
<p>This method will be called when the <code class="docutils literal"><span class="pre">fuse_stacktrace</span></code> extended
attribute is set on the mountpoint. It will be called without holding
the global lock. The default implementation logs the current stack trace
of every running Python thread. This can be quite useful to debug file
system deadlocks.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.statfs">
<code class="descname">statfs</code><span class="sig-paren">(</span><em>self</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.statfs" title="Permalink to this definition">¶</a></dt>
<dd><p>Get file system statistics</p>
<p><em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The method must return an appropriately filled <a class="reference internal" href="data.html#llfuse.StatvfsData" title="llfuse.StatvfsData"><code class="xref py py-obj docutils literal"><span class="pre">StatvfsData</span></code></a> instance.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.symlink">
<code class="descname">symlink</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode</em>, <em>name</em>, <em>target</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.symlink" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a symbolic link</p>
<p>This method must create a symbolink link named <em>name</em> in the directory
with inode <em>parent_inode</em>, pointing to <em>target</em>.  <em>ctx</em> will be a
<a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a> instance.</p>
<p>The method must return an <a class="reference internal" href="data.html#llfuse.EntryAttributes" title="llfuse.EntryAttributes"><code class="xref py py-obj docutils literal"><span class="pre">EntryAttributes</span></code></a> instance with the attributes
of the newly created directory entry.</p>
<p>(Successful) execution of this handler increases the lookup count for
the returned inode by one.</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.unlink">
<code class="descname">unlink</code><span class="sig-paren">(</span><em>self</em>, <em>parent_inode</em>, <em>name</em>, <em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.unlink" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a (possibly special) file</p>
<p>This method must remove the (special or regular) file <em>name</em> from the
direcory with inode <em>parent_inode</em>.  <em>ctx</em> will be a <a class="reference internal" href="data.html#llfuse.RequestContext" title="llfuse.RequestContext"><code class="xref py py-obj docutils literal"><span class="pre">RequestContext</span></code></a>
instance.</p>
<p>If the inode associated with <em>file</em> (i.e., not the <em>parent_inode</em>) has a
non-zero lookup count, or if there are still other directory entries
referring to this inode (due to hardlinks), the file system must remove
only the directory entry (so that future calls to <a class="reference internal" href="#llfuse.Operations.readdir" title="llfuse.Operations.readdir"><code class="xref py py-obj docutils literal"><span class="pre">readdir</span></code></a> for
<em>parent_inode</em> will no longer include <em>name</em>, but e.g. calls to
<a class="reference internal" href="#llfuse.Operations.getattr" title="llfuse.Operations.getattr"><code class="xref py py-obj docutils literal"><span class="pre">getattr</span></code></a> for <em>file</em>&#8216;s inode still succeed). (Potential) removal of the
associated inode with the file contents and metadata must be deferred to
the <a class="reference internal" href="#llfuse.Operations.forget" title="llfuse.Operations.forget"><code class="xref py py-obj docutils literal"><span class="pre">forget</span></code></a> method to be carried out when the lookup count reaches zero
(and of course only if at that point there are no more directory entries
associated with the inode either).</p>
</dd></dl>

<dl class="method">
<dt id="llfuse.Operations.write">
<code class="descname">write</code><span class="sig-paren">(</span><em>self</em>, <em>fh</em>, <em>off</em>, <em>buf</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.Operations.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write <em>buf</em> into <em>fh</em> at <em>off</em></p>
<p><em>fh</em> will by an integer filehandle returned by a prior <a class="reference internal" href="#llfuse.Operations.open" title="llfuse.Operations.open"><code class="xref py py-obj docutils literal"><span class="pre">open</span></code></a> or
<a class="reference internal" href="#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a> call.</p>
<p>This method must return the number of bytes written. However, unless the
file system has been mounted with the <code class="docutils literal"><span class="pre">direct_io</span></code> option, the file
system <em>must</em> always write <em>all</em> the provided data (i.e., return
<code class="docutils literal"><span class="pre">len(buf)</span></code>).</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper"><h3><a href="index.html">Table Of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="about.html">About</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="general.html">General Information</a></li>
<li class="toctree-l1"><a class="reference internal" href="fuse_api.html">FUSE API Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="data.html">Data Structures</a></li>
<li class="toctree-l1"><a class="reference internal" href="lock.html">The global lock</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Request Handlers</a></li>
<li class="toctree-l1"><a class="reference internal" href="util.html">Utility Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="gotchas.html">Common Gotchas</a></li>
<li class="toctree-l1"><a class="reference internal" href="example.html">Example File Systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="changes.html">Changelog</a></li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="lock.html"
                        title="previous chapter">The global lock</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="util.html"
                        title="next chapter">Utility Functions</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="util.html" title="Utility Functions"
             >next</a> |</li>
        <li class="right" >
          <a href="lock.html" title="The global lock"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Python-LLFUSE 1.3.6 documentation</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2010-2015, Nikolaus Rath.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9.
    </div>
  </body>
</html>