Current File : //proc/thread-self/root/usr/share/doc/python3-llfuse/html/general.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>General Information &#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="FUSE API Functions" href="fuse_api.html" />
    <link rel="prev" title="Installation" href="install.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="fuse_api.html" title="FUSE API Functions"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="install.html" title="Installation"
             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="general-information">
<h1>General Information<a class="headerlink" href="#general-information" title="Permalink to this headline">¶</a></h1>
<div class="section" id="getting-started">
<span id="id1"></span><h2>Getting started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h2>
<p>A file system is implemented by subclassing the <a class="reference internal" href="operations.html#llfuse.Operations" title="llfuse.Operations"><code class="xref py py-obj docutils literal"><span class="pre">llfuse.Operations</span></code></a>
class and implementing the various request handlers.  The handlers
respond to requests received from the FUSE kernel module and perform
functions like looking up the inode given a file name, looking up
attributes of an inode, opening a (file) inode for reading or writing
or listing the contents of a (directory) inode.</p>
<p>An instance of the operations class is passed to <a class="reference internal" href="fuse_api.html#llfuse.init" title="llfuse.init"><code class="xref py py-obj docutils literal"><span class="pre">llfuse.init</span></code></a> to
mount the file system. To enter the request handling loop, run
<a class="reference internal" href="fuse_api.html#llfuse.main" title="llfuse.main"><code class="xref py py-obj docutils literal"><span class="pre">llfuse.main</span></code></a>. This function will return when the file system should
be unmounted again, which is done by calling <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>.</p>
<p>All character data (directory entry names, extended attribute names
and values, symbolic link targets etc) are passed as <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> and must
be returned as <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>. This applies to both running under Python 2.x
and 3.x</p>
<p>For easier debugging, it is strongly recommended that applications
using Python-LLFUSE also make use of the <a class="reference external" href="http://docs.python.org/3/library/faulthandler.html">faulthandler</a> module.</p>
</div>
<div class="section" id="lookup-counts">
<h2>Lookup Counts<a class="headerlink" href="#lookup-counts" title="Permalink to this headline">¶</a></h2>
<p>Most file systems need to keep track which inodes are currently known
to the kernel. This is, for example, necessary to correctly implement
the <em>unlink</em> system call: when unlinking a directory entry whose
associated inode is currently opened, the file system must defer
removal of the inode (and thus the file contents) until it is no
longer in use by any process.</p>
<p>FUSE file systems achieve this by using &#8220;lookup counts&#8221;. A lookup
count is a number that&#8217;s associated with an inode. An inode with a
lookup count of zero is currently not known to the kernel. This means
that if there are no directory entries referring to such an inode it
can be safely removed, or (if a file system implements dynamic inode
numbers), the inode number can be safely recycled.</p>
<p>The lookup count of an inode is increased by one for each call to the
<a class="reference internal" href="operations.html#llfuse.Operations.lookup" title="llfuse.Operations.lookup"><code class="xref py py-obj docutils literal"><span class="pre">lookup</span></code></a>, <a class="reference internal" href="operations.html#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a>, <a class="reference internal" href="operations.html#llfuse.Operations.symlink" title="llfuse.Operations.symlink"><code class="xref py py-obj docutils literal"><span class="pre">symlink</span></code></a>,
<a class="reference internal" href="operations.html#llfuse.Operations.mknod" title="llfuse.Operations.mknod"><code class="xref py py-obj docutils literal"><span class="pre">mknod</span></code></a>, <a class="reference internal" href="operations.html#llfuse.Operations.link" title="llfuse.Operations.link"><code class="xref py py-obj docutils literal"><span class="pre">link</span></code></a> and <a class="reference internal" href="operations.html#llfuse.Operations.mkdir" title="llfuse.Operations.mkdir"><code class="xref py py-obj docutils literal"><span class="pre">mkdir</span></code></a>
handlers. The lookup count is decreased by calls to the
<a class="reference internal" href="operations.html#llfuse.Operations.forget" title="llfuse.Operations.forget"><code class="xref py py-obj docutils literal"><span class="pre">forget</span></code></a> handler.</p>
</div>
<div class="section" id="fuse-and-vfs-locking">
<h2>FUSE and VFS Locking<a class="headerlink" href="#fuse-and-vfs-locking" title="Permalink to this headline">¶</a></h2>
<p>FUSE and the kernel&#8217;s VFS layer provide some basic locking that FUSE
file systems automatically take advantage of. Specifically:</p>
<ul class="simple">
<li>Calls to <a class="reference internal" href="operations.html#llfuse.Operations.rename" title="llfuse.Operations.rename"><code class="xref py py-obj docutils literal"><span class="pre">rename</span></code></a>, <a class="reference internal" href="operations.html#llfuse.Operations.create" title="llfuse.Operations.create"><code class="xref py py-obj docutils literal"><span class="pre">create</span></code></a>,
<a class="reference internal" href="operations.html#llfuse.Operations.symlink" title="llfuse.Operations.symlink"><code class="xref py py-obj docutils literal"><span class="pre">symlink</span></code></a>, <a class="reference internal" href="operations.html#llfuse.Operations.mknod" title="llfuse.Operations.mknod"><code class="xref py py-obj docutils literal"><span class="pre">mknod</span></code></a>, <a class="reference internal" href="operations.html#llfuse.Operations.link" title="llfuse.Operations.link"><code class="xref py py-obj docutils literal"><span class="pre">link</span></code></a> and
<a class="reference internal" href="operations.html#llfuse.Operations.mkdir" title="llfuse.Operations.mkdir"><code class="xref py py-obj docutils literal"><span class="pre">mkdir</span></code></a> acquire a write-lock on the inode of the
directory in which the respective operation takes place (two in case
of rename).</li>
<li>Calls to <a class="reference internal" href="operations.html#llfuse.Operations.lookup" title="llfuse.Operations.lookup"><code class="xref py py-obj docutils literal"><span class="pre">lookup</span></code></a> acquire a read-lock on the inode of the
parent directory (meaning that lookups in the same directory may run
concurrently, but never at the same time as e.g. a rename or mkdir
operation).</li>
<li>Unless writeback caching is enabled (which Python-LLFUSE does not
yet allow), calls to <a class="reference internal" href="operations.html#llfuse.Operations.write" title="llfuse.Operations.write"><code class="xref py py-obj docutils literal"><span class="pre">write</span></code></a> for the same inode are
automatically serialized (i.e., there are never concurrent calls for
the same inode even when multithreading is enabled).</li>
</ul>
</div>
</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 current"><a class="current reference internal" href="#">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"><a class="reference internal" href="operations.html">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="install.html"
                        title="previous chapter">Installation</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="fuse_api.html"
                        title="next chapter">FUSE API 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="fuse_api.html" title="FUSE API Functions"
             >next</a> |</li>
        <li class="right" >
          <a href="install.html" title="Installation"
             >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>