1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>Utility Functions — pyfuse3 3.4.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/classic.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.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="next" title="Common Gotchas" href="gotchas.html" />
<link rel="prev" title="Request Handlers" href="operations.html" />
</head><body>
<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="py-modindex.html" title="Python Module Index"
>modules</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">pyfuse3 3.4.0 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">Utility Functions</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="utility-functions">
<h1>Utility Functions<a class="headerlink" href="#utility-functions" title="Permalink to this heading">¶</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="py function">
<dt class="sig sig-object py" id="pyfuse3.setxattr">
<span class="sig-prename descclassname"><span class="pre">pyfuse3.</span></span><span class="sig-name descname"><span class="pre">setxattr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">namespace</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'user'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyfuse3.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.12)"><code class="xref py py-obj docutils literal notranslate"><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.12)"><code class="xref py py-obj docutils literal notranslate"><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.12)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">os.setxattr</span></code></a> function from the standard library, the
method provided by pyfuse3 is also available for non-Linux systems.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="pyfuse3.getxattr">
<span class="sig-prename descclassname"><span class="pre">pyfuse3.</span></span><span class="sig-name descname"><span class="pre">getxattr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size_t</span> <span class="pre">size_guess=128</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">namespace=u'user'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyfuse3.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.12)"><code class="xref py py-obj docutils literal notranslate"><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.12)"><code class="xref py py-obj docutils literal notranslate"><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.12)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">os.getxattr</span></code></a> function from the standard library, the
method provided by pyfuse3 is also available for non-Linux systems.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="pyfuse3.listdir">
<span class="sig-prename descclassname"><span class="pre">pyfuse3.</span></span><span class="sig-name descname"><span class="pre">listdir</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyfuse3.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.12)"><code class="xref py py-obj docutils literal notranslate"><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>.</p>
<p>The returned values are of type <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#textseq" title="(in Python v3.12)"><span class="xref std std-ref">str</span></a>. 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="py function">
<dt class="sig sig-object py" id="pyfuse3.get_sup_groups">
<span class="sig-prename descclassname"><span class="pre">pyfuse3.</span></span><span class="sig-name descname"><span class="pre">get_sup_groups</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pid</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyfuse3.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 notranslate"><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 notranslate"><span class="pre">/proc</span></code> file system.</p>
<p>Returns a set.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="pyfuse3.syncfs">
<span class="sig-prename descclassname"><span class="pre">pyfuse3.</span></span><span class="sig-name descname"><span class="pre">syncfs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyfuse3.syncfs" title="Permalink to this definition">¶</a></dt>
<dd><p>Sync filesystem mounted at <em>path</em></p>
<p>This is a Python interface to the syncfs(2) system call. There is no
particular relation to libfuse, it is provided by pyfuse3 as a convience.</p>
</dd></dl>
</section>
<div class="clearer"></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="asyncio.html">asyncio Support</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="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>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="operations.html"
title="previous chapter">Request Handlers</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="gotchas.html"
title="next chapter">Common Gotchas</a></p>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</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="py-modindex.html" title="Python Module Index"
>modules</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">pyfuse3 3.4.0 documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">Utility Functions</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2010-2024, Nikolaus Rath.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
</div>
</body>
</html>
|