403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.217.116
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/sysutils/fusefs-libs3/work/fuse-3.12.0/doc/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/sysutils/fusefs-libs3/work/fuse-3.12.0/doc/html/notify__inval__entry_8c.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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libfuse: example/notify_inval_entry.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libfuse
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_cfafba98a580ce4b62f8a6fa96d7cbb0.html">example</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">notify_inval_entry.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;<a class="el" href="fuse__lowlevel_8h_source.html">fuse_lowlevel.h</a>&gt;</code><br />
<code>#include &lt;stdio.h&gt;</code><br />
<code>#include &lt;stdlib.h&gt;</code><br />
<code>#include &lt;string.h&gt;</code><br />
<code>#include &lt;errno.h&gt;</code><br />
<code>#include &lt;fcntl.h&gt;</code><br />
<code>#include &lt;assert.h&gt;</code><br />
<code>#include &lt;stddef.h&gt;</code><br />
<code>#include &lt;unistd.h&gt;</code><br />
<code>#include &lt;pthread.h&gt;</code><br />
</div>
<p><a href="notify__inval__entry_8c_source.html">Go to the source code of this file.</a></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This example implements a file system with a single file whose file name changes dynamically to reflect the current time.</p>
<p>It illustrates the use of the <a class="el" href="fuse__lowlevel_8h.html#ab14032b74b0a57a2b3155dd6ba8d6095">fuse_lowlevel_notify_inval_entry()</a> function.</p>
<p>To see the effect, first start the file system with the <code>--no-notify</code> </p><pre class="fragment">$ notify_inval_entry --update-interval=1 --timeout 30 --no-notify mnt/
</pre><p>Observe that <code>ls</code> always prints the correct directory contents (since <code>readdir</code> output is not cached):: </p><pre class="fragment">$ ls mnt; sleep 1; ls mnt; sleep 1; ls mnt
Time_is_15h_48m_33s  current_time
Time_is_15h_48m_34s  current_time
Time_is_15h_48m_35s  current_time
</pre><p>However, if you try to access a file by name the kernel will report that it still exists: </p><pre class="fragment">$ file=$(ls mnt/); echo $file
Time_is_15h_50m_09s
$ sleep 5; stat mnt/$file
  File: ‘mnt/Time_is_15h_50m_09s’
  Size: 32                Blocks: 0          IO Block: 4096   regular file
Device: 2ah/42d     Inode: 3           Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1969-12-31 16:00:00.000000000 -0800
Modify: 1969-12-31 16:00:00.000000000 -0800
Change: 1969-12-31 16:00:00.000000000 -0800
 Birth: -
</pre><p>Only once the kernel cache timeout has been reached will the stat call fail: </p><pre class="fragment">$ sleep 30; stat mnt/$file
stat: cannot stat ‘mnt/Time_is_15h_50m_09s’: No such file or directory
</pre><p>In contrast, if you enable notifications you will be unable to stat the file as soon as the file system updates its name: </p><pre class="fragment">$ notify_inval_entry --update-interval=1 --timeout 30 --no-notify mnt/
$ file=$(ls mnt/); stat mnt/$file
  File: ‘mnt/Time_is_20h_42m_11s’
  Size: 0                 Blocks: 0          IO Block: 4096   regular empty file
Device: 2ah/42d     Inode: 2           Links: 1
Access: (0000/----------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1969-12-31 16:00:00.000000000 -0800
Modify: 1969-12-31 16:00:00.000000000 -0800
Change: 1969-12-31 16:00:00.000000000 -0800
 Birth: -
$ sleep 1; stat mnt/$file
stat: cannot stat ‘mnt/Time_is_20h_42m_11s’: No such file or directory
</pre><h2>Compilation</h2>
<pre class="fragment">gcc -Wall notify_inval_entry.c `pkg-config fuse3 --cflags --libs` -o notify_inval_entry
</pre><h2>Source code</h2>
<div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment">  FUSE: Filesystem in Userspace</span></div><div class="line"><span class="comment">  Copyright (C) 2016 Nikolaus Rath &lt;Nikolaus@rath.org&gt;</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  This program can be distributed under the terms of the GNU GPLv2.</span></div><div class="line"><span class="comment">  See the file COPYING.</span></div><div class="line"><span class="comment">*/</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define FUSE_USE_VERSION 34</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="fuse__lowlevel_8h.html">fuse_lowlevel.h</a>&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;errno.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;fcntl.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;assert.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stddef.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;unistd.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;pthread.h&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define MAX_STR_LEN 128</span></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">char</span> file_name[MAX_STR_LEN];</div><div class="line"><span class="keyword">static</span> <a class="code" href="fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> file_ino = 2;</div><div class="line"><span class="keyword">static</span> <span class="keywordtype">int</span> lookup_cnt = 0;</div><div class="line"></div><div class="line"><span class="comment">/* Command line parsing */</span></div><div class="line"><span class="keyword">struct </span>options {</div><div class="line">    <span class="keywordtype">int</span> no_notify;</div><div class="line">    <span class="keywordtype">float</span> timeout;</div><div class="line">    <span class="keywordtype">int</span> update_interval;</div><div class="line">};</div><div class="line"><span class="keyword">static</span> <span class="keyword">struct </span>options options = {</div><div class="line">    .timeout = 5,</div><div class="line">    .no_notify = 0,</div><div class="line">    .update_interval = 1,</div><div class="line">};</div><div class="line"></div><div class="line"><span class="preprocessor">#define OPTION(t, p)                           \</span></div><div class="line"><span class="preprocessor">    { t, offsetof(struct options, p), 1 }</span></div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__opt.html">fuse_opt</a> option_spec[] = {</div><div class="line">    OPTION(<span class="stringliteral">&quot;--no-notify&quot;</span>, no_notify),</div><div class="line">    OPTION(<span class="stringliteral">&quot;--update-interval=%d&quot;</span>, update_interval),</div><div class="line">    OPTION(<span class="stringliteral">&quot;--timeout=%f&quot;</span>, timeout),</div><div class="line">    <a class="code" href="fuse__opt_8h.html#aca35962e17d189ceb5447f8eea11bd33">FUSE_OPT_END</a></div><div class="line">};</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">int</span> tfs_stat(<a class="code" href="fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino, <span class="keyword">struct</span> stat *stbuf) {</div><div class="line">    stbuf-&gt;st_ino = ino;</div><div class="line">    <span class="keywordflow">if</span> (ino == <a class="code" href="fuse__lowlevel_8h.html#a14d7299559cf05272b838cfc6388ef91">FUSE_ROOT_ID</a>) {</div><div class="line">        stbuf-&gt;st_mode = S_IFDIR | 0755;</div><div class="line">        stbuf-&gt;st_nlink = 1;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (ino == file_ino) {</div><div class="line">        stbuf-&gt;st_mode = S_IFREG | 0000;</div><div class="line">        stbuf-&gt;st_nlink = 1;</div><div class="line">        stbuf-&gt;st_size = 0;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">else</span></div><div class="line">        <span class="keywordflow">return</span> -1;</div><div class="line"></div><div class="line">    <span class="keywordflow">return</span> 0;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> tfs_lookup(<a class="code" href="fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> parent,</div><div class="line">                       <span class="keyword">const</span> <span class="keywordtype">char</span> *name) {</div><div class="line">    <span class="keyword">struct </span><a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> e;</div><div class="line">    memset(&amp;e, 0, <span class="keyword">sizeof</span>(e));</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (parent != <a class="code" href="fuse__lowlevel_8h.html#a14d7299559cf05272b838cfc6388ef91">FUSE_ROOT_ID</a>)</div><div class="line">        <span class="keywordflow">goto</span> err_out;</div><div class="line">    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(name, file_name) == 0) {</div><div class="line">        e.ino = file_ino;</div><div class="line">        lookup_cnt++;</div><div class="line">    } <span class="keywordflow">else</span></div><div class="line">        <span class="keywordflow">goto</span> err_out;</div><div class="line"></div><div class="line">    e.attr_timeout = options.timeout;</div><div class="line">    e.entry_timeout = options.timeout;</div><div class="line">    <span class="keywordflow">if</span> (tfs_stat(e.ino, &amp;e.attr) != 0)</div><div class="line">        <span class="keywordflow">goto</span> err_out;</div><div class="line">    <a class="code" href="fuse__lowlevel_8h.html#a672c45e126cd240f4bcd59bf9b7e3708">fuse_reply_entry</a>(req, &amp;e);</div><div class="line">    <span class="keywordflow">return</span>;</div><div class="line"></div><div class="line">err_out:</div><div class="line">    <a class="code" href="fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOENT);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> tfs_forget (<a class="code" href="fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line">                        uint64_t nlookup) {</div><div class="line">    (void) req;</div><div class="line">    <span class="keywordflow">if</span>(ino == file_ino)</div><div class="line">        lookup_cnt -= nlookup;</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">        assert(ino == <a class="code" href="fuse__lowlevel_8h.html#a14d7299559cf05272b838cfc6388ef91">FUSE_ROOT_ID</a>);</div><div class="line">    <a class="code" href="fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> tfs_getattr(<a class="code" href="fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line">                        <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fi) {</div><div class="line">    <span class="keyword">struct </span>stat stbuf;</div><div class="line"></div><div class="line">    (void) fi;</div><div class="line"></div><div class="line">    memset(&amp;stbuf, 0, <span class="keyword">sizeof</span>(stbuf));</div><div class="line">    <span class="keywordflow">if</span> (tfs_stat(ino, &amp;stbuf) != 0)</div><div class="line">        <a class="code" href="fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOENT);</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">        <a class="code" href="fuse__lowlevel_8h.html#ad28378dc569019c32acdb4995d70be18">fuse_reply_attr</a>(req, &amp;stbuf, options.timeout);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">struct </span>dirbuf {</div><div class="line">    <span class="keywordtype">char</span> *p;</div><div class="line">    <span class="keywordtype">size_t</span> size;</div><div class="line">};</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> dirbuf_add(<a class="code" href="fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">struct</span> dirbuf *b, <span class="keyword">const</span> <span class="keywordtype">char</span> *name,</div><div class="line">                       <a class="code" href="fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino) {</div><div class="line">    <span class="keyword">struct </span>stat stbuf;</div><div class="line">    <span class="keywordtype">size_t</span> oldsize = b-&gt;size;</div><div class="line">    b-&gt;size += <a class="code" href="fuse__lowlevel_8h.html#ad1957bcc8ece8c90f16c42c4daf3053f">fuse_add_direntry</a>(req, NULL, 0, name, NULL, 0);</div><div class="line">    b-&gt;p = (<span class="keywordtype">char</span> *) realloc(b-&gt;p, b-&gt;size);</div><div class="line">    memset(&amp;stbuf, 0, <span class="keyword">sizeof</span>(stbuf));</div><div class="line">    stbuf.st_ino = ino;</div><div class="line">    <a class="code" href="fuse__lowlevel_8h.html#ad1957bcc8ece8c90f16c42c4daf3053f">fuse_add_direntry</a>(req, b-&gt;p + oldsize, b-&gt;size - oldsize, name, &amp;stbuf,</div><div class="line">                      b-&gt;size);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="preprocessor">#define min(x, y) ((x) &lt; (y) ? (x) : (y))</span></div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">int</span> reply_buf_limited(<a class="code" href="fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> bufsize,</div><div class="line">                             off_t off, <span class="keywordtype">size_t</span> maxsize) {</div><div class="line">    <span class="keywordflow">if</span> (off &lt; bufsize)</div><div class="line">        <span class="keywordflow">return</span> <a class="code" href="fuse__lowlevel_8h.html#a300a88b63ab7c8ca92853a97486448c0">fuse_reply_buf</a>(req, buf + off,</div><div class="line">                              min(bufsize - off, maxsize));</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">        <span class="keywordflow">return</span> <a class="code" href="fuse__lowlevel_8h.html#a300a88b63ab7c8ca92853a97486448c0">fuse_reply_buf</a>(req, NULL, 0);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> tfs_readdir(<a class="code" href="fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino, <span class="keywordtype">size_t</span> size,</div><div class="line">                        off_t off, <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fi) {</div><div class="line">    (void) fi;</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (ino != <a class="code" href="fuse__lowlevel_8h.html#a14d7299559cf05272b838cfc6388ef91">FUSE_ROOT_ID</a>)</div><div class="line">        <a class="code" href="fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOTDIR);</div><div class="line">    <span class="keywordflow">else</span> {</div><div class="line">        <span class="keyword">struct </span>dirbuf b;</div><div class="line"></div><div class="line">        memset(&amp;b, 0, <span class="keyword">sizeof</span>(b));</div><div class="line">        dirbuf_add(req, &amp;b, file_name, file_ino);</div><div class="line">        reply_buf_limited(req, b.p, b.size, off, size);</div><div class="line">        free(b.p);</div><div class="line">    }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a> tfs_oper = {</div><div class="line">    .<a class="code" href="structfuse__lowlevel__ops.html#a7f46abd7c2795cfcf7a3d8c5ee8f6c70">lookup</a>     = tfs_lookup,</div><div class="line">    .getattr    = tfs_getattr,</div><div class="line">    .readdir    = tfs_readdir,</div><div class="line">    .forget     = tfs_forget,</div><div class="line">};</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> update_fs(<span class="keywordtype">void</span>) {</div><div class="line">    time_t t;</div><div class="line">    <span class="keyword">struct </span>tm *now;</div><div class="line">    ssize_t ret;</div><div class="line"></div><div class="line">    t = time(NULL);</div><div class="line">    now = localtime(&amp;t);</div><div class="line">    assert(now != NULL);</div><div class="line"></div><div class="line">    ret = strftime(file_name, MAX_STR_LEN,</div><div class="line">                   <span class="stringliteral">&quot;Time_is_%Hh_%Mm_%Ss&quot;</span>, now);</div><div class="line">    assert(ret != 0);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span>* update_fs_loop(<span class="keywordtype">void</span> *data) {</div><div class="line">    <span class="keyword">struct </span>fuse_session *se = (<span class="keyword">struct </span>fuse_session*) data;</div><div class="line">    <span class="keywordtype">char</span> *old_name;</div><div class="line"></div><div class="line">    <span class="keywordflow">while</span>(1) {</div><div class="line">        old_name = strdup(file_name);</div><div class="line">        update_fs();</div><div class="line">        <span class="keywordflow">if</span> (!options.no_notify &amp;&amp; lookup_cnt)</div><div class="line">            assert(<a class="code" href="fuse__lowlevel_8h.html#ab14032b74b0a57a2b3155dd6ba8d6095">fuse_lowlevel_notify_inval_entry</a></div><div class="line">                   (se, <a class="code" href="fuse__lowlevel_8h.html#a14d7299559cf05272b838cfc6388ef91">FUSE_ROOT_ID</a>, old_name, strlen(old_name)) == 0);</div><div class="line">        free(old_name);</div><div class="line">        sleep(options.update_interval);</div><div class="line">    }</div><div class="line">    <span class="keywordflow">return</span> NULL;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> show_help(<span class="keyword">const</span> <span class="keywordtype">char</span> *progname)</div><div class="line">{</div><div class="line">    printf(<span class="stringliteral">&quot;usage: %s [options] &lt;mountpoint&gt;\n\n&quot;</span>, progname);</div><div class="line">    printf(<span class="stringliteral">&quot;File-system specific options:\n&quot;</span></div><div class="line">               <span class="stringliteral">&quot;    --timeout=&lt;secs&gt;       Timeout for kernel caches\n&quot;</span></div><div class="line">               <span class="stringliteral">&quot;    --update-interval=&lt;secs&gt;  Update-rate of file system contents\n&quot;</span></div><div class="line">               <span class="stringliteral">&quot;    --no-notify            Disable kernel notifications\n&quot;</span></div><div class="line">               <span class="stringliteral">&quot;\n&quot;</span>);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]) {</div><div class="line">    <span class="keyword">struct </span><a class="code" href="structfuse__args.html">fuse_args</a> args = <a class="code" href="fuse__opt_8h.html#a9bea40fe56b18be9aa110185ab7387ed">FUSE_ARGS_INIT</a>(argc, argv);</div><div class="line">    <span class="keyword">struct </span>fuse_session *se;</div><div class="line">    <span class="keyword">struct </span>fuse_cmdline_opts opts;</div><div class="line">    <span class="keyword">struct </span><a class="code" href="structfuse__loop__config.html">fuse_loop_config</a> config;</div><div class="line">    pthread_t updater;</div><div class="line">    <span class="keywordtype">int</span> ret = -1;</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e">fuse_opt_parse</a>(&amp;args, &amp;options, option_spec, NULL) == -1)</div><div class="line">        <span class="keywordflow">return</span> 1;</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="fuse__lowlevel_8h.html#a8421a0cb3b6fb7013c7272c6997d1e08">fuse_parse_cmdline</a>(&amp;args, &amp;opts) != 0)</div><div class="line">        <span class="keywordflow">return</span> 1;</div><div class="line">    <span class="keywordflow">if</span> (opts.show_help) {</div><div class="line">        show_help(argv[0]);</div><div class="line">        <a class="code" href="fuse__lowlevel_8h.html#a7235e3a2d1c780d5e0beaee13c81529f">fuse_cmdline_help</a>();</div><div class="line">        <a class="code" href="fuse__lowlevel_8h.html#a990af0becaba1b5e45781d399720f85e">fuse_lowlevel_help</a>();</div><div class="line">        ret = 0;</div><div class="line">        <span class="keywordflow">goto</span> err_out1;</div><div class="line">    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (opts.show_version) {</div><div class="line">        printf(<span class="stringliteral">&quot;FUSE library version %s\n&quot;</span>, <a class="code" href="fuse__common_8h.html#ac52e27388a7c16eb509173908e5eebd0">fuse_pkgversion</a>());</div><div class="line">        <a class="code" href="fuse__lowlevel_8h.html#ac6e2d0fde62dcf4f0e57afeabeefd7b1">fuse_lowlevel_version</a>();</div><div class="line">        ret = 0;</div><div class="line">        <span class="keywordflow">goto</span> err_out1;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Initial contents */</span></div><div class="line">    update_fs();</div><div class="line"></div><div class="line">    se = <a class="code" href="fuse__lowlevel_8h.html#a9ee52f81d0c63d9bd46b11314ba596cf">fuse_session_new</a>(&amp;args, &amp;tfs_oper,</div><div class="line">                          <span class="keyword">sizeof</span>(tfs_oper), NULL);</div><div class="line">    <span class="keywordflow">if</span> (se == NULL)</div><div class="line">        <span class="keywordflow">goto</span> err_out1;</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="fuse__common_8h.html#a292dccc3c7b1799cb054efa2ba0c774b">fuse_set_signal_handlers</a>(se) != 0)</div><div class="line">        <span class="keywordflow">goto</span> err_out2;</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="fuse__lowlevel_8h.html#aa6d77679a110582684e9ca2da623bbc2">fuse_session_mount</a>(se, opts.mountpoint) != 0)</div><div class="line">        <span class="keywordflow">goto</span> err_out3;</div><div class="line"></div><div class="line">    <a class="code" href="fuse__common_8h.html#af1857d2209952f49a762aff39f3cd8bd">fuse_daemonize</a>(opts.foreground);</div><div class="line"></div><div class="line">    <span class="comment">/* Start thread to update file contents */</span></div><div class="line">    ret = pthread_create(&amp;updater, NULL, update_fs_loop, (<span class="keywordtype">void</span> *)se);</div><div class="line">    <span class="keywordflow">if</span> (ret != 0) {</div><div class="line">        fprintf(stderr, <span class="stringliteral">&quot;pthread_create failed with %s\n&quot;</span>,</div><div class="line">                strerror(ret));</div><div class="line">        <span class="keywordflow">goto</span> err_out3;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Block until ctrl+c or fusermount -u */</span></div><div class="line">    <span class="keywordflow">if</span> (opts.singlethread)</div><div class="line">        ret = <a class="code" href="fuse__lowlevel_8h.html#a5f1e538aa3287e251afbe985438c4249">fuse_session_loop</a>(se);</div><div class="line">    <span class="keywordflow">else</span> {</div><div class="line">        config.clone_fd = opts.clone_fd;</div><div class="line">        config.max_idle_threads = opts.max_idle_threads;</div><div class="line">        ret = <a class="code" href="fuse__lowlevel_8h.html#abf73f7cd9149b60f9635b8eac429fb1f">fuse_session_loop_mt</a>(se, &amp;config);</div><div class="line">    }</div><div class="line"></div><div class="line">    <a class="code" href="fuse__lowlevel_8h.html#a6c10d942751ddb214863a8b5e53de5e8">fuse_session_unmount</a>(se);</div><div class="line">err_out3:</div><div class="line">    <a class="code" href="fuse__common_8h.html#aeb674bbc11074c4fe520b952d6bfdd30">fuse_remove_signal_handlers</a>(se);</div><div class="line">err_out2:</div><div class="line">    <a class="code" href="fuse__lowlevel_8h.html#a08b5503c4e9656f9c4bc88331233cc65">fuse_session_destroy</a>(se);</div><div class="line">err_out1:</div><div class="line">    free(opts.mountpoint);</div><div class="line">    <a class="code" href="fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(&amp;args);</div><div class="line"></div><div class="line">    <span class="keywordflow">return</span> ret ? 1 : 0;</div><div class="line">}</div><div class="line"></div><div class="line"></div></div><!-- fragment --> 
<p class="definition">Definition in file <a class="el" href="notify__inval__entry_8c_source.html">notify_inval_entry.c</a>.</p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit