Current File : //proc/thread-self/root/usr/share/doc/python3-llfuse/html/util.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>Utility 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="Common Gotchas" href="gotchas.html" />
<link rel="prev" title="Request Handlers" href="operations.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="gotchas.html" title="Common Gotchas"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="operations.html" title="Request Handlers"
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="utility-functions">
<h1>Utility Functions<a class="headerlink" href="#utility-functions" title="Permalink to this headline">¶</a></h1>
<p>The following functions do not necessarily translate to calls to the
FUSE library. They are provided because they’re potentially useful
when implementing file systems in Python.</p>
<dl class="function">
<dt id="llfuse.setxattr">
<code class="descclassname">llfuse.</code><code class="descname">setxattr</code><span class="sig-paren">(</span><em>path</em>, <em>name</em>, <em>value</em>, <em>namespace=u'user'</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.setxattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Set extended attribute</p>
<p><em>path</em> and <em>name</em> have to be of type <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">str</span></code></a>. In Python 3.x, they may
contain surrogates. <em>value</em> has to 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>.</p>
<p>Under FreeBSD, the <em>namespace</em> parameter may be set to <em>system</em> or <em>user</em> to
select the namespace for the extended attribute. For other platforms, this
parameter is ignored.</p>
<p>In contrast to the <a class="reference external" href="https://docs.python.org/3/library/os.html#os.setxattr" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">os.setxattr</span></code></a> function from the standard library, the
method provided by Python-LLFUSE is also available for non-Linux systems.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.getxattr">
<code class="descclassname">llfuse.</code><code class="descname">getxattr</code><span class="sig-paren">(</span><em>path</em>, <em>name</em>, <em>size_t size_guess=128</em>, <em>namespace=u'user'</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.getxattr" title="Permalink to this definition">¶</a></dt>
<dd><p>Get extended attribute</p>
<p><em>path</em> and <em>name</em> have to be of type <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">str</span></code></a>. In Python 3.x, they may
contain surrogates. Returns a value 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>.</p>
<p>If the caller knows the approximate size of the attribute value,
it should be supplied in <em>size_guess</em>. If the guess turns out
to be wrong, the system call has to be carried out three times
(the first call will fail, the second determines the size and
the third finally gets the value).</p>
<p>Under FreeBSD, the <em>namespace</em> parameter may be set to <em>system</em> or <em>user</em> to
select the namespace for the extended attribute. For other platforms, this
parameter is ignored.</p>
<p>In contrast to the <a class="reference external" href="https://docs.python.org/3/library/os.html#os.getxattr" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">os.getxattr</span></code></a> function from the standard library, the
method provided by Python-LLFUSE is also available for non-Linux systems.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.listdir">
<code class="descclassname">llfuse.</code><code class="descname">listdir</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.listdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Like <a class="reference external" href="https://docs.python.org/3/library/os.html#os.listdir" title="(in Python v3.7)"><code class="xref py py-obj docutils literal"><span class="pre">os.listdir</span></code></a>, but releases the GIL.</p>
<p>This function returns an iterator over the directory entries in
<em>path</em>. The returned values are of type <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#textseq" title="(in Python v3.7)"><span class="xref std std-ref">str</span></a> in both Python 2.x and 3.x.</p>
<p>In Python 2.x <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> is equivalent to <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> so all names
can be represented. In Python 3.x, surrogate escape coding (cf.
<a class="reference external" href="http://www.python.org/dev/peps/pep-0383/">PEP 383</a>) is used for
directory names that do not have a string representation.</p>
</dd></dl>
<dl class="function">
<dt id="llfuse.get_sup_groups">
<code class="descclassname">llfuse.</code><code class="descname">get_sup_groups</code><span class="sig-paren">(</span><em>pid</em><span class="sig-paren">)</span><a class="headerlink" href="#llfuse.get_sup_groups" title="Permalink to this definition">¶</a></dt>
<dd><p>Return supplementary group ids of <em>pid</em></p>
<p>This function is relatively expensive because it has to read the group ids
from <code class="docutils literal"><span class="pre">/proc/[pid]/status</span></code>. For the same reason, it will also not work on
systems that do not provide a <code class="docutils literal"><span class="pre">/proc</span></code> file system.</p>
<p>Returns a set.</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"><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 current"><a class="current reference internal" href="#">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="operations.html"
title="previous chapter">Request Handlers</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="gotchas.html"
title="next chapter">Common Gotchas</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="gotchas.html" title="Common Gotchas"
>next</a> |</li>
<li class="right" >
<a href="operations.html" title="Request Handlers"
>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>