Current File : //proc/thread-self/root/usr/share/doc/python3-llfuse/html/fuse_api.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>FUSE API Functions — 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="Data Structures" href="data.html" />
<link rel="prev" title="General Information" href="general.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="data.html" title="Data Structures"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="general.html" title="General Information"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Python-LLFUSE 1.3.6 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="fuse-api-functions">
<h1>FUSE API Functions<a class="headerlink" href="#fuse-api-functions" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="llfuse.init">
<code class="descclassname">llfuse.</code><code class="descname">init</code><span class="sig-paren">(</span><em>ops</em>, <em>mountpoint</em>, <em>options=default_options</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.init" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize and mount FUSE file system</p>
<p><em>ops</em> has to be an instance of the <a class="reference internal" href="operations.html#llfuse.Operations" title="llfuse.Operations"><code class="xref py py-obj docutils literal"><span class="pre">Operations</span></code></a> class (or another
class defining the same methods).</p>
<p><em>args</em> has to be a set of strings. <a class="reference internal" href="data.html#llfuse.default_options" title="llfuse.default_options"><code class="xref py py-obj docutils literal"><span class="pre">default_options</span></code></a> provides some
reasonable defaults. It is recommended to use these options as a basis and
add or remove options as necessary. For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">my_opts</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">llfuse</span><span class="o">.</span><span class="n">default_options</span><span class="p">)</span>
<span class="n">my_opts</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="s1">'allow_other'</span><span class="p">)</span>
<span class="n">my_opts</span><span class="o">.</span><span class="n">discard</span><span class="p">(</span><span class="s1">'default_permissions'</span><span class="p">)</span>
<span class="n">llfuse</span><span class="o">.</span><span class="n">init</span><span class="p">(</span><span class="n">ops</span><span class="p">,</span> <span class="n">mountpoint</span><span class="p">,</span> <span class="n">my_opts</span><span class="p">)</span>
</pre></div>
</div>
<p>Valid options are listed under <code class="docutils literal"><span class="pre">struct</span>
<span class="pre">fuse_opt</span> <span class="pre">fuse_mount_opts[]</span></code>
(<a class="reference external" href="https://github.com/libfuse/libfuse/blob/master/lib/mount.c#L82">mount.c:82</a>)
and <code class="docutils literal"><span class="pre">struct</span> <span class="pre">fuse_opt</span> <span class="pre">fuse_ll_opts[]</span></code>
(<a class="reference external" href="https://github.com/libfuse/libfuse/blob/master/lib/fuse_lowlevel.c#L2626">fuse_lowlevel_c:2626</a>).</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.main">
<code class="descclassname">llfuse.</code><code class="descname">main</code><span class="sig-paren">(</span><em>workers=None</em>, <em>handle_signals=True</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.main" title="Permalink to this definition">¶</a></dt>
<dd><p>Run FUSE main loop</p>
<p><em>workers</em> specifies the number of threads that will process requests
concurrently. If <em>workers</em> is <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>, llfuse will pick a reasonable
number bigger than one. If <em>workers</em> is <code class="docutils literal"><span class="pre">1</span></code> all requests will be
processed by the thread calling <a class="reference internal" href="#llfuse.main" title="llfuse.main"><code class="xref py py-obj docutils literal"><span class="pre">main</span></code></a>.</p>
<p>This function will also start additional threads for internal purposes (even
if <em>workers</em> is <code class="docutils literal"><span class="pre">1</span></code>). These (and all worker threads) are guaranteed to
have terminated when <a class="reference internal" href="#llfuse.main" title="llfuse.main"><code class="xref py py-obj docutils literal"><span class="pre">main</span></code></a> returns.</p>
<p>Unless <em>handle_signals</em> is <a class="reference external" href="https://docs.python.org/3/library/constants.html#False" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">False</span></code></a>, while this function is running, special
signal handlers will be installed for the <em>SIGTERM</em>, <em>SIGINT</em> (Ctrl-C),
<em>SIGHUP</em>, <em>SIGUSR1</em> and <em>SIGPIPE</em> signals. <em>SIGPIPE</em> will be ignored,
while the other three signals will cause request processing to stop
and the function to return. <em>SIGINT</em> (Ctrl-C) will thus <em>not</em> result in
a <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#KeyboardInterrupt" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">KeyboardInterrupt</span></code></a> exception while this function is runnning.
Note setting <em>handle_signals</em> to <a class="reference external" href="https://docs.python.org/3/library/constants.html#False" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">False</span></code></a> means you must handle the signals
by yourself and call <code class="xref py py-obj docutils literal"><span class="pre">stop</span></code> to make the <a class="reference internal" href="#llfuse.main" title="llfuse.main"><code class="xref py py-obj docutils literal"><span class="pre">main</span></code></a> returns.</p>
<p>When the function returns because the file system has received an unmount
request it will return <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>. If it returns because it has received a
signal, it will return the signal number.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.close">
<code class="descclassname">llfuse.</code><code class="descname">close</code><span class="sig-paren">(</span><em>unmount=True</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Clean up and ensure filesystem is unmounted</p>
<p>If <em>unmount</em> is False, only clean up operations are peformed, but the file
system is not explicitly unmounted.</p>
<p>Normally, the filesystem is unmounted by the user calling umount(8) or
fusermount(1), which then terminates the FUSE main loop. However, the loop
may also terminate as a result of an exception or a signal. In this case the
filesystem remains mounted, but any attempt to access it will block (while
the filesystem process is still running) or (after the filesystem process
has terminated) return an error. If <em>unmount</em> is True, this function will
ensure that the filesystem is properly unmounted.</p>
<p>Note: if the connection to the kernel is terminated via the
<code class="docutils literal"><span class="pre">/sys/fs/fuse/connections/</span></code> interface, this function will <em>not</em> unmount
the filesystem even if <em>unmount</em> is True.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.invalidate_inode">
<code class="descclassname">llfuse.</code><code class="descname">invalidate_inode</code><span class="sig-paren">(</span><em>fuse_ino_t inode</em>, <em>attr_only=False</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.invalidate_inode" title="Permalink to this definition">¶</a></dt>
<dd><p>Invalidate cache for <em>inode</em></p>
<p>Instructs the FUSE kernel module to forgot cached attributes and
data (unless <em>attr_only</em> is True) for <em>inode</em>. This operation is
carried out asynchronously, i.e. the method may return before the
kernel has executed the request.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.invalidate_entry">
<code class="descclassname">llfuse.</code><code class="descname">invalidate_entry</code><span class="sig-paren">(</span><em>fuse_ino_t inode_p</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.invalidate_entry" title="Permalink to this definition">¶</a></dt>
<dd><p>Invalidate directory entry</p>
<p>Instructs the FUSE kernel module to forget about the directory
entry <em>name</em> in the directory with inode <em>inode_p</em>. This operation
is carried out asynchronously, i.e. the method may return before
the kernel has executed the request.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.notify_store">
<code class="descclassname">llfuse.</code><code class="descname">notify_store</code><span class="sig-paren">(</span><em>inode</em>, <em>offset</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.notify_store" title="Permalink to this definition">¶</a></dt>
<dd><p>Store data in kernel page cache</p>
<p>Sends <em>data</em> for the kernel to store it in the page cache for <em>inode</em> at
<em>offset</em>. If this provides data beyond the current file size, the file is
automatically extended.</p>
<p>If this function raises an exception, the store may still have completed
partially.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.get_ino_t_bits">
<code class="descclassname">llfuse.</code><code class="descname">get_ino_t_bits</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.get_ino_t_bits" title="Permalink to this definition">¶</a></dt>
<dd><p>Return number of bits available for inode numbers</p>
<p>Attempts to use inode values that need more bytes will result in
<a class="reference external" href="https://docs.python.org/3/library/exceptions.html#OverflowError" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">OverflowError</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.get_off_t_bits">
<code class="descclassname">llfuse.</code><code class="descname">get_off_t_bits</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.get_off_t_bits" title="Permalink to this definition">¶</a></dt>
<dd><p>Return number of bytes available for file offsets</p>
<p>Attempts to use values whose representation needs more bytes will
result in <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#OverflowError" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">OverflowError</span></code></a>.</p>
</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 current"><a class="current reference internal" href="#">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="general.html"
title="previous chapter">General Information</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="data.html"
title="next chapter">Data Structures</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="data.html" title="Data Structures"
>next</a> |</li>
<li class="right" >
<a href="general.html" title="General Information"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Python-LLFUSE 1.3.6 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2010-2015, Nikolaus Rath.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9.
</div>
</body>
</html>