=========================================================== .___ __ __ _________________ __ __ __| _/|__|/ |_ / ___\_` __ \__ \ | | \/ __ | | \\_ __\ / /_/ > | \// __ \| | / /_/ | | || | \___ /|__| (____ /____/\____ | |__||__| /_____/ \/ \/ grep rough audit - static analysis tool v2.8 written by @Wireghoul =================================[justanotherhacker.com]=== fuse3-3.10.0/ChangeLog.rst-273-* The init script is now installed into the right location fuse3-3.10.0/ChangeLog.rst:274: (``$DESTDIR/etc/init.d`` rather than ``$prefix/$sysconfdir/init.d``) fuse3-3.10.0/ChangeLog.rst-275-* The `example/passthrough_ll` filesystem now supports creating ############################################## fuse3-3.10.0/doc/html/fuse-3_86_80_2lib_2fuse__opt_8c_source.html-47-<div class="contents"> fuse3-3.10.0/doc/html/fuse-3_86_80_2lib_2fuse__opt_8c_source.html:48:<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> FUSE: Filesystem in Userspace</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> Implementation of option parsing routines (dealing with `struct</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> fuse_args`).</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> This program can be distributed under the terms of the GNU LGPLv2.</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> See the file COPYING.LIB</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">*/</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include "config.h"</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include "fuse_opt.h"</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "fuse_misc.h"</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <stdio.h></span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <assert.h></span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">struct </span>fuse_opt_context {</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordtype">void</span> *data;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__opt.html">fuse_opt</a> *opt;</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a3d2ab809528d409b0ee91cee400c07c2">fuse_opt_proc_t</a> proc;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordtype">int</span> argctr;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordtype">int</span> argc;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordtype">char</span> **argv;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">struct </span><a class="code" href="structfuse__args.html">fuse_args</a> outargs;</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordtype">char</span> *opts;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordtype">int</span> nonopt;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> };</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d"> 33</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args)</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">if</span> (args) {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> && args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a>) {</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordtype">int</span> i;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">for</span> (i = 0; i < args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>; i++)</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  free(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  free(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  }</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> = 0;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> = NULL;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a> = 0;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  }</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> }</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="keyword">static</span> <span class="keywordtype">int</span> alloc_failed(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> {</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  fprintf(stderr, <span class="stringliteral">"fuse: memory allocation failed\n"</span>);</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> }</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094"> 54</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> {</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordtype">char</span> **newargv;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">char</span> *newarg;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  assert(!args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> || args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a>);</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  newarg = strdup(arg);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">if</span> (!newarg)</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  newargv = realloc(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>, (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> + 2) * <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *));</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordflow">if</span> (!newargv) {</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  free(newarg);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  }</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> = newargv;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a> = 1;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>++] = newarg;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>] = NULL;</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> }</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_opt_insert_arg_common(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">int</span> pos,</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  assert(pos <= args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(args, arg) == -1)</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">if</span> (pos != args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - 1) {</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordtype">char</span> *newarg = args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - 1];</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  memmove(&args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos + 1], &args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos],</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *) * (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - pos - 1));</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos] = newarg;</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  }</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> }</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div><div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0"> 94</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">int</span> pos, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> {</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">return</span> fuse_opt_insert_arg_common(args, pos, arg);</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> }</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="keyword">static</span> <span class="keywordtype">int</span> next_arg(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> {</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (ctx->argctr + 1 >= ctx->argc) {</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  fprintf(stderr, <span class="stringliteral">"fuse: missing argument after `%s'\n"</span>, opt);</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  }</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  ctx->argctr++;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> }</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_arg(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> {</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(&ctx->outargs, arg);</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> }</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_opt_common(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt, <span class="keywordtype">int</span> esc)</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordtype">unsigned</span> oldlen = *opts ? strlen(*opts) : 0;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordtype">char</span> *d = realloc(*opts, oldlen + 1 + strlen(opt) * 2 + 1);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">if</span> (!d)</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  *opts = d;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">if</span> (oldlen) {</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  d += oldlen;</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  *d++ = <span class="charliteral">','</span>;</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  }</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> </div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">for</span> (; *opt; opt++) {</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">if</span> (esc && (*opt == <span class="charliteral">','</span> || *opt == <span class="charliteral">'\\'</span>))</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  *d++ = <span class="charliteral">'\\'</span>;</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  *d++ = *opt;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  }</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  *d = <span class="charliteral">'\0'</span>;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> }</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div><div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="include_2fuse__opt_8h.html#aaae525d5e959c5394bc323be0c1d02b0"> 138</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#aaae525d5e959c5394bc323be0c1d02b0">fuse_opt_add_opt</a>(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> {</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordflow">return</span> add_opt_common(opts, opt, 0);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> }</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> </div><div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="include_2fuse__opt_8h.html#a51a00d087d08bef250a53b9e4979b1cd"> 143</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a51a00d087d08bef250a53b9e4979b1cd">fuse_opt_add_opt_escaped</a>(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> {</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">return</span> add_opt_common(opts, opt, 1);</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> }</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> </div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_opt(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span> {</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keywordflow">return</span> add_opt_common(&ctx->opts, opt, 1);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> }</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="keyword">static</span> <span class="keywordtype">int</span> call_proc(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> key,</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> {</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">if</span> (key == <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a6e97b6ce492f1baaaf0a4eb4970c9a2f">FUSE_OPT_KEY_DISCARD</a>)</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordflow">if</span> (key != <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a8533ff341f910c1bd05f10c8fcc35a04">FUSE_OPT_KEY_KEEP</a> && ctx->proc) {</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordtype">int</span> res = ctx->proc(ctx->data, arg, key, &ctx->outargs);</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">if</span> (res == -1 || !res)</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  }</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="keywordflow">if</span> (iso)</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordflow">return</span> add_opt(ctx, arg);</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keywordflow">return</span> add_arg(ctx, arg);</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> }</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> </div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="keyword">static</span> <span class="keywordtype">int</span> match_template(<span class="keyword">const</span> <span class="keywordtype">char</span> *t, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">unsigned</span> *sepp)</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span> {</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordtype">int</span> arglen = strlen(arg);</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *sep = strchr(t, <span class="charliteral">'='</span>);</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  sep = sep ? sep : strchr(t, <span class="charliteral">' '</span>);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="keywordflow">if</span> (sep && (!sep[1] || sep[1] == <span class="charliteral">'%'</span>)) {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="keywordtype">int</span> tlen = sep - t;</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="keywordflow">if</span> (sep[0] == <span class="charliteral">'='</span>)</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  tlen ++;</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">if</span> (arglen >= tlen && strncmp(arg, t, tlen) == 0) {</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  *sepp = sep - t;</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  }</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  }</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="keywordflow">if</span> (strcmp(t, arg) == 0) {</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  *sepp = 0;</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  }</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> }</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> </div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> <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> *find_opt(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt,</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">unsigned</span> *sepp)</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> {</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keywordflow">for</span> (; opt && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>; opt++)</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (match_template(opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>, arg, sepp))</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordflow">return</span> opt;</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#af16c684bd2b10b7ac0ae299afa1e0e06">fuse_opt_match</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> {</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="keywordtype">unsigned</span> dummy;</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <span class="keywordflow">return</span> find_opt(opts, opt, &dummy) ? 1 : 0;</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> }</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> </div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt_param(<span class="keywordtype">void</span> *var, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, <span class="keyword">const</span> <span class="keywordtype">char</span> *param,</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> {</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  assert(format[0] == <span class="charliteral">'%'</span>);</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="keywordflow">if</span> (format[1] == <span class="charliteral">'s'</span>) {</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keywordtype">char</span> **s = var;</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keywordtype">char</span> *copy = strdup(param);</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <span class="keywordflow">if</span> (!copy)</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span> </div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  free(*s);</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  *s = copy;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <span class="keywordflow">if</span> (sscanf(param, format, var) != 1) {</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  fprintf(stderr, <span class="stringliteral">"fuse: invalid parameter in option `%s'\n"</span>, arg);</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  }</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  }</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> }</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span> </div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt(<span class="keyword">struct</span> fuse_opt_context *ctx,</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt, <span class="keywordtype">unsigned</span> sep,</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span> {</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <span class="keywordflow">if</span> (opt-><a class="code" href="structfuse__opt.html#a333dcd849a3bd54df06084a69b5a8d39">offset</a> == -1U) {</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordflow">if</span> (call_proc(ctx, arg, opt-><a class="code" href="structfuse__opt.html#aeb76339e1ce6948ad94bd2d4d5d01e20">value</a>, iso) == -1)</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordtype">void</span> *var = (<span class="keywordtype">char</span> *)ctx->data + opt-><a class="code" href="structfuse__opt.html#a333dcd849a3bd54df06084a69b5a8d39">offset</a>;</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  if (sep && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep + 1]) {</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *param = arg + sep;</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">if</span> (opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep] == <span class="charliteral">'='</span>)</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  param ++;</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <span class="keywordflow">if</span> (process_opt_param(var, opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a> + sep + 1,</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  param, arg) == -1)</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  *(<span class="keywordtype">int</span> *)var = opt-><a class="code" href="structfuse__opt.html#aeb76339e1ce6948ad94bd2d4d5d01e20">value</a>;</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  }</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> }</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span> </div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt_sep_arg(<span class="keyword">struct</span> fuse_opt_context *ctx,</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt, <span class="keywordtype">unsigned</span> sep,</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span> {</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  <span class="keywordtype">char</span> *newarg;</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  <span class="keywordtype">char</span> *param;</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span> </div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordflow">if</span> (next_arg(ctx, arg) == -1)</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span> </div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  param = ctx->argv[ctx->argctr];</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  newarg = malloc(sep + strlen(param) + 1);</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <span class="keywordflow">if</span> (!newarg)</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  memcpy(newarg, arg, sep);</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  strcpy(newarg + sep, param);</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  res = process_opt(ctx, opt, sep, newarg, iso);</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  free(newarg);</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> </div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span> }</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span> </div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_gopt(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span> {</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <span class="keywordtype">unsigned</span> sep;</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__opt.html">fuse_opt</a> *opt = find_opt(ctx->opt, arg, &sep);</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  <span class="keywordflow">if</span> (opt) {</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <span class="keywordflow">for</span> (; opt; opt = find_opt(opt + 1, arg, &sep)) {</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keywordflow">if</span> (sep && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep] == <span class="charliteral">' '</span> && !arg[sep])</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  res = process_opt_sep_arg(ctx, opt, sep, arg,</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  iso);</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  res = process_opt(ctx, opt, sep, arg, iso);</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  }</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">return</span> call_proc(ctx, arg, <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a48cb1aea482de904a848651360117748">FUSE_OPT_KEY_OPT</a>, iso);</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span> }</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> </div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_real_option_group(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keywordtype">char</span> *opts)</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> {</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <span class="keywordtype">char</span> *s = opts;</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <span class="keywordtype">char</span> *d = s;</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <span class="keywordtype">int</span> end = 0;</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span> </div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <span class="keywordflow">while</span> (!end) {</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <span class="keywordflow">if</span> (*s == <span class="charliteral">'\0'</span>)</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  end = 1;</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  <span class="keywordflow">if</span> (*s == <span class="charliteral">','</span> || end) {</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> </div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  *d = <span class="charliteral">'\0'</span>;</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  res = process_gopt(ctx, opts, 1);</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  d = opts;</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  <span class="keywordflow">if</span> (s[0] == <span class="charliteral">'\\'</span> && s[1] != <span class="charliteral">'\0'</span>) {</div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  s++;</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  <span class="keywordflow">if</span> (s[0] >= <span class="charliteral">'0'</span> && s[0] <= <span class="charliteral">'3'</span> &&</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  s[1] >= <span class="charliteral">'0'</span> && s[1] <= <span class="charliteral">'7'</span> &&</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  s[2] >= <span class="charliteral">'0'</span> && s[2] <= <span class="charliteral">'7'</span>) {</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  *d++ = (s[0] - <span class="charliteral">'0'</span>) * 0100 +</div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  (s[1] - <span class="charliteral">'0'</span>) * 0010 +</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  (s[2] - <span class="charliteral">'0'</span>);</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  s += 2;</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  *d++ = *s;</div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  }</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  *d++ = *s;</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  }</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  }</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  s++;</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  }</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span> </div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> }</div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span> </div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_option_group(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opts)</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span> {</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keywordtype">char</span> *copy = strdup(opts);</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span> </div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keywordflow">if</span> (!copy) {</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  fprintf(stderr, <span class="stringliteral">"fuse: memory allocation failed\n"</span>);</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  }</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  res = process_real_option_group(ctx, copy);</div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  free(copy);</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> }</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span> </div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_one(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span> {</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  <span class="keywordflow">if</span> (ctx->nonopt || arg[0] != <span class="charliteral">'-'</span>)</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <span class="keywordflow">return</span> call_proc(ctx, arg, <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a632b025441794a4e6fe59b7ab53bbfc4">FUSE_OPT_KEY_NONOPT</a>, 0);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg[1] == <span class="charliteral">'o'</span>) {</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  <span class="keywordflow">if</span> (arg[2])</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  <span class="keywordflow">return</span> process_option_group(ctx, arg + 2);</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="keywordflow">else</span> {</div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  <span class="keywordflow">if</span> (next_arg(ctx, arg) == -1)</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> </div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <span class="keywordflow">return</span> process_option_group(ctx,</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  ctx->argv[ctx->argctr]);</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  }</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg[1] == <span class="charliteral">'-'</span> && !arg[2]) {</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">if</span> (add_arg(ctx, arg) == -1)</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  ctx->nonopt = ctx->outargs.argc;</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <span class="keywordflow">return</span> process_gopt(ctx, arg, 0);</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span> }</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span> </div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span> <span class="keyword">static</span> <span class="keywordtype">int</span> opt_parse(<span class="keyword">struct</span> fuse_opt_context *ctx)</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> {</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <span class="keywordflow">if</span> (ctx->argc) {</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <span class="keywordflow">if</span> (add_arg(ctx, ctx->argv[0]) == -1)</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  }</div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span> </div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="keywordflow">for</span> (ctx->argctr = 1; ctx->argctr < ctx->argc; ctx->argctr++)</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  <span class="keywordflow">if</span> (process_one(ctx, ctx->argv[ctx->argctr]) == -1)</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span> </div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  <span class="keywordflow">if</span> (ctx->opts) {</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(&ctx->outargs, 1, <span class="stringliteral">"-o"</span>) == -1 ||</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(&ctx->outargs, 2, ctx->opts) == -1)</div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  }</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> </div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <span class="comment">/* If option separator ("--") is the last argument, remove it */</span></div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keywordflow">if</span> (ctx->nonopt && ctx->nonopt == ctx->outargs.argc &&</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  strcmp(ctx->outargs.argv[ctx->outargs.argc - 1], <span class="stringliteral">"--"</span>) == 0) {</div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  free(ctx->outargs.argv[ctx->outargs.argc - 1]);</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  ctx->outargs.argv[--ctx->outargs.argc] = NULL;</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  }</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span> </div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span> }</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span> </div><div class="line"><a name="l00397"></a><span class="lineno"><a class="line" href="include_2fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e"> 397</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e">fuse_opt_parse</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">void</span> *data,</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> opts[], <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a3d2ab809528d409b0ee91cee400c07c2">fuse_opt_proc_t</a> proc)</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> {</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="keyword">struct </span>fuse_opt_context ctx = {</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  .data = data,</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  .opt = opts,</div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  .proc = proc,</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  };</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span> </div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="keywordflow">if</span> (!args || !args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> || !args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>)</div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span> </div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  ctx.argc = args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>;</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  ctx.argv = args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>;</div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span> </div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  res = opt_parse(&ctx);</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordflow">if</span> (res != -1) {</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  <span class="keyword">struct </span><a class="code" href="structfuse__args.html">fuse_args</a> tmp = *args;</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  *args = ctx.outargs;</div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  ctx.outargs = tmp;</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  }</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  free(ctx.opts);</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(&ctx.outargs);</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span> }</div><div class="ttc" id="fuse-3_86_80_2include_2fuse__opt_8h_html_a8533ff341f910c1bd05f10c8fcc35a04"><div class="ttname"><a href="fuse-3_86_80_2include_2fuse__opt_8h.html#a8533ff341f910c1bd05f10c8fcc35a04">FUSE_OPT_KEY_KEEP</a></div><div class="ttdeci">#define FUSE_OPT_KEY_KEEP</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__opt_8h_source.html#l00145">fuse_opt.h:145</a></div></div> fuse3-3.10.0/doc/html/fuse-3_86_80_2lib_2fuse__opt_8c_source.html-49-<div class="ttc" id="structfuse__args_html_a501883d1eababa08e05b0c802b31e11d"><div class="ttname"><a href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">fuse_args::argc</a></div><div class="ttdeci">int argc</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__opt_8h_source.html#l00111">fuse_opt.h:111</a></div></div> ############################################## fuse3-3.10.0/doc/html/fuse-3_86_80_2lib_2fuse__lowlevel_8c_source.html-47-<div class="contents"> fuse3-3.10.0/doc/html/fuse-3_86_80_2lib_2fuse__lowlevel_8c_source.html:48:<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> FUSE: Filesystem in Userspace</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> Implementation of (most of) the low-level FUSE API. The session loop</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> functions are implemented in separate files.</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> This program can be distributed under the terms of the GNU LGPLv2.</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> See the file COPYING.LIB</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">*/</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#define _GNU_SOURCE</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "config.h"</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include "fuse_i.h"</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include "fuse_kernel.h"</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include "fuse_opt.h"</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include "fuse_misc.h"</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include "mount_util.h"</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <stdio.h></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include <stddef.h></span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <unistd.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <limits.h></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <errno.h></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <assert.h></span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include <sys/file.h></span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#ifndef F_LINUX_SPECIFIC_BASE</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#define F_LINUX_SPECIFIC_BASE 1024</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#ifndef F_SETPIPE_SZ</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#define PARAM(inarg) (((char *)(inarg)) + sizeof(*(inarg)))</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor">#define OFFSET_MAX 0x7fffffffffffffffLL</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor">#define container_of(ptr, type, member) ({ \</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor"> const typeof( ((type *)0)->member ) *__mptr = (ptr); \</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="preprocessor"> (type *)( (char *)__mptr - offsetof(type,member) );})</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="keyword">struct </span>fuse_pollhandle {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  uint64_t kh;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">struct </span>fuse_session *se;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> };</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> pagesize;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="keyword">static</span> __attribute__((constructor)) <span class="keywordtype">void</span> fuse_ll_init_pagesize(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  pagesize = getpagesize();</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> }</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> </div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_stat(<span class="keyword">const</span> <span class="keyword">struct</span> stat *stbuf, <span class="keyword">struct</span> fuse_attr *attr)</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  attr->ino = stbuf->st_ino;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  attr->mode = stbuf->st_mode;</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  attr->nlink = stbuf->st_nlink;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  attr->uid = stbuf->st_uid;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  attr->gid = stbuf->st_gid;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  attr->rdev = stbuf->st_rdev;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  attr->size = stbuf->st_size;</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  attr->blksize = stbuf->st_blksize;</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  attr->blocks = stbuf->st_blocks;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  attr->atime = stbuf->st_atime;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  attr->mtime = stbuf->st_mtime;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  attr->ctime = stbuf->st_ctime;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  attr->atimensec = ST_ATIM_NSEC(stbuf);</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  attr->mtimensec = ST_MTIM_NSEC(stbuf);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  attr->ctimensec = ST_CTIM_NSEC(stbuf);</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> }</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_attr(<span class="keyword">const</span> <span class="keyword">struct</span> fuse_setattr_in *attr, <span class="keyword">struct</span> stat *stbuf)</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> {</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  stbuf->st_mode = attr->mode;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  stbuf->st_uid = attr->uid;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  stbuf->st_gid = attr->gid;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  stbuf->st_size = attr->size;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  stbuf->st_atime = attr->atime;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  stbuf->st_mtime = attr->mtime;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  stbuf->st_ctime = attr->ctime;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  ST_ATIM_NSEC_SET(stbuf, attr->atimensec);</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  ST_MTIM_NSEC_SET(stbuf, attr->mtimensec);</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  ST_CTIM_NSEC_SET(stbuf, attr->ctimensec);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> }</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> iov_length(<span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> {</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordtype">size_t</span> seg;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordtype">size_t</span> ret = 0;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">for</span> (seg = 0; seg < count; seg++)</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  ret += iov[seg].iov_len;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordflow">return</span> ret;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> }</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_init_req(<span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> {</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  req->next = req;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  req->prev = req;</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> }</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> </div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_del_req(<span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> {</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keyword">struct </span>fuse_req *prev = req->prev;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keyword">struct </span>fuse_req *next = req->next;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  prev->next = next;</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  next->prev = prev;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> }</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> </div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_add_req(<span class="keyword">struct</span> fuse_req *req, <span class="keyword">struct</span> fuse_req *next)</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> {</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keyword">struct </span>fuse_req *prev = next->prev;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  req->next = next;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  req->prev = prev;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  prev->next = req;</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  next->prev = req;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> }</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="keyword">static</span> <span class="keywordtype">void</span> destroy_req(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> {</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  pthread_mutex_destroy(&req->lock);</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  free(req);</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> }</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="keywordtype">void</span> fuse_free_req(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> {</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordtype">int</span> ctr;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  req->u.ni.func = NULL;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  req->u.ni.data = NULL;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  list_del_req(req);</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  ctr = --req->ctr;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  fuse_chan_put(req->ch);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  req->ch = NULL;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordflow">if</span> (!ctr)</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  destroy_req(req);</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> }</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_req *fuse_ll_alloc_req(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> {</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keyword">struct </span>fuse_req *req;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  req = (<span class="keyword">struct </span>fuse_req *) calloc(1, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_req));</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">if</span> (req == NULL) {</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate request\n"</span>);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  req->se = se;</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  req->ctr = 1;</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  list_init_req(req);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  fuse_mutex_init(&req->lock);</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">return</span> req;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> }</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> </div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="comment">/* Send data. If *ch* is NULL, send via session master fd */</span></div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_msg(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> {</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="keyword">struct </span>fuse_out_header *out = iov[0].iov_base;</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> </div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  out->len = iov_length(iov, count);</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordflow">if</span> (out->unique == 0) {</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  fprintf(stderr, <span class="stringliteral">"NOTIFY: code=%d length=%u\n"</span>,</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  out->error, out->len);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (out->error) {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  fprintf(stderr,</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="stringliteral">" unique: %llu, error: %i (%s), outsize: %i\n"</span>,</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->error,</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  strerror(-out->error), out->len);</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  fprintf(stderr,</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="stringliteral">" unique: %llu, success, outsize: %i\n"</span>,</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->len);</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  }</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  }</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> </div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  ssize_t res = writev(ch ? ch->fd : se->fd,</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  iov, count);</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="keywordtype">int</span> err = errno;</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> </div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  assert(se != NULL);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="comment">/* ENOENT means the operation was interrupted */</span></div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (!<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se) && err != ENOENT)</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  perror(<span class="stringliteral">"fuse: writing device"</span>);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> }</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> </div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> </div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="keywordtype">int</span> fuse_send_reply_iov_nofree(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> {</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keywordflow">if</span> (error <= -1000 || error > 0) {</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  fprintf(stderr, <span class="stringliteral">"fuse: bad error value: %i\n"</span>, error);</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  error = -ERANGE;</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  }</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span> </div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  out.unique = req->unique;</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  out.error = error;</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> </div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span> </div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="keywordflow">return</span> fuse_send_msg(req->se, req->ch, iov, count);</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> }</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply_iov(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> {</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span> </div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  res = fuse_send_reply_iov_nofree(req, error, iov, count);</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  fuse_free_req(req);</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> }</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span> </div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">const</span> <span class="keywordtype">void</span> *arg,</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="keywordtype">size_t</span> argsize)</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span> {</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keywordtype">int</span> count = 1;</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">if</span> (argsize) {</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  iov[1].iov_base = (<span class="keywordtype">void</span> *) arg;</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  iov[1].iov_len = argsize;</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  count++;</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  }</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <span class="keywordflow">return</span> send_reply_iov(req, error, iov, count);</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span> }</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span> </div><div class="line"><a name="l00246"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a5fbbf591a55f09c02cd54d34bdbfe0e9"> 246</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a5fbbf591a55f09c02cd54d34bdbfe0e9">fuse_reply_iov</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> {</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  <span class="keyword">struct </span>iovec *padded_iov;</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span> </div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  padded_iov = malloc((count + 1) * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <span class="keywordflow">if</span> (padded_iov == NULL)</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span> </div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  memcpy(padded_iov + 1, iov, count * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  count++;</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span> </div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  res = send_reply_iov(req, 0, padded_iov, count);</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  free(padded_iov);</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span> </div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span> }</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span> </div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span> <span class="comment">/* `buf` is allowed to be empty so that the proper size may be</span></div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span> <span class="comment"> allocated by the caller */</span></div><div class="line"><a name="l00267"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ad1957bcc8ece8c90f16c42c4daf3053f"> 267</a></span> <span class="keywordtype">size_t</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1957bcc8ece8c90f16c42c4daf3053f">fuse_add_direntry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> bufsize,</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> <span class="keyword">struct</span> stat *stbuf, off_t off)</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> {</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  (void)req;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <span class="keywordtype">size_t</span> namelen;</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="keywordtype">size_t</span> entlen;</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  <span class="keywordtype">size_t</span> entlen_padded;</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keyword">struct </span>fuse_dirent *dirent;</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span> </div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  namelen = strlen(name);</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  entlen = FUSE_NAME_OFFSET + namelen;</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  entlen_padded = FUSE_DIRENT_ALIGN(entlen);</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span> </div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keywordflow">if</span> ((buf == NULL) || (entlen_padded > bufsize))</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span> </div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  dirent = (<span class="keyword">struct </span>fuse_dirent*) buf;</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  dirent->ino = stbuf->st_ino;</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  dirent->off = off;</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  dirent->namelen = namelen;</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  dirent->type = (stbuf->st_mode & S_IFMT) >> 12;</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  strncpy(dirent->name, name, namelen);</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  memset(dirent->name + namelen, 0, entlen_padded - entlen);</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span> </div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> }</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> </div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_statfs(<span class="keyword">const</span> <span class="keyword">struct</span> statvfs *stbuf,</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <span class="keyword">struct</span> fuse_kstatfs *kstatfs)</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span> {</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  kstatfs->bsize = stbuf->f_bsize;</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  kstatfs->frsize = stbuf->f_frsize;</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  kstatfs->blocks = stbuf->f_blocks;</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  kstatfs->bfree = stbuf->f_bfree;</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  kstatfs->bavail = stbuf->f_bavail;</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  kstatfs->files = stbuf->f_files;</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  kstatfs->ffree = stbuf->f_ffree;</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  kstatfs->namelen = stbuf->f_namemax;</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> }</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span> </div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply_ok(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keywordtype">void</span> *arg, <span class="keywordtype">size_t</span> argsize)</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span> {</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="keywordflow">return</span> send_reply(req, 0, arg, argsize);</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> }</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> </div><div class="line"><a name="l00312"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88"> 312</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> err)</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span> {</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  <span class="keywordflow">return</span> send_reply(req, -err, NULL, 0);</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span> }</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span> </div><div class="line"><a name="l00317"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678"> 317</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span> {</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  fuse_free_req(req);</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span> }</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span> </div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> calc_timeout_sec(<span class="keywordtype">double</span> t)</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span> {</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  <span class="keywordflow">if</span> (t > (<span class="keywordtype">double</span>) ULONG_MAX)</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  <span class="keywordflow">return</span> ULONG_MAX;</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (t < 0.0)</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) t;</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span> }</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> </div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> calc_timeout_nsec(<span class="keywordtype">double</span> t)</div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span> {</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  <span class="keywordtype">double</span> f = t - (double) calc_timeout_sec(t);</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordflow">if</span> (f < 0.0)</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (f >= 0.999999999)</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keywordflow">return</span> 999999999;</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>) (f * 1.0e9);</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span> }</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span> </div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fill_entry(<span class="keyword">struct</span> fuse_entry_out *arg,</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e)</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> {</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  arg->nodeid = e-><a class="code" href="structfuse__entry__param.html#a285ba89754871772d940fa4fb736bce3">ino</a>;</div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  arg->generation = e-><a class="code" href="structfuse__entry__param.html#a4c673ec62c76f7d63d326407beb1b463">generation</a>;</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  arg->entry_valid = calc_timeout_sec(e-><a class="code" href="structfuse__entry__param.html#a281b39b72e7ec574ba40d7341fd22c1d">entry_timeout</a>);</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  arg->entry_valid_nsec = calc_timeout_nsec(e-><a class="code" href="structfuse__entry__param.html#a281b39b72e7ec574ba40d7341fd22c1d">entry_timeout</a>);</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  arg->attr_valid = calc_timeout_sec(e-><a class="code" href="structfuse__entry__param.html#aa797a9f4152cae506ba479af8bbe2eb7">attr_timeout</a>);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  arg->attr_valid_nsec = calc_timeout_nsec(e-><a class="code" href="structfuse__entry__param.html#aa797a9f4152cae506ba479af8bbe2eb7">attr_timeout</a>);</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  convert_stat(&e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>, &arg->attr);</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span> }</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span> </div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span> <span class="comment">/* `buf` is allowed to be empty so that the proper size may be</span></div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span> <span class="comment"> allocated by the caller */</span></div><div class="line"><a name="l00357"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a34f3f1beebacab5f717d95baf832a8a5"> 357</a></span> <span class="keywordtype">size_t</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a34f3f1beebacab5f717d95baf832a8a5">fuse_add_direntry_plus</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> bufsize,</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name,</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e, off_t off)</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span> {</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  (void)req;</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordtype">size_t</span> namelen;</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordtype">size_t</span> entlen;</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  <span class="keywordtype">size_t</span> entlen_padded;</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span> </div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  namelen = strlen(name);</div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  entlen = FUSE_NAME_OFFSET_DIRENTPLUS + namelen;</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  entlen_padded = FUSE_DIRENT_ALIGN(entlen);</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  <span class="keywordflow">if</span> ((buf == NULL) || (entlen_padded > bufsize))</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> </div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <span class="keyword">struct </span>fuse_direntplus *dp = (<span class="keyword">struct </span>fuse_direntplus *) buf;</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  memset(&dp->entry_out, 0, <span class="keyword">sizeof</span>(dp->entry_out));</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  fill_entry(&dp->entry_out, e);</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span> </div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  <span class="keyword">struct </span>fuse_dirent *dirent = &dp->dirent;</div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  dirent->ino = e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>.st_ino;</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  dirent->off = off;</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  dirent->namelen = namelen;</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  dirent->type = (e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>.st_mode & S_IFMT) >> 12;</div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  strncpy(dirent->name, name, namelen);</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  memset(dirent->name + namelen, 0, entlen_padded - entlen);</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span> </div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span> }</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> </div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fill_open(<span class="keyword">struct</span> fuse_open_out *arg,</div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span> {</div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  arg->fh = f-><a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a>;</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a03b59a10e62963d9affa34ad78bd144a">direct_io</a>)</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  arg->open_flags |= FOPEN_DIRECT_IO;</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a23a64eaecbf83f99aba8ee79e6de2780">keep_cache</a>)</div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  arg->open_flags |= FOPEN_KEEP_CACHE;</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#af51d1a8d47e7a9d57b4aa15c11da238d">cache_readdir</a>)</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  arg->open_flags |= FOPEN_CACHE_DIR;</div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a272022c57a6a79dd8f98ef597786e154">nonseekable</a>)</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  arg->open_flags |= FOPEN_NONSEEKABLE;</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> }</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span> </div><div class="line"><a name="l00401"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a672c45e126cd240f4bcd59bf9b7e3708"> 401</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a672c45e126cd240f4bcd59bf9b7e3708">fuse_reply_entry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e)</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span> {</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  <span class="keyword">struct </span>fuse_entry_out arg;</div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  FUSE_COMPAT_ENTRY_OUT_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span> </div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="comment">/* before ABI 7.4 e->ino == 0 was invalid, only ENOENT meant</span></div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span> <span class="comment"> negative entry */</span></div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  <span class="keywordflow">if</span> (!e-><a class="code" href="structfuse__entry__param.html#a285ba89754871772d940fa4fb736bce3">ino</a> && req->se->conn.proto_minor < 4)</div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOENT);</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span> </div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  fill_entry(&arg, e);</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span> }</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span> </div><div class="line"><a name="l00417"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#abea78d22349198f8370d7cb91fbf05ed"> 417</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#abea78d22349198f8370d7cb91fbf05ed">fuse_reply_create</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e,</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span> {</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <span class="keywordtype">char</span> buf[<span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_entry_out) + sizeof(struct fuse_open_out)];</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <span class="keywordtype">size_t</span> entrysize = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  FUSE_COMPAT_ENTRY_OUT_SIZE : <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_entry_out);</div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  <span class="keyword">struct </span>fuse_entry_out *earg = (<span class="keyword">struct </span>fuse_entry_out *) buf;</div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span>  <span class="keyword">struct </span>fuse_open_out *oarg = (<span class="keyword">struct </span>fuse_open_out *) (buf + entrysize);</div><div class="line"><a name="l00425"></a><span class="lineno"> 425</span> </div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  memset(buf, 0, <span class="keyword">sizeof</span>(buf));</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  fill_entry(earg, e);</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  fill_open(oarg, f);</div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  <span class="keywordflow">return</span> send_reply_ok(req, buf,</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  entrysize + <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_open_out));</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span> }</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> </div><div class="line"><a name="l00433"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ad28378dc569019c32acdb4995d70be18"> 433</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad28378dc569019c32acdb4995d70be18">fuse_reply_attr</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> stat *attr,</div><div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  <span class="keywordtype">double</span> attr_timeout)</div><div class="line"><a name="l00435"></a><span class="lineno"> 435</span> {</div><div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  <span class="keyword">struct </span>fuse_attr_out arg;</div><div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  FUSE_COMPAT_ATTR_OUT_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span> </div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  arg.attr_valid = calc_timeout_sec(attr_timeout);</div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  arg.attr_valid_nsec = calc_timeout_nsec(attr_timeout);</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  convert_stat(attr, &arg.attr);</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span> </div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span> }</div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span> </div><div class="line"><a name="l00448"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a5a5872d7f73f0bd593e00788a4c7bbb7"> 448</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a5a5872d7f73f0bd593e00788a4c7bbb7">fuse_reply_readlink</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keywordtype">char</span> *linkname)</div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span> {</div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  <span class="keywordflow">return</span> send_reply_ok(req, linkname, strlen(linkname));</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span> }</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span> </div><div class="line"><a name="l00453"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc"> 453</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span> {</div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span>  <span class="keyword">struct </span>fuse_open_out arg;</div><div class="line"><a name="l00456"></a><span class="lineno"> 456</span> </div><div class="line"><a name="l00457"></a><span class="lineno"> 457</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00458"></a><span class="lineno"> 458</span>  fill_open(&arg, f);</div><div class="line"><a name="l00459"></a><span class="lineno"> 459</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span> }</div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span> </div><div class="line"><a name="l00462"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#aa3cfa73f61d6ef461ab5a3fbf859eb97"> 462</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa3cfa73f61d6ef461ab5a3fbf859eb97">fuse_reply_write</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span> {</div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span>  <span class="keyword">struct </span>fuse_write_out arg;</div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span> </div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  arg.size = count;</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span> </div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00470"></a><span class="lineno"> 470</span> }</div><div class="line"><a name="l00471"></a><span class="lineno"> 471</span> </div><div class="line"><a name="l00472"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a300a88b63ab7c8ca92853a97486448c0"> 472</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a300a88b63ab7c8ca92853a97486448c0">fuse_reply_buf</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__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> size)</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span> {</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span>  <span class="keywordflow">return</span> send_reply_ok(req, buf, size);</div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span> }</div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span> </div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov_fallback(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span>  <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf,</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span>  <span class="keywordtype">size_t</span> len)</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span> {</div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> mem_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span>  <span class="keywordtype">void</span> *mbuf;</div><div class="line"><a name="l00485"></a><span class="lineno"> 485</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00486"></a><span class="lineno"> 486</span> </div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span>  <span class="comment">/* Optimize common case */</span></div><div class="line"><a name="l00488"></a><span class="lineno"> 488</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> == 1 && buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> == 0 && buf-><a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a> == 0 &&</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>  !(buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>)) {</div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span>  <span class="comment">/* FIXME: also avoid memory copy if there are multiple buffers</span></div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span> <span class="comment"> but none of them contain an fd */</span></div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span> </div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span>  iov[iov_count].iov_base = buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>;</div><div class="line"><a name="l00494"></a><span class="lineno"> 494</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00495"></a><span class="lineno"> 495</span>  iov_count++;</div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span>  <span class="keywordflow">return</span> fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00497"></a><span class="lineno"> 497</span>  }</div><div class="line"><a name="l00498"></a><span class="lineno"> 498</span> </div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span>  res = posix_memalign(&mbuf, pagesize, len);</div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span>  <span class="keywordflow">if</span> (res != 0)</div><div class="line"><a name="l00501"></a><span class="lineno"> 501</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span> </div><div class="line"><a name="l00503"></a><span class="lineno"> 503</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l00504"></a><span class="lineno"> 504</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&mem_buf, buf, 0);</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l00506"></a><span class="lineno"> 506</span>  free(mbuf);</div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>  <span class="keywordflow">return</span> -res;</div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span>  }</div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span>  len = res;</div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span> </div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span>  iov[iov_count].iov_base = mbuf;</div><div class="line"><a name="l00512"></a><span class="lineno"> 512</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00513"></a><span class="lineno"> 513</span>  iov_count++;</div><div class="line"><a name="l00514"></a><span class="lineno"> 514</span>  res = fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00515"></a><span class="lineno"> 515</span>  free(mbuf);</div><div class="line"><a name="l00516"></a><span class="lineno"> 516</span> </div><div class="line"><a name="l00517"></a><span class="lineno"> 517</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00518"></a><span class="lineno"> 518</span> }</div><div class="line"><a name="l00519"></a><span class="lineno"> 519</span> </div><div class="line"><a name="l00520"></a><span class="lineno"> 520</span> <span class="keyword">struct </span>fuse_ll_pipe {</div><div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <span class="keywordtype">size_t</span> size;</div><div class="line"><a name="l00522"></a><span class="lineno"> 522</span>  <span class="keywordtype">int</span> can_grow;</div><div class="line"><a name="l00523"></a><span class="lineno"> 523</span>  <span class="keywordtype">int</span> pipe[2];</div><div class="line"><a name="l00524"></a><span class="lineno"> 524</span> };</div><div class="line"><a name="l00525"></a><span class="lineno"> 525</span> </div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_pipe_free(<span class="keyword">struct</span> fuse_ll_pipe *llp)</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span> {</div><div class="line"><a name="l00528"></a><span class="lineno"> 528</span>  close(llp->pipe[0]);</div><div class="line"><a name="l00529"></a><span class="lineno"> 529</span>  close(llp->pipe[1]);</div><div class="line"><a name="l00530"></a><span class="lineno"> 530</span>  free(llp);</div><div class="line"><a name="l00531"></a><span class="lineno"> 531</span> }</div><div class="line"><a name="l00532"></a><span class="lineno"> 532</span> </div><div class="line"><a name="l00533"></a><span class="lineno"> 533</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l00534"></a><span class="lineno"> 534</span> <span class="preprocessor">#if !defined(HAVE_PIPE2) || !defined(O_CLOEXEC)</span></div><div class="line"><a name="l00535"></a><span class="lineno"> 535</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_pipe(<span class="keywordtype">int</span> fds[2])</div><div class="line"><a name="l00536"></a><span class="lineno"> 536</span> {</div><div class="line"><a name="l00537"></a><span class="lineno"> 537</span>  <span class="keywordtype">int</span> rv = pipe(fds);</div><div class="line"><a name="l00538"></a><span class="lineno"> 538</span> </div><div class="line"><a name="l00539"></a><span class="lineno"> 539</span>  <span class="keywordflow">if</span> (rv == -1)</div><div class="line"><a name="l00540"></a><span class="lineno"> 540</span>  <span class="keywordflow">return</span> rv;</div><div class="line"><a name="l00541"></a><span class="lineno"> 541</span> </div><div class="line"><a name="l00542"></a><span class="lineno"> 542</span>  <span class="keywordflow">if</span> (fcntl(fds[0], F_SETFL, O_NONBLOCK) == -1 ||</div><div class="line"><a name="l00543"></a><span class="lineno"> 543</span>  fcntl(fds[1], F_SETFL, O_NONBLOCK) == -1 ||</div><div class="line"><a name="l00544"></a><span class="lineno"> 544</span>  fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 ||</div><div class="line"><a name="l00545"></a><span class="lineno"> 545</span>  fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) {</div><div class="line"><a name="l00546"></a><span class="lineno"> 546</span>  close(fds[0]);</div><div class="line"><a name="l00547"></a><span class="lineno"> 547</span>  close(fds[1]);</div><div class="line"><a name="l00548"></a><span class="lineno"> 548</span>  rv = -1;</div><div class="line"><a name="l00549"></a><span class="lineno"> 549</span>  }</div><div class="line"><a name="l00550"></a><span class="lineno"> 550</span>  <span class="keywordflow">return</span> rv;</div><div class="line"><a name="l00551"></a><span class="lineno"> 551</span> }</div><div class="line"><a name="l00552"></a><span class="lineno"> 552</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00553"></a><span class="lineno"> 553</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_pipe(<span class="keywordtype">int</span> fds[2])</div><div class="line"><a name="l00554"></a><span class="lineno"> 554</span> {</div><div class="line"><a name="l00555"></a><span class="lineno"> 555</span>  <span class="keywordflow">return</span> pipe2(fds, O_CLOEXEC | O_NONBLOCK);</div><div class="line"><a name="l00556"></a><span class="lineno"> 556</span> }</div><div class="line"><a name="l00557"></a><span class="lineno"> 557</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00558"></a><span class="lineno"> 558</span> </div><div class="line"><a name="l00559"></a><span class="lineno"> 559</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_ll_pipe *fuse_ll_get_pipe(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00560"></a><span class="lineno"> 560</span> {</div><div class="line"><a name="l00561"></a><span class="lineno"> 561</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l00562"></a><span class="lineno"> 562</span>  <span class="keywordflow">if</span> (llp == NULL) {</div><div class="line"><a name="l00563"></a><span class="lineno"> 563</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00564"></a><span class="lineno"> 564</span> </div><div class="line"><a name="l00565"></a><span class="lineno"> 565</span>  llp = malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_ll_pipe));</div><div class="line"><a name="l00566"></a><span class="lineno"> 566</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l00567"></a><span class="lineno"> 567</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00568"></a><span class="lineno"> 568</span> </div><div class="line"><a name="l00569"></a><span class="lineno"> 569</span>  res = fuse_pipe(llp->pipe);</div><div class="line"><a name="l00570"></a><span class="lineno"> 570</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00571"></a><span class="lineno"> 571</span>  free(llp);</div><div class="line"><a name="l00572"></a><span class="lineno"> 572</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00573"></a><span class="lineno"> 573</span>  }</div><div class="line"><a name="l00574"></a><span class="lineno"> 574</span> </div><div class="line"><a name="l00575"></a><span class="lineno"> 575</span>  <span class="comment">/*</span></div><div class="line"><a name="l00576"></a><span class="lineno"> 576</span> <span class="comment"> *the default size is 16 pages on linux</span></div><div class="line"><a name="l00577"></a><span class="lineno"> 577</span> <span class="comment"> */</span></div><div class="line"><a name="l00578"></a><span class="lineno"> 578</span>  llp->size = pagesize * 16;</div><div class="line"><a name="l00579"></a><span class="lineno"> 579</span>  llp->can_grow = 1;</div><div class="line"><a name="l00580"></a><span class="lineno"> 580</span> </div><div class="line"><a name="l00581"></a><span class="lineno"> 581</span>  pthread_setspecific(se->pipe_key, llp);</div><div class="line"><a name="l00582"></a><span class="lineno"> 582</span>  }</div><div class="line"><a name="l00583"></a><span class="lineno"> 583</span> </div><div class="line"><a name="l00584"></a><span class="lineno"> 584</span>  <span class="keywordflow">return</span> llp;</div><div class="line"><a name="l00585"></a><span class="lineno"> 585</span> }</div><div class="line"><a name="l00586"></a><span class="lineno"> 586</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00587"></a><span class="lineno"> 587</span> </div><div class="line"><a name="l00588"></a><span class="lineno"> 588</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_clear_pipe(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00589"></a><span class="lineno"> 589</span> {</div><div class="line"><a name="l00590"></a><span class="lineno"> 590</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  <span class="keywordflow">if</span> (llp) {</div><div class="line"><a name="l00592"></a><span class="lineno"> 592</span>  pthread_setspecific(se->pipe_key, NULL);</div><div class="line"><a name="l00593"></a><span class="lineno"> 593</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l00594"></a><span class="lineno"> 594</span>  }</div><div class="line"><a name="l00595"></a><span class="lineno"> 595</span> }</div><div class="line"><a name="l00596"></a><span class="lineno"> 596</span> </div><div class="line"><a name="l00597"></a><span class="lineno"> 597</span> <span class="preprocessor">#if defined(HAVE_SPLICE) && defined(HAVE_VMSPLICE)</span></div><div class="line"><a name="l00598"></a><span class="lineno"> 598</span> <span class="keyword">static</span> <span class="keywordtype">int</span> read_back(<span class="keywordtype">int</span> fd, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> len)</div><div class="line"><a name="l00599"></a><span class="lineno"> 599</span> {</div><div class="line"><a name="l00600"></a><span class="lineno"> 600</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00601"></a><span class="lineno"> 601</span> </div><div class="line"><a name="l00602"></a><span class="lineno"> 602</span>  res = read(fd, buf, len);</div><div class="line"><a name="l00603"></a><span class="lineno"> 603</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  fprintf(stderr, <span class="stringliteral">"fuse: internal error: failed to read back from pipe: %s\n"</span>, strerror(errno));</div><div class="line"><a name="l00605"></a><span class="lineno"> 605</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l00606"></a><span class="lineno"> 606</span>  }</div><div class="line"><a name="l00607"></a><span class="lineno"> 607</span>  <span class="keywordflow">if</span> (res != len) {</div><div class="line"><a name="l00608"></a><span class="lineno"> 608</span>  fprintf(stderr, <span class="stringliteral">"fuse: internal error: short read back from pipe: %i from %zi\n"</span>, res, len);</div><div class="line"><a name="l00609"></a><span class="lineno"> 609</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l00610"></a><span class="lineno"> 610</span>  }</div><div class="line"><a name="l00611"></a><span class="lineno"> 611</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00612"></a><span class="lineno"> 612</span> }</div><div class="line"><a name="l00613"></a><span class="lineno"> 613</span> </div><div class="line"><a name="l00614"></a><span class="lineno"> 614</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00616"></a><span class="lineno"> 616</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags)</div><div class="line"><a name="l00617"></a><span class="lineno"> 617</span> {</div><div class="line"><a name="l00618"></a><span class="lineno"> 618</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00619"></a><span class="lineno"> 619</span>  <span class="keywordtype">size_t</span> len = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(buf);</div><div class="line"><a name="l00620"></a><span class="lineno"> 620</span>  <span class="keyword">struct </span>fuse_out_header *out = iov[0].iov_base;</div><div class="line"><a name="l00621"></a><span class="lineno"> 621</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l00622"></a><span class="lineno"> 622</span>  <span class="keywordtype">int</span> splice_flags;</div><div class="line"><a name="l00623"></a><span class="lineno"> 623</span>  <span class="keywordtype">size_t</span> pipesize;</div><div class="line"><a name="l00624"></a><span class="lineno"> 624</span>  <span class="keywordtype">size_t</span> total_fd_size;</div><div class="line"><a name="l00625"></a><span class="lineno"> 625</span>  <span class="keywordtype">size_t</span> idx;</div><div class="line"><a name="l00626"></a><span class="lineno"> 626</span>  <span class="keywordtype">size_t</span> headerlen;</div><div class="line"><a name="l00627"></a><span class="lineno"> 627</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> pipe_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00628"></a><span class="lineno"> 628</span> </div><div class="line"><a name="l00629"></a><span class="lineno"> 629</span>  <span class="keywordflow">if</span> (se->broken_splice_nonblock)</div><div class="line"><a name="l00630"></a><span class="lineno"> 630</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00631"></a><span class="lineno"> 631</span> </div><div class="line"><a name="l00632"></a><span class="lineno"> 632</span>  <span class="keywordflow">if</span> (flags & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18adcef8052c48f314d4d9f9f05a5b4f838">FUSE_BUF_NO_SPLICE</a>)</div><div class="line"><a name="l00633"></a><span class="lineno"> 633</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00634"></a><span class="lineno"> 634</span> </div><div class="line"><a name="l00635"></a><span class="lineno"> 635</span>  total_fd_size = 0;</div><div class="line"><a name="l00636"></a><span class="lineno"> 636</span>  <span class="keywordflow">for</span> (idx = buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>; idx < buf->count; idx++) {</div><div class="line"><a name="l00637"></a><span class="lineno"> 637</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[idx].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>) {</div><div class="line"><a name="l00638"></a><span class="lineno"> 638</span>  total_fd_size = buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>;</div><div class="line"><a name="l00639"></a><span class="lineno"> 639</span>  <span class="keywordflow">if</span> (idx == buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>)</div><div class="line"><a name="l00640"></a><span class="lineno"> 640</span>  total_fd_size -= buf-><a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a>;</div><div class="line"><a name="l00641"></a><span class="lineno"> 641</span>  }</div><div class="line"><a name="l00642"></a><span class="lineno"> 642</span>  }</div><div class="line"><a name="l00643"></a><span class="lineno"> 643</span>  <span class="keywordflow">if</span> (total_fd_size < 2 * pagesize)</div><div class="line"><a name="l00644"></a><span class="lineno"> 644</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00645"></a><span class="lineno"> 645</span> </div><div class="line"><a name="l00646"></a><span class="lineno"> 646</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 14 ||</div><div class="line"><a name="l00647"></a><span class="lineno"> 647</span>  !(se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4f8815e0f48c60c3d9cd6e72be5a84e4">FUSE_CAP_SPLICE_WRITE</a>))</div><div class="line"><a name="l00648"></a><span class="lineno"> 648</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00649"></a><span class="lineno"> 649</span> </div><div class="line"><a name="l00650"></a><span class="lineno"> 650</span>  llp = fuse_ll_get_pipe(se);</div><div class="line"><a name="l00651"></a><span class="lineno"> 651</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l00652"></a><span class="lineno"> 652</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00653"></a><span class="lineno"> 653</span> </div><div class="line"><a name="l00654"></a><span class="lineno"> 654</span> </div><div class="line"><a name="l00655"></a><span class="lineno"> 655</span>  headerlen = iov_length(iov, iov_count);</div><div class="line"><a name="l00656"></a><span class="lineno"> 656</span> </div><div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  out->len = headerlen + len;</div><div class="line"><a name="l00658"></a><span class="lineno"> 658</span> </div><div class="line"><a name="l00659"></a><span class="lineno"> 659</span>  <span class="comment">/*</span></div><div class="line"><a name="l00660"></a><span class="lineno"> 660</span> <span class="comment"> * Heuristic for the required pipe size, does not work if the</span></div><div class="line"><a name="l00661"></a><span class="lineno"> 661</span> <span class="comment"> * source contains less than page size fragments</span></div><div class="line"><a name="l00662"></a><span class="lineno"> 662</span> <span class="comment"> */</span></div><div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  pipesize = pagesize * (iov_count + buf-><a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> + 1) + out->len;</div><div class="line"><a name="l00664"></a><span class="lineno"> 664</span> </div><div class="line"><a name="l00665"></a><span class="lineno"> 665</span>  if (llp->size < pipesize) {</div><div class="line"><a name="l00666"></a><span class="lineno"> 666</span>  <span class="keywordflow">if</span> (llp->can_grow) {</div><div class="line"><a name="l00667"></a><span class="lineno"> 667</span>  res = fcntl(llp->pipe[0], F_SETPIPE_SZ, pipesize);</div><div class="line"><a name="l00668"></a><span class="lineno"> 668</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00669"></a><span class="lineno"> 669</span>  llp->can_grow = 0;</div><div class="line"><a name="l00670"></a><span class="lineno"> 670</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00671"></a><span class="lineno"> 671</span>  }</div><div class="line"><a name="l00672"></a><span class="lineno"> 672</span>  llp->size = res;</div><div class="line"><a name="l00673"></a><span class="lineno"> 673</span>  }</div><div class="line"><a name="l00674"></a><span class="lineno"> 674</span>  <span class="keywordflow">if</span> (llp->size < pipesize)</div><div class="line"><a name="l00675"></a><span class="lineno"> 675</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00676"></a><span class="lineno"> 676</span>  }</div><div class="line"><a name="l00677"></a><span class="lineno"> 677</span> </div><div class="line"><a name="l00678"></a><span class="lineno"> 678</span> </div><div class="line"><a name="l00679"></a><span class="lineno"> 679</span>  res = vmsplice(llp->pipe[1], iov, iov_count, SPLICE_F_NONBLOCK);</div><div class="line"><a name="l00680"></a><span class="lineno"> 680</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00681"></a><span class="lineno"> 681</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00682"></a><span class="lineno"> 682</span> </div><div class="line"><a name="l00683"></a><span class="lineno"> 683</span>  <span class="keywordflow">if</span> (res != headerlen) {</div><div class="line"><a name="l00684"></a><span class="lineno"> 684</span>  res = -EIO;</div><div class="line"><a name="l00685"></a><span class="lineno"> 685</span>  fprintf(stderr, <span class="stringliteral">"fuse: short vmsplice to pipe: %u/%zu\n"</span>, res,</div><div class="line"><a name="l00686"></a><span class="lineno"> 686</span>  headerlen);</div><div class="line"><a name="l00687"></a><span class="lineno"> 687</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00688"></a><span class="lineno"> 688</span>  }</div><div class="line"><a name="l00689"></a><span class="lineno"> 689</span> </div><div class="line"><a name="l00690"></a><span class="lineno"> 690</span>  pipe_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>;</div><div class="line"><a name="l00691"></a><span class="lineno"> 691</span>  pipe_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a62b2ae82904ac4355142984b9dd90d68">fd</a> = llp->pipe[1];</div><div class="line"><a name="l00692"></a><span class="lineno"> 692</span> </div><div class="line"><a name="l00693"></a><span class="lineno"> 693</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&pipe_buf, buf,</div><div class="line"><a name="l00694"></a><span class="lineno"> 694</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18a375767de945f5178e8949d284abf1f5b">FUSE_BUF_FORCE_SPLICE</a> | <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18a32ec833f1eb4b5cd9283cf9d93021037">FUSE_BUF_SPLICE_NONBLOCK</a>);</div><div class="line"><a name="l00695"></a><span class="lineno"> 695</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l00696"></a><span class="lineno"> 696</span>  <span class="keywordflow">if</span> (res == -EAGAIN || res == -EINVAL) {</div><div class="line"><a name="l00697"></a><span class="lineno"> 697</span>  <span class="comment">/*</span></div><div class="line"><a name="l00698"></a><span class="lineno"> 698</span> <span class="comment"> * Should only get EAGAIN on kernels with</span></div><div class="line"><a name="l00699"></a><span class="lineno"> 699</span> <span class="comment"> * broken SPLICE_F_NONBLOCK support (<=</span></div><div class="line"><a name="l00700"></a><span class="lineno"> 700</span> <span class="comment"> * 2.6.35) where this error or a short read is</span></div><div class="line"><a name="l00701"></a><span class="lineno"> 701</span> <span class="comment"> * returned even if the pipe itself is not</span></div><div class="line"><a name="l00702"></a><span class="lineno"> 702</span> <span class="comment"> * full</span></div><div class="line"><a name="l00703"></a><span class="lineno"> 703</span> <span class="comment"> *</span></div><div class="line"><a name="l00704"></a><span class="lineno"> 704</span> <span class="comment"> * EINVAL might mean that splice can't handle</span></div><div class="line"><a name="l00705"></a><span class="lineno"> 705</span> <span class="comment"> * this combination of input and output.</span></div><div class="line"><a name="l00706"></a><span class="lineno"> 706</span> <span class="comment"> */</span></div><div class="line"><a name="l00707"></a><span class="lineno"> 707</span>  <span class="keywordflow">if</span> (res == -EAGAIN)</div><div class="line"><a name="l00708"></a><span class="lineno"> 708</span>  se->broken_splice_nonblock = 1;</div><div class="line"><a name="l00709"></a><span class="lineno"> 709</span> </div><div class="line"><a name="l00710"></a><span class="lineno"> 710</span>  pthread_setspecific(se->pipe_key, NULL);</div><div class="line"><a name="l00711"></a><span class="lineno"> 711</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l00712"></a><span class="lineno"> 712</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00713"></a><span class="lineno"> 713</span>  }</div><div class="line"><a name="l00714"></a><span class="lineno"> 714</span>  res = -res;</div><div class="line"><a name="l00715"></a><span class="lineno"> 715</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00716"></a><span class="lineno"> 716</span>  }</div><div class="line"><a name="l00717"></a><span class="lineno"> 717</span> </div><div class="line"><a name="l00718"></a><span class="lineno"> 718</span>  <span class="keywordflow">if</span> (res != 0 && res < len) {</div><div class="line"><a name="l00719"></a><span class="lineno"> 719</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> mem_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00720"></a><span class="lineno"> 720</span>  <span class="keywordtype">void</span> *mbuf;</div><div class="line"><a name="l00721"></a><span class="lineno"> 721</span>  <span class="keywordtype">size_t</span> now_len = res;</div><div class="line"><a name="l00722"></a><span class="lineno"> 722</span>  <span class="comment">/*</span></div><div class="line"><a name="l00723"></a><span class="lineno"> 723</span> <span class="comment"> * For regular files a short count is either</span></div><div class="line"><a name="l00724"></a><span class="lineno"> 724</span> <span class="comment"> * 1) due to EOF, or</span></div><div class="line"><a name="l00725"></a><span class="lineno"> 725</span> <span class="comment"> * 2) because of broken SPLICE_F_NONBLOCK (see above)</span></div><div class="line"><a name="l00726"></a><span class="lineno"> 726</span> <span class="comment"> *</span></div><div class="line"><a name="l00727"></a><span class="lineno"> 727</span> <span class="comment"> * For other inputs it's possible that we overflowed</span></div><div class="line"><a name="l00728"></a><span class="lineno"> 728</span> <span class="comment"> * the pipe because of small buffer fragments.</span></div><div class="line"><a name="l00729"></a><span class="lineno"> 729</span> <span class="comment"> */</span></div><div class="line"><a name="l00730"></a><span class="lineno"> 730</span> </div><div class="line"><a name="l00731"></a><span class="lineno"> 731</span>  res = posix_memalign(&mbuf, pagesize, len);</div><div class="line"><a name="l00732"></a><span class="lineno"> 732</span>  <span class="keywordflow">if</span> (res != 0)</div><div class="line"><a name="l00733"></a><span class="lineno"> 733</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00734"></a><span class="lineno"> 734</span> </div><div class="line"><a name="l00735"></a><span class="lineno"> 735</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l00736"></a><span class="lineno"> 736</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a> = now_len;</div><div class="line"><a name="l00737"></a><span class="lineno"> 737</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&mem_buf, buf, 0);</div><div class="line"><a name="l00738"></a><span class="lineno"> 738</span>  <span class="keywordflow">if</span> (res > 0) {</div><div class="line"><a name="l00739"></a><span class="lineno"> 739</span>  <span class="keywordtype">char</span> *tmpbuf;</div><div class="line"><a name="l00740"></a><span class="lineno"> 740</span>  <span class="keywordtype">size_t</span> extra_len = res;</div><div class="line"><a name="l00741"></a><span class="lineno"> 741</span>  <span class="comment">/*</span></div><div class="line"><a name="l00742"></a><span class="lineno"> 742</span> <span class="comment"> * Trickiest case: got more data. Need to get</span></div><div class="line"><a name="l00743"></a><span class="lineno"> 743</span> <span class="comment"> * back the data from the pipe and then fall</span></div><div class="line"><a name="l00744"></a><span class="lineno"> 744</span> <span class="comment"> * back to regular write.</span></div><div class="line"><a name="l00745"></a><span class="lineno"> 745</span> <span class="comment"> */</span></div><div class="line"><a name="l00746"></a><span class="lineno"> 746</span>  tmpbuf = malloc(headerlen);</div><div class="line"><a name="l00747"></a><span class="lineno"> 747</span>  <span class="keywordflow">if</span> (tmpbuf == NULL) {</div><div class="line"><a name="l00748"></a><span class="lineno"> 748</span>  free(mbuf);</div><div class="line"><a name="l00749"></a><span class="lineno"> 749</span>  res = ENOMEM;</div><div class="line"><a name="l00750"></a><span class="lineno"> 750</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00751"></a><span class="lineno"> 751</span>  }</div><div class="line"><a name="l00752"></a><span class="lineno"> 752</span>  res = read_back(llp->pipe[0], tmpbuf, headerlen);</div><div class="line"><a name="l00753"></a><span class="lineno"> 753</span>  free(tmpbuf);</div><div class="line"><a name="l00754"></a><span class="lineno"> 754</span>  <span class="keywordflow">if</span> (res != 0) {</div><div class="line"><a name="l00755"></a><span class="lineno"> 755</span>  free(mbuf);</div><div class="line"><a name="l00756"></a><span class="lineno"> 756</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00757"></a><span class="lineno"> 757</span>  }</div><div class="line"><a name="l00758"></a><span class="lineno"> 758</span>  res = read_back(llp->pipe[0], mbuf, now_len);</div><div class="line"><a name="l00759"></a><span class="lineno"> 759</span>  <span class="keywordflow">if</span> (res != 0) {</div><div class="line"><a name="l00760"></a><span class="lineno"> 760</span>  free(mbuf);</div><div class="line"><a name="l00761"></a><span class="lineno"> 761</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00762"></a><span class="lineno"> 762</span>  }</div><div class="line"><a name="l00763"></a><span class="lineno"> 763</span>  len = now_len + extra_len;</div><div class="line"><a name="l00764"></a><span class="lineno"> 764</span>  iov[iov_count].iov_base = mbuf;</div><div class="line"><a name="l00765"></a><span class="lineno"> 765</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00766"></a><span class="lineno"> 766</span>  iov_count++;</div><div class="line"><a name="l00767"></a><span class="lineno"> 767</span>  res = fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00768"></a><span class="lineno"> 768</span>  free(mbuf);</div><div class="line"><a name="l00769"></a><span class="lineno"> 769</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00770"></a><span class="lineno"> 770</span>  }</div><div class="line"><a name="l00771"></a><span class="lineno"> 771</span>  free(mbuf);</div><div class="line"><a name="l00772"></a><span class="lineno"> 772</span>  res = now_len;</div><div class="line"><a name="l00773"></a><span class="lineno"> 773</span>  }</div><div class="line"><a name="l00774"></a><span class="lineno"> 774</span>  len = res;</div><div class="line"><a name="l00775"></a><span class="lineno"> 775</span>  out->len = headerlen + len;</div><div class="line"><a name="l00776"></a><span class="lineno"> 776</span> </div><div class="line"><a name="l00777"></a><span class="lineno"> 777</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l00778"></a><span class="lineno"> 778</span>  fprintf(stderr,</div><div class="line"><a name="l00779"></a><span class="lineno"> 779</span>  <span class="stringliteral">" unique: %llu, success, outsize: %i (splice)\n"</span>,</div><div class="line"><a name="l00780"></a><span class="lineno"> 780</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->len);</div><div class="line"><a name="l00781"></a><span class="lineno"> 781</span>  }</div><div class="line"><a name="l00782"></a><span class="lineno"> 782</span> </div><div class="line"><a name="l00783"></a><span class="lineno"> 783</span>  splice_flags = 0;</div><div class="line"><a name="l00784"></a><span class="lineno"> 784</span>  <span class="keywordflow">if</span> ((flags & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18af239e556066a5d73b3ff542216b157b9">FUSE_BUF_SPLICE_MOVE</a>) &&</div><div class="line"><a name="l00785"></a><span class="lineno"> 785</span>  (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aef5da823dc5f202bbe033c7a5a3de9c4">FUSE_CAP_SPLICE_MOVE</a>))</div><div class="line"><a name="l00786"></a><span class="lineno"> 786</span>  splice_flags |= SPLICE_F_MOVE;</div><div class="line"><a name="l00787"></a><span class="lineno"> 787</span> </div><div class="line"><a name="l00788"></a><span class="lineno"> 788</span>  res = splice(llp->pipe[0], NULL, ch ? ch->fd : se->fd,</div><div class="line"><a name="l00789"></a><span class="lineno"> 789</span>  NULL, out->len, splice_flags);</div><div class="line"><a name="l00790"></a><span class="lineno"> 790</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00791"></a><span class="lineno"> 791</span>  res = -errno;</div><div class="line"><a name="l00792"></a><span class="lineno"> 792</span>  perror(<span class="stringliteral">"fuse: splice from pipe"</span>);</div><div class="line"><a name="l00793"></a><span class="lineno"> 793</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00794"></a><span class="lineno"> 794</span>  }</div><div class="line"><a name="l00795"></a><span class="lineno"> 795</span>  <span class="keywordflow">if</span> (res != out->len) {</div><div class="line"><a name="l00796"></a><span class="lineno"> 796</span>  res = -EIO;</div><div class="line"><a name="l00797"></a><span class="lineno"> 797</span>  fprintf(stderr, <span class="stringliteral">"fuse: short splice from pipe: %u/%u\n"</span>,</div><div class="line"><a name="l00798"></a><span class="lineno"> 798</span>  res, out->len);</div><div class="line"><a name="l00799"></a><span class="lineno"> 799</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00800"></a><span class="lineno"> 800</span>  }</div><div class="line"><a name="l00801"></a><span class="lineno"> 801</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00802"></a><span class="lineno"> 802</span> </div><div class="line"><a name="l00803"></a><span class="lineno"> 803</span> clear_pipe:</div><div class="line"><a name="l00804"></a><span class="lineno"> 804</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l00805"></a><span class="lineno"> 805</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00806"></a><span class="lineno"> 806</span> </div><div class="line"><a name="l00807"></a><span class="lineno"> 807</span> fallback:</div><div class="line"><a name="l00808"></a><span class="lineno"> 808</span>  <span class="keywordflow">return</span> fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);</div><div class="line"><a name="l00809"></a><span class="lineno"> 809</span> }</div><div class="line"><a name="l00810"></a><span class="lineno"> 810</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00811"></a><span class="lineno"> 811</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00812"></a><span class="lineno"> 812</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00813"></a><span class="lineno"> 813</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags)</div><div class="line"><a name="l00814"></a><span class="lineno"> 814</span> {</div><div class="line"><a name="l00815"></a><span class="lineno"> 815</span>  <span class="keywordtype">size_t</span> len = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(buf);</div><div class="line"><a name="l00816"></a><span class="lineno"> 816</span>  (void) flags;</div><div class="line"><a name="l00817"></a><span class="lineno"> 817</span> </div><div class="line"><a name="l00818"></a><span class="lineno"> 818</span>  <span class="keywordflow">return</span> fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);</div><div class="line"><a name="l00819"></a><span class="lineno"> 819</span> }</div><div class="line"><a name="l00820"></a><span class="lineno"> 820</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00821"></a><span class="lineno"> 821</span> </div><div class="line"><a name="l00822"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a1242694fe0fb6e253a88b57795987302"> 822</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1242694fe0fb6e253a88b57795987302">fuse_reply_data</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *bufv,</div><div class="line"><a name="l00823"></a><span class="lineno"> 823</span>  <span class="keyword">enum</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18">fuse_buf_copy_flags</a> flags)</div><div class="line"><a name="l00824"></a><span class="lineno"> 824</span> {</div><div class="line"><a name="l00825"></a><span class="lineno"> 825</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l00826"></a><span class="lineno"> 826</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l00827"></a><span class="lineno"> 827</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00828"></a><span class="lineno"> 828</span> </div><div class="line"><a name="l00829"></a><span class="lineno"> 829</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l00830"></a><span class="lineno"> 830</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l00831"></a><span class="lineno"> 831</span> </div><div class="line"><a name="l00832"></a><span class="lineno"> 832</span>  out.unique = req->unique;</div><div class="line"><a name="l00833"></a><span class="lineno"> 833</span>  out.error = 0;</div><div class="line"><a name="l00834"></a><span class="lineno"> 834</span> </div><div class="line"><a name="l00835"></a><span class="lineno"> 835</span>  res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv, flags);</div><div class="line"><a name="l00836"></a><span class="lineno"> 836</span>  <span class="keywordflow">if</span> (res <= 0) {</div><div class="line"><a name="l00837"></a><span class="lineno"> 837</span>  fuse_free_req(req);</div><div class="line"><a name="l00838"></a><span class="lineno"> 838</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00839"></a><span class="lineno"> 839</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00840"></a><span class="lineno"> 840</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, res);</div><div class="line"><a name="l00841"></a><span class="lineno"> 841</span>  }</div><div class="line"><a name="l00842"></a><span class="lineno"> 842</span> }</div><div class="line"><a name="l00843"></a><span class="lineno"> 843</span> </div><div class="line"><a name="l00844"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#aa1d95ec3ca674253baac3639ea10f0ff"> 844</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa1d95ec3ca674253baac3639ea10f0ff">fuse_reply_statfs</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> statvfs *stbuf)</div><div class="line"><a name="l00845"></a><span class="lineno"> 845</span> {</div><div class="line"><a name="l00846"></a><span class="lineno"> 846</span>  <span class="keyword">struct </span>fuse_statfs_out arg;</div><div class="line"><a name="l00847"></a><span class="lineno"> 847</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 4 ?</div><div class="line"><a name="l00848"></a><span class="lineno"> 848</span>  FUSE_COMPAT_STATFS_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00849"></a><span class="lineno"> 849</span> </div><div class="line"><a name="l00850"></a><span class="lineno"> 850</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00851"></a><span class="lineno"> 851</span>  convert_statfs(stbuf, &arg.st);</div><div class="line"><a name="l00852"></a><span class="lineno"> 852</span> </div><div class="line"><a name="l00853"></a><span class="lineno"> 853</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00854"></a><span class="lineno"> 854</span> }</div><div class="line"><a name="l00855"></a><span class="lineno"> 855</span> </div><div class="line"><a name="l00856"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#afed32e5d3e1f54d390103f79ebb8bd42"> 856</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#afed32e5d3e1f54d390103f79ebb8bd42">fuse_reply_xattr</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00857"></a><span class="lineno"> 857</span> {</div><div class="line"><a name="l00858"></a><span class="lineno"> 858</span>  <span class="keyword">struct </span>fuse_getxattr_out arg;</div><div class="line"><a name="l00859"></a><span class="lineno"> 859</span> </div><div class="line"><a name="l00860"></a><span class="lineno"> 860</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00861"></a><span class="lineno"> 861</span>  arg.size = count;</div><div class="line"><a name="l00862"></a><span class="lineno"> 862</span> </div><div class="line"><a name="l00863"></a><span class="lineno"> 863</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00864"></a><span class="lineno"> 864</span> }</div><div class="line"><a name="l00865"></a><span class="lineno"> 865</span> </div><div class="line"><a name="l00866"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a135eda9b7d36fb4eaae2de58526d4f85"> 866</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a135eda9b7d36fb4eaae2de58526d4f85">fuse_reply_lock</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> flock *lock)</div><div class="line"><a name="l00867"></a><span class="lineno"> 867</span> {</div><div class="line"><a name="l00868"></a><span class="lineno"> 868</span>  <span class="keyword">struct </span>fuse_lk_out arg;</div><div class="line"><a name="l00869"></a><span class="lineno"> 869</span> </div><div class="line"><a name="l00870"></a><span class="lineno"> 870</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00871"></a><span class="lineno"> 871</span>  arg.lk.type = lock->l_type;</div><div class="line"><a name="l00872"></a><span class="lineno"> 872</span>  <span class="keywordflow">if</span> (lock->l_type != F_UNLCK) {</div><div class="line"><a name="l00873"></a><span class="lineno"> 873</span>  arg.lk.start = lock->l_start;</div><div class="line"><a name="l00874"></a><span class="lineno"> 874</span>  <span class="keywordflow">if</span> (lock->l_len == 0)</div><div class="line"><a name="l00875"></a><span class="lineno"> 875</span>  arg.lk.end = OFFSET_MAX;</div><div class="line"><a name="l00876"></a><span class="lineno"> 876</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00877"></a><span class="lineno"> 877</span>  arg.lk.end = lock->l_start + lock->l_len - 1;</div><div class="line"><a name="l00878"></a><span class="lineno"> 878</span>  }</div><div class="line"><a name="l00879"></a><span class="lineno"> 879</span>  arg.lk.pid = lock->l_pid;</div><div class="line"><a name="l00880"></a><span class="lineno"> 880</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00881"></a><span class="lineno"> 881</span> }</div><div class="line"><a name="l00882"></a><span class="lineno"> 882</span> </div><div class="line"><a name="l00883"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a65431e8196e0533257acad767f7b074f"> 883</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a65431e8196e0533257acad767f7b074f">fuse_reply_bmap</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, uint64_t idx)</div><div class="line"><a name="l00884"></a><span class="lineno"> 884</span> {</div><div class="line"><a name="l00885"></a><span class="lineno"> 885</span>  <span class="keyword">struct </span>fuse_bmap_out arg;</div><div class="line"><a name="l00886"></a><span class="lineno"> 886</span> </div><div class="line"><a name="l00887"></a><span class="lineno"> 887</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00888"></a><span class="lineno"> 888</span>  arg.block = idx;</div><div class="line"><a name="l00889"></a><span class="lineno"> 889</span> </div><div class="line"><a name="l00890"></a><span class="lineno"> 890</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00891"></a><span class="lineno"> 891</span> }</div><div class="line"><a name="l00892"></a><span class="lineno"> 892</span> </div><div class="line"><a name="l00893"></a><span class="lineno"> 893</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_ioctl_iovec *fuse_ioctl_iovec_copy(<span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00894"></a><span class="lineno"> 894</span>  <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00895"></a><span class="lineno"> 895</span> {</div><div class="line"><a name="l00896"></a><span class="lineno"> 896</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *fiov;</div><div class="line"><a name="l00897"></a><span class="lineno"> 897</span>  <span class="keywordtype">size_t</span> i;</div><div class="line"><a name="l00898"></a><span class="lineno"> 898</span> </div><div class="line"><a name="l00899"></a><span class="lineno"> 899</span>  fiov = malloc(<span class="keyword">sizeof</span>(fiov[0]) * count);</div><div class="line"><a name="l00900"></a><span class="lineno"> 900</span>  <span class="keywordflow">if</span> (!fiov)</div><div class="line"><a name="l00901"></a><span class="lineno"> 901</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00902"></a><span class="lineno"> 902</span> </div><div class="line"><a name="l00903"></a><span class="lineno"> 903</span>  <span class="keywordflow">for</span> (i = 0; i < count; i++) {</div><div class="line"><a name="l00904"></a><span class="lineno"> 904</span>  fiov[i].base = (uintptr_t) iov[i].iov_base;</div><div class="line"><a name="l00905"></a><span class="lineno"> 905</span>  fiov[i].len = iov[i].iov_len;</div><div class="line"><a name="l00906"></a><span class="lineno"> 906</span>  }</div><div class="line"><a name="l00907"></a><span class="lineno"> 907</span> </div><div class="line"><a name="l00908"></a><span class="lineno"> 908</span>  <span class="keywordflow">return</span> fiov;</div><div class="line"><a name="l00909"></a><span class="lineno"> 909</span> }</div><div class="line"><a name="l00910"></a><span class="lineno"> 910</span> </div><div class="line"><a name="l00911"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a940683d07df12c24f56b4363aed90e4d"> 911</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a940683d07df12c24f56b4363aed90e4d">fuse_reply_ioctl_retry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req,</div><div class="line"><a name="l00912"></a><span class="lineno"> 912</span>  <span class="keyword">const</span> <span class="keyword">struct</span> iovec *in_iov, <span class="keywordtype">size_t</span> in_count,</div><div class="line"><a name="l00913"></a><span class="lineno"> 913</span>  <span class="keyword">const</span> <span class="keyword">struct</span> iovec *out_iov, <span class="keywordtype">size_t</span> out_count)</div><div class="line"><a name="l00914"></a><span class="lineno"> 914</span> {</div><div class="line"><a name="l00915"></a><span class="lineno"> 915</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l00916"></a><span class="lineno"> 916</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *in_fiov = NULL;</div><div class="line"><a name="l00917"></a><span class="lineno"> 917</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *out_fiov = NULL;</div><div class="line"><a name="l00918"></a><span class="lineno"> 918</span>  <span class="keyword">struct </span>iovec iov[4];</div><div class="line"><a name="l00919"></a><span class="lineno"> 919</span>  <span class="keywordtype">size_t</span> count = 1;</div><div class="line"><a name="l00920"></a><span class="lineno"> 920</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00921"></a><span class="lineno"> 921</span> </div><div class="line"><a name="l00922"></a><span class="lineno"> 922</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00923"></a><span class="lineno"> 923</span>  arg.flags |= FUSE_IOCTL_RETRY;</div><div class="line"><a name="l00924"></a><span class="lineno"> 924</span>  arg.in_iovs = in_count;</div><div class="line"><a name="l00925"></a><span class="lineno"> 925</span>  arg.out_iovs = out_count;</div><div class="line"><a name="l00926"></a><span class="lineno"> 926</span>  iov[count].iov_base = &arg;</div><div class="line"><a name="l00927"></a><span class="lineno"> 927</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00928"></a><span class="lineno"> 928</span>  count++;</div><div class="line"><a name="l00929"></a><span class="lineno"> 929</span> </div><div class="line"><a name="l00930"></a><span class="lineno"> 930</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor < 16) {</div><div class="line"><a name="l00931"></a><span class="lineno"> 931</span>  <span class="keywordflow">if</span> (in_count) {</div><div class="line"><a name="l00932"></a><span class="lineno"> 932</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)in_iov;</div><div class="line"><a name="l00933"></a><span class="lineno"> 933</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(in_iov[0]) * in_count;</div><div class="line"><a name="l00934"></a><span class="lineno"> 934</span>  count++;</div><div class="line"><a name="l00935"></a><span class="lineno"> 935</span>  }</div><div class="line"><a name="l00936"></a><span class="lineno"> 936</span> </div><div class="line"><a name="l00937"></a><span class="lineno"> 937</span>  <span class="keywordflow">if</span> (out_count) {</div><div class="line"><a name="l00938"></a><span class="lineno"> 938</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)out_iov;</div><div class="line"><a name="l00939"></a><span class="lineno"> 939</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(out_iov[0]) * out_count;</div><div class="line"><a name="l00940"></a><span class="lineno"> 940</span>  count++;</div><div class="line"><a name="l00941"></a><span class="lineno"> 941</span>  }</div><div class="line"><a name="l00942"></a><span class="lineno"> 942</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00943"></a><span class="lineno"> 943</span>  <span class="comment">/* Can't handle non-compat 64bit ioctls on 32bit */</span></div><div class="line"><a name="l00944"></a><span class="lineno"> 944</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span> *) == 4 && req->ioctl_64bit) {</div><div class="line"><a name="l00945"></a><span class="lineno"> 945</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EINVAL);</div><div class="line"><a name="l00946"></a><span class="lineno"> 946</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l00947"></a><span class="lineno"> 947</span>  }</div><div class="line"><a name="l00948"></a><span class="lineno"> 948</span> </div><div class="line"><a name="l00949"></a><span class="lineno"> 949</span>  <span class="keywordflow">if</span> (in_count) {</div><div class="line"><a name="l00950"></a><span class="lineno"> 950</span>  in_fiov = fuse_ioctl_iovec_copy(in_iov, in_count);</div><div class="line"><a name="l00951"></a><span class="lineno"> 951</span>  <span class="keywordflow">if</span> (!in_fiov)</div><div class="line"><a name="l00952"></a><span class="lineno"> 952</span>  <span class="keywordflow">goto</span> enomem;</div><div class="line"><a name="l00953"></a><span class="lineno"> 953</span> </div><div class="line"><a name="l00954"></a><span class="lineno"> 954</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)in_fiov;</div><div class="line"><a name="l00955"></a><span class="lineno"> 955</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(in_fiov[0]) * in_count;</div><div class="line"><a name="l00956"></a><span class="lineno"> 956</span>  count++;</div><div class="line"><a name="l00957"></a><span class="lineno"> 957</span>  }</div><div class="line"><a name="l00958"></a><span class="lineno"> 958</span>  <span class="keywordflow">if</span> (out_count) {</div><div class="line"><a name="l00959"></a><span class="lineno"> 959</span>  out_fiov = fuse_ioctl_iovec_copy(out_iov, out_count);</div><div class="line"><a name="l00960"></a><span class="lineno"> 960</span>  <span class="keywordflow">if</span> (!out_fiov)</div><div class="line"><a name="l00961"></a><span class="lineno"> 961</span>  <span class="keywordflow">goto</span> enomem;</div><div class="line"><a name="l00962"></a><span class="lineno"> 962</span> </div><div class="line"><a name="l00963"></a><span class="lineno"> 963</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)out_fiov;</div><div class="line"><a name="l00964"></a><span class="lineno"> 964</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(out_fiov[0]) * out_count;</div><div class="line"><a name="l00965"></a><span class="lineno"> 965</span>  count++;</div><div class="line"><a name="l00966"></a><span class="lineno"> 966</span>  }</div><div class="line"><a name="l00967"></a><span class="lineno"> 967</span>  }</div><div class="line"><a name="l00968"></a><span class="lineno"> 968</span> </div><div class="line"><a name="l00969"></a><span class="lineno"> 969</span>  res = send_reply_iov(req, 0, iov, count);</div><div class="line"><a name="l00970"></a><span class="lineno"> 970</span> out:</div><div class="line"><a name="l00971"></a><span class="lineno"> 971</span>  free(in_fiov);</div><div class="line"><a name="l00972"></a><span class="lineno"> 972</span>  free(out_fiov);</div><div class="line"><a name="l00973"></a><span class="lineno"> 973</span> </div><div class="line"><a name="l00974"></a><span class="lineno"> 974</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00975"></a><span class="lineno"> 975</span> </div><div class="line"><a name="l00976"></a><span class="lineno"> 976</span> enomem:</div><div class="line"><a name="l00977"></a><span class="lineno"> 977</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l00978"></a><span class="lineno"> 978</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l00979"></a><span class="lineno"> 979</span> }</div><div class="line"><a name="l00980"></a><span class="lineno"> 980</span> </div><div class="line"><a name="l00981"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#adf7f34f470c04f276b7091ad3b3dcb31"> 981</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#adf7f34f470c04f276b7091ad3b3dcb31">fuse_reply_ioctl</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> result, <span class="keyword">const</span> <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> size)</div><div class="line"><a name="l00982"></a><span class="lineno"> 982</span> {</div><div class="line"><a name="l00983"></a><span class="lineno"> 983</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l00984"></a><span class="lineno"> 984</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l00985"></a><span class="lineno"> 985</span>  <span class="keywordtype">size_t</span> count = 1;</div><div class="line"><a name="l00986"></a><span class="lineno"> 986</span> </div><div class="line"><a name="l00987"></a><span class="lineno"> 987</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00988"></a><span class="lineno"> 988</span>  arg.result = result;</div><div class="line"><a name="l00989"></a><span class="lineno"> 989</span>  iov[count].iov_base = &arg;</div><div class="line"><a name="l00990"></a><span class="lineno"> 990</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00991"></a><span class="lineno"> 991</span>  count++;</div><div class="line"><a name="l00992"></a><span class="lineno"> 992</span> </div><div class="line"><a name="l00993"></a><span class="lineno"> 993</span>  <span class="keywordflow">if</span> (size) {</div><div class="line"><a name="l00994"></a><span class="lineno"> 994</span>  iov[count].iov_base = (<span class="keywordtype">char</span> *) buf;</div><div class="line"><a name="l00995"></a><span class="lineno"> 995</span>  iov[count].iov_len = size;</div><div class="line"><a name="l00996"></a><span class="lineno"> 996</span>  count++;</div><div class="line"><a name="l00997"></a><span class="lineno"> 997</span>  }</div><div class="line"><a name="l00998"></a><span class="lineno"> 998</span> </div><div class="line"><a name="l00999"></a><span class="lineno"> 999</span>  <span class="keywordflow">return</span> send_reply_iov(req, 0, iov, count);</div><div class="line"><a name="l01000"></a><span class="lineno"> 1000</span> }</div><div class="line"><a name="l01001"></a><span class="lineno"> 1001</span> </div><div class="line"><a name="l01002"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a37381eb84c39e5fe3af9f3ef507aeeb7"> 1002</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a37381eb84c39e5fe3af9f3ef507aeeb7">fuse_reply_ioctl_iov</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> result, <span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l01004"></a><span class="lineno"> 1004</span> {</div><div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>  <span class="keyword">struct </span>iovec *padded_iov;</div><div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l01008"></a><span class="lineno"> 1008</span> </div><div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>  padded_iov = malloc((count + 2) * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>  <span class="keywordflow">if</span> (padded_iov == NULL)</div><div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l01012"></a><span class="lineno"> 1012</span> </div><div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>  arg.result = result;</div><div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>  padded_iov[1].iov_base = &arg;</div><div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>  padded_iov[1].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l01017"></a><span class="lineno"> 1017</span> </div><div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>  memcpy(&padded_iov[2], iov, count * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l01019"></a><span class="lineno"> 1019</span> </div><div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>  res = send_reply_iov(req, 0, padded_iov, count + 2);</div><div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>  free(padded_iov);</div><div class="line"><a name="l01022"></a><span class="lineno"> 1022</span> </div><div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l01024"></a><span class="lineno"> 1024</span> }</div><div class="line"><a name="l01025"></a><span class="lineno"> 1025</span> </div><div class="line"><a name="l01026"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a2172d260d34c76c25cd601870aee4220"> 1026</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2172d260d34c76c25cd601870aee4220">fuse_reply_poll</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">unsigned</span> revents)</div><div class="line"><a name="l01027"></a><span class="lineno"> 1027</span> {</div><div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>  <span class="keyword">struct </span>fuse_poll_out arg;</div><div class="line"><a name="l01029"></a><span class="lineno"> 1029</span> </div><div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>  arg.revents = revents;</div><div class="line"><a name="l01032"></a><span class="lineno"> 1032</span> </div><div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01034"></a><span class="lineno"> 1034</span> }</div><div class="line"><a name="l01035"></a><span class="lineno"> 1035</span> </div><div class="line"><a name="l01036"></a><span class="lineno"> 1036</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_lookup(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01037"></a><span class="lineno"> 1037</span> {</div><div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01039"></a><span class="lineno"> 1039</span> </div><div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>  <span class="keywordflow">if</span> (req->se->op.lookup)</div><div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>  req->se->op.lookup(req, nodeid, name);</div><div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01044"></a><span class="lineno"> 1044</span> }</div><div class="line"><a name="l01045"></a><span class="lineno"> 1045</span> </div><div class="line"><a name="l01046"></a><span class="lineno"> 1046</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_forget(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01047"></a><span class="lineno"> 1047</span> {</div><div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>  <span class="keyword">struct </span>fuse_forget_in *arg = (<span class="keyword">struct </span>fuse_forget_in *) inarg;</div><div class="line"><a name="l01049"></a><span class="lineno"> 1049</span> </div><div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>  <span class="keywordflow">if</span> (req->se->op.forget)</div><div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>  req->se->op.forget(req, nodeid, arg->nlookup);</div><div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01054"></a><span class="lineno"> 1054</span> }</div><div class="line"><a name="l01055"></a><span class="lineno"> 1055</span> </div><div class="line"><a name="l01056"></a><span class="lineno"> 1056</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_batch_forget(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01058"></a><span class="lineno"> 1058</span> {</div><div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>  <span class="keyword">struct </span>fuse_batch_forget_in *arg = (<span class="keywordtype">void</span> *) inarg;</div><div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>  <span class="keyword">struct </span>fuse_forget_one *param = (<span class="keywordtype">void</span> *) PARAM(arg);</div><div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;</div><div class="line"><a name="l01062"></a><span class="lineno"> 1062</span> </div><div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>  (void) nodeid;</div><div class="line"><a name="l01064"></a><span class="lineno"> 1064</span> </div><div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>  <span class="keywordflow">if</span> (req->se->op.forget_multi) {</div><div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>  req->se->op.forget_multi(req, arg->count,</div><div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>  (<span class="keyword">struct</span> fuse_forget_data *) param);</div><div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (req->se->op.forget) {</div><div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>  <span class="keywordflow">for</span> (i = 0; i < arg->count; i++) {</div><div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>  <span class="keyword">struct </span>fuse_forget_one *forget = &param[i];</div><div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>  <span class="keyword">struct </span>fuse_req *dummy_req;</div><div class="line"><a name="l01072"></a><span class="lineno"> 1072</span> </div><div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>  dummy_req = fuse_ll_alloc_req(req->se);</div><div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>  <span class="keywordflow">if</span> (dummy_req == NULL)</div><div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01076"></a><span class="lineno"> 1076</span> </div><div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>  dummy_req->unique = req->unique;</div><div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>  dummy_req->ctx = req->ctx;</div><div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>  dummy_req->ch = NULL;</div><div class="line"><a name="l01080"></a><span class="lineno"> 1080</span> </div><div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>  req->se->op.forget(dummy_req, forget->nodeid,</div><div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>  forget->nlookup);</div><div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>  }</div><div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>  }</div><div class="line"><a name="l01088"></a><span class="lineno"> 1088</span> }</div><div class="line"><a name="l01089"></a><span class="lineno"> 1089</span> </div><div class="line"><a name="l01090"></a><span class="lineno"> 1090</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01091"></a><span class="lineno"> 1091</span> {</div><div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fip = NULL;</div><div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01094"></a><span class="lineno"> 1094</span> </div><div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 9) {</div><div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>  <span class="keyword">struct </span>fuse_getattr_in *arg = (<span class="keyword">struct </span>fuse_getattr_in *) inarg;</div><div class="line"><a name="l01097"></a><span class="lineno"> 1097</span> </div><div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>  <span class="keywordflow">if</span> (arg->getattr_flags & FUSE_GETATTR_FH) {</div><div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>  fip = &fi;</div><div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>  }</div><div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>  }</div><div class="line"><a name="l01104"></a><span class="lineno"> 1104</span> </div><div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>  <span class="keywordflow">if</span> (req->se->op.getattr)</div><div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>  req->se->op.getattr(req, nodeid, fip);</div><div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01109"></a><span class="lineno"> 1109</span> }</div><div class="line"><a name="l01110"></a><span class="lineno"> 1110</span> </div><div class="line"><a name="l01111"></a><span class="lineno"> 1111</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01112"></a><span class="lineno"> 1112</span> {</div><div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>  <span class="keyword">struct </span>fuse_setattr_in *arg = (<span class="keyword">struct </span>fuse_setattr_in *) inarg;</div><div class="line"><a name="l01114"></a><span class="lineno"> 1114</span> </div><div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>  <span class="keywordflow">if</span> (req->se->op.setattr) {</div><div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fi = NULL;</div><div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi_store;</div><div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>  <span class="keyword">struct </span>stat stbuf;</div><div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>  memset(&stbuf, 0, <span class="keyword">sizeof</span>(stbuf));</div><div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>  convert_attr(arg, &stbuf);</div><div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>  <span class="keywordflow">if</span> (arg->valid & FATTR_FH) {</div><div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>  arg->valid &= ~FATTR_FH;</div><div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>  memset(&fi_store, 0, <span class="keyword">sizeof</span>(fi_store));</div><div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>  fi = &fi_store;</div><div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>  fi-><a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>  }</div><div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>  arg->valid &=</div><div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>  FUSE_SET_ATTR_MODE |</div><div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>  FUSE_SET_ATTR_UID |</div><div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>  FUSE_SET_ATTR_GID |</div><div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>  FUSE_SET_ATTR_SIZE |</div><div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>  FUSE_SET_ATTR_ATIME |</div><div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>  FUSE_SET_ATTR_MTIME |</div><div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>  FUSE_SET_ATTR_ATIME_NOW |</div><div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>  FUSE_SET_ATTR_MTIME_NOW |</div><div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>  FUSE_SET_ATTR_CTIME;</div><div class="line"><a name="l01137"></a><span class="lineno"> 1137</span> </div><div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>  req->se->op.setattr(req, nodeid, &stbuf, arg->valid, fi);</div><div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01141"></a><span class="lineno"> 1141</span> }</div><div class="line"><a name="l01142"></a><span class="lineno"> 1142</span> </div><div class="line"><a name="l01143"></a><span class="lineno"> 1143</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_access(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01144"></a><span class="lineno"> 1144</span> {</div><div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>  <span class="keyword">struct </span>fuse_access_in *arg = (<span class="keyword">struct </span>fuse_access_in *) inarg;</div><div class="line"><a name="l01146"></a><span class="lineno"> 1146</span> </div><div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>  <span class="keywordflow">if</span> (req->se->op.access)</div><div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>  req->se->op.access(req, nodeid, arg->mask);</div><div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01151"></a><span class="lineno"> 1151</span> }</div><div class="line"><a name="l01152"></a><span class="lineno"> 1152</span> </div><div class="line"><a name="l01153"></a><span class="lineno"> 1153</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01154"></a><span class="lineno"> 1154</span> {</div><div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>  (void) inarg;</div><div class="line"><a name="l01156"></a><span class="lineno"> 1156</span> </div><div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>  <span class="keywordflow">if</span> (req->se->op.readlink)</div><div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>  req->se->op.readlink(req, nodeid);</div><div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01161"></a><span class="lineno"> 1161</span> }</div><div class="line"><a name="l01162"></a><span class="lineno"> 1162</span> </div><div class="line"><a name="l01163"></a><span class="lineno"> 1163</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_mknod(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01164"></a><span class="lineno"> 1164</span> {</div><div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>  <span class="keyword">struct </span>fuse_mknod_in *arg = (<span class="keyword">struct </span>fuse_mknod_in *) inarg;</div><div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01167"></a><span class="lineno"> 1167</span> </div><div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>  name = (<span class="keywordtype">char</span> *) inarg + FUSE_COMPAT_MKNOD_IN_SIZE;</div><div class="line"><a name="l01172"></a><span class="lineno"> 1172</span> </div><div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>  <span class="keywordflow">if</span> (req->se->op.mknod)</div><div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>  req->se->op.mknod(req, nodeid, name, arg->mode, arg->rdev);</div><div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01177"></a><span class="lineno"> 1177</span> }</div><div class="line"><a name="l01178"></a><span class="lineno"> 1178</span> </div><div class="line"><a name="l01179"></a><span class="lineno"> 1179</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_mkdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01180"></a><span class="lineno"> 1180</span> {</div><div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>  <span class="keyword">struct </span>fuse_mkdir_in *arg = (<span class="keyword">struct </span>fuse_mkdir_in *) inarg;</div><div class="line"><a name="l01182"></a><span class="lineno"> 1182</span> </div><div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01185"></a><span class="lineno"> 1185</span> </div><div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>  <span class="keywordflow">if</span> (req->se->op.mkdir)</div><div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>  req->se->op.mkdir(req, nodeid, PARAM(arg), arg->mode);</div><div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01190"></a><span class="lineno"> 1190</span> }</div><div class="line"><a name="l01191"></a><span class="lineno"> 1191</span> </div><div class="line"><a name="l01192"></a><span class="lineno"> 1192</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_unlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01193"></a><span class="lineno"> 1193</span> {</div><div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01195"></a><span class="lineno"> 1195</span> </div><div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>  <span class="keywordflow">if</span> (req->se->op.unlink)</div><div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>  req->se->op.unlink(req, nodeid, name);</div><div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01200"></a><span class="lineno"> 1200</span> }</div><div class="line"><a name="l01201"></a><span class="lineno"> 1201</span> </div><div class="line"><a name="l01202"></a><span class="lineno"> 1202</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rmdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01203"></a><span class="lineno"> 1203</span> {</div><div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01205"></a><span class="lineno"> 1205</span> </div><div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>  <span class="keywordflow">if</span> (req->se->op.rmdir)</div><div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>  req->se->op.rmdir(req, nodeid, name);</div><div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01210"></a><span class="lineno"> 1210</span> }</div><div class="line"><a name="l01211"></a><span class="lineno"> 1211</span> </div><div class="line"><a name="l01212"></a><span class="lineno"> 1212</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_symlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01213"></a><span class="lineno"> 1213</span> {</div><div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>  <span class="keywordtype">char</span> *linkname = ((<span class="keywordtype">char</span> *) inarg) + strlen((<span class="keywordtype">char</span> *) inarg) + 1;</div><div class="line"><a name="l01216"></a><span class="lineno"> 1216</span> </div><div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>  <span class="keywordflow">if</span> (req->se->op.symlink)</div><div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>  req->se->op.symlink(req, linkname, nodeid, name);</div><div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01221"></a><span class="lineno"> 1221</span> }</div><div class="line"><a name="l01222"></a><span class="lineno"> 1222</span> </div><div class="line"><a name="l01223"></a><span class="lineno"> 1223</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rename(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01224"></a><span class="lineno"> 1224</span> {</div><div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>  <span class="keyword">struct </span>fuse_rename_in *arg = (<span class="keyword">struct </span>fuse_rename_in *) inarg;</div><div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>  <span class="keywordtype">char</span> *oldname = PARAM(arg);</div><div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>  <span class="keywordtype">char</span> *newname = oldname + strlen(oldname) + 1;</div><div class="line"><a name="l01228"></a><span class="lineno"> 1228</span> </div><div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>  <span class="keywordflow">if</span> (req->se->op.rename)</div><div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>  req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,</div><div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>  0);</div><div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01234"></a><span class="lineno"> 1234</span> }</div><div class="line"><a name="l01235"></a><span class="lineno"> 1235</span> </div><div class="line"><a name="l01236"></a><span class="lineno"> 1236</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rename2(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01237"></a><span class="lineno"> 1237</span> {</div><div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>  <span class="keyword">struct </span>fuse_rename2_in *arg = (<span class="keyword">struct </span>fuse_rename2_in *) inarg;</div><div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>  <span class="keywordtype">char</span> *oldname = PARAM(arg);</div><div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>  <span class="keywordtype">char</span> *newname = oldname + strlen(oldname) + 1;</div><div class="line"><a name="l01241"></a><span class="lineno"> 1241</span> </div><div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>  <span class="keywordflow">if</span> (req->se->op.rename)</div><div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>  req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,</div><div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>  arg->flags);</div><div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01247"></a><span class="lineno"> 1247</span> }</div><div class="line"><a name="l01248"></a><span class="lineno"> 1248</span> </div><div class="line"><a name="l01249"></a><span class="lineno"> 1249</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_link(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01250"></a><span class="lineno"> 1250</span> {</div><div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>  <span class="keyword">struct </span>fuse_link_in *arg = (<span class="keyword">struct </span>fuse_link_in *) inarg;</div><div class="line"><a name="l01252"></a><span class="lineno"> 1252</span> </div><div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>  <span class="keywordflow">if</span> (req->se->op.link)</div><div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>  req->se->op.link(req, arg->oldnodeid, nodeid, PARAM(arg));</div><div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01257"></a><span class="lineno"> 1257</span> }</div><div class="line"><a name="l01258"></a><span class="lineno"> 1258</span> </div><div class="line"><a name="l01259"></a><span class="lineno"> 1259</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_create(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01260"></a><span class="lineno"> 1260</span> {</div><div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>  <span class="keyword">struct </span>fuse_create_in *arg = (<span class="keyword">struct </span>fuse_create_in *) inarg;</div><div class="line"><a name="l01262"></a><span class="lineno"> 1262</span> </div><div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>  <span class="keywordflow">if</span> (req->se->op.create) {</div><div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01266"></a><span class="lineno"> 1266</span> </div><div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01269"></a><span class="lineno"> 1269</span> </div><div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>  name = (<span class="keywordtype">char</span> *) inarg + <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_open_in);</div><div class="line"><a name="l01274"></a><span class="lineno"> 1274</span> </div><div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>  req->se->op.create(req, nodeid, name, arg->mode, &fi);</div><div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01278"></a><span class="lineno"> 1278</span> }</div><div class="line"><a name="l01279"></a><span class="lineno"> 1279</span> </div><div class="line"><a name="l01280"></a><span class="lineno"> 1280</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_open(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01281"></a><span class="lineno"> 1281</span> {</div><div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>  <span class="keyword">struct </span>fuse_open_in *arg = (<span class="keyword">struct </span>fuse_open_in *) inarg;</div><div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01284"></a><span class="lineno"> 1284</span> </div><div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01287"></a><span class="lineno"> 1287</span> </div><div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>  <span class="keywordflow">if</span> (req->se->op.open)</div><div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>  req->se->op.open(req, nodeid, &fi);</div><div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(req, &fi);</div><div class="line"><a name="l01292"></a><span class="lineno"> 1292</span> }</div><div class="line"><a name="l01293"></a><span class="lineno"> 1293</span> </div><div class="line"><a name="l01294"></a><span class="lineno"> 1294</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_read(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01295"></a><span class="lineno"> 1295</span> {</div><div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01297"></a><span class="lineno"> 1297</span> </div><div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>  <span class="keywordflow">if</span> (req->se->op.read) {</div><div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01300"></a><span class="lineno"> 1300</span> </div><div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 9) {</div><div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>  }</div><div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>  req->se->op.read(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01310"></a><span class="lineno"> 1310</span> }</div><div class="line"><a name="l01311"></a><span class="lineno"> 1311</span> </div><div class="line"><a name="l01312"></a><span class="lineno"> 1312</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_write(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01313"></a><span class="lineno"> 1313</span> {</div><div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>  <span class="keyword">struct </span>fuse_write_in *arg = (<span class="keyword">struct </span>fuse_write_in *) inarg;</div><div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>  <span class="keywordtype">char</span> *param;</div><div class="line"><a name="l01317"></a><span class="lineno"> 1317</span> </div><div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>  fi.<a class="code" href="structfuse__file__info.html#a984187caa62aafc15abf9ff621667f3d">writepage</a> = (arg->write_flags & FUSE_WRITE_CACHE) != 0;</div><div class="line"><a name="l01321"></a><span class="lineno"> 1321</span> </div><div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor < 9) {</div><div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>  param = ((<span class="keywordtype">char</span> *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>  param = PARAM(arg);</div><div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>  }</div><div class="line"><a name="l01329"></a><span class="lineno"> 1329</span> </div><div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>  <span class="keywordflow">if</span> (req->se->op.write)</div><div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>  req->se->op.write(req, nodeid, param, arg->size,</div><div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>  arg->offset, &fi);</div><div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01335"></a><span class="lineno"> 1335</span> }</div><div class="line"><a name="l01336"></a><span class="lineno"> 1336</span> </div><div class="line"><a name="l01337"></a><span class="lineno"> 1337</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_write_buf(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg,</div><div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *ibuf)</div><div class="line"><a name="l01339"></a><span class="lineno"> 1339</span> {</div><div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = {</div><div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>  .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *ibuf,</div><div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>  .count = 1,</div><div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>  };</div><div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>  <span class="keyword">struct </span>fuse_write_in *arg = (<span class="keyword">struct </span>fuse_write_in *) inarg;</div><div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01347"></a><span class="lineno"> 1347</span> </div><div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>  fi.<a class="code" href="structfuse__file__info.html#a984187caa62aafc15abf9ff621667f3d">writepage</a> = arg->write_flags & FUSE_WRITE_CACHE;</div><div class="line"><a name="l01351"></a><span class="lineno"> 1351</span> </div><div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 9) {</div><div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = ((<span class="keywordtype">char</span> *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>  FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>  assert(!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>));</div><div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01359"></a><span class="lineno"> 1359</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01360"></a><span class="lineno"> 1360</span>  <span class="keywordflow">if</span> (!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>))</div><div class="line"><a name="l01361"></a><span class="lineno"> 1361</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = PARAM(arg);</div><div class="line"><a name="l01362"></a><span class="lineno"> 1362</span> </div><div class="line"><a name="l01363"></a><span class="lineno"> 1363</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l01364"></a><span class="lineno"> 1364</span>  sizeof(struct fuse_write_in);</div><div class="line"><a name="l01365"></a><span class="lineno"> 1365</span>  }</div><div class="line"><a name="l01366"></a><span class="lineno"> 1366</span>  <span class="keywordflow">if</span> (bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < arg->size) {</div><div class="line"><a name="l01367"></a><span class="lineno"> 1367</span>  fprintf(stderr, <span class="stringliteral">"fuse: do_write_buf: buffer size too small\n"</span>);</div><div class="line"><a name="l01368"></a><span class="lineno"> 1368</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EIO);</div><div class="line"><a name="l01369"></a><span class="lineno"> 1369</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l01370"></a><span class="lineno"> 1370</span>  }</div><div class="line"><a name="l01371"></a><span class="lineno"> 1371</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = arg->size;</div><div class="line"><a name="l01372"></a><span class="lineno"> 1372</span> </div><div class="line"><a name="l01373"></a><span class="lineno"> 1373</span>  se->op.write_buf(req, nodeid, &bufv, arg->offset, &fi);</div><div class="line"><a name="l01374"></a><span class="lineno"> 1374</span> </div><div class="line"><a name="l01375"></a><span class="lineno"> 1375</span> out:</div><div class="line"><a name="l01376"></a><span class="lineno"> 1376</span>  <span class="comment">/* Need to reset the pipe if ->write_buf() didn't consume all data */</span></div><div class="line"><a name="l01377"></a><span class="lineno"> 1377</span>  <span class="keywordflow">if</span> ((ibuf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>) && bufv.<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> < bufv.<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a>)</div><div class="line"><a name="l01378"></a><span class="lineno"> 1378</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l01379"></a><span class="lineno"> 1379</span> }</div><div class="line"><a name="l01380"></a><span class="lineno"> 1380</span> </div><div class="line"><a name="l01381"></a><span class="lineno"> 1381</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_flush(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01382"></a><span class="lineno"> 1382</span> {</div><div class="line"><a name="l01383"></a><span class="lineno"> 1383</span>  <span class="keyword">struct </span>fuse_flush_in *arg = (<span class="keyword">struct </span>fuse_flush_in *) inarg;</div><div class="line"><a name="l01384"></a><span class="lineno"> 1384</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01385"></a><span class="lineno"> 1385</span> </div><div class="line"><a name="l01386"></a><span class="lineno"> 1386</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01387"></a><span class="lineno"> 1387</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01388"></a><span class="lineno"> 1388</span>  fi.<a class="code" href="structfuse__file__info.html#a9c1571cb4b6be75827f48aac5891606c">flush</a> = 1;</div><div class="line"><a name="l01389"></a><span class="lineno"> 1389</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 7)</div><div class="line"><a name="l01390"></a><span class="lineno"> 1390</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01391"></a><span class="lineno"> 1391</span> </div><div class="line"><a name="l01392"></a><span class="lineno"> 1392</span>  <span class="keywordflow">if</span> (req->se->op.flush)</div><div class="line"><a name="l01393"></a><span class="lineno"> 1393</span>  req->se->op.flush(req, nodeid, &fi);</div><div class="line"><a name="l01394"></a><span class="lineno"> 1394</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01395"></a><span class="lineno"> 1395</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01396"></a><span class="lineno"> 1396</span> }</div><div class="line"><a name="l01397"></a><span class="lineno"> 1397</span> </div><div class="line"><a name="l01398"></a><span class="lineno"> 1398</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_release(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01399"></a><span class="lineno"> 1399</span> {</div><div class="line"><a name="l01400"></a><span class="lineno"> 1400</span>  <span class="keyword">struct </span>fuse_release_in *arg = (<span class="keyword">struct </span>fuse_release_in *) inarg;</div><div class="line"><a name="l01401"></a><span class="lineno"> 1401</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01402"></a><span class="lineno"> 1402</span> </div><div class="line"><a name="l01403"></a><span class="lineno"> 1403</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01404"></a><span class="lineno"> 1404</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01405"></a><span class="lineno"> 1405</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01406"></a><span class="lineno"> 1406</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 8) {</div><div class="line"><a name="l01407"></a><span class="lineno"> 1407</span>  fi.<a class="code" href="structfuse__file__info.html#a9c1571cb4b6be75827f48aac5891606c">flush</a> = (arg->release_flags & FUSE_RELEASE_FLUSH) ? 1 : 0;</div><div class="line"><a name="l01408"></a><span class="lineno"> 1408</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01409"></a><span class="lineno"> 1409</span>  }</div><div class="line"><a name="l01410"></a><span class="lineno"> 1410</span>  <span class="keywordflow">if</span> (arg->release_flags & FUSE_RELEASE_FLOCK_UNLOCK) {</div><div class="line"><a name="l01411"></a><span class="lineno"> 1411</span>  fi.flock_release = 1;</div><div class="line"><a name="l01412"></a><span class="lineno"> 1412</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01413"></a><span class="lineno"> 1413</span>  }</div><div class="line"><a name="l01414"></a><span class="lineno"> 1414</span> </div><div class="line"><a name="l01415"></a><span class="lineno"> 1415</span>  <span class="keywordflow">if</span> (req->se->op.release)</div><div class="line"><a name="l01416"></a><span class="lineno"> 1416</span>  req->se->op.release(req, nodeid, &fi);</div><div class="line"><a name="l01417"></a><span class="lineno"> 1417</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01418"></a><span class="lineno"> 1418</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, 0);</div><div class="line"><a name="l01419"></a><span class="lineno"> 1419</span> }</div><div class="line"><a name="l01420"></a><span class="lineno"> 1420</span> </div><div class="line"><a name="l01421"></a><span class="lineno"> 1421</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fsync(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01422"></a><span class="lineno"> 1422</span> {</div><div class="line"><a name="l01423"></a><span class="lineno"> 1423</span>  <span class="keyword">struct </span>fuse_fsync_in *arg = (<span class="keyword">struct </span>fuse_fsync_in *) inarg;</div><div class="line"><a name="l01424"></a><span class="lineno"> 1424</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01425"></a><span class="lineno"> 1425</span>  <span class="keywordtype">int</span> datasync = arg->fsync_flags & 1;</div><div class="line"><a name="l01426"></a><span class="lineno"> 1426</span> </div><div class="line"><a name="l01427"></a><span class="lineno"> 1427</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01428"></a><span class="lineno"> 1428</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01429"></a><span class="lineno"> 1429</span> </div><div class="line"><a name="l01430"></a><span class="lineno"> 1430</span>  <span class="keywordflow">if</span> (req->se->op.fsync)</div><div class="line"><a name="l01431"></a><span class="lineno"> 1431</span>  req->se->op.fsync(req, nodeid, datasync, &fi);</div><div class="line"><a name="l01432"></a><span class="lineno"> 1432</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01433"></a><span class="lineno"> 1433</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01434"></a><span class="lineno"> 1434</span> }</div><div class="line"><a name="l01435"></a><span class="lineno"> 1435</span> </div><div class="line"><a name="l01436"></a><span class="lineno"> 1436</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_opendir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01437"></a><span class="lineno"> 1437</span> {</div><div class="line"><a name="l01438"></a><span class="lineno"> 1438</span>  <span class="keyword">struct </span>fuse_open_in *arg = (<span class="keyword">struct </span>fuse_open_in *) inarg;</div><div class="line"><a name="l01439"></a><span class="lineno"> 1439</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01440"></a><span class="lineno"> 1440</span> </div><div class="line"><a name="l01441"></a><span class="lineno"> 1441</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01442"></a><span class="lineno"> 1442</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01443"></a><span class="lineno"> 1443</span> </div><div class="line"><a name="l01444"></a><span class="lineno"> 1444</span>  <span class="keywordflow">if</span> (req->se->op.opendir)</div><div class="line"><a name="l01445"></a><span class="lineno"> 1445</span>  req->se->op.opendir(req, nodeid, &fi);</div><div class="line"><a name="l01446"></a><span class="lineno"> 1446</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01447"></a><span class="lineno"> 1447</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(req, &fi);</div><div class="line"><a name="l01448"></a><span class="lineno"> 1448</span> }</div><div class="line"><a name="l01449"></a><span class="lineno"> 1449</span> </div><div class="line"><a name="l01450"></a><span class="lineno"> 1450</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01451"></a><span class="lineno"> 1451</span> {</div><div class="line"><a name="l01452"></a><span class="lineno"> 1452</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01453"></a><span class="lineno"> 1453</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01454"></a><span class="lineno"> 1454</span> </div><div class="line"><a name="l01455"></a><span class="lineno"> 1455</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01456"></a><span class="lineno"> 1456</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01457"></a><span class="lineno"> 1457</span> </div><div class="line"><a name="l01458"></a><span class="lineno"> 1458</span>  <span class="keywordflow">if</span> (req->se->op.readdir)</div><div class="line"><a name="l01459"></a><span class="lineno"> 1459</span>  req->se->op.readdir(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01460"></a><span class="lineno"> 1460</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01461"></a><span class="lineno"> 1461</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01462"></a><span class="lineno"> 1462</span> }</div><div class="line"><a name="l01463"></a><span class="lineno"> 1463</span> </div><div class="line"><a name="l01464"></a><span class="lineno"> 1464</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readdirplus(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01465"></a><span class="lineno"> 1465</span> {</div><div class="line"><a name="l01466"></a><span class="lineno"> 1466</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01467"></a><span class="lineno"> 1467</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01468"></a><span class="lineno"> 1468</span> </div><div class="line"><a name="l01469"></a><span class="lineno"> 1469</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01470"></a><span class="lineno"> 1470</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01471"></a><span class="lineno"> 1471</span> </div><div class="line"><a name="l01472"></a><span class="lineno"> 1472</span>  <span class="keywordflow">if</span> (req->se->op.readdirplus)</div><div class="line"><a name="l01473"></a><span class="lineno"> 1473</span>  req->se->op.readdirplus(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01474"></a><span class="lineno"> 1474</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01475"></a><span class="lineno"> 1475</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01476"></a><span class="lineno"> 1476</span> }</div><div class="line"><a name="l01477"></a><span class="lineno"> 1477</span> </div><div class="line"><a name="l01478"></a><span class="lineno"> 1478</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_releasedir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01479"></a><span class="lineno"> 1479</span> {</div><div class="line"><a name="l01480"></a><span class="lineno"> 1480</span>  <span class="keyword">struct </span>fuse_release_in *arg = (<span class="keyword">struct </span>fuse_release_in *) inarg;</div><div class="line"><a name="l01481"></a><span class="lineno"> 1481</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01482"></a><span class="lineno"> 1482</span> </div><div class="line"><a name="l01483"></a><span class="lineno"> 1483</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01484"></a><span class="lineno"> 1484</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01485"></a><span class="lineno"> 1485</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01486"></a><span class="lineno"> 1486</span> </div><div class="line"><a name="l01487"></a><span class="lineno"> 1487</span>  <span class="keywordflow">if</span> (req->se->op.releasedir)</div><div class="line"><a name="l01488"></a><span class="lineno"> 1488</span>  req->se->op.releasedir(req, nodeid, &fi);</div><div class="line"><a name="l01489"></a><span class="lineno"> 1489</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01490"></a><span class="lineno"> 1490</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, 0);</div><div class="line"><a name="l01491"></a><span class="lineno"> 1491</span> }</div><div class="line"><a name="l01492"></a><span class="lineno"> 1492</span> </div><div class="line"><a name="l01493"></a><span class="lineno"> 1493</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fsyncdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01494"></a><span class="lineno"> 1494</span> {</div><div class="line"><a name="l01495"></a><span class="lineno"> 1495</span>  <span class="keyword">struct </span>fuse_fsync_in *arg = (<span class="keyword">struct </span>fuse_fsync_in *) inarg;</div><div class="line"><a name="l01496"></a><span class="lineno"> 1496</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01497"></a><span class="lineno"> 1497</span>  <span class="keywordtype">int</span> datasync = arg->fsync_flags & 1;</div><div class="line"><a name="l01498"></a><span class="lineno"> 1498</span> </div><div class="line"><a name="l01499"></a><span class="lineno"> 1499</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01500"></a><span class="lineno"> 1500</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01501"></a><span class="lineno"> 1501</span> </div><div class="line"><a name="l01502"></a><span class="lineno"> 1502</span>  <span class="keywordflow">if</span> (req->se->op.fsyncdir)</div><div class="line"><a name="l01503"></a><span class="lineno"> 1503</span>  req->se->op.fsyncdir(req, nodeid, datasync, &fi);</div><div class="line"><a name="l01504"></a><span class="lineno"> 1504</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01505"></a><span class="lineno"> 1505</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01506"></a><span class="lineno"> 1506</span> }</div><div class="line"><a name="l01507"></a><span class="lineno"> 1507</span> </div><div class="line"><a name="l01508"></a><span class="lineno"> 1508</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_statfs(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01509"></a><span class="lineno"> 1509</span> {</div><div class="line"><a name="l01510"></a><span class="lineno"> 1510</span>  (void) nodeid;</div><div class="line"><a name="l01511"></a><span class="lineno"> 1511</span>  (void) inarg;</div><div class="line"><a name="l01512"></a><span class="lineno"> 1512</span> </div><div class="line"><a name="l01513"></a><span class="lineno"> 1513</span>  <span class="keywordflow">if</span> (req->se->op.statfs)</div><div class="line"><a name="l01514"></a><span class="lineno"> 1514</span>  req->se->op.statfs(req, nodeid);</div><div class="line"><a name="l01515"></a><span class="lineno"> 1515</span>  <span class="keywordflow">else</span> {</div><div class="line"><a name="l01516"></a><span class="lineno"> 1516</span>  <span class="keyword">struct </span>statvfs buf = {</div><div class="line"><a name="l01517"></a><span class="lineno"> 1517</span>  .f_namemax = 255,</div><div class="line"><a name="l01518"></a><span class="lineno"> 1518</span>  .f_bsize = 512,</div><div class="line"><a name="l01519"></a><span class="lineno"> 1519</span>  };</div><div class="line"><a name="l01520"></a><span class="lineno"> 1520</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa1d95ec3ca674253baac3639ea10f0ff">fuse_reply_statfs</a>(req, &buf);</div><div class="line"><a name="l01521"></a><span class="lineno"> 1521</span>  }</div><div class="line"><a name="l01522"></a><span class="lineno"> 1522</span> }</div><div class="line"><a name="l01523"></a><span class="lineno"> 1523</span> </div><div class="line"><a name="l01524"></a><span class="lineno"> 1524</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01525"></a><span class="lineno"> 1525</span> {</div><div class="line"><a name="l01526"></a><span class="lineno"> 1526</span>  <span class="keyword">struct </span>fuse_setxattr_in *arg = (<span class="keyword">struct </span>fuse_setxattr_in *) inarg;</div><div class="line"><a name="l01527"></a><span class="lineno"> 1527</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01528"></a><span class="lineno"> 1528</span>  <span class="keywordtype">char</span> *value = name + strlen(name) + 1;</div><div class="line"><a name="l01529"></a><span class="lineno"> 1529</span> </div><div class="line"><a name="l01530"></a><span class="lineno"> 1530</span>  <span class="keywordflow">if</span> (req->se->op.setxattr)</div><div class="line"><a name="l01531"></a><span class="lineno"> 1531</span>  req->se->op.setxattr(req, nodeid, name, value, arg->size,</div><div class="line"><a name="l01532"></a><span class="lineno"> 1532</span>  arg->flags);</div><div class="line"><a name="l01533"></a><span class="lineno"> 1533</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01534"></a><span class="lineno"> 1534</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01535"></a><span class="lineno"> 1535</span> }</div><div class="line"><a name="l01536"></a><span class="lineno"> 1536</span> </div><div class="line"><a name="l01537"></a><span class="lineno"> 1537</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01538"></a><span class="lineno"> 1538</span> {</div><div class="line"><a name="l01539"></a><span class="lineno"> 1539</span>  <span class="keyword">struct </span>fuse_getxattr_in *arg = (<span class="keyword">struct </span>fuse_getxattr_in *) inarg;</div><div class="line"><a name="l01540"></a><span class="lineno"> 1540</span> </div><div class="line"><a name="l01541"></a><span class="lineno"> 1541</span>  <span class="keywordflow">if</span> (req->se->op.getxattr)</div><div class="line"><a name="l01542"></a><span class="lineno"> 1542</span>  req->se->op.getxattr(req, nodeid, PARAM(arg), arg->size);</div><div class="line"><a name="l01543"></a><span class="lineno"> 1543</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01544"></a><span class="lineno"> 1544</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01545"></a><span class="lineno"> 1545</span> }</div><div class="line"><a name="l01546"></a><span class="lineno"> 1546</span> </div><div class="line"><a name="l01547"></a><span class="lineno"> 1547</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_listxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01548"></a><span class="lineno"> 1548</span> {</div><div class="line"><a name="l01549"></a><span class="lineno"> 1549</span>  <span class="keyword">struct </span>fuse_getxattr_in *arg = (<span class="keyword">struct </span>fuse_getxattr_in *) inarg;</div><div class="line"><a name="l01550"></a><span class="lineno"> 1550</span> </div><div class="line"><a name="l01551"></a><span class="lineno"> 1551</span>  <span class="keywordflow">if</span> (req->se->op.listxattr)</div><div class="line"><a name="l01552"></a><span class="lineno"> 1552</span>  req->se->op.listxattr(req, nodeid, arg->size);</div><div class="line"><a name="l01553"></a><span class="lineno"> 1553</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01554"></a><span class="lineno"> 1554</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01555"></a><span class="lineno"> 1555</span> }</div><div class="line"><a name="l01556"></a><span class="lineno"> 1556</span> </div><div class="line"><a name="l01557"></a><span class="lineno"> 1557</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_removexattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01558"></a><span class="lineno"> 1558</span> {</div><div class="line"><a name="l01559"></a><span class="lineno"> 1559</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01560"></a><span class="lineno"> 1560</span> </div><div class="line"><a name="l01561"></a><span class="lineno"> 1561</span>  <span class="keywordflow">if</span> (req->se->op.removexattr)</div><div class="line"><a name="l01562"></a><span class="lineno"> 1562</span>  req->se->op.removexattr(req, nodeid, name);</div><div class="line"><a name="l01563"></a><span class="lineno"> 1563</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01564"></a><span class="lineno"> 1564</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01565"></a><span class="lineno"> 1565</span> }</div><div class="line"><a name="l01566"></a><span class="lineno"> 1566</span> </div><div class="line"><a name="l01567"></a><span class="lineno"> 1567</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_fuse_file_lock(<span class="keyword">struct</span> fuse_file_lock *fl,</div><div class="line"><a name="l01568"></a><span class="lineno"> 1568</span>  <span class="keyword">struct</span> flock *flock)</div><div class="line"><a name="l01569"></a><span class="lineno"> 1569</span> {</div><div class="line"><a name="l01570"></a><span class="lineno"> 1570</span>  memset(flock, 0, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> flock));</div><div class="line"><a name="l01571"></a><span class="lineno"> 1571</span>  flock->l_type = fl->type;</div><div class="line"><a name="l01572"></a><span class="lineno"> 1572</span>  flock->l_whence = SEEK_SET;</div><div class="line"><a name="l01573"></a><span class="lineno"> 1573</span>  flock->l_start = fl->start;</div><div class="line"><a name="l01574"></a><span class="lineno"> 1574</span>  <span class="keywordflow">if</span> (fl->end == OFFSET_MAX)</div><div class="line"><a name="l01575"></a><span class="lineno"> 1575</span>  flock->l_len = 0;</div><div class="line"><a name="l01576"></a><span class="lineno"> 1576</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01577"></a><span class="lineno"> 1577</span>  flock->l_len = fl->end - fl->start + 1;</div><div class="line"><a name="l01578"></a><span class="lineno"> 1578</span>  flock->l_pid = fl->pid;</div><div class="line"><a name="l01579"></a><span class="lineno"> 1579</span> }</div><div class="line"><a name="l01580"></a><span class="lineno"> 1580</span> </div><div class="line"><a name="l01581"></a><span class="lineno"> 1581</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getlk(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01582"></a><span class="lineno"> 1582</span> {</div><div class="line"><a name="l01583"></a><span class="lineno"> 1583</span>  <span class="keyword">struct </span>fuse_lk_in *arg = (<span class="keyword">struct </span>fuse_lk_in *) inarg;</div><div class="line"><a name="l01584"></a><span class="lineno"> 1584</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01585"></a><span class="lineno"> 1585</span>  <span class="keyword">struct </span>flock flock;</div><div class="line"><a name="l01586"></a><span class="lineno"> 1586</span> </div><div class="line"><a name="l01587"></a><span class="lineno"> 1587</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01588"></a><span class="lineno"> 1588</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01589"></a><span class="lineno"> 1589</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->owner;</div><div class="line"><a name="l01590"></a><span class="lineno"> 1590</span> </div><div class="line"><a name="l01591"></a><span class="lineno"> 1591</span>  convert_fuse_file_lock(&arg->lk, &flock);</div><div class="line"><a name="l01592"></a><span class="lineno"> 1592</span>  <span class="keywordflow">if</span> (req->se->op.getlk)</div><div class="line"><a name="l01593"></a><span class="lineno"> 1593</span>  req->se->op.getlk(req, nodeid, &fi, &flock);</div><div class="line"><a name="l01594"></a><span class="lineno"> 1594</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01595"></a><span class="lineno"> 1595</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01596"></a><span class="lineno"> 1596</span> }</div><div class="line"><a name="l01597"></a><span class="lineno"> 1597</span> </div><div class="line"><a name="l01598"></a><span class="lineno"> 1598</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlk_common(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l01599"></a><span class="lineno"> 1599</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg, <span class="keywordtype">int</span> sleep)</div><div class="line"><a name="l01600"></a><span class="lineno"> 1600</span> {</div><div class="line"><a name="l01601"></a><span class="lineno"> 1601</span>  <span class="keyword">struct </span>fuse_lk_in *arg = (<span class="keyword">struct </span>fuse_lk_in *) inarg;</div><div class="line"><a name="l01602"></a><span class="lineno"> 1602</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01603"></a><span class="lineno"> 1603</span>  <span class="keyword">struct </span>flock flock;</div><div class="line"><a name="l01604"></a><span class="lineno"> 1604</span> </div><div class="line"><a name="l01605"></a><span class="lineno"> 1605</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01606"></a><span class="lineno"> 1606</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01607"></a><span class="lineno"> 1607</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->owner;</div><div class="line"><a name="l01608"></a><span class="lineno"> 1608</span> </div><div class="line"><a name="l01609"></a><span class="lineno"> 1609</span>  <span class="keywordflow">if</span> (arg->lk_flags & FUSE_LK_FLOCK) {</div><div class="line"><a name="l01610"></a><span class="lineno"> 1610</span>  <span class="keywordtype">int</span> op = 0;</div><div class="line"><a name="l01611"></a><span class="lineno"> 1611</span> </div><div class="line"><a name="l01612"></a><span class="lineno"> 1612</span>  <span class="keywordflow">switch</span> (arg->lk.type) {</div><div class="line"><a name="l01613"></a><span class="lineno"> 1613</span>  <span class="keywordflow">case</span> F_RDLCK:</div><div class="line"><a name="l01614"></a><span class="lineno"> 1614</span>  op = LOCK_SH;</div><div class="line"><a name="l01615"></a><span class="lineno"> 1615</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01616"></a><span class="lineno"> 1616</span>  <span class="keywordflow">case</span> F_WRLCK:</div><div class="line"><a name="l01617"></a><span class="lineno"> 1617</span>  op = LOCK_EX;</div><div class="line"><a name="l01618"></a><span class="lineno"> 1618</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01619"></a><span class="lineno"> 1619</span>  <span class="keywordflow">case</span> F_UNLCK:</div><div class="line"><a name="l01620"></a><span class="lineno"> 1620</span>  op = LOCK_UN;</div><div class="line"><a name="l01621"></a><span class="lineno"> 1621</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01622"></a><span class="lineno"> 1622</span>  }</div><div class="line"><a name="l01623"></a><span class="lineno"> 1623</span>  <span class="keywordflow">if</span> (!sleep)</div><div class="line"><a name="l01624"></a><span class="lineno"> 1624</span>  op |= LOCK_NB;</div><div class="line"><a name="l01625"></a><span class="lineno"> 1625</span> </div><div class="line"><a name="l01626"></a><span class="lineno"> 1626</span>  <span class="keywordflow">if</span> (req->se->op.flock)</div><div class="line"><a name="l01627"></a><span class="lineno"> 1627</span>  req->se->op.flock(req, nodeid, &fi, op);</div><div class="line"><a name="l01628"></a><span class="lineno"> 1628</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01629"></a><span class="lineno"> 1629</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01630"></a><span class="lineno"> 1630</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01631"></a><span class="lineno"> 1631</span>  convert_fuse_file_lock(&arg->lk, &flock);</div><div class="line"><a name="l01632"></a><span class="lineno"> 1632</span>  <span class="keywordflow">if</span> (req->se->op.setlk)</div><div class="line"><a name="l01633"></a><span class="lineno"> 1633</span>  req->se->op.setlk(req, nodeid, &fi, &flock, sleep);</div><div class="line"><a name="l01634"></a><span class="lineno"> 1634</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01635"></a><span class="lineno"> 1635</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01636"></a><span class="lineno"> 1636</span>  }</div><div class="line"><a name="l01637"></a><span class="lineno"> 1637</span> }</div><div class="line"><a name="l01638"></a><span class="lineno"> 1638</span> </div><div class="line"><a name="l01639"></a><span class="lineno"> 1639</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlk(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01640"></a><span class="lineno"> 1640</span> {</div><div class="line"><a name="l01641"></a><span class="lineno"> 1641</span>  do_setlk_common(req, nodeid, inarg, 0);</div><div class="line"><a name="l01642"></a><span class="lineno"> 1642</span> }</div><div class="line"><a name="l01643"></a><span class="lineno"> 1643</span> </div><div class="line"><a name="l01644"></a><span class="lineno"> 1644</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlkw(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01645"></a><span class="lineno"> 1645</span> {</div><div class="line"><a name="l01646"></a><span class="lineno"> 1646</span>  do_setlk_common(req, nodeid, inarg, 1);</div><div class="line"><a name="l01647"></a><span class="lineno"> 1647</span> }</div><div class="line"><a name="l01648"></a><span class="lineno"> 1648</span> </div><div class="line"><a name="l01649"></a><span class="lineno"> 1649</span> <span class="keyword">static</span> <span class="keywordtype">int</span> find_interrupted(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l01650"></a><span class="lineno"> 1650</span> {</div><div class="line"><a name="l01651"></a><span class="lineno"> 1651</span>  <span class="keyword">struct </span>fuse_req *curr;</div><div class="line"><a name="l01652"></a><span class="lineno"> 1652</span> </div><div class="line"><a name="l01653"></a><span class="lineno"> 1653</span>  <span class="keywordflow">for</span> (curr = se->list.next; curr != &se->list; curr = curr->next) {</div><div class="line"><a name="l01654"></a><span class="lineno"> 1654</span>  <span class="keywordflow">if</span> (curr->unique == req->u.i.unique) {</div><div class="line"><a name="l01655"></a><span class="lineno"> 1655</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1fe719ed24a713bb5d17e4e7a0dde730">fuse_interrupt_func_t</a> func;</div><div class="line"><a name="l01656"></a><span class="lineno"> 1656</span>  <span class="keywordtype">void</span> *data;</div><div class="line"><a name="l01657"></a><span class="lineno"> 1657</span> </div><div class="line"><a name="l01658"></a><span class="lineno"> 1658</span>  curr->ctr++;</div><div class="line"><a name="l01659"></a><span class="lineno"> 1659</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01660"></a><span class="lineno"> 1660</span> </div><div class="line"><a name="l01661"></a><span class="lineno"> 1661</span>  <span class="comment">/* Ugh, ugly locking */</span></div><div class="line"><a name="l01662"></a><span class="lineno"> 1662</span>  pthread_mutex_lock(&curr->lock);</div><div class="line"><a name="l01663"></a><span class="lineno"> 1663</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01664"></a><span class="lineno"> 1664</span>  curr->interrupted = 1;</div><div class="line"><a name="l01665"></a><span class="lineno"> 1665</span>  func = curr->u.ni.func;</div><div class="line"><a name="l01666"></a><span class="lineno"> 1666</span>  data = curr->u.ni.data;</div><div class="line"><a name="l01667"></a><span class="lineno"> 1667</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01668"></a><span class="lineno"> 1668</span>  <span class="keywordflow">if</span> (func)</div><div class="line"><a name="l01669"></a><span class="lineno"> 1669</span>  func(curr, data);</div><div class="line"><a name="l01670"></a><span class="lineno"> 1670</span>  pthread_mutex_unlock(&curr->lock);</div><div class="line"><a name="l01671"></a><span class="lineno"> 1671</span> </div><div class="line"><a name="l01672"></a><span class="lineno"> 1672</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01673"></a><span class="lineno"> 1673</span>  curr->ctr--;</div><div class="line"><a name="l01674"></a><span class="lineno"> 1674</span>  <span class="keywordflow">if</span> (!curr->ctr)</div><div class="line"><a name="l01675"></a><span class="lineno"> 1675</span>  destroy_req(curr);</div><div class="line"><a name="l01676"></a><span class="lineno"> 1676</span> </div><div class="line"><a name="l01677"></a><span class="lineno"> 1677</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l01678"></a><span class="lineno"> 1678</span>  }</div><div class="line"><a name="l01679"></a><span class="lineno"> 1679</span>  }</div><div class="line"><a name="l01680"></a><span class="lineno"> 1680</span>  <span class="keywordflow">for</span> (curr = se->interrupts.next; curr != &se->interrupts;</div><div class="line"><a name="l01681"></a><span class="lineno"> 1681</span>  curr = curr->next) {</div><div class="line"><a name="l01682"></a><span class="lineno"> 1682</span>  <span class="keywordflow">if</span> (curr->u.i.unique == req->u.i.unique)</div><div class="line"><a name="l01683"></a><span class="lineno"> 1683</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l01684"></a><span class="lineno"> 1684</span>  }</div><div class="line"><a name="l01685"></a><span class="lineno"> 1685</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l01686"></a><span class="lineno"> 1686</span> }</div><div class="line"><a name="l01687"></a><span class="lineno"> 1687</span> </div><div class="line"><a name="l01688"></a><span class="lineno"> 1688</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_interrupt(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01689"></a><span class="lineno"> 1689</span> {</div><div class="line"><a name="l01690"></a><span class="lineno"> 1690</span>  <span class="keyword">struct </span>fuse_interrupt_in *arg = (<span class="keyword">struct </span>fuse_interrupt_in *) inarg;</div><div class="line"><a name="l01691"></a><span class="lineno"> 1691</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01692"></a><span class="lineno"> 1692</span> </div><div class="line"><a name="l01693"></a><span class="lineno"> 1693</span>  (void) nodeid;</div><div class="line"><a name="l01694"></a><span class="lineno"> 1694</span>  <span class="keywordflow">if</span> (se->debug)</div><div class="line"><a name="l01695"></a><span class="lineno"> 1695</span>  fprintf(stderr, <span class="stringliteral">"INTERRUPT: %llu\n"</span>,</div><div class="line"><a name="l01696"></a><span class="lineno"> 1696</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) arg->unique);</div><div class="line"><a name="l01697"></a><span class="lineno"> 1697</span> </div><div class="line"><a name="l01698"></a><span class="lineno"> 1698</span>  req->u.i.unique = arg->unique;</div><div class="line"><a name="l01699"></a><span class="lineno"> 1699</span> </div><div class="line"><a name="l01700"></a><span class="lineno"> 1700</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01701"></a><span class="lineno"> 1701</span>  <span class="keywordflow">if</span> (find_interrupted(se, req))</div><div class="line"><a name="l01702"></a><span class="lineno"> 1702</span>  destroy_req(req);</div><div class="line"><a name="l01703"></a><span class="lineno"> 1703</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01704"></a><span class="lineno"> 1704</span>  list_add_req(req, &se->interrupts);</div><div class="line"><a name="l01705"></a><span class="lineno"> 1705</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01706"></a><span class="lineno"> 1706</span> }</div><div class="line"><a name="l01707"></a><span class="lineno"> 1707</span> </div><div class="line"><a name="l01708"></a><span class="lineno"> 1708</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_req *check_interrupt(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l01709"></a><span class="lineno"> 1709</span>  <span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l01710"></a><span class="lineno"> 1710</span> {</div><div class="line"><a name="l01711"></a><span class="lineno"> 1711</span>  <span class="keyword">struct </span>fuse_req *curr;</div><div class="line"><a name="l01712"></a><span class="lineno"> 1712</span> </div><div class="line"><a name="l01713"></a><span class="lineno"> 1713</span>  <span class="keywordflow">for</span> (curr = se->interrupts.next; curr != &se->interrupts;</div><div class="line"><a name="l01714"></a><span class="lineno"> 1714</span>  curr = curr->next) {</div><div class="line"><a name="l01715"></a><span class="lineno"> 1715</span>  <span class="keywordflow">if</span> (curr->u.i.unique == req->unique) {</div><div class="line"><a name="l01716"></a><span class="lineno"> 1716</span>  req->interrupted = 1;</div><div class="line"><a name="l01717"></a><span class="lineno"> 1717</span>  list_del_req(curr);</div><div class="line"><a name="l01718"></a><span class="lineno"> 1718</span>  free(curr);</div><div class="line"><a name="l01719"></a><span class="lineno"> 1719</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l01720"></a><span class="lineno"> 1720</span>  }</div><div class="line"><a name="l01721"></a><span class="lineno"> 1721</span>  }</div><div class="line"><a name="l01722"></a><span class="lineno"> 1722</span>  curr = se->interrupts.next;</div><div class="line"><a name="l01723"></a><span class="lineno"> 1723</span>  <span class="keywordflow">if</span> (curr != &se->interrupts) {</div><div class="line"><a name="l01724"></a><span class="lineno"> 1724</span>  list_del_req(curr);</div><div class="line"><a name="l01725"></a><span class="lineno"> 1725</span>  list_init_req(curr);</div><div class="line"><a name="l01726"></a><span class="lineno"> 1726</span>  <span class="keywordflow">return</span> curr;</div><div class="line"><a name="l01727"></a><span class="lineno"> 1727</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01728"></a><span class="lineno"> 1728</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l01729"></a><span class="lineno"> 1729</span> }</div><div class="line"><a name="l01730"></a><span class="lineno"> 1730</span> </div><div class="line"><a name="l01731"></a><span class="lineno"> 1731</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_bmap(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01732"></a><span class="lineno"> 1732</span> {</div><div class="line"><a name="l01733"></a><span class="lineno"> 1733</span>  <span class="keyword">struct </span>fuse_bmap_in *arg = (<span class="keyword">struct </span>fuse_bmap_in *) inarg;</div><div class="line"><a name="l01734"></a><span class="lineno"> 1734</span> </div><div class="line"><a name="l01735"></a><span class="lineno"> 1735</span>  <span class="keywordflow">if</span> (req->se->op.bmap)</div><div class="line"><a name="l01736"></a><span class="lineno"> 1736</span>  req->se->op.bmap(req, nodeid, arg->blocksize, arg->block);</div><div class="line"><a name="l01737"></a><span class="lineno"> 1737</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01738"></a><span class="lineno"> 1738</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01739"></a><span class="lineno"> 1739</span> }</div><div class="line"><a name="l01740"></a><span class="lineno"> 1740</span> </div><div class="line"><a name="l01741"></a><span class="lineno"> 1741</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_ioctl(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01742"></a><span class="lineno"> 1742</span> {</div><div class="line"><a name="l01743"></a><span class="lineno"> 1743</span>  <span class="keyword">struct </span>fuse_ioctl_in *arg = (<span class="keyword">struct </span>fuse_ioctl_in *) inarg;</div><div class="line"><a name="l01744"></a><span class="lineno"> 1744</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags = arg->flags;</div><div class="line"><a name="l01745"></a><span class="lineno"> 1745</span>  <span class="keywordtype">void</span> *in_buf = arg->in_size ? PARAM(arg) : NULL;</div><div class="line"><a name="l01746"></a><span class="lineno"> 1746</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01747"></a><span class="lineno"> 1747</span> </div><div class="line"><a name="l01748"></a><span class="lineno"> 1748</span>  <span class="keywordflow">if</span> (flags & FUSE_IOCTL_DIR &&</div><div class="line"><a name="l01749"></a><span class="lineno"> 1749</span>  !(req->se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>)) {</div><div class="line"><a name="l01750"></a><span class="lineno"> 1750</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOTTY);</div><div class="line"><a name="l01751"></a><span class="lineno"> 1751</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01752"></a><span class="lineno"> 1752</span>  }</div><div class="line"><a name="l01753"></a><span class="lineno"> 1753</span> </div><div class="line"><a name="l01754"></a><span class="lineno"> 1754</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01755"></a><span class="lineno"> 1755</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01756"></a><span class="lineno"> 1756</span> </div><div class="line"><a name="l01757"></a><span class="lineno"> 1757</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span> *) == 4 && req->se->conn.proto_minor >= 16 &&</div><div class="line"><a name="l01758"></a><span class="lineno"> 1758</span>  !(flags & FUSE_IOCTL_32BIT)) {</div><div class="line"><a name="l01759"></a><span class="lineno"> 1759</span>  req->ioctl_64bit = 1;</div><div class="line"><a name="l01760"></a><span class="lineno"> 1760</span>  }</div><div class="line"><a name="l01761"></a><span class="lineno"> 1761</span> </div><div class="line"><a name="l01762"></a><span class="lineno"> 1762</span>  <span class="keywordflow">if</span> (req->se->op.ioctl)</div><div class="line"><a name="l01763"></a><span class="lineno"> 1763</span>  req->se->op.ioctl(req, nodeid, arg->cmd,</div><div class="line"><a name="l01764"></a><span class="lineno"> 1764</span>  (<span class="keywordtype">void</span> *)(uintptr_t)arg->arg, &fi, flags,</div><div class="line"><a name="l01765"></a><span class="lineno"> 1765</span>  in_buf, arg->in_size, arg->out_size);</div><div class="line"><a name="l01766"></a><span class="lineno"> 1766</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01767"></a><span class="lineno"> 1767</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01768"></a><span class="lineno"> 1768</span> }</div><div class="line"><a name="l01769"></a><span class="lineno"> 1769</span> </div><div class="line"><a name="l01770"></a><span class="lineno"><a class="line" href="include_2fuse__common_8h.html#adf5027f8a38b2efc03858efd7fdc756a"> 1770</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#adf5027f8a38b2efc03858efd7fdc756a">fuse_pollhandle_destroy</a>(<span class="keyword">struct</span> fuse_pollhandle *ph)</div><div class="line"><a name="l01771"></a><span class="lineno"> 1771</span> {</div><div class="line"><a name="l01772"></a><span class="lineno"> 1772</span>  free(ph);</div><div class="line"><a name="l01773"></a><span class="lineno"> 1773</span> }</div><div class="line"><a name="l01774"></a><span class="lineno"> 1774</span> </div><div class="line"><a name="l01775"></a><span class="lineno"> 1775</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_poll(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01776"></a><span class="lineno"> 1776</span> {</div><div class="line"><a name="l01777"></a><span class="lineno"> 1777</span>  <span class="keyword">struct </span>fuse_poll_in *arg = (<span class="keyword">struct </span>fuse_poll_in *) inarg;</div><div class="line"><a name="l01778"></a><span class="lineno"> 1778</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01779"></a><span class="lineno"> 1779</span> </div><div class="line"><a name="l01780"></a><span class="lineno"> 1780</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01781"></a><span class="lineno"> 1781</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01782"></a><span class="lineno"> 1782</span>  fi.<a class="code" href="structfuse__file__info.html#a51b0d5928ec6112456d2aa50f2c35001">poll_events</a> = arg->events;</div><div class="line"><a name="l01783"></a><span class="lineno"> 1783</span> </div><div class="line"><a name="l01784"></a><span class="lineno"> 1784</span>  <span class="keywordflow">if</span> (req->se->op.poll) {</div><div class="line"><a name="l01785"></a><span class="lineno"> 1785</span>  <span class="keyword">struct </span>fuse_pollhandle *ph = NULL;</div><div class="line"><a name="l01786"></a><span class="lineno"> 1786</span> </div><div class="line"><a name="l01787"></a><span class="lineno"> 1787</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POLL_SCHEDULE_NOTIFY) {</div><div class="line"><a name="l01788"></a><span class="lineno"> 1788</span>  ph = malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_pollhandle));</div><div class="line"><a name="l01789"></a><span class="lineno"> 1789</span>  <span class="keywordflow">if</span> (ph == NULL) {</div><div class="line"><a name="l01790"></a><span class="lineno"> 1790</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l01791"></a><span class="lineno"> 1791</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01792"></a><span class="lineno"> 1792</span>  }</div><div class="line"><a name="l01793"></a><span class="lineno"> 1793</span>  ph->kh = arg->kh;</div><div class="line"><a name="l01794"></a><span class="lineno"> 1794</span>  ph->se = req->se;</div><div class="line"><a name="l01795"></a><span class="lineno"> 1795</span>  }</div><div class="line"><a name="l01796"></a><span class="lineno"> 1796</span> </div><div class="line"><a name="l01797"></a><span class="lineno"> 1797</span>  req->se->op.poll(req, nodeid, &fi, ph);</div><div class="line"><a name="l01798"></a><span class="lineno"> 1798</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01799"></a><span class="lineno"> 1799</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01800"></a><span class="lineno"> 1800</span>  }</div><div class="line"><a name="l01801"></a><span class="lineno"> 1801</span> }</div><div class="line"><a name="l01802"></a><span class="lineno"> 1802</span> </div><div class="line"><a name="l01803"></a><span class="lineno"> 1803</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fallocate(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01804"></a><span class="lineno"> 1804</span> {</div><div class="line"><a name="l01805"></a><span class="lineno"> 1805</span>  <span class="keyword">struct </span>fuse_fallocate_in *arg = (<span class="keyword">struct </span>fuse_fallocate_in *) inarg;</div><div class="line"><a name="l01806"></a><span class="lineno"> 1806</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01807"></a><span class="lineno"> 1807</span> </div><div class="line"><a name="l01808"></a><span class="lineno"> 1808</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01809"></a><span class="lineno"> 1809</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01810"></a><span class="lineno"> 1810</span> </div><div class="line"><a name="l01811"></a><span class="lineno"> 1811</span>  <span class="keywordflow">if</span> (req->se->op.fallocate)</div><div class="line"><a name="l01812"></a><span class="lineno"> 1812</span>  req->se->op.fallocate(req, nodeid, arg->mode, arg->offset, arg->length, &fi);</div><div class="line"><a name="l01813"></a><span class="lineno"> 1813</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01814"></a><span class="lineno"> 1814</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01815"></a><span class="lineno"> 1815</span> }</div><div class="line"><a name="l01816"></a><span class="lineno"> 1816</span> </div><div class="line"><a name="l01817"></a><span class="lineno"> 1817</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_copy_file_range(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid_in, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01818"></a><span class="lineno"> 1818</span> {</div><div class="line"><a name="l01819"></a><span class="lineno"> 1819</span>  <span class="keyword">struct </span>fuse_copy_file_range_in *arg = (<span class="keyword">struct </span>fuse_copy_file_range_in *) inarg;</div><div class="line"><a name="l01820"></a><span class="lineno"> 1820</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi_in, fi_out;</div><div class="line"><a name="l01821"></a><span class="lineno"> 1821</span> </div><div class="line"><a name="l01822"></a><span class="lineno"> 1822</span>  memset(&fi_in, 0, <span class="keyword">sizeof</span>(fi_in));</div><div class="line"><a name="l01823"></a><span class="lineno"> 1823</span>  fi_in.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh_in;</div><div class="line"><a name="l01824"></a><span class="lineno"> 1824</span> </div><div class="line"><a name="l01825"></a><span class="lineno"> 1825</span>  memset(&fi_out, 0, <span class="keyword">sizeof</span>(fi_out));</div><div class="line"><a name="l01826"></a><span class="lineno"> 1826</span>  fi_out.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh_out;</div><div class="line"><a name="l01827"></a><span class="lineno"> 1827</span> </div><div class="line"><a name="l01828"></a><span class="lineno"> 1828</span> </div><div class="line"><a name="l01829"></a><span class="lineno"> 1829</span>  <span class="keywordflow">if</span> (req->se->op.copy_file_range)</div><div class="line"><a name="l01830"></a><span class="lineno"> 1830</span>  req->se->op.copy_file_range(req, nodeid_in, arg->off_in,</div><div class="line"><a name="l01831"></a><span class="lineno"> 1831</span>  &fi_in, arg->nodeid_out,</div><div class="line"><a name="l01832"></a><span class="lineno"> 1832</span>  arg->off_out, &fi_out, arg->len,</div><div class="line"><a name="l01833"></a><span class="lineno"> 1833</span>  arg-><a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a>);</div><div class="line"><a name="l01834"></a><span class="lineno"> 1834</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01835"></a><span class="lineno"> 1835</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01836"></a><span class="lineno"> 1836</span> }</div><div class="line"><a name="l01837"></a><span class="lineno"> 1837</span> </div><div class="line"><a name="l01838"></a><span class="lineno"> 1838</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_init(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01839"></a><span class="lineno"> 1839</span> {</div><div class="line"><a name="l01840"></a><span class="lineno"> 1840</span>  <span class="keyword">struct </span>fuse_init_in *arg = (<span class="keyword">struct </span>fuse_init_in *) inarg;</div><div class="line"><a name="l01841"></a><span class="lineno"> 1841</span>  <span class="keyword">struct </span>fuse_init_out outarg;</div><div class="line"><a name="l01842"></a><span class="lineno"> 1842</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01843"></a><span class="lineno"> 1843</span>  <span class="keywordtype">size_t</span> bufsize = se->bufsize;</div><div class="line"><a name="l01844"></a><span class="lineno"> 1844</span>  <span class="keywordtype">size_t</span> outargsize = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l01845"></a><span class="lineno"> 1845</span> </div><div class="line"><a name="l01846"></a><span class="lineno"> 1846</span>  (void) nodeid;</div><div class="line"><a name="l01847"></a><span class="lineno"> 1847</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l01848"></a><span class="lineno"> 1848</span>  fprintf(stderr, <span class="stringliteral">"INIT: %u.%u\n"</span>, arg->major, arg->minor);</div><div class="line"><a name="l01849"></a><span class="lineno"> 1849</span>  <span class="keywordflow">if</span> (arg->major == 7 && arg->minor >= 6) {</div><div class="line"><a name="l01850"></a><span class="lineno"> 1850</span>  fprintf(stderr, <span class="stringliteral">"flags=0x%08x\n"</span>, arg->flags);</div><div class="line"><a name="l01851"></a><span class="lineno"> 1851</span>  fprintf(stderr, <span class="stringliteral">"max_readahead=0x%08x\n"</span>,</div><div class="line"><a name="l01852"></a><span class="lineno"> 1852</span>  arg->max_readahead);</div><div class="line"><a name="l01853"></a><span class="lineno"> 1853</span>  }</div><div class="line"><a name="l01854"></a><span class="lineno"> 1854</span>  }</div><div class="line"><a name="l01855"></a><span class="lineno"> 1855</span>  se->conn.proto_major = arg->major;</div><div class="line"><a name="l01856"></a><span class="lineno"> 1856</span>  se->conn.proto_minor = arg->minor;</div><div class="line"><a name="l01857"></a><span class="lineno"> 1857</span>  se->conn.capable = 0;</div><div class="line"><a name="l01858"></a><span class="lineno"> 1858</span>  se->conn.want = 0;</div><div class="line"><a name="l01859"></a><span class="lineno"> 1859</span> </div><div class="line"><a name="l01860"></a><span class="lineno"> 1860</span>  memset(&outarg, 0, <span class="keyword">sizeof</span>(outarg));</div><div class="line"><a name="l01861"></a><span class="lineno"> 1861</span>  outarg.major = FUSE_KERNEL_VERSION;</div><div class="line"><a name="l01862"></a><span class="lineno"> 1862</span>  outarg.minor = FUSE_KERNEL_MINOR_VERSION;</div><div class="line"><a name="l01863"></a><span class="lineno"> 1863</span> </div><div class="line"><a name="l01864"></a><span class="lineno"> 1864</span>  <span class="keywordflow">if</span> (arg->major < 7) {</div><div class="line"><a name="l01865"></a><span class="lineno"> 1865</span>  fprintf(stderr, <span class="stringliteral">"fuse: unsupported protocol version: %u.%u\n"</span>,</div><div class="line"><a name="l01866"></a><span class="lineno"> 1866</span>  arg->major, arg->minor);</div><div class="line"><a name="l01867"></a><span class="lineno"> 1867</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01868"></a><span class="lineno"> 1868</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01869"></a><span class="lineno"> 1869</span>  }</div><div class="line"><a name="l01870"></a><span class="lineno"> 1870</span> </div><div class="line"><a name="l01871"></a><span class="lineno"> 1871</span>  <span class="keywordflow">if</span> (arg->major > 7) {</div><div class="line"><a name="l01872"></a><span class="lineno"> 1872</span>  <span class="comment">/* Wait for a second INIT request with a 7.X version */</span></div><div class="line"><a name="l01873"></a><span class="lineno"> 1873</span>  send_reply_ok(req, &outarg, <span class="keyword">sizeof</span>(outarg));</div><div class="line"><a name="l01874"></a><span class="lineno"> 1874</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01875"></a><span class="lineno"> 1875</span>  }</div><div class="line"><a name="l01876"></a><span class="lineno"> 1876</span> </div><div class="line"><a name="l01877"></a><span class="lineno"> 1877</span>  <span class="keywordflow">if</span> (arg->minor >= 6) {</div><div class="line"><a name="l01878"></a><span class="lineno"> 1878</span>  <span class="keywordflow">if</span> (arg->max_readahead < se->conn.max_readahead)</div><div class="line"><a name="l01879"></a><span class="lineno"> 1879</span>  se->conn.max_readahead = arg->max_readahead;</div><div class="line"><a name="l01880"></a><span class="lineno"> 1880</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ASYNC_READ)</div><div class="line"><a name="l01881"></a><span class="lineno"> 1881</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>;</div><div class="line"><a name="l01882"></a><span class="lineno"> 1882</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POSIX_LOCKS)</div><div class="line"><a name="l01883"></a><span class="lineno"> 1883</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>;</div><div class="line"><a name="l01884"></a><span class="lineno"> 1884</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ATOMIC_O_TRUNC)</div><div class="line"><a name="l01885"></a><span class="lineno"> 1885</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>;</div><div class="line"><a name="l01886"></a><span class="lineno"> 1886</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_EXPORT_SUPPORT)</div><div class="line"><a name="l01887"></a><span class="lineno"> 1887</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a7686c11aaf80382189927b10b848d8c8">FUSE_CAP_EXPORT_SUPPORT</a>;</div><div class="line"><a name="l01888"></a><span class="lineno"> 1888</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_DONT_MASK)</div><div class="line"><a name="l01889"></a><span class="lineno"> 1889</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0cd4cebf7ec784886836aa061a1612fe">FUSE_CAP_DONT_MASK</a>;</div><div class="line"><a name="l01890"></a><span class="lineno"> 1890</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_FLOCK_LOCKS)</div><div class="line"><a name="l01891"></a><span class="lineno"> 1891</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>;</div><div class="line"><a name="l01892"></a><span class="lineno"> 1892</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_AUTO_INVAL_DATA)</div><div class="line"><a name="l01893"></a><span class="lineno"> 1893</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>;</div><div class="line"><a name="l01894"></a><span class="lineno"> 1894</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_DO_READDIRPLUS)</div><div class="line"><a name="l01895"></a><span class="lineno"> 1895</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>;</div><div class="line"><a name="l01896"></a><span class="lineno"> 1896</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_READDIRPLUS_AUTO)</div><div class="line"><a name="l01897"></a><span class="lineno"> 1897</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>;</div><div class="line"><a name="l01898"></a><span class="lineno"> 1898</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ASYNC_DIO)</div><div class="line"><a name="l01899"></a><span class="lineno"> 1899</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>;</div><div class="line"><a name="l01900"></a><span class="lineno"> 1900</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_WRITEBACK_CACHE)</div><div class="line"><a name="l01901"></a><span class="lineno"> 1901</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4839fce31097f4b4da7a1f01169228fa">FUSE_CAP_WRITEBACK_CACHE</a>;</div><div class="line"><a name="l01902"></a><span class="lineno"> 1902</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_NO_OPEN_SUPPORT)</div><div class="line"><a name="l01903"></a><span class="lineno"> 1903</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad4477fe76f57e8b726d0357a637d7aaf">FUSE_CAP_NO_OPEN_SUPPORT</a>;</div><div class="line"><a name="l01904"></a><span class="lineno"> 1904</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_PARALLEL_DIROPS)</div><div class="line"><a name="l01905"></a><span class="lineno"> 1905</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a3311a7f569e9fbf55b3f0bcaadbe4ad0">FUSE_CAP_PARALLEL_DIROPS</a>;</div><div class="line"><a name="l01906"></a><span class="lineno"> 1906</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POSIX_ACL)</div><div class="line"><a name="l01907"></a><span class="lineno"> 1907</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5b3ef5b12be33295311d6b751846c263">FUSE_CAP_POSIX_ACL</a>;</div><div class="line"><a name="l01908"></a><span class="lineno"> 1908</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_HANDLE_KILLPRIV)</div><div class="line"><a name="l01909"></a><span class="lineno"> 1909</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a24a4a980dff3f7a4ba771a92bb59a4bd">FUSE_CAP_HANDLE_KILLPRIV</a>;</div><div class="line"><a name="l01910"></a><span class="lineno"> 1910</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_NO_OPENDIR_SUPPORT)</div><div class="line"><a name="l01911"></a><span class="lineno"> 1911</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aa573f7b730ea608463d8399659c38ca6">FUSE_CAP_NO_OPENDIR_SUPPORT</a>;</div><div class="line"><a name="l01912"></a><span class="lineno"> 1912</span>  <span class="keywordflow">if</span> (!(arg->flags & FUSE_MAX_PAGES)) {</div><div class="line"><a name="l01913"></a><span class="lineno"> 1913</span>  <span class="keywordtype">size_t</span> max_bufsize =</div><div class="line"><a name="l01914"></a><span class="lineno"> 1914</span>  FUSE_DEFAULT_MAX_PAGES_PER_REQ * getpagesize()</div><div class="line"><a name="l01915"></a><span class="lineno"> 1915</span>  + FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01916"></a><span class="lineno"> 1916</span>  <span class="keywordflow">if</span> (bufsize > max_bufsize) {</div><div class="line"><a name="l01917"></a><span class="lineno"> 1917</span>  bufsize = max_bufsize;</div><div class="line"><a name="l01918"></a><span class="lineno"> 1918</span>  }</div><div class="line"><a name="l01919"></a><span class="lineno"> 1919</span>  }</div><div class="line"><a name="l01920"></a><span class="lineno"> 1920</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01921"></a><span class="lineno"> 1921</span>  se->conn.max_readahead = 0;</div><div class="line"><a name="l01922"></a><span class="lineno"> 1922</span>  }</div><div class="line"><a name="l01923"></a><span class="lineno"> 1923</span> </div><div class="line"><a name="l01924"></a><span class="lineno"> 1924</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 14) {</div><div class="line"><a name="l01925"></a><span class="lineno"> 1925</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l01926"></a><span class="lineno"> 1926</span> <span class="preprocessor">#ifdef HAVE_VMSPLICE</span></div><div class="line"><a name="l01927"></a><span class="lineno"> 1927</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4f8815e0f48c60c3d9cd6e72be5a84e4">FUSE_CAP_SPLICE_WRITE</a> | <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aef5da823dc5f202bbe033c7a5a3de9c4">FUSE_CAP_SPLICE_MOVE</a>;</div><div class="line"><a name="l01928"></a><span class="lineno"> 1928</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l01929"></a><span class="lineno"> 1929</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>;</div><div class="line"><a name="l01930"></a><span class="lineno"> 1930</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l01931"></a><span class="lineno"> 1931</span>  }</div><div class="line"><a name="l01932"></a><span class="lineno"> 1932</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 18)</div><div class="line"><a name="l01933"></a><span class="lineno"> 1933</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>;</div><div class="line"><a name="l01934"></a><span class="lineno"> 1934</span> </div><div class="line"><a name="l01935"></a><span class="lineno"> 1935</span>  <span class="comment">/* Default settings for modern filesystems.</span></div><div class="line"><a name="l01936"></a><span class="lineno"> 1936</span> <span class="comment"> *</span></div><div class="line"><a name="l01937"></a><span class="lineno"> 1937</span> <span class="comment"> * Most of these capabilities were disabled by default in</span></div><div class="line"><a name="l01938"></a><span class="lineno"> 1938</span> <span class="comment"> * libfuse2 for backwards compatibility reasons. In libfuse3,</span></div><div class="line"><a name="l01939"></a><span class="lineno"> 1939</span> <span class="comment"> * we can finally enable them by default (as long as they're</span></div><div class="line"><a name="l01940"></a><span class="lineno"> 1940</span> <span class="comment"> * supported by the kernel).</span></div><div class="line"><a name="l01941"></a><span class="lineno"> 1941</span> <span class="comment"> */</span></div><div class="line"><a name="l01942"></a><span class="lineno"> 1942</span> <span class="preprocessor">#define LL_SET_DEFAULT(cond, cap) \</span></div><div class="line"><a name="l01943"></a><span class="lineno"> 1943</span> <span class="preprocessor"> if ((cond) && (se->conn.capable & (cap))) \</span></div><div class="line"><a name="l01944"></a><span class="lineno"> 1944</span> <span class="preprocessor"> se->conn.want |= (cap)</span></div><div class="line"><a name="l01945"></a><span class="lineno"> 1945</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>);</div><div class="line"><a name="l01946"></a><span class="lineno"> 1946</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a3311a7f569e9fbf55b3f0bcaadbe4ad0">FUSE_CAP_PARALLEL_DIROPS</a>);</div><div class="line"><a name="l01947"></a><span class="lineno"> 1947</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>);</div><div class="line"><a name="l01948"></a><span class="lineno"> 1948</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a24a4a980dff3f7a4ba771a92bb59a4bd">FUSE_CAP_HANDLE_KILLPRIV</a>);</div><div class="line"><a name="l01949"></a><span class="lineno"> 1949</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>);</div><div class="line"><a name="l01950"></a><span class="lineno"> 1950</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>);</div><div class="line"><a name="l01951"></a><span class="lineno"> 1951</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>);</div><div class="line"><a name="l01952"></a><span class="lineno"> 1952</span>  LL_SET_DEFAULT(se->op.write_buf, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>);</div><div class="line"><a name="l01953"></a><span class="lineno"> 1953</span>  LL_SET_DEFAULT(se->op.getlk && se->op.setlk,</div><div class="line"><a name="l01954"></a><span class="lineno"> 1954</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>);</div><div class="line"><a name="l01955"></a><span class="lineno"> 1955</span>  LL_SET_DEFAULT(se->op.flock, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>);</div><div class="line"><a name="l01956"></a><span class="lineno"> 1956</span>  LL_SET_DEFAULT(se->op.readdirplus, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>);</div><div class="line"><a name="l01957"></a><span class="lineno"> 1957</span>  LL_SET_DEFAULT(se->op.readdirplus && se->op.readdir,</div><div class="line"><a name="l01958"></a><span class="lineno"> 1958</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>);</div><div class="line"><a name="l01959"></a><span class="lineno"> 1959</span>  se->conn.time_gran = 1;</div><div class="line"><a name="l01960"></a><span class="lineno"> 1960</span>  </div><div class="line"><a name="l01961"></a><span class="lineno"> 1961</span>  <span class="keywordflow">if</span> (bufsize < FUSE_MIN_READ_BUFFER) {</div><div class="line"><a name="l01962"></a><span class="lineno"> 1962</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: buffer size too small: %zu\n"</span>,</div><div class="line"><a name="l01963"></a><span class="lineno"> 1963</span>  bufsize);</div><div class="line"><a name="l01964"></a><span class="lineno"> 1964</span>  bufsize = FUSE_MIN_READ_BUFFER;</div><div class="line"><a name="l01965"></a><span class="lineno"> 1965</span>  }</div><div class="line"><a name="l01966"></a><span class="lineno"> 1966</span>  se->bufsize = bufsize;</div><div class="line"><a name="l01967"></a><span class="lineno"> 1967</span> </div><div class="line"><a name="l01968"></a><span class="lineno"> 1968</span>  <span class="keywordflow">if</span> (se->conn.max_write > bufsize - FUSE_BUFFER_HEADER_SIZE)</div><div class="line"><a name="l01969"></a><span class="lineno"> 1969</span>  se->conn.max_write = bufsize - FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01970"></a><span class="lineno"> 1970</span> </div><div class="line"><a name="l01971"></a><span class="lineno"> 1971</span>  se->got_init = 1;</div><div class="line"><a name="l01972"></a><span class="lineno"> 1972</span>  <span class="keywordflow">if</span> (se->op.init)</div><div class="line"><a name="l01973"></a><span class="lineno"> 1973</span>  se->op.init(se->userdata, &se->conn);</div><div class="line"><a name="l01974"></a><span class="lineno"> 1974</span> </div><div class="line"><a name="l01975"></a><span class="lineno"> 1975</span>  <span class="keywordflow">if</span> (se->conn.want & (~se->conn.capable)) {</div><div class="line"><a name="l01976"></a><span class="lineno"> 1976</span>  fprintf(stderr, <span class="stringliteral">"fuse: error: filesystem requested capabilities "</span></div><div class="line"><a name="l01977"></a><span class="lineno"> 1977</span>  <span class="stringliteral">"0x%x that are not supported by kernel, aborting.\n"</span>,</div><div class="line"><a name="l01978"></a><span class="lineno"> 1978</span>  se->conn.want & (~se->conn.capable));</div><div class="line"><a name="l01979"></a><span class="lineno"> 1979</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01980"></a><span class="lineno"> 1980</span>  se->error = -EPROTO;</div><div class="line"><a name="l01981"></a><span class="lineno"> 1981</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l01982"></a><span class="lineno"> 1982</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01983"></a><span class="lineno"> 1983</span>  }</div><div class="line"><a name="l01984"></a><span class="lineno"> 1984</span> </div><div class="line"><a name="l01985"></a><span class="lineno"> 1985</span>  <span class="keywordtype">unsigned</span> max_read_mo = get_max_read(se->mo);</div><div class="line"><a name="l01986"></a><span class="lineno"> 1986</span>  <span class="keywordflow">if</span> (se->conn.max_read != max_read_mo) {</div><div class="line"><a name="l01987"></a><span class="lineno"> 1987</span>  fprintf(stderr, <span class="stringliteral">"fuse: error: init() and fuse_session_new() "</span></div><div class="line"><a name="l01988"></a><span class="lineno"> 1988</span>  <span class="stringliteral">"requested different maximum read size (%u vs %u)\n"</span>,</div><div class="line"><a name="l01989"></a><span class="lineno"> 1989</span>  se->conn.max_read, max_read_mo);</div><div class="line"><a name="l01990"></a><span class="lineno"> 1990</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01991"></a><span class="lineno"> 1991</span>  se->error = -EPROTO;</div><div class="line"><a name="l01992"></a><span class="lineno"> 1992</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l01993"></a><span class="lineno"> 1993</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01994"></a><span class="lineno"> 1994</span>  }</div><div class="line"><a name="l01995"></a><span class="lineno"> 1995</span> </div><div class="line"><a name="l01996"></a><span class="lineno"> 1996</span>  <span class="keywordflow">if</span> (se->conn.max_write < bufsize - FUSE_BUFFER_HEADER_SIZE) {</div><div class="line"><a name="l01997"></a><span class="lineno"> 1997</span>  se->bufsize = se->conn.max_write + FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01998"></a><span class="lineno"> 1998</span>  }</div><div class="line"><a name="l01999"></a><span class="lineno"> 1999</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_MAX_PAGES) {</div><div class="line"><a name="l02000"></a><span class="lineno"> 2000</span>  outarg.flags |= FUSE_MAX_PAGES;</div><div class="line"><a name="l02001"></a><span class="lineno"> 2001</span>  outarg.max_pages = (se->conn.max_write - 1) / getpagesize() + 1;</div><div class="line"><a name="l02002"></a><span class="lineno"> 2002</span>  }</div><div class="line"><a name="l02003"></a><span class="lineno"> 2003</span> </div><div class="line"><a name="l02004"></a><span class="lineno"> 2004</span>  <span class="comment">/* Always enable big writes, this is superseded</span></div><div class="line"><a name="l02005"></a><span class="lineno"> 2005</span> <span class="comment"> by the max_write option */</span></div><div class="line"><a name="l02006"></a><span class="lineno"> 2006</span>  outarg.flags |= FUSE_BIG_WRITES;</div><div class="line"><a name="l02007"></a><span class="lineno"> 2007</span> </div><div class="line"><a name="l02008"></a><span class="lineno"> 2008</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>)</div><div class="line"><a name="l02009"></a><span class="lineno"> 2009</span>  outarg.flags |= FUSE_ASYNC_READ;</div><div class="line"><a name="l02010"></a><span class="lineno"> 2010</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>)</div><div class="line"><a name="l02011"></a><span class="lineno"> 2011</span>  outarg.flags |= FUSE_POSIX_LOCKS;</div><div class="line"><a name="l02012"></a><span class="lineno"> 2012</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>)</div><div class="line"><a name="l02013"></a><span class="lineno"> 2013</span>  outarg.flags |= FUSE_ATOMIC_O_TRUNC;</div><div class="line"><a name="l02014"></a><span class="lineno"> 2014</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a7686c11aaf80382189927b10b848d8c8">FUSE_CAP_EXPORT_SUPPORT</a>)</div><div class="line"><a name="l02015"></a><span class="lineno"> 2015</span>  outarg.flags |= FUSE_EXPORT_SUPPORT;</div><div class="line"><a name="l02016"></a><span class="lineno"> 2016</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0cd4cebf7ec784886836aa061a1612fe">FUSE_CAP_DONT_MASK</a>)</div><div class="line"><a name="l02017"></a><span class="lineno"> 2017</span>  outarg.flags |= FUSE_DONT_MASK;</div><div class="line"><a name="l02018"></a><span class="lineno"> 2018</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>)</div><div class="line"><a name="l02019"></a><span class="lineno"> 2019</span>  outarg.flags |= FUSE_FLOCK_LOCKS;</div><div class="line"><a name="l02020"></a><span class="lineno"> 2020</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>)</div><div class="line"><a name="l02021"></a><span class="lineno"> 2021</span>  outarg.flags |= FUSE_AUTO_INVAL_DATA;</div><div class="line"><a name="l02022"></a><span class="lineno"> 2022</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>)</div><div class="line"><a name="l02023"></a><span class="lineno"> 2023</span>  outarg.flags |= FUSE_DO_READDIRPLUS;</div><div class="line"><a name="l02024"></a><span class="lineno"> 2024</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>)</div><div class="line"><a name="l02025"></a><span class="lineno"> 2025</span>  outarg.flags |= FUSE_READDIRPLUS_AUTO;</div><div class="line"><a name="l02026"></a><span class="lineno"> 2026</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>)</div><div class="line"><a name="l02027"></a><span class="lineno"> 2027</span>  outarg.flags |= FUSE_ASYNC_DIO;</div><div class="line"><a name="l02028"></a><span class="lineno"> 2028</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4839fce31097f4b4da7a1f01169228fa">FUSE_CAP_WRITEBACK_CACHE</a>)</div><div class="line"><a name="l02029"></a><span class="lineno"> 2029</span>  outarg.flags |= FUSE_WRITEBACK_CACHE;</div><div class="line"><a name="l02030"></a><span class="lineno"> 2030</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5b3ef5b12be33295311d6b751846c263">FUSE_CAP_POSIX_ACL</a>)</div><div class="line"><a name="l02031"></a><span class="lineno"> 2031</span>  outarg.flags |= FUSE_POSIX_ACL;</div><div class="line"><a name="l02032"></a><span class="lineno"> 2032</span>  outarg.max_readahead = se->conn.max_readahead;</div><div class="line"><a name="l02033"></a><span class="lineno"> 2033</span>  outarg.max_write = se->conn.max_write;</div><div class="line"><a name="l02034"></a><span class="lineno"> 2034</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 13) {</div><div class="line"><a name="l02035"></a><span class="lineno"> 2035</span>  <span class="keywordflow">if</span> (se->conn.max_background >= (1 << 16))</div><div class="line"><a name="l02036"></a><span class="lineno"> 2036</span>  se->conn.max_background = (1 << 16) - 1;</div><div class="line"><a name="l02037"></a><span class="lineno"> 2037</span>  <span class="keywordflow">if</span> (se->conn.congestion_threshold > se->conn.max_background)</div><div class="line"><a name="l02038"></a><span class="lineno"> 2038</span>  se->conn.congestion_threshold = se->conn.max_background;</div><div class="line"><a name="l02039"></a><span class="lineno"> 2039</span>  <span class="keywordflow">if</span> (!se->conn.congestion_threshold) {</div><div class="line"><a name="l02040"></a><span class="lineno"> 2040</span>  se->conn.congestion_threshold =</div><div class="line"><a name="l02041"></a><span class="lineno"> 2041</span>  se->conn.max_background * 3 / 4;</div><div class="line"><a name="l02042"></a><span class="lineno"> 2042</span>  }</div><div class="line"><a name="l02043"></a><span class="lineno"> 2043</span> </div><div class="line"><a name="l02044"></a><span class="lineno"> 2044</span>  outarg.max_background = se->conn.max_background;</div><div class="line"><a name="l02045"></a><span class="lineno"> 2045</span>  outarg.congestion_threshold = se->conn.congestion_threshold;</div><div class="line"><a name="l02046"></a><span class="lineno"> 2046</span>  }</div><div class="line"><a name="l02047"></a><span class="lineno"> 2047</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 23)</div><div class="line"><a name="l02048"></a><span class="lineno"> 2048</span>  outarg.time_gran = se->conn.time_gran;</div><div class="line"><a name="l02049"></a><span class="lineno"> 2049</span> </div><div class="line"><a name="l02050"></a><span class="lineno"> 2050</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l02051"></a><span class="lineno"> 2051</span>  fprintf(stderr, <span class="stringliteral">" INIT: %u.%u\n"</span>, outarg.major, outarg.minor);</div><div class="line"><a name="l02052"></a><span class="lineno"> 2052</span>  fprintf(stderr, <span class="stringliteral">" flags=0x%08x\n"</span>, outarg.flags);</div><div class="line"><a name="l02053"></a><span class="lineno"> 2053</span>  fprintf(stderr, <span class="stringliteral">" max_readahead=0x%08x\n"</span>,</div><div class="line"><a name="l02054"></a><span class="lineno"> 2054</span>  outarg.max_readahead);</div><div class="line"><a name="l02055"></a><span class="lineno"> 2055</span>  fprintf(stderr, <span class="stringliteral">" max_write=0x%08x\n"</span>, outarg.max_write);</div><div class="line"><a name="l02056"></a><span class="lineno"> 2056</span>  fprintf(stderr, <span class="stringliteral">" max_background=%i\n"</span>,</div><div class="line"><a name="l02057"></a><span class="lineno"> 2057</span>  outarg.max_background);</div><div class="line"><a name="l02058"></a><span class="lineno"> 2058</span>  fprintf(stderr, <span class="stringliteral">" congestion_threshold=%i\n"</span>,</div><div class="line"><a name="l02059"></a><span class="lineno"> 2059</span>  outarg.congestion_threshold);</div><div class="line"><a name="l02060"></a><span class="lineno"> 2060</span>  fprintf(stderr, <span class="stringliteral">" time_gran=%u\n"</span>,</div><div class="line"><a name="l02061"></a><span class="lineno"> 2061</span>  outarg.time_gran);</div><div class="line"><a name="l02062"></a><span class="lineno"> 2062</span>  }</div><div class="line"><a name="l02063"></a><span class="lineno"> 2063</span>  <span class="keywordflow">if</span> (arg->minor < 5)</div><div class="line"><a name="l02064"></a><span class="lineno"> 2064</span>  outargsize = FUSE_COMPAT_INIT_OUT_SIZE;</div><div class="line"><a name="l02065"></a><span class="lineno"> 2065</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg->minor < 23)</div><div class="line"><a name="l02066"></a><span class="lineno"> 2066</span>  outargsize = FUSE_COMPAT_22_INIT_OUT_SIZE;</div><div class="line"><a name="l02067"></a><span class="lineno"> 2067</span> </div><div class="line"><a name="l02068"></a><span class="lineno"> 2068</span>  send_reply_ok(req, &outarg, outargsize);</div><div class="line"><a name="l02069"></a><span class="lineno"> 2069</span> }</div><div class="line"><a name="l02070"></a><span class="lineno"> 2070</span> </div><div class="line"><a name="l02071"></a><span class="lineno"> 2071</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_destroy(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l02072"></a><span class="lineno"> 2072</span> {</div><div class="line"><a name="l02073"></a><span class="lineno"> 2073</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02074"></a><span class="lineno"> 2074</span> </div><div class="line"><a name="l02075"></a><span class="lineno"> 2075</span>  (void) nodeid;</div><div class="line"><a name="l02076"></a><span class="lineno"> 2076</span>  (void) inarg;</div><div class="line"><a name="l02077"></a><span class="lineno"> 2077</span> </div><div class="line"><a name="l02078"></a><span class="lineno"> 2078</span>  se->got_destroy = 1;</div><div class="line"><a name="l02079"></a><span class="lineno"> 2079</span>  <span class="keywordflow">if</span> (se->op.destroy)</div><div class="line"><a name="l02080"></a><span class="lineno"> 2080</span>  se->op.destroy(se->userdata);</div><div class="line"><a name="l02081"></a><span class="lineno"> 2081</span> </div><div class="line"><a name="l02082"></a><span class="lineno"> 2082</span>  send_reply_ok(req, NULL, 0);</div><div class="line"><a name="l02083"></a><span class="lineno"> 2083</span> }</div><div class="line"><a name="l02084"></a><span class="lineno"> 2084</span> </div><div class="line"><a name="l02085"></a><span class="lineno"> 2085</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_del_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq)</div><div class="line"><a name="l02086"></a><span class="lineno"> 2086</span> {</div><div class="line"><a name="l02087"></a><span class="lineno"> 2087</span>  <span class="keyword">struct </span>fuse_notify_req *prev = nreq->prev;</div><div class="line"><a name="l02088"></a><span class="lineno"> 2088</span>  <span class="keyword">struct </span>fuse_notify_req *next = nreq->next;</div><div class="line"><a name="l02089"></a><span class="lineno"> 2089</span>  prev->next = next;</div><div class="line"><a name="l02090"></a><span class="lineno"> 2090</span>  next->prev = prev;</div><div class="line"><a name="l02091"></a><span class="lineno"> 2091</span> }</div><div class="line"><a name="l02092"></a><span class="lineno"> 2092</span> </div><div class="line"><a name="l02093"></a><span class="lineno"> 2093</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_add_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq,</div><div class="line"><a name="l02094"></a><span class="lineno"> 2094</span>  <span class="keyword">struct</span> fuse_notify_req *next)</div><div class="line"><a name="l02095"></a><span class="lineno"> 2095</span> {</div><div class="line"><a name="l02096"></a><span class="lineno"> 2096</span>  <span class="keyword">struct </span>fuse_notify_req *prev = next->prev;</div><div class="line"><a name="l02097"></a><span class="lineno"> 2097</span>  nreq->next = next;</div><div class="line"><a name="l02098"></a><span class="lineno"> 2098</span>  nreq->prev = prev;</div><div class="line"><a name="l02099"></a><span class="lineno"> 2099</span>  prev->next = nreq;</div><div class="line"><a name="l02100"></a><span class="lineno"> 2100</span>  next->prev = nreq;</div><div class="line"><a name="l02101"></a><span class="lineno"> 2101</span> }</div><div class="line"><a name="l02102"></a><span class="lineno"> 2102</span> </div><div class="line"><a name="l02103"></a><span class="lineno"> 2103</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_init_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq)</div><div class="line"><a name="l02104"></a><span class="lineno"> 2104</span> {</div><div class="line"><a name="l02105"></a><span class="lineno"> 2105</span>  nreq->next = nreq;</div><div class="line"><a name="l02106"></a><span class="lineno"> 2106</span>  nreq->prev = nreq;</div><div class="line"><a name="l02107"></a><span class="lineno"> 2107</span> }</div><div class="line"><a name="l02108"></a><span class="lineno"> 2108</span> </div><div class="line"><a name="l02109"></a><span class="lineno"> 2109</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_notify_reply(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l02110"></a><span class="lineno"> 2110</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02111"></a><span class="lineno"> 2111</span> {</div><div class="line"><a name="l02112"></a><span class="lineno"> 2112</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02113"></a><span class="lineno"> 2113</span>  <span class="keyword">struct </span>fuse_notify_req *nreq;</div><div class="line"><a name="l02114"></a><span class="lineno"> 2114</span>  <span class="keyword">struct </span>fuse_notify_req *head;</div><div class="line"><a name="l02115"></a><span class="lineno"> 2115</span> </div><div class="line"><a name="l02116"></a><span class="lineno"> 2116</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02117"></a><span class="lineno"> 2117</span>  head = &se->notify_list;</div><div class="line"><a name="l02118"></a><span class="lineno"> 2118</span>  <span class="keywordflow">for</span> (nreq = head->next; nreq != head; nreq = nreq->next) {</div><div class="line"><a name="l02119"></a><span class="lineno"> 2119</span>  <span class="keywordflow">if</span> (nreq->unique == req->unique) {</div><div class="line"><a name="l02120"></a><span class="lineno"> 2120</span>  list_del_nreq(nreq);</div><div class="line"><a name="l02121"></a><span class="lineno"> 2121</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l02122"></a><span class="lineno"> 2122</span>  }</div><div class="line"><a name="l02123"></a><span class="lineno"> 2123</span>  }</div><div class="line"><a name="l02124"></a><span class="lineno"> 2124</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02125"></a><span class="lineno"> 2125</span> </div><div class="line"><a name="l02126"></a><span class="lineno"> 2126</span>  <span class="keywordflow">if</span> (nreq != head)</div><div class="line"><a name="l02127"></a><span class="lineno"> 2127</span>  nreq->reply(nreq, req, nodeid, inarg, buf);</div><div class="line"><a name="l02128"></a><span class="lineno"> 2128</span> }</div><div class="line"><a name="l02129"></a><span class="lineno"> 2129</span> </div><div class="line"><a name="l02130"></a><span class="lineno"> 2130</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_notify_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keywordtype">int</span> notify_code,</div><div class="line"><a name="l02131"></a><span class="lineno"> 2131</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l02132"></a><span class="lineno"> 2132</span> {</div><div class="line"><a name="l02133"></a><span class="lineno"> 2133</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l02134"></a><span class="lineno"> 2134</span> </div><div class="line"><a name="l02135"></a><span class="lineno"> 2135</span>  <span class="keywordflow">if</span> (!se->got_init)</div><div class="line"><a name="l02136"></a><span class="lineno"> 2136</span>  <span class="keywordflow">return</span> -ENOTCONN;</div><div class="line"><a name="l02137"></a><span class="lineno"> 2137</span> </div><div class="line"><a name="l02138"></a><span class="lineno"> 2138</span>  out.unique = 0;</div><div class="line"><a name="l02139"></a><span class="lineno"> 2139</span>  out.error = notify_code;</div><div class="line"><a name="l02140"></a><span class="lineno"> 2140</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l02141"></a><span class="lineno"> 2141</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l02142"></a><span class="lineno"> 2142</span> </div><div class="line"><a name="l02143"></a><span class="lineno"> 2143</span>  <span class="keywordflow">return</span> fuse_send_msg(se, NULL, iov, count);</div><div class="line"><a name="l02144"></a><span class="lineno"> 2144</span> }</div><div class="line"><a name="l02145"></a><span class="lineno"> 2145</span> </div><div class="line"><a name="l02146"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ab078685b1f480188031fc40aa2e2fbca"> 2146</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab078685b1f480188031fc40aa2e2fbca">fuse_lowlevel_notify_poll</a>(<span class="keyword">struct</span> fuse_pollhandle *ph)</div><div class="line"><a name="l02147"></a><span class="lineno"> 2147</span> {</div><div class="line"><a name="l02148"></a><span class="lineno"> 2148</span>  <span class="keywordflow">if</span> (ph != NULL) {</div><div class="line"><a name="l02149"></a><span class="lineno"> 2149</span>  <span class="keyword">struct </span>fuse_notify_poll_wakeup_out outarg;</div><div class="line"><a name="l02150"></a><span class="lineno"> 2150</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02151"></a><span class="lineno"> 2151</span> </div><div class="line"><a name="l02152"></a><span class="lineno"> 2152</span>  outarg.kh = ph->kh;</div><div class="line"><a name="l02153"></a><span class="lineno"> 2153</span> </div><div class="line"><a name="l02154"></a><span class="lineno"> 2154</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02155"></a><span class="lineno"> 2155</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02156"></a><span class="lineno"> 2156</span> </div><div class="line"><a name="l02157"></a><span class="lineno"> 2157</span>  <span class="keywordflow">return</span> send_notify_iov(ph->se, FUSE_NOTIFY_POLL, iov, 2);</div><div class="line"><a name="l02158"></a><span class="lineno"> 2158</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02159"></a><span class="lineno"> 2159</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02160"></a><span class="lineno"> 2160</span>  }</div><div class="line"><a name="l02161"></a><span class="lineno"> 2161</span> }</div><div class="line"><a name="l02162"></a><span class="lineno"> 2162</span> </div><div class="line"><a name="l02163"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a9cb974af9745294ff446d11cba2422f1"> 2163</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a9cb974af9745294ff446d11cba2422f1">fuse_lowlevel_notify_inval_inode</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02164"></a><span class="lineno"> 2164</span>  off_t off, off_t len)</div><div class="line"><a name="l02165"></a><span class="lineno"> 2165</span> {</div><div class="line"><a name="l02166"></a><span class="lineno"> 2166</span>  <span class="keyword">struct </span>fuse_notify_inval_inode_out outarg;</div><div class="line"><a name="l02167"></a><span class="lineno"> 2167</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02168"></a><span class="lineno"> 2168</span> </div><div class="line"><a name="l02169"></a><span class="lineno"> 2169</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02170"></a><span class="lineno"> 2170</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02171"></a><span class="lineno"> 2171</span> </div><div class="line"><a name="l02172"></a><span class="lineno"> 2172</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 12)</div><div class="line"><a name="l02173"></a><span class="lineno"> 2173</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02174"></a><span class="lineno"> 2174</span>  </div><div class="line"><a name="l02175"></a><span class="lineno"> 2175</span>  outarg.ino = ino;</div><div class="line"><a name="l02176"></a><span class="lineno"> 2176</span>  outarg.off = off;</div><div class="line"><a name="l02177"></a><span class="lineno"> 2177</span>  outarg.len = len;</div><div class="line"><a name="l02178"></a><span class="lineno"> 2178</span> </div><div class="line"><a name="l02179"></a><span class="lineno"> 2179</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02180"></a><span class="lineno"> 2180</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02181"></a><span class="lineno"> 2181</span> </div><div class="line"><a name="l02182"></a><span class="lineno"> 2182</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_INVAL_INODE, iov, 2);</div><div class="line"><a name="l02183"></a><span class="lineno"> 2183</span> }</div><div class="line"><a name="l02184"></a><span class="lineno"> 2184</span> </div><div class="line"><a name="l02185"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ab14032b74b0a57a2b3155dd6ba8d6095"> 2185</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab14032b74b0a57a2b3155dd6ba8d6095">fuse_lowlevel_notify_inval_entry</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> parent,</div><div class="line"><a name="l02186"></a><span class="lineno"> 2186</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> namelen)</div><div class="line"><a name="l02187"></a><span class="lineno"> 2187</span> {</div><div class="line"><a name="l02188"></a><span class="lineno"> 2188</span>  <span class="keyword">struct </span>fuse_notify_inval_entry_out outarg;</div><div class="line"><a name="l02189"></a><span class="lineno"> 2189</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02190"></a><span class="lineno"> 2190</span> </div><div class="line"><a name="l02191"></a><span class="lineno"> 2191</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02192"></a><span class="lineno"> 2192</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02193"></a><span class="lineno"> 2193</span>  </div><div class="line"><a name="l02194"></a><span class="lineno"> 2194</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 12)</div><div class="line"><a name="l02195"></a><span class="lineno"> 2195</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02196"></a><span class="lineno"> 2196</span> </div><div class="line"><a name="l02197"></a><span class="lineno"> 2197</span>  outarg.parent = parent;</div><div class="line"><a name="l02198"></a><span class="lineno"> 2198</span>  outarg.namelen = namelen;</div><div class="line"><a name="l02199"></a><span class="lineno"> 2199</span>  outarg.padding = 0;</div><div class="line"><a name="l02200"></a><span class="lineno"> 2200</span> </div><div class="line"><a name="l02201"></a><span class="lineno"> 2201</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02202"></a><span class="lineno"> 2202</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02203"></a><span class="lineno"> 2203</span>  iov[2].iov_base = (<span class="keywordtype">void</span> *)name;</div><div class="line"><a name="l02204"></a><span class="lineno"> 2204</span>  iov[2].iov_len = namelen + 1;</div><div class="line"><a name="l02205"></a><span class="lineno"> 2205</span> </div><div class="line"><a name="l02206"></a><span class="lineno"> 2206</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_INVAL_ENTRY, iov, 3);</div><div class="line"><a name="l02207"></a><span class="lineno"> 2207</span> }</div><div class="line"><a name="l02208"></a><span class="lineno"> 2208</span> </div><div class="line"><a name="l02209"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a399a43ff69a20ce42082a81eb1517992"> 2209</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a399a43ff69a20ce42082a81eb1517992">fuse_lowlevel_notify_delete</a>(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02210"></a><span class="lineno"> 2210</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> parent, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> child,</div><div class="line"><a name="l02211"></a><span class="lineno"> 2211</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> namelen)</div><div class="line"><a name="l02212"></a><span class="lineno"> 2212</span> {</div><div class="line"><a name="l02213"></a><span class="lineno"> 2213</span>  <span class="keyword">struct </span>fuse_notify_delete_out outarg;</div><div class="line"><a name="l02214"></a><span class="lineno"> 2214</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02215"></a><span class="lineno"> 2215</span> </div><div class="line"><a name="l02216"></a><span class="lineno"> 2216</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02217"></a><span class="lineno"> 2217</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02218"></a><span class="lineno"> 2218</span> </div><div class="line"><a name="l02219"></a><span class="lineno"> 2219</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 18)</div><div class="line"><a name="l02220"></a><span class="lineno"> 2220</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02221"></a><span class="lineno"> 2221</span> </div><div class="line"><a name="l02222"></a><span class="lineno"> 2222</span>  outarg.parent = parent;</div><div class="line"><a name="l02223"></a><span class="lineno"> 2223</span>  outarg.child = child;</div><div class="line"><a name="l02224"></a><span class="lineno"> 2224</span>  outarg.namelen = namelen;</div><div class="line"><a name="l02225"></a><span class="lineno"> 2225</span>  outarg.padding = 0;</div><div class="line"><a name="l02226"></a><span class="lineno"> 2226</span> </div><div class="line"><a name="l02227"></a><span class="lineno"> 2227</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02228"></a><span class="lineno"> 2228</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02229"></a><span class="lineno"> 2229</span>  iov[2].iov_base = (<span class="keywordtype">void</span> *)name;</div><div class="line"><a name="l02230"></a><span class="lineno"> 2230</span>  iov[2].iov_len = namelen + 1;</div><div class="line"><a name="l02231"></a><span class="lineno"> 2231</span> </div><div class="line"><a name="l02232"></a><span class="lineno"> 2232</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_DELETE, iov, 3);</div><div class="line"><a name="l02233"></a><span class="lineno"> 2233</span> }</div><div class="line"><a name="l02234"></a><span class="lineno"> 2234</span> </div><div class="line"><a name="l02235"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#af856725ed4a13ed7c17512554043edbc"> 2235</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#af856725ed4a13ed7c17512554043edbc">fuse_lowlevel_notify_store</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02236"></a><span class="lineno"> 2236</span>  off_t offset, <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *bufv,</div><div class="line"><a name="l02237"></a><span class="lineno"> 2237</span>  <span class="keyword">enum</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18">fuse_buf_copy_flags</a> flags)</div><div class="line"><a name="l02238"></a><span class="lineno"> 2238</span> {</div><div class="line"><a name="l02239"></a><span class="lineno"> 2239</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l02240"></a><span class="lineno"> 2240</span>  <span class="keyword">struct </span>fuse_notify_store_out outarg;</div><div class="line"><a name="l02241"></a><span class="lineno"> 2241</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02242"></a><span class="lineno"> 2242</span>  <span class="keywordtype">size_t</span> size = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(bufv);</div><div class="line"><a name="l02243"></a><span class="lineno"> 2243</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l02244"></a><span class="lineno"> 2244</span> </div><div class="line"><a name="l02245"></a><span class="lineno"> 2245</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02246"></a><span class="lineno"> 2246</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02247"></a><span class="lineno"> 2247</span> </div><div class="line"><a name="l02248"></a><span class="lineno"> 2248</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 15)</div><div class="line"><a name="l02249"></a><span class="lineno"> 2249</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02250"></a><span class="lineno"> 2250</span> </div><div class="line"><a name="l02251"></a><span class="lineno"> 2251</span>  out.unique = 0;</div><div class="line"><a name="l02252"></a><span class="lineno"> 2252</span>  out.error = FUSE_NOTIFY_STORE;</div><div class="line"><a name="l02253"></a><span class="lineno"> 2253</span> </div><div class="line"><a name="l02254"></a><span class="lineno"> 2254</span>  outarg.nodeid = ino;</div><div class="line"><a name="l02255"></a><span class="lineno"> 2255</span>  outarg.offset = offset;</div><div class="line"><a name="l02256"></a><span class="lineno"> 2256</span>  outarg.size = size;</div><div class="line"><a name="l02257"></a><span class="lineno"> 2257</span>  outarg.padding = 0;</div><div class="line"><a name="l02258"></a><span class="lineno"> 2258</span> </div><div class="line"><a name="l02259"></a><span class="lineno"> 2259</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l02260"></a><span class="lineno"> 2260</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(out);</div><div class="line"><a name="l02261"></a><span class="lineno"> 2261</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02262"></a><span class="lineno"> 2262</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02263"></a><span class="lineno"> 2263</span> </div><div class="line"><a name="l02264"></a><span class="lineno"> 2264</span>  res = fuse_send_data_iov(se, NULL, iov, 2, bufv, flags);</div><div class="line"><a name="l02265"></a><span class="lineno"> 2265</span>  <span class="keywordflow">if</span> (res > 0)</div><div class="line"><a name="l02266"></a><span class="lineno"> 2266</span>  res = -res;</div><div class="line"><a name="l02267"></a><span class="lineno"> 2267</span> </div><div class="line"><a name="l02268"></a><span class="lineno"> 2268</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02269"></a><span class="lineno"> 2269</span> }</div><div class="line"><a name="l02270"></a><span class="lineno"> 2270</span> </div><div class="line"><a name="l02271"></a><span class="lineno"> 2271</span> <span class="keyword">struct </span>fuse_retrieve_req {</div><div class="line"><a name="l02272"></a><span class="lineno"> 2272</span>  <span class="keyword">struct </span>fuse_notify_req nreq;</div><div class="line"><a name="l02273"></a><span class="lineno"> 2273</span>  <span class="keywordtype">void</span> *cookie;</div><div class="line"><a name="l02274"></a><span class="lineno"> 2274</span> };</div><div class="line"><a name="l02275"></a><span class="lineno"> 2275</span> </div><div class="line"><a name="l02276"></a><span class="lineno"> 2276</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_retrieve_reply(<span class="keyword">struct</span> fuse_notify_req *nreq,</div><div class="line"><a name="l02277"></a><span class="lineno"> 2277</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02278"></a><span class="lineno"> 2278</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg,</div><div class="line"><a name="l02279"></a><span class="lineno"> 2279</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *ibuf)</div><div class="line"><a name="l02280"></a><span class="lineno"> 2280</span> {</div><div class="line"><a name="l02281"></a><span class="lineno"> 2281</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02282"></a><span class="lineno"> 2282</span>  <span class="keyword">struct </span>fuse_retrieve_req *rreq =</div><div class="line"><a name="l02283"></a><span class="lineno"> 2283</span>  container_of(nreq, <span class="keyword">struct</span> fuse_retrieve_req, nreq);</div><div class="line"><a name="l02284"></a><span class="lineno"> 2284</span>  <span class="keyword">const</span> <span class="keyword">struct </span>fuse_notify_retrieve_in *arg = inarg;</div><div class="line"><a name="l02285"></a><span class="lineno"> 2285</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = {</div><div class="line"><a name="l02286"></a><span class="lineno"> 2286</span>  .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *ibuf,</div><div class="line"><a name="l02287"></a><span class="lineno"> 2287</span>  .count = 1,</div><div class="line"><a name="l02288"></a><span class="lineno"> 2288</span>  };</div><div class="line"><a name="l02289"></a><span class="lineno"> 2289</span> </div><div class="line"><a name="l02290"></a><span class="lineno"> 2290</span>  <span class="keywordflow">if</span> (!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>))</div><div class="line"><a name="l02291"></a><span class="lineno"> 2291</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = PARAM(arg);</div><div class="line"><a name="l02292"></a><span class="lineno"> 2292</span> </div><div class="line"><a name="l02293"></a><span class="lineno"> 2293</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l02294"></a><span class="lineno"> 2294</span>  sizeof(struct fuse_notify_retrieve_in);</div><div class="line"><a name="l02295"></a><span class="lineno"> 2295</span> </div><div class="line"><a name="l02296"></a><span class="lineno"> 2296</span>  <span class="keywordflow">if</span> (bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < arg->size) {</div><div class="line"><a name="l02297"></a><span class="lineno"> 2297</span>  fprintf(stderr, <span class="stringliteral">"fuse: retrieve reply: buffer size too small\n"</span>);</div><div class="line"><a name="l02298"></a><span class="lineno"> 2298</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l02299"></a><span class="lineno"> 2299</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l02300"></a><span class="lineno"> 2300</span>  }</div><div class="line"><a name="l02301"></a><span class="lineno"> 2301</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = arg->size;</div><div class="line"><a name="l02302"></a><span class="lineno"> 2302</span> </div><div class="line"><a name="l02303"></a><span class="lineno"> 2303</span>  <span class="keywordflow">if</span> (se->op.retrieve_reply) {</div><div class="line"><a name="l02304"></a><span class="lineno"> 2304</span>  se->op.retrieve_reply(req, rreq->cookie, ino,</div><div class="line"><a name="l02305"></a><span class="lineno"> 2305</span>  arg->offset, &bufv);</div><div class="line"><a name="l02306"></a><span class="lineno"> 2306</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02307"></a><span class="lineno"> 2307</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l02308"></a><span class="lineno"> 2308</span>  }</div><div class="line"><a name="l02309"></a><span class="lineno"> 2309</span> out:</div><div class="line"><a name="l02310"></a><span class="lineno"> 2310</span>  free(rreq);</div><div class="line"><a name="l02311"></a><span class="lineno"> 2311</span>  <span class="keywordflow">if</span> ((ibuf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>) && bufv.<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> < bufv.<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a>)</div><div class="line"><a name="l02312"></a><span class="lineno"> 2312</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02313"></a><span class="lineno"> 2313</span> }</div><div class="line"><a name="l02314"></a><span class="lineno"> 2314</span> </div><div class="line"><a name="l02315"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a58cb3543209d2c29dc2830f2503b5058"> 2315</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a58cb3543209d2c29dc2830f2503b5058">fuse_lowlevel_notify_retrieve</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02316"></a><span class="lineno"> 2316</span>  <span class="keywordtype">size_t</span> size, off_t offset, <span class="keywordtype">void</span> *cookie)</div><div class="line"><a name="l02317"></a><span class="lineno"> 2317</span> {</div><div class="line"><a name="l02318"></a><span class="lineno"> 2318</span>  <span class="keyword">struct </span>fuse_notify_retrieve_out outarg;</div><div class="line"><a name="l02319"></a><span class="lineno"> 2319</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02320"></a><span class="lineno"> 2320</span>  <span class="keyword">struct </span>fuse_retrieve_req *rreq;</div><div class="line"><a name="l02321"></a><span class="lineno"> 2321</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02322"></a><span class="lineno"> 2322</span> </div><div class="line"><a name="l02323"></a><span class="lineno"> 2323</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02324"></a><span class="lineno"> 2324</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02325"></a><span class="lineno"> 2325</span> </div><div class="line"><a name="l02326"></a><span class="lineno"> 2326</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 15)</div><div class="line"><a name="l02327"></a><span class="lineno"> 2327</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02328"></a><span class="lineno"> 2328</span> </div><div class="line"><a name="l02329"></a><span class="lineno"> 2329</span>  rreq = malloc(<span class="keyword">sizeof</span>(*rreq));</div><div class="line"><a name="l02330"></a><span class="lineno"> 2330</span>  <span class="keywordflow">if</span> (rreq == NULL)</div><div class="line"><a name="l02331"></a><span class="lineno"> 2331</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02332"></a><span class="lineno"> 2332</span> </div><div class="line"><a name="l02333"></a><span class="lineno"> 2333</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02334"></a><span class="lineno"> 2334</span>  rreq->cookie = cookie;</div><div class="line"><a name="l02335"></a><span class="lineno"> 2335</span>  rreq->nreq.unique = se->notify_ctr++;</div><div class="line"><a name="l02336"></a><span class="lineno"> 2336</span>  rreq->nreq.reply = fuse_ll_retrieve_reply;</div><div class="line"><a name="l02337"></a><span class="lineno"> 2337</span>  list_add_nreq(&rreq->nreq, &se->notify_list);</div><div class="line"><a name="l02338"></a><span class="lineno"> 2338</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02339"></a><span class="lineno"> 2339</span> </div><div class="line"><a name="l02340"></a><span class="lineno"> 2340</span>  outarg.notify_unique = rreq->nreq.unique;</div><div class="line"><a name="l02341"></a><span class="lineno"> 2341</span>  outarg.nodeid = ino;</div><div class="line"><a name="l02342"></a><span class="lineno"> 2342</span>  outarg.offset = offset;</div><div class="line"><a name="l02343"></a><span class="lineno"> 2343</span>  outarg.size = size;</div><div class="line"><a name="l02344"></a><span class="lineno"> 2344</span>  outarg.padding = 0;</div><div class="line"><a name="l02345"></a><span class="lineno"> 2345</span> </div><div class="line"><a name="l02346"></a><span class="lineno"> 2346</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02347"></a><span class="lineno"> 2347</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02348"></a><span class="lineno"> 2348</span> </div><div class="line"><a name="l02349"></a><span class="lineno"> 2349</span>  err = send_notify_iov(se, FUSE_NOTIFY_RETRIEVE, iov, 2);</div><div class="line"><a name="l02350"></a><span class="lineno"> 2350</span>  <span class="keywordflow">if</span> (err) {</div><div class="line"><a name="l02351"></a><span class="lineno"> 2351</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02352"></a><span class="lineno"> 2352</span>  list_del_nreq(&rreq->nreq);</div><div class="line"><a name="l02353"></a><span class="lineno"> 2353</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02354"></a><span class="lineno"> 2354</span>  free(rreq);</div><div class="line"><a name="l02355"></a><span class="lineno"> 2355</span>  }</div><div class="line"><a name="l02356"></a><span class="lineno"> 2356</span> </div><div class="line"><a name="l02357"></a><span class="lineno"> 2357</span>  <span class="keywordflow">return</span> err;</div><div class="line"><a name="l02358"></a><span class="lineno"> 2358</span> }</div><div class="line"><a name="l02359"></a><span class="lineno"> 2359</span> </div><div class="line"><a name="l02360"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#aab00273c65d124e44abcf2374f9c504b"> 2360</a></span> <span class="keywordtype">void</span> *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aab00273c65d124e44abcf2374f9c504b">fuse_req_userdata</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02361"></a><span class="lineno"> 2361</span> {</div><div class="line"><a name="l02362"></a><span class="lineno"> 2362</span>  <span class="keywordflow">return</span> req->se->userdata;</div><div class="line"><a name="l02363"></a><span class="lineno"> 2363</span> }</div><div class="line"><a name="l02364"></a><span class="lineno"> 2364</span> </div><div class="line"><a name="l02365"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ad1d1963190eb93ae5667d32d2b387ca1"> 2365</a></span> <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__ctx.html">fuse_ctx</a> *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1d1963190eb93ae5667d32d2b387ca1">fuse_req_ctx</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02366"></a><span class="lineno"> 2366</span> {</div><div class="line"><a name="l02367"></a><span class="lineno"> 2367</span>  <span class="keywordflow">return</span> &req->ctx;</div><div class="line"><a name="l02368"></a><span class="lineno"> 2368</span> }</div><div class="line"><a name="l02369"></a><span class="lineno"> 2369</span> </div><div class="line"><a name="l02370"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ab3cdb9744f033e37a72984489343940f"> 2370</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab3cdb9744f033e37a72984489343940f">fuse_req_interrupt_func</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1fe719ed24a713bb5d17e4e7a0dde730">fuse_interrupt_func_t</a> func,</div><div class="line"><a name="l02371"></a><span class="lineno"> 2371</span>  <span class="keywordtype">void</span> *data)</div><div class="line"><a name="l02372"></a><span class="lineno"> 2372</span> {</div><div class="line"><a name="l02373"></a><span class="lineno"> 2373</span>  pthread_mutex_lock(&req->lock);</div><div class="line"><a name="l02374"></a><span class="lineno"> 2374</span>  pthread_mutex_lock(&req->se->lock);</div><div class="line"><a name="l02375"></a><span class="lineno"> 2375</span>  req->u.ni.func = func;</div><div class="line"><a name="l02376"></a><span class="lineno"> 2376</span>  req->u.ni.data = data;</div><div class="line"><a name="l02377"></a><span class="lineno"> 2377</span>  pthread_mutex_unlock(&req->se->lock);</div><div class="line"><a name="l02378"></a><span class="lineno"> 2378</span>  <span class="keywordflow">if</span> (req->interrupted && func)</div><div class="line"><a name="l02379"></a><span class="lineno"> 2379</span>  func(req, data);</div><div class="line"><a name="l02380"></a><span class="lineno"> 2380</span>  pthread_mutex_unlock(&req->lock);</div><div class="line"><a name="l02381"></a><span class="lineno"> 2381</span> }</div><div class="line"><a name="l02382"></a><span class="lineno"> 2382</span> </div><div class="line"><a name="l02383"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a52674fc627647f33e63c74267f0f1f9d"> 2383</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a52674fc627647f33e63c74267f0f1f9d">fuse_req_interrupted</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02384"></a><span class="lineno"> 2384</span> {</div><div class="line"><a name="l02385"></a><span class="lineno"> 2385</span>  <span class="keywordtype">int</span> interrupted;</div><div class="line"><a name="l02386"></a><span class="lineno"> 2386</span> </div><div class="line"><a name="l02387"></a><span class="lineno"> 2387</span>  pthread_mutex_lock(&req->se->lock);</div><div class="line"><a name="l02388"></a><span class="lineno"> 2388</span>  interrupted = req->interrupted;</div><div class="line"><a name="l02389"></a><span class="lineno"> 2389</span>  pthread_mutex_unlock(&req->se->lock);</div><div class="line"><a name="l02390"></a><span class="lineno"> 2390</span> </div><div class="line"><a name="l02391"></a><span class="lineno"> 2391</span>  <span class="keywordflow">return</span> interrupted;</div><div class="line"><a name="l02392"></a><span class="lineno"> 2392</span> }</div><div class="line"><a name="l02393"></a><span class="lineno"> 2393</span> </div><div class="line"><a name="l02394"></a><span class="lineno"> 2394</span> <span class="keyword">static</span> <span class="keyword">struct </span>{</div><div class="line"><a name="l02395"></a><span class="lineno"> 2395</span>  void (*func)(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a>, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *);</div><div class="line"><a name="l02396"></a><span class="lineno"> 2396</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name;</div><div class="line"><a name="l02397"></a><span class="lineno"> 2397</span> } fuse_ll_ops[] = {</div><div class="line"><a name="l02398"></a><span class="lineno"> 2398</span>  [FUSE_LOOKUP] = { do_lookup, <span class="stringliteral">"LOOKUP"</span> },</div><div class="line"><a name="l02399"></a><span class="lineno"> 2399</span>  [FUSE_FORGET] = { do_forget, <span class="stringliteral">"FORGET"</span> },</div><div class="line"><a name="l02400"></a><span class="lineno"> 2400</span>  [FUSE_GETATTR] = { do_getattr, <span class="stringliteral">"GETATTR"</span> },</div><div class="line"><a name="l02401"></a><span class="lineno"> 2401</span>  [FUSE_SETATTR] = { do_setattr, <span class="stringliteral">"SETATTR"</span> },</div><div class="line"><a name="l02402"></a><span class="lineno"> 2402</span>  [FUSE_READLINK] = { do_readlink, <span class="stringliteral">"READLINK"</span> },</div><div class="line"><a name="l02403"></a><span class="lineno"> 2403</span>  [FUSE_SYMLINK] = { do_symlink, <span class="stringliteral">"SYMLINK"</span> },</div><div class="line"><a name="l02404"></a><span class="lineno"> 2404</span>  [FUSE_MKNOD] = { do_mknod, <span class="stringliteral">"MKNOD"</span> },</div><div class="line"><a name="l02405"></a><span class="lineno"> 2405</span>  [FUSE_MKDIR] = { do_mkdir, <span class="stringliteral">"MKDIR"</span> },</div><div class="line"><a name="l02406"></a><span class="lineno"> 2406</span>  [FUSE_UNLINK] = { do_unlink, <span class="stringliteral">"UNLINK"</span> },</div><div class="line"><a name="l02407"></a><span class="lineno"> 2407</span>  [FUSE_RMDIR] = { do_rmdir, <span class="stringliteral">"RMDIR"</span> },</div><div class="line"><a name="l02408"></a><span class="lineno"> 2408</span>  [FUSE_RENAME] = { do_rename, <span class="stringliteral">"RENAME"</span> },</div><div class="line"><a name="l02409"></a><span class="lineno"> 2409</span>  [FUSE_LINK] = { do_link, <span class="stringliteral">"LINK"</span> },</div><div class="line"><a name="l02410"></a><span class="lineno"> 2410</span>  [FUSE_OPEN] = { do_open, <span class="stringliteral">"OPEN"</span> },</div><div class="line"><a name="l02411"></a><span class="lineno"> 2411</span>  [FUSE_READ] = { do_read, <span class="stringliteral">"READ"</span> },</div><div class="line"><a name="l02412"></a><span class="lineno"> 2412</span>  [FUSE_WRITE] = { do_write, <span class="stringliteral">"WRITE"</span> },</div><div class="line"><a name="l02413"></a><span class="lineno"> 2413</span>  [FUSE_STATFS] = { do_statfs, <span class="stringliteral">"STATFS"</span> },</div><div class="line"><a name="l02414"></a><span class="lineno"> 2414</span>  [FUSE_RELEASE] = { do_release, <span class="stringliteral">"RELEASE"</span> },</div><div class="line"><a name="l02415"></a><span class="lineno"> 2415</span>  [FUSE_FSYNC] = { do_fsync, <span class="stringliteral">"FSYNC"</span> },</div><div class="line"><a name="l02416"></a><span class="lineno"> 2416</span>  [FUSE_SETXATTR] = { do_setxattr, <span class="stringliteral">"SETXATTR"</span> },</div><div class="line"><a name="l02417"></a><span class="lineno"> 2417</span>  [FUSE_GETXATTR] = { do_getxattr, <span class="stringliteral">"GETXATTR"</span> },</div><div class="line"><a name="l02418"></a><span class="lineno"> 2418</span>  [FUSE_LISTXATTR] = { do_listxattr, <span class="stringliteral">"LISTXATTR"</span> },</div><div class="line"><a name="l02419"></a><span class="lineno"> 2419</span>  [FUSE_REMOVEXATTR] = { do_removexattr, <span class="stringliteral">"REMOVEXATTR"</span> },</div><div class="line"><a name="l02420"></a><span class="lineno"> 2420</span>  [FUSE_FLUSH] = { do_flush, <span class="stringliteral">"FLUSH"</span> },</div><div class="line"><a name="l02421"></a><span class="lineno"> 2421</span>  [FUSE_INIT] = { do_init, <span class="stringliteral">"INIT"</span> },</div><div class="line"><a name="l02422"></a><span class="lineno"> 2422</span>  [FUSE_OPENDIR] = { do_opendir, <span class="stringliteral">"OPENDIR"</span> },</div><div class="line"><a name="l02423"></a><span class="lineno"> 2423</span>  [FUSE_READDIR] = { do_readdir, <span class="stringliteral">"READDIR"</span> },</div><div class="line"><a name="l02424"></a><span class="lineno"> 2424</span>  [FUSE_RELEASEDIR] = { do_releasedir, <span class="stringliteral">"RELEASEDIR"</span> },</div><div class="line"><a name="l02425"></a><span class="lineno"> 2425</span>  [FUSE_FSYNCDIR] = { do_fsyncdir, <span class="stringliteral">"FSYNCDIR"</span> },</div><div class="line"><a name="l02426"></a><span class="lineno"> 2426</span>  [FUSE_GETLK] = { do_getlk, <span class="stringliteral">"GETLK"</span> },</div><div class="line"><a name="l02427"></a><span class="lineno"> 2427</span>  [FUSE_SETLK] = { do_setlk, <span class="stringliteral">"SETLK"</span> },</div><div class="line"><a name="l02428"></a><span class="lineno"> 2428</span>  [FUSE_SETLKW] = { do_setlkw, <span class="stringliteral">"SETLKW"</span> },</div><div class="line"><a name="l02429"></a><span class="lineno"> 2429</span>  [FUSE_ACCESS] = { do_access, <span class="stringliteral">"ACCESS"</span> },</div><div class="line"><a name="l02430"></a><span class="lineno"> 2430</span>  [FUSE_CREATE] = { do_create, <span class="stringliteral">"CREATE"</span> },</div><div class="line"><a name="l02431"></a><span class="lineno"> 2431</span>  [FUSE_INTERRUPT] = { do_interrupt, <span class="stringliteral">"INTERRUPT"</span> },</div><div class="line"><a name="l02432"></a><span class="lineno"> 2432</span>  [FUSE_BMAP] = { do_bmap, <span class="stringliteral">"BMAP"</span> },</div><div class="line"><a name="l02433"></a><span class="lineno"> 2433</span>  [FUSE_IOCTL] = { do_ioctl, <span class="stringliteral">"IOCTL"</span> },</div><div class="line"><a name="l02434"></a><span class="lineno"> 2434</span>  [FUSE_POLL] = { do_poll, <span class="stringliteral">"POLL"</span> },</div><div class="line"><a name="l02435"></a><span class="lineno"> 2435</span>  [FUSE_FALLOCATE] = { do_fallocate, <span class="stringliteral">"FALLOCATE"</span> },</div><div class="line"><a name="l02436"></a><span class="lineno"> 2436</span>  [FUSE_DESTROY] = { do_destroy, <span class="stringliteral">"DESTROY"</span> },</div><div class="line"><a name="l02437"></a><span class="lineno"> 2437</span>  [FUSE_NOTIFY_REPLY] = { (<span class="keywordtype">void</span> *) 1, <span class="stringliteral">"NOTIFY_REPLY"</span> },</div><div class="line"><a name="l02438"></a><span class="lineno"> 2438</span>  [FUSE_BATCH_FORGET] = { do_batch_forget, <span class="stringliteral">"BATCH_FORGET"</span> },</div><div class="line"><a name="l02439"></a><span class="lineno"> 2439</span>  [FUSE_READDIRPLUS] = { do_readdirplus, <span class="stringliteral">"READDIRPLUS"</span>},</div><div class="line"><a name="l02440"></a><span class="lineno"> 2440</span>  [FUSE_RENAME2] = { do_rename2, <span class="stringliteral">"RENAME2"</span> },</div><div class="line"><a name="l02441"></a><span class="lineno"> 2441</span>  [FUSE_COPY_FILE_RANGE] = { do_copy_file_range, <span class="stringliteral">"COPY_FILE_RANGE"</span> },</div><div class="line"><a name="l02442"></a><span class="lineno"> 2442</span>  [CUSE_INIT] = { cuse_lowlevel_init, <span class="stringliteral">"CUSE_INIT"</span> },</div><div class="line"><a name="l02443"></a><span class="lineno"> 2443</span> };</div><div class="line"><a name="l02444"></a><span class="lineno"> 2444</span> </div><div class="line"><a name="l02445"></a><span class="lineno"> 2445</span> <span class="preprocessor">#define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))</span></div><div class="line"><a name="l02446"></a><span class="lineno"> 2446</span> </div><div class="line"><a name="l02447"></a><span class="lineno"> 2447</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *opname(<span class="keyword">enum</span> fuse_opcode opcode)</div><div class="line"><a name="l02448"></a><span class="lineno"> 2448</span> {</div><div class="line"><a name="l02449"></a><span class="lineno"> 2449</span>  <span class="keywordflow">if</span> (opcode >= FUSE_MAXOP || !fuse_ll_ops[opcode].name)</div><div class="line"><a name="l02450"></a><span class="lineno"> 2450</span>  <span class="keywordflow">return</span> <span class="stringliteral">"???"</span>;</div><div class="line"><a name="l02451"></a><span class="lineno"> 2451</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l02452"></a><span class="lineno"> 2452</span>  <span class="keywordflow">return</span> fuse_ll_ops[opcode].name;</div><div class="line"><a name="l02453"></a><span class="lineno"> 2453</span> }</div><div class="line"><a name="l02454"></a><span class="lineno"> 2454</span> </div><div class="line"><a name="l02455"></a><span class="lineno"> 2455</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_ll_copy_from_pipe(<span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *dst,</div><div class="line"><a name="l02456"></a><span class="lineno"> 2456</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *src)</div><div class="line"><a name="l02457"></a><span class="lineno"> 2457</span> {</div><div class="line"><a name="l02458"></a><span class="lineno"> 2458</span>  ssize_t res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(dst, src, 0);</div><div class="line"><a name="l02459"></a><span class="lineno"> 2459</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l02460"></a><span class="lineno"> 2460</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: %s\n"</span>, strerror(-res));</div><div class="line"><a name="l02461"></a><span class="lineno"> 2461</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02462"></a><span class="lineno"> 2462</span>  }</div><div class="line"><a name="l02463"></a><span class="lineno"> 2463</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>)res < <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(dst)) {</div><div class="line"><a name="l02464"></a><span class="lineno"> 2464</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: short read\n"</span>);</div><div class="line"><a name="l02465"></a><span class="lineno"> 2465</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02466"></a><span class="lineno"> 2466</span>  }</div><div class="line"><a name="l02467"></a><span class="lineno"> 2467</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02468"></a><span class="lineno"> 2468</span> }</div><div class="line"><a name="l02469"></a><span class="lineno"> 2469</span> </div><div class="line"><a name="l02470"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a411ee86ec4657ea954402a9ca263e6d0"> 2470</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a411ee86ec4657ea954402a9ca263e6d0">fuse_session_process_buf</a>(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02471"></a><span class="lineno"> 2471</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02472"></a><span class="lineno"> 2472</span> {</div><div class="line"><a name="l02473"></a><span class="lineno"> 2473</span>  fuse_session_process_buf_int(se, buf, NULL);</div><div class="line"><a name="l02474"></a><span class="lineno"> 2474</span> }</div><div class="line"><a name="l02475"></a><span class="lineno"> 2475</span> </div><div class="line"><a name="l02476"></a><span class="lineno"> 2476</span> <span class="keywordtype">void</span> fuse_session_process_buf_int(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02477"></a><span class="lineno"> 2477</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf, <span class="keyword">struct</span> fuse_chan *ch)</div><div class="line"><a name="l02478"></a><span class="lineno"> 2478</span> {</div><div class="line"><a name="l02479"></a><span class="lineno"> 2479</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> write_header_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l02480"></a><span class="lineno"> 2480</span>  sizeof(struct fuse_write_in);</div><div class="line"><a name="l02481"></a><span class="lineno"> 2481</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = { .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>, .count = 1 };</div><div class="line"><a name="l02482"></a><span class="lineno"> 2482</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> tmpbuf = FUSE_BUFVEC_INIT(write_header_size);</div><div class="line"><a name="l02483"></a><span class="lineno"> 2483</span>  <span class="keyword">struct </span>fuse_in_header *in;</div><div class="line"><a name="l02484"></a><span class="lineno"> 2484</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg;</div><div class="line"><a name="l02485"></a><span class="lineno"> 2485</span>  <span class="keyword">struct </span>fuse_req *req;</div><div class="line"><a name="l02486"></a><span class="lineno"> 2486</span>  <span class="keywordtype">void</span> *mbuf = NULL;</div><div class="line"><a name="l02487"></a><span class="lineno"> 2487</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02488"></a><span class="lineno"> 2488</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l02489"></a><span class="lineno"> 2489</span> </div><div class="line"><a name="l02490"></a><span class="lineno"> 2490</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>) {</div><div class="line"><a name="l02491"></a><span class="lineno"> 2491</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>)</div><div class="line"><a name="l02492"></a><span class="lineno"> 2492</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>;</div><div class="line"><a name="l02493"></a><span class="lineno"> 2493</span> </div><div class="line"><a name="l02494"></a><span class="lineno"> 2494</span>  mbuf = malloc(tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>);</div><div class="line"><a name="l02495"></a><span class="lineno"> 2495</span>  <span class="keywordflow">if</span> (mbuf == NULL) {</div><div class="line"><a name="l02496"></a><span class="lineno"> 2496</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate header\n"</span>);</div><div class="line"><a name="l02497"></a><span class="lineno"> 2497</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02498"></a><span class="lineno"> 2498</span>  }</div><div class="line"><a name="l02499"></a><span class="lineno"> 2499</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l02500"></a><span class="lineno"> 2500</span> </div><div class="line"><a name="l02501"></a><span class="lineno"> 2501</span>  res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);</div><div class="line"><a name="l02502"></a><span class="lineno"> 2502</span>  <span class="keywordflow">if</span> (res < 0)</div><div class="line"><a name="l02503"></a><span class="lineno"> 2503</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02504"></a><span class="lineno"> 2504</span> </div><div class="line"><a name="l02505"></a><span class="lineno"> 2505</span>  in = mbuf;</div><div class="line"><a name="l02506"></a><span class="lineno"> 2506</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02507"></a><span class="lineno"> 2507</span>  in = buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>;</div><div class="line"><a name="l02508"></a><span class="lineno"> 2508</span>  }</div><div class="line"><a name="l02509"></a><span class="lineno"> 2509</span> </div><div class="line"><a name="l02510"></a><span class="lineno"> 2510</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l02511"></a><span class="lineno"> 2511</span>  fprintf(stderr,</div><div class="line"><a name="l02512"></a><span class="lineno"> 2512</span>  <span class="stringliteral">"unique: %llu, opcode: %s (%i), nodeid: %llu, insize: %zu, pid: %u\n"</span>,</div><div class="line"><a name="l02513"></a><span class="lineno"> 2513</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) in->unique,</div><div class="line"><a name="l02514"></a><span class="lineno"> 2514</span>  opname((<span class="keyword">enum</span> fuse_opcode) in->opcode), in->opcode,</div><div class="line"><a name="l02515"></a><span class="lineno"> 2515</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) in->nodeid, buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>, in->pid);</div><div class="line"><a name="l02516"></a><span class="lineno"> 2516</span>  }</div><div class="line"><a name="l02517"></a><span class="lineno"> 2517</span> </div><div class="line"><a name="l02518"></a><span class="lineno"> 2518</span>  req = fuse_ll_alloc_req(se);</div><div class="line"><a name="l02519"></a><span class="lineno"> 2519</span>  <span class="keywordflow">if</span> (req == NULL) {</div><div class="line"><a name="l02520"></a><span class="lineno"> 2520</span>  <span class="keyword">struct </span>fuse_out_header out = {</div><div class="line"><a name="l02521"></a><span class="lineno"> 2521</span>  .unique = in->unique,</div><div class="line"><a name="l02522"></a><span class="lineno"> 2522</span>  .error = -ENOMEM,</div><div class="line"><a name="l02523"></a><span class="lineno"> 2523</span>  };</div><div class="line"><a name="l02524"></a><span class="lineno"> 2524</span>  <span class="keyword">struct </span>iovec iov = {</div><div class="line"><a name="l02525"></a><span class="lineno"> 2525</span>  .iov_base = &out,</div><div class="line"><a name="l02526"></a><span class="lineno"> 2526</span>  .iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header),</div><div class="line"><a name="l02527"></a><span class="lineno"> 2527</span>  };</div><div class="line"><a name="l02528"></a><span class="lineno"> 2528</span> </div><div class="line"><a name="l02529"></a><span class="lineno"> 2529</span>  fuse_send_msg(se, ch, &iov, 1);</div><div class="line"><a name="l02530"></a><span class="lineno"> 2530</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02531"></a><span class="lineno"> 2531</span>  }</div><div class="line"><a name="l02532"></a><span class="lineno"> 2532</span> </div><div class="line"><a name="l02533"></a><span class="lineno"> 2533</span>  req->unique = in->unique;</div><div class="line"><a name="l02534"></a><span class="lineno"> 2534</span>  req->ctx.uid = in->uid;</div><div class="line"><a name="l02535"></a><span class="lineno"> 2535</span>  req->ctx.gid = in->gid;</div><div class="line"><a name="l02536"></a><span class="lineno"> 2536</span>  req->ctx.pid = in->pid;</div><div class="line"><a name="l02537"></a><span class="lineno"> 2537</span>  req->ch = ch ? fuse_chan_get(ch) : NULL;</div><div class="line"><a name="l02538"></a><span class="lineno"> 2538</span> </div><div class="line"><a name="l02539"></a><span class="lineno"> 2539</span>  err = EIO;</div><div class="line"><a name="l02540"></a><span class="lineno"> 2540</span>  <span class="keywordflow">if</span> (!se->got_init) {</div><div class="line"><a name="l02541"></a><span class="lineno"> 2541</span>  <span class="keyword">enum</span> fuse_opcode expected;</div><div class="line"><a name="l02542"></a><span class="lineno"> 2542</span> </div><div class="line"><a name="l02543"></a><span class="lineno"> 2543</span>  expected = se->cuse_data ? CUSE_INIT : FUSE_INIT;</div><div class="line"><a name="l02544"></a><span class="lineno"> 2544</span>  <span class="keywordflow">if</span> (in->opcode != expected)</div><div class="line"><a name="l02545"></a><span class="lineno"> 2545</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02546"></a><span class="lineno"> 2546</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (in->opcode == FUSE_INIT || in->opcode == CUSE_INIT)</div><div class="line"><a name="l02547"></a><span class="lineno"> 2547</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02548"></a><span class="lineno"> 2548</span> </div><div class="line"><a name="l02549"></a><span class="lineno"> 2549</span>  err = EACCES;</div><div class="line"><a name="l02550"></a><span class="lineno"> 2550</span>  <span class="comment">/* Implement -o allow_root */</span></div><div class="line"><a name="l02551"></a><span class="lineno"> 2551</span>  <span class="keywordflow">if</span> (se->deny_others && in->uid != se->owner && in->uid != 0 &&</div><div class="line"><a name="l02552"></a><span class="lineno"> 2552</span>  in->opcode != FUSE_INIT && in->opcode != FUSE_READ &&</div><div class="line"><a name="l02553"></a><span class="lineno"> 2553</span>  in->opcode != FUSE_WRITE && in->opcode != FUSE_FSYNC &&</div><div class="line"><a name="l02554"></a><span class="lineno"> 2554</span>  in->opcode != FUSE_RELEASE && in->opcode != FUSE_READDIR &&</div><div class="line"><a name="l02555"></a><span class="lineno"> 2555</span>  in->opcode != FUSE_FSYNCDIR && in->opcode != FUSE_RELEASEDIR &&</div><div class="line"><a name="l02556"></a><span class="lineno"> 2556</span>  in->opcode != FUSE_NOTIFY_REPLY &&</div><div class="line"><a name="l02557"></a><span class="lineno"> 2557</span>  in->opcode != FUSE_READDIRPLUS)</div><div class="line"><a name="l02558"></a><span class="lineno"> 2558</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02559"></a><span class="lineno"> 2559</span> </div><div class="line"><a name="l02560"></a><span class="lineno"> 2560</span>  err = ENOSYS;</div><div class="line"><a name="l02561"></a><span class="lineno"> 2561</span>  <span class="keywordflow">if</span> (in->opcode >= FUSE_MAXOP || !fuse_ll_ops[in->opcode].func)</div><div class="line"><a name="l02562"></a><span class="lineno"> 2562</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02563"></a><span class="lineno"> 2563</span>  <span class="keywordflow">if</span> (in->opcode != FUSE_INTERRUPT) {</div><div class="line"><a name="l02564"></a><span class="lineno"> 2564</span>  <span class="keyword">struct </span>fuse_req *intr;</div><div class="line"><a name="l02565"></a><span class="lineno"> 2565</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02566"></a><span class="lineno"> 2566</span>  intr = check_interrupt(se, req);</div><div class="line"><a name="l02567"></a><span class="lineno"> 2567</span>  list_add_req(req, &se->list);</div><div class="line"><a name="l02568"></a><span class="lineno"> 2568</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02569"></a><span class="lineno"> 2569</span>  <span class="keywordflow">if</span> (intr)</div><div class="line"><a name="l02570"></a><span class="lineno"> 2570</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(intr, EAGAIN);</div><div class="line"><a name="l02571"></a><span class="lineno"> 2571</span>  }</div><div class="line"><a name="l02572"></a><span class="lineno"> 2572</span> </div><div class="line"><a name="l02573"></a><span class="lineno"> 2573</span>  <span class="keywordflow">if</span> ((buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>) && write_header_size < buf->size &&</div><div class="line"><a name="l02574"></a><span class="lineno"> 2574</span>  (in->opcode != FUSE_WRITE || !se->op.write_buf) &&</div><div class="line"><a name="l02575"></a><span class="lineno"> 2575</span>  in->opcode != FUSE_NOTIFY_REPLY) {</div><div class="line"><a name="l02576"></a><span class="lineno"> 2576</span>  <span class="keywordtype">void</span> *newmbuf;</div><div class="line"><a name="l02577"></a><span class="lineno"> 2577</span> </div><div class="line"><a name="l02578"></a><span class="lineno"> 2578</span>  err = ENOMEM;</div><div class="line"><a name="l02579"></a><span class="lineno"> 2579</span>  newmbuf = realloc(mbuf, buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>);</div><div class="line"><a name="l02580"></a><span class="lineno"> 2580</span>  <span class="keywordflow">if</span> (newmbuf == NULL)</div><div class="line"><a name="l02581"></a><span class="lineno"> 2581</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02582"></a><span class="lineno"> 2582</span>  mbuf = newmbuf;</div><div class="line"><a name="l02583"></a><span class="lineno"> 2583</span> </div><div class="line"><a name="l02584"></a><span class="lineno"> 2584</span>  tmpbuf = FUSE_BUFVEC_INIT(buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> - write_header_size);</div><div class="line"><a name="l02585"></a><span class="lineno"> 2585</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = (<span class="keywordtype">char</span> *)mbuf + write_header_size;</div><div class="line"><a name="l02586"></a><span class="lineno"> 2586</span> </div><div class="line"><a name="l02587"></a><span class="lineno"> 2587</span>  res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);</div><div class="line"><a name="l02588"></a><span class="lineno"> 2588</span>  err = -res;</div><div class="line"><a name="l02589"></a><span class="lineno"> 2589</span>  <span class="keywordflow">if</span> (res < 0)</div><div class="line"><a name="l02590"></a><span class="lineno"> 2590</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02591"></a><span class="lineno"> 2591</span> </div><div class="line"><a name="l02592"></a><span class="lineno"> 2592</span>  in = mbuf;</div><div class="line"><a name="l02593"></a><span class="lineno"> 2593</span>  }</div><div class="line"><a name="l02594"></a><span class="lineno"> 2594</span> </div><div class="line"><a name="l02595"></a><span class="lineno"> 2595</span>  inarg = (<span class="keywordtype">void</span> *) &in[1];</div><div class="line"><a name="l02596"></a><span class="lineno"> 2596</span>  <span class="keywordflow">if</span> (in->opcode == FUSE_WRITE && se->op.write_buf)</div><div class="line"><a name="l02597"></a><span class="lineno"> 2597</span>  do_write_buf(req, in->nodeid, inarg, buf);</div><div class="line"><a name="l02598"></a><span class="lineno"> 2598</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (in->opcode == FUSE_NOTIFY_REPLY)</div><div class="line"><a name="l02599"></a><span class="lineno"> 2599</span>  do_notify_reply(req, in->nodeid, inarg, buf);</div><div class="line"><a name="l02600"></a><span class="lineno"> 2600</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l02601"></a><span class="lineno"> 2601</span>  fuse_ll_ops[in->opcode].func(req, in->nodeid, inarg);</div><div class="line"><a name="l02602"></a><span class="lineno"> 2602</span> </div><div class="line"><a name="l02603"></a><span class="lineno"> 2603</span> out_free:</div><div class="line"><a name="l02604"></a><span class="lineno"> 2604</span>  free(mbuf);</div><div class="line"><a name="l02605"></a><span class="lineno"> 2605</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l02606"></a><span class="lineno"> 2606</span> </div><div class="line"><a name="l02607"></a><span class="lineno"> 2607</span> reply_err:</div><div class="line"><a name="l02608"></a><span class="lineno"> 2608</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, err);</div><div class="line"><a name="l02609"></a><span class="lineno"> 2609</span> clear_pipe:</div><div class="line"><a name="l02610"></a><span class="lineno"> 2610</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>)</div><div class="line"><a name="l02611"></a><span class="lineno"> 2611</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02612"></a><span class="lineno"> 2612</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l02613"></a><span class="lineno"> 2613</span> }</div><div class="line"><a name="l02614"></a><span class="lineno"> 2614</span> </div><div class="line"><a name="l02615"></a><span class="lineno"> 2615</span> <span class="preprocessor">#define LL_OPTION(n,o,v) \</span></div><div class="line"><a name="l02616"></a><span class="lineno"> 2616</span> <span class="preprocessor"> { n, offsetof(struct fuse_session, o), v }</span></div><div class="line"><a name="l02617"></a><span class="lineno"> 2617</span> </div><div class="line"><a name="l02618"></a><span class="lineno"> 2618</span> <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> fuse_ll_opts[] = {</div><div class="line"><a name="l02619"></a><span class="lineno"> 2619</span>  LL_OPTION(<span class="stringliteral">"debug"</span>, debug, 1),</div><div class="line"><a name="l02620"></a><span class="lineno"> 2620</span>  LL_OPTION(<span class="stringliteral">"-d"</span>, debug, 1),</div><div class="line"><a name="l02621"></a><span class="lineno"> 2621</span>  LL_OPTION(<span class="stringliteral">"--debug"</span>, debug, 1),</div><div class="line"><a name="l02622"></a><span class="lineno"> 2622</span>  LL_OPTION(<span class="stringliteral">"allow_root"</span>, deny_others, 1),</div><div class="line"><a name="l02623"></a><span class="lineno"> 2623</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#aca35962e17d189ceb5447f8eea11bd33">FUSE_OPT_END</a></div><div class="line"><a name="l02624"></a><span class="lineno"> 2624</span> };</div><div class="line"><a name="l02625"></a><span class="lineno"> 2625</span> </div><div class="line"><a name="l02626"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ac6e2d0fde62dcf4f0e57afeabeefd7b1"> 2626</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ac6e2d0fde62dcf4f0e57afeabeefd7b1">fuse_lowlevel_version</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l02627"></a><span class="lineno"> 2627</span> {</div><div class="line"><a name="l02628"></a><span class="lineno"> 2628</span>  printf(<span class="stringliteral">"using FUSE kernel interface version %i.%i\n"</span>,</div><div class="line"><a name="l02629"></a><span class="lineno"> 2629</span>  FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION);</div><div class="line"><a name="l02630"></a><span class="lineno"> 2630</span>  fuse_mount_version();</div><div class="line"><a name="l02631"></a><span class="lineno"> 2631</span> }</div><div class="line"><a name="l02632"></a><span class="lineno"> 2632</span> </div><div class="line"><a name="l02633"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a990af0becaba1b5e45781d399720f85e"> 2633</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a990af0becaba1b5e45781d399720f85e">fuse_lowlevel_help</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l02634"></a><span class="lineno"> 2634</span> {</div><div class="line"><a name="l02635"></a><span class="lineno"> 2635</span>  <span class="comment">/* These are not all options, but the ones that are</span></div><div class="line"><a name="l02636"></a><span class="lineno"> 2636</span> <span class="comment"> potentially of interest to an end-user */</span></div><div class="line"><a name="l02637"></a><span class="lineno"> 2637</span>  printf(</div><div class="line"><a name="l02638"></a><span class="lineno"> 2638</span> <span class="stringliteral">" -o allow_other allow access by all users\n"</span></div><div class="line"><a name="l02639"></a><span class="lineno"> 2639</span> <span class="stringliteral">" -o allow_root allow access by root\n"</span></div><div class="line"><a name="l02640"></a><span class="lineno"> 2640</span> <span class="stringliteral">" -o auto_unmount auto unmount on process termination\n"</span>);</div><div class="line"><a name="l02641"></a><span class="lineno"> 2641</span> }</div><div class="line"><a name="l02642"></a><span class="lineno"> 2642</span> </div><div class="line"><a name="l02643"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a08b5503c4e9656f9c4bc88331233cc65"> 2643</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a08b5503c4e9656f9c4bc88331233cc65">fuse_session_destroy</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02644"></a><span class="lineno"> 2644</span> {</div><div class="line"><a name="l02645"></a><span class="lineno"> 2645</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l02646"></a><span class="lineno"> 2646</span> </div><div class="line"><a name="l02647"></a><span class="lineno"> 2647</span>  <span class="keywordflow">if</span> (se->got_init && !se->got_destroy) {</div><div class="line"><a name="l02648"></a><span class="lineno"> 2648</span>  <span class="keywordflow">if</span> (se->op.destroy)</div><div class="line"><a name="l02649"></a><span class="lineno"> 2649</span>  se->op.destroy(se->userdata);</div><div class="line"><a name="l02650"></a><span class="lineno"> 2650</span>  }</div><div class="line"><a name="l02651"></a><span class="lineno"> 2651</span>  llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l02652"></a><span class="lineno"> 2652</span>  <span class="keywordflow">if</span> (llp != NULL)</div><div class="line"><a name="l02653"></a><span class="lineno"> 2653</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l02654"></a><span class="lineno"> 2654</span>  pthread_key_delete(se->pipe_key);</div><div class="line"><a name="l02655"></a><span class="lineno"> 2655</span>  pthread_mutex_destroy(&se->lock);</div><div class="line"><a name="l02656"></a><span class="lineno"> 2656</span>  free(se->cuse_data);</div><div class="line"><a name="l02657"></a><span class="lineno"> 2657</span>  <span class="keywordflow">if</span> (se->fd != -1)</div><div class="line"><a name="l02658"></a><span class="lineno"> 2658</span>  close(se->fd);</div><div class="line"><a name="l02659"></a><span class="lineno"> 2659</span>  destroy_mount_opts(se->mo);</div><div class="line"><a name="l02660"></a><span class="lineno"> 2660</span>  free(se);</div><div class="line"><a name="l02661"></a><span class="lineno"> 2661</span> }</div><div class="line"><a name="l02662"></a><span class="lineno"> 2662</span> </div><div class="line"><a name="l02663"></a><span class="lineno"> 2663</span> </div><div class="line"><a name="l02664"></a><span class="lineno"> 2664</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_pipe_destructor(<span class="keywordtype">void</span> *data)</div><div class="line"><a name="l02665"></a><span class="lineno"> 2665</span> {</div><div class="line"><a name="l02666"></a><span class="lineno"> 2666</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = data;</div><div class="line"><a name="l02667"></a><span class="lineno"> 2667</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l02668"></a><span class="lineno"> 2668</span> }</div><div class="line"><a name="l02669"></a><span class="lineno"> 2669</span> </div><div class="line"><a name="l02670"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#aa434f1c9e7d71c4ed219c4dc3b1deae7"> 2670</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa434f1c9e7d71c4ed219c4dc3b1deae7">fuse_session_receive_buf</a>(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02671"></a><span class="lineno"> 2671</span> {</div><div class="line"><a name="l02672"></a><span class="lineno"> 2672</span>  <span class="keywordflow">return</span> fuse_session_receive_buf_int(se, buf, NULL);</div><div class="line"><a name="l02673"></a><span class="lineno"> 2673</span> }</div><div class="line"><a name="l02674"></a><span class="lineno"> 2674</span> </div><div class="line"><a name="l02675"></a><span class="lineno"> 2675</span> <span class="keywordtype">int</span> fuse_session_receive_buf_int(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf,</div><div class="line"><a name="l02676"></a><span class="lineno"> 2676</span>  <span class="keyword">struct</span> fuse_chan *ch)</div><div class="line"><a name="l02677"></a><span class="lineno"> 2677</span> {</div><div class="line"><a name="l02678"></a><span class="lineno"> 2678</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02679"></a><span class="lineno"> 2679</span>  ssize_t res;</div><div class="line"><a name="l02680"></a><span class="lineno"> 2680</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l02681"></a><span class="lineno"> 2681</span>  <span class="keywordtype">size_t</span> bufsize = se->bufsize;</div><div class="line"><a name="l02682"></a><span class="lineno"> 2682</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l02683"></a><span class="lineno"> 2683</span>  <span class="keyword">struct </span><a class="code" href="structfuse__buf.html">fuse_buf</a> tmpbuf;</div><div class="line"><a name="l02684"></a><span class="lineno"> 2684</span> </div><div class="line"><a name="l02685"></a><span class="lineno"> 2685</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 14 || !(se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>))</div><div class="line"><a name="l02686"></a><span class="lineno"> 2686</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02687"></a><span class="lineno"> 2687</span> </div><div class="line"><a name="l02688"></a><span class="lineno"> 2688</span>  llp = fuse_ll_get_pipe(se);</div><div class="line"><a name="l02689"></a><span class="lineno"> 2689</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l02690"></a><span class="lineno"> 2690</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02691"></a><span class="lineno"> 2691</span> </div><div class="line"><a name="l02692"></a><span class="lineno"> 2692</span>  <span class="keywordflow">if</span> (llp->size < bufsize) {</div><div class="line"><a name="l02693"></a><span class="lineno"> 2693</span>  <span class="keywordflow">if</span> (llp->can_grow) {</div><div class="line"><a name="l02694"></a><span class="lineno"> 2694</span>  res = fcntl(llp->pipe[0], F_SETPIPE_SZ, bufsize);</div><div class="line"><a name="l02695"></a><span class="lineno"> 2695</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02696"></a><span class="lineno"> 2696</span>  llp->can_grow = 0;</div><div class="line"><a name="l02697"></a><span class="lineno"> 2697</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02698"></a><span class="lineno"> 2698</span>  }</div><div class="line"><a name="l02699"></a><span class="lineno"> 2699</span>  llp->size = res;</div><div class="line"><a name="l02700"></a><span class="lineno"> 2700</span>  }</div><div class="line"><a name="l02701"></a><span class="lineno"> 2701</span>  <span class="keywordflow">if</span> (llp->size < bufsize)</div><div class="line"><a name="l02702"></a><span class="lineno"> 2702</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02703"></a><span class="lineno"> 2703</span>  }</div><div class="line"><a name="l02704"></a><span class="lineno"> 2704</span> </div><div class="line"><a name="l02705"></a><span class="lineno"> 2705</span>  res = splice(ch ? ch->fd : se->fd,</div><div class="line"><a name="l02706"></a><span class="lineno"> 2706</span>  NULL, llp->pipe[1], NULL, bufsize, 0);</div><div class="line"><a name="l02707"></a><span class="lineno"> 2707</span>  err = errno;</div><div class="line"><a name="l02708"></a><span class="lineno"> 2708</span> </div><div class="line"><a name="l02709"></a><span class="lineno"> 2709</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se))</div><div class="line"><a name="l02710"></a><span class="lineno"> 2710</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02711"></a><span class="lineno"> 2711</span> </div><div class="line"><a name="l02712"></a><span class="lineno"> 2712</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02713"></a><span class="lineno"> 2713</span>  <span class="keywordflow">if</span> (err == ENODEV) {</div><div class="line"><a name="l02714"></a><span class="lineno"> 2714</span>  <span class="comment">/* Filesystem was unmounted, or connection was aborted</span></div><div class="line"><a name="l02715"></a><span class="lineno"> 2715</span> <span class="comment"> via /sys/fs/fuse/connections */</span></div><div class="line"><a name="l02716"></a><span class="lineno"> 2716</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l02717"></a><span class="lineno"> 2717</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02718"></a><span class="lineno"> 2718</span>  }</div><div class="line"><a name="l02719"></a><span class="lineno"> 2719</span>  <span class="keywordflow">if</span> (err != EINTR && err != EAGAIN)</div><div class="line"><a name="l02720"></a><span class="lineno"> 2720</span>  perror(<span class="stringliteral">"fuse: splice from device"</span>);</div><div class="line"><a name="l02721"></a><span class="lineno"> 2721</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l02722"></a><span class="lineno"> 2722</span>  }</div><div class="line"><a name="l02723"></a><span class="lineno"> 2723</span> </div><div class="line"><a name="l02724"></a><span class="lineno"> 2724</span>  <span class="keywordflow">if</span> (res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header)) {</div><div class="line"><a name="l02725"></a><span class="lineno"> 2725</span>  fprintf(stderr, <span class="stringliteral">"short splice from fuse device\n"</span>);</div><div class="line"><a name="l02726"></a><span class="lineno"> 2726</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02727"></a><span class="lineno"> 2727</span>  }</div><div class="line"><a name="l02728"></a><span class="lineno"> 2728</span> </div><div class="line"><a name="l02729"></a><span class="lineno"> 2729</span>  tmpbuf = (<span class="keyword">struct </span><a class="code" href="structfuse__buf.html">fuse_buf</a>) {</div><div class="line"><a name="l02730"></a><span class="lineno"> 2730</span>  .<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = res,</div><div class="line"><a name="l02731"></a><span class="lineno"> 2731</span>  .flags = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>,</div><div class="line"><a name="l02732"></a><span class="lineno"> 2732</span>  .fd = llp->pipe[0],</div><div class="line"><a name="l02733"></a><span class="lineno"> 2733</span>  };</div><div class="line"><a name="l02734"></a><span class="lineno"> 2734</span> </div><div class="line"><a name="l02735"></a><span class="lineno"> 2735</span>  <span class="comment">/*</span></div><div class="line"><a name="l02736"></a><span class="lineno"> 2736</span> <span class="comment"> * Don't bother with zero copy for small requests.</span></div><div class="line"><a name="l02737"></a><span class="lineno"> 2737</span> <span class="comment"> * fuse_loop_mt() needs to check for FORGET so this more than</span></div><div class="line"><a name="l02738"></a><span class="lineno"> 2738</span> <span class="comment"> * just an optimization.</span></div><div class="line"><a name="l02739"></a><span class="lineno"> 2739</span> <span class="comment"> */</span></div><div class="line"><a name="l02740"></a><span class="lineno"> 2740</span>  <span class="keywordflow">if</span> (res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header) +</div><div class="line"><a name="l02741"></a><span class="lineno"> 2741</span>  <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_write_in) + pagesize) {</div><div class="line"><a name="l02742"></a><span class="lineno"> 2742</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> src = { .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = tmpbuf, .count = 1 };</div><div class="line"><a name="l02743"></a><span class="lineno"> 2743</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> dst = { .<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> = 1 };</div><div class="line"><a name="l02744"></a><span class="lineno"> 2744</span> </div><div class="line"><a name="l02745"></a><span class="lineno"> 2745</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02746"></a><span class="lineno"> 2746</span>  buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = malloc(se->bufsize);</div><div class="line"><a name="l02747"></a><span class="lineno"> 2747</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02748"></a><span class="lineno"> 2748</span>  fprintf(stderr,</div><div class="line"><a name="l02749"></a><span class="lineno"> 2749</span>  <span class="stringliteral">"fuse: failed to allocate read buffer\n"</span>);</div><div class="line"><a name="l02750"></a><span class="lineno"> 2750</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02751"></a><span class="lineno"> 2751</span>  }</div><div class="line"><a name="l02752"></a><span class="lineno"> 2752</span>  }</div><div class="line"><a name="l02753"></a><span class="lineno"> 2753</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = se->bufsize;</div><div class="line"><a name="l02754"></a><span class="lineno"> 2754</span>  buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = 0;</div><div class="line"><a name="l02755"></a><span class="lineno"> 2755</span>  dst.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>;</div><div class="line"><a name="l02756"></a><span class="lineno"> 2756</span> </div><div class="line"><a name="l02757"></a><span class="lineno"> 2757</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&dst, &src, 0);</div><div class="line"><a name="l02758"></a><span class="lineno"> 2758</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l02759"></a><span class="lineno"> 2759</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: %s\n"</span>,</div><div class="line"><a name="l02760"></a><span class="lineno"> 2760</span>  strerror(-res));</div><div class="line"><a name="l02761"></a><span class="lineno"> 2761</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02762"></a><span class="lineno"> 2762</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02763"></a><span class="lineno"> 2763</span>  }</div><div class="line"><a name="l02764"></a><span class="lineno"> 2764</span>  <span class="keywordflow">if</span> (res < tmpbuf.<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>) {</div><div class="line"><a name="l02765"></a><span class="lineno"> 2765</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: short read\n"</span>);</div><div class="line"><a name="l02766"></a><span class="lineno"> 2766</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02767"></a><span class="lineno"> 2767</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02768"></a><span class="lineno"> 2768</span>  }</div><div class="line"><a name="l02769"></a><span class="lineno"> 2769</span>  assert(res == tmpbuf.<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>);</div><div class="line"><a name="l02770"></a><span class="lineno"> 2770</span> </div><div class="line"><a name="l02771"></a><span class="lineno"> 2771</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02772"></a><span class="lineno"> 2772</span>  <span class="comment">/* Don't overwrite buf->mem, as that would cause a leak */</span></div><div class="line"><a name="l02773"></a><span class="lineno"> 2773</span>  buf-><a class="code" href="structfuse__buf.html#a62b2ae82904ac4355142984b9dd90d68">fd</a> = tmpbuf.<a class="code" href="structfuse__buf.html#a62b2ae82904ac4355142984b9dd90d68">fd</a>;</div><div class="line"><a name="l02774"></a><span class="lineno"> 2774</span>  buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = tmpbuf.<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a>;</div><div class="line"><a name="l02775"></a><span class="lineno"> 2775</span>  }</div><div class="line"><a name="l02776"></a><span class="lineno"> 2776</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = tmpbuf.<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>;</div><div class="line"><a name="l02777"></a><span class="lineno"> 2777</span> </div><div class="line"><a name="l02778"></a><span class="lineno"> 2778</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02779"></a><span class="lineno"> 2779</span> </div><div class="line"><a name="l02780"></a><span class="lineno"> 2780</span> fallback:</div><div class="line"><a name="l02781"></a><span class="lineno"> 2781</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l02782"></a><span class="lineno"> 2782</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02783"></a><span class="lineno"> 2783</span>  buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = malloc(se->bufsize);</div><div class="line"><a name="l02784"></a><span class="lineno"> 2784</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02785"></a><span class="lineno"> 2785</span>  fprintf(stderr,</div><div class="line"><a name="l02786"></a><span class="lineno"> 2786</span>  <span class="stringliteral">"fuse: failed to allocate read buffer\n"</span>);</div><div class="line"><a name="l02787"></a><span class="lineno"> 2787</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02788"></a><span class="lineno"> 2788</span>  }</div><div class="line"><a name="l02789"></a><span class="lineno"> 2789</span>  }</div><div class="line"><a name="l02790"></a><span class="lineno"> 2790</span> </div><div class="line"><a name="l02791"></a><span class="lineno"> 2791</span> restart:</div><div class="line"><a name="l02792"></a><span class="lineno"> 2792</span>  res = read(ch ? ch->fd : se->fd, buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>, se->bufsize);</div><div class="line"><a name="l02793"></a><span class="lineno"> 2793</span>  err = errno;</div><div class="line"><a name="l02794"></a><span class="lineno"> 2794</span> </div><div class="line"><a name="l02795"></a><span class="lineno"> 2795</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se))</div><div class="line"><a name="l02796"></a><span class="lineno"> 2796</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02797"></a><span class="lineno"> 2797</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02798"></a><span class="lineno"> 2798</span>  <span class="comment">/* ENOENT means the operation was interrupted, it's safe</span></div><div class="line"><a name="l02799"></a><span class="lineno"> 2799</span> <span class="comment"> to restart */</span></div><div class="line"><a name="l02800"></a><span class="lineno"> 2800</span>  <span class="keywordflow">if</span> (err == ENOENT)</div><div class="line"><a name="l02801"></a><span class="lineno"> 2801</span>  <span class="keywordflow">goto</span> restart;</div><div class="line"><a name="l02802"></a><span class="lineno"> 2802</span> </div><div class="line"><a name="l02803"></a><span class="lineno"> 2803</span>  <span class="keywordflow">if</span> (err == ENODEV) {</div><div class="line"><a name="l02804"></a><span class="lineno"> 2804</span>  <span class="comment">/* Filesystem was unmounted, or connection was aborted</span></div><div class="line"><a name="l02805"></a><span class="lineno"> 2805</span> <span class="comment"> via /sys/fs/fuse/connections */</span></div><div class="line"><a name="l02806"></a><span class="lineno"> 2806</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l02807"></a><span class="lineno"> 2807</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02808"></a><span class="lineno"> 2808</span>  }</div><div class="line"><a name="l02809"></a><span class="lineno"> 2809</span>  <span class="comment">/* Errors occurring during normal operation: EINTR (read</span></div><div class="line"><a name="l02810"></a><span class="lineno"> 2810</span> <span class="comment"> interrupted), EAGAIN (nonblocking I/O), ENODEV (filesystem</span></div><div class="line"><a name="l02811"></a><span class="lineno"> 2811</span> <span class="comment"> umounted) */</span></div><div class="line"><a name="l02812"></a><span class="lineno"> 2812</span>  <span class="keywordflow">if</span> (err != EINTR && err != EAGAIN)</div><div class="line"><a name="l02813"></a><span class="lineno"> 2813</span>  perror(<span class="stringliteral">"fuse: reading device"</span>);</div><div class="line"><a name="l02814"></a><span class="lineno"> 2814</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l02815"></a><span class="lineno"> 2815</span>  }</div><div class="line"><a name="l02816"></a><span class="lineno"> 2816</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>) res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header)) {</div><div class="line"><a name="l02817"></a><span class="lineno"> 2817</span>  fprintf(stderr, <span class="stringliteral">"short read on fuse device\n"</span>);</div><div class="line"><a name="l02818"></a><span class="lineno"> 2818</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02819"></a><span class="lineno"> 2819</span>  }</div><div class="line"><a name="l02820"></a><span class="lineno"> 2820</span> </div><div class="line"><a name="l02821"></a><span class="lineno"> 2821</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = res;</div><div class="line"><a name="l02822"></a><span class="lineno"> 2822</span> </div><div class="line"><a name="l02823"></a><span class="lineno"> 2823</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02824"></a><span class="lineno"> 2824</span> }</div><div class="line"><a name="l02825"></a><span class="lineno"> 2825</span> </div><div class="line"><a name="l02826"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a9ee52f81d0c63d9bd46b11314ba596cf"> 2826</a></span> <span class="keyword">struct </span>fuse_session *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a9ee52f81d0c63d9bd46b11314ba596cf">fuse_session_new</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args,</div><div class="line"><a name="l02827"></a><span class="lineno"> 2827</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a> *op,</div><div class="line"><a name="l02828"></a><span class="lineno"> 2828</span>  <span class="keywordtype">size_t</span> op_size, <span class="keywordtype">void</span> *userdata)</div><div class="line"><a name="l02829"></a><span class="lineno"> 2829</span> {</div><div class="line"><a name="l02830"></a><span class="lineno"> 2830</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02831"></a><span class="lineno"> 2831</span>  <span class="keyword">struct </span>fuse_session *se;</div><div class="line"><a name="l02832"></a><span class="lineno"> 2832</span>  <span class="keyword">struct </span>mount_opts *mo;</div><div class="line"><a name="l02833"></a><span class="lineno"> 2833</span> </div><div class="line"><a name="l02834"></a><span class="lineno"> 2834</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a>) < op_size) {</div><div class="line"><a name="l02835"></a><span class="lineno"> 2835</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: library too old, some operations may not work\n"</span>);</div><div class="line"><a name="l02836"></a><span class="lineno"> 2836</span>  op_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a>);</div><div class="line"><a name="l02837"></a><span class="lineno"> 2837</span>  }</div><div class="line"><a name="l02838"></a><span class="lineno"> 2838</span> </div><div class="line"><a name="l02839"></a><span class="lineno"> 2839</span>  <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> == 0) {</div><div class="line"><a name="l02840"></a><span class="lineno"> 2840</span>  fprintf(stderr, <span class="stringliteral">"fuse: empty argv passed to fuse_session_new().\n"</span>);</div><div class="line"><a name="l02841"></a><span class="lineno"> 2841</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l02842"></a><span class="lineno"> 2842</span>  }</div><div class="line"><a name="l02843"></a><span class="lineno"> 2843</span> </div><div class="line"><a name="l02844"></a><span class="lineno"> 2844</span>  se = (<span class="keyword">struct </span>fuse_session *) calloc(1, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_session));</div><div class="line"><a name="l02845"></a><span class="lineno"> 2845</span>  <span class="keywordflow">if</span> (se == NULL) {</div><div class="line"><a name="l02846"></a><span class="lineno"> 2846</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate fuse object\n"</span>);</div><div class="line"><a name="l02847"></a><span class="lineno"> 2847</span>  <span class="keywordflow">goto</span> out1;</div><div class="line"><a name="l02848"></a><span class="lineno"> 2848</span>  }</div><div class="line"><a name="l02849"></a><span class="lineno"> 2849</span>  se->fd = -1;</div><div class="line"><a name="l02850"></a><span class="lineno"> 2850</span>  se->conn.max_write = UINT_MAX;</div><div class="line"><a name="l02851"></a><span class="lineno"> 2851</span>  se->conn.max_readahead = UINT_MAX;</div><div class="line"><a name="l02852"></a><span class="lineno"> 2852</span> </div><div class="line"><a name="l02853"></a><span class="lineno"> 2853</span>  <span class="comment">/* Parse options */</span></div><div class="line"><a name="l02854"></a><span class="lineno"> 2854</span>  <span class="keywordflow">if</span>(<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e">fuse_opt_parse</a>(args, se, fuse_ll_opts, NULL) == -1)</div><div class="line"><a name="l02855"></a><span class="lineno"> 2855</span>  <span class="keywordflow">goto</span> out2;</div><div class="line"><a name="l02856"></a><span class="lineno"> 2856</span>  <span class="keywordflow">if</span>(se->deny_others) {</div><div class="line"><a name="l02857"></a><span class="lineno"> 2857</span>  <span class="comment">/* Allowing access only by root is done by instructing</span></div><div class="line"><a name="l02858"></a><span class="lineno"> 2858</span> <span class="comment"> * kernel to allow access by everyone, and then restricting</span></div><div class="line"><a name="l02859"></a><span class="lineno"> 2859</span> <span class="comment"> * access to root and mountpoint owner in libfuse.</span></div><div class="line"><a name="l02860"></a><span class="lineno"> 2860</span> <span class="comment"> */</span></div><div class="line"><a name="l02861"></a><span class="lineno"> 2861</span>  <span class="comment">// We may be adding the option a second time, but</span></div><div class="line"><a name="l02862"></a><span class="lineno"> 2862</span>  <span class="comment">// that doesn't hurt.</span></div><div class="line"><a name="l02863"></a><span class="lineno"> 2863</span>  <span class="keywordflow">if</span>(<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(args, <span class="stringliteral">"-oallow_other"</span>) == -1)</div><div class="line"><a name="l02864"></a><span class="lineno"> 2864</span>  <span class="keywordflow">goto</span> out2;</div><div class="line"><a name="l02865"></a><span class="lineno"> 2865</span>  }</div><div class="line"><a name="l02866"></a><span class="lineno"> 2866</span>  mo = parse_mount_opts(args);</div><div class="line"><a name="l02867"></a><span class="lineno"> 2867</span>  <span class="keywordflow">if</span> (mo == NULL)</div><div class="line"><a name="l02868"></a><span class="lineno"> 2868</span>  <span class="keywordflow">goto</span> out3;</div><div class="line"><a name="l02869"></a><span class="lineno"> 2869</span> </div><div class="line"><a name="l02870"></a><span class="lineno"> 2870</span>  <span class="keywordflow">if</span>(args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> == 1 &&</div><div class="line"><a name="l02871"></a><span class="lineno"> 2871</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[0][0] == <span class="charliteral">'-'</span>) {</div><div class="line"><a name="l02872"></a><span class="lineno"> 2872</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: argv[0] looks like an option, but "</span></div><div class="line"><a name="l02873"></a><span class="lineno"> 2873</span>  <span class="stringliteral">"will be ignored\n"</span>);</div><div class="line"><a name="l02874"></a><span class="lineno"> 2874</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> != 1) {</div><div class="line"><a name="l02875"></a><span class="lineno"> 2875</span>  <span class="keywordtype">int</span> i;</div><div class="line"><a name="l02876"></a><span class="lineno"> 2876</span>  fprintf(stderr, <span class="stringliteral">"fuse: unknown option(s): `"</span>);</div><div class="line"><a name="l02877"></a><span class="lineno"> 2877</span>  <span class="keywordflow">for</span>(i = 1; i < args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>-1; i++)</div><div class="line"><a name="l02878"></a><span class="lineno"> 2878</span>  fprintf(stderr, <span class="stringliteral">"%s "</span>, args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l02879"></a><span class="lineno"> 2879</span>  fprintf(stderr, <span class="stringliteral">"%s'\n"</span>, args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l02880"></a><span class="lineno"> 2880</span>  <span class="keywordflow">goto</span> out4;</div><div class="line"><a name="l02881"></a><span class="lineno"> 2881</span>  }</div><div class="line"><a name="l02882"></a><span class="lineno"> 2882</span> </div><div class="line"><a name="l02883"></a><span class="lineno"> 2883</span>  <span class="keywordflow">if</span> (se->debug)</div><div class="line"><a name="l02884"></a><span class="lineno"> 2884</span>  fprintf(stderr, <span class="stringliteral">"FUSE library version: %s\n"</span>, PACKAGE_VERSION);</div><div class="line"><a name="l02885"></a><span class="lineno"> 2885</span> </div><div class="line"><a name="l02886"></a><span class="lineno"> 2886</span>  se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() +</div><div class="line"><a name="l02887"></a><span class="lineno"> 2887</span>  FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l02888"></a><span class="lineno"> 2888</span> </div><div class="line"><a name="l02889"></a><span class="lineno"> 2889</span>  list_init_req(&se->list);</div><div class="line"><a name="l02890"></a><span class="lineno"> 2890</span>  list_init_req(&se->interrupts);</div><div class="line"><a name="l02891"></a><span class="lineno"> 2891</span>  list_init_nreq(&se->notify_list);</div><div class="line"><a name="l02892"></a><span class="lineno"> 2892</span>  se->notify_ctr = 1;</div><div class="line"><a name="l02893"></a><span class="lineno"> 2893</span>  fuse_mutex_init(&se->lock);</div><div class="line"><a name="l02894"></a><span class="lineno"> 2894</span> </div><div class="line"><a name="l02895"></a><span class="lineno"> 2895</span>  err = pthread_key_create(&se->pipe_key, fuse_ll_pipe_destructor);</div><div class="line"><a name="l02896"></a><span class="lineno"> 2896</span>  <span class="keywordflow">if</span> (err) {</div><div class="line"><a name="l02897"></a><span class="lineno"> 2897</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to create thread specific key: %s\n"</span>,</div><div class="line"><a name="l02898"></a><span class="lineno"> 2898</span>  strerror(err));</div><div class="line"><a name="l02899"></a><span class="lineno"> 2899</span>  <span class="keywordflow">goto</span> out5;</div><div class="line"><a name="l02900"></a><span class="lineno"> 2900</span>  }</div><div class="line"><a name="l02901"></a><span class="lineno"> 2901</span> </div><div class="line"><a name="l02902"></a><span class="lineno"> 2902</span>  memcpy(&se->op, op, op_size);</div><div class="line"><a name="l02903"></a><span class="lineno"> 2903</span>  se->owner = getuid();</div><div class="line"><a name="l02904"></a><span class="lineno"> 2904</span>  se->userdata = userdata;</div><div class="line"><a name="l02905"></a><span class="lineno"> 2905</span> </div><div class="line"><a name="l02906"></a><span class="lineno"> 2906</span>  se->mo = mo;</div><div class="line"><a name="l02907"></a><span class="lineno"> 2907</span>  <span class="keywordflow">return</span> se;</div><div class="line"><a name="l02908"></a><span class="lineno"> 2908</span> </div><div class="line"><a name="l02909"></a><span class="lineno"> 2909</span> out5:</div><div class="line"><a name="l02910"></a><span class="lineno"> 2910</span>  pthread_mutex_destroy(&se->lock);</div><div class="line"><a name="l02911"></a><span class="lineno"> 2911</span> out4:</div><div class="line"><a name="l02912"></a><span class="lineno"> 2912</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(args);</div><div class="line"><a name="l02913"></a><span class="lineno"> 2913</span> out3:</div><div class="line"><a name="l02914"></a><span class="lineno"> 2914</span>  free(mo);</div><div class="line"><a name="l02915"></a><span class="lineno"> 2915</span> out2:</div><div class="line"><a name="l02916"></a><span class="lineno"> 2916</span>  free(se);</div><div class="line"><a name="l02917"></a><span class="lineno"> 2917</span> out1:</div><div class="line"><a name="l02918"></a><span class="lineno"> 2918</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l02919"></a><span class="lineno"> 2919</span> }</div><div class="line"><a name="l02920"></a><span class="lineno"> 2920</span> </div><div class="line"><a name="l02921"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#aa6d77679a110582684e9ca2da623bbc2"> 2921</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa6d77679a110582684e9ca2da623bbc2">fuse_session_mount</a>(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">const</span> <span class="keywordtype">char</span> *mountpoint)</div><div class="line"><a name="l02922"></a><span class="lineno"> 2922</span> {</div><div class="line"><a name="l02923"></a><span class="lineno"> 2923</span>  <span class="keywordtype">int</span> fd;</div><div class="line"><a name="l02924"></a><span class="lineno"> 2924</span> </div><div class="line"><a name="l02925"></a><span class="lineno"> 2925</span>  <span class="comment">/*</span></div><div class="line"><a name="l02926"></a><span class="lineno"> 2926</span> <span class="comment"> * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos</span></div><div class="line"><a name="l02927"></a><span class="lineno"> 2927</span> <span class="comment"> * would ensue.</span></div><div class="line"><a name="l02928"></a><span class="lineno"> 2928</span> <span class="comment"> */</span></div><div class="line"><a name="l02929"></a><span class="lineno"> 2929</span>  <span class="keywordflow">do</span> {</div><div class="line"><a name="l02930"></a><span class="lineno"> 2930</span>  fd = open(<span class="stringliteral">"/dev/null"</span>, O_RDWR);</div><div class="line"><a name="l02931"></a><span class="lineno"> 2931</span>  <span class="keywordflow">if</span> (fd > 2)</div><div class="line"><a name="l02932"></a><span class="lineno"> 2932</span>  close(fd);</div><div class="line"><a name="l02933"></a><span class="lineno"> 2933</span>  } <span class="keywordflow">while</span> (fd >= 0 && fd <= 2);</div><div class="line"><a name="l02934"></a><span class="lineno"> 2934</span> </div><div class="line"><a name="l02935"></a><span class="lineno"> 2935</span>  <span class="comment">/*</span></div><div class="line"><a name="l02936"></a><span class="lineno"> 2936</span> <span class="comment"> * To allow FUSE daemons to run without privileges, the caller may open</span></div><div class="line"><a name="l02937"></a><span class="lineno"> 2937</span> <span class="comment"> * /dev/fuse before launching the file system and pass on the file</span></div><div class="line"><a name="l02938"></a><span class="lineno"> 2938</span> <span class="comment"> * descriptor by specifying /dev/fd/N as the mount point. Note that the</span></div><div class="line"><a name="l02939"></a><span class="lineno"> 2939</span> <span class="comment"> * parent process takes care of performing the mount in this case.</span></div><div class="line"><a name="l02940"></a><span class="lineno"> 2940</span> <span class="comment"> */</span></div><div class="line"><a name="l02941"></a><span class="lineno"> 2941</span>  fd = fuse_mnt_parse_fuse_fd(mountpoint);</div><div class="line"><a name="l02942"></a><span class="lineno"> 2942</span>  <span class="keywordflow">if</span> (fd != -1) {</div><div class="line"><a name="l02943"></a><span class="lineno"> 2943</span>  <span class="keywordflow">if</span> (fcntl(fd, F_GETFD) == -1) {</div><div class="line"><a name="l02944"></a><span class="lineno"> 2944</span>  fprintf(stderr,</div><div class="line"><a name="l02945"></a><span class="lineno"> 2945</span>  <span class="stringliteral">"fuse: Invalid file descriptor /dev/fd/%u\n"</span>,</div><div class="line"><a name="l02946"></a><span class="lineno"> 2946</span>  fd);</div><div class="line"><a name="l02947"></a><span class="lineno"> 2947</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02948"></a><span class="lineno"> 2948</span>  }</div><div class="line"><a name="l02949"></a><span class="lineno"> 2949</span>  se->fd = fd;</div><div class="line"><a name="l02950"></a><span class="lineno"> 2950</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02951"></a><span class="lineno"> 2951</span>  }</div><div class="line"><a name="l02952"></a><span class="lineno"> 2952</span> </div><div class="line"><a name="l02953"></a><span class="lineno"> 2953</span>  <span class="comment">/* Open channel */</span></div><div class="line"><a name="l02954"></a><span class="lineno"> 2954</span>  fd = fuse_kern_mount(mountpoint, se->mo);</div><div class="line"><a name="l02955"></a><span class="lineno"> 2955</span>  <span class="keywordflow">if</span> (fd == -1)</div><div class="line"><a name="l02956"></a><span class="lineno"> 2956</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02957"></a><span class="lineno"> 2957</span>  se->fd = fd;</div><div class="line"><a name="l02958"></a><span class="lineno"> 2958</span> </div><div class="line"><a name="l02959"></a><span class="lineno"> 2959</span>  <span class="comment">/* Save mountpoint */</span></div><div class="line"><a name="l02960"></a><span class="lineno"> 2960</span>  se->mountpoint = strdup(mountpoint);</div><div class="line"><a name="l02961"></a><span class="lineno"> 2961</span>  <span class="keywordflow">if</span> (se->mountpoint == NULL)</div><div class="line"><a name="l02962"></a><span class="lineno"> 2962</span>  <span class="keywordflow">goto</span> error_out;</div><div class="line"><a name="l02963"></a><span class="lineno"> 2963</span> </div><div class="line"><a name="l02964"></a><span class="lineno"> 2964</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02965"></a><span class="lineno"> 2965</span> </div><div class="line"><a name="l02966"></a><span class="lineno"> 2966</span> error_out:</div><div class="line"><a name="l02967"></a><span class="lineno"> 2967</span>  fuse_kern_unmount(mountpoint, fd);</div><div class="line"><a name="l02968"></a><span class="lineno"> 2968</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02969"></a><span class="lineno"> 2969</span> }</div><div class="line"><a name="l02970"></a><span class="lineno"> 2970</span> </div><div class="line"><a name="l02971"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a4bf19badb53d92d31d6b2fb131546a2d"> 2971</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a4bf19badb53d92d31d6b2fb131546a2d">fuse_session_fd</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02972"></a><span class="lineno"> 2972</span> {</div><div class="line"><a name="l02973"></a><span class="lineno"> 2973</span>  <span class="keywordflow">return</span> se->fd;</div><div class="line"><a name="l02974"></a><span class="lineno"> 2974</span> }</div><div class="line"><a name="l02975"></a><span class="lineno"> 2975</span> </div><div class="line"><a name="l02976"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a6c10d942751ddb214863a8b5e53de5e8"> 2976</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a6c10d942751ddb214863a8b5e53de5e8">fuse_session_unmount</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02977"></a><span class="lineno"> 2977</span> {</div><div class="line"><a name="l02978"></a><span class="lineno"> 2978</span>  <span class="keywordflow">if</span> (se->mountpoint != NULL) {</div><div class="line"><a name="l02979"></a><span class="lineno"> 2979</span>  fuse_kern_unmount(se->mountpoint, se->fd);</div><div class="line"><a name="l02980"></a><span class="lineno"> 2980</span>  free(se->mountpoint);</div><div class="line"><a name="l02981"></a><span class="lineno"> 2981</span>  se->mountpoint = NULL;</div><div class="line"><a name="l02982"></a><span class="lineno"> 2982</span>  }</div><div class="line"><a name="l02983"></a><span class="lineno"> 2983</span> }</div><div class="line"><a name="l02984"></a><span class="lineno"> 2984</span> </div><div class="line"><a name="l02985"></a><span class="lineno"> 2985</span> <span class="preprocessor">#ifdef linux</span></div><div class="line"><a name="l02986"></a><span class="lineno"> 2986</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a57f4dabcf044aafcdba6c4682b3a1869">fuse_req_getgroups</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> size, gid_t list[])</div><div class="line"><a name="l02987"></a><span class="lineno"> 2987</span> {</div><div class="line"><a name="l02988"></a><span class="lineno"> 2988</span>  <span class="keywordtype">char</span> *buf;</div><div class="line"><a name="l02989"></a><span class="lineno"> 2989</span>  <span class="keywordtype">size_t</span> bufsize = 1024;</div><div class="line"><a name="l02990"></a><span class="lineno"> 2990</span>  <span class="keywordtype">char</span> path[128];</div><div class="line"><a name="l02991"></a><span class="lineno"> 2991</span>  <span class="keywordtype">int</span> ret;</div><div class="line"><a name="l02992"></a><span class="lineno"> 2992</span>  <span class="keywordtype">int</span> fd;</div><div class="line"><a name="l02993"></a><span class="lineno"> 2993</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> pid = req->ctx.pid;</div><div class="line"><a name="l02994"></a><span class="lineno"> 2994</span>  <span class="keywordtype">char</span> *s;</div><div class="line"><a name="l02995"></a><span class="lineno"> 2995</span> </div><div class="line"><a name="l02996"></a><span class="lineno"> 2996</span>  sprintf(path, <span class="stringliteral">"/proc/%lu/task/%lu/status"</span>, pid, pid);</div><div class="line"><a name="l02997"></a><span class="lineno"> 2997</span> </div><div class="line"><a name="l02998"></a><span class="lineno"> 2998</span> retry:</div><div class="line"><a name="l02999"></a><span class="lineno"> 2999</span>  buf = malloc(bufsize);</div><div class="line"><a name="l03000"></a><span class="lineno"> 3000</span>  <span class="keywordflow">if</span> (buf == NULL)</div><div class="line"><a name="l03001"></a><span class="lineno"> 3001</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l03002"></a><span class="lineno"> 3002</span> </div><div class="line"><a name="l03003"></a><span class="lineno"> 3003</span>  ret = -EIO;</div><div class="line"><a name="l03004"></a><span class="lineno"> 3004</span>  fd = open(path, O_RDONLY);</div><div class="line"><a name="l03005"></a><span class="lineno"> 3005</span>  <span class="keywordflow">if</span> (fd == -1)</div><div class="line"><a name="l03006"></a><span class="lineno"> 3006</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03007"></a><span class="lineno"> 3007</span> </div><div class="line"><a name="l03008"></a><span class="lineno"> 3008</span>  ret = read(fd, buf, bufsize);</div><div class="line"><a name="l03009"></a><span class="lineno"> 3009</span>  close(fd);</div><div class="line"><a name="l03010"></a><span class="lineno"> 3010</span>  <span class="keywordflow">if</span> (ret < 0) {</div><div class="line"><a name="l03011"></a><span class="lineno"> 3011</span>  ret = -EIO;</div><div class="line"><a name="l03012"></a><span class="lineno"> 3012</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03013"></a><span class="lineno"> 3013</span>  }</div><div class="line"><a name="l03014"></a><span class="lineno"> 3014</span> </div><div class="line"><a name="l03015"></a><span class="lineno"> 3015</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>)ret == bufsize) {</div><div class="line"><a name="l03016"></a><span class="lineno"> 3016</span>  free(buf);</div><div class="line"><a name="l03017"></a><span class="lineno"> 3017</span>  bufsize *= 4;</div><div class="line"><a name="l03018"></a><span class="lineno"> 3018</span>  <span class="keywordflow">goto</span> retry;</div><div class="line"><a name="l03019"></a><span class="lineno"> 3019</span>  }</div><div class="line"><a name="l03020"></a><span class="lineno"> 3020</span> </div><div class="line"><a name="l03021"></a><span class="lineno"> 3021</span>  ret = -EIO;</div><div class="line"><a name="l03022"></a><span class="lineno"> 3022</span>  s = strstr(buf, <span class="stringliteral">"\nGroups:"</span>);</div><div class="line"><a name="l03023"></a><span class="lineno"> 3023</span>  <span class="keywordflow">if</span> (s == NULL)</div><div class="line"><a name="l03024"></a><span class="lineno"> 3024</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03025"></a><span class="lineno"> 3025</span> </div><div class="line"><a name="l03026"></a><span class="lineno"> 3026</span>  s += 8;</div><div class="line"><a name="l03027"></a><span class="lineno"> 3027</span>  ret = 0;</div><div class="line"><a name="l03028"></a><span class="lineno"> 3028</span>  <span class="keywordflow">while</span> (1) {</div><div class="line"><a name="l03029"></a><span class="lineno"> 3029</span>  <span class="keywordtype">char</span> *end;</div><div class="line"><a name="l03030"></a><span class="lineno"> 3030</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> val = strtoul(s, &end, 0);</div><div class="line"><a name="l03031"></a><span class="lineno"> 3031</span>  <span class="keywordflow">if</span> (end == s)</div><div class="line"><a name="l03032"></a><span class="lineno"> 3032</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l03033"></a><span class="lineno"> 3033</span> </div><div class="line"><a name="l03034"></a><span class="lineno"> 3034</span>  s = end;</div><div class="line"><a name="l03035"></a><span class="lineno"> 3035</span>  <span class="keywordflow">if</span> (ret < size)</div><div class="line"><a name="l03036"></a><span class="lineno"> 3036</span>  list[ret] = val;</div><div class="line"><a name="l03037"></a><span class="lineno"> 3037</span>  ret++;</div><div class="line"><a name="l03038"></a><span class="lineno"> 3038</span>  }</div><div class="line"><a name="l03039"></a><span class="lineno"> 3039</span> </div><div class="line"><a name="l03040"></a><span class="lineno"> 3040</span> out_free:</div><div class="line"><a name="l03041"></a><span class="lineno"> 3041</span>  free(buf);</div><div class="line"><a name="l03042"></a><span class="lineno"> 3042</span>  <span class="keywordflow">return</span> ret;</div><div class="line"><a name="l03043"></a><span class="lineno"> 3043</span> }</div><div class="line"><a name="l03044"></a><span class="lineno"> 3044</span> <span class="preprocessor">#else </span><span class="comment">/* linux */</span><span class="preprocessor"></span></div><div class="line"><a name="l03045"></a><span class="lineno"> 3045</span> <span class="comment">/*</span></div><div class="line"><a name="l03046"></a><span class="lineno"> 3046</span> <span class="comment"> * This is currently not implemented on other than Linux...</span></div><div class="line"><a name="l03047"></a><span class="lineno"> 3047</span> <span class="comment"> */</span></div><div class="line"><a name="l03048"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a57f4dabcf044aafcdba6c4682b3a1869"> 3048</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a57f4dabcf044aafcdba6c4682b3a1869">fuse_req_getgroups</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> size, gid_t list[])</div><div class="line"><a name="l03049"></a><span class="lineno"> 3049</span> {</div><div class="line"><a name="l03050"></a><span class="lineno"> 3050</span>  (void) req; (void) size; (void) list;</div><div class="line"><a name="l03051"></a><span class="lineno"> 3051</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l03052"></a><span class="lineno"> 3052</span> }</div><div class="line"><a name="l03053"></a><span class="lineno"> 3053</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l03054"></a><span class="lineno"> 3054</span> </div><div class="line"><a name="l03055"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690"> 3055</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03056"></a><span class="lineno"> 3056</span> {</div><div class="line"><a name="l03057"></a><span class="lineno"> 3057</span>  se->exited = 1;</div><div class="line"><a name="l03058"></a><span class="lineno"> 3058</span> }</div><div class="line"><a name="l03059"></a><span class="lineno"> 3059</span> </div><div class="line"><a name="l03060"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#ab3d015de77ae0edeb3157321e7a5c434"> 3060</a></span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab3d015de77ae0edeb3157321e7a5c434">fuse_session_reset</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03061"></a><span class="lineno"> 3061</span> {</div><div class="line"><a name="l03062"></a><span class="lineno"> 3062</span>  se->exited = 0;</div><div class="line"><a name="l03063"></a><span class="lineno"> 3063</span>  se->error = 0;</div><div class="line"><a name="l03064"></a><span class="lineno"> 3064</span> }</div><div class="line"><a name="l03065"></a><span class="lineno"> 3065</span> </div><div class="line"><a name="l03066"></a><span class="lineno"><a class="line" href="include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c"> 3066</a></span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03067"></a><span class="lineno"> 3067</span> {</div><div class="line"><a name="l03068"></a><span class="lineno"> 3068</span>  <span class="keywordflow">return</span> se->exited;</div><div class="line"><a name="l03069"></a><span class="lineno"> 3069</span> }</div><div class="ttc" id="fuse-3_86_80_2include_2fuse__lowlevel_8h_html_ad1d1963190eb93ae5667d32d2b387ca1"><div class="ttname"><a href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1d1963190eb93ae5667d32d2b387ca1">fuse_req_ctx</a></div><div class="ttdeci">const struct fuse_ctx * fuse_req_ctx(fuse_req_t req)</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2lib_2fuse__lowlevel_8c_source.html#l02365">fuse_lowlevel.c:2365</a></div></div> fuse3-3.10.0/doc/html/fuse-3_86_80_2lib_2fuse__lowlevel_8c_source.html-49-<div class="ttc" id="structfuse__bufvec_html_a0fbb583168d52562f0f848562ecf63bc"><div class="ttname"><a href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">fuse_bufvec::off</a></div><div class="ttdeci">size_t off</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__common_8h_source.html#l00710">fuse_common.h:710</a></div></div> ############################################## fuse3-3.10.0/doc/html/fuse-3_86_82_2lib_2fuse__opt_8c_source.html-47-<div class="contents"> fuse3-3.10.0/doc/html/fuse-3_86_82_2lib_2fuse__opt_8c_source.html:48:<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> FUSE: Filesystem in Userspace</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> Implementation of option parsing routines (dealing with `struct</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> fuse_args`).</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> This program can be distributed under the terms of the GNU LGPLv2.</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> See the file COPYING.LIB</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">*/</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include "config.h"</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include "fuse_opt.h"</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "fuse_misc.h"</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <stdio.h></span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <assert.h></span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">struct </span>fuse_opt_context {</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordtype">void</span> *data;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__opt.html">fuse_opt</a> *opt;</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a3d2ab809528d409b0ee91cee400c07c2">fuse_opt_proc_t</a> proc;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordtype">int</span> argctr;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordtype">int</span> argc;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordtype">char</span> **argv;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">struct </span><a class="code" href="structfuse__args.html">fuse_args</a> outargs;</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordtype">char</span> *opts;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordtype">int</span> nonopt;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> };</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args)</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">if</span> (args) {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> && args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a>) {</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordtype">int</span> i;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">for</span> (i = 0; i < args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>; i++)</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  free(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  free(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  }</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> = 0;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> = NULL;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a> = 0;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  }</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> }</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="keyword">static</span> <span class="keywordtype">int</span> alloc_failed(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> {</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  fprintf(stderr, <span class="stringliteral">"fuse: memory allocation failed\n"</span>);</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> }</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> {</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordtype">char</span> **newargv;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">char</span> *newarg;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  assert(!args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> || args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a>);</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  newarg = strdup(arg);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">if</span> (!newarg)</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  newargv = realloc(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>, (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> + 2) * <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *));</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordflow">if</span> (!newargv) {</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  free(newarg);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  }</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> = newargv;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a> = 1;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>++] = newarg;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>] = NULL;</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> }</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_opt_insert_arg_common(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">int</span> pos,</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  assert(pos <= args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(args, arg) == -1)</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">if</span> (pos != args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - 1) {</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordtype">char</span> *newarg = args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - 1];</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  memmove(&args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos + 1], &args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos],</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *) * (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - pos - 1));</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos] = newarg;</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  }</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> }</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">int</span> pos, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> {</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">return</span> fuse_opt_insert_arg_common(args, pos, arg);</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> }</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="keyword">static</span> <span class="keywordtype">int</span> next_arg(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> {</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (ctx->argctr + 1 >= ctx->argc) {</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  fprintf(stderr, <span class="stringliteral">"fuse: missing argument after `%s'\n"</span>, opt);</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  }</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  ctx->argctr++;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> }</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_arg(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> {</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(&ctx->outargs, arg);</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> }</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_opt_common(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt, <span class="keywordtype">int</span> esc)</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordtype">unsigned</span> oldlen = *opts ? strlen(*opts) : 0;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordtype">char</span> *d = realloc(*opts, oldlen + 1 + strlen(opt) * 2 + 1);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">if</span> (!d)</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  *opts = d;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">if</span> (oldlen) {</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  d += oldlen;</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  *d++ = <span class="charliteral">','</span>;</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  }</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> </div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">for</span> (; *opt; opt++) {</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">if</span> (esc && (*opt == <span class="charliteral">','</span> || *opt == <span class="charliteral">'\\'</span>))</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  *d++ = <span class="charliteral">'\\'</span>;</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  *d++ = *opt;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  }</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  *d = <span class="charliteral">'\0'</span>;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> }</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#aaae525d5e959c5394bc323be0c1d02b0">fuse_opt_add_opt</a>(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> {</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordflow">return</span> add_opt_common(opts, opt, 0);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> }</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a51a00d087d08bef250a53b9e4979b1cd">fuse_opt_add_opt_escaped</a>(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> {</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">return</span> add_opt_common(opts, opt, 1);</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> }</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> </div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_opt(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span> {</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keywordflow">return</span> add_opt_common(&ctx->opts, opt, 1);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> }</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="keyword">static</span> <span class="keywordtype">int</span> call_proc(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> key,</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> {</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">if</span> (key == <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a6e97b6ce492f1baaaf0a4eb4970c9a2f">FUSE_OPT_KEY_DISCARD</a>)</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordflow">if</span> (key != <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a8533ff341f910c1bd05f10c8fcc35a04">FUSE_OPT_KEY_KEEP</a> && ctx->proc) {</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordtype">int</span> res = ctx->proc(ctx->data, arg, key, &ctx->outargs);</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">if</span> (res == -1 || !res)</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  }</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="keywordflow">if</span> (iso)</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordflow">return</span> add_opt(ctx, arg);</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keywordflow">return</span> add_arg(ctx, arg);</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> }</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> </div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="keyword">static</span> <span class="keywordtype">int</span> match_template(<span class="keyword">const</span> <span class="keywordtype">char</span> *t, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">unsigned</span> *sepp)</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span> {</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordtype">int</span> arglen = strlen(arg);</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *sep = strchr(t, <span class="charliteral">'='</span>);</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  sep = sep ? sep : strchr(t, <span class="charliteral">' '</span>);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="keywordflow">if</span> (sep && (!sep[1] || sep[1] == <span class="charliteral">'%'</span>)) {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="keywordtype">int</span> tlen = sep - t;</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="keywordflow">if</span> (sep[0] == <span class="charliteral">'='</span>)</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  tlen ++;</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">if</span> (arglen >= tlen && strncmp(arg, t, tlen) == 0) {</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  *sepp = sep - t;</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  }</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  }</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="keywordflow">if</span> (strcmp(t, arg) == 0) {</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  *sepp = 0;</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  }</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> }</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> </div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> <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> *find_opt(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt,</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">unsigned</span> *sepp)</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> {</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keywordflow">for</span> (; opt && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>; opt++)</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (match_template(opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>, arg, sepp))</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordflow">return</span> opt;</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#af16c684bd2b10b7ac0ae299afa1e0e06">fuse_opt_match</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> {</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="keywordtype">unsigned</span> dummy;</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <span class="keywordflow">return</span> find_opt(opts, opt, &dummy) ? 1 : 0;</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> }</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> </div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt_param(<span class="keywordtype">void</span> *var, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, <span class="keyword">const</span> <span class="keywordtype">char</span> *param,</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> {</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  assert(format[0] == <span class="charliteral">'%'</span>);</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="keywordflow">if</span> (format[1] == <span class="charliteral">'s'</span>) {</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keywordtype">char</span> **s = var;</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keywordtype">char</span> *copy = strdup(param);</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <span class="keywordflow">if</span> (!copy)</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span> </div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  free(*s);</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  *s = copy;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <span class="keywordflow">if</span> (sscanf(param, format, var) != 1) {</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  fprintf(stderr, <span class="stringliteral">"fuse: invalid parameter in option `%s'\n"</span>, arg);</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  }</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  }</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> }</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span> </div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt(<span class="keyword">struct</span> fuse_opt_context *ctx,</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt, <span class="keywordtype">unsigned</span> sep,</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span> {</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <span class="keywordflow">if</span> (opt-><a class="code" href="structfuse__opt.html#a333dcd849a3bd54df06084a69b5a8d39">offset</a> == -1U) {</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordflow">if</span> (call_proc(ctx, arg, opt-><a class="code" href="structfuse__opt.html#aeb76339e1ce6948ad94bd2d4d5d01e20">value</a>, iso) == -1)</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordtype">void</span> *var = (<span class="keywordtype">char</span> *)ctx->data + opt-><a class="code" href="structfuse__opt.html#a333dcd849a3bd54df06084a69b5a8d39">offset</a>;</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  if (sep && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep + 1]) {</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *param = arg + sep;</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">if</span> (opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep] == <span class="charliteral">'='</span>)</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  param ++;</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <span class="keywordflow">if</span> (process_opt_param(var, opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a> + sep + 1,</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  param, arg) == -1)</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  *(<span class="keywordtype">int</span> *)var = opt-><a class="code" href="structfuse__opt.html#aeb76339e1ce6948ad94bd2d4d5d01e20">value</a>;</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  }</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> }</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span> </div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt_sep_arg(<span class="keyword">struct</span> fuse_opt_context *ctx,</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt, <span class="keywordtype">unsigned</span> sep,</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span> {</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  <span class="keywordtype">char</span> *newarg;</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  <span class="keywordtype">char</span> *param;</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span> </div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordflow">if</span> (next_arg(ctx, arg) == -1)</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span> </div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  param = ctx->argv[ctx->argctr];</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  newarg = malloc(sep + strlen(param) + 1);</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <span class="keywordflow">if</span> (!newarg)</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  memcpy(newarg, arg, sep);</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  strcpy(newarg + sep, param);</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  res = process_opt(ctx, opt, sep, newarg, iso);</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  free(newarg);</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> </div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span> }</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span> </div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_gopt(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span> {</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <span class="keywordtype">unsigned</span> sep;</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__opt.html">fuse_opt</a> *opt = find_opt(ctx->opt, arg, &sep);</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  <span class="keywordflow">if</span> (opt) {</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <span class="keywordflow">for</span> (; opt; opt = find_opt(opt + 1, arg, &sep)) {</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keywordflow">if</span> (sep && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep] == <span class="charliteral">' '</span> && !arg[sep])</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  res = process_opt_sep_arg(ctx, opt, sep, arg,</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  iso);</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  res = process_opt(ctx, opt, sep, arg, iso);</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  }</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">return</span> call_proc(ctx, arg, <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a48cb1aea482de904a848651360117748">FUSE_OPT_KEY_OPT</a>, iso);</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span> }</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> </div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_real_option_group(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keywordtype">char</span> *opts)</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> {</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <span class="keywordtype">char</span> *s = opts;</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <span class="keywordtype">char</span> *d = s;</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <span class="keywordtype">int</span> end = 0;</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span> </div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <span class="keywordflow">while</span> (!end) {</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <span class="keywordflow">if</span> (*s == <span class="charliteral">'\0'</span>)</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  end = 1;</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  <span class="keywordflow">if</span> (*s == <span class="charliteral">','</span> || end) {</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> </div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  *d = <span class="charliteral">'\0'</span>;</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  res = process_gopt(ctx, opts, 1);</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  d = opts;</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  <span class="keywordflow">if</span> (s[0] == <span class="charliteral">'\\'</span> && s[1] != <span class="charliteral">'\0'</span>) {</div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  s++;</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  <span class="keywordflow">if</span> (s[0] >= <span class="charliteral">'0'</span> && s[0] <= <span class="charliteral">'3'</span> &&</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  s[1] >= <span class="charliteral">'0'</span> && s[1] <= <span class="charliteral">'7'</span> &&</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  s[2] >= <span class="charliteral">'0'</span> && s[2] <= <span class="charliteral">'7'</span>) {</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  *d++ = (s[0] - <span class="charliteral">'0'</span>) * 0100 +</div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  (s[1] - <span class="charliteral">'0'</span>) * 0010 +</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  (s[2] - <span class="charliteral">'0'</span>);</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  s += 2;</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  *d++ = *s;</div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  }</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  *d++ = *s;</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  }</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  }</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  s++;</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  }</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span> </div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> }</div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span> </div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_option_group(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opts)</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span> {</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keywordtype">char</span> *copy = strdup(opts);</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span> </div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keywordflow">if</span> (!copy) {</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  fprintf(stderr, <span class="stringliteral">"fuse: memory allocation failed\n"</span>);</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  }</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  res = process_real_option_group(ctx, copy);</div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  free(copy);</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> }</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span> </div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_one(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span> {</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  <span class="keywordflow">if</span> (ctx->nonopt || arg[0] != <span class="charliteral">'-'</span>)</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <span class="keywordflow">return</span> call_proc(ctx, arg, <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a632b025441794a4e6fe59b7ab53bbfc4">FUSE_OPT_KEY_NONOPT</a>, 0);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg[1] == <span class="charliteral">'o'</span>) {</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  <span class="keywordflow">if</span> (arg[2])</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  <span class="keywordflow">return</span> process_option_group(ctx, arg + 2);</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="keywordflow">else</span> {</div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  <span class="keywordflow">if</span> (next_arg(ctx, arg) == -1)</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> </div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <span class="keywordflow">return</span> process_option_group(ctx,</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  ctx->argv[ctx->argctr]);</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  }</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg[1] == <span class="charliteral">'-'</span> && !arg[2]) {</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">if</span> (add_arg(ctx, arg) == -1)</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  ctx->nonopt = ctx->outargs.argc;</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <span class="keywordflow">return</span> process_gopt(ctx, arg, 0);</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span> }</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span> </div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span> <span class="keyword">static</span> <span class="keywordtype">int</span> opt_parse(<span class="keyword">struct</span> fuse_opt_context *ctx)</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> {</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <span class="keywordflow">if</span> (ctx->argc) {</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <span class="keywordflow">if</span> (add_arg(ctx, ctx->argv[0]) == -1)</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  }</div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span> </div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="keywordflow">for</span> (ctx->argctr = 1; ctx->argctr < ctx->argc; ctx->argctr++)</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  <span class="keywordflow">if</span> (process_one(ctx, ctx->argv[ctx->argctr]) == -1)</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span> </div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  <span class="keywordflow">if</span> (ctx->opts) {</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(&ctx->outargs, 1, <span class="stringliteral">"-o"</span>) == -1 ||</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(&ctx->outargs, 2, ctx->opts) == -1)</div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  }</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> </div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <span class="comment">/* If option separator ("--") is the last argument, remove it */</span></div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keywordflow">if</span> (ctx->nonopt && ctx->nonopt == ctx->outargs.argc &&</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  strcmp(ctx->outargs.argv[ctx->outargs.argc - 1], <span class="stringliteral">"--"</span>) == 0) {</div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  free(ctx->outargs.argv[ctx->outargs.argc - 1]);</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  ctx->outargs.argv[--ctx->outargs.argc] = NULL;</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  }</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span> </div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span> }</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span> </div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e">fuse_opt_parse</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">void</span> *data,</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> opts[], <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a3d2ab809528d409b0ee91cee400c07c2">fuse_opt_proc_t</a> proc)</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> {</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="keyword">struct </span>fuse_opt_context ctx = {</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  .data = data,</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  .opt = opts,</div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  .proc = proc,</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  };</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span> </div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="keywordflow">if</span> (!args || !args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> || !args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>)</div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span> </div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  ctx.argc = args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>;</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  ctx.argv = args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>;</div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span> </div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  res = opt_parse(&ctx);</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordflow">if</span> (res != -1) {</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  <span class="keyword">struct </span><a class="code" href="structfuse__args.html">fuse_args</a> tmp = *args;</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  *args = ctx.outargs;</div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  ctx.outargs = tmp;</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  }</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  free(ctx.opts);</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(&ctx.outargs);</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span> }</div><div class="ttc" id="fuse-3_86_80_2include_2fuse__opt_8h_html_a8533ff341f910c1bd05f10c8fcc35a04"><div class="ttname"><a href="fuse-3_86_80_2include_2fuse__opt_8h.html#a8533ff341f910c1bd05f10c8fcc35a04">FUSE_OPT_KEY_KEEP</a></div><div class="ttdeci">#define FUSE_OPT_KEY_KEEP</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__opt_8h_source.html#l00145">fuse_opt.h:145</a></div></div> fuse3-3.10.0/doc/html/fuse-3_86_82_2lib_2fuse__opt_8c_source.html-49-<div class="ttc" id="structfuse__args_html_a501883d1eababa08e05b0c802b31e11d"><div class="ttname"><a href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">fuse_args::argc</a></div><div class="ttdeci">int argc</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__opt_8h_source.html#l00111">fuse_opt.h:111</a></div></div> ############################################## fuse3-3.10.0/doc/html/jquery.js-15- */ fuse3-3.10.0/doc/html/jquery.js:16:(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b4<b3;b4++){if((b9=arguments[b4])!=null){for(b2 in b9){b0=b5[b2];b1=b9[b2];if(b5===b1){continue}if(b8&&b1&&(bF.isPlainObject(b1)||(b6=bF.isArray(b1)))){if(b6){b6=false;b7=b0&&bF.isArray(b0)?b0:[]}else{b7=b0&&bF.isPlainObject(b0)?b0:{}}b5[b2]=bF.extend(b8,b7,b1)}else{if(b1!==L){b5[b2]=b1}}}}}return b5};bF.extend({noConflict:function(b0){if(bb.$===bF){bb.$=bH}if(b0&&bb.jQuery===bF){bb.jQuery=bU}return bF},isReady:false,readyWait:1,holdReady:function(b0){if(b0){bF.readyWait++}else{bF.ready(true)}},ready:function(b0){if((b0===true&&!--bF.readyWait)||(b0!==true&&!bF.isReady)){if(!av.body){return setTimeout(bF.ready,1)}bF.isReady=true;if(b0!==true&&--bF.readyWait>0){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b4<b5;){if(b6.apply(b3[b4++],b2)===false){break}}}}else{if(b0){for(b1 in b3){if(b6.call(b3[b1],b1,b3[b1])===false){break}}}else{for(;b4<b5;){if(b6.call(b3[b4],b4,b3[b4++])===false){break}}}}return b3},trim:bO?function(b0){return b0==null?"":bO.call(b0)}:function(b0){return b0==null?"":b0.toString().replace(bI,"").replace(bE,"")},makeArray:function(b3,b1){var b0=b1||[];if(b3!=null){var b2=bF.type(b3);if(b3.length==null||b2==="string"||b2==="function"||b2==="regexp"||bF.isWindow(b3)){bz.call(b0,b3)}else{bF.merge(b0,b3)}}return b0},inArray:function(b2,b3,b1){var b0;if(b3){if(bv){return bv.call(b3,b2,b1)}b0=b3.length;b1=b1?b1<0?Math.max(0,b0+b1):b1:0;for(;b1<b0;b1++){if(b1 in b3&&b3[b1]===b2){return b1}}}return -1},merge:function(b4,b2){var b3=b4.length,b1=0;if(typeof b2.length==="number"){for(var b0=b2.length;b1<b0;b1++){b4[b3++]=b2[b1]}}else{while(b2[b1]!==L){b4[b3++]=b2[b1++]}}b4.length=b3;return b4},grep:function(b1,b6,b0){var b2=[],b5;b0=!!b0;for(var b3=0,b4=b1.length;b3<b4;b3++){b5=!!b6(b1[b3],b3);if(b0!==b5){b2.push(b1[b3])}}return b2},map:function(b0,b7,b8){var b5,b6,b4=[],b2=0,b1=b0.length,b3=b0 instanceof bF||b1!==L&&typeof b1==="number"&&((b1>0&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b2<b1;b2++){b5=b7(b0[b2],b2,b8);if(b5!=null){b4[b4.length]=b5}}}else{for(b6 in b0){b5=b7(b0[b6],b6,b8);if(b5!=null){b4[b4.length]=b5}}}return b4.concat.apply([],b4)},guid:1,proxy:function(b4,b3){if(typeof b3==="string"){var b2=b4[b3];b3=b4;b4=b2}if(!bF.isFunction(b4)){return L}var b0=bK.call(arguments,2),b1=function(){return b4.apply(b3,b0.concat(bK.call(arguments)))};b1.guid=b4.guid=b4.guid||b1.guid||bF.guid++;return b1},access:function(b0,b8,b6,b2,b5,b7){var b1=b0.length;if(typeof b8==="object"){for(var b3 in b8){bF.access(b0,b3,b8[b3],b2,b5,b6)}return b0}if(b6!==L){b2=!b7&&b2&&bF.isFunction(b6);for(var b4=0;b4<b1;b4++){b5(b0[b4],b8,b2?b6.call(b0[b4],b4,b5(b0[b4],b8)):b6,b7)}return b0}return b1?b5(b0[0],b8):L},now:function(){return(new Date()).getTime()},uaMatch:function(b1){b1=b1.toLowerCase();var b0=by.exec(b1)||bR.exec(b1)||bQ.exec(b1)||b1.indexOf("compatible")<0&&bS.exec(b1)||[];return{browser:b0[1]||"",version:b0[2]||"0"}},sub:function(){function b0(b3,b4){return new b0.fn.init(b3,b4)}bF.extend(true,b0,this);b0.superclass=this;b0.fn=b0.prototype=this();b0.fn.constructor=b0;b0.sub=this.sub;b0.fn.init=function b2(b3,b4){if(b4&&b4 instanceof bF&&!(b4 instanceof b0)){b4=b0(b4)}return bF.fn.init.call(this,b3,b4,b1)};b0.fn.init.prototype=b0.fn;var b1=b0(av);return b0},browser:{}});bF.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(b1,b0){bx["[object "+b0+"]"]=b0.toLowerCase()});bV=bF.uaMatch(bX);if(bV.browser){bF.browser[bV.browser]=true;bF.browser.version=bV.version}if(bF.browser.webkit){bF.browser.safari=true}if(bM.test("\xA0")){bI=/^[\s\xA0]+/;bE=/[\s\xA0]+$/}bD=bF(av);if(av.addEventListener){e=function(){av.removeEventListener("DOMContentLoaded",e,false);bF.ready()}}else{if(av.attachEvent){e=function(){if(av.readyState==="complete"){av.detachEvent("onreadystatechange",e);bF.ready()}}}}function bw(){if(bF.isReady){return}try{av.documentElement.doScroll("left")}catch(b0){setTimeout(bw,1);return}bF.ready()}return bF})();var a2={};function X(e){var bv=a2[e]={},bw,bx;e=e.split(/\s+/);for(bw=0,bx=e.length;bw<bx;bw++){bv[e[bw]]=true}return bv}b.Callbacks=function(bw){bw=bw?(a2[bw]||X(bw)):{};var bB=[],bC=[],bx,by,bv,bz,bA,bE=function(bF){var bG,bJ,bI,bH,bK;for(bG=0,bJ=bF.length;bG<bJ;bG++){bI=bF[bG];bH=b.type(bI);if(bH==="array"){bE(bI)}else{if(bH==="function"){if(!bw.unique||!bD.has(bI)){bB.push(bI)}}}}},e=function(bG,bF){bF=bF||[];bx=!bw.memory||[bG,bF];by=true;bA=bv||0;bv=0;bz=bB.length;for(;bB&&bA<bz;bA++){if(bB[bA].apply(bG,bF)===false&&bw.stopOnFalse){bx=true;break}}by=false;if(bB){if(!bw.once){if(bC&&bC.length){bx=bC.shift();bD.fireWith(bx[0],bx[1])}}else{if(bx===true){bD.disable()}else{bB=[]}}}},bD={add:function(){if(bB){var bF=bB.length;bE(arguments);if(by){bz=bB.length}else{if(bx&&bx!==true){bv=bF;e(bx[0],bx[1])}}}return this},remove:function(){if(bB){var bF=arguments,bH=0,bI=bF.length;for(;bH<bI;bH++){for(var bG=0;bG<bB.length;bG++){if(bF[bH]===bB[bG]){if(by){if(bG<=bz){bz--;if(bG<=bA){bA--}}}bB.splice(bG--,1);if(bw.unique){break}}}}}return this},has:function(bG){if(bB){var bF=0,bH=bB.length;for(;bF<bH;bF++){if(bG===bB[bF]){return true}}}return false},empty:function(){bB=[];return this},disable:function(){bB=bC=bx=L;return this},disabled:function(){return !bB},lock:function(){bC=L;if(!bx||bx===true){bD.disable()}return this},locked:function(){return !bC},fireWith:function(bG,bF){if(bC){if(by){if(!bw.once){bC.push([bG,bF])}}else{if(!(bw.once&&bx)){e(bG,bF)}}}return this},fire:function(){bD.fireWith(this,arguments);return this},fired:function(){return !!bx}};return bD};var aJ=[].slice;b.extend({Deferred:function(by){var bx=b.Callbacks("once memory"),bw=b.Callbacks("once memory"),bv=b.Callbacks("memory"),e="pending",bA={resolve:bx,reject:bw,notify:bv},bC={done:bx.add,fail:bw.add,progress:bv.add,state:function(){return e},isResolved:bx.fired,isRejected:bw.fired,then:function(bE,bD,bF){bB.done(bE).fail(bD).progress(bF);return this},always:function(){bB.done.apply(bB,arguments).fail.apply(bB,arguments);return this},pipe:function(bF,bE,bD){return b.Deferred(function(bG){b.each({done:[bF,"resolve"],fail:[bE,"reject"],progress:[bD,"notify"]},function(bI,bL){var bH=bL[0],bK=bL[1],bJ;if(b.isFunction(bH)){bB[bI](function(){bJ=bH.apply(this,arguments);if(bJ&&b.isFunction(bJ.promise)){bJ.promise().then(bG.resolve,bG.reject,bG.notify)}else{bG[bK+"With"](this===bB?bG:this,[bJ])}})}else{bB[bI](bG[bK])}})}).promise()},promise:function(bE){if(bE==null){bE=bC}else{for(var bD in bC){bE[bD]=bC[bD]}}return bE}},bB=bC.promise({}),bz;for(bz in bA){bB[bz]=bA[bz].fire;bB[bz+"With"]=bA[bz].fireWith}bB.done(function(){e="resolved"},bw.disable,bv.lock).fail(function(){e="rejected"},bx.disable,bv.lock);if(by){by.call(bB,bB)}return bB},when:function(bA){var bx=aJ.call(arguments,0),bv=0,e=bx.length,bB=new Array(e),bw=e,by=e,bC=e<=1&&bA&&b.isFunction(bA.promise)?bA:b.Deferred(),bE=bC.promise();function bD(bF){return function(bG){bx[bF]=arguments.length>1?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv<e;bv++){if(bx[bv]&&bx[bv].promise&&b.isFunction(bx[bv].promise)){bx[bv].promise().then(bD(bv),bC.reject,bz(bv))}else{--bw}}if(!bw){bC.resolveWith(bC,bx)}}else{if(bC!==bA){bC.resolveWith(bC,e?[bA]:[])}}return bE}});b.support=(function(){var bJ,bI,bF,bG,bx,bE,bA,bD,bz,bK,bB,by,bw,bv=av.createElement("div"),bH=av.documentElement;bv.setAttribute("className","t");bv.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="<div "+e+"><div></div></div><table "+e+" cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="<div style='width:4px;'></div>";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA<bz;bA++){delete bB[bv[bA]]}if(!(by?S:b.isEmptyObject)(bB)){return}}}if(!by){delete e[bw].data;if(!S(e[bw])){return}}if(b.support.deleteExpando||!e.setInterval){delete e[bw]}else{e[bw]=null}if(bD){if(b.support.deleteExpando){delete bx[bC]}else{if(bx.removeAttribute){bx.removeAttribute(bC)}else{bx[bC]=null}}}},_data:function(bv,e,bw){return b.data(bv,e,bw,true)},acceptData:function(bv){if(bv.nodeName){var e=b.noData[bv.nodeName.toLowerCase()];if(e){return !(e===true||bv.getAttribute("classid")!==e)}}return true}});b.fn.extend({data:function(by,bA){var bB,e,bw,bz=null;if(typeof by==="undefined"){if(this.length){bz=b.data(this[0]);if(this[0].nodeType===1&&!b._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var bx=0,bv=e.length;bx<bv;bx++){bw=e[bx].name;if(bw.indexOf("data-")===0){bw=b.camelCase(bw.substring(5));a5(this[0],bw,bz[bw])}}b._data(this[0],"parsedAttrs",true)}}return bz}else{if(typeof by==="object"){return this.each(function(){b.data(this,by)})}}bB=by.split(".");bB[1]=bB[1]?"."+bB[1]:"";if(bA===L){bz=this.triggerHandler("getData"+bB[1]+"!",[bB[0]]);if(bz===L&&this.length){bz=b.data(this[0],by);bz=a5(this[0],by,bz)}return bz===L&&bB[1]?this.data(bB[0]):bz}else{return this.each(function(){var bC=b(this),bD=[bB[0],bA];bC.triggerHandler("setData"+bB[1]+"!",bD);b.data(this,by,bA);bC.triggerHandler("changeData"+bB[1]+"!",bD)})}},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function a5(bx,bw,by){if(by===L&&bx.nodeType===1){var bv="data-"+bw.replace(aA,"-$1").toLowerCase();by=bx.getAttribute(bv);if(typeof by==="string"){try{by=by==="true"?true:by==="false"?false:by==="null"?null:b.isNumeric(by)?parseFloat(by):aS.test(by)?b.parseJSON(by):by}catch(bz){}b.data(bx,bw,by)}else{by=L}}return by}function S(bv){for(var e in bv){if(e==="data"&&b.isEmptyObject(bv[e])){continue}if(e!=="toJSON"){return false}}return true}function bi(by,bx,bA){var bw=bx+"defer",bv=bx+"queue",e=bx+"mark",bz=b._data(by,bw);if(bz&&(bA==="queue"||!b._data(by,bv))&&(bA==="mark"||!b._data(by,e))){setTimeout(function(){if(!b._data(by,bv)&&!b._data(by,e)){b.removeData(by,bw,true);bz.fire()}},0)}}b.extend({_mark:function(bv,e){if(bv){e=(e||"fx")+"mark";b._data(bv,e,(b._data(bv,e)||0)+1)}},_unmark:function(by,bx,bv){if(by!==true){bv=bx;bx=by;by=false}if(bx){bv=bv||"fx";var e=bv+"mark",bw=by?0:((b._data(bx,e)||1)-1);if(bw){b._data(bx,e,bw)}else{b.removeData(bx,e,true);bi(bx,bv,"mark")}}},queue:function(bv,e,bx){var bw;if(bv){e=(e||"fx")+"queue";bw=b._data(bv,e);if(bx){if(!bw||b.isArray(bx)){bw=b._data(bv,e,b.makeArray(bx))}else{bw.push(bx)}}return bw||[]}},dequeue:function(by,bx){bx=bx||"fx";var bv=b.queue(by,bx),bw=bv.shift(),e={};if(bw==="inprogress"){bw=bv.shift()}if(bw){if(bx==="fx"){bv.unshift("inprogress")}b._data(by,bx+".run",e);bw.call(by,function(){b.dequeue(by,bx)},e)}if(!bv.length){b.removeData(by,bx+"queue "+bx+".run",true);bi(by,bx,"queue")}}});b.fn.extend({queue:function(e,bv){if(typeof e!=="string"){bv=e;e="fx"}if(bv===L){return b.queue(this[0],e)}return this.each(function(){var bw=b.queue(this,e,bv);if(e==="fx"&&bw[0]!=="inprogress"){b.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(bv,e){bv=b.fx?b.fx.speeds[bv]||bv:bv;e=e||"fx";return this.queue(e,function(bx,bw){var by=setTimeout(bx,bv);bw.stop=function(){clearTimeout(by)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(bD,bw){if(typeof bD!=="string"){bw=bD;bD=L}bD=bD||"fx";var e=b.Deferred(),bv=this,by=bv.length,bB=1,bz=bD+"defer",bA=bD+"queue",bC=bD+"mark",bx;function bE(){if(!(--bB)){e.resolveWith(bv,[bv])}}while(by--){if((bx=b.data(bv[by],bz,L,true)||(b.data(bv[by],bA,L,true)||b.data(bv[by],bC,L,true))&&b.data(bv[by],bz,b.Callbacks("once memory"),true))){bB++;bx.add(bE)}}bE();return e.promise()}});var aP=/[\n\t\r]/g,af=/\s+/,aU=/\r/g,g=/^(?:button|input)$/i,D=/^(?:button|input|object|select|textarea)$/i,l=/^a(?:rea)?$/i,ao=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,F=b.support.getSetAttribute,be,aY,aF;b.fn.extend({attr:function(e,bv){return b.access(this,e,bv,true,b.attr)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,bv){return b.access(this,e,bv,true,b.prop)},removeProp:function(e){e=b.propFix[e]||e;return this.each(function(){try{this[e]=L;delete this[e]}catch(bv){}})},addClass:function(by){var bA,bw,bv,bx,bz,bB,e;if(b.isFunction(by)){return this.each(function(bC){b(this).addClass(by.call(this,bC,this.className))})}if(by&&typeof by==="string"){bA=by.split(af);for(bw=0,bv=this.length;bw<bv;bw++){bx=this[bw];if(bx.nodeType===1){if(!bx.className&&bA.length===1){bx.className=by}else{bz=" "+bx.className+" ";for(bB=0,e=bA.length;bB<e;bB++){if(!~bz.indexOf(" "+bA[bB]+" ")){bz+=bA[bB]+" "}}bx.className=b.trim(bz)}}}}return this},removeClass:function(bz){var bA,bw,bv,by,bx,bB,e;if(b.isFunction(bz)){return this.each(function(bC){b(this).removeClass(bz.call(this,bC,this.className))})}if((bz&&typeof bz==="string")||bz===L){bA=(bz||"").split(af);for(bw=0,bv=this.length;bw<bv;bw++){by=this[bw];if(by.nodeType===1&&by.className){if(bz){bx=(" "+by.className+" ").replace(aP," ");for(bB=0,e=bA.length;bB<e;bB++){bx=bx.replace(" "+bA[bB]+" "," ")}by.className=b.trim(bx)}else{by.className=""}}}}return this},toggleClass:function(bx,bv){var bw=typeof bx,e=typeof bv==="boolean";if(b.isFunction(bx)){return this.each(function(by){b(this).toggleClass(bx.call(this,by,this.className,bv),bv)})}return this.each(function(){if(bw==="string"){var bA,bz=0,by=b(this),bB=bv,bC=bx.split(af);while((bA=bC[bz++])){bB=e?bB:!by.hasClass(bA);by[bB?"addClass":"removeClass"](bA)}}else{if(bw==="undefined"||bw==="boolean"){if(this.className){b._data(this,"__className__",this.className)}this.className=this.className||bx===false?"":b._data(this,"__className__")||""}}})},hasClass:function(e){var bx=" "+e+" ",bw=0,bv=this.length;for(;bw<bv;bw++){if(this[bw].nodeType===1&&(" "+this[bw].className+" ").replace(aP," ").indexOf(bx)>-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv<bz;bv++){bx=bC[bv];if(bx.selected&&(b.support.optDisabled?!bx.disabled:bx.getAttribute("disabled")===null)&&(!bx.parentNode.disabled||!b.nodeName(bx.parentNode,"optgroup"))){bA=b(bx).val();if(bw){return bA}bB.push(bA)}}if(bw&&!bB.length&&bC.length){return b(bC[by]).val()}return bB},set:function(bv,bw){var e=b.makeArray(bw);b(bv).find("option").each(function(){this.selected=b.inArray(b(this).val(),e)>=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw<e;bw++){bv=bA[bw];if(bv){by=b.propFix[bv]||bv;b.attr(bx,bv,"");bx.removeAttribute(F?bv:by);if(ao.test(bv)&&by in bx){bx[by]=false}}}}},attrHooks:{type:{set:function(e,bv){if(g.test(e.nodeName)&&e.parentNode){b.error("type property can't be changed")}else{if(!b.support.radioValue&&bv==="radio"&&b.nodeName(e,"input")){var bw=e.value;e.setAttribute("type",bv);if(bw){e.value=bw}return bv}}}},value:{get:function(bv,e){if(be&&b.nodeName(bv,"button")){return be.get(bv,e)}return e in bv?bv.value:null},set:function(bv,bw,e){if(be&&b.nodeName(bv,"button")){return be.set(bv,bw,e)}bv.value=bw}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(bz,bx,bA){var bw,e,by,bv=bz.nodeType;if(!bz||bv===3||bv===8||bv===2){return}by=bv!==1||!b.isXMLDoc(bz);if(by){bx=b.propFix[bx]||bx;e=b.propHooks[bx]}if(bA!==L){if(e&&"set" in e&&(bw=e.set(bz,bA,bx))!==L){return bw}else{return(bz[bx]=bA)}}else{if(e&&"get" in e&&(bw=e.get(bz,bx))!==null){return bw}else{return bz[bx]}}},propHooks:{tabIndex:{get:function(bv){var e=bv.getAttributeNode("tabindex");return e&&e.specified?parseInt(e.value,10):D.test(bv.nodeName)||l.test(bv.nodeName)&&bv.href?0:L}}}});b.attrHooks.tabindex=b.propHooks.tabIndex;aY={get:function(bv,e){var bx,bw=b.prop(bv,e);return bw===true||typeof bw!=="boolean"&&(bx=bv.getAttributeNode(e))&&bx.nodeValue!==false?e.toLowerCase():L},set:function(bv,bx,e){var bw;if(bx===false){b.removeAttr(bv,e)}else{bw=b.propFix[e]||e;if(bw in bv){bv[bw]=true}bv.setAttribute(e,e.toLowerCase())}return e}};if(!F){aF={name:true,id:true};be=b.valHooks.button={get:function(bw,bv){var e;e=bw.getAttributeNode(bv);return e&&(aF[bv]?e.nodeValue!=="":e.specified)?e.nodeValue:L},set:function(bw,bx,bv){var e=bw.getAttributeNode(bv);if(!e){e=av.createAttribute(bv);bw.setAttributeNode(e)}return(e.nodeValue=bx+"")}};b.attrHooks.tabindex.set=be.set;b.each(["width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{set:function(bw,bx){if(bx===""){bw.setAttribute(e,"auto");return bx}}})});b.attrHooks.contenteditable={get:be.get,set:function(bv,bw,e){if(bw===""){bw="false"}be.set(bv,bw,e)}}}if(!b.support.hrefNormalized){b.each(["href","src","width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{get:function(bx){var bw=bx.getAttribute(e,2);return bw===null?L:bw}})})}if(!b.support.style){b.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||L},set:function(e,bv){return(e.style.cssText=""+bv)}}}if(!b.support.optSelected){b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(bv){var e=bv.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}return null}})}if(!b.support.enctype){b.propFix.enctype="encoding"}if(!b.support.checkOn){b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}})}b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,bv){if(b.isArray(bv)){return(e.checked=b.inArray(b(e).val(),bv)>=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI<bC.length;bI++){bH=n.exec(bC[bI])||[];bF=bH[1];e=(bH[2]||"").split(".").sort();bE=b.event.special[bF]||{};bF=(by?bE.delegateType:bE.bindType)||bF;bE=b.event.special[bF]||{};bG=b.extend({type:bF,origType:bH[1],data:bA,handler:bJ,guid:bJ.guid,selector:by,quick:Y(by),namespace:e.join(".")},bv);bw=bK[bF];if(!bw){bw=bK[bF]=[];bw.delegateCount=0;if(!bE.setup||bE.setup.call(bx,bA,e,bB)===false){if(bx.addEventListener){bx.addEventListener(bF,bB,false)}else{if(bx.attachEvent){bx.attachEvent("on"+bF,bB)}}}}if(bE.add){bE.add.call(bx,bG);if(!bG.handler.guid){bG.handler.guid=bJ.guid}}if(by){bw.splice(bw.delegateCount++,0,bG)}else{bw.push(bG)}b.event.global[bF]=true}bx=null},global:{},remove:function(bJ,bE,bv,bH,bB){var bI=b.hasData(bJ)&&b._data(bJ),bF,bx,bz,bL,bC,bA,bG,bw,by,bK,bD,e;if(!bI||!(bw=bI.events)){return}bE=b.trim(bt(bE||"")).split(" ");for(bF=0;bF<bE.length;bF++){bx=n.exec(bE[bF])||[];bz=bL=bx[1];bC=bx[2];if(!bz){for(bz in bw){b.event.remove(bJ,bz+bE[bF],bv,bH,true)}continue}by=b.event.special[bz]||{};bz=(bH?by.delegateType:by.bindType)||bz;bD=bw[bz]||[];bA=bD.length;bC=bC?new RegExp("(^|\\.)"+bC.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(bG=0;bG<bD.length;bG++){e=bD[bG];if((bB||bL===e.origType)&&(!bv||bv.guid===e.guid)&&(!bC||bC.test(e.namespace))&&(!bH||bH===e.selector||bH==="**"&&e.selector)){bD.splice(bG--,1);if(e.selector){bD.delegateCount--}if(by.remove){by.remove.call(bJ,e)}}}if(bD.length===0&&bA!==bD.length){if(!by.teardown||by.teardown.call(bJ,bC)===false){b.removeEvent(bJ,bz,bI.handle)}delete bw[bz]}}if(b.isEmptyObject(bw)){bK=bI.handle;if(bK){bK.elem=null}b.removeData(bJ,["events","handle"],true)}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(bv,bD,bA,bJ){if(bA&&(bA.nodeType===3||bA.nodeType===8)){return}var bG=bv.type||bv,bx=[],e,bw,bC,bH,bz,by,bF,bE,bB,bI;if(T.test(bG+b.event.triggered)){return}if(bG.indexOf("!")>=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bC<bB.length&&!bv.isPropagationStopped();bC++){bH=bB[bC][0];bv.type=bB[bC][1];bE=(b._data(bH,"events")||{})[bv.type]&&b._data(bH,"handle");if(bE){bE.apply(bH,bD)}bE=by&&bH[by];if(bE&&b.acceptData(bH)&&bE.apply(bH,bD)===false){bv.preventDefault()}}bv.type=bG;if(!bJ&&!bv.isDefaultPrevented()){if((!bF._default||bF._default.apply(bA.ownerDocument,bD)===false)&&!(bG==="click"&&b.nodeName(bA,"a"))&&b.acceptData(bA)){if(by&&bA[bG]&&((bG!=="focus"&&bG!=="blur")||bv.target.offsetWidth!==0)&&!b.isWindow(bA)){bz=bA[by];if(bz){bA[by]=null}b.event.triggered=bG;bA[bG]();b.event.triggered=L;if(bz){bA[by]=bz}}}}return bv.result},dispatch:function(e){e=b.event.fix(e||bb.event);var bz=((b._data(this,"events")||{})[e.type]||[]),bA=bz.delegateCount,bG=[].slice.call(arguments,0),by=!e.exclusive&&!e.namespace,bH=[],bC,bB,bK,bx,bF,bE,bv,bD,bI,bw,bJ;bG[0]=e;e.delegateTarget=this;if(bA&&!e.target.disabled&&!(e.button&&e.type==="click")){bx=b(this);bx.context=this.ownerDocument||this;for(bK=e.target;bK!=this;bK=bK.parentNode||this){bE={};bD=[];bx[0]=bK;for(bC=0;bC<bA;bC++){bI=bz[bC];bw=bI.selector;if(bE[bw]===L){bE[bw]=(bI.quick?j(bK,bI.quick):bx.is(bw))}if(bE[bw]){bD.push(bI)}}if(bD.length){bH.push({elem:bK,matches:bD})}}}if(bz.length>bA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC<bH.length&&!e.isPropagationStopped();bC++){bv=bH[bC];e.currentTarget=bv.elem;for(bB=0;bB<bv.matches.length&&!e.isImmediatePropagationStopped();bB++){bI=bv.matches[bB];if(by||(!e.namespace&&!bI.namespace)||e.namespace_re&&e.namespace_re.test(bI.namespace)){e.data=bI.data;e.handleObj=bI;bF=((b.event.special[bI.origType]||{}).handle||bI.handler).apply(bv.elem,bG);if(bF!==L){e.result=bF;if(bF===false){e.preventDefault();e.stopPropagation()}}}}}return e.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(bv,e){if(bv.which==null){bv.which=e.charCode!=null?e.charCode:e.keyCode}return bv}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(bx,bw){var by,bz,e,bv=bw.button,bA=bw.fromElement;if(bx.pageX==null&&bw.clientX!=null){by=bx.target.ownerDocument||av;bz=by.documentElement;e=by.body;bx.pageX=bw.clientX+(bz&&bz.scrollLeft||e&&e.scrollLeft||0)-(bz&&bz.clientLeft||e&&e.clientLeft||0);bx.pageY=bw.clientY+(bz&&bz.scrollTop||e&&e.scrollTop||0)-(bz&&bz.clientTop||e&&e.clientTop||0)}if(!bx.relatedTarget&&bA){bx.relatedTarget=bA===bx.target?bw.toElement:bA}if(!bx.which&&bv!==L){bx.which=(bv&1?1:(bv&2?3:(bv&4?2:0)))}return bx}},fix:function(bw){if(bw[b.expando]){return bw}var bv,bz,e=bw,bx=b.event.fixHooks[bw.type]||{},by=bx.props?this.props.concat(bx.props):this.props;bw=b.Event(e);for(bv=by.length;bv;){bz=by[--bv];bw[bz]=e[bz]}if(!bw.target){bw.target=e.srcElement||av}if(bw.target.nodeType===3){bw.target=bw.target.parentNode}if(bw.metaKey===L){bw.metaKey=bw.ctrlKey}return bx.filter?bx.filter(bw,e):bw},special:{ready:{setup:b.bindReady},load:{noBubble:true},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(bw,bv,e){if(b.isWindow(this)){this.onbeforeunload=e}},teardown:function(bv,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}},simulate:function(bw,by,bx,bv){var bz=b.extend(new b.Event(),bx,{type:bw,isSimulated:true,originalEvent:{}});if(bv){b.event.trigger(bz,null,by)}else{b.event.dispatch.call(by,bz)}if(bz.isDefaultPrevented()){bx.preventDefault()}}};b.event.handle=b.event.dispatch;b.removeEvent=av.removeEventListener?function(bv,e,bw){if(bv.removeEventListener){bv.removeEventListener(e,bw,false)}}:function(bv,e,bw){if(bv.detachEvent){bv.detachEvent("on"+e,bw)}};b.Event=function(bv,e){if(!(this instanceof b.Event)){return new b.Event(bv,e)}if(bv&&bv.type){this.originalEvent=bv;this.type=bv.type;this.isDefaultPrevented=(bv.defaultPrevented||bv.returnValue===false||bv.getPreventDefault&&bv.getPreventDefault())?i:bk}else{this.type=bv}if(e){b.extend(this,e)}this.timeStamp=bv&&bv.timeStamp||b.now();this[b.expando]=true};function bk(){return false}function i(){return true}b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=i;var bv=this.originalEvent;if(!bv){return}if(bv.preventDefault){bv.preventDefault()}else{bv.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=i;var bv=this.originalEvent;if(!bv){return}if(bv.stopPropagation){bv.stopPropagation()}bv.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i;this.stopPropagation()},isDefaultPrevented:bk,isPropagationStopped:bk,isImmediatePropagationStopped:bk};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bv,e){b.event.special[bv]={delegateType:e,bindType:e,handle:function(bz){var bB=this,bA=bz.relatedTarget,by=bz.handleObj,bw=by.selector,bx;if(!bA||(bA!==bB&&!b.contains(bB,bA))){bz.type=by.origType;bx=by.handler.apply(this,arguments);bz.type=e}return bx}}});if(!b.support.submitBubbles){b.event.special.submit={setup:function(){if(b.nodeName(this,"form")){return false}b.event.add(this,"click._submit keypress._submit",function(bx){var bw=bx.target,bv=b.nodeName(bw,"input")||b.nodeName(bw,"button")?bw.form:L;if(bv&&!bv._submit_attached){b.event.add(bv,"submit._submit",function(e){if(this.parentNode&&!e.isTrigger){b.event.simulate("submit",this.parentNode,e,true)}});bv._submit_attached=true}})},teardown:function(){if(b.nodeName(this,"form")){return false}b.event.remove(this,"._submit")}}}if(!b.support.changeBubbles){b.event.special.change={setup:function(){if(bd.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){b.event.add(this,"propertychange._change",function(e){if(e.originalEvent.propertyName==="checked"){this._just_changed=true}});b.event.add(this,"click._change",function(e){if(this._just_changed&&!e.isTrigger){this._just_changed=false;b.event.simulate("change",this,e,true)}})}return false}b.event.add(this,"beforeactivate._change",function(bw){var bv=bw.target;if(bd.test(bv.nodeName)&&!bv._change_attached){b.event.add(bv,"change._change",function(e){if(this.parentNode&&!e.isSimulated&&!e.isTrigger){b.event.simulate("change",this.parentNode,e,true)}});bv._change_attached=true}})},handle:function(bv){var e=bv.target;if(this!==e||bv.isSimulated||bv.isTrigger||(e.type!=="radio"&&e.type!=="checkbox")){return bv.handleObj.handler.apply(this,arguments)}},teardown:function(){b.event.remove(this,"._change");return bd.test(this.nodeName)}}}if(!b.support.focusinBubbles){b.each({focus:"focusin",blur:"focusout"},function(bx,e){var bv=0,bw=function(by){b.event.simulate(e,by.target,b.event.fix(by),true)};b.event.special[e]={setup:function(){if(bv++===0){av.addEventListener(bx,bw,true)}},teardown:function(){if(--bv===0){av.removeEventListener(bx,bw,true)}}}})}b.fn.extend({on:function(bw,e,bz,by,bv){var bA,bx;if(typeof bw==="object"){if(typeof e!=="string"){bz=e;e=L}for(bx in bw){this.on(bx,e,bz,bw[bx],bv)}return this}if(bz==null&&by==null){by=e;bz=e=L}else{if(by==null){if(typeof e==="string"){by=bz;bz=L}else{by=bz;bz=e;e=L}}}if(by===false){by=bk}else{if(!by){return this}}if(bv===1){bA=by;by=function(bB){b().off(bB);return bA.apply(this,arguments)};by.guid=bA.guid||(bA.guid=b.guid++)}return this.each(function(){b.event.add(this,bw,by,bz,e)})},one:function(bv,e,bx,bw){return this.on.call(this,bv,e,bx,bw,1)},off:function(bw,e,by){if(bw&&bw.preventDefault&&bw.handleObj){var bv=bw.handleObj;b(bw.delegateTarget).off(bv.namespace?bv.type+"."+bv.namespace:bv.type,bv.selector,bv.handler);return this}if(typeof bw==="object"){for(var bx in bw){this.off(bx,e,bw[bx])}return this}if(e===false||typeof e==="function"){by=e;e=L}if(by===false){by=bk}return this.each(function(){b.event.remove(this,bw,by,e)})},bind:function(e,bw,bv){return this.on(e,null,bw,bv)},unbind:function(e,bv){return this.off(e,null,bv)},live:function(e,bw,bv){b(this.context).on(e,this.selector,bw,bv);return this},die:function(e,bv){b(this.context).off(e,this.selector||"**",bv);return this},delegate:function(e,bv,bx,bw){return this.on(bv,e,bx,bw)},undelegate:function(e,bv,bw){return arguments.length==1?this.off(e,"**"):this.off(bv,e,bw)},trigger:function(e,bv){return this.each(function(){b.event.trigger(e,bv,this)})},triggerHandler:function(e,bv){if(this[0]){return b.event.trigger(e,bv,this[0],true)}},toggle:function(bx){var bv=arguments,e=bx.guid||b.guid++,bw=0,by=function(bz){var bA=(b._data(this,"lastToggle"+bx.guid)||0)%bw;b._data(this,"lastToggle"+bx.guid,bA+1);bz.preventDefault();return bv[bA].apply(this,arguments)||false};by.guid=e;while(bw<bv.length){bv[bw++].guid=e}return this.click(by)},hover:function(e,bv){return this.mouseenter(e).mouseleave(bv||e)}});b.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu").split(" "),function(bv,e){b.fn[e]=function(bx,bw){if(bw==null){bw=bx;bx=null}return arguments.length>0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); fuse3-3.10.0/doc/html/jquery.js-17-/*! ############################################## fuse3-3.10.0/doc/html/jquery.js-22- */ fuse3-3.10.0/doc/html/jquery.js:23:(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e<bR.length;e++){if(bR[e]===bR[e-1]){bR.splice(e--,1)}}}}return bR};by.matches=function(e,bR){return by(e,null,null,bR)};by.matchesSelector=function(e,bR){return by(bR,null,null,[e]).length>0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS<bU;bS++){bV=bE.order[bS];if((bT=bE.leftMatch[bV].exec(bX))){bR=bT[1];bT.splice(1,1);if(bR.substr(bR.length-1)!=="\\"){bT[1]=(bT[1]||"").replace(bK,"");bW=bE.find[bV](bT,e,bY);if(bW!=null){bX=bX.replace(bE.match[bV],"");break}}}}if(!bW){bW=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bW,expr:bX}};by.filter=function(b1,b0,b4,bU){var bW,e,bZ,b6,b3,bR,bT,bV,b2,bS=b1,b5=[],bY=b0,bX=b0&&b0[0]&&by.isXML(b0[0]);while(b1&&b0.length){for(bZ in bE.filter){if((bW=bE.leftMatch[bZ].exec(b1))!=null&&bW[2]){bR=bE.filter[bZ];bT=bW[1];e=false;bW.splice(1,1);if(bT.substr(bT.length-1)==="\\"){continue}if(bY===b5){b5=[]}if(bE.preFilter[bZ]){bW=bE.preFilter[bZ](bW,bY,b4,b5,bU,bX);if(!bW){e=b6=true}else{if(bW===true){continue}}}if(bW){for(bV=0;(b3=bY[bV])!=null;bV++){if(b3){b6=bR(b3,bW,bV,bY);b2=bU^b6;if(b4&&b6!=null){if(b2){e=true}else{bY[bV]=false}}else{if(b2){b5.push(b3);e=true}}}}}if(b6!==L){if(!b4){bY=b5}b1=b1.replace(bE.match[bZ],"");if(!e){return[]}break}}}if(b1===bS){if(e==null){by.error(b1)}else{break}}bS=b1}return bY};by.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var bw=by.getText=function(bU){var bS,bT,e=bU.nodeType,bR="";if(e){if(e===1||e===9){if(typeof bU.textContent==="string"){return bU.textContent}else{if(typeof bU.innerText==="string"){return bU.innerText.replace(bO,"")}else{for(bU=bU.firstChild;bU;bU=bU.nextSibling){bR+=bw(bU)}}}}else{if(e===3||e===4){return bU.nodeValue}}}else{for(bS=0;(bT=bU[bS]);bS++){if(bT.nodeType!==8){bR+=bw(bT)}}}return bR};var bE=by.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bW,bR){var bT=typeof bR==="string",bV=bT&&!bQ.test(bR),bX=bT&&!bV;if(bV){bR=bR.toLowerCase()}for(var bS=0,e=bW.length,bU;bS<e;bS++){if((bU=bW[bS])){while((bU=bU.previousSibling)&&bU.nodeType!==1){}bW[bS]=bX||bU&&bU.nodeName.toLowerCase()===bR?bU||false:bU===bR}}if(bX){by.filter(bR,bW,true)}},">":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS<e;bS++){bV=bW[bS];if(bV){var bT=bV.parentNode;bW[bS]=bT.nodeName.toLowerCase()===bR?bT:false}}}else{for(;bS<e;bS++){bV=bW[bS];if(bV){bW[bS]=bU?bV.parentNode:bV.parentNode===bR}}if(bU){by.filter(bR,bW,true)}}},"":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("parentNode",bR,bS,bT,bU,bV)},"~":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("previousSibling",bR,bS,bT,bU,bV)}},find:{ID:function(bR,bS,bT){if(typeof bS.getElementById!=="undefined"&&!bT){var e=bS.getElementById(bR[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bS,bV){if(typeof bV.getElementsByName!=="undefined"){var bR=[],bU=bV.getElementsByName(bS[1]);for(var bT=0,e=bU.length;bT<e;bT++){if(bU[bT].getAttribute("name")===bS[1]){bR.push(bU[bT])}}return bR.length===0?null:bR}},TAG:function(e,bR){if(typeof bR.getElementsByTagName!=="undefined"){return bR.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bT,bR,bS,e,bW,bX){bT=" "+bT[1].replace(bK,"")+" ";if(bX){return bT}for(var bU=0,bV;(bV=bR[bU])!=null;bU++){if(bV){if(bW^(bV.className&&(" "+bV.className+" ").replace(/[\t\n\r]/g," ").indexOf(bT)>=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bR<e[3]-0},gt:function(bS,bR,e){return bR>e[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV<bU;bV++){if(bT[bV]===bS){return false}}return true}else{by.error(e)}}}},CHILD:function(bS,bU){var bT,b0,bW,bZ,e,bV,bY,bX=bU[1],bR=bS;switch(bX){case"only":case"first":while((bR=bR.previousSibling)){if(bR.nodeType===1){return false}}if(bX==="first"){return true}bR=bS;case"last":while((bR=bR.nextSibling)){if(bR.nodeType===1){return false}}return true;case"nth":bT=bU[2];b0=bU[3];if(bT===1&&b0===0){return true}bW=bU[0];bZ=bS.parentNode;if(bZ&&(bZ[bC]!==bW||!bS.nodeIndex)){bV=0;for(bR=bZ.firstChild;bR;bR=bR.nextSibling){if(bR.nodeType===1){bR.nodeIndex=++bV}}bZ[bC]=bW}bY=bS.nodeIndex-b0;if(bT===0){return bY===0}else{return(bY%bT===0&&bY/bT>=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS<e;bS++){bR.push(bU[bS])}}else{for(;bU[bS];bS++){bR.push(bU[bS])}}}return bR}}var bJ,bG;if(av.documentElement.compareDocumentPosition){bJ=function(bR,e){if(bR===e){bB=true;return 0}if(!bR.compareDocumentPosition||!e.compareDocumentPosition){return bR.compareDocumentPosition?-1:1}return bR.compareDocumentPosition(e)&4?-1:1}}else{bJ=function(bY,bX){if(bY===bX){bB=true;return 0}else{if(bY.sourceIndex&&bX.sourceIndex){return bY.sourceIndex-bX.sourceIndex}}var bV,bR,bS=[],e=[],bU=bY.parentNode,bW=bX.parentNode,bZ=bU;if(bU===bW){return bG(bY,bX)}else{if(!bU){return -1}else{if(!bW){return 1}}}while(bZ){bS.unshift(bZ);bZ=bZ.parentNode}bZ=bW;while(bZ){e.unshift(bZ);bZ=bZ.parentNode}bV=bS.length;bR=e.length;for(var bT=0;bT<bV&&bT<bR;bT++){if(bS[bT]!==e[bT]){return bG(bS[bT],e[bT])}}return bT===bV?bG(bY,e[bT],-1):bG(bS[bT],bX,1)};bG=function(bR,e,bS){if(bR===e){return bS}var bT=bR.nextSibling;while(bT){if(bT===e){return -1}bT=bT.nextSibling}return 1}}(function(){var bR=av.createElement("div"),bS="script"+(new Date()).getTime(),e=av.documentElement;bR.innerHTML="<a name='"+bS+"'/>";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="<p class='TEST'></p>";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1&&!bY){e[bC]=bV;e.sizset=bT}if(e.nodeName.toLowerCase()===bW){bU=e;break}e=e[bR]}bZ[bT]=bU}}}function bN(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1){if(!bY){e[bC]=bV;e.sizset=bT}if(typeof bW!=="string"){if(e===bW){bU=true;break}}else{if(by.filter(bW,[e]).length>0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT<bR;bT++){by(bS,bY[bT],bX,bW)}return by.filter(bU,bX)};by.attr=b.attr;by.selectors.attrMap={};b.find=by;b.expr=by.selectors;b.expr[":"]=b.expr.filters;b.unique=by.uniqueSort;b.text=by.getText;b.isXMLDoc=by.isXML;b.contains=by.contains})();var ab=/Until$/,aq=/^(?:parents|prevUntil|prevAll)/,a9=/,/,bp=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,H=b.expr.match.POS,ay={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bw=this,by,bv;if(typeof e!=="string"){return b(e).filter(function(){for(by=0,bv=bw.length;by<bv;by++){if(b.contains(bw[by],this)){return true}}})}var bx=this.pushStack("","find",e),bA,bB,bz;for(by=0,bv=this.length;by<bv;by++){bA=bx.length;b.find(e,this[by],bx);if(by>0){for(bB=bA;bB<bx.length;bB++){for(bz=0;bz<bA;bz++){if(bx[bz]===bx[bB]){bx.splice(bB--,1);break}}}}}return bx},has:function(bv){var e=b(bv);return this.filter(function(){for(var bx=0,bw=e.length;bx<bw;bx++){if(b.contains(this,e[bx])){return true}}})},not:function(e){return this.pushStack(aG(this,e,false),"not",e)},filter:function(e){return this.pushStack(aG(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?H.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw<by.length;bw++){if(b(bz).is(by[bw])){bv.push({selector:by[bw],elem:bz,level:bB})}}bz=bz.parentNode;bB++}return bv}var bA=H.test(by)||typeof by!=="string"?b(by,bx||this.context):0;for(bw=0,e=this.length;bw<e;bw++){bz=this[bw];while(bz){if(bA?bA.index(bz)>-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/<tbody/i,W=/<|&#?\w+;/,ae=/<(?:script|style)/i,O=/<(?:script|object|embed|option|style)/i,ah=new RegExp("<(?:"+aR+")","i"),o=/checked\s*(?:[^=]|=\s*.checked.)/i,bm=/\/(java|ecma)script/i,aN=/^\s*<!(?:\[CDATA\[|\-\-)/,ax={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1></$2>");try{for(var bw=0,bv=this.length;bw<bv;bw++){if(this[bw].nodeType===1){b.cleanData(this[bw].getElementsByTagName("*"));this[bw].innerHTML=bx}}}catch(by){this.empty().append(bx)}}else{if(b.isFunction(bx)){this.each(function(bz){var e=b(this);e.html(bx.call(this,bz,e.html()))})}else{this.empty().append(bx)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bx){var bw=b(this),bv=bw.html();bw.replaceWith(e.call(this,bx,bv))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bw=this.nextSibling,bv=this.parentNode;b(this).remove();if(bw){b(bw).before(e)}else{b(bv).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(bB,bF,bE){var bx,by,bA,bD,bC=bB[0],bv=[];if(!b.support.checkClone&&arguments.length===3&&typeof bC==="string"&&o.test(bC)){return this.each(function(){b(this).domManip(bB,bF,bE,true)})}if(b.isFunction(bC)){return this.each(function(bH){var bG=b(this);bB[0]=bC.call(this,bH,bF?bG.html():L);bG.domManip(bB,bF,bE)})}if(this[0]){bD=bC&&bC.parentNode;if(b.support.parentNode&&bD&&bD.nodeType===11&&bD.childNodes.length===this.length){bx={fragment:bD}}else{bx=b.buildFragment(bB,this,bv)}bA=bx.fragment;if(bA.childNodes.length===1){by=bA=bA.firstChild}else{by=bA.firstChild}if(by){bF=bF&&b.nodeName(by,"tr");for(var bw=0,e=this.length,bz=e-1;bw<e;bw++){bE.call(bF?ba(this[bw],by):this[bw],bx.cacheable||(e>1&&bw<bz)?b.clone(bA,true,true):bA)}}if(bv.length){b.each(bv,bo)}}return this}});function ba(e,bv){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function t(bB,bv){if(bv.nodeType!==1||!b.hasData(bB)){return}var by,bx,e,bA=b._data(bB),bz=b._data(bv,bA),bw=bA.events;if(bw){delete bz.handle;bz.events={};for(by in bw){for(bx=0,e=bw[by].length;bx<e;bx++){b.event.add(bv,by+(bw[by][bx].namespace?".":"")+bw[by][bx].namespace,bw[by][bx],bw[by][bx].data)}}}if(bz.data){bz.data=b.extend({},bz.data)}}function ai(bv,e){var bw;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bv)}bw=e.nodeName.toLowerCase();if(bw==="object"){e.outerHTML=bv.outerHTML}else{if(bw==="input"&&(bv.type==="checkbox"||bv.type==="radio")){if(bv.checked){e.defaultChecked=e.checked=bv.checked}if(e.value!==bv.value){e.value=bv.value}}else{if(bw==="option"){e.selected=bv.defaultSelected}else{if(bw==="input"||bw==="textarea"){e.defaultValue=bv.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(bz,bx,bv){var by,e,bw,bA,bB=bz[0];if(bx&&bx[0]){bA=bx[0].ownerDocument||bx[0]}if(!bA.createDocumentFragment){bA=av}if(bz.length===1&&typeof bB==="string"&&bB.length<512&&bA===av&&bB.charAt(0)==="<"&&!O.test(bB)&&(b.support.checkClone||!o.test(bB))&&(b.support.html5Clone||!ah.test(bB))){e=true;bw=b.fragments[bB];if(bw&&bw!==1){by=bw}}if(!by){by=bA.createDocumentFragment();b.clean(bz,bA,by,bv)}if(e){b.fragments[bB]=bw?by:1}return{fragment:by,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bv){b.fn[e]=function(bw){var bz=[],bC=b(bw),bB=this.length===1&&this[0].parentNode;if(bB&&bB.nodeType===11&&bB.childNodes.length===1&&bC.length===1){bC[bv](this[0]);return this}else{for(var bA=0,bx=bC.length;bA<bx;bA++){var by=(bA>0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1></$2>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]==="<table>"&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB<bG;bB++){E(bz[bB])}}else{E(bz)}}if(bz.nodeType){bI.push(bz)}else{bI=b.merge(bI,bz)}}if(bH){bF=function(bL){return !bL.type||bm.test(bL.type)};for(bE=0;bI[bE];bE++){if(bA&&b.nodeName(bI[bE],"script")&&(!bI[bE].type||bI[bE].type.toLowerCase()==="text/javascript")){bA.push(bI[bE].parentNode?bI[bE].parentNode.removeChild(bI[bE]):bI[bE])}else{if(bI[bE].nodeType===1){var bJ=b.grep(bI[bE].getElementsByTagName("script"),bF);bI.splice.apply(bI,[bE+1,0].concat(bJ))}bH.appendChild(bI[bE])}}}return bI},cleanData:function(bv){var by,bw,e=b.cache,bB=b.event.special,bA=b.support.deleteExpando;for(var bz=0,bx;(bx=bv[bz])!=null;bz++){if(bx.nodeName&&b.noData[bx.nodeName.toLowerCase()]){continue}bw=bx[b.expando];if(bw){by=e[bw];if(by&&by.events){for(var bC in by.events){if(bB[bC]){b.event.remove(bx,bC)}else{b.removeEvent(bx,bC,by.handle)}}if(by.handle){by.handle.elem=null}}if(bA){delete bx[b.expando]}else{if(bx.removeAttribute){bx.removeAttribute(b.expando)}}delete e[bw]}}}});function bo(e,bv){if(bv.src){b.ajax({url:bv.src,async:false,dataType:"script"})}else{b.globalEval((bv.text||bv.textContent||bv.innerHTML||"").replace(aN,"/*$0*/"))}if(bv.parentNode){bv.parentNode.removeChild(bv)}}var ak=/alpha\([^)]*\)/i,au=/opacity=([^)]*)/,z=/([A-Z]|^ms)/g,bc=/^-?\d+(?:px)?$/i,bn=/^-?\d/,I=/^([\-+])=([\-+.\de]+)/,a7={position:"absolute",visibility:"hidden",display:"block"},an=["Left","Right"],a1=["Top","Bottom"],Z,aI,aX;b.fn.css=function(e,bv){if(arguments.length===2&&bv===L){return this}return b.access(this,e,bv,true,function(bx,bw,by){return by!==L?b.style(bx,bw,by):b.css(bx,bw)})};b.extend({cssHooks:{opacity:{get:function(bw,bv){if(bv){var e=Z(bw,"opacity","opacity");return e===""?"1":e}else{return bw.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bx,bw,bD,by){if(!bx||bx.nodeType===3||bx.nodeType===8||!bx.style){return}var bB,bC,bz=b.camelCase(bw),bv=bx.style,bE=b.cssHooks[bz];bw=b.cssProps[bz]||bz;if(bD!==L){bC=typeof bD;if(bC==="string"&&(bB=I.exec(bD))){bD=(+(bB[1]+1)*+bB[2])+parseFloat(b.css(bx,bw));bC="number"}if(bD==null||bC==="number"&&isNaN(bD)){return}if(bC==="number"&&!b.cssNumber[bz]){bD+="px"}if(!bE||!("set" in bE)||(bD=bE.set(bx,bD))!==L){try{bv[bw]=bD}catch(bA){}}}else{if(bE&&"get" in bE&&(bB=bE.get(bx,false,by))!==L){return bB}return bv[bw]}},css:function(by,bx,bv){var bw,e;bx=b.camelCase(bx);e=b.cssHooks[bx];bx=b.cssProps[bx]||bx;if(bx==="cssFloat"){bx="float"}if(e&&"get" in e&&(bw=e.get(by,true,bv))!==L){return bw}else{if(Z){return Z(by,bx)}}},swap:function(bx,bw,by){var e={};for(var bv in bw){e[bv]=bx.style[bv];bx.style[bv]=bw[bv]}by.call(bx);for(bv in bw){bx.style[bv]=e[bv]}}});b.curCSS=b.css;b.each(["height","width"],function(bv,e){b.cssHooks[e]={get:function(by,bx,bw){var bz;if(bx){if(by.offsetWidth!==0){return p(by,e,bw)}else{b.swap(by,a7,function(){bz=p(by,e,bw)})}return bz}},set:function(bw,bx){if(bc.test(bx)){bx=parseFloat(bx);if(bx>=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx<e;bx++){if(!bv){bA-=parseFloat(b.css(by,"padding"+bz[bx]))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}else{bA-=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}}}return bA+"px"}bA=Z(by,bw,bw);if(bA<0||bA==null){bA=by.style[bw]||0}bA=parseFloat(bA)||0;if(bv){for(;bx<e;bx++){bA+=parseFloat(b.css(by,"padding"+bz[bx]))||0;if(bv!=="padding"){bA+=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}}}return bA+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bw){var bv=bw.offsetWidth,e=bw.offsetHeight;return(bv===0&&e===0)||(!b.support.reliableHiddenOffsets&&((bw.style&&bw.style.display)||b.css(bw,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var k=/%20/g,ap=/\[\]$/,bs=/\r?\n/g,bq=/#.*$/,aD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aZ=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aM=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,aQ=/^(?:GET|HEAD)$/,c=/^\/\//,M=/\?/,a6=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw<bz;bw++){bv=bx[bw];bC=/^\+/.test(bv);if(bC){bv=bv.substr(1)||"*"}bB=e[bv]=e[bv]||[];bB[bC?"unshift":"push"](bA)}}}}function aW(bv,bE,bz,bD,bB,bx){bB=bB||bE.dataTypes[0];bx=bx||{};bx[bB]=true;var bA=bv[bB],bw=0,e=bA?bA.length:0,by=(bv===aa),bC;for(;bw<e&&(by||!bC);bw++){bC=bA[bw](bE,bz,bD);if(typeof bC==="string"){if(!by||bx[bC]){bC=L}else{bE.dataTypes.unshift(bC);bC=aW(bv,bE,bz,bD,bC,bx)}}}if((by||!bC)&&!bx["*"]){bC=aW(bv,bE,bz,bD,"*",bx)}return bC}function am(bw,bx){var bv,e,by=b.ajaxSettings.flatOptions||{};for(bv in bx){if(bx[bv]!==L){(by[bv]?bw:(e||(e={})))[bv]=bx[bv]}}if(e){b.extend(true,bw,e)}}b.fn.extend({load:function(bw,bz,bA){if(typeof bw!=="string"&&A){return A.apply(this,arguments)}else{if(!this.length){return this}}var by=bw.indexOf(" ");if(by>=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("<div>").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA<bw;bA++){if(bA===1){for(bE in bH.converters){if(typeof bE==="string"){bG[bE.toLowerCase()]=bH.converters[bE]}}}bx=bC;bC=bD[bA];if(bC==="*"){bC=bx}else{if(bx!=="*"&&bx!==bC){by=bx+" "+bC;bF=bG[by]||bG["* "+bC];if(!bF){e=L;for(bv in bG){bB=bv.split(" ");if(bB[0]===bx||bB[0]==="*"){e=bG[bB[1]+" "+bC];if(e){bv=bG[bv];if(bv===true){bF=e}else{if(e===true){bF=bv}}break}}}}if(!(bF||e)){b.error("No conversion from "+by.replace(" "," to "))}if(bF!==true){bz=bF?bF(bz):e(bv(bz))}}}}return bz}var aC=b.now(),u=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(aC++)}});b.ajaxPrefilter("json jsonp",function(bD,bA,bC){var bx=bD.contentType==="application/x-www-form-urlencoded"&&(typeof bD.data==="string");if(bD.dataTypes[0]==="jsonp"||bD.jsonp!==false&&(u.test(bD.url)||bx&&u.test(bD.data))){var bB,bw=bD.jsonpCallback=b.isFunction(bD.jsonpCallback)?bD.jsonpCallback():bD.jsonpCallback,bz=bb[bw],e=bD.url,by=bD.data,bv="$1"+bw+"$2";if(bD.jsonp!==false){e=e.replace(u,bv);if(bD.url===e){if(bx){by=by.replace(u,bv)}if(bD.data===by){e+=(/\?/.test(e)?"&":"?")+bD.jsonp+"="+bw}}}bD.url=e;bD.data=by;bb[bw]=function(bE){bB=[bE]};bC.always(function(){bb[bw]=bz;if(bB&&b.isFunction(bz)){bb[bw](bB[0])}});bD.converters["script json"]=function(){if(!bB){b.error(bw+" was not called")}return bB[0]};bD.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===L){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bw){if(bw.crossDomain){var e,bv=av.head||av.getElementsByTagName("head")[0]||av.documentElement;return{send:function(bx,by){e=av.createElement("script");e.async="async";if(bw.scriptCharset){e.charset=bw.scriptCharset}e.src=bw.url;e.onload=e.onreadystatechange=function(bA,bz){if(bz||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bv&&e.parentNode){bv.removeChild(e)}e=L;if(!bz){by(200,"success")}}};bv.insertBefore(e,bv.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var B=bb.ActiveXObject?function(){for(var e in N){N[e](0,1)}}:false,y=0,N;function aL(){try{return new bb.XMLHttpRequest()}catch(bv){}}function aj(){try{return new bb.ActiveXObject("Microsoft.XMLHTTP")}catch(bv){}}b.ajaxSettings.xhr=bb.ActiveXObject?function(){return !this.isLocal&&aL()||aj()}:aL;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bv;return{send:function(bB,bw){var bA=e.xhr(),bz,by;if(e.username){bA.open(e.type,e.url,e.async,e.username,e.password)}else{bA.open(e.type,e.url,e.async)}if(e.xhrFields){for(by in e.xhrFields){bA[by]=e.xhrFields[by]}}if(e.mimeType&&bA.overrideMimeType){bA.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!bB["X-Requested-With"]){bB["X-Requested-With"]="XMLHttpRequest"}try{for(by in bB){bA.setRequestHeader(by,bB[by])}}catch(bx){}bA.send((e.hasContent&&e.data)||null);bv=function(bK,bE){var bF,bD,bC,bI,bH;try{if(bv&&(bE||bA.readyState===4)){bv=L;if(bz){bA.onreadystatechange=b.noop;if(B){delete N[bz]}}if(bE){if(bA.readyState!==4){bA.abort()}}else{bF=bA.status;bC=bA.getAllResponseHeaders();bI={};bH=bA.responseXML;if(bH&&bH.documentElement){bI.xml=bH}bI.text=bA.responseText;try{bD=bA.statusText}catch(bJ){bD=""}if(!bF&&e.isLocal&&!e.crossDomain){bF=bI.text?200:404}else{if(bF===1223){bF=204}}}}}catch(bG){if(!bE){bw(-1,bG)}}if(bI){bw(bF,bD,bI,bC)}};if(!e.async||bA.readyState===4){bv()}else{bz=++y;if(B){if(!N){N={};b(bb).unload(B)}N[bz]=bv}bA.onreadystatechange=bv}},abort:function(){if(bv){bv(0,1)}}}}})}var Q={},a8,m,aB=/^(?:toggle|show|hide)$/,aT=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,a3,aH=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a4;b.fn.extend({show:function(bx,bA,bz){var bw,by;if(bx||bx===0){return this.animate(a0("show",3),bx,bA,bz)}else{for(var bv=0,e=this.length;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(!b._data(bw,"olddisplay")&&by==="none"){by=bw.style.display=""}if(by===""&&b.css(bw,"display")==="none"){b._data(bw,"olddisplay",x(bw.nodeName))}}}for(bv=0;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(by===""||by==="none"){bw.style.display=b._data(bw,"olddisplay")||""}}}return this}},hide:function(bx,bA,bz){if(bx||bx===0){return this.animate(a0("hide",3),bx,bA,bz)}else{var bw,by,bv=0,e=this.length;for(;bv<e;bv++){bw=this[bv];if(bw.style){by=b.css(bw,"display");if(by!=="none"&&!b._data(bw,"olddisplay")){b._data(bw,"olddisplay",by)}}}for(bv=0;bv<e;bv++){if(this[bv].style){this[bv].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bw,bv,bx){var e=typeof bw==="boolean";if(b.isFunction(bw)&&b.isFunction(bv)){this._toggle.apply(this,arguments)}else{if(bw==null||e){this.each(function(){var by=e?bw:b(this).is(":hidden");b(this)[by?"show":"hide"]()})}else{this.animate(a0("toggle",3),bw,bv,bx)}}return this},fadeTo:function(e,bx,bw,bv){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bx},e,bw,bv)},animate:function(bz,bw,by,bx){var e=b.speed(bw,by,bx);if(b.isEmptyObject(bz)){return this.each(e.complete,[false])}bz=b.extend({},bz);function bv(){if(e.queue===false){b._mark(this)}var bE=b.extend({},e),bK=this.nodeType===1,bI=bK&&b(this).is(":hidden"),bB,bF,bD,bJ,bH,bC,bG,bL,bA;bE.animatedProperties={};for(bD in bz){bB=b.camelCase(bD);if(bD!==bB){bz[bB]=bz[bD];delete bz[bD]}bF=bz[bB];if(b.isArray(bF)){bE.animatedProperties[bB]=bF[1];bF=bz[bB]=bF[0]}else{bE.animatedProperties[bB]=bE.specialEasing&&bE.specialEasing[bB]||bE.easing||"swing"}if(bF==="hide"&&bI||bF==="show"&&!bI){return bE.complete.call(this)}if(bK&&(bB==="height"||bB==="width")){bE.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout||x(this.nodeName)==="inline"){this.style.display="inline-block"}else{this.style.zoom=1}}}}if(bE.overflow!=null){this.style.overflow="hidden"}for(bD in bz){bJ=new b.fx(this,bE,bD);bF=bz[bD];if(aB.test(bF)){bA=b._data(this,"toggle"+bD)||(bF==="toggle"?bI?"show":"hide":0);if(bA){b._data(this,"toggle"+bD,bA==="show"?"hide":"show");bJ[bA]()}else{bJ[bF]()}}else{bH=aT.exec(bF);bC=bJ.cur();if(bH){bG=parseFloat(bH[2]);bL=bH[3]||(b.cssNumber[bD]?"":"px");if(bL!=="px"){b.style(this,bD,(bG||1)+bL);bC=((bG||1)/bJ.cur())*bC;b.style(this,bD,bC+bL)}if(bH[1]){bG=((bH[1]==="-="?-1:1)*bG)+bC}bJ.custom(bC,bG,bL)}else{bJ.custom(bC,bF,"")}}}return true}return e.queue===false?this.each(bv):this.queue(e.queue,bv)},stop:function(bw,bv,e){if(typeof bw!=="string"){e=bv;bv=bw;bw=L}if(bv&&bw!==false){this.queue(bw||"fx",[])}return this.each(function(){var bx,by=false,bA=b.timers,bz=b._data(this);if(!e){b._unmark(true,this)}function bB(bE,bF,bD){var bC=bF[bD];b.removeData(bE,bD,true);bC.stop(e)}if(bw==null){for(bx in bz){if(bz[bx]&&bz[bx].stop&&bx.indexOf(".run")===bx.length-4){bB(this,bz,bx)}}}else{if(bz[bx=bw+".run"]&&bz[bx].stop){bB(this,bz,bx)}}for(bx=bA.length;bx--;){if(bA[bx].elem===this&&(bw==null||bA[bx].queue===bw)){if(e){bA[bx](true)}else{bA[bx].saveState()}by=true;bA.splice(bx,1)}}if(!(e&&by)){b.dequeue(this,bw)}})}});function bh(){setTimeout(at,0);return(a4=b.now())}function at(){a4=L}function a0(bv,e){var bw={};b.each(aH.concat.apply([],aH.slice(0,e)),function(){bw[this]=bv});return bw}b.each({slideDown:a0("show",1),slideUp:a0("hide",1),slideToggle:a0("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bv){b.fn[e]=function(bw,by,bx){return this.animate(bv,bw,by,bx)}});b.extend({speed:function(bw,bx,bv){var e=bw&&typeof bw==="object"?b.extend({},bw):{complete:bv||!bv&&bx||b.isFunction(bw)&&bw,duration:bw,easing:bv&&bx||bx&&!b.isFunction(bx)&&bx};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;if(e.queue==null||e.queue===true){e.queue="fx"}e.old=e.complete;e.complete=function(by){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue){b.dequeue(this,e.queue)}else{if(by!==false){b._unmark(this)}}};return e},easing:{linear:function(bw,bx,e,bv){return e+bv*bw},swing:function(bw,bx,e,bv){return((-Math.cos(bw*Math.PI)/2)+0.5)*bv+e}},timers:[],fx:function(bv,e,bw){this.options=e;this.elem=bv;this.prop=bw;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bv=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bv))?!bv||bv==="auto"?0:bv:e},custom:function(bz,by,bx){var e=this,bw=b.fx;this.startTime=a4||bh();this.end=by;this.now=this.start=bz;this.pos=this.state=0;this.unit=bx||this.unit||(b.cssNumber[this.prop]?"":"px");function bv(bA){return e.step(bA)}bv.queue=this.options.queue;bv.elem=this.elem;bv.saveState=function(){if(e.options.hide&&b._data(e.elem,"fxshow"+e.prop)===L){b._data(e.elem,"fxshow"+e.prop,e.start)}};if(bv()&&b.timers.push(bv)&&!a3){a3=setInterval(bw.tick,bw.interval)}},show:function(){var e=b._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||b.style(this.elem,this.prop);this.options.show=true;if(e!==L){this.custom(this.cur(),e)}else{this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur())}b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b._data(this.elem,"fxshow"+this.prop)||b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(by){var bA,bB,bv,bx=a4||bh(),e=true,bz=this.elem,bw=this.options;if(by||bx>=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e<bv.length;e++){bw=bv[e];if(!bw()&&bv[e]===bw){bv.splice(e--,1)}}if(!bv.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(a3);a3=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=e.now+e.unit}else{e.elem[e.prop]=e.now}}}});b.each(["width","height"],function(e,bv){b.fx.step[bv]=function(bw){b.style(bw.elem,bv,Math.max(0,bw.now)+bw.unit)}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bv){return e===bv.elem}).length}}function x(bx){if(!Q[bx]){var e=av.body,bv=b("<"+bx+">").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/*! fuse3-3.10.0/doc/html/jquery.js-24- * jQuery UI 1.8.18 ############################################## fuse3-3.10.0/doc/html/jquery.js-86- */ fuse3-3.10.0/doc/html/jquery.js:87:(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module==="object"&&typeof module.exports==="object"){module.exports=a(require("jquery"))}else{a(jQuery)}}}(function(a){var b=[],e=!!window.createPopup,f=false,d="ontouchstart" in window,h=false,g=window.requestAnimationFrame||function(l){return setTimeout(l,1000/60)},c=window.cancelAnimationFrame||function(l){clearTimeout(l)};function k(m){var n=".smartmenus_mouse";if(!h&&!m){var o=true,l=null;a(document).bind(i([["mousemove",function(s){var t={x:s.pageX,y:s.pageY,timeStamp:new Date().getTime()};if(l){var q=Math.abs(l.x-t.x),p=Math.abs(l.y-t.y);if((q>0||p>0)&&q<=2&&p<=2&&t.timeStamp-l.timeStamp<=300){f=true;if(o){var r=a(s.target).closest("a");if(r.is("a")){a.each(b,function(){if(a.contains(this.$root[0],r[0])){this.itemEnter({currentTarget:r[0]});return false}})}o=false}}}l=t}],[d?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut",function(p){if(j(p.originalEvent)){f=false}}]],n));h=true}else{if(h&&m){a(document).unbind(n);h=false}}}function j(l){return !/^(4|mouse)$/.test(l.pointerType)}function i(l,n){if(!n){n=""}var m={};a.each(l,function(o,p){m[p[0].split(" ").join(n+" ")+n]=p[1]});return m}a.SmartMenus=function(m,l){this.$root=a(m);this.opts=l;this.rootId="";this.accessIdPrefix="";this.$subArrow=null;this.activatedItems=[];this.visibleSubMenus=[];this.showTimeout=0;this.hideTimeout=0;this.scrollTimeout=0;this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.idInc=0;this.$firstLink=null;this.$firstSub=null;this.disabled=false;this.$disableOverlay=null;this.$touchScrollingSub=null;this.cssTransforms3d="perspective" in m.style||"webkitPerspective" in m.style;this.wasCollapsible=false;this.init()};a.extend(a.SmartMenus,{hideAll:function(){a.each(b,function(){this.menuHideAll()})},destroy:function(){while(b.length){b[0].destroy()}k(true)},prototype:{init:function(n){var l=this;if(!n){b.push(this);this.rootId=(new Date().getTime()+Math.random()+"").replace(/\D/g,"");this.accessIdPrefix="sm-"+this.rootId+"-";if(this.$root.hasClass("sm-rtl")){this.opts.rightToLeftSubMenus=true}var r=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).bind(i([["mouseover focusin",a.proxy(this.rootOver,this)],["mouseout focusout",a.proxy(this.rootOut,this)],["keydown",a.proxy(this.rootKeyDown,this)]],r)).delegate("a",i([["mouseenter",a.proxy(this.itemEnter,this)],["mouseleave",a.proxy(this.itemLeave,this)],["mousedown",a.proxy(this.itemDown,this)],["focus",a.proxy(this.itemFocus,this)],["blur",a.proxy(this.itemBlur,this)],["click",a.proxy(this.itemClick,this)]],r));r+=this.rootId;if(this.opts.hideOnClick){a(document).bind(i([["touchstart",a.proxy(this.docTouchStart,this)],["touchmove",a.proxy(this.docTouchMove,this)],["touchend",a.proxy(this.docTouchEnd,this)],["click",a.proxy(this.docClick,this)]],r))}a(window).bind(i([["resize orientationchange",a.proxy(this.winResize,this)]],r));if(this.opts.subIndicators){this.$subArrow=a("<span/>").addClass("sub-arrow");if(this.opts.subIndicatorsText){this.$subArrow.html(this.opts.subIndicatorsText)}}k()}this.$firstSub=this.$root.find("ul").each(function(){l.menuInit(a(this))}).eq(0);this.$firstLink=this.$root.find("a").eq(0);if(this.opts.markCurrentItem){var p=/(index|default)\.[^#\?\/]*/i,m=/#.*/,q=window.location.href.replace(p,""),o=q.replace(m,"");this.$root.find("a").each(function(){var s=this.href.replace(p,""),t=a(this);if(s==q||s==o){t.addClass("current");if(l.opts.markCurrentTree){t.parentsUntil("[data-smartmenus-id]","ul").each(function(){a(this).dataSM("parent-a").addClass("current")})}}})}this.wasCollapsible=this.isCollapsible()},destroy:function(m){if(!m){var n=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").unbind(n).undelegate(n);n+=this.rootId;a(document).unbind(n);a(window).unbind(n);if(this.opts.subIndicators){this.$subArrow=null}}this.menuHideAll();var l=this;this.$root.find("ul").each(function(){var o=a(this);if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}if(o.dataSM("shown-before")){if(l.opts.subMenusMinWidth||l.opts.subMenusMaxWidth){o.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap")}if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}o.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})}if((o.attr("id")||"").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded");this.$root.find("a.has-submenu").each(function(){var o=a(this);if(o.attr("id").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub");if(this.opts.subIndicators){this.$root.find("span.sub-arrow").remove()}if(this.opts.markCurrentItem){this.$root.find("a.current").removeClass("current")}if(!m){this.$root=null;this.$firstLink=null;this.$firstSub=null;if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}b.splice(a.inArray(this,b),1)}},disable:function(l){if(!this.disabled){this.menuHideAll();if(!l&&!this.opts.isPopup&&this.$root.is(":visible")){var m=this.$root.offset();this.$disableOverlay=a('<div class="sm-jquery-disable-overlay"/>').css({position:"absolute",top:m.top,left:m.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(true),opacity:0}).appendTo(document.body)}this.disabled=true}},docClick:function(l){if(this.$touchScrollingSub){this.$touchScrollingSub=null;return}if(this.visibleSubMenus.length&&!a.contains(this.$root[0],l.target)||a(l.target).is("a")){this.menuHideAll()}},docTouchEnd:function(m){if(!this.lastTouch){return}if(this.visibleSubMenus.length&&(this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2)&&(this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!a.contains(this.$root[0],this.lastTouch.target))){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}var l=this;this.hideTimeout=setTimeout(function(){l.menuHideAll()},350)}this.lastTouch=null},docTouchMove:function(m){if(!this.lastTouch){return}var l=m.originalEvent.touches[0];this.lastTouch.x2=l.pageX;this.lastTouch.y2=l.pageY},docTouchStart:function(m){var l=m.originalEvent.touches[0];this.lastTouch={x1:l.pageX,y1:l.pageY,target:l.target}},enable:function(){if(this.disabled){if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}this.disabled=false}},getClosestMenu:function(m){var l=a(m).closest("ul");while(l.dataSM("in-mega")){l=l.parent().closest("ul")}return l[0]||null},getHeight:function(l){return this.getOffset(l,true)},getOffset:function(n,l){var m;if(n.css("display")=="none"){m={position:n[0].style.position,visibility:n[0].style.visibility};n.css({position:"absolute",visibility:"hidden"}).show()}var o=n[0].getBoundingClientRect&&n[0].getBoundingClientRect(),p=o&&(l?o.height||o.bottom-o.top:o.width||o.right-o.left);if(!p&&p!==0){p=l?n[0].offsetHeight:n[0].offsetWidth}if(m){n.hide().css(m)}return p},getStartZIndex:function(l){var m=parseInt(this[l?"$root":"$firstSub"].css("z-index"));if(!l&&isNaN(m)){m=parseInt(this.$root.css("z-index"))}return !isNaN(m)?m:1},getTouchPoint:function(l){return l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0]||l},getViewport:function(l){var m=l?"Height":"Width",o=document.documentElement["client"+m],n=window["inner"+m];if(n){o=Math.min(o,n)}return o},getViewportHeight:function(){return this.getViewport(true)},getViewportWidth:function(){return this.getViewport()},getWidth:function(l){return this.getOffset(l)},handleEvents:function(){return !this.disabled&&this.isCSSOn()},handleItemEvents:function(l){return this.handleEvents()&&!this.isLinkInMegaMenu(l)},isCollapsible:function(){return this.$firstSub.css("position")=="static"},isCSSOn:function(){return this.$firstLink.css("display")=="block"},isFixed:function(){var l=this.$root.css("position")=="fixed";if(!l){this.$root.parentsUntil("body").each(function(){if(a(this).css("position")=="fixed"){l=true;return false}})}return l},isLinkInMegaMenu:function(l){return a(this.getClosestMenu(l[0])).hasClass("mega-menu")},isTouchMode:function(){return !f||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(p,l){var n=p.closest("ul"),q=n.dataSM("level");if(q>1&&(!this.activatedItems[q-2]||this.activatedItems[q-2][0]!=n.dataSM("parent-a")[0])){var m=this;a(n.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(n).each(function(){m.itemActivate(a(this).dataSM("parent-a"))})}if(!this.isCollapsible()||l){this.menuHideSubMenus(!this.activatedItems[q-1]||this.activatedItems[q-1][0]!=p[0]?q-1:q)}this.activatedItems[q-1]=p;if(this.$root.triggerHandler("activate.smapi",p[0])===false){return}var o=p.dataSM("sub");if(o&&(this.isTouchMode()||(!this.opts.showOnClick||this.clickActivated))){this.menuShow(o)}},itemBlur:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}this.$root.triggerHandler("blur.smapi",l[0])},itemClick:function(o){var n=a(o.currentTarget);if(!this.handleItemEvents(n)){return}if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==n.closest("ul")[0]){this.$touchScrollingSub=null;o.stopPropagation();return false}if(this.$root.triggerHandler("click.smapi",n[0])===false){return false}var p=a(o.target).is("span.sub-arrow"),m=n.dataSM("sub"),l=m?m.dataSM("level")==2:false;if(m&&!m.is(":visible")){if(this.opts.showOnClick&&l){this.clickActivated=true}this.itemActivate(n);if(m.is(":visible")){this.focusActivated=true;return false}}else{if(this.isCollapsible()&&p){this.itemActivate(n);this.menuHide(m);return false}}if(this.opts.showOnClick&&l||n.hasClass("disabled")||this.$root.triggerHandler("select.smapi",n[0])===false){return false}},itemDown:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}l.dataSM("mousedown",true)},itemEnter:function(n){var m=a(n.currentTarget);if(!this.handleItemEvents(m)){return}if(!this.isTouchMode()){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var l=this;this.showTimeout=setTimeout(function(){l.itemActivate(m)},this.opts.showOnClick&&m.closest("ul").dataSM("level")==1?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",m[0])},itemFocus:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(this.focusActivated&&(!this.isTouchMode()||!l.dataSM("mousedown"))&&(!this.activatedItems.length||this.activatedItems[this.activatedItems.length-1][0]!=l[0])){this.itemActivate(l,true)}this.$root.triggerHandler("focus.smapi",l[0])},itemLeave:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(!this.isTouchMode()){l[0].blur();if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}}l.removeDataSM("mousedown");this.$root.triggerHandler("mouseleave.smapi",l[0])},menuHide:function(m){if(this.$root.triggerHandler("beforehide.smapi",m[0])===false){return}m.stop(true,true);if(m.css("display")!="none"){var l=function(){m.css("z-index","")};if(this.isCollapsible()){if(this.opts.collapsibleHideFunction){this.opts.collapsibleHideFunction.call(this,m,l)}else{m.hide(this.opts.collapsibleHideDuration,l)}}else{if(this.opts.hideFunction){this.opts.hideFunction.call(this,m,l)}else{m.hide(this.opts.hideDuration,l)}}if(m.dataSM("ie-shim")){m.dataSM("ie-shim").remove().css({"-webkit-transform":"",transform:""})}if(m.dataSM("scroll")){this.menuScrollStop(m);m.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).unbind(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()}m.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false");m.attr({"aria-expanded":"false","aria-hidden":"true"});var n=m.dataSM("level");this.activatedItems.splice(n-1,1);this.visibleSubMenus.splice(a.inArray(m,this.visibleSubMenus),1);this.$root.triggerHandler("hide.smapi",m[0])}},menuHideAll:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var m=this.opts.isPopup?1:0;for(var l=this.visibleSubMenus.length-1;l>=m;l--){this.menuHide(this.visibleSubMenus[l])}if(this.opts.isPopup){this.$root.stop(true,true);if(this.$root.is(":visible")){if(this.opts.hideFunction){this.opts.hideFunction.call(this,this.$root)}else{this.$root.hide(this.opts.hideDuration)}if(this.$root.dataSM("ie-shim")){this.$root.dataSM("ie-shim").remove()}}}this.activatedItems=[];this.visibleSubMenus=[];this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(n){for(var l=this.activatedItems.length-1;l>=n;l--){var m=this.activatedItems[l].dataSM("sub");if(m){this.menuHide(m)}}},menuIframeShim:function(l){if(e&&this.opts.overlapControlsInIE&&!l.dataSM("ie-shim")){l.dataSM("ie-shim",a("<iframe/>").attr({src:"javascript:0",tabindex:-9}).css({position:"absolute",top:"auto",left:"0",opacity:0,border:"0"}))}},menuInit:function(l){if(!l.dataSM("in-mega")){if(l.hasClass("mega-menu")){l.find("ul").dataSM("in-mega",true)}var q=2,m=l[0];while((m=m.parentNode.parentNode)!=this.$root[0]){q++}var n=l.prevAll("a").eq(-1);if(!n.length){n=l.prevAll().find("a").eq(-1)}n.addClass("has-submenu").dataSM("sub",l);l.dataSM("parent-a",n).dataSM("level",q).parent().dataSM("sub",l);var o=n.attr("id")||this.accessIdPrefix+(++this.idInc),p=l.attr("id")||this.accessIdPrefix+(++this.idInc);n.attr({id:o,"aria-haspopup":"true","aria-controls":p,"aria-expanded":"false"});l.attr({id:p,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"});if(this.opts.subIndicators){n[this.opts.subIndicatorsPos](this.$subArrow.clone())}}},menuPosition:function(K){var r=K.dataSM("parent-a"),D=r.closest("li"),E=D.parent(),l=K.dataSM("level"),t=this.getWidth(K),J=this.getHeight(K),u=r.offset(),o=u.left,m=u.top,q=this.getWidth(r),F=this.getHeight(r),H=a(window),v=H.scrollLeft(),s=H.scrollTop(),z=this.getViewportWidth(),L=this.getViewportHeight(),w=E.parent().is("[data-sm-horizontal-sub]")||l==2&&!E.hasClass("sm-vertical"),B=this.opts.rightToLeftSubMenus&&!D.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&D.is("[data-sm-reverse]"),p=l==2?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,n=l==2?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY,C,A;if(w){C=B?q-t-p:p;A=this.opts.bottomToTopSubMenus?-J-n:F+n}else{C=B?p-t:q-p;A=this.opts.bottomToTopSubMenus?F-n-J:n}if(this.opts.keepInViewport){var N=o+C,M=m+A;if(B&&N<v){C=w?v-N+C:q-p}else{if(!B&&N+t>v+z){C=w?v+z-t-N+C:p-t}}if(!w){if(J<L&&M+J>s+L){A+=s+L-J-M}else{if(J>=L||M<s){A+=s-M}}}if(w&&(M+J>s+L+0.49||M<s)||!w&&J>L+0.49){var G=this;if(!K.dataSM("scroll-arrows")){K.dataSM("scroll-arrows",a([a('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0],a('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]).bind({mouseenter:function(){K.dataSM("scroll").up=a(this).hasClass("scroll-up");G.menuScroll(K)},mouseleave:function(x){G.menuScrollStop(K);G.menuScrollOut(K,x)},"mousewheel DOMMouseScroll":function(x){x.preventDefault()}}).insertAfter(K))}var I=".smartmenus_scroll";K.dataSM("scroll",{y:this.cssTransforms3d?0:A-F,step:1,itemH:F,subH:J,arrowDownH:this.getHeight(K.dataSM("scroll-arrows").eq(1))}).bind(i([["mouseover",function(x){G.menuScrollOver(K,x)}],["mouseout",function(x){G.menuScrollOut(K,x)}],["mousewheel DOMMouseScroll",function(x){G.menuScrollMousewheel(K,x)}]],I)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:C+(parseInt(K.css("border-left-width"))||0),width:t-(parseInt(K.css("border-left-width"))||0)-(parseInt(K.css("border-right-width"))||0),zIndex:K.css("z-index")}).eq(w&&this.opts.bottomToTopSubMenus?0:1).show();if(this.isFixed()){K.css({"touch-action":"none","-ms-touch-action":"none"}).bind(i([[d?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp",function(x){G.menuScrollTouch(K,x)}]],I))}}}K.css({top:"auto",left:"0",marginLeft:C,marginTop:A-F});this.menuIframeShim(K);if(K.dataSM("ie-shim")){K.dataSM("ie-shim").css({zIndex:K.css("z-index"),width:t,height:J,marginLeft:C,marginTop:A-F})}},menuScroll:function(r,m,n){var p=r.dataSM("scroll"),q=r.dataSM("scroll-arrows"),o=p.up?p.upEnd:p.downEnd,s;if(!m&&p.momentum){p.momentum*=0.92;s=p.momentum;if(s<0.5){this.menuScrollStop(r);return}}else{s=n||(m||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(p.step))}var l=r.dataSM("level");if(this.activatedItems[l-1]&&this.activatedItems[l-1].dataSM("sub")&&this.activatedItems[l-1].dataSM("sub").is(":visible")){this.menuHideSubMenus(l-1)}p.y=p.up&&o<=p.y||!p.up&&o>=p.y?p.y:(Math.abs(o-p.y)>s?p.y+(p.up?s:-s):o);r.add(r.dataSM("ie-shim")).css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+p.y+"px, 0)",transform:"translate3d(0, "+p.y+"px, 0)"}:{marginTop:p.y});if(f&&(p.up&&p.y>p.downEnd||!p.up&&p.y<p.upEnd)){q.eq(p.up?1:0).show()}if(p.y==o){if(f){q.eq(p.up?0:1).hide()}this.menuScrollStop(r)}else{if(!m){if(this.opts.scrollAccelerate&&p.step<this.opts.scrollStep){p.step+=0.2}var t=this;this.scrollTimeout=g(function(){t.menuScroll(r)})}}},menuScrollMousewheel:function(m,n){if(this.getClosestMenu(n.target)==m[0]){n=n.originalEvent;var l=(n.wheelDelta||-n.detail)>0;if(m.dataSM("scroll-arrows").eq(l?0:1).is(":visible")){m.dataSM("scroll").up=l;this.menuScroll(m,true)}}n.preventDefault()},menuScrollOut:function(l,m){if(f){if(!/^scroll-(up|down)/.test((m.relatedTarget||"").className)&&(l[0]!=m.relatedTarget&&!a.contains(l[0],m.relatedTarget)||this.getClosestMenu(m.relatedTarget)!=l[0])){l.dataSM("scroll-arrows").css("visibility","hidden")}}},menuScrollOver:function(n,o){if(f){if(!/^scroll-(up|down)/.test(o.target.className)&&this.getClosestMenu(o.target)==n[0]){this.menuScrollRefreshData(n);var m=n.dataSM("scroll"),l=a(window).scrollTop()-n.dataSM("parent-a").offset().top-m.itemH;n.dataSM("scroll-arrows").eq(0).css("margin-top",l).end().eq(1).css("margin-top",l+this.getViewportHeight()-m.arrowDownH).end().css("visibility","visible")}}},menuScrollRefreshData:function(n){var m=n.dataSM("scroll"),l=a(window).scrollTop()-n.dataSM("parent-a").offset().top-m.itemH;if(this.cssTransforms3d){l=-(parseFloat(n.css("margin-top"))-l)}a.extend(m,{upEnd:l,downEnd:l+this.getViewportHeight()-m.subH})},menuScrollStop:function(l){if(this.scrollTimeout){c(this.scrollTimeout);this.scrollTimeout=0;l.dataSM("scroll").step=1;return true}},menuScrollTouch:function(p,q){q=q.originalEvent;if(j(q)){var m=this.getTouchPoint(q);if(this.getClosestMenu(m.target)==p[0]){var o=p.dataSM("scroll");if(/(start|down)$/i.test(q.type)){if(this.menuScrollStop(p)){q.preventDefault();this.$touchScrollingSub=p}else{this.$touchScrollingSub=null}this.menuScrollRefreshData(p);a.extend(o,{touchStartY:m.pageY,touchStartTime:q.timeStamp})}else{if(/move$/i.test(q.type)){var n=o.touchY!==undefined?o.touchY:o.touchStartY;if(n!==undefined&&n!=m.pageY){this.$touchScrollingSub=p;var l=n<m.pageY;if(o.up!==undefined&&o.up!=l){a.extend(o,{touchStartY:m.pageY,touchStartTime:q.timeStamp})}a.extend(o,{up:l,touchY:m.pageY});this.menuScroll(p,true,Math.abs(m.pageY-n))}q.preventDefault()}else{if(o.touchY!==undefined){if(o.momentum=Math.pow(Math.abs(m.pageY-o.touchStartY)/(q.timeStamp-o.touchStartTime),2)*15){this.menuScrollStop(p);this.menuScroll(p);q.preventDefault()}delete o.touchY}}}}}},menuShow:function(n){if(!n.dataSM("beforefirstshowfired")){n.dataSM("beforefirstshowfired",true);if(this.$root.triggerHandler("beforefirstshow.smapi",n[0])===false){return}}if(this.$root.triggerHandler("beforeshow.smapi",n[0])===false){return}n.dataSM("shown-before",true).stop(true,true);if(!n.is(":visible")){var m=n.dataSM("parent-a");if(this.opts.keepHighlighted||this.isCollapsible()){m.addClass("highlighted")}if(this.isCollapsible()){n.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""})}else{n.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1);if(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth){n.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap");if(this.opts.subMenusMinWidth){n.css("min-width",this.opts.subMenusMinWidth)}if(this.opts.subMenusMaxWidth){var o=this.getWidth(n);n.css("max-width",this.opts.subMenusMaxWidth);if(o>this.getWidth(n)){n.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}}}this.menuPosition(n);if(n.dataSM("ie-shim")){n.dataSM("ie-shim").insertBefore(n)}}var l=function(){n.css("overflow","")};if(this.isCollapsible()){if(this.opts.collapsibleShowFunction){this.opts.collapsibleShowFunction.call(this,n,l)}else{n.show(this.opts.collapsibleShowDuration,l)}}else{if(this.opts.showFunction){this.opts.showFunction.call(this,n,l)}else{n.show(this.opts.showDuration,l)}}m.attr("aria-expanded","true");n.attr({"aria-expanded":"true","aria-hidden":"false"});this.visibleSubMenus.push(n);this.$root.triggerHandler("show.smapi",n[0])}},popupHide:function(l){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}var m=this;this.hideTimeout=setTimeout(function(){m.menuHideAll()},l?1:this.opts.hideTimeout)},popupShow:function(o,n){if(!this.opts.isPopup){alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.');return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}this.$root.dataSM("shown-before",true).stop(true,true);if(!this.$root.is(":visible")){this.$root.css({left:o,top:n});this.menuIframeShim(this.$root);if(this.$root.dataSM("ie-shim")){this.$root.dataSM("ie-shim").css({zIndex:this.$root.css("z-index"),width:this.getWidth(this.$root),height:this.getHeight(this.$root),left:o,top:n}).insertBefore(this.$root)}var m=this,l=function(){m.$root.css("overflow","")};if(this.opts.showFunction){this.opts.showFunction.call(this,this.$root,l)}else{this.$root.show(this.opts.showDuration,l)}this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(true);this.init(true)},rootKeyDown:function(o){if(!this.handleEvents()){return}switch(o.keyCode){case 27:var m=this.activatedItems[0];if(m){this.menuHideAll();m[0].focus();var n=m.dataSM("sub");if(n){this.menuHide(n)}}break;case 32:var l=a(o.target);if(l.is("a")&&this.handleItemEvents(l)){var n=l.dataSM("sub");if(n&&!n.is(":visible")){this.itemClick({currentTarget:o.target});o.preventDefault()}}break}},rootOut:function(m){if(!this.handleEvents()||this.isTouchMode()||m.target==this.$root[0]){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}if(!this.opts.showOnClick||!this.opts.hideOnClick){var l=this;this.hideTimeout=setTimeout(function(){l.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(l){if(!this.handleEvents()||this.isTouchMode()||l.target==this.$root[0]){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}},winResize:function(m){if(!this.handleEvents()){if(this.$disableOverlay){var n=this.$root.offset();this.$disableOverlay.css({top:n.top,left:n.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}return}if(!("onorientationchange" in window)||m.type=="orientationchange"){var l=this.isCollapsible();if(!(this.wasCollapsible&&l)){if(this.activatedItems.length){this.activatedItems[this.activatedItems.length-1][0].blur()}this.menuHideAll()}this.wasCollapsible=l}}}});a.fn.dataSM=function(l,m){if(m){return this.data(l+"_smartmenus",m)}return this.data(l+"_smartmenus")};a.fn.removeDataSM=function(l){return this.removeData(l+"_smartmenus")};a.fn.smartmenus=function(m){if(typeof m=="string"){var l=arguments,o=m;Array.prototype.shift.call(l);return this.each(function(){var p=a(this).data("smartmenus");if(p&&p[o]){p[o].apply(p,l)}})}var n=a.extend({},a.fn.smartmenus.defaults,m);return this.each(function(){new a.SmartMenus(this,n)})};a.fn.smartmenus.defaults={isPopup:false,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:true,subIndicatorsPos:"prepend",subIndicatorsText:"+",scrollStep:30,scrollAccelerate:true,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(m,l){m.fadeOut(200,l)},collapsibleShowDuration:0,collapsibleShowFunction:function(m,l){m.slideDown(200,l)},collapsibleHideDuration:0,collapsibleHideFunction:function(m,l){m.slideUp(200,l)},showOnClick:false,hideOnClick:true,noMouseOver:false,keepInViewport:true,keepHighlighted:true,markCurrentItem:false,markCurrentTree:true,rightToLeftSubMenus:false,bottomToTopSubMenus:false,overlapControlsInIE:true};return a})); ############################################## fuse3-3.10.0/doc/html/fuse-3_86_81_2lib_2fuse__lowlevel_8c_source.html-47-<div class="contents"> fuse3-3.10.0/doc/html/fuse-3_86_81_2lib_2fuse__lowlevel_8c_source.html:48:<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> FUSE: Filesystem in Userspace</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> Implementation of (most of) the low-level FUSE API. The session loop</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> functions are implemented in separate files.</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> This program can be distributed under the terms of the GNU LGPLv2.</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> See the file COPYING.LIB</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">*/</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#define _GNU_SOURCE</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "config.h"</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include "fuse_i.h"</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include "fuse_kernel.h"</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include "fuse_opt.h"</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include "fuse_misc.h"</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include "mount_util.h"</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <stdio.h></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include <stddef.h></span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <unistd.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <limits.h></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <errno.h></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <assert.h></span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include <sys/file.h></span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#ifndef F_LINUX_SPECIFIC_BASE</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#define F_LINUX_SPECIFIC_BASE 1024</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#ifndef F_SETPIPE_SZ</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#define PARAM(inarg) (((char *)(inarg)) + sizeof(*(inarg)))</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor">#define OFFSET_MAX 0x7fffffffffffffffLL</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor">#define container_of(ptr, type, member) ({ \</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor"> const typeof( ((type *)0)->member ) *__mptr = (ptr); \</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="preprocessor"> (type *)( (char *)__mptr - offsetof(type,member) );})</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="keyword">struct </span>fuse_pollhandle {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  uint64_t kh;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">struct </span>fuse_session *se;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> };</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> pagesize;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="keyword">static</span> __attribute__((constructor)) <span class="keywordtype">void</span> fuse_ll_init_pagesize(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  pagesize = getpagesize();</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> }</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> </div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_stat(<span class="keyword">const</span> <span class="keyword">struct</span> stat *stbuf, <span class="keyword">struct</span> fuse_attr *attr)</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  attr->ino = stbuf->st_ino;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  attr->mode = stbuf->st_mode;</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  attr->nlink = stbuf->st_nlink;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  attr->uid = stbuf->st_uid;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  attr->gid = stbuf->st_gid;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  attr->rdev = stbuf->st_rdev;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  attr->size = stbuf->st_size;</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  attr->blksize = stbuf->st_blksize;</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  attr->blocks = stbuf->st_blocks;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  attr->atime = stbuf->st_atime;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  attr->mtime = stbuf->st_mtime;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  attr->ctime = stbuf->st_ctime;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  attr->atimensec = ST_ATIM_NSEC(stbuf);</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  attr->mtimensec = ST_MTIM_NSEC(stbuf);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  attr->ctimensec = ST_CTIM_NSEC(stbuf);</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> }</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_attr(<span class="keyword">const</span> <span class="keyword">struct</span> fuse_setattr_in *attr, <span class="keyword">struct</span> stat *stbuf)</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> {</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  stbuf->st_mode = attr->mode;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  stbuf->st_uid = attr->uid;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  stbuf->st_gid = attr->gid;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  stbuf->st_size = attr->size;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  stbuf->st_atime = attr->atime;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  stbuf->st_mtime = attr->mtime;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  stbuf->st_ctime = attr->ctime;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  ST_ATIM_NSEC_SET(stbuf, attr->atimensec);</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  ST_MTIM_NSEC_SET(stbuf, attr->mtimensec);</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  ST_CTIM_NSEC_SET(stbuf, attr->ctimensec);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> }</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> iov_length(<span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> {</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordtype">size_t</span> seg;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordtype">size_t</span> ret = 0;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">for</span> (seg = 0; seg < count; seg++)</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  ret += iov[seg].iov_len;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordflow">return</span> ret;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> }</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_init_req(<span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> {</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  req->next = req;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  req->prev = req;</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> }</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> </div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_del_req(<span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> {</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keyword">struct </span>fuse_req *prev = req->prev;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keyword">struct </span>fuse_req *next = req->next;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  prev->next = next;</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  next->prev = prev;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> }</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> </div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_add_req(<span class="keyword">struct</span> fuse_req *req, <span class="keyword">struct</span> fuse_req *next)</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> {</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keyword">struct </span>fuse_req *prev = next->prev;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  req->next = next;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  req->prev = prev;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  prev->next = req;</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  next->prev = req;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> }</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="keyword">static</span> <span class="keywordtype">void</span> destroy_req(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> {</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  pthread_mutex_destroy(&req->lock);</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  free(req);</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> }</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="keywordtype">void</span> fuse_free_req(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> {</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordtype">int</span> ctr;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  req->u.ni.func = NULL;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  req->u.ni.data = NULL;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  list_del_req(req);</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  ctr = --req->ctr;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  fuse_chan_put(req->ch);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  req->ch = NULL;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordflow">if</span> (!ctr)</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  destroy_req(req);</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> }</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_req *fuse_ll_alloc_req(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> {</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keyword">struct </span>fuse_req *req;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  req = (<span class="keyword">struct </span>fuse_req *) calloc(1, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_req));</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">if</span> (req == NULL) {</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate request\n"</span>);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  req->se = se;</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  req->ctr = 1;</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  list_init_req(req);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  fuse_mutex_init(&req->lock);</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">return</span> req;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> }</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> </div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="comment">/* Send data. If *ch* is NULL, send via session master fd */</span></div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_msg(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> {</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="keyword">struct </span>fuse_out_header *out = iov[0].iov_base;</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> </div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  out->len = iov_length(iov, count);</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordflow">if</span> (out->unique == 0) {</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  fprintf(stderr, <span class="stringliteral">"NOTIFY: code=%d length=%u\n"</span>,</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  out->error, out->len);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (out->error) {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  fprintf(stderr,</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="stringliteral">" unique: %llu, error: %i (%s), outsize: %i\n"</span>,</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->error,</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  strerror(-out->error), out->len);</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  fprintf(stderr,</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="stringliteral">" unique: %llu, success, outsize: %i\n"</span>,</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->len);</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  }</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  }</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> </div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  ssize_t res = writev(ch ? ch->fd : se->fd,</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  iov, count);</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="keywordtype">int</span> err = errno;</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> </div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  assert(se != NULL);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="comment">/* ENOENT means the operation was interrupted */</span></div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (!<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se) && err != ENOENT)</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  perror(<span class="stringliteral">"fuse: writing device"</span>);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> }</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> </div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> </div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="keywordtype">int</span> fuse_send_reply_iov_nofree(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> {</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keywordflow">if</span> (error <= -1000 || error > 0) {</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  fprintf(stderr, <span class="stringliteral">"fuse: bad error value: %i\n"</span>, error);</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  error = -ERANGE;</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  }</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span> </div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  out.unique = req->unique;</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  out.error = error;</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> </div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span> </div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="keywordflow">return</span> fuse_send_msg(req->se, req->ch, iov, count);</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> }</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply_iov(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> {</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span> </div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  res = fuse_send_reply_iov_nofree(req, error, iov, count);</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  fuse_free_req(req);</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> }</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span> </div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">const</span> <span class="keywordtype">void</span> *arg,</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="keywordtype">size_t</span> argsize)</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span> {</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keywordtype">int</span> count = 1;</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">if</span> (argsize) {</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  iov[1].iov_base = (<span class="keywordtype">void</span> *) arg;</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  iov[1].iov_len = argsize;</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  count++;</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  }</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <span class="keywordflow">return</span> send_reply_iov(req, error, iov, count);</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span> }</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span> </div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a5fbbf591a55f09c02cd54d34bdbfe0e9">fuse_reply_iov</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> {</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  <span class="keyword">struct </span>iovec *padded_iov;</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span> </div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  padded_iov = malloc((count + 1) * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <span class="keywordflow">if</span> (padded_iov == NULL)</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span> </div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  memcpy(padded_iov + 1, iov, count * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  count++;</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span> </div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  res = send_reply_iov(req, 0, padded_iov, count);</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  free(padded_iov);</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span> </div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span> }</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span> </div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span> <span class="comment">/* `buf` is allowed to be empty so that the proper size may be</span></div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span> <span class="comment"> allocated by the caller */</span></div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span> <span class="keywordtype">size_t</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1957bcc8ece8c90f16c42c4daf3053f">fuse_add_direntry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> bufsize,</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> <span class="keyword">struct</span> stat *stbuf, off_t off)</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> {</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  (void)req;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <span class="keywordtype">size_t</span> namelen;</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="keywordtype">size_t</span> entlen;</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  <span class="keywordtype">size_t</span> entlen_padded;</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keyword">struct </span>fuse_dirent *dirent;</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span> </div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  namelen = strlen(name);</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  entlen = FUSE_NAME_OFFSET + namelen;</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  entlen_padded = FUSE_DIRENT_ALIGN(entlen);</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span> </div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keywordflow">if</span> ((buf == NULL) || (entlen_padded > bufsize))</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span> </div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  dirent = (<span class="keyword">struct </span>fuse_dirent*) buf;</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  dirent->ino = stbuf->st_ino;</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  dirent->off = off;</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  dirent->namelen = namelen;</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  dirent->type = (stbuf->st_mode & S_IFMT) >> 12;</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  strncpy(dirent->name, name, namelen);</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  memset(dirent->name + namelen, 0, entlen_padded - entlen);</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span> </div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> }</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> </div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_statfs(<span class="keyword">const</span> <span class="keyword">struct</span> statvfs *stbuf,</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <span class="keyword">struct</span> fuse_kstatfs *kstatfs)</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span> {</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  kstatfs->bsize = stbuf->f_bsize;</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  kstatfs->frsize = stbuf->f_frsize;</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  kstatfs->blocks = stbuf->f_blocks;</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  kstatfs->bfree = stbuf->f_bfree;</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  kstatfs->bavail = stbuf->f_bavail;</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  kstatfs->files = stbuf->f_files;</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  kstatfs->ffree = stbuf->f_ffree;</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  kstatfs->namelen = stbuf->f_namemax;</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> }</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span> </div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply_ok(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keywordtype">void</span> *arg, <span class="keywordtype">size_t</span> argsize)</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span> {</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="keywordflow">return</span> send_reply(req, 0, arg, argsize);</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> }</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> </div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> err)</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span> {</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  <span class="keywordflow">return</span> send_reply(req, -err, NULL, 0);</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span> }</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span> </div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span> {</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  fuse_free_req(req);</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span> }</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span> </div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> calc_timeout_sec(<span class="keywordtype">double</span> t)</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span> {</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  <span class="keywordflow">if</span> (t > (<span class="keywordtype">double</span>) ULONG_MAX)</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  <span class="keywordflow">return</span> ULONG_MAX;</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (t < 0.0)</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) t;</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span> }</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> </div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> calc_timeout_nsec(<span class="keywordtype">double</span> t)</div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span> {</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  <span class="keywordtype">double</span> f = t - (double) calc_timeout_sec(t);</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordflow">if</span> (f < 0.0)</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (f >= 0.999999999)</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keywordflow">return</span> 999999999;</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>) (f * 1.0e9);</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span> }</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span> </div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fill_entry(<span class="keyword">struct</span> fuse_entry_out *arg,</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e)</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> {</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  arg->nodeid = e-><a class="code" href="structfuse__entry__param.html#a285ba89754871772d940fa4fb736bce3">ino</a>;</div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  arg->generation = e-><a class="code" href="structfuse__entry__param.html#a4c673ec62c76f7d63d326407beb1b463">generation</a>;</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  arg->entry_valid = calc_timeout_sec(e-><a class="code" href="structfuse__entry__param.html#a281b39b72e7ec574ba40d7341fd22c1d">entry_timeout</a>);</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  arg->entry_valid_nsec = calc_timeout_nsec(e-><a class="code" href="structfuse__entry__param.html#a281b39b72e7ec574ba40d7341fd22c1d">entry_timeout</a>);</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  arg->attr_valid = calc_timeout_sec(e-><a class="code" href="structfuse__entry__param.html#aa797a9f4152cae506ba479af8bbe2eb7">attr_timeout</a>);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  arg->attr_valid_nsec = calc_timeout_nsec(e-><a class="code" href="structfuse__entry__param.html#aa797a9f4152cae506ba479af8bbe2eb7">attr_timeout</a>);</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  convert_stat(&e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>, &arg->attr);</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span> }</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span> </div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span> <span class="comment">/* `buf` is allowed to be empty so that the proper size may be</span></div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span> <span class="comment"> allocated by the caller */</span></div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> <span class="keywordtype">size_t</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a34f3f1beebacab5f717d95baf832a8a5">fuse_add_direntry_plus</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> bufsize,</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name,</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e, off_t off)</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span> {</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  (void)req;</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordtype">size_t</span> namelen;</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordtype">size_t</span> entlen;</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  <span class="keywordtype">size_t</span> entlen_padded;</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span> </div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  namelen = strlen(name);</div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  entlen = FUSE_NAME_OFFSET_DIRENTPLUS + namelen;</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  entlen_padded = FUSE_DIRENT_ALIGN(entlen);</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  <span class="keywordflow">if</span> ((buf == NULL) || (entlen_padded > bufsize))</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> </div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <span class="keyword">struct </span>fuse_direntplus *dp = (<span class="keyword">struct </span>fuse_direntplus *) buf;</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  memset(&dp->entry_out, 0, <span class="keyword">sizeof</span>(dp->entry_out));</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  fill_entry(&dp->entry_out, e);</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span> </div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  <span class="keyword">struct </span>fuse_dirent *dirent = &dp->dirent;</div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  dirent->ino = e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>.st_ino;</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  dirent->off = off;</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  dirent->namelen = namelen;</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  dirent->type = (e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>.st_mode & S_IFMT) >> 12;</div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  strncpy(dirent->name, name, namelen);</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  memset(dirent->name + namelen, 0, entlen_padded - entlen);</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span> </div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span> }</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> </div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fill_open(<span class="keyword">struct</span> fuse_open_out *arg,</div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span> {</div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  arg->fh = f-><a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a>;</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a03b59a10e62963d9affa34ad78bd144a">direct_io</a>)</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  arg->open_flags |= FOPEN_DIRECT_IO;</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a23a64eaecbf83f99aba8ee79e6de2780">keep_cache</a>)</div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  arg->open_flags |= FOPEN_KEEP_CACHE;</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#af51d1a8d47e7a9d57b4aa15c11da238d">cache_readdir</a>)</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  arg->open_flags |= FOPEN_CACHE_DIR;</div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a272022c57a6a79dd8f98ef597786e154">nonseekable</a>)</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  arg->open_flags |= FOPEN_NONSEEKABLE;</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> }</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span> </div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a672c45e126cd240f4bcd59bf9b7e3708">fuse_reply_entry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e)</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span> {</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  <span class="keyword">struct </span>fuse_entry_out arg;</div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  FUSE_COMPAT_ENTRY_OUT_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span> </div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="comment">/* before ABI 7.4 e->ino == 0 was invalid, only ENOENT meant</span></div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span> <span class="comment"> negative entry */</span></div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  <span class="keywordflow">if</span> (!e-><a class="code" href="structfuse__entry__param.html#a285ba89754871772d940fa4fb736bce3">ino</a> && req->se->conn.proto_minor < 4)</div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOENT);</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span> </div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  fill_entry(&arg, e);</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span> }</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span> </div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#abea78d22349198f8370d7cb91fbf05ed">fuse_reply_create</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e,</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span> {</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <span class="keywordtype">char</span> buf[<span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_entry_out) + sizeof(struct fuse_open_out)];</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <span class="keywordtype">size_t</span> entrysize = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  FUSE_COMPAT_ENTRY_OUT_SIZE : <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_entry_out);</div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  <span class="keyword">struct </span>fuse_entry_out *earg = (<span class="keyword">struct </span>fuse_entry_out *) buf;</div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span>  <span class="keyword">struct </span>fuse_open_out *oarg = (<span class="keyword">struct </span>fuse_open_out *) (buf + entrysize);</div><div class="line"><a name="l00425"></a><span class="lineno"> 425</span> </div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  memset(buf, 0, <span class="keyword">sizeof</span>(buf));</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  fill_entry(earg, e);</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  fill_open(oarg, f);</div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  <span class="keywordflow">return</span> send_reply_ok(req, buf,</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  entrysize + <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_open_out));</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span> }</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> </div><div class="line"><a name="l00433"></a><span class="lineno"> 433</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad28378dc569019c32acdb4995d70be18">fuse_reply_attr</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> stat *attr,</div><div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  <span class="keywordtype">double</span> attr_timeout)</div><div class="line"><a name="l00435"></a><span class="lineno"> 435</span> {</div><div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  <span class="keyword">struct </span>fuse_attr_out arg;</div><div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  FUSE_COMPAT_ATTR_OUT_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span> </div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  arg.attr_valid = calc_timeout_sec(attr_timeout);</div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  arg.attr_valid_nsec = calc_timeout_nsec(attr_timeout);</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  convert_stat(attr, &arg.attr);</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span> </div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span> }</div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span> </div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a5a5872d7f73f0bd593e00788a4c7bbb7">fuse_reply_readlink</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keywordtype">char</span> *linkname)</div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span> {</div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  <span class="keywordflow">return</span> send_reply_ok(req, linkname, strlen(linkname));</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span> }</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span> </div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span> {</div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span>  <span class="keyword">struct </span>fuse_open_out arg;</div><div class="line"><a name="l00456"></a><span class="lineno"> 456</span> </div><div class="line"><a name="l00457"></a><span class="lineno"> 457</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00458"></a><span class="lineno"> 458</span>  fill_open(&arg, f);</div><div class="line"><a name="l00459"></a><span class="lineno"> 459</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span> }</div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span> </div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa3cfa73f61d6ef461ab5a3fbf859eb97">fuse_reply_write</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span> {</div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span>  <span class="keyword">struct </span>fuse_write_out arg;</div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span> </div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  arg.size = count;</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span> </div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00470"></a><span class="lineno"> 470</span> }</div><div class="line"><a name="l00471"></a><span class="lineno"> 471</span> </div><div class="line"><a name="l00472"></a><span class="lineno"> 472</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a300a88b63ab7c8ca92853a97486448c0">fuse_reply_buf</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__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> size)</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span> {</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span>  <span class="keywordflow">return</span> send_reply_ok(req, buf, size);</div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span> }</div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span> </div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov_fallback(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span>  <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf,</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span>  <span class="keywordtype">size_t</span> len)</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span> {</div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> mem_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span>  <span class="keywordtype">void</span> *mbuf;</div><div class="line"><a name="l00485"></a><span class="lineno"> 485</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00486"></a><span class="lineno"> 486</span> </div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span>  <span class="comment">/* Optimize common case */</span></div><div class="line"><a name="l00488"></a><span class="lineno"> 488</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> == 1 && buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> == 0 && buf-><a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a> == 0 &&</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>  !(buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>)) {</div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span>  <span class="comment">/* FIXME: also avoid memory copy if there are multiple buffers</span></div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span> <span class="comment"> but none of them contain an fd */</span></div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span> </div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span>  iov[iov_count].iov_base = buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>;</div><div class="line"><a name="l00494"></a><span class="lineno"> 494</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00495"></a><span class="lineno"> 495</span>  iov_count++;</div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span>  <span class="keywordflow">return</span> fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00497"></a><span class="lineno"> 497</span>  }</div><div class="line"><a name="l00498"></a><span class="lineno"> 498</span> </div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span>  res = posix_memalign(&mbuf, pagesize, len);</div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span>  <span class="keywordflow">if</span> (res != 0)</div><div class="line"><a name="l00501"></a><span class="lineno"> 501</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span> </div><div class="line"><a name="l00503"></a><span class="lineno"> 503</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l00504"></a><span class="lineno"> 504</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&mem_buf, buf, 0);</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l00506"></a><span class="lineno"> 506</span>  free(mbuf);</div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>  <span class="keywordflow">return</span> -res;</div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span>  }</div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span>  len = res;</div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span> </div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span>  iov[iov_count].iov_base = mbuf;</div><div class="line"><a name="l00512"></a><span class="lineno"> 512</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00513"></a><span class="lineno"> 513</span>  iov_count++;</div><div class="line"><a name="l00514"></a><span class="lineno"> 514</span>  res = fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00515"></a><span class="lineno"> 515</span>  free(mbuf);</div><div class="line"><a name="l00516"></a><span class="lineno"> 516</span> </div><div class="line"><a name="l00517"></a><span class="lineno"> 517</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00518"></a><span class="lineno"> 518</span> }</div><div class="line"><a name="l00519"></a><span class="lineno"> 519</span> </div><div class="line"><a name="l00520"></a><span class="lineno"> 520</span> <span class="keyword">struct </span>fuse_ll_pipe {</div><div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <span class="keywordtype">size_t</span> size;</div><div class="line"><a name="l00522"></a><span class="lineno"> 522</span>  <span class="keywordtype">int</span> can_grow;</div><div class="line"><a name="l00523"></a><span class="lineno"> 523</span>  <span class="keywordtype">int</span> pipe[2];</div><div class="line"><a name="l00524"></a><span class="lineno"> 524</span> };</div><div class="line"><a name="l00525"></a><span class="lineno"> 525</span> </div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_pipe_free(<span class="keyword">struct</span> fuse_ll_pipe *llp)</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span> {</div><div class="line"><a name="l00528"></a><span class="lineno"> 528</span>  close(llp->pipe[0]);</div><div class="line"><a name="l00529"></a><span class="lineno"> 529</span>  close(llp->pipe[1]);</div><div class="line"><a name="l00530"></a><span class="lineno"> 530</span>  free(llp);</div><div class="line"><a name="l00531"></a><span class="lineno"> 531</span> }</div><div class="line"><a name="l00532"></a><span class="lineno"> 532</span> </div><div class="line"><a name="l00533"></a><span class="lineno"> 533</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l00534"></a><span class="lineno"> 534</span> <span class="preprocessor">#if !defined(HAVE_PIPE2) || !defined(O_CLOEXEC)</span></div><div class="line"><a name="l00535"></a><span class="lineno"> 535</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_pipe(<span class="keywordtype">int</span> fds[2])</div><div class="line"><a name="l00536"></a><span class="lineno"> 536</span> {</div><div class="line"><a name="l00537"></a><span class="lineno"> 537</span>  <span class="keywordtype">int</span> rv = pipe(fds);</div><div class="line"><a name="l00538"></a><span class="lineno"> 538</span> </div><div class="line"><a name="l00539"></a><span class="lineno"> 539</span>  <span class="keywordflow">if</span> (rv == -1)</div><div class="line"><a name="l00540"></a><span class="lineno"> 540</span>  <span class="keywordflow">return</span> rv;</div><div class="line"><a name="l00541"></a><span class="lineno"> 541</span> </div><div class="line"><a name="l00542"></a><span class="lineno"> 542</span>  <span class="keywordflow">if</span> (fcntl(fds[0], F_SETFL, O_NONBLOCK) == -1 ||</div><div class="line"><a name="l00543"></a><span class="lineno"> 543</span>  fcntl(fds[1], F_SETFL, O_NONBLOCK) == -1 ||</div><div class="line"><a name="l00544"></a><span class="lineno"> 544</span>  fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 ||</div><div class="line"><a name="l00545"></a><span class="lineno"> 545</span>  fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) {</div><div class="line"><a name="l00546"></a><span class="lineno"> 546</span>  close(fds[0]);</div><div class="line"><a name="l00547"></a><span class="lineno"> 547</span>  close(fds[1]);</div><div class="line"><a name="l00548"></a><span class="lineno"> 548</span>  rv = -1;</div><div class="line"><a name="l00549"></a><span class="lineno"> 549</span>  }</div><div class="line"><a name="l00550"></a><span class="lineno"> 550</span>  <span class="keywordflow">return</span> rv;</div><div class="line"><a name="l00551"></a><span class="lineno"> 551</span> }</div><div class="line"><a name="l00552"></a><span class="lineno"> 552</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00553"></a><span class="lineno"> 553</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_pipe(<span class="keywordtype">int</span> fds[2])</div><div class="line"><a name="l00554"></a><span class="lineno"> 554</span> {</div><div class="line"><a name="l00555"></a><span class="lineno"> 555</span>  <span class="keywordflow">return</span> pipe2(fds, O_CLOEXEC | O_NONBLOCK);</div><div class="line"><a name="l00556"></a><span class="lineno"> 556</span> }</div><div class="line"><a name="l00557"></a><span class="lineno"> 557</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00558"></a><span class="lineno"> 558</span> </div><div class="line"><a name="l00559"></a><span class="lineno"> 559</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_ll_pipe *fuse_ll_get_pipe(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00560"></a><span class="lineno"> 560</span> {</div><div class="line"><a name="l00561"></a><span class="lineno"> 561</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l00562"></a><span class="lineno"> 562</span>  <span class="keywordflow">if</span> (llp == NULL) {</div><div class="line"><a name="l00563"></a><span class="lineno"> 563</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00564"></a><span class="lineno"> 564</span> </div><div class="line"><a name="l00565"></a><span class="lineno"> 565</span>  llp = malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_ll_pipe));</div><div class="line"><a name="l00566"></a><span class="lineno"> 566</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l00567"></a><span class="lineno"> 567</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00568"></a><span class="lineno"> 568</span> </div><div class="line"><a name="l00569"></a><span class="lineno"> 569</span>  res = fuse_pipe(llp->pipe);</div><div class="line"><a name="l00570"></a><span class="lineno"> 570</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00571"></a><span class="lineno"> 571</span>  free(llp);</div><div class="line"><a name="l00572"></a><span class="lineno"> 572</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00573"></a><span class="lineno"> 573</span>  }</div><div class="line"><a name="l00574"></a><span class="lineno"> 574</span> </div><div class="line"><a name="l00575"></a><span class="lineno"> 575</span>  <span class="comment">/*</span></div><div class="line"><a name="l00576"></a><span class="lineno"> 576</span> <span class="comment"> *the default size is 16 pages on linux</span></div><div class="line"><a name="l00577"></a><span class="lineno"> 577</span> <span class="comment"> */</span></div><div class="line"><a name="l00578"></a><span class="lineno"> 578</span>  llp->size = pagesize * 16;</div><div class="line"><a name="l00579"></a><span class="lineno"> 579</span>  llp->can_grow = 1;</div><div class="line"><a name="l00580"></a><span class="lineno"> 580</span> </div><div class="line"><a name="l00581"></a><span class="lineno"> 581</span>  pthread_setspecific(se->pipe_key, llp);</div><div class="line"><a name="l00582"></a><span class="lineno"> 582</span>  }</div><div class="line"><a name="l00583"></a><span class="lineno"> 583</span> </div><div class="line"><a name="l00584"></a><span class="lineno"> 584</span>  <span class="keywordflow">return</span> llp;</div><div class="line"><a name="l00585"></a><span class="lineno"> 585</span> }</div><div class="line"><a name="l00586"></a><span class="lineno"> 586</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00587"></a><span class="lineno"> 587</span> </div><div class="line"><a name="l00588"></a><span class="lineno"> 588</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_clear_pipe(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00589"></a><span class="lineno"> 589</span> {</div><div class="line"><a name="l00590"></a><span class="lineno"> 590</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  <span class="keywordflow">if</span> (llp) {</div><div class="line"><a name="l00592"></a><span class="lineno"> 592</span>  pthread_setspecific(se->pipe_key, NULL);</div><div class="line"><a name="l00593"></a><span class="lineno"> 593</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l00594"></a><span class="lineno"> 594</span>  }</div><div class="line"><a name="l00595"></a><span class="lineno"> 595</span> }</div><div class="line"><a name="l00596"></a><span class="lineno"> 596</span> </div><div class="line"><a name="l00597"></a><span class="lineno"> 597</span> <span class="preprocessor">#if defined(HAVE_SPLICE) && defined(HAVE_VMSPLICE)</span></div><div class="line"><a name="l00598"></a><span class="lineno"> 598</span> <span class="keyword">static</span> <span class="keywordtype">int</span> read_back(<span class="keywordtype">int</span> fd, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> len)</div><div class="line"><a name="l00599"></a><span class="lineno"> 599</span> {</div><div class="line"><a name="l00600"></a><span class="lineno"> 600</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00601"></a><span class="lineno"> 601</span> </div><div class="line"><a name="l00602"></a><span class="lineno"> 602</span>  res = read(fd, buf, len);</div><div class="line"><a name="l00603"></a><span class="lineno"> 603</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  fprintf(stderr, <span class="stringliteral">"fuse: internal error: failed to read back from pipe: %s\n"</span>, strerror(errno));</div><div class="line"><a name="l00605"></a><span class="lineno"> 605</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l00606"></a><span class="lineno"> 606</span>  }</div><div class="line"><a name="l00607"></a><span class="lineno"> 607</span>  <span class="keywordflow">if</span> (res != len) {</div><div class="line"><a name="l00608"></a><span class="lineno"> 608</span>  fprintf(stderr, <span class="stringliteral">"fuse: internal error: short read back from pipe: %i from %zi\n"</span>, res, len);</div><div class="line"><a name="l00609"></a><span class="lineno"> 609</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l00610"></a><span class="lineno"> 610</span>  }</div><div class="line"><a name="l00611"></a><span class="lineno"> 611</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00612"></a><span class="lineno"> 612</span> }</div><div class="line"><a name="l00613"></a><span class="lineno"> 613</span> </div><div class="line"><a name="l00614"></a><span class="lineno"> 614</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00616"></a><span class="lineno"> 616</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags)</div><div class="line"><a name="l00617"></a><span class="lineno"> 617</span> {</div><div class="line"><a name="l00618"></a><span class="lineno"> 618</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00619"></a><span class="lineno"> 619</span>  <span class="keywordtype">size_t</span> len = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(buf);</div><div class="line"><a name="l00620"></a><span class="lineno"> 620</span>  <span class="keyword">struct </span>fuse_out_header *out = iov[0].iov_base;</div><div class="line"><a name="l00621"></a><span class="lineno"> 621</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l00622"></a><span class="lineno"> 622</span>  <span class="keywordtype">int</span> splice_flags;</div><div class="line"><a name="l00623"></a><span class="lineno"> 623</span>  <span class="keywordtype">size_t</span> pipesize;</div><div class="line"><a name="l00624"></a><span class="lineno"> 624</span>  <span class="keywordtype">size_t</span> total_fd_size;</div><div class="line"><a name="l00625"></a><span class="lineno"> 625</span>  <span class="keywordtype">size_t</span> idx;</div><div class="line"><a name="l00626"></a><span class="lineno"> 626</span>  <span class="keywordtype">size_t</span> headerlen;</div><div class="line"><a name="l00627"></a><span class="lineno"> 627</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> pipe_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00628"></a><span class="lineno"> 628</span> </div><div class="line"><a name="l00629"></a><span class="lineno"> 629</span>  <span class="keywordflow">if</span> (se->broken_splice_nonblock)</div><div class="line"><a name="l00630"></a><span class="lineno"> 630</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00631"></a><span class="lineno"> 631</span> </div><div class="line"><a name="l00632"></a><span class="lineno"> 632</span>  <span class="keywordflow">if</span> (flags & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18adcef8052c48f314d4d9f9f05a5b4f838">FUSE_BUF_NO_SPLICE</a>)</div><div class="line"><a name="l00633"></a><span class="lineno"> 633</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00634"></a><span class="lineno"> 634</span> </div><div class="line"><a name="l00635"></a><span class="lineno"> 635</span>  total_fd_size = 0;</div><div class="line"><a name="l00636"></a><span class="lineno"> 636</span>  <span class="keywordflow">for</span> (idx = buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>; idx < buf->count; idx++) {</div><div class="line"><a name="l00637"></a><span class="lineno"> 637</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[idx].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>) {</div><div class="line"><a name="l00638"></a><span class="lineno"> 638</span>  total_fd_size = buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>;</div><div class="line"><a name="l00639"></a><span class="lineno"> 639</span>  <span class="keywordflow">if</span> (idx == buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>)</div><div class="line"><a name="l00640"></a><span class="lineno"> 640</span>  total_fd_size -= buf-><a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a>;</div><div class="line"><a name="l00641"></a><span class="lineno"> 641</span>  }</div><div class="line"><a name="l00642"></a><span class="lineno"> 642</span>  }</div><div class="line"><a name="l00643"></a><span class="lineno"> 643</span>  <span class="keywordflow">if</span> (total_fd_size < 2 * pagesize)</div><div class="line"><a name="l00644"></a><span class="lineno"> 644</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00645"></a><span class="lineno"> 645</span> </div><div class="line"><a name="l00646"></a><span class="lineno"> 646</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 14 ||</div><div class="line"><a name="l00647"></a><span class="lineno"> 647</span>  !(se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4f8815e0f48c60c3d9cd6e72be5a84e4">FUSE_CAP_SPLICE_WRITE</a>))</div><div class="line"><a name="l00648"></a><span class="lineno"> 648</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00649"></a><span class="lineno"> 649</span> </div><div class="line"><a name="l00650"></a><span class="lineno"> 650</span>  llp = fuse_ll_get_pipe(se);</div><div class="line"><a name="l00651"></a><span class="lineno"> 651</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l00652"></a><span class="lineno"> 652</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00653"></a><span class="lineno"> 653</span> </div><div class="line"><a name="l00654"></a><span class="lineno"> 654</span> </div><div class="line"><a name="l00655"></a><span class="lineno"> 655</span>  headerlen = iov_length(iov, iov_count);</div><div class="line"><a name="l00656"></a><span class="lineno"> 656</span> </div><div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  out->len = headerlen + len;</div><div class="line"><a name="l00658"></a><span class="lineno"> 658</span> </div><div class="line"><a name="l00659"></a><span class="lineno"> 659</span>  <span class="comment">/*</span></div><div class="line"><a name="l00660"></a><span class="lineno"> 660</span> <span class="comment"> * Heuristic for the required pipe size, does not work if the</span></div><div class="line"><a name="l00661"></a><span class="lineno"> 661</span> <span class="comment"> * source contains less than page size fragments</span></div><div class="line"><a name="l00662"></a><span class="lineno"> 662</span> <span class="comment"> */</span></div><div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  pipesize = pagesize * (iov_count + buf-><a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> + 1) + out->len;</div><div class="line"><a name="l00664"></a><span class="lineno"> 664</span> </div><div class="line"><a name="l00665"></a><span class="lineno"> 665</span>  if (llp->size < pipesize) {</div><div class="line"><a name="l00666"></a><span class="lineno"> 666</span>  <span class="keywordflow">if</span> (llp->can_grow) {</div><div class="line"><a name="l00667"></a><span class="lineno"> 667</span>  res = fcntl(llp->pipe[0], F_SETPIPE_SZ, pipesize);</div><div class="line"><a name="l00668"></a><span class="lineno"> 668</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00669"></a><span class="lineno"> 669</span>  llp->can_grow = 0;</div><div class="line"><a name="l00670"></a><span class="lineno"> 670</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00671"></a><span class="lineno"> 671</span>  }</div><div class="line"><a name="l00672"></a><span class="lineno"> 672</span>  llp->size = res;</div><div class="line"><a name="l00673"></a><span class="lineno"> 673</span>  }</div><div class="line"><a name="l00674"></a><span class="lineno"> 674</span>  <span class="keywordflow">if</span> (llp->size < pipesize)</div><div class="line"><a name="l00675"></a><span class="lineno"> 675</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00676"></a><span class="lineno"> 676</span>  }</div><div class="line"><a name="l00677"></a><span class="lineno"> 677</span> </div><div class="line"><a name="l00678"></a><span class="lineno"> 678</span> </div><div class="line"><a name="l00679"></a><span class="lineno"> 679</span>  res = vmsplice(llp->pipe[1], iov, iov_count, SPLICE_F_NONBLOCK);</div><div class="line"><a name="l00680"></a><span class="lineno"> 680</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00681"></a><span class="lineno"> 681</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00682"></a><span class="lineno"> 682</span> </div><div class="line"><a name="l00683"></a><span class="lineno"> 683</span>  <span class="keywordflow">if</span> (res != headerlen) {</div><div class="line"><a name="l00684"></a><span class="lineno"> 684</span>  res = -EIO;</div><div class="line"><a name="l00685"></a><span class="lineno"> 685</span>  fprintf(stderr, <span class="stringliteral">"fuse: short vmsplice to pipe: %u/%zu\n"</span>, res,</div><div class="line"><a name="l00686"></a><span class="lineno"> 686</span>  headerlen);</div><div class="line"><a name="l00687"></a><span class="lineno"> 687</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00688"></a><span class="lineno"> 688</span>  }</div><div class="line"><a name="l00689"></a><span class="lineno"> 689</span> </div><div class="line"><a name="l00690"></a><span class="lineno"> 690</span>  pipe_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>;</div><div class="line"><a name="l00691"></a><span class="lineno"> 691</span>  pipe_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a62b2ae82904ac4355142984b9dd90d68">fd</a> = llp->pipe[1];</div><div class="line"><a name="l00692"></a><span class="lineno"> 692</span> </div><div class="line"><a name="l00693"></a><span class="lineno"> 693</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&pipe_buf, buf,</div><div class="line"><a name="l00694"></a><span class="lineno"> 694</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18a375767de945f5178e8949d284abf1f5b">FUSE_BUF_FORCE_SPLICE</a> | <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18a32ec833f1eb4b5cd9283cf9d93021037">FUSE_BUF_SPLICE_NONBLOCK</a>);</div><div class="line"><a name="l00695"></a><span class="lineno"> 695</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l00696"></a><span class="lineno"> 696</span>  <span class="keywordflow">if</span> (res == -EAGAIN || res == -EINVAL) {</div><div class="line"><a name="l00697"></a><span class="lineno"> 697</span>  <span class="comment">/*</span></div><div class="line"><a name="l00698"></a><span class="lineno"> 698</span> <span class="comment"> * Should only get EAGAIN on kernels with</span></div><div class="line"><a name="l00699"></a><span class="lineno"> 699</span> <span class="comment"> * broken SPLICE_F_NONBLOCK support (<=</span></div><div class="line"><a name="l00700"></a><span class="lineno"> 700</span> <span class="comment"> * 2.6.35) where this error or a short read is</span></div><div class="line"><a name="l00701"></a><span class="lineno"> 701</span> <span class="comment"> * returned even if the pipe itself is not</span></div><div class="line"><a name="l00702"></a><span class="lineno"> 702</span> <span class="comment"> * full</span></div><div class="line"><a name="l00703"></a><span class="lineno"> 703</span> <span class="comment"> *</span></div><div class="line"><a name="l00704"></a><span class="lineno"> 704</span> <span class="comment"> * EINVAL might mean that splice can't handle</span></div><div class="line"><a name="l00705"></a><span class="lineno"> 705</span> <span class="comment"> * this combination of input and output.</span></div><div class="line"><a name="l00706"></a><span class="lineno"> 706</span> <span class="comment"> */</span></div><div class="line"><a name="l00707"></a><span class="lineno"> 707</span>  <span class="keywordflow">if</span> (res == -EAGAIN)</div><div class="line"><a name="l00708"></a><span class="lineno"> 708</span>  se->broken_splice_nonblock = 1;</div><div class="line"><a name="l00709"></a><span class="lineno"> 709</span> </div><div class="line"><a name="l00710"></a><span class="lineno"> 710</span>  pthread_setspecific(se->pipe_key, NULL);</div><div class="line"><a name="l00711"></a><span class="lineno"> 711</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l00712"></a><span class="lineno"> 712</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00713"></a><span class="lineno"> 713</span>  }</div><div class="line"><a name="l00714"></a><span class="lineno"> 714</span>  res = -res;</div><div class="line"><a name="l00715"></a><span class="lineno"> 715</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00716"></a><span class="lineno"> 716</span>  }</div><div class="line"><a name="l00717"></a><span class="lineno"> 717</span> </div><div class="line"><a name="l00718"></a><span class="lineno"> 718</span>  <span class="keywordflow">if</span> (res != 0 && res < len) {</div><div class="line"><a name="l00719"></a><span class="lineno"> 719</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> mem_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00720"></a><span class="lineno"> 720</span>  <span class="keywordtype">void</span> *mbuf;</div><div class="line"><a name="l00721"></a><span class="lineno"> 721</span>  <span class="keywordtype">size_t</span> now_len = res;</div><div class="line"><a name="l00722"></a><span class="lineno"> 722</span>  <span class="comment">/*</span></div><div class="line"><a name="l00723"></a><span class="lineno"> 723</span> <span class="comment"> * For regular files a short count is either</span></div><div class="line"><a name="l00724"></a><span class="lineno"> 724</span> <span class="comment"> * 1) due to EOF, or</span></div><div class="line"><a name="l00725"></a><span class="lineno"> 725</span> <span class="comment"> * 2) because of broken SPLICE_F_NONBLOCK (see above)</span></div><div class="line"><a name="l00726"></a><span class="lineno"> 726</span> <span class="comment"> *</span></div><div class="line"><a name="l00727"></a><span class="lineno"> 727</span> <span class="comment"> * For other inputs it's possible that we overflowed</span></div><div class="line"><a name="l00728"></a><span class="lineno"> 728</span> <span class="comment"> * the pipe because of small buffer fragments.</span></div><div class="line"><a name="l00729"></a><span class="lineno"> 729</span> <span class="comment"> */</span></div><div class="line"><a name="l00730"></a><span class="lineno"> 730</span> </div><div class="line"><a name="l00731"></a><span class="lineno"> 731</span>  res = posix_memalign(&mbuf, pagesize, len);</div><div class="line"><a name="l00732"></a><span class="lineno"> 732</span>  <span class="keywordflow">if</span> (res != 0)</div><div class="line"><a name="l00733"></a><span class="lineno"> 733</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00734"></a><span class="lineno"> 734</span> </div><div class="line"><a name="l00735"></a><span class="lineno"> 735</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l00736"></a><span class="lineno"> 736</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a> = now_len;</div><div class="line"><a name="l00737"></a><span class="lineno"> 737</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&mem_buf, buf, 0);</div><div class="line"><a name="l00738"></a><span class="lineno"> 738</span>  <span class="keywordflow">if</span> (res > 0) {</div><div class="line"><a name="l00739"></a><span class="lineno"> 739</span>  <span class="keywordtype">char</span> *tmpbuf;</div><div class="line"><a name="l00740"></a><span class="lineno"> 740</span>  <span class="keywordtype">size_t</span> extra_len = res;</div><div class="line"><a name="l00741"></a><span class="lineno"> 741</span>  <span class="comment">/*</span></div><div class="line"><a name="l00742"></a><span class="lineno"> 742</span> <span class="comment"> * Trickiest case: got more data. Need to get</span></div><div class="line"><a name="l00743"></a><span class="lineno"> 743</span> <span class="comment"> * back the data from the pipe and then fall</span></div><div class="line"><a name="l00744"></a><span class="lineno"> 744</span> <span class="comment"> * back to regular write.</span></div><div class="line"><a name="l00745"></a><span class="lineno"> 745</span> <span class="comment"> */</span></div><div class="line"><a name="l00746"></a><span class="lineno"> 746</span>  tmpbuf = malloc(headerlen);</div><div class="line"><a name="l00747"></a><span class="lineno"> 747</span>  <span class="keywordflow">if</span> (tmpbuf == NULL) {</div><div class="line"><a name="l00748"></a><span class="lineno"> 748</span>  free(mbuf);</div><div class="line"><a name="l00749"></a><span class="lineno"> 749</span>  res = ENOMEM;</div><div class="line"><a name="l00750"></a><span class="lineno"> 750</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00751"></a><span class="lineno"> 751</span>  }</div><div class="line"><a name="l00752"></a><span class="lineno"> 752</span>  res = read_back(llp->pipe[0], tmpbuf, headerlen);</div><div class="line"><a name="l00753"></a><span class="lineno"> 753</span>  free(tmpbuf);</div><div class="line"><a name="l00754"></a><span class="lineno"> 754</span>  <span class="keywordflow">if</span> (res != 0) {</div><div class="line"><a name="l00755"></a><span class="lineno"> 755</span>  free(mbuf);</div><div class="line"><a name="l00756"></a><span class="lineno"> 756</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00757"></a><span class="lineno"> 757</span>  }</div><div class="line"><a name="l00758"></a><span class="lineno"> 758</span>  res = read_back(llp->pipe[0], mbuf, now_len);</div><div class="line"><a name="l00759"></a><span class="lineno"> 759</span>  <span class="keywordflow">if</span> (res != 0) {</div><div class="line"><a name="l00760"></a><span class="lineno"> 760</span>  free(mbuf);</div><div class="line"><a name="l00761"></a><span class="lineno"> 761</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00762"></a><span class="lineno"> 762</span>  }</div><div class="line"><a name="l00763"></a><span class="lineno"> 763</span>  len = now_len + extra_len;</div><div class="line"><a name="l00764"></a><span class="lineno"> 764</span>  iov[iov_count].iov_base = mbuf;</div><div class="line"><a name="l00765"></a><span class="lineno"> 765</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00766"></a><span class="lineno"> 766</span>  iov_count++;</div><div class="line"><a name="l00767"></a><span class="lineno"> 767</span>  res = fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00768"></a><span class="lineno"> 768</span>  free(mbuf);</div><div class="line"><a name="l00769"></a><span class="lineno"> 769</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00770"></a><span class="lineno"> 770</span>  }</div><div class="line"><a name="l00771"></a><span class="lineno"> 771</span>  free(mbuf);</div><div class="line"><a name="l00772"></a><span class="lineno"> 772</span>  res = now_len;</div><div class="line"><a name="l00773"></a><span class="lineno"> 773</span>  }</div><div class="line"><a name="l00774"></a><span class="lineno"> 774</span>  len = res;</div><div class="line"><a name="l00775"></a><span class="lineno"> 775</span>  out->len = headerlen + len;</div><div class="line"><a name="l00776"></a><span class="lineno"> 776</span> </div><div class="line"><a name="l00777"></a><span class="lineno"> 777</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l00778"></a><span class="lineno"> 778</span>  fprintf(stderr,</div><div class="line"><a name="l00779"></a><span class="lineno"> 779</span>  <span class="stringliteral">" unique: %llu, success, outsize: %i (splice)\n"</span>,</div><div class="line"><a name="l00780"></a><span class="lineno"> 780</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->len);</div><div class="line"><a name="l00781"></a><span class="lineno"> 781</span>  }</div><div class="line"><a name="l00782"></a><span class="lineno"> 782</span> </div><div class="line"><a name="l00783"></a><span class="lineno"> 783</span>  splice_flags = 0;</div><div class="line"><a name="l00784"></a><span class="lineno"> 784</span>  <span class="keywordflow">if</span> ((flags & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18af239e556066a5d73b3ff542216b157b9">FUSE_BUF_SPLICE_MOVE</a>) &&</div><div class="line"><a name="l00785"></a><span class="lineno"> 785</span>  (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aef5da823dc5f202bbe033c7a5a3de9c4">FUSE_CAP_SPLICE_MOVE</a>))</div><div class="line"><a name="l00786"></a><span class="lineno"> 786</span>  splice_flags |= SPLICE_F_MOVE;</div><div class="line"><a name="l00787"></a><span class="lineno"> 787</span> </div><div class="line"><a name="l00788"></a><span class="lineno"> 788</span>  res = splice(llp->pipe[0], NULL, ch ? ch->fd : se->fd,</div><div class="line"><a name="l00789"></a><span class="lineno"> 789</span>  NULL, out->len, splice_flags);</div><div class="line"><a name="l00790"></a><span class="lineno"> 790</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00791"></a><span class="lineno"> 791</span>  res = -errno;</div><div class="line"><a name="l00792"></a><span class="lineno"> 792</span>  perror(<span class="stringliteral">"fuse: splice from pipe"</span>);</div><div class="line"><a name="l00793"></a><span class="lineno"> 793</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00794"></a><span class="lineno"> 794</span>  }</div><div class="line"><a name="l00795"></a><span class="lineno"> 795</span>  <span class="keywordflow">if</span> (res != out->len) {</div><div class="line"><a name="l00796"></a><span class="lineno"> 796</span>  res = -EIO;</div><div class="line"><a name="l00797"></a><span class="lineno"> 797</span>  fprintf(stderr, <span class="stringliteral">"fuse: short splice from pipe: %u/%u\n"</span>,</div><div class="line"><a name="l00798"></a><span class="lineno"> 798</span>  res, out->len);</div><div class="line"><a name="l00799"></a><span class="lineno"> 799</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00800"></a><span class="lineno"> 800</span>  }</div><div class="line"><a name="l00801"></a><span class="lineno"> 801</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00802"></a><span class="lineno"> 802</span> </div><div class="line"><a name="l00803"></a><span class="lineno"> 803</span> clear_pipe:</div><div class="line"><a name="l00804"></a><span class="lineno"> 804</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l00805"></a><span class="lineno"> 805</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00806"></a><span class="lineno"> 806</span> </div><div class="line"><a name="l00807"></a><span class="lineno"> 807</span> fallback:</div><div class="line"><a name="l00808"></a><span class="lineno"> 808</span>  <span class="keywordflow">return</span> fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);</div><div class="line"><a name="l00809"></a><span class="lineno"> 809</span> }</div><div class="line"><a name="l00810"></a><span class="lineno"> 810</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00811"></a><span class="lineno"> 811</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00812"></a><span class="lineno"> 812</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00813"></a><span class="lineno"> 813</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags)</div><div class="line"><a name="l00814"></a><span class="lineno"> 814</span> {</div><div class="line"><a name="l00815"></a><span class="lineno"> 815</span>  <span class="keywordtype">size_t</span> len = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(buf);</div><div class="line"><a name="l00816"></a><span class="lineno"> 816</span>  (void) flags;</div><div class="line"><a name="l00817"></a><span class="lineno"> 817</span> </div><div class="line"><a name="l00818"></a><span class="lineno"> 818</span>  <span class="keywordflow">return</span> fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);</div><div class="line"><a name="l00819"></a><span class="lineno"> 819</span> }</div><div class="line"><a name="l00820"></a><span class="lineno"> 820</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00821"></a><span class="lineno"> 821</span> </div><div class="line"><a name="l00822"></a><span class="lineno"> 822</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1242694fe0fb6e253a88b57795987302">fuse_reply_data</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *bufv,</div><div class="line"><a name="l00823"></a><span class="lineno"> 823</span>  <span class="keyword">enum</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18">fuse_buf_copy_flags</a> flags)</div><div class="line"><a name="l00824"></a><span class="lineno"> 824</span> {</div><div class="line"><a name="l00825"></a><span class="lineno"> 825</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l00826"></a><span class="lineno"> 826</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l00827"></a><span class="lineno"> 827</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00828"></a><span class="lineno"> 828</span> </div><div class="line"><a name="l00829"></a><span class="lineno"> 829</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l00830"></a><span class="lineno"> 830</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l00831"></a><span class="lineno"> 831</span> </div><div class="line"><a name="l00832"></a><span class="lineno"> 832</span>  out.unique = req->unique;</div><div class="line"><a name="l00833"></a><span class="lineno"> 833</span>  out.error = 0;</div><div class="line"><a name="l00834"></a><span class="lineno"> 834</span> </div><div class="line"><a name="l00835"></a><span class="lineno"> 835</span>  res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv, flags);</div><div class="line"><a name="l00836"></a><span class="lineno"> 836</span>  <span class="keywordflow">if</span> (res <= 0) {</div><div class="line"><a name="l00837"></a><span class="lineno"> 837</span>  fuse_free_req(req);</div><div class="line"><a name="l00838"></a><span class="lineno"> 838</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00839"></a><span class="lineno"> 839</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00840"></a><span class="lineno"> 840</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, res);</div><div class="line"><a name="l00841"></a><span class="lineno"> 841</span>  }</div><div class="line"><a name="l00842"></a><span class="lineno"> 842</span> }</div><div class="line"><a name="l00843"></a><span class="lineno"> 843</span> </div><div class="line"><a name="l00844"></a><span class="lineno"> 844</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa1d95ec3ca674253baac3639ea10f0ff">fuse_reply_statfs</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> statvfs *stbuf)</div><div class="line"><a name="l00845"></a><span class="lineno"> 845</span> {</div><div class="line"><a name="l00846"></a><span class="lineno"> 846</span>  <span class="keyword">struct </span>fuse_statfs_out arg;</div><div class="line"><a name="l00847"></a><span class="lineno"> 847</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 4 ?</div><div class="line"><a name="l00848"></a><span class="lineno"> 848</span>  FUSE_COMPAT_STATFS_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00849"></a><span class="lineno"> 849</span> </div><div class="line"><a name="l00850"></a><span class="lineno"> 850</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00851"></a><span class="lineno"> 851</span>  convert_statfs(stbuf, &arg.st);</div><div class="line"><a name="l00852"></a><span class="lineno"> 852</span> </div><div class="line"><a name="l00853"></a><span class="lineno"> 853</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00854"></a><span class="lineno"> 854</span> }</div><div class="line"><a name="l00855"></a><span class="lineno"> 855</span> </div><div class="line"><a name="l00856"></a><span class="lineno"> 856</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#afed32e5d3e1f54d390103f79ebb8bd42">fuse_reply_xattr</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00857"></a><span class="lineno"> 857</span> {</div><div class="line"><a name="l00858"></a><span class="lineno"> 858</span>  <span class="keyword">struct </span>fuse_getxattr_out arg;</div><div class="line"><a name="l00859"></a><span class="lineno"> 859</span> </div><div class="line"><a name="l00860"></a><span class="lineno"> 860</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00861"></a><span class="lineno"> 861</span>  arg.size = count;</div><div class="line"><a name="l00862"></a><span class="lineno"> 862</span> </div><div class="line"><a name="l00863"></a><span class="lineno"> 863</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00864"></a><span class="lineno"> 864</span> }</div><div class="line"><a name="l00865"></a><span class="lineno"> 865</span> </div><div class="line"><a name="l00866"></a><span class="lineno"> 866</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a135eda9b7d36fb4eaae2de58526d4f85">fuse_reply_lock</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> flock *lock)</div><div class="line"><a name="l00867"></a><span class="lineno"> 867</span> {</div><div class="line"><a name="l00868"></a><span class="lineno"> 868</span>  <span class="keyword">struct </span>fuse_lk_out arg;</div><div class="line"><a name="l00869"></a><span class="lineno"> 869</span> </div><div class="line"><a name="l00870"></a><span class="lineno"> 870</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00871"></a><span class="lineno"> 871</span>  arg.lk.type = lock->l_type;</div><div class="line"><a name="l00872"></a><span class="lineno"> 872</span>  <span class="keywordflow">if</span> (lock->l_type != F_UNLCK) {</div><div class="line"><a name="l00873"></a><span class="lineno"> 873</span>  arg.lk.start = lock->l_start;</div><div class="line"><a name="l00874"></a><span class="lineno"> 874</span>  <span class="keywordflow">if</span> (lock->l_len == 0)</div><div class="line"><a name="l00875"></a><span class="lineno"> 875</span>  arg.lk.end = OFFSET_MAX;</div><div class="line"><a name="l00876"></a><span class="lineno"> 876</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00877"></a><span class="lineno"> 877</span>  arg.lk.end = lock->l_start + lock->l_len - 1;</div><div class="line"><a name="l00878"></a><span class="lineno"> 878</span>  }</div><div class="line"><a name="l00879"></a><span class="lineno"> 879</span>  arg.lk.pid = lock->l_pid;</div><div class="line"><a name="l00880"></a><span class="lineno"> 880</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00881"></a><span class="lineno"> 881</span> }</div><div class="line"><a name="l00882"></a><span class="lineno"> 882</span> </div><div class="line"><a name="l00883"></a><span class="lineno"> 883</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a65431e8196e0533257acad767f7b074f">fuse_reply_bmap</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, uint64_t idx)</div><div class="line"><a name="l00884"></a><span class="lineno"> 884</span> {</div><div class="line"><a name="l00885"></a><span class="lineno"> 885</span>  <span class="keyword">struct </span>fuse_bmap_out arg;</div><div class="line"><a name="l00886"></a><span class="lineno"> 886</span> </div><div class="line"><a name="l00887"></a><span class="lineno"> 887</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00888"></a><span class="lineno"> 888</span>  arg.block = idx;</div><div class="line"><a name="l00889"></a><span class="lineno"> 889</span> </div><div class="line"><a name="l00890"></a><span class="lineno"> 890</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00891"></a><span class="lineno"> 891</span> }</div><div class="line"><a name="l00892"></a><span class="lineno"> 892</span> </div><div class="line"><a name="l00893"></a><span class="lineno"> 893</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_ioctl_iovec *fuse_ioctl_iovec_copy(<span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00894"></a><span class="lineno"> 894</span>  <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00895"></a><span class="lineno"> 895</span> {</div><div class="line"><a name="l00896"></a><span class="lineno"> 896</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *fiov;</div><div class="line"><a name="l00897"></a><span class="lineno"> 897</span>  <span class="keywordtype">size_t</span> i;</div><div class="line"><a name="l00898"></a><span class="lineno"> 898</span> </div><div class="line"><a name="l00899"></a><span class="lineno"> 899</span>  fiov = malloc(<span class="keyword">sizeof</span>(fiov[0]) * count);</div><div class="line"><a name="l00900"></a><span class="lineno"> 900</span>  <span class="keywordflow">if</span> (!fiov)</div><div class="line"><a name="l00901"></a><span class="lineno"> 901</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00902"></a><span class="lineno"> 902</span> </div><div class="line"><a name="l00903"></a><span class="lineno"> 903</span>  <span class="keywordflow">for</span> (i = 0; i < count; i++) {</div><div class="line"><a name="l00904"></a><span class="lineno"> 904</span>  fiov[i].base = (uintptr_t) iov[i].iov_base;</div><div class="line"><a name="l00905"></a><span class="lineno"> 905</span>  fiov[i].len = iov[i].iov_len;</div><div class="line"><a name="l00906"></a><span class="lineno"> 906</span>  }</div><div class="line"><a name="l00907"></a><span class="lineno"> 907</span> </div><div class="line"><a name="l00908"></a><span class="lineno"> 908</span>  <span class="keywordflow">return</span> fiov;</div><div class="line"><a name="l00909"></a><span class="lineno"> 909</span> }</div><div class="line"><a name="l00910"></a><span class="lineno"> 910</span> </div><div class="line"><a name="l00911"></a><span class="lineno"> 911</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a940683d07df12c24f56b4363aed90e4d">fuse_reply_ioctl_retry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req,</div><div class="line"><a name="l00912"></a><span class="lineno"> 912</span>  <span class="keyword">const</span> <span class="keyword">struct</span> iovec *in_iov, <span class="keywordtype">size_t</span> in_count,</div><div class="line"><a name="l00913"></a><span class="lineno"> 913</span>  <span class="keyword">const</span> <span class="keyword">struct</span> iovec *out_iov, <span class="keywordtype">size_t</span> out_count)</div><div class="line"><a name="l00914"></a><span class="lineno"> 914</span> {</div><div class="line"><a name="l00915"></a><span class="lineno"> 915</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l00916"></a><span class="lineno"> 916</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *in_fiov = NULL;</div><div class="line"><a name="l00917"></a><span class="lineno"> 917</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *out_fiov = NULL;</div><div class="line"><a name="l00918"></a><span class="lineno"> 918</span>  <span class="keyword">struct </span>iovec iov[4];</div><div class="line"><a name="l00919"></a><span class="lineno"> 919</span>  <span class="keywordtype">size_t</span> count = 1;</div><div class="line"><a name="l00920"></a><span class="lineno"> 920</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00921"></a><span class="lineno"> 921</span> </div><div class="line"><a name="l00922"></a><span class="lineno"> 922</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00923"></a><span class="lineno"> 923</span>  arg.flags |= FUSE_IOCTL_RETRY;</div><div class="line"><a name="l00924"></a><span class="lineno"> 924</span>  arg.in_iovs = in_count;</div><div class="line"><a name="l00925"></a><span class="lineno"> 925</span>  arg.out_iovs = out_count;</div><div class="line"><a name="l00926"></a><span class="lineno"> 926</span>  iov[count].iov_base = &arg;</div><div class="line"><a name="l00927"></a><span class="lineno"> 927</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00928"></a><span class="lineno"> 928</span>  count++;</div><div class="line"><a name="l00929"></a><span class="lineno"> 929</span> </div><div class="line"><a name="l00930"></a><span class="lineno"> 930</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor < 16) {</div><div class="line"><a name="l00931"></a><span class="lineno"> 931</span>  <span class="keywordflow">if</span> (in_count) {</div><div class="line"><a name="l00932"></a><span class="lineno"> 932</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)in_iov;</div><div class="line"><a name="l00933"></a><span class="lineno"> 933</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(in_iov[0]) * in_count;</div><div class="line"><a name="l00934"></a><span class="lineno"> 934</span>  count++;</div><div class="line"><a name="l00935"></a><span class="lineno"> 935</span>  }</div><div class="line"><a name="l00936"></a><span class="lineno"> 936</span> </div><div class="line"><a name="l00937"></a><span class="lineno"> 937</span>  <span class="keywordflow">if</span> (out_count) {</div><div class="line"><a name="l00938"></a><span class="lineno"> 938</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)out_iov;</div><div class="line"><a name="l00939"></a><span class="lineno"> 939</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(out_iov[0]) * out_count;</div><div class="line"><a name="l00940"></a><span class="lineno"> 940</span>  count++;</div><div class="line"><a name="l00941"></a><span class="lineno"> 941</span>  }</div><div class="line"><a name="l00942"></a><span class="lineno"> 942</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00943"></a><span class="lineno"> 943</span>  <span class="comment">/* Can't handle non-compat 64bit ioctls on 32bit */</span></div><div class="line"><a name="l00944"></a><span class="lineno"> 944</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span> *) == 4 && req->ioctl_64bit) {</div><div class="line"><a name="l00945"></a><span class="lineno"> 945</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EINVAL);</div><div class="line"><a name="l00946"></a><span class="lineno"> 946</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l00947"></a><span class="lineno"> 947</span>  }</div><div class="line"><a name="l00948"></a><span class="lineno"> 948</span> </div><div class="line"><a name="l00949"></a><span class="lineno"> 949</span>  <span class="keywordflow">if</span> (in_count) {</div><div class="line"><a name="l00950"></a><span class="lineno"> 950</span>  in_fiov = fuse_ioctl_iovec_copy(in_iov, in_count);</div><div class="line"><a name="l00951"></a><span class="lineno"> 951</span>  <span class="keywordflow">if</span> (!in_fiov)</div><div class="line"><a name="l00952"></a><span class="lineno"> 952</span>  <span class="keywordflow">goto</span> enomem;</div><div class="line"><a name="l00953"></a><span class="lineno"> 953</span> </div><div class="line"><a name="l00954"></a><span class="lineno"> 954</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)in_fiov;</div><div class="line"><a name="l00955"></a><span class="lineno"> 955</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(in_fiov[0]) * in_count;</div><div class="line"><a name="l00956"></a><span class="lineno"> 956</span>  count++;</div><div class="line"><a name="l00957"></a><span class="lineno"> 957</span>  }</div><div class="line"><a name="l00958"></a><span class="lineno"> 958</span>  <span class="keywordflow">if</span> (out_count) {</div><div class="line"><a name="l00959"></a><span class="lineno"> 959</span>  out_fiov = fuse_ioctl_iovec_copy(out_iov, out_count);</div><div class="line"><a name="l00960"></a><span class="lineno"> 960</span>  <span class="keywordflow">if</span> (!out_fiov)</div><div class="line"><a name="l00961"></a><span class="lineno"> 961</span>  <span class="keywordflow">goto</span> enomem;</div><div class="line"><a name="l00962"></a><span class="lineno"> 962</span> </div><div class="line"><a name="l00963"></a><span class="lineno"> 963</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)out_fiov;</div><div class="line"><a name="l00964"></a><span class="lineno"> 964</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(out_fiov[0]) * out_count;</div><div class="line"><a name="l00965"></a><span class="lineno"> 965</span>  count++;</div><div class="line"><a name="l00966"></a><span class="lineno"> 966</span>  }</div><div class="line"><a name="l00967"></a><span class="lineno"> 967</span>  }</div><div class="line"><a name="l00968"></a><span class="lineno"> 968</span> </div><div class="line"><a name="l00969"></a><span class="lineno"> 969</span>  res = send_reply_iov(req, 0, iov, count);</div><div class="line"><a name="l00970"></a><span class="lineno"> 970</span> out:</div><div class="line"><a name="l00971"></a><span class="lineno"> 971</span>  free(in_fiov);</div><div class="line"><a name="l00972"></a><span class="lineno"> 972</span>  free(out_fiov);</div><div class="line"><a name="l00973"></a><span class="lineno"> 973</span> </div><div class="line"><a name="l00974"></a><span class="lineno"> 974</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00975"></a><span class="lineno"> 975</span> </div><div class="line"><a name="l00976"></a><span class="lineno"> 976</span> enomem:</div><div class="line"><a name="l00977"></a><span class="lineno"> 977</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l00978"></a><span class="lineno"> 978</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l00979"></a><span class="lineno"> 979</span> }</div><div class="line"><a name="l00980"></a><span class="lineno"> 980</span> </div><div class="line"><a name="l00981"></a><span class="lineno"> 981</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#adf7f34f470c04f276b7091ad3b3dcb31">fuse_reply_ioctl</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> result, <span class="keyword">const</span> <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> size)</div><div class="line"><a name="l00982"></a><span class="lineno"> 982</span> {</div><div class="line"><a name="l00983"></a><span class="lineno"> 983</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l00984"></a><span class="lineno"> 984</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l00985"></a><span class="lineno"> 985</span>  <span class="keywordtype">size_t</span> count = 1;</div><div class="line"><a name="l00986"></a><span class="lineno"> 986</span> </div><div class="line"><a name="l00987"></a><span class="lineno"> 987</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00988"></a><span class="lineno"> 988</span>  arg.result = result;</div><div class="line"><a name="l00989"></a><span class="lineno"> 989</span>  iov[count].iov_base = &arg;</div><div class="line"><a name="l00990"></a><span class="lineno"> 990</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00991"></a><span class="lineno"> 991</span>  count++;</div><div class="line"><a name="l00992"></a><span class="lineno"> 992</span> </div><div class="line"><a name="l00993"></a><span class="lineno"> 993</span>  <span class="keywordflow">if</span> (size) {</div><div class="line"><a name="l00994"></a><span class="lineno"> 994</span>  iov[count].iov_base = (<span class="keywordtype">char</span> *) buf;</div><div class="line"><a name="l00995"></a><span class="lineno"> 995</span>  iov[count].iov_len = size;</div><div class="line"><a name="l00996"></a><span class="lineno"> 996</span>  count++;</div><div class="line"><a name="l00997"></a><span class="lineno"> 997</span>  }</div><div class="line"><a name="l00998"></a><span class="lineno"> 998</span> </div><div class="line"><a name="l00999"></a><span class="lineno"> 999</span>  <span class="keywordflow">return</span> send_reply_iov(req, 0, iov, count);</div><div class="line"><a name="l01000"></a><span class="lineno"> 1000</span> }</div><div class="line"><a name="l01001"></a><span class="lineno"> 1001</span> </div><div class="line"><a name="l01002"></a><span class="lineno"> 1002</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a37381eb84c39e5fe3af9f3ef507aeeb7">fuse_reply_ioctl_iov</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> result, <span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l01004"></a><span class="lineno"> 1004</span> {</div><div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>  <span class="keyword">struct </span>iovec *padded_iov;</div><div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l01008"></a><span class="lineno"> 1008</span> </div><div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>  padded_iov = malloc((count + 2) * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>  <span class="keywordflow">if</span> (padded_iov == NULL)</div><div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l01012"></a><span class="lineno"> 1012</span> </div><div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>  arg.result = result;</div><div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>  padded_iov[1].iov_base = &arg;</div><div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>  padded_iov[1].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l01017"></a><span class="lineno"> 1017</span> </div><div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>  memcpy(&padded_iov[2], iov, count * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l01019"></a><span class="lineno"> 1019</span> </div><div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>  res = send_reply_iov(req, 0, padded_iov, count + 2);</div><div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>  free(padded_iov);</div><div class="line"><a name="l01022"></a><span class="lineno"> 1022</span> </div><div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l01024"></a><span class="lineno"> 1024</span> }</div><div class="line"><a name="l01025"></a><span class="lineno"> 1025</span> </div><div class="line"><a name="l01026"></a><span class="lineno"> 1026</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2172d260d34c76c25cd601870aee4220">fuse_reply_poll</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">unsigned</span> revents)</div><div class="line"><a name="l01027"></a><span class="lineno"> 1027</span> {</div><div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>  <span class="keyword">struct </span>fuse_poll_out arg;</div><div class="line"><a name="l01029"></a><span class="lineno"> 1029</span> </div><div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>  arg.revents = revents;</div><div class="line"><a name="l01032"></a><span class="lineno"> 1032</span> </div><div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01034"></a><span class="lineno"> 1034</span> }</div><div class="line"><a name="l01035"></a><span class="lineno"> 1035</span> </div><div class="line"><a name="l01036"></a><span class="lineno"> 1036</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_lookup(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01037"></a><span class="lineno"> 1037</span> {</div><div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01039"></a><span class="lineno"> 1039</span> </div><div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>  <span class="keywordflow">if</span> (req->se->op.lookup)</div><div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>  req->se->op.lookup(req, nodeid, name);</div><div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01044"></a><span class="lineno"> 1044</span> }</div><div class="line"><a name="l01045"></a><span class="lineno"> 1045</span> </div><div class="line"><a name="l01046"></a><span class="lineno"> 1046</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_forget(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01047"></a><span class="lineno"> 1047</span> {</div><div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>  <span class="keyword">struct </span>fuse_forget_in *arg = (<span class="keyword">struct </span>fuse_forget_in *) inarg;</div><div class="line"><a name="l01049"></a><span class="lineno"> 1049</span> </div><div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>  <span class="keywordflow">if</span> (req->se->op.forget)</div><div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>  req->se->op.forget(req, nodeid, arg->nlookup);</div><div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01054"></a><span class="lineno"> 1054</span> }</div><div class="line"><a name="l01055"></a><span class="lineno"> 1055</span> </div><div class="line"><a name="l01056"></a><span class="lineno"> 1056</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_batch_forget(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01058"></a><span class="lineno"> 1058</span> {</div><div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>  <span class="keyword">struct </span>fuse_batch_forget_in *arg = (<span class="keywordtype">void</span> *) inarg;</div><div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>  <span class="keyword">struct </span>fuse_forget_one *param = (<span class="keywordtype">void</span> *) PARAM(arg);</div><div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;</div><div class="line"><a name="l01062"></a><span class="lineno"> 1062</span> </div><div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>  (void) nodeid;</div><div class="line"><a name="l01064"></a><span class="lineno"> 1064</span> </div><div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>  <span class="keywordflow">if</span> (req->se->op.forget_multi) {</div><div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>  req->se->op.forget_multi(req, arg->count,</div><div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>  (<span class="keyword">struct</span> fuse_forget_data *) param);</div><div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (req->se->op.forget) {</div><div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>  <span class="keywordflow">for</span> (i = 0; i < arg->count; i++) {</div><div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>  <span class="keyword">struct </span>fuse_forget_one *forget = &param[i];</div><div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>  <span class="keyword">struct </span>fuse_req *dummy_req;</div><div class="line"><a name="l01072"></a><span class="lineno"> 1072</span> </div><div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>  dummy_req = fuse_ll_alloc_req(req->se);</div><div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>  <span class="keywordflow">if</span> (dummy_req == NULL)</div><div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01076"></a><span class="lineno"> 1076</span> </div><div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>  dummy_req->unique = req->unique;</div><div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>  dummy_req->ctx = req->ctx;</div><div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>  dummy_req->ch = NULL;</div><div class="line"><a name="l01080"></a><span class="lineno"> 1080</span> </div><div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>  req->se->op.forget(dummy_req, forget->nodeid,</div><div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>  forget->nlookup);</div><div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>  }</div><div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>  }</div><div class="line"><a name="l01088"></a><span class="lineno"> 1088</span> }</div><div class="line"><a name="l01089"></a><span class="lineno"> 1089</span> </div><div class="line"><a name="l01090"></a><span class="lineno"> 1090</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01091"></a><span class="lineno"> 1091</span> {</div><div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fip = NULL;</div><div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01094"></a><span class="lineno"> 1094</span> </div><div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 9) {</div><div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>  <span class="keyword">struct </span>fuse_getattr_in *arg = (<span class="keyword">struct </span>fuse_getattr_in *) inarg;</div><div class="line"><a name="l01097"></a><span class="lineno"> 1097</span> </div><div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>  <span class="keywordflow">if</span> (arg->getattr_flags & FUSE_GETATTR_FH) {</div><div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>  fi.fh = arg->fh;</div><div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>  fip = &fi;</div><div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>  }</div><div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>  }</div><div class="line"><a name="l01104"></a><span class="lineno"> 1104</span> </div><div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>  <span class="keywordflow">if</span> (req->se->op.getattr)</div><div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>  req->se->op.getattr(req, nodeid, fip);</div><div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01109"></a><span class="lineno"> 1109</span> }</div><div class="line"><a name="l01110"></a><span class="lineno"> 1110</span> </div><div class="line"><a name="l01111"></a><span class="lineno"> 1111</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01112"></a><span class="lineno"> 1112</span> {</div><div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>  <span class="keyword">struct </span>fuse_setattr_in *arg = (<span class="keyword">struct </span>fuse_setattr_in *) inarg;</div><div class="line"><a name="l01114"></a><span class="lineno"> 1114</span> </div><div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>  <span class="keywordflow">if</span> (req->se->op.setattr) {</div><div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fi = NULL;</div><div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi_store;</div><div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>  <span class="keyword">struct </span>stat stbuf;</div><div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>  memset(&stbuf, 0, <span class="keyword">sizeof</span>(stbuf));</div><div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>  convert_attr(arg, &stbuf);</div><div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>  <span class="keywordflow">if</span> (arg->valid & FATTR_FH) {</div><div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>  arg->valid &= ~FATTR_FH;</div><div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>  memset(&fi_store, 0, <span class="keyword">sizeof</span>(fi_store));</div><div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>  fi = &fi_store;</div><div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>  fi-><a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>  }</div><div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>  arg->valid &=</div><div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>  FUSE_SET_ATTR_MODE |</div><div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>  FUSE_SET_ATTR_UID |</div><div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>  FUSE_SET_ATTR_GID |</div><div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>  FUSE_SET_ATTR_SIZE |</div><div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>  FUSE_SET_ATTR_ATIME |</div><div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>  FUSE_SET_ATTR_MTIME |</div><div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>  FUSE_SET_ATTR_ATIME_NOW |</div><div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>  FUSE_SET_ATTR_MTIME_NOW |</div><div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>  FUSE_SET_ATTR_CTIME;</div><div class="line"><a name="l01137"></a><span class="lineno"> 1137</span> </div><div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>  req->se->op.setattr(req, nodeid, &stbuf, arg->valid, fi);</div><div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01141"></a><span class="lineno"> 1141</span> }</div><div class="line"><a name="l01142"></a><span class="lineno"> 1142</span> </div><div class="line"><a name="l01143"></a><span class="lineno"> 1143</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_access(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01144"></a><span class="lineno"> 1144</span> {</div><div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>  <span class="keyword">struct </span>fuse_access_in *arg = (<span class="keyword">struct </span>fuse_access_in *) inarg;</div><div class="line"><a name="l01146"></a><span class="lineno"> 1146</span> </div><div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>  <span class="keywordflow">if</span> (req->se->op.access)</div><div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>  req->se->op.access(req, nodeid, arg->mask);</div><div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01151"></a><span class="lineno"> 1151</span> }</div><div class="line"><a name="l01152"></a><span class="lineno"> 1152</span> </div><div class="line"><a name="l01153"></a><span class="lineno"> 1153</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01154"></a><span class="lineno"> 1154</span> {</div><div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>  (void) inarg;</div><div class="line"><a name="l01156"></a><span class="lineno"> 1156</span> </div><div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>  <span class="keywordflow">if</span> (req->se->op.readlink)</div><div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>  req->se->op.readlink(req, nodeid);</div><div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01161"></a><span class="lineno"> 1161</span> }</div><div class="line"><a name="l01162"></a><span class="lineno"> 1162</span> </div><div class="line"><a name="l01163"></a><span class="lineno"> 1163</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_mknod(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01164"></a><span class="lineno"> 1164</span> {</div><div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>  <span class="keyword">struct </span>fuse_mknod_in *arg = (<span class="keyword">struct </span>fuse_mknod_in *) inarg;</div><div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01167"></a><span class="lineno"> 1167</span> </div><div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>  name = (<span class="keywordtype">char</span> *) inarg + FUSE_COMPAT_MKNOD_IN_SIZE;</div><div class="line"><a name="l01172"></a><span class="lineno"> 1172</span> </div><div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>  <span class="keywordflow">if</span> (req->se->op.mknod)</div><div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>  req->se->op.mknod(req, nodeid, name, arg->mode, arg->rdev);</div><div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01177"></a><span class="lineno"> 1177</span> }</div><div class="line"><a name="l01178"></a><span class="lineno"> 1178</span> </div><div class="line"><a name="l01179"></a><span class="lineno"> 1179</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_mkdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01180"></a><span class="lineno"> 1180</span> {</div><div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>  <span class="keyword">struct </span>fuse_mkdir_in *arg = (<span class="keyword">struct </span>fuse_mkdir_in *) inarg;</div><div class="line"><a name="l01182"></a><span class="lineno"> 1182</span> </div><div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01185"></a><span class="lineno"> 1185</span> </div><div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>  <span class="keywordflow">if</span> (req->se->op.mkdir)</div><div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>  req->se->op.mkdir(req, nodeid, PARAM(arg), arg->mode);</div><div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01190"></a><span class="lineno"> 1190</span> }</div><div class="line"><a name="l01191"></a><span class="lineno"> 1191</span> </div><div class="line"><a name="l01192"></a><span class="lineno"> 1192</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_unlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01193"></a><span class="lineno"> 1193</span> {</div><div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01195"></a><span class="lineno"> 1195</span> </div><div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>  <span class="keywordflow">if</span> (req->se->op.unlink)</div><div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>  req->se->op.unlink(req, nodeid, name);</div><div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01200"></a><span class="lineno"> 1200</span> }</div><div class="line"><a name="l01201"></a><span class="lineno"> 1201</span> </div><div class="line"><a name="l01202"></a><span class="lineno"> 1202</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rmdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01203"></a><span class="lineno"> 1203</span> {</div><div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01205"></a><span class="lineno"> 1205</span> </div><div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>  <span class="keywordflow">if</span> (req->se->op.rmdir)</div><div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>  req->se->op.rmdir(req, nodeid, name);</div><div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01210"></a><span class="lineno"> 1210</span> }</div><div class="line"><a name="l01211"></a><span class="lineno"> 1211</span> </div><div class="line"><a name="l01212"></a><span class="lineno"> 1212</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_symlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01213"></a><span class="lineno"> 1213</span> {</div><div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>  <span class="keywordtype">char</span> *linkname = ((<span class="keywordtype">char</span> *) inarg) + strlen((<span class="keywordtype">char</span> *) inarg) + 1;</div><div class="line"><a name="l01216"></a><span class="lineno"> 1216</span> </div><div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>  <span class="keywordflow">if</span> (req->se->op.symlink)</div><div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>  req->se->op.symlink(req, linkname, nodeid, name);</div><div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01221"></a><span class="lineno"> 1221</span> }</div><div class="line"><a name="l01222"></a><span class="lineno"> 1222</span> </div><div class="line"><a name="l01223"></a><span class="lineno"> 1223</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rename(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01224"></a><span class="lineno"> 1224</span> {</div><div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>  <span class="keyword">struct </span>fuse_rename_in *arg = (<span class="keyword">struct </span>fuse_rename_in *) inarg;</div><div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>  <span class="keywordtype">char</span> *oldname = PARAM(arg);</div><div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>  <span class="keywordtype">char</span> *newname = oldname + strlen(oldname) + 1;</div><div class="line"><a name="l01228"></a><span class="lineno"> 1228</span> </div><div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>  <span class="keywordflow">if</span> (req->se->op.rename)</div><div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>  req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,</div><div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>  0);</div><div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01234"></a><span class="lineno"> 1234</span> }</div><div class="line"><a name="l01235"></a><span class="lineno"> 1235</span> </div><div class="line"><a name="l01236"></a><span class="lineno"> 1236</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rename2(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01237"></a><span class="lineno"> 1237</span> {</div><div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>  <span class="keyword">struct </span>fuse_rename2_in *arg = (<span class="keyword">struct </span>fuse_rename2_in *) inarg;</div><div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>  <span class="keywordtype">char</span> *oldname = PARAM(arg);</div><div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>  <span class="keywordtype">char</span> *newname = oldname + strlen(oldname) + 1;</div><div class="line"><a name="l01241"></a><span class="lineno"> 1241</span> </div><div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>  <span class="keywordflow">if</span> (req->se->op.rename)</div><div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>  req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,</div><div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>  arg->flags);</div><div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01247"></a><span class="lineno"> 1247</span> }</div><div class="line"><a name="l01248"></a><span class="lineno"> 1248</span> </div><div class="line"><a name="l01249"></a><span class="lineno"> 1249</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_link(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01250"></a><span class="lineno"> 1250</span> {</div><div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>  <span class="keyword">struct </span>fuse_link_in *arg = (<span class="keyword">struct </span>fuse_link_in *) inarg;</div><div class="line"><a name="l01252"></a><span class="lineno"> 1252</span> </div><div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>  <span class="keywordflow">if</span> (req->se->op.link)</div><div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>  req->se->op.link(req, arg->oldnodeid, nodeid, PARAM(arg));</div><div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01257"></a><span class="lineno"> 1257</span> }</div><div class="line"><a name="l01258"></a><span class="lineno"> 1258</span> </div><div class="line"><a name="l01259"></a><span class="lineno"> 1259</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_create(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01260"></a><span class="lineno"> 1260</span> {</div><div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>  <span class="keyword">struct </span>fuse_create_in *arg = (<span class="keyword">struct </span>fuse_create_in *) inarg;</div><div class="line"><a name="l01262"></a><span class="lineno"> 1262</span> </div><div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>  <span class="keywordflow">if</span> (req->se->op.create) {</div><div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01266"></a><span class="lineno"> 1266</span> </div><div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01269"></a><span class="lineno"> 1269</span> </div><div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>  name = (<span class="keywordtype">char</span> *) inarg + <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_open_in);</div><div class="line"><a name="l01274"></a><span class="lineno"> 1274</span> </div><div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>  req->se->op.create(req, nodeid, name, arg->mode, &fi);</div><div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01278"></a><span class="lineno"> 1278</span> }</div><div class="line"><a name="l01279"></a><span class="lineno"> 1279</span> </div><div class="line"><a name="l01280"></a><span class="lineno"> 1280</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_open(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01281"></a><span class="lineno"> 1281</span> {</div><div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>  <span class="keyword">struct </span>fuse_open_in *arg = (<span class="keyword">struct </span>fuse_open_in *) inarg;</div><div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01284"></a><span class="lineno"> 1284</span> </div><div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01287"></a><span class="lineno"> 1287</span> </div><div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>  <span class="keywordflow">if</span> (req->se->op.open)</div><div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>  req->se->op.open(req, nodeid, &fi);</div><div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(req, &fi);</div><div class="line"><a name="l01292"></a><span class="lineno"> 1292</span> }</div><div class="line"><a name="l01293"></a><span class="lineno"> 1293</span> </div><div class="line"><a name="l01294"></a><span class="lineno"> 1294</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_read(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01295"></a><span class="lineno"> 1295</span> {</div><div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01297"></a><span class="lineno"> 1297</span> </div><div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>  <span class="keywordflow">if</span> (req->se->op.read) {</div><div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01300"></a><span class="lineno"> 1300</span> </div><div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 9) {</div><div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>  }</div><div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>  req->se->op.read(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01310"></a><span class="lineno"> 1310</span> }</div><div class="line"><a name="l01311"></a><span class="lineno"> 1311</span> </div><div class="line"><a name="l01312"></a><span class="lineno"> 1312</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_write(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01313"></a><span class="lineno"> 1313</span> {</div><div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>  <span class="keyword">struct </span>fuse_write_in *arg = (<span class="keyword">struct </span>fuse_write_in *) inarg;</div><div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>  <span class="keywordtype">char</span> *param;</div><div class="line"><a name="l01317"></a><span class="lineno"> 1317</span> </div><div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>  fi.<a class="code" href="structfuse__file__info.html#a984187caa62aafc15abf9ff621667f3d">writepage</a> = (arg->write_flags & FUSE_WRITE_CACHE) != 0;</div><div class="line"><a name="l01321"></a><span class="lineno"> 1321</span> </div><div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor < 9) {</div><div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>  param = ((<span class="keywordtype">char</span> *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>  param = PARAM(arg);</div><div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>  }</div><div class="line"><a name="l01329"></a><span class="lineno"> 1329</span> </div><div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>  <span class="keywordflow">if</span> (req->se->op.write)</div><div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>  req->se->op.write(req, nodeid, param, arg->size,</div><div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>  arg->offset, &fi);</div><div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01335"></a><span class="lineno"> 1335</span> }</div><div class="line"><a name="l01336"></a><span class="lineno"> 1336</span> </div><div class="line"><a name="l01337"></a><span class="lineno"> 1337</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_write_buf(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg,</div><div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *ibuf)</div><div class="line"><a name="l01339"></a><span class="lineno"> 1339</span> {</div><div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = {</div><div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>  .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *ibuf,</div><div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>  .count = 1,</div><div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>  };</div><div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>  <span class="keyword">struct </span>fuse_write_in *arg = (<span class="keyword">struct </span>fuse_write_in *) inarg;</div><div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01347"></a><span class="lineno"> 1347</span> </div><div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>  fi.<a class="code" href="structfuse__file__info.html#a984187caa62aafc15abf9ff621667f3d">writepage</a> = arg->write_flags & FUSE_WRITE_CACHE;</div><div class="line"><a name="l01351"></a><span class="lineno"> 1351</span> </div><div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 9) {</div><div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = ((<span class="keywordtype">char</span> *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>  FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>  assert(!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD));</div><div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01359"></a><span class="lineno"> 1359</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01360"></a><span class="lineno"> 1360</span>  <span class="keywordflow">if</span> (!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD))</div><div class="line"><a name="l01361"></a><span class="lineno"> 1361</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = PARAM(arg);</div><div class="line"><a name="l01362"></a><span class="lineno"> 1362</span> </div><div class="line"><a name="l01363"></a><span class="lineno"> 1363</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l01364"></a><span class="lineno"> 1364</span>  sizeof(struct fuse_write_in);</div><div class="line"><a name="l01365"></a><span class="lineno"> 1365</span>  }</div><div class="line"><a name="l01366"></a><span class="lineno"> 1366</span>  <span class="keywordflow">if</span> (bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < arg->size) {</div><div class="line"><a name="l01367"></a><span class="lineno"> 1367</span>  fprintf(stderr, <span class="stringliteral">"fuse: do_write_buf: buffer size too small\n"</span>);</div><div class="line"><a name="l01368"></a><span class="lineno"> 1368</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EIO);</div><div class="line"><a name="l01369"></a><span class="lineno"> 1369</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l01370"></a><span class="lineno"> 1370</span>  }</div><div class="line"><a name="l01371"></a><span class="lineno"> 1371</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = arg->size;</div><div class="line"><a name="l01372"></a><span class="lineno"> 1372</span> </div><div class="line"><a name="l01373"></a><span class="lineno"> 1373</span>  se->op.write_buf(req, nodeid, &bufv, arg->offset, &fi);</div><div class="line"><a name="l01374"></a><span class="lineno"> 1374</span> </div><div class="line"><a name="l01375"></a><span class="lineno"> 1375</span> out:</div><div class="line"><a name="l01376"></a><span class="lineno"> 1376</span>  <span class="comment">/* Need to reset the pipe if ->write_buf() didn't consume all data */</span></div><div class="line"><a name="l01377"></a><span class="lineno"> 1377</span>  <span class="keywordflow">if</span> ((ibuf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) && bufv.<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> < bufv.<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a>)</div><div class="line"><a name="l01378"></a><span class="lineno"> 1378</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l01379"></a><span class="lineno"> 1379</span> }</div><div class="line"><a name="l01380"></a><span class="lineno"> 1380</span> </div><div class="line"><a name="l01381"></a><span class="lineno"> 1381</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_flush(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01382"></a><span class="lineno"> 1382</span> {</div><div class="line"><a name="l01383"></a><span class="lineno"> 1383</span>  <span class="keyword">struct </span>fuse_flush_in *arg = (<span class="keyword">struct </span>fuse_flush_in *) inarg;</div><div class="line"><a name="l01384"></a><span class="lineno"> 1384</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01385"></a><span class="lineno"> 1385</span> </div><div class="line"><a name="l01386"></a><span class="lineno"> 1386</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01387"></a><span class="lineno"> 1387</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01388"></a><span class="lineno"> 1388</span>  fi.<a class="code" href="structfuse__file__info.html#a9c1571cb4b6be75827f48aac5891606c">flush</a> = 1;</div><div class="line"><a name="l01389"></a><span class="lineno"> 1389</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 7)</div><div class="line"><a name="l01390"></a><span class="lineno"> 1390</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01391"></a><span class="lineno"> 1391</span> </div><div class="line"><a name="l01392"></a><span class="lineno"> 1392</span>  <span class="keywordflow">if</span> (req->se->op.flush)</div><div class="line"><a name="l01393"></a><span class="lineno"> 1393</span>  req->se->op.flush(req, nodeid, &fi);</div><div class="line"><a name="l01394"></a><span class="lineno"> 1394</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01395"></a><span class="lineno"> 1395</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01396"></a><span class="lineno"> 1396</span> }</div><div class="line"><a name="l01397"></a><span class="lineno"> 1397</span> </div><div class="line"><a name="l01398"></a><span class="lineno"> 1398</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_release(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01399"></a><span class="lineno"> 1399</span> {</div><div class="line"><a name="l01400"></a><span class="lineno"> 1400</span>  <span class="keyword">struct </span>fuse_release_in *arg = (<span class="keyword">struct </span>fuse_release_in *) inarg;</div><div class="line"><a name="l01401"></a><span class="lineno"> 1401</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01402"></a><span class="lineno"> 1402</span> </div><div class="line"><a name="l01403"></a><span class="lineno"> 1403</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01404"></a><span class="lineno"> 1404</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01405"></a><span class="lineno"> 1405</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01406"></a><span class="lineno"> 1406</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 8) {</div><div class="line"><a name="l01407"></a><span class="lineno"> 1407</span>  fi.<a class="code" href="structfuse__file__info.html#a9c1571cb4b6be75827f48aac5891606c">flush</a> = (arg->release_flags & FUSE_RELEASE_FLUSH) ? 1 : 0;</div><div class="line"><a name="l01408"></a><span class="lineno"> 1408</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01409"></a><span class="lineno"> 1409</span>  }</div><div class="line"><a name="l01410"></a><span class="lineno"> 1410</span>  <span class="keywordflow">if</span> (arg->release_flags & FUSE_RELEASE_FLOCK_UNLOCK) {</div><div class="line"><a name="l01411"></a><span class="lineno"> 1411</span>  fi.flock_release = 1;</div><div class="line"><a name="l01412"></a><span class="lineno"> 1412</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01413"></a><span class="lineno"> 1413</span>  }</div><div class="line"><a name="l01414"></a><span class="lineno"> 1414</span> </div><div class="line"><a name="l01415"></a><span class="lineno"> 1415</span>  <span class="keywordflow">if</span> (req->se->op.release)</div><div class="line"><a name="l01416"></a><span class="lineno"> 1416</span>  req->se->op.release(req, nodeid, &fi);</div><div class="line"><a name="l01417"></a><span class="lineno"> 1417</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01418"></a><span class="lineno"> 1418</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, 0);</div><div class="line"><a name="l01419"></a><span class="lineno"> 1419</span> }</div><div class="line"><a name="l01420"></a><span class="lineno"> 1420</span> </div><div class="line"><a name="l01421"></a><span class="lineno"> 1421</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fsync(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01422"></a><span class="lineno"> 1422</span> {</div><div class="line"><a name="l01423"></a><span class="lineno"> 1423</span>  <span class="keyword">struct </span>fuse_fsync_in *arg = (<span class="keyword">struct </span>fuse_fsync_in *) inarg;</div><div class="line"><a name="l01424"></a><span class="lineno"> 1424</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01425"></a><span class="lineno"> 1425</span>  <span class="keywordtype">int</span> datasync = arg->fsync_flags & 1;</div><div class="line"><a name="l01426"></a><span class="lineno"> 1426</span> </div><div class="line"><a name="l01427"></a><span class="lineno"> 1427</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01428"></a><span class="lineno"> 1428</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01429"></a><span class="lineno"> 1429</span> </div><div class="line"><a name="l01430"></a><span class="lineno"> 1430</span>  <span class="keywordflow">if</span> (req->se->op.fsync)</div><div class="line"><a name="l01431"></a><span class="lineno"> 1431</span>  req->se->op.fsync(req, nodeid, datasync, &fi);</div><div class="line"><a name="l01432"></a><span class="lineno"> 1432</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01433"></a><span class="lineno"> 1433</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01434"></a><span class="lineno"> 1434</span> }</div><div class="line"><a name="l01435"></a><span class="lineno"> 1435</span> </div><div class="line"><a name="l01436"></a><span class="lineno"> 1436</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_opendir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01437"></a><span class="lineno"> 1437</span> {</div><div class="line"><a name="l01438"></a><span class="lineno"> 1438</span>  <span class="keyword">struct </span>fuse_open_in *arg = (<span class="keyword">struct </span>fuse_open_in *) inarg;</div><div class="line"><a name="l01439"></a><span class="lineno"> 1439</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01440"></a><span class="lineno"> 1440</span> </div><div class="line"><a name="l01441"></a><span class="lineno"> 1441</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01442"></a><span class="lineno"> 1442</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01443"></a><span class="lineno"> 1443</span> </div><div class="line"><a name="l01444"></a><span class="lineno"> 1444</span>  <span class="keywordflow">if</span> (req->se->op.opendir)</div><div class="line"><a name="l01445"></a><span class="lineno"> 1445</span>  req->se->op.opendir(req, nodeid, &fi);</div><div class="line"><a name="l01446"></a><span class="lineno"> 1446</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01447"></a><span class="lineno"> 1447</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(req, &fi);</div><div class="line"><a name="l01448"></a><span class="lineno"> 1448</span> }</div><div class="line"><a name="l01449"></a><span class="lineno"> 1449</span> </div><div class="line"><a name="l01450"></a><span class="lineno"> 1450</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01451"></a><span class="lineno"> 1451</span> {</div><div class="line"><a name="l01452"></a><span class="lineno"> 1452</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01453"></a><span class="lineno"> 1453</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01454"></a><span class="lineno"> 1454</span> </div><div class="line"><a name="l01455"></a><span class="lineno"> 1455</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01456"></a><span class="lineno"> 1456</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01457"></a><span class="lineno"> 1457</span> </div><div class="line"><a name="l01458"></a><span class="lineno"> 1458</span>  <span class="keywordflow">if</span> (req->se->op.readdir)</div><div class="line"><a name="l01459"></a><span class="lineno"> 1459</span>  req->se->op.readdir(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01460"></a><span class="lineno"> 1460</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01461"></a><span class="lineno"> 1461</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01462"></a><span class="lineno"> 1462</span> }</div><div class="line"><a name="l01463"></a><span class="lineno"> 1463</span> </div><div class="line"><a name="l01464"></a><span class="lineno"> 1464</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readdirplus(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01465"></a><span class="lineno"> 1465</span> {</div><div class="line"><a name="l01466"></a><span class="lineno"> 1466</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01467"></a><span class="lineno"> 1467</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01468"></a><span class="lineno"> 1468</span> </div><div class="line"><a name="l01469"></a><span class="lineno"> 1469</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01470"></a><span class="lineno"> 1470</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01471"></a><span class="lineno"> 1471</span> </div><div class="line"><a name="l01472"></a><span class="lineno"> 1472</span>  <span class="keywordflow">if</span> (req->se->op.readdirplus)</div><div class="line"><a name="l01473"></a><span class="lineno"> 1473</span>  req->se->op.readdirplus(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01474"></a><span class="lineno"> 1474</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01475"></a><span class="lineno"> 1475</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01476"></a><span class="lineno"> 1476</span> }</div><div class="line"><a name="l01477"></a><span class="lineno"> 1477</span> </div><div class="line"><a name="l01478"></a><span class="lineno"> 1478</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_releasedir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01479"></a><span class="lineno"> 1479</span> {</div><div class="line"><a name="l01480"></a><span class="lineno"> 1480</span>  <span class="keyword">struct </span>fuse_release_in *arg = (<span class="keyword">struct </span>fuse_release_in *) inarg;</div><div class="line"><a name="l01481"></a><span class="lineno"> 1481</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01482"></a><span class="lineno"> 1482</span> </div><div class="line"><a name="l01483"></a><span class="lineno"> 1483</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01484"></a><span class="lineno"> 1484</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01485"></a><span class="lineno"> 1485</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01486"></a><span class="lineno"> 1486</span> </div><div class="line"><a name="l01487"></a><span class="lineno"> 1487</span>  <span class="keywordflow">if</span> (req->se->op.releasedir)</div><div class="line"><a name="l01488"></a><span class="lineno"> 1488</span>  req->se->op.releasedir(req, nodeid, &fi);</div><div class="line"><a name="l01489"></a><span class="lineno"> 1489</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01490"></a><span class="lineno"> 1490</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, 0);</div><div class="line"><a name="l01491"></a><span class="lineno"> 1491</span> }</div><div class="line"><a name="l01492"></a><span class="lineno"> 1492</span> </div><div class="line"><a name="l01493"></a><span class="lineno"> 1493</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fsyncdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01494"></a><span class="lineno"> 1494</span> {</div><div class="line"><a name="l01495"></a><span class="lineno"> 1495</span>  <span class="keyword">struct </span>fuse_fsync_in *arg = (<span class="keyword">struct </span>fuse_fsync_in *) inarg;</div><div class="line"><a name="l01496"></a><span class="lineno"> 1496</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01497"></a><span class="lineno"> 1497</span>  <span class="keywordtype">int</span> datasync = arg->fsync_flags & 1;</div><div class="line"><a name="l01498"></a><span class="lineno"> 1498</span> </div><div class="line"><a name="l01499"></a><span class="lineno"> 1499</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01500"></a><span class="lineno"> 1500</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01501"></a><span class="lineno"> 1501</span> </div><div class="line"><a name="l01502"></a><span class="lineno"> 1502</span>  <span class="keywordflow">if</span> (req->se->op.fsyncdir)</div><div class="line"><a name="l01503"></a><span class="lineno"> 1503</span>  req->se->op.fsyncdir(req, nodeid, datasync, &fi);</div><div class="line"><a name="l01504"></a><span class="lineno"> 1504</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01505"></a><span class="lineno"> 1505</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01506"></a><span class="lineno"> 1506</span> }</div><div class="line"><a name="l01507"></a><span class="lineno"> 1507</span> </div><div class="line"><a name="l01508"></a><span class="lineno"> 1508</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_statfs(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01509"></a><span class="lineno"> 1509</span> {</div><div class="line"><a name="l01510"></a><span class="lineno"> 1510</span>  (void) nodeid;</div><div class="line"><a name="l01511"></a><span class="lineno"> 1511</span>  (void) inarg;</div><div class="line"><a name="l01512"></a><span class="lineno"> 1512</span> </div><div class="line"><a name="l01513"></a><span class="lineno"> 1513</span>  <span class="keywordflow">if</span> (req->se->op.statfs)</div><div class="line"><a name="l01514"></a><span class="lineno"> 1514</span>  req->se->op.statfs(req, nodeid);</div><div class="line"><a name="l01515"></a><span class="lineno"> 1515</span>  <span class="keywordflow">else</span> {</div><div class="line"><a name="l01516"></a><span class="lineno"> 1516</span>  <span class="keyword">struct </span>statvfs buf = {</div><div class="line"><a name="l01517"></a><span class="lineno"> 1517</span>  .f_namemax = 255,</div><div class="line"><a name="l01518"></a><span class="lineno"> 1518</span>  .f_bsize = 512,</div><div class="line"><a name="l01519"></a><span class="lineno"> 1519</span>  };</div><div class="line"><a name="l01520"></a><span class="lineno"> 1520</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa1d95ec3ca674253baac3639ea10f0ff">fuse_reply_statfs</a>(req, &buf);</div><div class="line"><a name="l01521"></a><span class="lineno"> 1521</span>  }</div><div class="line"><a name="l01522"></a><span class="lineno"> 1522</span> }</div><div class="line"><a name="l01523"></a><span class="lineno"> 1523</span> </div><div class="line"><a name="l01524"></a><span class="lineno"> 1524</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01525"></a><span class="lineno"> 1525</span> {</div><div class="line"><a name="l01526"></a><span class="lineno"> 1526</span>  <span class="keyword">struct </span>fuse_setxattr_in *arg = (<span class="keyword">struct </span>fuse_setxattr_in *) inarg;</div><div class="line"><a name="l01527"></a><span class="lineno"> 1527</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01528"></a><span class="lineno"> 1528</span>  <span class="keywordtype">char</span> *value = name + strlen(name) + 1;</div><div class="line"><a name="l01529"></a><span class="lineno"> 1529</span> </div><div class="line"><a name="l01530"></a><span class="lineno"> 1530</span>  <span class="keywordflow">if</span> (req->se->op.setxattr)</div><div class="line"><a name="l01531"></a><span class="lineno"> 1531</span>  req->se->op.setxattr(req, nodeid, name, value, arg->size,</div><div class="line"><a name="l01532"></a><span class="lineno"> 1532</span>  arg->flags);</div><div class="line"><a name="l01533"></a><span class="lineno"> 1533</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01534"></a><span class="lineno"> 1534</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01535"></a><span class="lineno"> 1535</span> }</div><div class="line"><a name="l01536"></a><span class="lineno"> 1536</span> </div><div class="line"><a name="l01537"></a><span class="lineno"> 1537</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01538"></a><span class="lineno"> 1538</span> {</div><div class="line"><a name="l01539"></a><span class="lineno"> 1539</span>  <span class="keyword">struct </span>fuse_getxattr_in *arg = (<span class="keyword">struct </span>fuse_getxattr_in *) inarg;</div><div class="line"><a name="l01540"></a><span class="lineno"> 1540</span> </div><div class="line"><a name="l01541"></a><span class="lineno"> 1541</span>  <span class="keywordflow">if</span> (req->se->op.getxattr)</div><div class="line"><a name="l01542"></a><span class="lineno"> 1542</span>  req->se->op.getxattr(req, nodeid, PARAM(arg), arg->size);</div><div class="line"><a name="l01543"></a><span class="lineno"> 1543</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01544"></a><span class="lineno"> 1544</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01545"></a><span class="lineno"> 1545</span> }</div><div class="line"><a name="l01546"></a><span class="lineno"> 1546</span> </div><div class="line"><a name="l01547"></a><span class="lineno"> 1547</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_listxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01548"></a><span class="lineno"> 1548</span> {</div><div class="line"><a name="l01549"></a><span class="lineno"> 1549</span>  <span class="keyword">struct </span>fuse_getxattr_in *arg = (<span class="keyword">struct </span>fuse_getxattr_in *) inarg;</div><div class="line"><a name="l01550"></a><span class="lineno"> 1550</span> </div><div class="line"><a name="l01551"></a><span class="lineno"> 1551</span>  <span class="keywordflow">if</span> (req->se->op.listxattr)</div><div class="line"><a name="l01552"></a><span class="lineno"> 1552</span>  req->se->op.listxattr(req, nodeid, arg->size);</div><div class="line"><a name="l01553"></a><span class="lineno"> 1553</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01554"></a><span class="lineno"> 1554</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01555"></a><span class="lineno"> 1555</span> }</div><div class="line"><a name="l01556"></a><span class="lineno"> 1556</span> </div><div class="line"><a name="l01557"></a><span class="lineno"> 1557</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_removexattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01558"></a><span class="lineno"> 1558</span> {</div><div class="line"><a name="l01559"></a><span class="lineno"> 1559</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01560"></a><span class="lineno"> 1560</span> </div><div class="line"><a name="l01561"></a><span class="lineno"> 1561</span>  <span class="keywordflow">if</span> (req->se->op.removexattr)</div><div class="line"><a name="l01562"></a><span class="lineno"> 1562</span>  req->se->op.removexattr(req, nodeid, name);</div><div class="line"><a name="l01563"></a><span class="lineno"> 1563</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01564"></a><span class="lineno"> 1564</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01565"></a><span class="lineno"> 1565</span> }</div><div class="line"><a name="l01566"></a><span class="lineno"> 1566</span> </div><div class="line"><a name="l01567"></a><span class="lineno"> 1567</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_fuse_file_lock(<span class="keyword">struct</span> fuse_file_lock *fl,</div><div class="line"><a name="l01568"></a><span class="lineno"> 1568</span>  <span class="keyword">struct</span> flock *flock)</div><div class="line"><a name="l01569"></a><span class="lineno"> 1569</span> {</div><div class="line"><a name="l01570"></a><span class="lineno"> 1570</span>  memset(flock, 0, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> flock));</div><div class="line"><a name="l01571"></a><span class="lineno"> 1571</span>  flock->l_type = fl->type;</div><div class="line"><a name="l01572"></a><span class="lineno"> 1572</span>  flock->l_whence = SEEK_SET;</div><div class="line"><a name="l01573"></a><span class="lineno"> 1573</span>  flock->l_start = fl->start;</div><div class="line"><a name="l01574"></a><span class="lineno"> 1574</span>  <span class="keywordflow">if</span> (fl->end == OFFSET_MAX)</div><div class="line"><a name="l01575"></a><span class="lineno"> 1575</span>  flock->l_len = 0;</div><div class="line"><a name="l01576"></a><span class="lineno"> 1576</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01577"></a><span class="lineno"> 1577</span>  flock->l_len = fl->end - fl->start + 1;</div><div class="line"><a name="l01578"></a><span class="lineno"> 1578</span>  flock->l_pid = fl->pid;</div><div class="line"><a name="l01579"></a><span class="lineno"> 1579</span> }</div><div class="line"><a name="l01580"></a><span class="lineno"> 1580</span> </div><div class="line"><a name="l01581"></a><span class="lineno"> 1581</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getlk(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01582"></a><span class="lineno"> 1582</span> {</div><div class="line"><a name="l01583"></a><span class="lineno"> 1583</span>  <span class="keyword">struct </span>fuse_lk_in *arg = (<span class="keyword">struct </span>fuse_lk_in *) inarg;</div><div class="line"><a name="l01584"></a><span class="lineno"> 1584</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01585"></a><span class="lineno"> 1585</span>  <span class="keyword">struct </span>flock flock;</div><div class="line"><a name="l01586"></a><span class="lineno"> 1586</span> </div><div class="line"><a name="l01587"></a><span class="lineno"> 1587</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01588"></a><span class="lineno"> 1588</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01589"></a><span class="lineno"> 1589</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->owner;</div><div class="line"><a name="l01590"></a><span class="lineno"> 1590</span> </div><div class="line"><a name="l01591"></a><span class="lineno"> 1591</span>  convert_fuse_file_lock(&arg->lk, &flock);</div><div class="line"><a name="l01592"></a><span class="lineno"> 1592</span>  <span class="keywordflow">if</span> (req->se->op.getlk)</div><div class="line"><a name="l01593"></a><span class="lineno"> 1593</span>  req->se->op.getlk(req, nodeid, &fi, &flock);</div><div class="line"><a name="l01594"></a><span class="lineno"> 1594</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01595"></a><span class="lineno"> 1595</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01596"></a><span class="lineno"> 1596</span> }</div><div class="line"><a name="l01597"></a><span class="lineno"> 1597</span> </div><div class="line"><a name="l01598"></a><span class="lineno"> 1598</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlk_common(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l01599"></a><span class="lineno"> 1599</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg, <span class="keywordtype">int</span> sleep)</div><div class="line"><a name="l01600"></a><span class="lineno"> 1600</span> {</div><div class="line"><a name="l01601"></a><span class="lineno"> 1601</span>  <span class="keyword">struct </span>fuse_lk_in *arg = (<span class="keyword">struct </span>fuse_lk_in *) inarg;</div><div class="line"><a name="l01602"></a><span class="lineno"> 1602</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01603"></a><span class="lineno"> 1603</span>  <span class="keyword">struct </span>flock flock;</div><div class="line"><a name="l01604"></a><span class="lineno"> 1604</span> </div><div class="line"><a name="l01605"></a><span class="lineno"> 1605</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01606"></a><span class="lineno"> 1606</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01607"></a><span class="lineno"> 1607</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->owner;</div><div class="line"><a name="l01608"></a><span class="lineno"> 1608</span> </div><div class="line"><a name="l01609"></a><span class="lineno"> 1609</span>  <span class="keywordflow">if</span> (arg->lk_flags & FUSE_LK_FLOCK) {</div><div class="line"><a name="l01610"></a><span class="lineno"> 1610</span>  <span class="keywordtype">int</span> op = 0;</div><div class="line"><a name="l01611"></a><span class="lineno"> 1611</span> </div><div class="line"><a name="l01612"></a><span class="lineno"> 1612</span>  <span class="keywordflow">switch</span> (arg->lk.type) {</div><div class="line"><a name="l01613"></a><span class="lineno"> 1613</span>  <span class="keywordflow">case</span> F_RDLCK:</div><div class="line"><a name="l01614"></a><span class="lineno"> 1614</span>  op = LOCK_SH;</div><div class="line"><a name="l01615"></a><span class="lineno"> 1615</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01616"></a><span class="lineno"> 1616</span>  <span class="keywordflow">case</span> F_WRLCK:</div><div class="line"><a name="l01617"></a><span class="lineno"> 1617</span>  op = LOCK_EX;</div><div class="line"><a name="l01618"></a><span class="lineno"> 1618</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01619"></a><span class="lineno"> 1619</span>  <span class="keywordflow">case</span> F_UNLCK:</div><div class="line"><a name="l01620"></a><span class="lineno"> 1620</span>  op = LOCK_UN;</div><div class="line"><a name="l01621"></a><span class="lineno"> 1621</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01622"></a><span class="lineno"> 1622</span>  }</div><div class="line"><a name="l01623"></a><span class="lineno"> 1623</span>  <span class="keywordflow">if</span> (!sleep)</div><div class="line"><a name="l01624"></a><span class="lineno"> 1624</span>  op |= LOCK_NB;</div><div class="line"><a name="l01625"></a><span class="lineno"> 1625</span> </div><div class="line"><a name="l01626"></a><span class="lineno"> 1626</span>  <span class="keywordflow">if</span> (req->se->op.flock)</div><div class="line"><a name="l01627"></a><span class="lineno"> 1627</span>  req->se->op.flock(req, nodeid, &fi, op);</div><div class="line"><a name="l01628"></a><span class="lineno"> 1628</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01629"></a><span class="lineno"> 1629</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01630"></a><span class="lineno"> 1630</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01631"></a><span class="lineno"> 1631</span>  convert_fuse_file_lock(&arg->lk, &flock);</div><div class="line"><a name="l01632"></a><span class="lineno"> 1632</span>  <span class="keywordflow">if</span> (req->se->op.setlk)</div><div class="line"><a name="l01633"></a><span class="lineno"> 1633</span>  req->se->op.setlk(req, nodeid, &fi, &flock, sleep);</div><div class="line"><a name="l01634"></a><span class="lineno"> 1634</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01635"></a><span class="lineno"> 1635</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01636"></a><span class="lineno"> 1636</span>  }</div><div class="line"><a name="l01637"></a><span class="lineno"> 1637</span> }</div><div class="line"><a name="l01638"></a><span class="lineno"> 1638</span> </div><div class="line"><a name="l01639"></a><span class="lineno"> 1639</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlk(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01640"></a><span class="lineno"> 1640</span> {</div><div class="line"><a name="l01641"></a><span class="lineno"> 1641</span>  do_setlk_common(req, nodeid, inarg, 0);</div><div class="line"><a name="l01642"></a><span class="lineno"> 1642</span> }</div><div class="line"><a name="l01643"></a><span class="lineno"> 1643</span> </div><div class="line"><a name="l01644"></a><span class="lineno"> 1644</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlkw(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01645"></a><span class="lineno"> 1645</span> {</div><div class="line"><a name="l01646"></a><span class="lineno"> 1646</span>  do_setlk_common(req, nodeid, inarg, 1);</div><div class="line"><a name="l01647"></a><span class="lineno"> 1647</span> }</div><div class="line"><a name="l01648"></a><span class="lineno"> 1648</span> </div><div class="line"><a name="l01649"></a><span class="lineno"> 1649</span> <span class="keyword">static</span> <span class="keywordtype">int</span> find_interrupted(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l01650"></a><span class="lineno"> 1650</span> {</div><div class="line"><a name="l01651"></a><span class="lineno"> 1651</span>  <span class="keyword">struct </span>fuse_req *curr;</div><div class="line"><a name="l01652"></a><span class="lineno"> 1652</span> </div><div class="line"><a name="l01653"></a><span class="lineno"> 1653</span>  <span class="keywordflow">for</span> (curr = se->list.next; curr != &se->list; curr = curr->next) {</div><div class="line"><a name="l01654"></a><span class="lineno"> 1654</span>  <span class="keywordflow">if</span> (curr->unique == req->u.i.unique) {</div><div class="line"><a name="l01655"></a><span class="lineno"> 1655</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1fe719ed24a713bb5d17e4e7a0dde730">fuse_interrupt_func_t</a> func;</div><div class="line"><a name="l01656"></a><span class="lineno"> 1656</span>  <span class="keywordtype">void</span> *data;</div><div class="line"><a name="l01657"></a><span class="lineno"> 1657</span> </div><div class="line"><a name="l01658"></a><span class="lineno"> 1658</span>  curr->ctr++;</div><div class="line"><a name="l01659"></a><span class="lineno"> 1659</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01660"></a><span class="lineno"> 1660</span> </div><div class="line"><a name="l01661"></a><span class="lineno"> 1661</span>  <span class="comment">/* Ugh, ugly locking */</span></div><div class="line"><a name="l01662"></a><span class="lineno"> 1662</span>  pthread_mutex_lock(&curr->lock);</div><div class="line"><a name="l01663"></a><span class="lineno"> 1663</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01664"></a><span class="lineno"> 1664</span>  curr->interrupted = 1;</div><div class="line"><a name="l01665"></a><span class="lineno"> 1665</span>  func = curr->u.ni.func;</div><div class="line"><a name="l01666"></a><span class="lineno"> 1666</span>  data = curr->u.ni.data;</div><div class="line"><a name="l01667"></a><span class="lineno"> 1667</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01668"></a><span class="lineno"> 1668</span>  <span class="keywordflow">if</span> (func)</div><div class="line"><a name="l01669"></a><span class="lineno"> 1669</span>  func(curr, data);</div><div class="line"><a name="l01670"></a><span class="lineno"> 1670</span>  pthread_mutex_unlock(&curr->lock);</div><div class="line"><a name="l01671"></a><span class="lineno"> 1671</span> </div><div class="line"><a name="l01672"></a><span class="lineno"> 1672</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01673"></a><span class="lineno"> 1673</span>  curr->ctr--;</div><div class="line"><a name="l01674"></a><span class="lineno"> 1674</span>  <span class="keywordflow">if</span> (!curr->ctr)</div><div class="line"><a name="l01675"></a><span class="lineno"> 1675</span>  destroy_req(curr);</div><div class="line"><a name="l01676"></a><span class="lineno"> 1676</span> </div><div class="line"><a name="l01677"></a><span class="lineno"> 1677</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l01678"></a><span class="lineno"> 1678</span>  }</div><div class="line"><a name="l01679"></a><span class="lineno"> 1679</span>  }</div><div class="line"><a name="l01680"></a><span class="lineno"> 1680</span>  <span class="keywordflow">for</span> (curr = se->interrupts.next; curr != &se->interrupts;</div><div class="line"><a name="l01681"></a><span class="lineno"> 1681</span>  curr = curr->next) {</div><div class="line"><a name="l01682"></a><span class="lineno"> 1682</span>  <span class="keywordflow">if</span> (curr->u.i.unique == req->u.i.unique)</div><div class="line"><a name="l01683"></a><span class="lineno"> 1683</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l01684"></a><span class="lineno"> 1684</span>  }</div><div class="line"><a name="l01685"></a><span class="lineno"> 1685</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l01686"></a><span class="lineno"> 1686</span> }</div><div class="line"><a name="l01687"></a><span class="lineno"> 1687</span> </div><div class="line"><a name="l01688"></a><span class="lineno"> 1688</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_interrupt(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01689"></a><span class="lineno"> 1689</span> {</div><div class="line"><a name="l01690"></a><span class="lineno"> 1690</span>  <span class="keyword">struct </span>fuse_interrupt_in *arg = (<span class="keyword">struct </span>fuse_interrupt_in *) inarg;</div><div class="line"><a name="l01691"></a><span class="lineno"> 1691</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01692"></a><span class="lineno"> 1692</span> </div><div class="line"><a name="l01693"></a><span class="lineno"> 1693</span>  (void) nodeid;</div><div class="line"><a name="l01694"></a><span class="lineno"> 1694</span>  <span class="keywordflow">if</span> (se->debug)</div><div class="line"><a name="l01695"></a><span class="lineno"> 1695</span>  fprintf(stderr, <span class="stringliteral">"INTERRUPT: %llu\n"</span>,</div><div class="line"><a name="l01696"></a><span class="lineno"> 1696</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) arg->unique);</div><div class="line"><a name="l01697"></a><span class="lineno"> 1697</span> </div><div class="line"><a name="l01698"></a><span class="lineno"> 1698</span>  req->u.i.unique = arg->unique;</div><div class="line"><a name="l01699"></a><span class="lineno"> 1699</span> </div><div class="line"><a name="l01700"></a><span class="lineno"> 1700</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01701"></a><span class="lineno"> 1701</span>  <span class="keywordflow">if</span> (find_interrupted(se, req))</div><div class="line"><a name="l01702"></a><span class="lineno"> 1702</span>  destroy_req(req);</div><div class="line"><a name="l01703"></a><span class="lineno"> 1703</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01704"></a><span class="lineno"> 1704</span>  list_add_req(req, &se->interrupts);</div><div class="line"><a name="l01705"></a><span class="lineno"> 1705</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01706"></a><span class="lineno"> 1706</span> }</div><div class="line"><a name="l01707"></a><span class="lineno"> 1707</span> </div><div class="line"><a name="l01708"></a><span class="lineno"> 1708</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_req *check_interrupt(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l01709"></a><span class="lineno"> 1709</span>  <span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l01710"></a><span class="lineno"> 1710</span> {</div><div class="line"><a name="l01711"></a><span class="lineno"> 1711</span>  <span class="keyword">struct </span>fuse_req *curr;</div><div class="line"><a name="l01712"></a><span class="lineno"> 1712</span> </div><div class="line"><a name="l01713"></a><span class="lineno"> 1713</span>  <span class="keywordflow">for</span> (curr = se->interrupts.next; curr != &se->interrupts;</div><div class="line"><a name="l01714"></a><span class="lineno"> 1714</span>  curr = curr->next) {</div><div class="line"><a name="l01715"></a><span class="lineno"> 1715</span>  <span class="keywordflow">if</span> (curr->u.i.unique == req->unique) {</div><div class="line"><a name="l01716"></a><span class="lineno"> 1716</span>  req->interrupted = 1;</div><div class="line"><a name="l01717"></a><span class="lineno"> 1717</span>  list_del_req(curr);</div><div class="line"><a name="l01718"></a><span class="lineno"> 1718</span>  free(curr);</div><div class="line"><a name="l01719"></a><span class="lineno"> 1719</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l01720"></a><span class="lineno"> 1720</span>  }</div><div class="line"><a name="l01721"></a><span class="lineno"> 1721</span>  }</div><div class="line"><a name="l01722"></a><span class="lineno"> 1722</span>  curr = se->interrupts.next;</div><div class="line"><a name="l01723"></a><span class="lineno"> 1723</span>  <span class="keywordflow">if</span> (curr != &se->interrupts) {</div><div class="line"><a name="l01724"></a><span class="lineno"> 1724</span>  list_del_req(curr);</div><div class="line"><a name="l01725"></a><span class="lineno"> 1725</span>  list_init_req(curr);</div><div class="line"><a name="l01726"></a><span class="lineno"> 1726</span>  <span class="keywordflow">return</span> curr;</div><div class="line"><a name="l01727"></a><span class="lineno"> 1727</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01728"></a><span class="lineno"> 1728</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l01729"></a><span class="lineno"> 1729</span> }</div><div class="line"><a name="l01730"></a><span class="lineno"> 1730</span> </div><div class="line"><a name="l01731"></a><span class="lineno"> 1731</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_bmap(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01732"></a><span class="lineno"> 1732</span> {</div><div class="line"><a name="l01733"></a><span class="lineno"> 1733</span>  <span class="keyword">struct </span>fuse_bmap_in *arg = (<span class="keyword">struct </span>fuse_bmap_in *) inarg;</div><div class="line"><a name="l01734"></a><span class="lineno"> 1734</span> </div><div class="line"><a name="l01735"></a><span class="lineno"> 1735</span>  <span class="keywordflow">if</span> (req->se->op.bmap)</div><div class="line"><a name="l01736"></a><span class="lineno"> 1736</span>  req->se->op.bmap(req, nodeid, arg->blocksize, arg->block);</div><div class="line"><a name="l01737"></a><span class="lineno"> 1737</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01738"></a><span class="lineno"> 1738</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01739"></a><span class="lineno"> 1739</span> }</div><div class="line"><a name="l01740"></a><span class="lineno"> 1740</span> </div><div class="line"><a name="l01741"></a><span class="lineno"> 1741</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_ioctl(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01742"></a><span class="lineno"> 1742</span> {</div><div class="line"><a name="l01743"></a><span class="lineno"> 1743</span>  <span class="keyword">struct </span>fuse_ioctl_in *arg = (<span class="keyword">struct </span>fuse_ioctl_in *) inarg;</div><div class="line"><a name="l01744"></a><span class="lineno"> 1744</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags = arg->flags;</div><div class="line"><a name="l01745"></a><span class="lineno"> 1745</span>  <span class="keywordtype">void</span> *in_buf = arg->in_size ? PARAM(arg) : NULL;</div><div class="line"><a name="l01746"></a><span class="lineno"> 1746</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01747"></a><span class="lineno"> 1747</span> </div><div class="line"><a name="l01748"></a><span class="lineno"> 1748</span>  <span class="keywordflow">if</span> (flags & FUSE_IOCTL_DIR &&</div><div class="line"><a name="l01749"></a><span class="lineno"> 1749</span>  !(req->se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>)) {</div><div class="line"><a name="l01750"></a><span class="lineno"> 1750</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOTTY);</div><div class="line"><a name="l01751"></a><span class="lineno"> 1751</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01752"></a><span class="lineno"> 1752</span>  }</div><div class="line"><a name="l01753"></a><span class="lineno"> 1753</span> </div><div class="line"><a name="l01754"></a><span class="lineno"> 1754</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01755"></a><span class="lineno"> 1755</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01756"></a><span class="lineno"> 1756</span> </div><div class="line"><a name="l01757"></a><span class="lineno"> 1757</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span> *) == 4 && req->se->conn.proto_minor >= 16 &&</div><div class="line"><a name="l01758"></a><span class="lineno"> 1758</span>  !(flags & FUSE_IOCTL_32BIT)) {</div><div class="line"><a name="l01759"></a><span class="lineno"> 1759</span>  req->ioctl_64bit = 1;</div><div class="line"><a name="l01760"></a><span class="lineno"> 1760</span>  }</div><div class="line"><a name="l01761"></a><span class="lineno"> 1761</span> </div><div class="line"><a name="l01762"></a><span class="lineno"> 1762</span>  <span class="keywordflow">if</span> (req->se->op.ioctl)</div><div class="line"><a name="l01763"></a><span class="lineno"> 1763</span>  req->se->op.ioctl(req, nodeid, arg->cmd,</div><div class="line"><a name="l01764"></a><span class="lineno"> 1764</span>  (<span class="keywordtype">void</span> *)(uintptr_t)arg->arg, &fi, flags,</div><div class="line"><a name="l01765"></a><span class="lineno"> 1765</span>  in_buf, arg->in_size, arg->out_size);</div><div class="line"><a name="l01766"></a><span class="lineno"> 1766</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01767"></a><span class="lineno"> 1767</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01768"></a><span class="lineno"> 1768</span> }</div><div class="line"><a name="l01769"></a><span class="lineno"> 1769</span> </div><div class="line"><a name="l01770"></a><span class="lineno"> 1770</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#adf5027f8a38b2efc03858efd7fdc756a">fuse_pollhandle_destroy</a>(<span class="keyword">struct</span> fuse_pollhandle *ph)</div><div class="line"><a name="l01771"></a><span class="lineno"> 1771</span> {</div><div class="line"><a name="l01772"></a><span class="lineno"> 1772</span>  free(ph);</div><div class="line"><a name="l01773"></a><span class="lineno"> 1773</span> }</div><div class="line"><a name="l01774"></a><span class="lineno"> 1774</span> </div><div class="line"><a name="l01775"></a><span class="lineno"> 1775</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_poll(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01776"></a><span class="lineno"> 1776</span> {</div><div class="line"><a name="l01777"></a><span class="lineno"> 1777</span>  <span class="keyword">struct </span>fuse_poll_in *arg = (<span class="keyword">struct </span>fuse_poll_in *) inarg;</div><div class="line"><a name="l01778"></a><span class="lineno"> 1778</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01779"></a><span class="lineno"> 1779</span> </div><div class="line"><a name="l01780"></a><span class="lineno"> 1780</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01781"></a><span class="lineno"> 1781</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01782"></a><span class="lineno"> 1782</span>  fi.<a class="code" href="structfuse__file__info.html#a51b0d5928ec6112456d2aa50f2c35001">poll_events</a> = arg->events;</div><div class="line"><a name="l01783"></a><span class="lineno"> 1783</span> </div><div class="line"><a name="l01784"></a><span class="lineno"> 1784</span>  <span class="keywordflow">if</span> (req->se->op.poll) {</div><div class="line"><a name="l01785"></a><span class="lineno"> 1785</span>  <span class="keyword">struct </span>fuse_pollhandle *ph = NULL;</div><div class="line"><a name="l01786"></a><span class="lineno"> 1786</span> </div><div class="line"><a name="l01787"></a><span class="lineno"> 1787</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POLL_SCHEDULE_NOTIFY) {</div><div class="line"><a name="l01788"></a><span class="lineno"> 1788</span>  ph = malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_pollhandle));</div><div class="line"><a name="l01789"></a><span class="lineno"> 1789</span>  <span class="keywordflow">if</span> (ph == NULL) {</div><div class="line"><a name="l01790"></a><span class="lineno"> 1790</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l01791"></a><span class="lineno"> 1791</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01792"></a><span class="lineno"> 1792</span>  }</div><div class="line"><a name="l01793"></a><span class="lineno"> 1793</span>  ph->kh = arg->kh;</div><div class="line"><a name="l01794"></a><span class="lineno"> 1794</span>  ph->se = req->se;</div><div class="line"><a name="l01795"></a><span class="lineno"> 1795</span>  }</div><div class="line"><a name="l01796"></a><span class="lineno"> 1796</span> </div><div class="line"><a name="l01797"></a><span class="lineno"> 1797</span>  req->se->op.poll(req, nodeid, &fi, ph);</div><div class="line"><a name="l01798"></a><span class="lineno"> 1798</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01799"></a><span class="lineno"> 1799</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01800"></a><span class="lineno"> 1800</span>  }</div><div class="line"><a name="l01801"></a><span class="lineno"> 1801</span> }</div><div class="line"><a name="l01802"></a><span class="lineno"> 1802</span> </div><div class="line"><a name="l01803"></a><span class="lineno"> 1803</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fallocate(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01804"></a><span class="lineno"> 1804</span> {</div><div class="line"><a name="l01805"></a><span class="lineno"> 1805</span>  <span class="keyword">struct </span>fuse_fallocate_in *arg = (<span class="keyword">struct </span>fuse_fallocate_in *) inarg;</div><div class="line"><a name="l01806"></a><span class="lineno"> 1806</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01807"></a><span class="lineno"> 1807</span> </div><div class="line"><a name="l01808"></a><span class="lineno"> 1808</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01809"></a><span class="lineno"> 1809</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01810"></a><span class="lineno"> 1810</span> </div><div class="line"><a name="l01811"></a><span class="lineno"> 1811</span>  <span class="keywordflow">if</span> (req->se->op.fallocate)</div><div class="line"><a name="l01812"></a><span class="lineno"> 1812</span>  req->se->op.fallocate(req, nodeid, arg->mode, arg->offset, arg->length, &fi);</div><div class="line"><a name="l01813"></a><span class="lineno"> 1813</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01814"></a><span class="lineno"> 1814</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01815"></a><span class="lineno"> 1815</span> }</div><div class="line"><a name="l01816"></a><span class="lineno"> 1816</span> </div><div class="line"><a name="l01817"></a><span class="lineno"> 1817</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_copy_file_range(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid_in, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01818"></a><span class="lineno"> 1818</span> {</div><div class="line"><a name="l01819"></a><span class="lineno"> 1819</span>  <span class="keyword">struct </span>fuse_copy_file_range_in *arg = (<span class="keyword">struct </span>fuse_copy_file_range_in *) inarg;</div><div class="line"><a name="l01820"></a><span class="lineno"> 1820</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi_in, fi_out;</div><div class="line"><a name="l01821"></a><span class="lineno"> 1821</span> </div><div class="line"><a name="l01822"></a><span class="lineno"> 1822</span>  memset(&fi_in, 0, <span class="keyword">sizeof</span>(fi_in));</div><div class="line"><a name="l01823"></a><span class="lineno"> 1823</span>  fi_in.fh = arg->fh_in;</div><div class="line"><a name="l01824"></a><span class="lineno"> 1824</span> </div><div class="line"><a name="l01825"></a><span class="lineno"> 1825</span>  memset(&fi_out, 0, <span class="keyword">sizeof</span>(fi_out));</div><div class="line"><a name="l01826"></a><span class="lineno"> 1826</span>  fi_out.fh = arg->fh_out;</div><div class="line"><a name="l01827"></a><span class="lineno"> 1827</span> </div><div class="line"><a name="l01828"></a><span class="lineno"> 1828</span> </div><div class="line"><a name="l01829"></a><span class="lineno"> 1829</span>  <span class="keywordflow">if</span> (req->se->op.copy_file_range)</div><div class="line"><a name="l01830"></a><span class="lineno"> 1830</span>  req->se->op.copy_file_range(req, nodeid_in, arg->off_in,</div><div class="line"><a name="l01831"></a><span class="lineno"> 1831</span>  &fi_in, arg->nodeid_out,</div><div class="line"><a name="l01832"></a><span class="lineno"> 1832</span>  arg->off_out, &fi_out, arg->len,</div><div class="line"><a name="l01833"></a><span class="lineno"> 1833</span>  arg->flags);</div><div class="line"><a name="l01834"></a><span class="lineno"> 1834</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01835"></a><span class="lineno"> 1835</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01836"></a><span class="lineno"> 1836</span> }</div><div class="line"><a name="l01837"></a><span class="lineno"> 1837</span> </div><div class="line"><a name="l01838"></a><span class="lineno"> 1838</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_init(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01839"></a><span class="lineno"> 1839</span> {</div><div class="line"><a name="l01840"></a><span class="lineno"> 1840</span>  <span class="keyword">struct </span>fuse_init_in *arg = (<span class="keyword">struct </span>fuse_init_in *) inarg;</div><div class="line"><a name="l01841"></a><span class="lineno"> 1841</span>  <span class="keyword">struct </span>fuse_init_out outarg;</div><div class="line"><a name="l01842"></a><span class="lineno"> 1842</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01843"></a><span class="lineno"> 1843</span>  <span class="keywordtype">size_t</span> bufsize = se->bufsize;</div><div class="line"><a name="l01844"></a><span class="lineno"> 1844</span>  <span class="keywordtype">size_t</span> outargsize = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l01845"></a><span class="lineno"> 1845</span> </div><div class="line"><a name="l01846"></a><span class="lineno"> 1846</span>  (void) nodeid;</div><div class="line"><a name="l01847"></a><span class="lineno"> 1847</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l01848"></a><span class="lineno"> 1848</span>  fprintf(stderr, <span class="stringliteral">"INIT: %u.%u\n"</span>, arg->major, arg->minor);</div><div class="line"><a name="l01849"></a><span class="lineno"> 1849</span>  <span class="keywordflow">if</span> (arg->major == 7 && arg->minor >= 6) {</div><div class="line"><a name="l01850"></a><span class="lineno"> 1850</span>  fprintf(stderr, <span class="stringliteral">"flags=0x%08x\n"</span>, arg->flags);</div><div class="line"><a name="l01851"></a><span class="lineno"> 1851</span>  fprintf(stderr, <span class="stringliteral">"max_readahead=0x%08x\n"</span>,</div><div class="line"><a name="l01852"></a><span class="lineno"> 1852</span>  arg->max_readahead);</div><div class="line"><a name="l01853"></a><span class="lineno"> 1853</span>  }</div><div class="line"><a name="l01854"></a><span class="lineno"> 1854</span>  }</div><div class="line"><a name="l01855"></a><span class="lineno"> 1855</span>  se->conn.proto_major = arg->major;</div><div class="line"><a name="l01856"></a><span class="lineno"> 1856</span>  se->conn.proto_minor = arg->minor;</div><div class="line"><a name="l01857"></a><span class="lineno"> 1857</span>  se->conn.capable = 0;</div><div class="line"><a name="l01858"></a><span class="lineno"> 1858</span>  se->conn.want = 0;</div><div class="line"><a name="l01859"></a><span class="lineno"> 1859</span> </div><div class="line"><a name="l01860"></a><span class="lineno"> 1860</span>  memset(&outarg, 0, <span class="keyword">sizeof</span>(outarg));</div><div class="line"><a name="l01861"></a><span class="lineno"> 1861</span>  outarg.major = FUSE_KERNEL_VERSION;</div><div class="line"><a name="l01862"></a><span class="lineno"> 1862</span>  outarg.minor = FUSE_KERNEL_MINOR_VERSION;</div><div class="line"><a name="l01863"></a><span class="lineno"> 1863</span> </div><div class="line"><a name="l01864"></a><span class="lineno"> 1864</span>  <span class="keywordflow">if</span> (arg->major < 7) {</div><div class="line"><a name="l01865"></a><span class="lineno"> 1865</span>  fprintf(stderr, <span class="stringliteral">"fuse: unsupported protocol version: %u.%u\n"</span>,</div><div class="line"><a name="l01866"></a><span class="lineno"> 1866</span>  arg->major, arg->minor);</div><div class="line"><a name="l01867"></a><span class="lineno"> 1867</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01868"></a><span class="lineno"> 1868</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01869"></a><span class="lineno"> 1869</span>  }</div><div class="line"><a name="l01870"></a><span class="lineno"> 1870</span> </div><div class="line"><a name="l01871"></a><span class="lineno"> 1871</span>  <span class="keywordflow">if</span> (arg->major > 7) {</div><div class="line"><a name="l01872"></a><span class="lineno"> 1872</span>  <span class="comment">/* Wait for a second INIT request with a 7.X version */</span></div><div class="line"><a name="l01873"></a><span class="lineno"> 1873</span>  send_reply_ok(req, &outarg, <span class="keyword">sizeof</span>(outarg));</div><div class="line"><a name="l01874"></a><span class="lineno"> 1874</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01875"></a><span class="lineno"> 1875</span>  }</div><div class="line"><a name="l01876"></a><span class="lineno"> 1876</span> </div><div class="line"><a name="l01877"></a><span class="lineno"> 1877</span>  <span class="keywordflow">if</span> (arg->minor >= 6) {</div><div class="line"><a name="l01878"></a><span class="lineno"> 1878</span>  <span class="keywordflow">if</span> (arg->max_readahead < se->conn.max_readahead)</div><div class="line"><a name="l01879"></a><span class="lineno"> 1879</span>  se->conn.max_readahead = arg->max_readahead;</div><div class="line"><a name="l01880"></a><span class="lineno"> 1880</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ASYNC_READ)</div><div class="line"><a name="l01881"></a><span class="lineno"> 1881</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>;</div><div class="line"><a name="l01882"></a><span class="lineno"> 1882</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POSIX_LOCKS)</div><div class="line"><a name="l01883"></a><span class="lineno"> 1883</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>;</div><div class="line"><a name="l01884"></a><span class="lineno"> 1884</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ATOMIC_O_TRUNC)</div><div class="line"><a name="l01885"></a><span class="lineno"> 1885</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>;</div><div class="line"><a name="l01886"></a><span class="lineno"> 1886</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_EXPORT_SUPPORT)</div><div class="line"><a name="l01887"></a><span class="lineno"> 1887</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a7686c11aaf80382189927b10b848d8c8">FUSE_CAP_EXPORT_SUPPORT</a>;</div><div class="line"><a name="l01888"></a><span class="lineno"> 1888</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_DONT_MASK)</div><div class="line"><a name="l01889"></a><span class="lineno"> 1889</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0cd4cebf7ec784886836aa061a1612fe">FUSE_CAP_DONT_MASK</a>;</div><div class="line"><a name="l01890"></a><span class="lineno"> 1890</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_FLOCK_LOCKS)</div><div class="line"><a name="l01891"></a><span class="lineno"> 1891</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>;</div><div class="line"><a name="l01892"></a><span class="lineno"> 1892</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_AUTO_INVAL_DATA)</div><div class="line"><a name="l01893"></a><span class="lineno"> 1893</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>;</div><div class="line"><a name="l01894"></a><span class="lineno"> 1894</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_DO_READDIRPLUS)</div><div class="line"><a name="l01895"></a><span class="lineno"> 1895</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>;</div><div class="line"><a name="l01896"></a><span class="lineno"> 1896</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_READDIRPLUS_AUTO)</div><div class="line"><a name="l01897"></a><span class="lineno"> 1897</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>;</div><div class="line"><a name="l01898"></a><span class="lineno"> 1898</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ASYNC_DIO)</div><div class="line"><a name="l01899"></a><span class="lineno"> 1899</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>;</div><div class="line"><a name="l01900"></a><span class="lineno"> 1900</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_WRITEBACK_CACHE)</div><div class="line"><a name="l01901"></a><span class="lineno"> 1901</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4839fce31097f4b4da7a1f01169228fa">FUSE_CAP_WRITEBACK_CACHE</a>;</div><div class="line"><a name="l01902"></a><span class="lineno"> 1902</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_NO_OPEN_SUPPORT)</div><div class="line"><a name="l01903"></a><span class="lineno"> 1903</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad4477fe76f57e8b726d0357a637d7aaf">FUSE_CAP_NO_OPEN_SUPPORT</a>;</div><div class="line"><a name="l01904"></a><span class="lineno"> 1904</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_PARALLEL_DIROPS)</div><div class="line"><a name="l01905"></a><span class="lineno"> 1905</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a3311a7f569e9fbf55b3f0bcaadbe4ad0">FUSE_CAP_PARALLEL_DIROPS</a>;</div><div class="line"><a name="l01906"></a><span class="lineno"> 1906</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POSIX_ACL)</div><div class="line"><a name="l01907"></a><span class="lineno"> 1907</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5b3ef5b12be33295311d6b751846c263">FUSE_CAP_POSIX_ACL</a>;</div><div class="line"><a name="l01908"></a><span class="lineno"> 1908</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_HANDLE_KILLPRIV)</div><div class="line"><a name="l01909"></a><span class="lineno"> 1909</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a24a4a980dff3f7a4ba771a92bb59a4bd">FUSE_CAP_HANDLE_KILLPRIV</a>;</div><div class="line"><a name="l01910"></a><span class="lineno"> 1910</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_NO_OPENDIR_SUPPORT)</div><div class="line"><a name="l01911"></a><span class="lineno"> 1911</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aa573f7b730ea608463d8399659c38ca6">FUSE_CAP_NO_OPENDIR_SUPPORT</a>;</div><div class="line"><a name="l01912"></a><span class="lineno"> 1912</span>  <span class="keywordflow">if</span> (!(arg->flags & FUSE_MAX_PAGES)) {</div><div class="line"><a name="l01913"></a><span class="lineno"> 1913</span>  <span class="keywordtype">size_t</span> max_bufsize =</div><div class="line"><a name="l01914"></a><span class="lineno"> 1914</span>  FUSE_DEFAULT_MAX_PAGES_PER_REQ * getpagesize()</div><div class="line"><a name="l01915"></a><span class="lineno"> 1915</span>  + FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01916"></a><span class="lineno"> 1916</span>  <span class="keywordflow">if</span> (bufsize > max_bufsize) {</div><div class="line"><a name="l01917"></a><span class="lineno"> 1917</span>  bufsize = max_bufsize;</div><div class="line"><a name="l01918"></a><span class="lineno"> 1918</span>  }</div><div class="line"><a name="l01919"></a><span class="lineno"> 1919</span>  }</div><div class="line"><a name="l01920"></a><span class="lineno"> 1920</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01921"></a><span class="lineno"> 1921</span>  se->conn.max_readahead = 0;</div><div class="line"><a name="l01922"></a><span class="lineno"> 1922</span>  }</div><div class="line"><a name="l01923"></a><span class="lineno"> 1923</span> </div><div class="line"><a name="l01924"></a><span class="lineno"> 1924</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 14) {</div><div class="line"><a name="l01925"></a><span class="lineno"> 1925</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l01926"></a><span class="lineno"> 1926</span> <span class="preprocessor">#ifdef HAVE_VMSPLICE</span></div><div class="line"><a name="l01927"></a><span class="lineno"> 1927</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4f8815e0f48c60c3d9cd6e72be5a84e4">FUSE_CAP_SPLICE_WRITE</a> | <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aef5da823dc5f202bbe033c7a5a3de9c4">FUSE_CAP_SPLICE_MOVE</a>;</div><div class="line"><a name="l01928"></a><span class="lineno"> 1928</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l01929"></a><span class="lineno"> 1929</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>;</div><div class="line"><a name="l01930"></a><span class="lineno"> 1930</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l01931"></a><span class="lineno"> 1931</span>  }</div><div class="line"><a name="l01932"></a><span class="lineno"> 1932</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 18)</div><div class="line"><a name="l01933"></a><span class="lineno"> 1933</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>;</div><div class="line"><a name="l01934"></a><span class="lineno"> 1934</span> </div><div class="line"><a name="l01935"></a><span class="lineno"> 1935</span>  <span class="comment">/* Default settings for modern filesystems.</span></div><div class="line"><a name="l01936"></a><span class="lineno"> 1936</span> <span class="comment"> *</span></div><div class="line"><a name="l01937"></a><span class="lineno"> 1937</span> <span class="comment"> * Most of these capabilities were disabled by default in</span></div><div class="line"><a name="l01938"></a><span class="lineno"> 1938</span> <span class="comment"> * libfuse2 for backwards compatibility reasons. In libfuse3,</span></div><div class="line"><a name="l01939"></a><span class="lineno"> 1939</span> <span class="comment"> * we can finally enable them by default (as long as they're</span></div><div class="line"><a name="l01940"></a><span class="lineno"> 1940</span> <span class="comment"> * supported by the kernel).</span></div><div class="line"><a name="l01941"></a><span class="lineno"> 1941</span> <span class="comment"> */</span></div><div class="line"><a name="l01942"></a><span class="lineno"> 1942</span> <span class="preprocessor">#define LL_SET_DEFAULT(cond, cap) \</span></div><div class="line"><a name="l01943"></a><span class="lineno"> 1943</span> <span class="preprocessor"> if ((cond) && (se->conn.capable & (cap))) \</span></div><div class="line"><a name="l01944"></a><span class="lineno"> 1944</span> <span class="preprocessor"> se->conn.want |= (cap)</span></div><div class="line"><a name="l01945"></a><span class="lineno"> 1945</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>);</div><div class="line"><a name="l01946"></a><span class="lineno"> 1946</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a3311a7f569e9fbf55b3f0bcaadbe4ad0">FUSE_CAP_PARALLEL_DIROPS</a>);</div><div class="line"><a name="l01947"></a><span class="lineno"> 1947</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>);</div><div class="line"><a name="l01948"></a><span class="lineno"> 1948</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a24a4a980dff3f7a4ba771a92bb59a4bd">FUSE_CAP_HANDLE_KILLPRIV</a>);</div><div class="line"><a name="l01949"></a><span class="lineno"> 1949</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>);</div><div class="line"><a name="l01950"></a><span class="lineno"> 1950</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>);</div><div class="line"><a name="l01951"></a><span class="lineno"> 1951</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>);</div><div class="line"><a name="l01952"></a><span class="lineno"> 1952</span>  LL_SET_DEFAULT(se->op.write_buf, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>);</div><div class="line"><a name="l01953"></a><span class="lineno"> 1953</span>  LL_SET_DEFAULT(se->op.getlk && se->op.setlk,</div><div class="line"><a name="l01954"></a><span class="lineno"> 1954</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>);</div><div class="line"><a name="l01955"></a><span class="lineno"> 1955</span>  LL_SET_DEFAULT(se->op.flock, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>);</div><div class="line"><a name="l01956"></a><span class="lineno"> 1956</span>  LL_SET_DEFAULT(se->op.readdirplus, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>);</div><div class="line"><a name="l01957"></a><span class="lineno"> 1957</span>  LL_SET_DEFAULT(se->op.readdirplus && se->op.readdir,</div><div class="line"><a name="l01958"></a><span class="lineno"> 1958</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>);</div><div class="line"><a name="l01959"></a><span class="lineno"> 1959</span>  se->conn.time_gran = 1;</div><div class="line"><a name="l01960"></a><span class="lineno"> 1960</span>  </div><div class="line"><a name="l01961"></a><span class="lineno"> 1961</span>  <span class="keywordflow">if</span> (bufsize < FUSE_MIN_READ_BUFFER) {</div><div class="line"><a name="l01962"></a><span class="lineno"> 1962</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: buffer size too small: %zu\n"</span>,</div><div class="line"><a name="l01963"></a><span class="lineno"> 1963</span>  bufsize);</div><div class="line"><a name="l01964"></a><span class="lineno"> 1964</span>  bufsize = FUSE_MIN_READ_BUFFER;</div><div class="line"><a name="l01965"></a><span class="lineno"> 1965</span>  }</div><div class="line"><a name="l01966"></a><span class="lineno"> 1966</span>  se->bufsize = bufsize;</div><div class="line"><a name="l01967"></a><span class="lineno"> 1967</span> </div><div class="line"><a name="l01968"></a><span class="lineno"> 1968</span>  <span class="keywordflow">if</span> (se->conn.max_write > bufsize - FUSE_BUFFER_HEADER_SIZE)</div><div class="line"><a name="l01969"></a><span class="lineno"> 1969</span>  se->conn.max_write = bufsize - FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01970"></a><span class="lineno"> 1970</span> </div><div class="line"><a name="l01971"></a><span class="lineno"> 1971</span>  se->got_init = 1;</div><div class="line"><a name="l01972"></a><span class="lineno"> 1972</span>  <span class="keywordflow">if</span> (se->op.init)</div><div class="line"><a name="l01973"></a><span class="lineno"> 1973</span>  se->op.init(se->userdata, &se->conn);</div><div class="line"><a name="l01974"></a><span class="lineno"> 1974</span> </div><div class="line"><a name="l01975"></a><span class="lineno"> 1975</span>  <span class="keywordflow">if</span> (se->conn.want & (~se->conn.capable)) {</div><div class="line"><a name="l01976"></a><span class="lineno"> 1976</span>  fprintf(stderr, <span class="stringliteral">"fuse: error: filesystem requested capabilities "</span></div><div class="line"><a name="l01977"></a><span class="lineno"> 1977</span>  <span class="stringliteral">"0x%x that are not supported by kernel, aborting.\n"</span>,</div><div class="line"><a name="l01978"></a><span class="lineno"> 1978</span>  se->conn.want & (~se->conn.capable));</div><div class="line"><a name="l01979"></a><span class="lineno"> 1979</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01980"></a><span class="lineno"> 1980</span>  se->error = -EPROTO;</div><div class="line"><a name="l01981"></a><span class="lineno"> 1981</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l01982"></a><span class="lineno"> 1982</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01983"></a><span class="lineno"> 1983</span>  }</div><div class="line"><a name="l01984"></a><span class="lineno"> 1984</span> </div><div class="line"><a name="l01985"></a><span class="lineno"> 1985</span>  <span class="keywordtype">unsigned</span> max_read_mo = get_max_read(se->mo);</div><div class="line"><a name="l01986"></a><span class="lineno"> 1986</span>  <span class="keywordflow">if</span> (se->conn.max_read != max_read_mo) {</div><div class="line"><a name="l01987"></a><span class="lineno"> 1987</span>  fprintf(stderr, <span class="stringliteral">"fuse: error: init() and fuse_session_new() "</span></div><div class="line"><a name="l01988"></a><span class="lineno"> 1988</span>  <span class="stringliteral">"requested different maximum read size (%u vs %u)\n"</span>,</div><div class="line"><a name="l01989"></a><span class="lineno"> 1989</span>  se->conn.max_read, max_read_mo);</div><div class="line"><a name="l01990"></a><span class="lineno"> 1990</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01991"></a><span class="lineno"> 1991</span>  se->error = -EPROTO;</div><div class="line"><a name="l01992"></a><span class="lineno"> 1992</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l01993"></a><span class="lineno"> 1993</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01994"></a><span class="lineno"> 1994</span>  }</div><div class="line"><a name="l01995"></a><span class="lineno"> 1995</span> </div><div class="line"><a name="l01996"></a><span class="lineno"> 1996</span>  <span class="keywordflow">if</span> (se->conn.max_write < bufsize - FUSE_BUFFER_HEADER_SIZE) {</div><div class="line"><a name="l01997"></a><span class="lineno"> 1997</span>  se->bufsize = se->conn.max_write + FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01998"></a><span class="lineno"> 1998</span>  }</div><div class="line"><a name="l01999"></a><span class="lineno"> 1999</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_MAX_PAGES) {</div><div class="line"><a name="l02000"></a><span class="lineno"> 2000</span>  outarg.flags |= FUSE_MAX_PAGES;</div><div class="line"><a name="l02001"></a><span class="lineno"> 2001</span>  outarg.max_pages = (se->conn.max_write - 1) / getpagesize() + 1;</div><div class="line"><a name="l02002"></a><span class="lineno"> 2002</span>  }</div><div class="line"><a name="l02003"></a><span class="lineno"> 2003</span> </div><div class="line"><a name="l02004"></a><span class="lineno"> 2004</span>  <span class="comment">/* Always enable big writes, this is superseded</span></div><div class="line"><a name="l02005"></a><span class="lineno"> 2005</span> <span class="comment"> by the max_write option */</span></div><div class="line"><a name="l02006"></a><span class="lineno"> 2006</span>  outarg.flags |= FUSE_BIG_WRITES;</div><div class="line"><a name="l02007"></a><span class="lineno"> 2007</span> </div><div class="line"><a name="l02008"></a><span class="lineno"> 2008</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>)</div><div class="line"><a name="l02009"></a><span class="lineno"> 2009</span>  outarg.flags |= FUSE_ASYNC_READ;</div><div class="line"><a name="l02010"></a><span class="lineno"> 2010</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>)</div><div class="line"><a name="l02011"></a><span class="lineno"> 2011</span>  outarg.flags |= FUSE_POSIX_LOCKS;</div><div class="line"><a name="l02012"></a><span class="lineno"> 2012</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>)</div><div class="line"><a name="l02013"></a><span class="lineno"> 2013</span>  outarg.flags |= FUSE_ATOMIC_O_TRUNC;</div><div class="line"><a name="l02014"></a><span class="lineno"> 2014</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a7686c11aaf80382189927b10b848d8c8">FUSE_CAP_EXPORT_SUPPORT</a>)</div><div class="line"><a name="l02015"></a><span class="lineno"> 2015</span>  outarg.flags |= FUSE_EXPORT_SUPPORT;</div><div class="line"><a name="l02016"></a><span class="lineno"> 2016</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0cd4cebf7ec784886836aa061a1612fe">FUSE_CAP_DONT_MASK</a>)</div><div class="line"><a name="l02017"></a><span class="lineno"> 2017</span>  outarg.flags |= FUSE_DONT_MASK;</div><div class="line"><a name="l02018"></a><span class="lineno"> 2018</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>)</div><div class="line"><a name="l02019"></a><span class="lineno"> 2019</span>  outarg.flags |= FUSE_FLOCK_LOCKS;</div><div class="line"><a name="l02020"></a><span class="lineno"> 2020</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>)</div><div class="line"><a name="l02021"></a><span class="lineno"> 2021</span>  outarg.flags |= FUSE_AUTO_INVAL_DATA;</div><div class="line"><a name="l02022"></a><span class="lineno"> 2022</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>)</div><div class="line"><a name="l02023"></a><span class="lineno"> 2023</span>  outarg.flags |= FUSE_DO_READDIRPLUS;</div><div class="line"><a name="l02024"></a><span class="lineno"> 2024</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>)</div><div class="line"><a name="l02025"></a><span class="lineno"> 2025</span>  outarg.flags |= FUSE_READDIRPLUS_AUTO;</div><div class="line"><a name="l02026"></a><span class="lineno"> 2026</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>)</div><div class="line"><a name="l02027"></a><span class="lineno"> 2027</span>  outarg.flags |= FUSE_ASYNC_DIO;</div><div class="line"><a name="l02028"></a><span class="lineno"> 2028</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4839fce31097f4b4da7a1f01169228fa">FUSE_CAP_WRITEBACK_CACHE</a>)</div><div class="line"><a name="l02029"></a><span class="lineno"> 2029</span>  outarg.flags |= FUSE_WRITEBACK_CACHE;</div><div class="line"><a name="l02030"></a><span class="lineno"> 2030</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5b3ef5b12be33295311d6b751846c263">FUSE_CAP_POSIX_ACL</a>)</div><div class="line"><a name="l02031"></a><span class="lineno"> 2031</span>  outarg.flags |= FUSE_POSIX_ACL;</div><div class="line"><a name="l02032"></a><span class="lineno"> 2032</span>  outarg.max_readahead = se->conn.max_readahead;</div><div class="line"><a name="l02033"></a><span class="lineno"> 2033</span>  outarg.max_write = se->conn.max_write;</div><div class="line"><a name="l02034"></a><span class="lineno"> 2034</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 13) {</div><div class="line"><a name="l02035"></a><span class="lineno"> 2035</span>  <span class="keywordflow">if</span> (se->conn.max_background >= (1 << 16))</div><div class="line"><a name="l02036"></a><span class="lineno"> 2036</span>  se->conn.max_background = (1 << 16) - 1;</div><div class="line"><a name="l02037"></a><span class="lineno"> 2037</span>  <span class="keywordflow">if</span> (se->conn.congestion_threshold > se->conn.max_background)</div><div class="line"><a name="l02038"></a><span class="lineno"> 2038</span>  se->conn.congestion_threshold = se->conn.max_background;</div><div class="line"><a name="l02039"></a><span class="lineno"> 2039</span>  <span class="keywordflow">if</span> (!se->conn.congestion_threshold) {</div><div class="line"><a name="l02040"></a><span class="lineno"> 2040</span>  se->conn.congestion_threshold =</div><div class="line"><a name="l02041"></a><span class="lineno"> 2041</span>  se->conn.max_background * 3 / 4;</div><div class="line"><a name="l02042"></a><span class="lineno"> 2042</span>  }</div><div class="line"><a name="l02043"></a><span class="lineno"> 2043</span> </div><div class="line"><a name="l02044"></a><span class="lineno"> 2044</span>  outarg.max_background = se->conn.max_background;</div><div class="line"><a name="l02045"></a><span class="lineno"> 2045</span>  outarg.congestion_threshold = se->conn.congestion_threshold;</div><div class="line"><a name="l02046"></a><span class="lineno"> 2046</span>  }</div><div class="line"><a name="l02047"></a><span class="lineno"> 2047</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 23)</div><div class="line"><a name="l02048"></a><span class="lineno"> 2048</span>  outarg.time_gran = se->conn.time_gran;</div><div class="line"><a name="l02049"></a><span class="lineno"> 2049</span> </div><div class="line"><a name="l02050"></a><span class="lineno"> 2050</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l02051"></a><span class="lineno"> 2051</span>  fprintf(stderr, <span class="stringliteral">" INIT: %u.%u\n"</span>, outarg.major, outarg.minor);</div><div class="line"><a name="l02052"></a><span class="lineno"> 2052</span>  fprintf(stderr, <span class="stringliteral">" flags=0x%08x\n"</span>, outarg.flags);</div><div class="line"><a name="l02053"></a><span class="lineno"> 2053</span>  fprintf(stderr, <span class="stringliteral">" max_readahead=0x%08x\n"</span>,</div><div class="line"><a name="l02054"></a><span class="lineno"> 2054</span>  outarg.max_readahead);</div><div class="line"><a name="l02055"></a><span class="lineno"> 2055</span>  fprintf(stderr, <span class="stringliteral">" max_write=0x%08x\n"</span>, outarg.max_write);</div><div class="line"><a name="l02056"></a><span class="lineno"> 2056</span>  fprintf(stderr, <span class="stringliteral">" max_background=%i\n"</span>,</div><div class="line"><a name="l02057"></a><span class="lineno"> 2057</span>  outarg.max_background);</div><div class="line"><a name="l02058"></a><span class="lineno"> 2058</span>  fprintf(stderr, <span class="stringliteral">" congestion_threshold=%i\n"</span>,</div><div class="line"><a name="l02059"></a><span class="lineno"> 2059</span>  outarg.congestion_threshold);</div><div class="line"><a name="l02060"></a><span class="lineno"> 2060</span>  fprintf(stderr, <span class="stringliteral">" time_gran=%u\n"</span>,</div><div class="line"><a name="l02061"></a><span class="lineno"> 2061</span>  outarg.time_gran);</div><div class="line"><a name="l02062"></a><span class="lineno"> 2062</span>  }</div><div class="line"><a name="l02063"></a><span class="lineno"> 2063</span>  <span class="keywordflow">if</span> (arg->minor < 5)</div><div class="line"><a name="l02064"></a><span class="lineno"> 2064</span>  outargsize = FUSE_COMPAT_INIT_OUT_SIZE;</div><div class="line"><a name="l02065"></a><span class="lineno"> 2065</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg->minor < 23)</div><div class="line"><a name="l02066"></a><span class="lineno"> 2066</span>  outargsize = FUSE_COMPAT_22_INIT_OUT_SIZE;</div><div class="line"><a name="l02067"></a><span class="lineno"> 2067</span> </div><div class="line"><a name="l02068"></a><span class="lineno"> 2068</span>  send_reply_ok(req, &outarg, outargsize);</div><div class="line"><a name="l02069"></a><span class="lineno"> 2069</span> }</div><div class="line"><a name="l02070"></a><span class="lineno"> 2070</span> </div><div class="line"><a name="l02071"></a><span class="lineno"> 2071</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_destroy(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l02072"></a><span class="lineno"> 2072</span> {</div><div class="line"><a name="l02073"></a><span class="lineno"> 2073</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02074"></a><span class="lineno"> 2074</span> </div><div class="line"><a name="l02075"></a><span class="lineno"> 2075</span>  (void) nodeid;</div><div class="line"><a name="l02076"></a><span class="lineno"> 2076</span>  (void) inarg;</div><div class="line"><a name="l02077"></a><span class="lineno"> 2077</span> </div><div class="line"><a name="l02078"></a><span class="lineno"> 2078</span>  se->got_destroy = 1;</div><div class="line"><a name="l02079"></a><span class="lineno"> 2079</span>  <span class="keywordflow">if</span> (se->op.destroy)</div><div class="line"><a name="l02080"></a><span class="lineno"> 2080</span>  se->op.destroy(se->userdata);</div><div class="line"><a name="l02081"></a><span class="lineno"> 2081</span> </div><div class="line"><a name="l02082"></a><span class="lineno"> 2082</span>  send_reply_ok(req, NULL, 0);</div><div class="line"><a name="l02083"></a><span class="lineno"> 2083</span> }</div><div class="line"><a name="l02084"></a><span class="lineno"> 2084</span> </div><div class="line"><a name="l02085"></a><span class="lineno"> 2085</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_del_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq)</div><div class="line"><a name="l02086"></a><span class="lineno"> 2086</span> {</div><div class="line"><a name="l02087"></a><span class="lineno"> 2087</span>  <span class="keyword">struct </span>fuse_notify_req *prev = nreq->prev;</div><div class="line"><a name="l02088"></a><span class="lineno"> 2088</span>  <span class="keyword">struct </span>fuse_notify_req *next = nreq->next;</div><div class="line"><a name="l02089"></a><span class="lineno"> 2089</span>  prev->next = next;</div><div class="line"><a name="l02090"></a><span class="lineno"> 2090</span>  next->prev = prev;</div><div class="line"><a name="l02091"></a><span class="lineno"> 2091</span> }</div><div class="line"><a name="l02092"></a><span class="lineno"> 2092</span> </div><div class="line"><a name="l02093"></a><span class="lineno"> 2093</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_add_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq,</div><div class="line"><a name="l02094"></a><span class="lineno"> 2094</span>  <span class="keyword">struct</span> fuse_notify_req *next)</div><div class="line"><a name="l02095"></a><span class="lineno"> 2095</span> {</div><div class="line"><a name="l02096"></a><span class="lineno"> 2096</span>  <span class="keyword">struct </span>fuse_notify_req *prev = next->prev;</div><div class="line"><a name="l02097"></a><span class="lineno"> 2097</span>  nreq->next = next;</div><div class="line"><a name="l02098"></a><span class="lineno"> 2098</span>  nreq->prev = prev;</div><div class="line"><a name="l02099"></a><span class="lineno"> 2099</span>  prev->next = nreq;</div><div class="line"><a name="l02100"></a><span class="lineno"> 2100</span>  next->prev = nreq;</div><div class="line"><a name="l02101"></a><span class="lineno"> 2101</span> }</div><div class="line"><a name="l02102"></a><span class="lineno"> 2102</span> </div><div class="line"><a name="l02103"></a><span class="lineno"> 2103</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_init_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq)</div><div class="line"><a name="l02104"></a><span class="lineno"> 2104</span> {</div><div class="line"><a name="l02105"></a><span class="lineno"> 2105</span>  nreq->next = nreq;</div><div class="line"><a name="l02106"></a><span class="lineno"> 2106</span>  nreq->prev = nreq;</div><div class="line"><a name="l02107"></a><span class="lineno"> 2107</span> }</div><div class="line"><a name="l02108"></a><span class="lineno"> 2108</span> </div><div class="line"><a name="l02109"></a><span class="lineno"> 2109</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_notify_reply(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l02110"></a><span class="lineno"> 2110</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02111"></a><span class="lineno"> 2111</span> {</div><div class="line"><a name="l02112"></a><span class="lineno"> 2112</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02113"></a><span class="lineno"> 2113</span>  <span class="keyword">struct </span>fuse_notify_req *nreq;</div><div class="line"><a name="l02114"></a><span class="lineno"> 2114</span>  <span class="keyword">struct </span>fuse_notify_req *head;</div><div class="line"><a name="l02115"></a><span class="lineno"> 2115</span> </div><div class="line"><a name="l02116"></a><span class="lineno"> 2116</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02117"></a><span class="lineno"> 2117</span>  head = &se->notify_list;</div><div class="line"><a name="l02118"></a><span class="lineno"> 2118</span>  <span class="keywordflow">for</span> (nreq = head->next; nreq != head; nreq = nreq->next) {</div><div class="line"><a name="l02119"></a><span class="lineno"> 2119</span>  <span class="keywordflow">if</span> (nreq->unique == req->unique) {</div><div class="line"><a name="l02120"></a><span class="lineno"> 2120</span>  list_del_nreq(nreq);</div><div class="line"><a name="l02121"></a><span class="lineno"> 2121</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l02122"></a><span class="lineno"> 2122</span>  }</div><div class="line"><a name="l02123"></a><span class="lineno"> 2123</span>  }</div><div class="line"><a name="l02124"></a><span class="lineno"> 2124</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02125"></a><span class="lineno"> 2125</span> </div><div class="line"><a name="l02126"></a><span class="lineno"> 2126</span>  <span class="keywordflow">if</span> (nreq != head)</div><div class="line"><a name="l02127"></a><span class="lineno"> 2127</span>  nreq->reply(nreq, req, nodeid, inarg, buf);</div><div class="line"><a name="l02128"></a><span class="lineno"> 2128</span> }</div><div class="line"><a name="l02129"></a><span class="lineno"> 2129</span> </div><div class="line"><a name="l02130"></a><span class="lineno"> 2130</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_notify_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keywordtype">int</span> notify_code,</div><div class="line"><a name="l02131"></a><span class="lineno"> 2131</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l02132"></a><span class="lineno"> 2132</span> {</div><div class="line"><a name="l02133"></a><span class="lineno"> 2133</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l02134"></a><span class="lineno"> 2134</span> </div><div class="line"><a name="l02135"></a><span class="lineno"> 2135</span>  <span class="keywordflow">if</span> (!se->got_init)</div><div class="line"><a name="l02136"></a><span class="lineno"> 2136</span>  <span class="keywordflow">return</span> -ENOTCONN;</div><div class="line"><a name="l02137"></a><span class="lineno"> 2137</span> </div><div class="line"><a name="l02138"></a><span class="lineno"> 2138</span>  out.unique = 0;</div><div class="line"><a name="l02139"></a><span class="lineno"> 2139</span>  out.error = notify_code;</div><div class="line"><a name="l02140"></a><span class="lineno"> 2140</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l02141"></a><span class="lineno"> 2141</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l02142"></a><span class="lineno"> 2142</span> </div><div class="line"><a name="l02143"></a><span class="lineno"> 2143</span>  <span class="keywordflow">return</span> fuse_send_msg(se, NULL, iov, count);</div><div class="line"><a name="l02144"></a><span class="lineno"> 2144</span> }</div><div class="line"><a name="l02145"></a><span class="lineno"> 2145</span> </div><div class="line"><a name="l02146"></a><span class="lineno"> 2146</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab078685b1f480188031fc40aa2e2fbca">fuse_lowlevel_notify_poll</a>(<span class="keyword">struct</span> fuse_pollhandle *ph)</div><div class="line"><a name="l02147"></a><span class="lineno"> 2147</span> {</div><div class="line"><a name="l02148"></a><span class="lineno"> 2148</span>  <span class="keywordflow">if</span> (ph != NULL) {</div><div class="line"><a name="l02149"></a><span class="lineno"> 2149</span>  <span class="keyword">struct </span>fuse_notify_poll_wakeup_out outarg;</div><div class="line"><a name="l02150"></a><span class="lineno"> 2150</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02151"></a><span class="lineno"> 2151</span> </div><div class="line"><a name="l02152"></a><span class="lineno"> 2152</span>  outarg.kh = ph->kh;</div><div class="line"><a name="l02153"></a><span class="lineno"> 2153</span> </div><div class="line"><a name="l02154"></a><span class="lineno"> 2154</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02155"></a><span class="lineno"> 2155</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02156"></a><span class="lineno"> 2156</span> </div><div class="line"><a name="l02157"></a><span class="lineno"> 2157</span>  <span class="keywordflow">return</span> send_notify_iov(ph->se, FUSE_NOTIFY_POLL, iov, 2);</div><div class="line"><a name="l02158"></a><span class="lineno"> 2158</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02159"></a><span class="lineno"> 2159</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02160"></a><span class="lineno"> 2160</span>  }</div><div class="line"><a name="l02161"></a><span class="lineno"> 2161</span> }</div><div class="line"><a name="l02162"></a><span class="lineno"> 2162</span> </div><div class="line"><a name="l02163"></a><span class="lineno"> 2163</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a9cb974af9745294ff446d11cba2422f1">fuse_lowlevel_notify_inval_inode</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02164"></a><span class="lineno"> 2164</span>  off_t off, off_t len)</div><div class="line"><a name="l02165"></a><span class="lineno"> 2165</span> {</div><div class="line"><a name="l02166"></a><span class="lineno"> 2166</span>  <span class="keyword">struct </span>fuse_notify_inval_inode_out outarg;</div><div class="line"><a name="l02167"></a><span class="lineno"> 2167</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02168"></a><span class="lineno"> 2168</span> </div><div class="line"><a name="l02169"></a><span class="lineno"> 2169</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02170"></a><span class="lineno"> 2170</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02171"></a><span class="lineno"> 2171</span> </div><div class="line"><a name="l02172"></a><span class="lineno"> 2172</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 12)</div><div class="line"><a name="l02173"></a><span class="lineno"> 2173</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02174"></a><span class="lineno"> 2174</span>  </div><div class="line"><a name="l02175"></a><span class="lineno"> 2175</span>  outarg.ino = ino;</div><div class="line"><a name="l02176"></a><span class="lineno"> 2176</span>  outarg.off = off;</div><div class="line"><a name="l02177"></a><span class="lineno"> 2177</span>  outarg.len = len;</div><div class="line"><a name="l02178"></a><span class="lineno"> 2178</span> </div><div class="line"><a name="l02179"></a><span class="lineno"> 2179</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02180"></a><span class="lineno"> 2180</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02181"></a><span class="lineno"> 2181</span> </div><div class="line"><a name="l02182"></a><span class="lineno"> 2182</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_INVAL_INODE, iov, 2);</div><div class="line"><a name="l02183"></a><span class="lineno"> 2183</span> }</div><div class="line"><a name="l02184"></a><span class="lineno"> 2184</span> </div><div class="line"><a name="l02185"></a><span class="lineno"> 2185</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab14032b74b0a57a2b3155dd6ba8d6095">fuse_lowlevel_notify_inval_entry</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> parent,</div><div class="line"><a name="l02186"></a><span class="lineno"> 2186</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> namelen)</div><div class="line"><a name="l02187"></a><span class="lineno"> 2187</span> {</div><div class="line"><a name="l02188"></a><span class="lineno"> 2188</span>  <span class="keyword">struct </span>fuse_notify_inval_entry_out outarg;</div><div class="line"><a name="l02189"></a><span class="lineno"> 2189</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02190"></a><span class="lineno"> 2190</span> </div><div class="line"><a name="l02191"></a><span class="lineno"> 2191</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02192"></a><span class="lineno"> 2192</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02193"></a><span class="lineno"> 2193</span>  </div><div class="line"><a name="l02194"></a><span class="lineno"> 2194</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 12)</div><div class="line"><a name="l02195"></a><span class="lineno"> 2195</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02196"></a><span class="lineno"> 2196</span> </div><div class="line"><a name="l02197"></a><span class="lineno"> 2197</span>  outarg.parent = parent;</div><div class="line"><a name="l02198"></a><span class="lineno"> 2198</span>  outarg.namelen = namelen;</div><div class="line"><a name="l02199"></a><span class="lineno"> 2199</span>  outarg.padding = 0;</div><div class="line"><a name="l02200"></a><span class="lineno"> 2200</span> </div><div class="line"><a name="l02201"></a><span class="lineno"> 2201</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02202"></a><span class="lineno"> 2202</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02203"></a><span class="lineno"> 2203</span>  iov[2].iov_base = (<span class="keywordtype">void</span> *)name;</div><div class="line"><a name="l02204"></a><span class="lineno"> 2204</span>  iov[2].iov_len = namelen + 1;</div><div class="line"><a name="l02205"></a><span class="lineno"> 2205</span> </div><div class="line"><a name="l02206"></a><span class="lineno"> 2206</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_INVAL_ENTRY, iov, 3);</div><div class="line"><a name="l02207"></a><span class="lineno"> 2207</span> }</div><div class="line"><a name="l02208"></a><span class="lineno"> 2208</span> </div><div class="line"><a name="l02209"></a><span class="lineno"> 2209</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a399a43ff69a20ce42082a81eb1517992">fuse_lowlevel_notify_delete</a>(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02210"></a><span class="lineno"> 2210</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> parent, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> child,</div><div class="line"><a name="l02211"></a><span class="lineno"> 2211</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> namelen)</div><div class="line"><a name="l02212"></a><span class="lineno"> 2212</span> {</div><div class="line"><a name="l02213"></a><span class="lineno"> 2213</span>  <span class="keyword">struct </span>fuse_notify_delete_out outarg;</div><div class="line"><a name="l02214"></a><span class="lineno"> 2214</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02215"></a><span class="lineno"> 2215</span> </div><div class="line"><a name="l02216"></a><span class="lineno"> 2216</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02217"></a><span class="lineno"> 2217</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02218"></a><span class="lineno"> 2218</span> </div><div class="line"><a name="l02219"></a><span class="lineno"> 2219</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 18)</div><div class="line"><a name="l02220"></a><span class="lineno"> 2220</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02221"></a><span class="lineno"> 2221</span> </div><div class="line"><a name="l02222"></a><span class="lineno"> 2222</span>  outarg.parent = parent;</div><div class="line"><a name="l02223"></a><span class="lineno"> 2223</span>  outarg.child = child;</div><div class="line"><a name="l02224"></a><span class="lineno"> 2224</span>  outarg.namelen = namelen;</div><div class="line"><a name="l02225"></a><span class="lineno"> 2225</span>  outarg.padding = 0;</div><div class="line"><a name="l02226"></a><span class="lineno"> 2226</span> </div><div class="line"><a name="l02227"></a><span class="lineno"> 2227</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02228"></a><span class="lineno"> 2228</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02229"></a><span class="lineno"> 2229</span>  iov[2].iov_base = (<span class="keywordtype">void</span> *)name;</div><div class="line"><a name="l02230"></a><span class="lineno"> 2230</span>  iov[2].iov_len = namelen + 1;</div><div class="line"><a name="l02231"></a><span class="lineno"> 2231</span> </div><div class="line"><a name="l02232"></a><span class="lineno"> 2232</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_DELETE, iov, 3);</div><div class="line"><a name="l02233"></a><span class="lineno"> 2233</span> }</div><div class="line"><a name="l02234"></a><span class="lineno"> 2234</span> </div><div class="line"><a name="l02235"></a><span class="lineno"> 2235</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#af856725ed4a13ed7c17512554043edbc">fuse_lowlevel_notify_store</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02236"></a><span class="lineno"> 2236</span>  off_t offset, <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *bufv,</div><div class="line"><a name="l02237"></a><span class="lineno"> 2237</span>  <span class="keyword">enum</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18">fuse_buf_copy_flags</a> flags)</div><div class="line"><a name="l02238"></a><span class="lineno"> 2238</span> {</div><div class="line"><a name="l02239"></a><span class="lineno"> 2239</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l02240"></a><span class="lineno"> 2240</span>  <span class="keyword">struct </span>fuse_notify_store_out outarg;</div><div class="line"><a name="l02241"></a><span class="lineno"> 2241</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02242"></a><span class="lineno"> 2242</span>  <span class="keywordtype">size_t</span> size = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(bufv);</div><div class="line"><a name="l02243"></a><span class="lineno"> 2243</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l02244"></a><span class="lineno"> 2244</span> </div><div class="line"><a name="l02245"></a><span class="lineno"> 2245</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02246"></a><span class="lineno"> 2246</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02247"></a><span class="lineno"> 2247</span> </div><div class="line"><a name="l02248"></a><span class="lineno"> 2248</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 15)</div><div class="line"><a name="l02249"></a><span class="lineno"> 2249</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02250"></a><span class="lineno"> 2250</span> </div><div class="line"><a name="l02251"></a><span class="lineno"> 2251</span>  out.unique = 0;</div><div class="line"><a name="l02252"></a><span class="lineno"> 2252</span>  out.error = FUSE_NOTIFY_STORE;</div><div class="line"><a name="l02253"></a><span class="lineno"> 2253</span> </div><div class="line"><a name="l02254"></a><span class="lineno"> 2254</span>  outarg.nodeid = ino;</div><div class="line"><a name="l02255"></a><span class="lineno"> 2255</span>  outarg.offset = offset;</div><div class="line"><a name="l02256"></a><span class="lineno"> 2256</span>  outarg.size = size;</div><div class="line"><a name="l02257"></a><span class="lineno"> 2257</span>  outarg.padding = 0;</div><div class="line"><a name="l02258"></a><span class="lineno"> 2258</span> </div><div class="line"><a name="l02259"></a><span class="lineno"> 2259</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l02260"></a><span class="lineno"> 2260</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(out);</div><div class="line"><a name="l02261"></a><span class="lineno"> 2261</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02262"></a><span class="lineno"> 2262</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02263"></a><span class="lineno"> 2263</span> </div><div class="line"><a name="l02264"></a><span class="lineno"> 2264</span>  res = fuse_send_data_iov(se, NULL, iov, 2, bufv, flags);</div><div class="line"><a name="l02265"></a><span class="lineno"> 2265</span>  <span class="keywordflow">if</span> (res > 0)</div><div class="line"><a name="l02266"></a><span class="lineno"> 2266</span>  res = -res;</div><div class="line"><a name="l02267"></a><span class="lineno"> 2267</span> </div><div class="line"><a name="l02268"></a><span class="lineno"> 2268</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02269"></a><span class="lineno"> 2269</span> }</div><div class="line"><a name="l02270"></a><span class="lineno"> 2270</span> </div><div class="line"><a name="l02271"></a><span class="lineno"> 2271</span> <span class="keyword">struct </span>fuse_retrieve_req {</div><div class="line"><a name="l02272"></a><span class="lineno"> 2272</span>  <span class="keyword">struct </span>fuse_notify_req nreq;</div><div class="line"><a name="l02273"></a><span class="lineno"> 2273</span>  <span class="keywordtype">void</span> *cookie;</div><div class="line"><a name="l02274"></a><span class="lineno"> 2274</span> };</div><div class="line"><a name="l02275"></a><span class="lineno"> 2275</span> </div><div class="line"><a name="l02276"></a><span class="lineno"> 2276</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_retrieve_reply(<span class="keyword">struct</span> fuse_notify_req *nreq,</div><div class="line"><a name="l02277"></a><span class="lineno"> 2277</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02278"></a><span class="lineno"> 2278</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg,</div><div class="line"><a name="l02279"></a><span class="lineno"> 2279</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *ibuf)</div><div class="line"><a name="l02280"></a><span class="lineno"> 2280</span> {</div><div class="line"><a name="l02281"></a><span class="lineno"> 2281</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02282"></a><span class="lineno"> 2282</span>  <span class="keyword">struct </span>fuse_retrieve_req *rreq =</div><div class="line"><a name="l02283"></a><span class="lineno"> 2283</span>  container_of(nreq, <span class="keyword">struct</span> fuse_retrieve_req, nreq);</div><div class="line"><a name="l02284"></a><span class="lineno"> 2284</span>  <span class="keyword">const</span> <span class="keyword">struct </span>fuse_notify_retrieve_in *arg = inarg;</div><div class="line"><a name="l02285"></a><span class="lineno"> 2285</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = {</div><div class="line"><a name="l02286"></a><span class="lineno"> 2286</span>  .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *ibuf,</div><div class="line"><a name="l02287"></a><span class="lineno"> 2287</span>  .count = 1,</div><div class="line"><a name="l02288"></a><span class="lineno"> 2288</span>  };</div><div class="line"><a name="l02289"></a><span class="lineno"> 2289</span> </div><div class="line"><a name="l02290"></a><span class="lineno"> 2290</span>  <span class="keywordflow">if</span> (!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD))</div><div class="line"><a name="l02291"></a><span class="lineno"> 2291</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = PARAM(arg);</div><div class="line"><a name="l02292"></a><span class="lineno"> 2292</span> </div><div class="line"><a name="l02293"></a><span class="lineno"> 2293</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l02294"></a><span class="lineno"> 2294</span>  sizeof(struct fuse_notify_retrieve_in);</div><div class="line"><a name="l02295"></a><span class="lineno"> 2295</span> </div><div class="line"><a name="l02296"></a><span class="lineno"> 2296</span>  <span class="keywordflow">if</span> (bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < arg->size) {</div><div class="line"><a name="l02297"></a><span class="lineno"> 2297</span>  fprintf(stderr, <span class="stringliteral">"fuse: retrieve reply: buffer size too small\n"</span>);</div><div class="line"><a name="l02298"></a><span class="lineno"> 2298</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l02299"></a><span class="lineno"> 2299</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l02300"></a><span class="lineno"> 2300</span>  }</div><div class="line"><a name="l02301"></a><span class="lineno"> 2301</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = arg->size;</div><div class="line"><a name="l02302"></a><span class="lineno"> 2302</span> </div><div class="line"><a name="l02303"></a><span class="lineno"> 2303</span>  <span class="keywordflow">if</span> (se->op.retrieve_reply) {</div><div class="line"><a name="l02304"></a><span class="lineno"> 2304</span>  se->op.retrieve_reply(req, rreq->cookie, ino,</div><div class="line"><a name="l02305"></a><span class="lineno"> 2305</span>  arg->offset, &bufv);</div><div class="line"><a name="l02306"></a><span class="lineno"> 2306</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02307"></a><span class="lineno"> 2307</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l02308"></a><span class="lineno"> 2308</span>  }</div><div class="line"><a name="l02309"></a><span class="lineno"> 2309</span> out:</div><div class="line"><a name="l02310"></a><span class="lineno"> 2310</span>  free(rreq);</div><div class="line"><a name="l02311"></a><span class="lineno"> 2311</span>  <span class="keywordflow">if</span> ((ibuf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) && bufv.<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> < bufv.<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a>)</div><div class="line"><a name="l02312"></a><span class="lineno"> 2312</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02313"></a><span class="lineno"> 2313</span> }</div><div class="line"><a name="l02314"></a><span class="lineno"> 2314</span> </div><div class="line"><a name="l02315"></a><span class="lineno"> 2315</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a58cb3543209d2c29dc2830f2503b5058">fuse_lowlevel_notify_retrieve</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02316"></a><span class="lineno"> 2316</span>  <span class="keywordtype">size_t</span> size, off_t offset, <span class="keywordtype">void</span> *cookie)</div><div class="line"><a name="l02317"></a><span class="lineno"> 2317</span> {</div><div class="line"><a name="l02318"></a><span class="lineno"> 2318</span>  <span class="keyword">struct </span>fuse_notify_retrieve_out outarg;</div><div class="line"><a name="l02319"></a><span class="lineno"> 2319</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02320"></a><span class="lineno"> 2320</span>  <span class="keyword">struct </span>fuse_retrieve_req *rreq;</div><div class="line"><a name="l02321"></a><span class="lineno"> 2321</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02322"></a><span class="lineno"> 2322</span> </div><div class="line"><a name="l02323"></a><span class="lineno"> 2323</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02324"></a><span class="lineno"> 2324</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02325"></a><span class="lineno"> 2325</span> </div><div class="line"><a name="l02326"></a><span class="lineno"> 2326</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 15)</div><div class="line"><a name="l02327"></a><span class="lineno"> 2327</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02328"></a><span class="lineno"> 2328</span> </div><div class="line"><a name="l02329"></a><span class="lineno"> 2329</span>  rreq = malloc(<span class="keyword">sizeof</span>(*rreq));</div><div class="line"><a name="l02330"></a><span class="lineno"> 2330</span>  <span class="keywordflow">if</span> (rreq == NULL)</div><div class="line"><a name="l02331"></a><span class="lineno"> 2331</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02332"></a><span class="lineno"> 2332</span> </div><div class="line"><a name="l02333"></a><span class="lineno"> 2333</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02334"></a><span class="lineno"> 2334</span>  rreq->cookie = cookie;</div><div class="line"><a name="l02335"></a><span class="lineno"> 2335</span>  rreq->nreq.unique = se->notify_ctr++;</div><div class="line"><a name="l02336"></a><span class="lineno"> 2336</span>  rreq->nreq.reply = fuse_ll_retrieve_reply;</div><div class="line"><a name="l02337"></a><span class="lineno"> 2337</span>  list_add_nreq(&rreq->nreq, &se->notify_list);</div><div class="line"><a name="l02338"></a><span class="lineno"> 2338</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02339"></a><span class="lineno"> 2339</span> </div><div class="line"><a name="l02340"></a><span class="lineno"> 2340</span>  outarg.notify_unique = rreq->nreq.unique;</div><div class="line"><a name="l02341"></a><span class="lineno"> 2341</span>  outarg.nodeid = ino;</div><div class="line"><a name="l02342"></a><span class="lineno"> 2342</span>  outarg.offset = offset;</div><div class="line"><a name="l02343"></a><span class="lineno"> 2343</span>  outarg.size = size;</div><div class="line"><a name="l02344"></a><span class="lineno"> 2344</span>  outarg.padding = 0;</div><div class="line"><a name="l02345"></a><span class="lineno"> 2345</span> </div><div class="line"><a name="l02346"></a><span class="lineno"> 2346</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02347"></a><span class="lineno"> 2347</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02348"></a><span class="lineno"> 2348</span> </div><div class="line"><a name="l02349"></a><span class="lineno"> 2349</span>  err = send_notify_iov(se, FUSE_NOTIFY_RETRIEVE, iov, 2);</div><div class="line"><a name="l02350"></a><span class="lineno"> 2350</span>  <span class="keywordflow">if</span> (err) {</div><div class="line"><a name="l02351"></a><span class="lineno"> 2351</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02352"></a><span class="lineno"> 2352</span>  list_del_nreq(&rreq->nreq);</div><div class="line"><a name="l02353"></a><span class="lineno"> 2353</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02354"></a><span class="lineno"> 2354</span>  free(rreq);</div><div class="line"><a name="l02355"></a><span class="lineno"> 2355</span>  }</div><div class="line"><a name="l02356"></a><span class="lineno"> 2356</span> </div><div class="line"><a name="l02357"></a><span class="lineno"> 2357</span>  <span class="keywordflow">return</span> err;</div><div class="line"><a name="l02358"></a><span class="lineno"> 2358</span> }</div><div class="line"><a name="l02359"></a><span class="lineno"> 2359</span> </div><div class="line"><a name="l02360"></a><span class="lineno"> 2360</span> <span class="keywordtype">void</span> *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aab00273c65d124e44abcf2374f9c504b">fuse_req_userdata</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02361"></a><span class="lineno"> 2361</span> {</div><div class="line"><a name="l02362"></a><span class="lineno"> 2362</span>  <span class="keywordflow">return</span> req->se->userdata;</div><div class="line"><a name="l02363"></a><span class="lineno"> 2363</span> }</div><div class="line"><a name="l02364"></a><span class="lineno"> 2364</span> </div><div class="line"><a name="l02365"></a><span class="lineno"> 2365</span> <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__ctx.html">fuse_ctx</a> *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1d1963190eb93ae5667d32d2b387ca1">fuse_req_ctx</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02366"></a><span class="lineno"> 2366</span> {</div><div class="line"><a name="l02367"></a><span class="lineno"> 2367</span>  <span class="keywordflow">return</span> &req->ctx;</div><div class="line"><a name="l02368"></a><span class="lineno"> 2368</span> }</div><div class="line"><a name="l02369"></a><span class="lineno"> 2369</span> </div><div class="line"><a name="l02370"></a><span class="lineno"> 2370</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab3cdb9744f033e37a72984489343940f">fuse_req_interrupt_func</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1fe719ed24a713bb5d17e4e7a0dde730">fuse_interrupt_func_t</a> func,</div><div class="line"><a name="l02371"></a><span class="lineno"> 2371</span>  <span class="keywordtype">void</span> *data)</div><div class="line"><a name="l02372"></a><span class="lineno"> 2372</span> {</div><div class="line"><a name="l02373"></a><span class="lineno"> 2373</span>  pthread_mutex_lock(&req->lock);</div><div class="line"><a name="l02374"></a><span class="lineno"> 2374</span>  pthread_mutex_lock(&req->se->lock);</div><div class="line"><a name="l02375"></a><span class="lineno"> 2375</span>  req->u.ni.func = func;</div><div class="line"><a name="l02376"></a><span class="lineno"> 2376</span>  req->u.ni.data = data;</div><div class="line"><a name="l02377"></a><span class="lineno"> 2377</span>  pthread_mutex_unlock(&req->se->lock);</div><div class="line"><a name="l02378"></a><span class="lineno"> 2378</span>  <span class="keywordflow">if</span> (req->interrupted && func)</div><div class="line"><a name="l02379"></a><span class="lineno"> 2379</span>  func(req, data);</div><div class="line"><a name="l02380"></a><span class="lineno"> 2380</span>  pthread_mutex_unlock(&req->lock);</div><div class="line"><a name="l02381"></a><span class="lineno"> 2381</span> }</div><div class="line"><a name="l02382"></a><span class="lineno"> 2382</span> </div><div class="line"><a name="l02383"></a><span class="lineno"> 2383</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a52674fc627647f33e63c74267f0f1f9d">fuse_req_interrupted</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02384"></a><span class="lineno"> 2384</span> {</div><div class="line"><a name="l02385"></a><span class="lineno"> 2385</span>  <span class="keywordtype">int</span> interrupted;</div><div class="line"><a name="l02386"></a><span class="lineno"> 2386</span> </div><div class="line"><a name="l02387"></a><span class="lineno"> 2387</span>  pthread_mutex_lock(&req->se->lock);</div><div class="line"><a name="l02388"></a><span class="lineno"> 2388</span>  interrupted = req->interrupted;</div><div class="line"><a name="l02389"></a><span class="lineno"> 2389</span>  pthread_mutex_unlock(&req->se->lock);</div><div class="line"><a name="l02390"></a><span class="lineno"> 2390</span> </div><div class="line"><a name="l02391"></a><span class="lineno"> 2391</span>  <span class="keywordflow">return</span> interrupted;</div><div class="line"><a name="l02392"></a><span class="lineno"> 2392</span> }</div><div class="line"><a name="l02393"></a><span class="lineno"> 2393</span> </div><div class="line"><a name="l02394"></a><span class="lineno"> 2394</span> <span class="keyword">static</span> <span class="keyword">struct </span>{</div><div class="line"><a name="l02395"></a><span class="lineno"> 2395</span>  void (*func)(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a>, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *);</div><div class="line"><a name="l02396"></a><span class="lineno"> 2396</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name;</div><div class="line"><a name="l02397"></a><span class="lineno"> 2397</span> } fuse_ll_ops[] = {</div><div class="line"><a name="l02398"></a><span class="lineno"> 2398</span>  [FUSE_LOOKUP] = { do_lookup, <span class="stringliteral">"LOOKUP"</span> },</div><div class="line"><a name="l02399"></a><span class="lineno"> 2399</span>  [FUSE_FORGET] = { do_forget, <span class="stringliteral">"FORGET"</span> },</div><div class="line"><a name="l02400"></a><span class="lineno"> 2400</span>  [FUSE_GETATTR] = { do_getattr, <span class="stringliteral">"GETATTR"</span> },</div><div class="line"><a name="l02401"></a><span class="lineno"> 2401</span>  [FUSE_SETATTR] = { do_setattr, <span class="stringliteral">"SETATTR"</span> },</div><div class="line"><a name="l02402"></a><span class="lineno"> 2402</span>  [FUSE_READLINK] = { do_readlink, <span class="stringliteral">"READLINK"</span> },</div><div class="line"><a name="l02403"></a><span class="lineno"> 2403</span>  [FUSE_SYMLINK] = { do_symlink, <span class="stringliteral">"SYMLINK"</span> },</div><div class="line"><a name="l02404"></a><span class="lineno"> 2404</span>  [FUSE_MKNOD] = { do_mknod, <span class="stringliteral">"MKNOD"</span> },</div><div class="line"><a name="l02405"></a><span class="lineno"> 2405</span>  [FUSE_MKDIR] = { do_mkdir, <span class="stringliteral">"MKDIR"</span> },</div><div class="line"><a name="l02406"></a><span class="lineno"> 2406</span>  [FUSE_UNLINK] = { do_unlink, <span class="stringliteral">"UNLINK"</span> },</div><div class="line"><a name="l02407"></a><span class="lineno"> 2407</span>  [FUSE_RMDIR] = { do_rmdir, <span class="stringliteral">"RMDIR"</span> },</div><div class="line"><a name="l02408"></a><span class="lineno"> 2408</span>  [FUSE_RENAME] = { do_rename, <span class="stringliteral">"RENAME"</span> },</div><div class="line"><a name="l02409"></a><span class="lineno"> 2409</span>  [FUSE_LINK] = { do_link, <span class="stringliteral">"LINK"</span> },</div><div class="line"><a name="l02410"></a><span class="lineno"> 2410</span>  [FUSE_OPEN] = { do_open, <span class="stringliteral">"OPEN"</span> },</div><div class="line"><a name="l02411"></a><span class="lineno"> 2411</span>  [FUSE_READ] = { do_read, <span class="stringliteral">"READ"</span> },</div><div class="line"><a name="l02412"></a><span class="lineno"> 2412</span>  [FUSE_WRITE] = { do_write, <span class="stringliteral">"WRITE"</span> },</div><div class="line"><a name="l02413"></a><span class="lineno"> 2413</span>  [FUSE_STATFS] = { do_statfs, <span class="stringliteral">"STATFS"</span> },</div><div class="line"><a name="l02414"></a><span class="lineno"> 2414</span>  [FUSE_RELEASE] = { do_release, <span class="stringliteral">"RELEASE"</span> },</div><div class="line"><a name="l02415"></a><span class="lineno"> 2415</span>  [FUSE_FSYNC] = { do_fsync, <span class="stringliteral">"FSYNC"</span> },</div><div class="line"><a name="l02416"></a><span class="lineno"> 2416</span>  [FUSE_SETXATTR] = { do_setxattr, <span class="stringliteral">"SETXATTR"</span> },</div><div class="line"><a name="l02417"></a><span class="lineno"> 2417</span>  [FUSE_GETXATTR] = { do_getxattr, <span class="stringliteral">"GETXATTR"</span> },</div><div class="line"><a name="l02418"></a><span class="lineno"> 2418</span>  [FUSE_LISTXATTR] = { do_listxattr, <span class="stringliteral">"LISTXATTR"</span> },</div><div class="line"><a name="l02419"></a><span class="lineno"> 2419</span>  [FUSE_REMOVEXATTR] = { do_removexattr, <span class="stringliteral">"REMOVEXATTR"</span> },</div><div class="line"><a name="l02420"></a><span class="lineno"> 2420</span>  [FUSE_FLUSH] = { do_flush, <span class="stringliteral">"FLUSH"</span> },</div><div class="line"><a name="l02421"></a><span class="lineno"> 2421</span>  [FUSE_INIT] = { do_init, <span class="stringliteral">"INIT"</span> },</div><div class="line"><a name="l02422"></a><span class="lineno"> 2422</span>  [FUSE_OPENDIR] = { do_opendir, <span class="stringliteral">"OPENDIR"</span> },</div><div class="line"><a name="l02423"></a><span class="lineno"> 2423</span>  [FUSE_READDIR] = { do_readdir, <span class="stringliteral">"READDIR"</span> },</div><div class="line"><a name="l02424"></a><span class="lineno"> 2424</span>  [FUSE_RELEASEDIR] = { do_releasedir, <span class="stringliteral">"RELEASEDIR"</span> },</div><div class="line"><a name="l02425"></a><span class="lineno"> 2425</span>  [FUSE_FSYNCDIR] = { do_fsyncdir, <span class="stringliteral">"FSYNCDIR"</span> },</div><div class="line"><a name="l02426"></a><span class="lineno"> 2426</span>  [FUSE_GETLK] = { do_getlk, <span class="stringliteral">"GETLK"</span> },</div><div class="line"><a name="l02427"></a><span class="lineno"> 2427</span>  [FUSE_SETLK] = { do_setlk, <span class="stringliteral">"SETLK"</span> },</div><div class="line"><a name="l02428"></a><span class="lineno"> 2428</span>  [FUSE_SETLKW] = { do_setlkw, <span class="stringliteral">"SETLKW"</span> },</div><div class="line"><a name="l02429"></a><span class="lineno"> 2429</span>  [FUSE_ACCESS] = { do_access, <span class="stringliteral">"ACCESS"</span> },</div><div class="line"><a name="l02430"></a><span class="lineno"> 2430</span>  [FUSE_CREATE] = { do_create, <span class="stringliteral">"CREATE"</span> },</div><div class="line"><a name="l02431"></a><span class="lineno"> 2431</span>  [FUSE_INTERRUPT] = { do_interrupt, <span class="stringliteral">"INTERRUPT"</span> },</div><div class="line"><a name="l02432"></a><span class="lineno"> 2432</span>  [FUSE_BMAP] = { do_bmap, <span class="stringliteral">"BMAP"</span> },</div><div class="line"><a name="l02433"></a><span class="lineno"> 2433</span>  [FUSE_IOCTL] = { do_ioctl, <span class="stringliteral">"IOCTL"</span> },</div><div class="line"><a name="l02434"></a><span class="lineno"> 2434</span>  [FUSE_POLL] = { do_poll, <span class="stringliteral">"POLL"</span> },</div><div class="line"><a name="l02435"></a><span class="lineno"> 2435</span>  [FUSE_FALLOCATE] = { do_fallocate, <span class="stringliteral">"FALLOCATE"</span> },</div><div class="line"><a name="l02436"></a><span class="lineno"> 2436</span>  [FUSE_DESTROY] = { do_destroy, <span class="stringliteral">"DESTROY"</span> },</div><div class="line"><a name="l02437"></a><span class="lineno"> 2437</span>  [FUSE_NOTIFY_REPLY] = { (<span class="keywordtype">void</span> *) 1, <span class="stringliteral">"NOTIFY_REPLY"</span> },</div><div class="line"><a name="l02438"></a><span class="lineno"> 2438</span>  [FUSE_BATCH_FORGET] = { do_batch_forget, <span class="stringliteral">"BATCH_FORGET"</span> },</div><div class="line"><a name="l02439"></a><span class="lineno"> 2439</span>  [FUSE_READDIRPLUS] = { do_readdirplus, <span class="stringliteral">"READDIRPLUS"</span>},</div><div class="line"><a name="l02440"></a><span class="lineno"> 2440</span>  [FUSE_RENAME2] = { do_rename2, <span class="stringliteral">"RENAME2"</span> },</div><div class="line"><a name="l02441"></a><span class="lineno"> 2441</span>  [FUSE_COPY_FILE_RANGE] = { do_copy_file_range, <span class="stringliteral">"COPY_FILE_RANGE"</span> },</div><div class="line"><a name="l02442"></a><span class="lineno"> 2442</span>  [CUSE_INIT] = { cuse_lowlevel_init, <span class="stringliteral">"CUSE_INIT"</span> },</div><div class="line"><a name="l02443"></a><span class="lineno"> 2443</span> };</div><div class="line"><a name="l02444"></a><span class="lineno"> 2444</span> </div><div class="line"><a name="l02445"></a><span class="lineno"> 2445</span> <span class="preprocessor">#define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))</span></div><div class="line"><a name="l02446"></a><span class="lineno"> 2446</span> </div><div class="line"><a name="l02447"></a><span class="lineno"> 2447</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *opname(<span class="keyword">enum</span> fuse_opcode opcode)</div><div class="line"><a name="l02448"></a><span class="lineno"> 2448</span> {</div><div class="line"><a name="l02449"></a><span class="lineno"> 2449</span>  <span class="keywordflow">if</span> (opcode >= FUSE_MAXOP || !fuse_ll_ops[opcode].name)</div><div class="line"><a name="l02450"></a><span class="lineno"> 2450</span>  <span class="keywordflow">return</span> <span class="stringliteral">"???"</span>;</div><div class="line"><a name="l02451"></a><span class="lineno"> 2451</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l02452"></a><span class="lineno"> 2452</span>  <span class="keywordflow">return</span> fuse_ll_ops[opcode].name;</div><div class="line"><a name="l02453"></a><span class="lineno"> 2453</span> }</div><div class="line"><a name="l02454"></a><span class="lineno"> 2454</span> </div><div class="line"><a name="l02455"></a><span class="lineno"> 2455</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_ll_copy_from_pipe(<span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *dst,</div><div class="line"><a name="l02456"></a><span class="lineno"> 2456</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *src)</div><div class="line"><a name="l02457"></a><span class="lineno"> 2457</span> {</div><div class="line"><a name="l02458"></a><span class="lineno"> 2458</span>  ssize_t res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(dst, src, 0);</div><div class="line"><a name="l02459"></a><span class="lineno"> 2459</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l02460"></a><span class="lineno"> 2460</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: %s\n"</span>, strerror(-res));</div><div class="line"><a name="l02461"></a><span class="lineno"> 2461</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02462"></a><span class="lineno"> 2462</span>  }</div><div class="line"><a name="l02463"></a><span class="lineno"> 2463</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>)res < <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(dst)) {</div><div class="line"><a name="l02464"></a><span class="lineno"> 2464</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: short read\n"</span>);</div><div class="line"><a name="l02465"></a><span class="lineno"> 2465</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02466"></a><span class="lineno"> 2466</span>  }</div><div class="line"><a name="l02467"></a><span class="lineno"> 2467</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02468"></a><span class="lineno"> 2468</span> }</div><div class="line"><a name="l02469"></a><span class="lineno"> 2469</span> </div><div class="line"><a name="l02470"></a><span class="lineno"> 2470</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a411ee86ec4657ea954402a9ca263e6d0">fuse_session_process_buf</a>(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02471"></a><span class="lineno"> 2471</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02472"></a><span class="lineno"> 2472</span> {</div><div class="line"><a name="l02473"></a><span class="lineno"> 2473</span>  fuse_session_process_buf_int(se, buf, NULL);</div><div class="line"><a name="l02474"></a><span class="lineno"> 2474</span> }</div><div class="line"><a name="l02475"></a><span class="lineno"> 2475</span> </div><div class="line"><a name="l02476"></a><span class="lineno"> 2476</span> <span class="keywordtype">void</span> fuse_session_process_buf_int(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02477"></a><span class="lineno"> 2477</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf, <span class="keyword">struct</span> fuse_chan *ch)</div><div class="line"><a name="l02478"></a><span class="lineno"> 2478</span> {</div><div class="line"><a name="l02479"></a><span class="lineno"> 2479</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> write_header_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l02480"></a><span class="lineno"> 2480</span>  sizeof(struct fuse_write_in);</div><div class="line"><a name="l02481"></a><span class="lineno"> 2481</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = { .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>, .count = 1 };</div><div class="line"><a name="l02482"></a><span class="lineno"> 2482</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> tmpbuf = FUSE_BUFVEC_INIT(write_header_size);</div><div class="line"><a name="l02483"></a><span class="lineno"> 2483</span>  <span class="keyword">struct </span>fuse_in_header *in;</div><div class="line"><a name="l02484"></a><span class="lineno"> 2484</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg;</div><div class="line"><a name="l02485"></a><span class="lineno"> 2485</span>  <span class="keyword">struct </span>fuse_req *req;</div><div class="line"><a name="l02486"></a><span class="lineno"> 2486</span>  <span class="keywordtype">void</span> *mbuf = NULL;</div><div class="line"><a name="l02487"></a><span class="lineno"> 2487</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02488"></a><span class="lineno"> 2488</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l02489"></a><span class="lineno"> 2489</span> </div><div class="line"><a name="l02490"></a><span class="lineno"> 2490</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) {</div><div class="line"><a name="l02491"></a><span class="lineno"> 2491</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>)</div><div class="line"><a name="l02492"></a><span class="lineno"> 2492</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>;</div><div class="line"><a name="l02493"></a><span class="lineno"> 2493</span> </div><div class="line"><a name="l02494"></a><span class="lineno"> 2494</span>  mbuf = malloc(tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>);</div><div class="line"><a name="l02495"></a><span class="lineno"> 2495</span>  <span class="keywordflow">if</span> (mbuf == NULL) {</div><div class="line"><a name="l02496"></a><span class="lineno"> 2496</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate header\n"</span>);</div><div class="line"><a name="l02497"></a><span class="lineno"> 2497</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02498"></a><span class="lineno"> 2498</span>  }</div><div class="line"><a name="l02499"></a><span class="lineno"> 2499</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l02500"></a><span class="lineno"> 2500</span> </div><div class="line"><a name="l02501"></a><span class="lineno"> 2501</span>  res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);</div><div class="line"><a name="l02502"></a><span class="lineno"> 2502</span>  <span class="keywordflow">if</span> (res < 0)</div><div class="line"><a name="l02503"></a><span class="lineno"> 2503</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02504"></a><span class="lineno"> 2504</span> </div><div class="line"><a name="l02505"></a><span class="lineno"> 2505</span>  in = mbuf;</div><div class="line"><a name="l02506"></a><span class="lineno"> 2506</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02507"></a><span class="lineno"> 2507</span>  in = buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>;</div><div class="line"><a name="l02508"></a><span class="lineno"> 2508</span>  }</div><div class="line"><a name="l02509"></a><span class="lineno"> 2509</span> </div><div class="line"><a name="l02510"></a><span class="lineno"> 2510</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l02511"></a><span class="lineno"> 2511</span>  fprintf(stderr,</div><div class="line"><a name="l02512"></a><span class="lineno"> 2512</span>  <span class="stringliteral">"unique: %llu, opcode: %s (%i), nodeid: %llu, insize: %zu, pid: %u\n"</span>,</div><div class="line"><a name="l02513"></a><span class="lineno"> 2513</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) in->unique,</div><div class="line"><a name="l02514"></a><span class="lineno"> 2514</span>  opname((<span class="keyword">enum</span> fuse_opcode) in->opcode), in->opcode,</div><div class="line"><a name="l02515"></a><span class="lineno"> 2515</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) in->nodeid, buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>, in->pid);</div><div class="line"><a name="l02516"></a><span class="lineno"> 2516</span>  }</div><div class="line"><a name="l02517"></a><span class="lineno"> 2517</span> </div><div class="line"><a name="l02518"></a><span class="lineno"> 2518</span>  req = fuse_ll_alloc_req(se);</div><div class="line"><a name="l02519"></a><span class="lineno"> 2519</span>  <span class="keywordflow">if</span> (req == NULL) {</div><div class="line"><a name="l02520"></a><span class="lineno"> 2520</span>  <span class="keyword">struct </span>fuse_out_header out = {</div><div class="line"><a name="l02521"></a><span class="lineno"> 2521</span>  .unique = in->unique,</div><div class="line"><a name="l02522"></a><span class="lineno"> 2522</span>  .error = -ENOMEM,</div><div class="line"><a name="l02523"></a><span class="lineno"> 2523</span>  };</div><div class="line"><a name="l02524"></a><span class="lineno"> 2524</span>  <span class="keyword">struct </span>iovec iov = {</div><div class="line"><a name="l02525"></a><span class="lineno"> 2525</span>  .iov_base = &out,</div><div class="line"><a name="l02526"></a><span class="lineno"> 2526</span>  .iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header),</div><div class="line"><a name="l02527"></a><span class="lineno"> 2527</span>  };</div><div class="line"><a name="l02528"></a><span class="lineno"> 2528</span> </div><div class="line"><a name="l02529"></a><span class="lineno"> 2529</span>  fuse_send_msg(se, ch, &iov, 1);</div><div class="line"><a name="l02530"></a><span class="lineno"> 2530</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02531"></a><span class="lineno"> 2531</span>  }</div><div class="line"><a name="l02532"></a><span class="lineno"> 2532</span> </div><div class="line"><a name="l02533"></a><span class="lineno"> 2533</span>  req->unique = in->unique;</div><div class="line"><a name="l02534"></a><span class="lineno"> 2534</span>  req->ctx.uid = in->uid;</div><div class="line"><a name="l02535"></a><span class="lineno"> 2535</span>  req->ctx.gid = in->gid;</div><div class="line"><a name="l02536"></a><span class="lineno"> 2536</span>  req->ctx.pid = in->pid;</div><div class="line"><a name="l02537"></a><span class="lineno"> 2537</span>  req->ch = ch ? fuse_chan_get(ch) : NULL;</div><div class="line"><a name="l02538"></a><span class="lineno"> 2538</span> </div><div class="line"><a name="l02539"></a><span class="lineno"> 2539</span>  err = EIO;</div><div class="line"><a name="l02540"></a><span class="lineno"> 2540</span>  <span class="keywordflow">if</span> (!se->got_init) {</div><div class="line"><a name="l02541"></a><span class="lineno"> 2541</span>  <span class="keyword">enum</span> fuse_opcode expected;</div><div class="line"><a name="l02542"></a><span class="lineno"> 2542</span> </div><div class="line"><a name="l02543"></a><span class="lineno"> 2543</span>  expected = se->cuse_data ? CUSE_INIT : FUSE_INIT;</div><div class="line"><a name="l02544"></a><span class="lineno"> 2544</span>  <span class="keywordflow">if</span> (in->opcode != expected)</div><div class="line"><a name="l02545"></a><span class="lineno"> 2545</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02546"></a><span class="lineno"> 2546</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (in->opcode == FUSE_INIT || in->opcode == CUSE_INIT)</div><div class="line"><a name="l02547"></a><span class="lineno"> 2547</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02548"></a><span class="lineno"> 2548</span> </div><div class="line"><a name="l02549"></a><span class="lineno"> 2549</span>  err = EACCES;</div><div class="line"><a name="l02550"></a><span class="lineno"> 2550</span>  <span class="comment">/* Implement -o allow_root */</span></div><div class="line"><a name="l02551"></a><span class="lineno"> 2551</span>  <span class="keywordflow">if</span> (se->deny_others && in->uid != se->owner && in->uid != 0 &&</div><div class="line"><a name="l02552"></a><span class="lineno"> 2552</span>  in->opcode != FUSE_INIT && in->opcode != FUSE_READ &&</div><div class="line"><a name="l02553"></a><span class="lineno"> 2553</span>  in->opcode != FUSE_WRITE && in->opcode != FUSE_FSYNC &&</div><div class="line"><a name="l02554"></a><span class="lineno"> 2554</span>  in->opcode != FUSE_RELEASE && in->opcode != FUSE_READDIR &&</div><div class="line"><a name="l02555"></a><span class="lineno"> 2555</span>  in->opcode != FUSE_FSYNCDIR && in->opcode != FUSE_RELEASEDIR &&</div><div class="line"><a name="l02556"></a><span class="lineno"> 2556</span>  in->opcode != FUSE_NOTIFY_REPLY &&</div><div class="line"><a name="l02557"></a><span class="lineno"> 2557</span>  in->opcode != FUSE_READDIRPLUS)</div><div class="line"><a name="l02558"></a><span class="lineno"> 2558</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02559"></a><span class="lineno"> 2559</span> </div><div class="line"><a name="l02560"></a><span class="lineno"> 2560</span>  err = ENOSYS;</div><div class="line"><a name="l02561"></a><span class="lineno"> 2561</span>  <span class="keywordflow">if</span> (in->opcode >= FUSE_MAXOP || !fuse_ll_ops[in->opcode].func)</div><div class="line"><a name="l02562"></a><span class="lineno"> 2562</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02563"></a><span class="lineno"> 2563</span>  <span class="keywordflow">if</span> (in->opcode != FUSE_INTERRUPT) {</div><div class="line"><a name="l02564"></a><span class="lineno"> 2564</span>  <span class="keyword">struct </span>fuse_req *intr;</div><div class="line"><a name="l02565"></a><span class="lineno"> 2565</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02566"></a><span class="lineno"> 2566</span>  intr = check_interrupt(se, req);</div><div class="line"><a name="l02567"></a><span class="lineno"> 2567</span>  list_add_req(req, &se->list);</div><div class="line"><a name="l02568"></a><span class="lineno"> 2568</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02569"></a><span class="lineno"> 2569</span>  <span class="keywordflow">if</span> (intr)</div><div class="line"><a name="l02570"></a><span class="lineno"> 2570</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(intr, EAGAIN);</div><div class="line"><a name="l02571"></a><span class="lineno"> 2571</span>  }</div><div class="line"><a name="l02572"></a><span class="lineno"> 2572</span> </div><div class="line"><a name="l02573"></a><span class="lineno"> 2573</span>  <span class="keywordflow">if</span> ((buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) && write_header_size < buf->size &&</div><div class="line"><a name="l02574"></a><span class="lineno"> 2574</span>  (in->opcode != FUSE_WRITE || !se->op.write_buf) &&</div><div class="line"><a name="l02575"></a><span class="lineno"> 2575</span>  in->opcode != FUSE_NOTIFY_REPLY) {</div><div class="line"><a name="l02576"></a><span class="lineno"> 2576</span>  <span class="keywordtype">void</span> *newmbuf;</div><div class="line"><a name="l02577"></a><span class="lineno"> 2577</span> </div><div class="line"><a name="l02578"></a><span class="lineno"> 2578</span>  err = ENOMEM;</div><div class="line"><a name="l02579"></a><span class="lineno"> 2579</span>  newmbuf = realloc(mbuf, buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>);</div><div class="line"><a name="l02580"></a><span class="lineno"> 2580</span>  <span class="keywordflow">if</span> (newmbuf == NULL)</div><div class="line"><a name="l02581"></a><span class="lineno"> 2581</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02582"></a><span class="lineno"> 2582</span>  mbuf = newmbuf;</div><div class="line"><a name="l02583"></a><span class="lineno"> 2583</span> </div><div class="line"><a name="l02584"></a><span class="lineno"> 2584</span>  tmpbuf = FUSE_BUFVEC_INIT(buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> - write_header_size);</div><div class="line"><a name="l02585"></a><span class="lineno"> 2585</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = (<span class="keywordtype">char</span> *)mbuf + write_header_size;</div><div class="line"><a name="l02586"></a><span class="lineno"> 2586</span> </div><div class="line"><a name="l02587"></a><span class="lineno"> 2587</span>  res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);</div><div class="line"><a name="l02588"></a><span class="lineno"> 2588</span>  err = -res;</div><div class="line"><a name="l02589"></a><span class="lineno"> 2589</span>  <span class="keywordflow">if</span> (res < 0)</div><div class="line"><a name="l02590"></a><span class="lineno"> 2590</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02591"></a><span class="lineno"> 2591</span> </div><div class="line"><a name="l02592"></a><span class="lineno"> 2592</span>  in = mbuf;</div><div class="line"><a name="l02593"></a><span class="lineno"> 2593</span>  }</div><div class="line"><a name="l02594"></a><span class="lineno"> 2594</span> </div><div class="line"><a name="l02595"></a><span class="lineno"> 2595</span>  inarg = (<span class="keywordtype">void</span> *) &in[1];</div><div class="line"><a name="l02596"></a><span class="lineno"> 2596</span>  <span class="keywordflow">if</span> (in->opcode == FUSE_WRITE && se->op.write_buf)</div><div class="line"><a name="l02597"></a><span class="lineno"> 2597</span>  do_write_buf(req, in->nodeid, inarg, buf);</div><div class="line"><a name="l02598"></a><span class="lineno"> 2598</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (in->opcode == FUSE_NOTIFY_REPLY)</div><div class="line"><a name="l02599"></a><span class="lineno"> 2599</span>  do_notify_reply(req, in->nodeid, inarg, buf);</div><div class="line"><a name="l02600"></a><span class="lineno"> 2600</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l02601"></a><span class="lineno"> 2601</span>  fuse_ll_ops[in->opcode].func(req, in->nodeid, inarg);</div><div class="line"><a name="l02602"></a><span class="lineno"> 2602</span> </div><div class="line"><a name="l02603"></a><span class="lineno"> 2603</span> out_free:</div><div class="line"><a name="l02604"></a><span class="lineno"> 2604</span>  free(mbuf);</div><div class="line"><a name="l02605"></a><span class="lineno"> 2605</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l02606"></a><span class="lineno"> 2606</span> </div><div class="line"><a name="l02607"></a><span class="lineno"> 2607</span> reply_err:</div><div class="line"><a name="l02608"></a><span class="lineno"> 2608</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, err);</div><div class="line"><a name="l02609"></a><span class="lineno"> 2609</span> clear_pipe:</div><div class="line"><a name="l02610"></a><span class="lineno"> 2610</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD)</div><div class="line"><a name="l02611"></a><span class="lineno"> 2611</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02612"></a><span class="lineno"> 2612</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l02613"></a><span class="lineno"> 2613</span> }</div><div class="line"><a name="l02614"></a><span class="lineno"> 2614</span> </div><div class="line"><a name="l02615"></a><span class="lineno"> 2615</span> <span class="preprocessor">#define LL_OPTION(n,o,v) \</span></div><div class="line"><a name="l02616"></a><span class="lineno"> 2616</span> <span class="preprocessor"> { n, offsetof(struct fuse_session, o), v }</span></div><div class="line"><a name="l02617"></a><span class="lineno"> 2617</span> </div><div class="line"><a name="l02618"></a><span class="lineno"> 2618</span> <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> fuse_ll_opts[] = {</div><div class="line"><a name="l02619"></a><span class="lineno"> 2619</span>  LL_OPTION(<span class="stringliteral">"debug"</span>, debug, 1),</div><div class="line"><a name="l02620"></a><span class="lineno"> 2620</span>  LL_OPTION(<span class="stringliteral">"-d"</span>, debug, 1),</div><div class="line"><a name="l02621"></a><span class="lineno"> 2621</span>  LL_OPTION(<span class="stringliteral">"--debug"</span>, debug, 1),</div><div class="line"><a name="l02622"></a><span class="lineno"> 2622</span>  LL_OPTION(<span class="stringliteral">"allow_root"</span>, deny_others, 1),</div><div class="line"><a name="l02623"></a><span class="lineno"> 2623</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#aca35962e17d189ceb5447f8eea11bd33">FUSE_OPT_END</a></div><div class="line"><a name="l02624"></a><span class="lineno"> 2624</span> };</div><div class="line"><a name="l02625"></a><span class="lineno"> 2625</span> </div><div class="line"><a name="l02626"></a><span class="lineno"> 2626</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ac6e2d0fde62dcf4f0e57afeabeefd7b1">fuse_lowlevel_version</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l02627"></a><span class="lineno"> 2627</span> {</div><div class="line"><a name="l02628"></a><span class="lineno"> 2628</span>  printf(<span class="stringliteral">"using FUSE kernel interface version %i.%i\n"</span>,</div><div class="line"><a name="l02629"></a><span class="lineno"> 2629</span>  FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION);</div><div class="line"><a name="l02630"></a><span class="lineno"> 2630</span>  fuse_mount_version();</div><div class="line"><a name="l02631"></a><span class="lineno"> 2631</span> }</div><div class="line"><a name="l02632"></a><span class="lineno"> 2632</span> </div><div class="line"><a name="l02633"></a><span class="lineno"> 2633</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a990af0becaba1b5e45781d399720f85e">fuse_lowlevel_help</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l02634"></a><span class="lineno"> 2634</span> {</div><div class="line"><a name="l02635"></a><span class="lineno"> 2635</span>  <span class="comment">/* These are not all options, but the ones that are</span></div><div class="line"><a name="l02636"></a><span class="lineno"> 2636</span> <span class="comment"> potentially of interest to an end-user */</span></div><div class="line"><a name="l02637"></a><span class="lineno"> 2637</span>  printf(</div><div class="line"><a name="l02638"></a><span class="lineno"> 2638</span> <span class="stringliteral">" -o allow_other allow access by all users\n"</span></div><div class="line"><a name="l02639"></a><span class="lineno"> 2639</span> <span class="stringliteral">" -o allow_root allow access by root\n"</span></div><div class="line"><a name="l02640"></a><span class="lineno"> 2640</span> <span class="stringliteral">" -o auto_unmount auto unmount on process termination\n"</span>);</div><div class="line"><a name="l02641"></a><span class="lineno"> 2641</span> }</div><div class="line"><a name="l02642"></a><span class="lineno"> 2642</span> </div><div class="line"><a name="l02643"></a><span class="lineno"> 2643</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a08b5503c4e9656f9c4bc88331233cc65">fuse_session_destroy</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02644"></a><span class="lineno"> 2644</span> {</div><div class="line"><a name="l02645"></a><span class="lineno"> 2645</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l02646"></a><span class="lineno"> 2646</span> </div><div class="line"><a name="l02647"></a><span class="lineno"> 2647</span>  <span class="keywordflow">if</span> (se->got_init && !se->got_destroy) {</div><div class="line"><a name="l02648"></a><span class="lineno"> 2648</span>  <span class="keywordflow">if</span> (se->op.destroy)</div><div class="line"><a name="l02649"></a><span class="lineno"> 2649</span>  se->op.destroy(se->userdata);</div><div class="line"><a name="l02650"></a><span class="lineno"> 2650</span>  }</div><div class="line"><a name="l02651"></a><span class="lineno"> 2651</span>  llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l02652"></a><span class="lineno"> 2652</span>  <span class="keywordflow">if</span> (llp != NULL)</div><div class="line"><a name="l02653"></a><span class="lineno"> 2653</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l02654"></a><span class="lineno"> 2654</span>  pthread_key_delete(se->pipe_key);</div><div class="line"><a name="l02655"></a><span class="lineno"> 2655</span>  pthread_mutex_destroy(&se->lock);</div><div class="line"><a name="l02656"></a><span class="lineno"> 2656</span>  free(se->cuse_data);</div><div class="line"><a name="l02657"></a><span class="lineno"> 2657</span>  <span class="keywordflow">if</span> (se->fd != -1)</div><div class="line"><a name="l02658"></a><span class="lineno"> 2658</span>  close(se->fd);</div><div class="line"><a name="l02659"></a><span class="lineno"> 2659</span>  destroy_mount_opts(se->mo);</div><div class="line"><a name="l02660"></a><span class="lineno"> 2660</span>  free(se);</div><div class="line"><a name="l02661"></a><span class="lineno"> 2661</span> }</div><div class="line"><a name="l02662"></a><span class="lineno"> 2662</span> </div><div class="line"><a name="l02663"></a><span class="lineno"> 2663</span> </div><div class="line"><a name="l02664"></a><span class="lineno"> 2664</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_pipe_destructor(<span class="keywordtype">void</span> *data)</div><div class="line"><a name="l02665"></a><span class="lineno"> 2665</span> {</div><div class="line"><a name="l02666"></a><span class="lineno"> 2666</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = data;</div><div class="line"><a name="l02667"></a><span class="lineno"> 2667</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l02668"></a><span class="lineno"> 2668</span> }</div><div class="line"><a name="l02669"></a><span class="lineno"> 2669</span> </div><div class="line"><a name="l02670"></a><span class="lineno"> 2670</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa434f1c9e7d71c4ed219c4dc3b1deae7">fuse_session_receive_buf</a>(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02671"></a><span class="lineno"> 2671</span> {</div><div class="line"><a name="l02672"></a><span class="lineno"> 2672</span>  <span class="keywordflow">return</span> fuse_session_receive_buf_int(se, buf, NULL);</div><div class="line"><a name="l02673"></a><span class="lineno"> 2673</span> }</div><div class="line"><a name="l02674"></a><span class="lineno"> 2674</span> </div><div class="line"><a name="l02675"></a><span class="lineno"> 2675</span> <span class="keywordtype">int</span> fuse_session_receive_buf_int(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf,</div><div class="line"><a name="l02676"></a><span class="lineno"> 2676</span>  <span class="keyword">struct</span> fuse_chan *ch)</div><div class="line"><a name="l02677"></a><span class="lineno"> 2677</span> {</div><div class="line"><a name="l02678"></a><span class="lineno"> 2678</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02679"></a><span class="lineno"> 2679</span>  ssize_t res;</div><div class="line"><a name="l02680"></a><span class="lineno"> 2680</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l02681"></a><span class="lineno"> 2681</span>  <span class="keywordtype">size_t</span> bufsize = se->bufsize;</div><div class="line"><a name="l02682"></a><span class="lineno"> 2682</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l02683"></a><span class="lineno"> 2683</span>  <span class="keyword">struct </span><a class="code" href="structfuse__buf.html">fuse_buf</a> tmpbuf;</div><div class="line"><a name="l02684"></a><span class="lineno"> 2684</span> </div><div class="line"><a name="l02685"></a><span class="lineno"> 2685</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 14 || !(se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>))</div><div class="line"><a name="l02686"></a><span class="lineno"> 2686</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02687"></a><span class="lineno"> 2687</span> </div><div class="line"><a name="l02688"></a><span class="lineno"> 2688</span>  llp = fuse_ll_get_pipe(se);</div><div class="line"><a name="l02689"></a><span class="lineno"> 2689</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l02690"></a><span class="lineno"> 2690</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02691"></a><span class="lineno"> 2691</span> </div><div class="line"><a name="l02692"></a><span class="lineno"> 2692</span>  <span class="keywordflow">if</span> (llp->size < bufsize) {</div><div class="line"><a name="l02693"></a><span class="lineno"> 2693</span>  <span class="keywordflow">if</span> (llp->can_grow) {</div><div class="line"><a name="l02694"></a><span class="lineno"> 2694</span>  res = fcntl(llp->pipe[0], F_SETPIPE_SZ, bufsize);</div><div class="line"><a name="l02695"></a><span class="lineno"> 2695</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02696"></a><span class="lineno"> 2696</span>  llp->can_grow = 0;</div><div class="line"><a name="l02697"></a><span class="lineno"> 2697</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02698"></a><span class="lineno"> 2698</span>  }</div><div class="line"><a name="l02699"></a><span class="lineno"> 2699</span>  llp->size = res;</div><div class="line"><a name="l02700"></a><span class="lineno"> 2700</span>  }</div><div class="line"><a name="l02701"></a><span class="lineno"> 2701</span>  <span class="keywordflow">if</span> (llp->size < bufsize)</div><div class="line"><a name="l02702"></a><span class="lineno"> 2702</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02703"></a><span class="lineno"> 2703</span>  }</div><div class="line"><a name="l02704"></a><span class="lineno"> 2704</span> </div><div class="line"><a name="l02705"></a><span class="lineno"> 2705</span>  res = splice(ch ? ch->fd : se->fd,</div><div class="line"><a name="l02706"></a><span class="lineno"> 2706</span>  NULL, llp->pipe[1], NULL, bufsize, 0);</div><div class="line"><a name="l02707"></a><span class="lineno"> 2707</span>  err = errno;</div><div class="line"><a name="l02708"></a><span class="lineno"> 2708</span> </div><div class="line"><a name="l02709"></a><span class="lineno"> 2709</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se))</div><div class="line"><a name="l02710"></a><span class="lineno"> 2710</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02711"></a><span class="lineno"> 2711</span> </div><div class="line"><a name="l02712"></a><span class="lineno"> 2712</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02713"></a><span class="lineno"> 2713</span>  <span class="keywordflow">if</span> (err == ENODEV) {</div><div class="line"><a name="l02714"></a><span class="lineno"> 2714</span>  <span class="comment">/* Filesystem was unmounted, or connection was aborted</span></div><div class="line"><a name="l02715"></a><span class="lineno"> 2715</span> <span class="comment"> via /sys/fs/fuse/connections */</span></div><div class="line"><a name="l02716"></a><span class="lineno"> 2716</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l02717"></a><span class="lineno"> 2717</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02718"></a><span class="lineno"> 2718</span>  }</div><div class="line"><a name="l02719"></a><span class="lineno"> 2719</span>  <span class="keywordflow">if</span> (err != EINTR && err != EAGAIN)</div><div class="line"><a name="l02720"></a><span class="lineno"> 2720</span>  perror(<span class="stringliteral">"fuse: splice from device"</span>);</div><div class="line"><a name="l02721"></a><span class="lineno"> 2721</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l02722"></a><span class="lineno"> 2722</span>  }</div><div class="line"><a name="l02723"></a><span class="lineno"> 2723</span> </div><div class="line"><a name="l02724"></a><span class="lineno"> 2724</span>  <span class="keywordflow">if</span> (res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header)) {</div><div class="line"><a name="l02725"></a><span class="lineno"> 2725</span>  fprintf(stderr, <span class="stringliteral">"short splice from fuse device\n"</span>);</div><div class="line"><a name="l02726"></a><span class="lineno"> 2726</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02727"></a><span class="lineno"> 2727</span>  }</div><div class="line"><a name="l02728"></a><span class="lineno"> 2728</span> </div><div class="line"><a name="l02729"></a><span class="lineno"> 2729</span>  tmpbuf = (<span class="keyword">struct </span><a class="code" href="structfuse__buf.html">fuse_buf</a>) {</div><div class="line"><a name="l02730"></a><span class="lineno"> 2730</span>  .size = res,</div><div class="line"><a name="l02731"></a><span class="lineno"> 2731</span>  .flags = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>,</div><div class="line"><a name="l02732"></a><span class="lineno"> 2732</span>  .fd = llp->pipe[0],</div><div class="line"><a name="l02733"></a><span class="lineno"> 2733</span>  };</div><div class="line"><a name="l02734"></a><span class="lineno"> 2734</span> </div><div class="line"><a name="l02735"></a><span class="lineno"> 2735</span>  <span class="comment">/*</span></div><div class="line"><a name="l02736"></a><span class="lineno"> 2736</span> <span class="comment"> * Don't bother with zero copy for small requests.</span></div><div class="line"><a name="l02737"></a><span class="lineno"> 2737</span> <span class="comment"> * fuse_loop_mt() needs to check for FORGET so this more than</span></div><div class="line"><a name="l02738"></a><span class="lineno"> 2738</span> <span class="comment"> * just an optimization.</span></div><div class="line"><a name="l02739"></a><span class="lineno"> 2739</span> <span class="comment"> */</span></div><div class="line"><a name="l02740"></a><span class="lineno"> 2740</span>  <span class="keywordflow">if</span> (res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header) +</div><div class="line"><a name="l02741"></a><span class="lineno"> 2741</span>  <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_write_in) + pagesize) {</div><div class="line"><a name="l02742"></a><span class="lineno"> 2742</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> src = { .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = tmpbuf, .<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> = 1 };</div><div class="line"><a name="l02743"></a><span class="lineno"> 2743</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> dst = { .<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> = 1 };</div><div class="line"><a name="l02744"></a><span class="lineno"> 2744</span> </div><div class="line"><a name="l02745"></a><span class="lineno"> 2745</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02746"></a><span class="lineno"> 2746</span>  buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = malloc(se->bufsize);</div><div class="line"><a name="l02747"></a><span class="lineno"> 2747</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02748"></a><span class="lineno"> 2748</span>  fprintf(stderr,</div><div class="line"><a name="l02749"></a><span class="lineno"> 2749</span>  <span class="stringliteral">"fuse: failed to allocate read buffer\n"</span>);</div><div class="line"><a name="l02750"></a><span class="lineno"> 2750</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02751"></a><span class="lineno"> 2751</span>  }</div><div class="line"><a name="l02752"></a><span class="lineno"> 2752</span>  }</div><div class="line"><a name="l02753"></a><span class="lineno"> 2753</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = se->bufsize;</div><div class="line"><a name="l02754"></a><span class="lineno"> 2754</span>  buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = 0;</div><div class="line"><a name="l02755"></a><span class="lineno"> 2755</span>  dst.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>;</div><div class="line"><a name="l02756"></a><span class="lineno"> 2756</span> </div><div class="line"><a name="l02757"></a><span class="lineno"> 2757</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&dst, &src, 0);</div><div class="line"><a name="l02758"></a><span class="lineno"> 2758</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l02759"></a><span class="lineno"> 2759</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: %s\n"</span>,</div><div class="line"><a name="l02760"></a><span class="lineno"> 2760</span>  strerror(-res));</div><div class="line"><a name="l02761"></a><span class="lineno"> 2761</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02762"></a><span class="lineno"> 2762</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02763"></a><span class="lineno"> 2763</span>  }</div><div class="line"><a name="l02764"></a><span class="lineno"> 2764</span>  <span class="keywordflow">if</span> (res < tmpbuf.size) {</div><div class="line"><a name="l02765"></a><span class="lineno"> 2765</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: short read\n"</span>);</div><div class="line"><a name="l02766"></a><span class="lineno"> 2766</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02767"></a><span class="lineno"> 2767</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02768"></a><span class="lineno"> 2768</span>  }</div><div class="line"><a name="l02769"></a><span class="lineno"> 2769</span>  assert(res == tmpbuf.size);</div><div class="line"><a name="l02770"></a><span class="lineno"> 2770</span> </div><div class="line"><a name="l02771"></a><span class="lineno"> 2771</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02772"></a><span class="lineno"> 2772</span>  <span class="comment">/* Don't overwrite buf->mem, as that would cause a leak */</span></div><div class="line"><a name="l02773"></a><span class="lineno"> 2773</span>  buf-><a class="code" href="structfuse__buf.html#a62b2ae82904ac4355142984b9dd90d68">fd</a> = tmpbuf.fd;</div><div class="line"><a name="l02774"></a><span class="lineno"> 2774</span>  buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = tmpbuf.flags;</div><div class="line"><a name="l02775"></a><span class="lineno"> 2775</span>  }</div><div class="line"><a name="l02776"></a><span class="lineno"> 2776</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = tmpbuf.size;</div><div class="line"><a name="l02777"></a><span class="lineno"> 2777</span> </div><div class="line"><a name="l02778"></a><span class="lineno"> 2778</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02779"></a><span class="lineno"> 2779</span> </div><div class="line"><a name="l02780"></a><span class="lineno"> 2780</span> fallback:</div><div class="line"><a name="l02781"></a><span class="lineno"> 2781</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l02782"></a><span class="lineno"> 2782</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02783"></a><span class="lineno"> 2783</span>  buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = malloc(se->bufsize);</div><div class="line"><a name="l02784"></a><span class="lineno"> 2784</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02785"></a><span class="lineno"> 2785</span>  fprintf(stderr,</div><div class="line"><a name="l02786"></a><span class="lineno"> 2786</span>  <span class="stringliteral">"fuse: failed to allocate read buffer\n"</span>);</div><div class="line"><a name="l02787"></a><span class="lineno"> 2787</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02788"></a><span class="lineno"> 2788</span>  }</div><div class="line"><a name="l02789"></a><span class="lineno"> 2789</span>  }</div><div class="line"><a name="l02790"></a><span class="lineno"> 2790</span> </div><div class="line"><a name="l02791"></a><span class="lineno"> 2791</span> restart:</div><div class="line"><a name="l02792"></a><span class="lineno"> 2792</span>  res = read(ch ? ch->fd : se->fd, buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>, se->bufsize);</div><div class="line"><a name="l02793"></a><span class="lineno"> 2793</span>  err = errno;</div><div class="line"><a name="l02794"></a><span class="lineno"> 2794</span> </div><div class="line"><a name="l02795"></a><span class="lineno"> 2795</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se))</div><div class="line"><a name="l02796"></a><span class="lineno"> 2796</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02797"></a><span class="lineno"> 2797</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02798"></a><span class="lineno"> 2798</span>  <span class="comment">/* ENOENT means the operation was interrupted, it's safe</span></div><div class="line"><a name="l02799"></a><span class="lineno"> 2799</span> <span class="comment"> to restart */</span></div><div class="line"><a name="l02800"></a><span class="lineno"> 2800</span>  <span class="keywordflow">if</span> (err == ENOENT)</div><div class="line"><a name="l02801"></a><span class="lineno"> 2801</span>  <span class="keywordflow">goto</span> restart;</div><div class="line"><a name="l02802"></a><span class="lineno"> 2802</span> </div><div class="line"><a name="l02803"></a><span class="lineno"> 2803</span>  <span class="keywordflow">if</span> (err == ENODEV) {</div><div class="line"><a name="l02804"></a><span class="lineno"> 2804</span>  <span class="comment">/* Filesystem was unmounted, or connection was aborted</span></div><div class="line"><a name="l02805"></a><span class="lineno"> 2805</span> <span class="comment"> via /sys/fs/fuse/connections */</span></div><div class="line"><a name="l02806"></a><span class="lineno"> 2806</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l02807"></a><span class="lineno"> 2807</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02808"></a><span class="lineno"> 2808</span>  }</div><div class="line"><a name="l02809"></a><span class="lineno"> 2809</span>  <span class="comment">/* Errors occurring during normal operation: EINTR (read</span></div><div class="line"><a name="l02810"></a><span class="lineno"> 2810</span> <span class="comment"> interrupted), EAGAIN (nonblocking I/O), ENODEV (filesystem</span></div><div class="line"><a name="l02811"></a><span class="lineno"> 2811</span> <span class="comment"> umounted) */</span></div><div class="line"><a name="l02812"></a><span class="lineno"> 2812</span>  <span class="keywordflow">if</span> (err != EINTR && err != EAGAIN)</div><div class="line"><a name="l02813"></a><span class="lineno"> 2813</span>  perror(<span class="stringliteral">"fuse: reading device"</span>);</div><div class="line"><a name="l02814"></a><span class="lineno"> 2814</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l02815"></a><span class="lineno"> 2815</span>  }</div><div class="line"><a name="l02816"></a><span class="lineno"> 2816</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>) res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header)) {</div><div class="line"><a name="l02817"></a><span class="lineno"> 2817</span>  fprintf(stderr, <span class="stringliteral">"short read on fuse device\n"</span>);</div><div class="line"><a name="l02818"></a><span class="lineno"> 2818</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02819"></a><span class="lineno"> 2819</span>  }</div><div class="line"><a name="l02820"></a><span class="lineno"> 2820</span> </div><div class="line"><a name="l02821"></a><span class="lineno"> 2821</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = res;</div><div class="line"><a name="l02822"></a><span class="lineno"> 2822</span> </div><div class="line"><a name="l02823"></a><span class="lineno"> 2823</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02824"></a><span class="lineno"> 2824</span> }</div><div class="line"><a name="l02825"></a><span class="lineno"> 2825</span> </div><div class="line"><a name="l02826"></a><span class="lineno"> 2826</span> <span class="keyword">struct </span>fuse_session *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a9ee52f81d0c63d9bd46b11314ba596cf">fuse_session_new</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args,</div><div class="line"><a name="l02827"></a><span class="lineno"> 2827</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a> *op,</div><div class="line"><a name="l02828"></a><span class="lineno"> 2828</span>  <span class="keywordtype">size_t</span> op_size, <span class="keywordtype">void</span> *userdata)</div><div class="line"><a name="l02829"></a><span class="lineno"> 2829</span> {</div><div class="line"><a name="l02830"></a><span class="lineno"> 2830</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02831"></a><span class="lineno"> 2831</span>  <span class="keyword">struct </span>fuse_session *se;</div><div class="line"><a name="l02832"></a><span class="lineno"> 2832</span>  <span class="keyword">struct </span>mount_opts *mo;</div><div class="line"><a name="l02833"></a><span class="lineno"> 2833</span> </div><div class="line"><a name="l02834"></a><span class="lineno"> 2834</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a>) < op_size) {</div><div class="line"><a name="l02835"></a><span class="lineno"> 2835</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: library too old, some operations may not work\n"</span>);</div><div class="line"><a name="l02836"></a><span class="lineno"> 2836</span>  op_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a>);</div><div class="line"><a name="l02837"></a><span class="lineno"> 2837</span>  }</div><div class="line"><a name="l02838"></a><span class="lineno"> 2838</span> </div><div class="line"><a name="l02839"></a><span class="lineno"> 2839</span>  <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> == 0) {</div><div class="line"><a name="l02840"></a><span class="lineno"> 2840</span>  fprintf(stderr, <span class="stringliteral">"fuse: empty argv passed to fuse_session_new().\n"</span>);</div><div class="line"><a name="l02841"></a><span class="lineno"> 2841</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l02842"></a><span class="lineno"> 2842</span>  }</div><div class="line"><a name="l02843"></a><span class="lineno"> 2843</span> </div><div class="line"><a name="l02844"></a><span class="lineno"> 2844</span>  se = (<span class="keyword">struct </span>fuse_session *) calloc(1, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_session));</div><div class="line"><a name="l02845"></a><span class="lineno"> 2845</span>  <span class="keywordflow">if</span> (se == NULL) {</div><div class="line"><a name="l02846"></a><span class="lineno"> 2846</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate fuse object\n"</span>);</div><div class="line"><a name="l02847"></a><span class="lineno"> 2847</span>  <span class="keywordflow">goto</span> out1;</div><div class="line"><a name="l02848"></a><span class="lineno"> 2848</span>  }</div><div class="line"><a name="l02849"></a><span class="lineno"> 2849</span>  se->fd = -1;</div><div class="line"><a name="l02850"></a><span class="lineno"> 2850</span>  se->conn.max_write = UINT_MAX;</div><div class="line"><a name="l02851"></a><span class="lineno"> 2851</span>  se->conn.max_readahead = UINT_MAX;</div><div class="line"><a name="l02852"></a><span class="lineno"> 2852</span> </div><div class="line"><a name="l02853"></a><span class="lineno"> 2853</span>  <span class="comment">/* Parse options */</span></div><div class="line"><a name="l02854"></a><span class="lineno"> 2854</span>  <span class="keywordflow">if</span>(<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e">fuse_opt_parse</a>(args, se, fuse_ll_opts, NULL) == -1)</div><div class="line"><a name="l02855"></a><span class="lineno"> 2855</span>  <span class="keywordflow">goto</span> out2;</div><div class="line"><a name="l02856"></a><span class="lineno"> 2856</span>  <span class="keywordflow">if</span>(se->deny_others) {</div><div class="line"><a name="l02857"></a><span class="lineno"> 2857</span>  <span class="comment">/* Allowing access only by root is done by instructing</span></div><div class="line"><a name="l02858"></a><span class="lineno"> 2858</span> <span class="comment"> * kernel to allow access by everyone, and then restricting</span></div><div class="line"><a name="l02859"></a><span class="lineno"> 2859</span> <span class="comment"> * access to root and mountpoint owner in libfuse.</span></div><div class="line"><a name="l02860"></a><span class="lineno"> 2860</span> <span class="comment"> */</span></div><div class="line"><a name="l02861"></a><span class="lineno"> 2861</span>  <span class="comment">// We may be adding the option a second time, but</span></div><div class="line"><a name="l02862"></a><span class="lineno"> 2862</span>  <span class="comment">// that doesn't hurt.</span></div><div class="line"><a name="l02863"></a><span class="lineno"> 2863</span>  <span class="keywordflow">if</span>(<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(args, <span class="stringliteral">"-oallow_other"</span>) == -1)</div><div class="line"><a name="l02864"></a><span class="lineno"> 2864</span>  <span class="keywordflow">goto</span> out2;</div><div class="line"><a name="l02865"></a><span class="lineno"> 2865</span>  }</div><div class="line"><a name="l02866"></a><span class="lineno"> 2866</span>  mo = parse_mount_opts(args);</div><div class="line"><a name="l02867"></a><span class="lineno"> 2867</span>  <span class="keywordflow">if</span> (mo == NULL)</div><div class="line"><a name="l02868"></a><span class="lineno"> 2868</span>  <span class="keywordflow">goto</span> out3;</div><div class="line"><a name="l02869"></a><span class="lineno"> 2869</span> </div><div class="line"><a name="l02870"></a><span class="lineno"> 2870</span>  <span class="keywordflow">if</span>(args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> == 1 &&</div><div class="line"><a name="l02871"></a><span class="lineno"> 2871</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[0][0] == <span class="charliteral">'-'</span>) {</div><div class="line"><a name="l02872"></a><span class="lineno"> 2872</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: argv[0] looks like an option, but "</span></div><div class="line"><a name="l02873"></a><span class="lineno"> 2873</span>  <span class="stringliteral">"will be ignored\n"</span>);</div><div class="line"><a name="l02874"></a><span class="lineno"> 2874</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> != 1) {</div><div class="line"><a name="l02875"></a><span class="lineno"> 2875</span>  <span class="keywordtype">int</span> i;</div><div class="line"><a name="l02876"></a><span class="lineno"> 2876</span>  fprintf(stderr, <span class="stringliteral">"fuse: unknown option(s): `"</span>);</div><div class="line"><a name="l02877"></a><span class="lineno"> 2877</span>  <span class="keywordflow">for</span>(i = 1; i < args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>-1; i++)</div><div class="line"><a name="l02878"></a><span class="lineno"> 2878</span>  fprintf(stderr, <span class="stringliteral">"%s "</span>, args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l02879"></a><span class="lineno"> 2879</span>  fprintf(stderr, <span class="stringliteral">"%s'\n"</span>, args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l02880"></a><span class="lineno"> 2880</span>  <span class="keywordflow">goto</span> out4;</div><div class="line"><a name="l02881"></a><span class="lineno"> 2881</span>  }</div><div class="line"><a name="l02882"></a><span class="lineno"> 2882</span> </div><div class="line"><a name="l02883"></a><span class="lineno"> 2883</span>  <span class="keywordflow">if</span> (se->debug)</div><div class="line"><a name="l02884"></a><span class="lineno"> 2884</span>  fprintf(stderr, <span class="stringliteral">"FUSE library version: %s\n"</span>, PACKAGE_VERSION);</div><div class="line"><a name="l02885"></a><span class="lineno"> 2885</span> </div><div class="line"><a name="l02886"></a><span class="lineno"> 2886</span>  se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() +</div><div class="line"><a name="l02887"></a><span class="lineno"> 2887</span>  FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l02888"></a><span class="lineno"> 2888</span> </div><div class="line"><a name="l02889"></a><span class="lineno"> 2889</span>  list_init_req(&se->list);</div><div class="line"><a name="l02890"></a><span class="lineno"> 2890</span>  list_init_req(&se->interrupts);</div><div class="line"><a name="l02891"></a><span class="lineno"> 2891</span>  list_init_nreq(&se->notify_list);</div><div class="line"><a name="l02892"></a><span class="lineno"> 2892</span>  se->notify_ctr = 1;</div><div class="line"><a name="l02893"></a><span class="lineno"> 2893</span>  fuse_mutex_init(&se->lock);</div><div class="line"><a name="l02894"></a><span class="lineno"> 2894</span> </div><div class="line"><a name="l02895"></a><span class="lineno"> 2895</span>  err = pthread_key_create(&se->pipe_key, fuse_ll_pipe_destructor);</div><div class="line"><a name="l02896"></a><span class="lineno"> 2896</span>  <span class="keywordflow">if</span> (err) {</div><div class="line"><a name="l02897"></a><span class="lineno"> 2897</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to create thread specific key: %s\n"</span>,</div><div class="line"><a name="l02898"></a><span class="lineno"> 2898</span>  strerror(err));</div><div class="line"><a name="l02899"></a><span class="lineno"> 2899</span>  <span class="keywordflow">goto</span> out5;</div><div class="line"><a name="l02900"></a><span class="lineno"> 2900</span>  }</div><div class="line"><a name="l02901"></a><span class="lineno"> 2901</span> </div><div class="line"><a name="l02902"></a><span class="lineno"> 2902</span>  memcpy(&se->op, op, op_size);</div><div class="line"><a name="l02903"></a><span class="lineno"> 2903</span>  se->owner = getuid();</div><div class="line"><a name="l02904"></a><span class="lineno"> 2904</span>  se->userdata = userdata;</div><div class="line"><a name="l02905"></a><span class="lineno"> 2905</span> </div><div class="line"><a name="l02906"></a><span class="lineno"> 2906</span>  se->mo = mo;</div><div class="line"><a name="l02907"></a><span class="lineno"> 2907</span>  <span class="keywordflow">return</span> se;</div><div class="line"><a name="l02908"></a><span class="lineno"> 2908</span> </div><div class="line"><a name="l02909"></a><span class="lineno"> 2909</span> out5:</div><div class="line"><a name="l02910"></a><span class="lineno"> 2910</span>  pthread_mutex_destroy(&se->lock);</div><div class="line"><a name="l02911"></a><span class="lineno"> 2911</span> out4:</div><div class="line"><a name="l02912"></a><span class="lineno"> 2912</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(args);</div><div class="line"><a name="l02913"></a><span class="lineno"> 2913</span> out3:</div><div class="line"><a name="l02914"></a><span class="lineno"> 2914</span>  free(mo);</div><div class="line"><a name="l02915"></a><span class="lineno"> 2915</span> out2:</div><div class="line"><a name="l02916"></a><span class="lineno"> 2916</span>  free(se);</div><div class="line"><a name="l02917"></a><span class="lineno"> 2917</span> out1:</div><div class="line"><a name="l02918"></a><span class="lineno"> 2918</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l02919"></a><span class="lineno"> 2919</span> }</div><div class="line"><a name="l02920"></a><span class="lineno"> 2920</span> </div><div class="line"><a name="l02921"></a><span class="lineno"> 2921</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa6d77679a110582684e9ca2da623bbc2">fuse_session_mount</a>(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">const</span> <span class="keywordtype">char</span> *mountpoint)</div><div class="line"><a name="l02922"></a><span class="lineno"> 2922</span> {</div><div class="line"><a name="l02923"></a><span class="lineno"> 2923</span>  <span class="keywordtype">int</span> fd;</div><div class="line"><a name="l02924"></a><span class="lineno"> 2924</span> </div><div class="line"><a name="l02925"></a><span class="lineno"> 2925</span>  <span class="comment">/*</span></div><div class="line"><a name="l02926"></a><span class="lineno"> 2926</span> <span class="comment"> * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos</span></div><div class="line"><a name="l02927"></a><span class="lineno"> 2927</span> <span class="comment"> * would ensue.</span></div><div class="line"><a name="l02928"></a><span class="lineno"> 2928</span> <span class="comment"> */</span></div><div class="line"><a name="l02929"></a><span class="lineno"> 2929</span>  <span class="keywordflow">do</span> {</div><div class="line"><a name="l02930"></a><span class="lineno"> 2930</span>  fd = open(<span class="stringliteral">"/dev/null"</span>, O_RDWR);</div><div class="line"><a name="l02931"></a><span class="lineno"> 2931</span>  <span class="keywordflow">if</span> (fd > 2)</div><div class="line"><a name="l02932"></a><span class="lineno"> 2932</span>  close(fd);</div><div class="line"><a name="l02933"></a><span class="lineno"> 2933</span>  } <span class="keywordflow">while</span> (fd >= 0 && fd <= 2);</div><div class="line"><a name="l02934"></a><span class="lineno"> 2934</span> </div><div class="line"><a name="l02935"></a><span class="lineno"> 2935</span>  <span class="comment">/*</span></div><div class="line"><a name="l02936"></a><span class="lineno"> 2936</span> <span class="comment"> * To allow FUSE daemons to run without privileges, the caller may open</span></div><div class="line"><a name="l02937"></a><span class="lineno"> 2937</span> <span class="comment"> * /dev/fuse before launching the file system and pass on the file</span></div><div class="line"><a name="l02938"></a><span class="lineno"> 2938</span> <span class="comment"> * descriptor by specifying /dev/fd/N as the mount point. Note that the</span></div><div class="line"><a name="l02939"></a><span class="lineno"> 2939</span> <span class="comment"> * parent process takes care of performing the mount in this case.</span></div><div class="line"><a name="l02940"></a><span class="lineno"> 2940</span> <span class="comment"> */</span></div><div class="line"><a name="l02941"></a><span class="lineno"> 2941</span>  fd = fuse_mnt_parse_fuse_fd(mountpoint);</div><div class="line"><a name="l02942"></a><span class="lineno"> 2942</span>  <span class="keywordflow">if</span> (fd != -1) {</div><div class="line"><a name="l02943"></a><span class="lineno"> 2943</span>  <span class="keywordflow">if</span> (fcntl(fd, F_GETFD) == -1) {</div><div class="line"><a name="l02944"></a><span class="lineno"> 2944</span>  fprintf(stderr,</div><div class="line"><a name="l02945"></a><span class="lineno"> 2945</span>  <span class="stringliteral">"fuse: Invalid file descriptor /dev/fd/%u\n"</span>,</div><div class="line"><a name="l02946"></a><span class="lineno"> 2946</span>  fd);</div><div class="line"><a name="l02947"></a><span class="lineno"> 2947</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02948"></a><span class="lineno"> 2948</span>  }</div><div class="line"><a name="l02949"></a><span class="lineno"> 2949</span>  se->fd = fd;</div><div class="line"><a name="l02950"></a><span class="lineno"> 2950</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02951"></a><span class="lineno"> 2951</span>  }</div><div class="line"><a name="l02952"></a><span class="lineno"> 2952</span> </div><div class="line"><a name="l02953"></a><span class="lineno"> 2953</span>  <span class="comment">/* Open channel */</span></div><div class="line"><a name="l02954"></a><span class="lineno"> 2954</span>  fd = fuse_kern_mount(mountpoint, se->mo);</div><div class="line"><a name="l02955"></a><span class="lineno"> 2955</span>  <span class="keywordflow">if</span> (fd == -1)</div><div class="line"><a name="l02956"></a><span class="lineno"> 2956</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02957"></a><span class="lineno"> 2957</span>  se->fd = fd;</div><div class="line"><a name="l02958"></a><span class="lineno"> 2958</span> </div><div class="line"><a name="l02959"></a><span class="lineno"> 2959</span>  <span class="comment">/* Save mountpoint */</span></div><div class="line"><a name="l02960"></a><span class="lineno"> 2960</span>  se->mountpoint = strdup(mountpoint);</div><div class="line"><a name="l02961"></a><span class="lineno"> 2961</span>  <span class="keywordflow">if</span> (se->mountpoint == NULL)</div><div class="line"><a name="l02962"></a><span class="lineno"> 2962</span>  <span class="keywordflow">goto</span> error_out;</div><div class="line"><a name="l02963"></a><span class="lineno"> 2963</span> </div><div class="line"><a name="l02964"></a><span class="lineno"> 2964</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02965"></a><span class="lineno"> 2965</span> </div><div class="line"><a name="l02966"></a><span class="lineno"> 2966</span> error_out:</div><div class="line"><a name="l02967"></a><span class="lineno"> 2967</span>  fuse_kern_unmount(mountpoint, fd);</div><div class="line"><a name="l02968"></a><span class="lineno"> 2968</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02969"></a><span class="lineno"> 2969</span> }</div><div class="line"><a name="l02970"></a><span class="lineno"> 2970</span> </div><div class="line"><a name="l02971"></a><span class="lineno"> 2971</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a4bf19badb53d92d31d6b2fb131546a2d">fuse_session_fd</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02972"></a><span class="lineno"> 2972</span> {</div><div class="line"><a name="l02973"></a><span class="lineno"> 2973</span>  <span class="keywordflow">return</span> se->fd;</div><div class="line"><a name="l02974"></a><span class="lineno"> 2974</span> }</div><div class="line"><a name="l02975"></a><span class="lineno"> 2975</span> </div><div class="line"><a name="l02976"></a><span class="lineno"> 2976</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a6c10d942751ddb214863a8b5e53de5e8">fuse_session_unmount</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02977"></a><span class="lineno"> 2977</span> {</div><div class="line"><a name="l02978"></a><span class="lineno"> 2978</span>  <span class="keywordflow">if</span> (se->mountpoint != NULL) {</div><div class="line"><a name="l02979"></a><span class="lineno"> 2979</span>  fuse_kern_unmount(se->mountpoint, se->fd);</div><div class="line"><a name="l02980"></a><span class="lineno"> 2980</span>  free(se->mountpoint);</div><div class="line"><a name="l02981"></a><span class="lineno"> 2981</span>  se->mountpoint = NULL;</div><div class="line"><a name="l02982"></a><span class="lineno"> 2982</span>  }</div><div class="line"><a name="l02983"></a><span class="lineno"> 2983</span> }</div><div class="line"><a name="l02984"></a><span class="lineno"> 2984</span> </div><div class="line"><a name="l02985"></a><span class="lineno"> 2985</span> <span class="preprocessor">#ifdef linux</span></div><div class="line"><a name="l02986"></a><span class="lineno"> 2986</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a57f4dabcf044aafcdba6c4682b3a1869">fuse_req_getgroups</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> size, gid_t list[])</div><div class="line"><a name="l02987"></a><span class="lineno"> 2987</span> {</div><div class="line"><a name="l02988"></a><span class="lineno"> 2988</span>  <span class="keywordtype">char</span> *buf;</div><div class="line"><a name="l02989"></a><span class="lineno"> 2989</span>  <span class="keywordtype">size_t</span> bufsize = 1024;</div><div class="line"><a name="l02990"></a><span class="lineno"> 2990</span>  <span class="keywordtype">char</span> path[128];</div><div class="line"><a name="l02991"></a><span class="lineno"> 2991</span>  <span class="keywordtype">int</span> ret;</div><div class="line"><a name="l02992"></a><span class="lineno"> 2992</span>  <span class="keywordtype">int</span> fd;</div><div class="line"><a name="l02993"></a><span class="lineno"> 2993</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> pid = req->ctx.pid;</div><div class="line"><a name="l02994"></a><span class="lineno"> 2994</span>  <span class="keywordtype">char</span> *s;</div><div class="line"><a name="l02995"></a><span class="lineno"> 2995</span> </div><div class="line"><a name="l02996"></a><span class="lineno"> 2996</span>  sprintf(path, <span class="stringliteral">"/proc/%lu/task/%lu/status"</span>, pid, pid);</div><div class="line"><a name="l02997"></a><span class="lineno"> 2997</span> </div><div class="line"><a name="l02998"></a><span class="lineno"> 2998</span> retry:</div><div class="line"><a name="l02999"></a><span class="lineno"> 2999</span>  buf = malloc(bufsize);</div><div class="line"><a name="l03000"></a><span class="lineno"> 3000</span>  <span class="keywordflow">if</span> (buf == NULL)</div><div class="line"><a name="l03001"></a><span class="lineno"> 3001</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l03002"></a><span class="lineno"> 3002</span> </div><div class="line"><a name="l03003"></a><span class="lineno"> 3003</span>  ret = -EIO;</div><div class="line"><a name="l03004"></a><span class="lineno"> 3004</span>  fd = open(path, O_RDONLY);</div><div class="line"><a name="l03005"></a><span class="lineno"> 3005</span>  <span class="keywordflow">if</span> (fd == -1)</div><div class="line"><a name="l03006"></a><span class="lineno"> 3006</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03007"></a><span class="lineno"> 3007</span> </div><div class="line"><a name="l03008"></a><span class="lineno"> 3008</span>  ret = read(fd, buf, bufsize);</div><div class="line"><a name="l03009"></a><span class="lineno"> 3009</span>  close(fd);</div><div class="line"><a name="l03010"></a><span class="lineno"> 3010</span>  <span class="keywordflow">if</span> (ret < 0) {</div><div class="line"><a name="l03011"></a><span class="lineno"> 3011</span>  ret = -EIO;</div><div class="line"><a name="l03012"></a><span class="lineno"> 3012</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03013"></a><span class="lineno"> 3013</span>  }</div><div class="line"><a name="l03014"></a><span class="lineno"> 3014</span> </div><div class="line"><a name="l03015"></a><span class="lineno"> 3015</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>)ret == bufsize) {</div><div class="line"><a name="l03016"></a><span class="lineno"> 3016</span>  free(buf);</div><div class="line"><a name="l03017"></a><span class="lineno"> 3017</span>  bufsize *= 4;</div><div class="line"><a name="l03018"></a><span class="lineno"> 3018</span>  <span class="keywordflow">goto</span> retry;</div><div class="line"><a name="l03019"></a><span class="lineno"> 3019</span>  }</div><div class="line"><a name="l03020"></a><span class="lineno"> 3020</span> </div><div class="line"><a name="l03021"></a><span class="lineno"> 3021</span>  ret = -EIO;</div><div class="line"><a name="l03022"></a><span class="lineno"> 3022</span>  s = strstr(buf, <span class="stringliteral">"\nGroups:"</span>);</div><div class="line"><a name="l03023"></a><span class="lineno"> 3023</span>  <span class="keywordflow">if</span> (s == NULL)</div><div class="line"><a name="l03024"></a><span class="lineno"> 3024</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03025"></a><span class="lineno"> 3025</span> </div><div class="line"><a name="l03026"></a><span class="lineno"> 3026</span>  s += 8;</div><div class="line"><a name="l03027"></a><span class="lineno"> 3027</span>  ret = 0;</div><div class="line"><a name="l03028"></a><span class="lineno"> 3028</span>  <span class="keywordflow">while</span> (1) {</div><div class="line"><a name="l03029"></a><span class="lineno"> 3029</span>  <span class="keywordtype">char</span> *end;</div><div class="line"><a name="l03030"></a><span class="lineno"> 3030</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> val = strtoul(s, &end, 0);</div><div class="line"><a name="l03031"></a><span class="lineno"> 3031</span>  <span class="keywordflow">if</span> (end == s)</div><div class="line"><a name="l03032"></a><span class="lineno"> 3032</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l03033"></a><span class="lineno"> 3033</span> </div><div class="line"><a name="l03034"></a><span class="lineno"> 3034</span>  s = end;</div><div class="line"><a name="l03035"></a><span class="lineno"> 3035</span>  <span class="keywordflow">if</span> (ret < size)</div><div class="line"><a name="l03036"></a><span class="lineno"> 3036</span>  list[ret] = val;</div><div class="line"><a name="l03037"></a><span class="lineno"> 3037</span>  ret++;</div><div class="line"><a name="l03038"></a><span class="lineno"> 3038</span>  }</div><div class="line"><a name="l03039"></a><span class="lineno"> 3039</span> </div><div class="line"><a name="l03040"></a><span class="lineno"> 3040</span> out_free:</div><div class="line"><a name="l03041"></a><span class="lineno"> 3041</span>  free(buf);</div><div class="line"><a name="l03042"></a><span class="lineno"> 3042</span>  <span class="keywordflow">return</span> ret;</div><div class="line"><a name="l03043"></a><span class="lineno"> 3043</span> }</div><div class="line"><a name="l03044"></a><span class="lineno"> 3044</span> <span class="preprocessor">#else </span><span class="comment">/* linux */</span><span class="preprocessor"></span></div><div class="line"><a name="l03045"></a><span class="lineno"> 3045</span> <span class="comment">/*</span></div><div class="line"><a name="l03046"></a><span class="lineno"> 3046</span> <span class="comment"> * This is currently not implemented on other than Linux...</span></div><div class="line"><a name="l03047"></a><span class="lineno"> 3047</span> <span class="comment"> */</span></div><div class="line"><a name="l03048"></a><span class="lineno"> 3048</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a57f4dabcf044aafcdba6c4682b3a1869">fuse_req_getgroups</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> size, gid_t list[])</div><div class="line"><a name="l03049"></a><span class="lineno"> 3049</span> {</div><div class="line"><a name="l03050"></a><span class="lineno"> 3050</span>  (void) req; (void) size; (void) list;</div><div class="line"><a name="l03051"></a><span class="lineno"> 3051</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l03052"></a><span class="lineno"> 3052</span> }</div><div class="line"><a name="l03053"></a><span class="lineno"> 3053</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l03054"></a><span class="lineno"> 3054</span> </div><div class="line"><a name="l03055"></a><span class="lineno"> 3055</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03056"></a><span class="lineno"> 3056</span> {</div><div class="line"><a name="l03057"></a><span class="lineno"> 3057</span>  se->exited = 1;</div><div class="line"><a name="l03058"></a><span class="lineno"> 3058</span> }</div><div class="line"><a name="l03059"></a><span class="lineno"> 3059</span> </div><div class="line"><a name="l03060"></a><span class="lineno"> 3060</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab3d015de77ae0edeb3157321e7a5c434">fuse_session_reset</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03061"></a><span class="lineno"> 3061</span> {</div><div class="line"><a name="l03062"></a><span class="lineno"> 3062</span>  se->exited = 0;</div><div class="line"><a name="l03063"></a><span class="lineno"> 3063</span>  se->error = 0;</div><div class="line"><a name="l03064"></a><span class="lineno"> 3064</span> }</div><div class="line"><a name="l03065"></a><span class="lineno"> 3065</span> </div><div class="line"><a name="l03066"></a><span class="lineno"> 3066</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03067"></a><span class="lineno"> 3067</span> {</div><div class="line"><a name="l03068"></a><span class="lineno"> 3068</span>  <span class="keywordflow">return</span> se->exited;</div><div class="line"><a name="l03069"></a><span class="lineno"> 3069</span> }</div><div class="ttc" id="fuse-3_86_80_2include_2fuse__lowlevel_8h_html_ad1d1963190eb93ae5667d32d2b387ca1"><div class="ttname"><a href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1d1963190eb93ae5667d32d2b387ca1">fuse_req_ctx</a></div><div class="ttdeci">const struct fuse_ctx * fuse_req_ctx(fuse_req_t req)</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2lib_2fuse__lowlevel_8c_source.html#l02365">fuse_lowlevel.c:2365</a></div></div> fuse3-3.10.0/doc/html/fuse-3_86_81_2lib_2fuse__lowlevel_8c_source.html-49-<div class="ttc" id="structfuse__bufvec_html_a0fbb583168d52562f0f848562ecf63bc"><div class="ttname"><a href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">fuse_bufvec::off</a></div><div class="ttdeci">size_t off</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__common_8h_source.html#l00710">fuse_common.h:710</a></div></div> ############################################## fuse3-3.10.0/doc/html/fuse-3_86_82_2lib_2fuse__lowlevel_8c_source.html-47-<div class="contents"> fuse3-3.10.0/doc/html/fuse-3_86_82_2lib_2fuse__lowlevel_8c_source.html:48:<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> FUSE: Filesystem in Userspace</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> Implementation of (most of) the low-level FUSE API. The session loop</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> functions are implemented in separate files.</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> This program can be distributed under the terms of the GNU LGPLv2.</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> See the file COPYING.LIB</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">*/</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#define _GNU_SOURCE</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "config.h"</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include "fuse_i.h"</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include "fuse_kernel.h"</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include "fuse_opt.h"</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include "fuse_misc.h"</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include "mount_util.h"</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <stdio.h></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include <stddef.h></span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <unistd.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <limits.h></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <errno.h></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <assert.h></span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include <sys/file.h></span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#ifndef F_LINUX_SPECIFIC_BASE</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#define F_LINUX_SPECIFIC_BASE 1024</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#ifndef F_SETPIPE_SZ</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#define PARAM(inarg) (((char *)(inarg)) + sizeof(*(inarg)))</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor">#define OFFSET_MAX 0x7fffffffffffffffLL</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor">#define container_of(ptr, type, member) ({ \</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor"> const typeof( ((type *)0)->member ) *__mptr = (ptr); \</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="preprocessor"> (type *)( (char *)__mptr - offsetof(type,member) );})</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="keyword">struct </span>fuse_pollhandle {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  uint64_t kh;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">struct </span>fuse_session *se;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> };</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> pagesize;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="keyword">static</span> __attribute__((constructor)) <span class="keywordtype">void</span> fuse_ll_init_pagesize(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  pagesize = getpagesize();</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> }</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> </div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_stat(<span class="keyword">const</span> <span class="keyword">struct</span> stat *stbuf, <span class="keyword">struct</span> fuse_attr *attr)</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  attr->ino = stbuf->st_ino;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  attr->mode = stbuf->st_mode;</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  attr->nlink = stbuf->st_nlink;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  attr->uid = stbuf->st_uid;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  attr->gid = stbuf->st_gid;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  attr->rdev = stbuf->st_rdev;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  attr->size = stbuf->st_size;</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  attr->blksize = stbuf->st_blksize;</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  attr->blocks = stbuf->st_blocks;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  attr->atime = stbuf->st_atime;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  attr->mtime = stbuf->st_mtime;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  attr->ctime = stbuf->st_ctime;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  attr->atimensec = ST_ATIM_NSEC(stbuf);</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  attr->mtimensec = ST_MTIM_NSEC(stbuf);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  attr->ctimensec = ST_CTIM_NSEC(stbuf);</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> }</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_attr(<span class="keyword">const</span> <span class="keyword">struct</span> fuse_setattr_in *attr, <span class="keyword">struct</span> stat *stbuf)</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> {</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  stbuf->st_mode = attr->mode;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  stbuf->st_uid = attr->uid;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  stbuf->st_gid = attr->gid;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  stbuf->st_size = attr->size;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  stbuf->st_atime = attr->atime;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  stbuf->st_mtime = attr->mtime;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  stbuf->st_ctime = attr->ctime;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  ST_ATIM_NSEC_SET(stbuf, attr->atimensec);</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  ST_MTIM_NSEC_SET(stbuf, attr->mtimensec);</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  ST_CTIM_NSEC_SET(stbuf, attr->ctimensec);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> }</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> iov_length(<span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> {</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordtype">size_t</span> seg;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordtype">size_t</span> ret = 0;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">for</span> (seg = 0; seg < count; seg++)</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  ret += iov[seg].iov_len;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordflow">return</span> ret;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> }</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_init_req(<span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> {</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  req->next = req;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  req->prev = req;</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> }</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> </div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_del_req(<span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> {</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keyword">struct </span>fuse_req *prev = req->prev;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keyword">struct </span>fuse_req *next = req->next;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  prev->next = next;</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  next->prev = prev;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> }</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> </div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_add_req(<span class="keyword">struct</span> fuse_req *req, <span class="keyword">struct</span> fuse_req *next)</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> {</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keyword">struct </span>fuse_req *prev = next->prev;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  req->next = next;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  req->prev = prev;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  prev->next = req;</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  next->prev = req;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> }</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="keyword">static</span> <span class="keywordtype">void</span> destroy_req(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> {</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  pthread_mutex_destroy(&req->lock);</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  free(req);</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> }</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="keywordtype">void</span> fuse_free_req(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> {</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordtype">int</span> ctr;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  req->u.ni.func = NULL;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  req->u.ni.data = NULL;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  list_del_req(req);</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  ctr = --req->ctr;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  fuse_chan_put(req->ch);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  req->ch = NULL;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordflow">if</span> (!ctr)</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  destroy_req(req);</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> }</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_req *fuse_ll_alloc_req(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> {</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keyword">struct </span>fuse_req *req;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  req = (<span class="keyword">struct </span>fuse_req *) calloc(1, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_req));</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">if</span> (req == NULL) {</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate request\n"</span>);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  req->se = se;</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  req->ctr = 1;</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  list_init_req(req);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  fuse_mutex_init(&req->lock);</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">return</span> req;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> }</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> </div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="comment">/* Send data. If *ch* is NULL, send via session master fd */</span></div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_msg(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> {</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="keyword">struct </span>fuse_out_header *out = iov[0].iov_base;</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> </div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  out->len = iov_length(iov, count);</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordflow">if</span> (out->unique == 0) {</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  fprintf(stderr, <span class="stringliteral">"NOTIFY: code=%d length=%u\n"</span>,</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  out->error, out->len);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (out->error) {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  fprintf(stderr,</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="stringliteral">" unique: %llu, error: %i (%s), outsize: %i\n"</span>,</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->error,</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  strerror(-out->error), out->len);</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  fprintf(stderr,</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="stringliteral">" unique: %llu, success, outsize: %i\n"</span>,</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->len);</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  }</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  }</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> </div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  ssize_t res = writev(ch ? ch->fd : se->fd,</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  iov, count);</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="keywordtype">int</span> err = errno;</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> </div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  assert(se != NULL);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="comment">/* ENOENT means the operation was interrupted */</span></div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (!<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se) && err != ENOENT)</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  perror(<span class="stringliteral">"fuse: writing device"</span>);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> }</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> </div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> </div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="keywordtype">int</span> fuse_send_reply_iov_nofree(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> {</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keywordflow">if</span> (error <= -1000 || error > 0) {</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  fprintf(stderr, <span class="stringliteral">"fuse: bad error value: %i\n"</span>, error);</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  error = -ERANGE;</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  }</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span> </div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  out.unique = req->unique;</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  out.error = error;</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> </div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span> </div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="keywordflow">return</span> fuse_send_msg(req->se, req->ch, iov, count);</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> }</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply_iov(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> {</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span> </div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  res = fuse_send_reply_iov_nofree(req, error, iov, count);</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  fuse_free_req(req);</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> }</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span> </div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> error, <span class="keyword">const</span> <span class="keywordtype">void</span> *arg,</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="keywordtype">size_t</span> argsize)</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span> {</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keywordtype">int</span> count = 1;</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">if</span> (argsize) {</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  iov[1].iov_base = (<span class="keywordtype">void</span> *) arg;</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  iov[1].iov_len = argsize;</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  count++;</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  }</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <span class="keywordflow">return</span> send_reply_iov(req, error, iov, count);</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span> }</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span> </div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a5fbbf591a55f09c02cd54d34bdbfe0e9">fuse_reply_iov</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> {</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  <span class="keyword">struct </span>iovec *padded_iov;</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span> </div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  padded_iov = malloc((count + 1) * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <span class="keywordflow">if</span> (padded_iov == NULL)</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span> </div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  memcpy(padded_iov + 1, iov, count * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  count++;</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span> </div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  res = send_reply_iov(req, 0, padded_iov, count);</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  free(padded_iov);</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span> </div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span> }</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span> </div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span> <span class="comment">/* `buf` is allowed to be empty so that the proper size may be</span></div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span> <span class="comment"> allocated by the caller */</span></div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span> <span class="keywordtype">size_t</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1957bcc8ece8c90f16c42c4daf3053f">fuse_add_direntry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> bufsize,</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> <span class="keyword">struct</span> stat *stbuf, off_t off)</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> {</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  (void)req;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <span class="keywordtype">size_t</span> namelen;</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="keywordtype">size_t</span> entlen;</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  <span class="keywordtype">size_t</span> entlen_padded;</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keyword">struct </span>fuse_dirent *dirent;</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span> </div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  namelen = strlen(name);</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  entlen = FUSE_NAME_OFFSET + namelen;</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  entlen_padded = FUSE_DIRENT_ALIGN(entlen);</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span> </div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keywordflow">if</span> ((buf == NULL) || (entlen_padded > bufsize))</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span> </div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  dirent = (<span class="keyword">struct </span>fuse_dirent*) buf;</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  dirent->ino = stbuf->st_ino;</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  dirent->off = off;</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  dirent->namelen = namelen;</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  dirent->type = (stbuf->st_mode & S_IFMT) >> 12;</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  strncpy(dirent->name, name, namelen);</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  memset(dirent->name + namelen, 0, entlen_padded - entlen);</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span> </div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> }</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> </div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_statfs(<span class="keyword">const</span> <span class="keyword">struct</span> statvfs *stbuf,</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <span class="keyword">struct</span> fuse_kstatfs *kstatfs)</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span> {</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  kstatfs->bsize = stbuf->f_bsize;</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  kstatfs->frsize = stbuf->f_frsize;</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  kstatfs->blocks = stbuf->f_blocks;</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  kstatfs->bfree = stbuf->f_bfree;</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  kstatfs->bavail = stbuf->f_bavail;</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  kstatfs->files = stbuf->f_files;</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  kstatfs->ffree = stbuf->f_ffree;</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  kstatfs->namelen = stbuf->f_namemax;</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> }</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span> </div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_reply_ok(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keywordtype">void</span> *arg, <span class="keywordtype">size_t</span> argsize)</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span> {</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="keywordflow">return</span> send_reply(req, 0, arg, argsize);</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> }</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> </div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> err)</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span> {</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  <span class="keywordflow">return</span> send_reply(req, -err, NULL, 0);</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span> }</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span> </div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span> {</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  fuse_free_req(req);</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span> }</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span> </div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> calc_timeout_sec(<span class="keywordtype">double</span> t)</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span> {</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  <span class="keywordflow">if</span> (t > (<span class="keywordtype">double</span>) ULONG_MAX)</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  <span class="keywordflow">return</span> ULONG_MAX;</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (t < 0.0)</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) t;</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span> }</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> </div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> calc_timeout_nsec(<span class="keywordtype">double</span> t)</div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span> {</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  <span class="keywordtype">double</span> f = t - (double) calc_timeout_sec(t);</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordflow">if</span> (f < 0.0)</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (f >= 0.999999999)</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keywordflow">return</span> 999999999;</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">return</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>) (f * 1.0e9);</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span> }</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span> </div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fill_entry(<span class="keyword">struct</span> fuse_entry_out *arg,</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e)</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> {</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  arg->nodeid = e-><a class="code" href="structfuse__entry__param.html#a285ba89754871772d940fa4fb736bce3">ino</a>;</div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  arg->generation = e-><a class="code" href="structfuse__entry__param.html#a4c673ec62c76f7d63d326407beb1b463">generation</a>;</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  arg->entry_valid = calc_timeout_sec(e-><a class="code" href="structfuse__entry__param.html#a281b39b72e7ec574ba40d7341fd22c1d">entry_timeout</a>);</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  arg->entry_valid_nsec = calc_timeout_nsec(e-><a class="code" href="structfuse__entry__param.html#a281b39b72e7ec574ba40d7341fd22c1d">entry_timeout</a>);</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  arg->attr_valid = calc_timeout_sec(e-><a class="code" href="structfuse__entry__param.html#aa797a9f4152cae506ba479af8bbe2eb7">attr_timeout</a>);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  arg->attr_valid_nsec = calc_timeout_nsec(e-><a class="code" href="structfuse__entry__param.html#aa797a9f4152cae506ba479af8bbe2eb7">attr_timeout</a>);</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  convert_stat(&e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>, &arg->attr);</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span> }</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span> </div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span> <span class="comment">/* `buf` is allowed to be empty so that the proper size may be</span></div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span> <span class="comment"> allocated by the caller */</span></div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> <span class="keywordtype">size_t</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a34f3f1beebacab5f717d95baf832a8a5">fuse_add_direntry_plus</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> bufsize,</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name,</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e, off_t off)</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span> {</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  (void)req;</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordtype">size_t</span> namelen;</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordtype">size_t</span> entlen;</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  <span class="keywordtype">size_t</span> entlen_padded;</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span> </div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  namelen = strlen(name);</div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  entlen = FUSE_NAME_OFFSET_DIRENTPLUS + namelen;</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  entlen_padded = FUSE_DIRENT_ALIGN(entlen);</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  <span class="keywordflow">if</span> ((buf == NULL) || (entlen_padded > bufsize))</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> </div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <span class="keyword">struct </span>fuse_direntplus *dp = (<span class="keyword">struct </span>fuse_direntplus *) buf;</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  memset(&dp->entry_out, 0, <span class="keyword">sizeof</span>(dp->entry_out));</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  fill_entry(&dp->entry_out, e);</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span> </div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  <span class="keyword">struct </span>fuse_dirent *dirent = &dp->dirent;</div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  dirent->ino = e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>.st_ino;</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  dirent->off = off;</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  dirent->namelen = namelen;</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  dirent->type = (e-><a class="code" href="structfuse__entry__param.html#adcdee37c96ad18380a47cdbe96a323b9">attr</a>.st_mode & S_IFMT) >> 12;</div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  strncpy(dirent->name, name, namelen);</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  memset(dirent->name + namelen, 0, entlen_padded - entlen);</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span> </div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="keywordflow">return</span> entlen_padded;</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span> }</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> </div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fill_open(<span class="keyword">struct</span> fuse_open_out *arg,</div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span> {</div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  arg->fh = f-><a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a>;</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a03b59a10e62963d9affa34ad78bd144a">direct_io</a>)</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  arg->open_flags |= FOPEN_DIRECT_IO;</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a23a64eaecbf83f99aba8ee79e6de2780">keep_cache</a>)</div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  arg->open_flags |= FOPEN_KEEP_CACHE;</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#af51d1a8d47e7a9d57b4aa15c11da238d">cache_readdir</a>)</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  arg->open_flags |= FOPEN_CACHE_DIR;</div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  <span class="keywordflow">if</span> (f-><a class="code" href="structfuse__file__info.html#a272022c57a6a79dd8f98ef597786e154">nonseekable</a>)</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  arg->open_flags |= FOPEN_NONSEEKABLE;</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> }</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span> </div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a672c45e126cd240f4bcd59bf9b7e3708">fuse_reply_entry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e)</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span> {</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  <span class="keyword">struct </span>fuse_entry_out arg;</div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  FUSE_COMPAT_ENTRY_OUT_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span> </div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="comment">/* before ABI 7.4 e->ino == 0 was invalid, only ENOENT meant</span></div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span> <span class="comment"> negative entry */</span></div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  <span class="keywordflow">if</span> (!e-><a class="code" href="structfuse__entry__param.html#a285ba89754871772d940fa4fb736bce3">ino</a> && req->se->conn.proto_minor < 4)</div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOENT);</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span> </div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  fill_entry(&arg, e);</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span> }</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span> </div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#abea78d22349198f8370d7cb91fbf05ed">fuse_reply_create</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__entry__param.html">fuse_entry_param</a> *e,</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span> {</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <span class="keywordtype">char</span> buf[<span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_entry_out) + sizeof(struct fuse_open_out)];</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <span class="keywordtype">size_t</span> entrysize = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  FUSE_COMPAT_ENTRY_OUT_SIZE : <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_entry_out);</div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  <span class="keyword">struct </span>fuse_entry_out *earg = (<span class="keyword">struct </span>fuse_entry_out *) buf;</div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span>  <span class="keyword">struct </span>fuse_open_out *oarg = (<span class="keyword">struct </span>fuse_open_out *) (buf + entrysize);</div><div class="line"><a name="l00425"></a><span class="lineno"> 425</span> </div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  memset(buf, 0, <span class="keyword">sizeof</span>(buf));</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  fill_entry(earg, e);</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  fill_open(oarg, f);</div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  <span class="keywordflow">return</span> send_reply_ok(req, buf,</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  entrysize + <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_open_out));</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span> }</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> </div><div class="line"><a name="l00433"></a><span class="lineno"> 433</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad28378dc569019c32acdb4995d70be18">fuse_reply_attr</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> stat *attr,</div><div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  <span class="keywordtype">double</span> attr_timeout)</div><div class="line"><a name="l00435"></a><span class="lineno"> 435</span> {</div><div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  <span class="keyword">struct </span>fuse_attr_out arg;</div><div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 9 ?</div><div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  FUSE_COMPAT_ATTR_OUT_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span> </div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  arg.attr_valid = calc_timeout_sec(attr_timeout);</div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  arg.attr_valid_nsec = calc_timeout_nsec(attr_timeout);</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  convert_stat(attr, &arg.attr);</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span> </div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span> }</div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span> </div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a5a5872d7f73f0bd593e00788a4c7bbb7">fuse_reply_readlink</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keywordtype">char</span> *linkname)</div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span> {</div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  <span class="keywordflow">return</span> send_reply_ok(req, linkname, strlen(linkname));</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span> }</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span> </div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__file__info.html">fuse_file_info</a> *f)</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span> {</div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span>  <span class="keyword">struct </span>fuse_open_out arg;</div><div class="line"><a name="l00456"></a><span class="lineno"> 456</span> </div><div class="line"><a name="l00457"></a><span class="lineno"> 457</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00458"></a><span class="lineno"> 458</span>  fill_open(&arg, f);</div><div class="line"><a name="l00459"></a><span class="lineno"> 459</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span> }</div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span> </div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa3cfa73f61d6ef461ab5a3fbf859eb97">fuse_reply_write</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span> {</div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span>  <span class="keyword">struct </span>fuse_write_out arg;</div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span> </div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  arg.size = count;</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span> </div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00470"></a><span class="lineno"> 470</span> }</div><div class="line"><a name="l00471"></a><span class="lineno"> 471</span> </div><div class="line"><a name="l00472"></a><span class="lineno"> 472</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a300a88b63ab7c8ca92853a97486448c0">fuse_reply_buf</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__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> size)</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span> {</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span>  <span class="keywordflow">return</span> send_reply_ok(req, buf, size);</div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span> }</div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span> </div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov_fallback(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span>  <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf,</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span>  <span class="keywordtype">size_t</span> len)</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span> {</div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> mem_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span>  <span class="keywordtype">void</span> *mbuf;</div><div class="line"><a name="l00485"></a><span class="lineno"> 485</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00486"></a><span class="lineno"> 486</span> </div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span>  <span class="comment">/* Optimize common case */</span></div><div class="line"><a name="l00488"></a><span class="lineno"> 488</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> == 1 && buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> == 0 && buf-><a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a> == 0 &&</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>  !(buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>)) {</div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span>  <span class="comment">/* FIXME: also avoid memory copy if there are multiple buffers</span></div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span> <span class="comment"> but none of them contain an fd */</span></div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span> </div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span>  iov[iov_count].iov_base = buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>;</div><div class="line"><a name="l00494"></a><span class="lineno"> 494</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00495"></a><span class="lineno"> 495</span>  iov_count++;</div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span>  <span class="keywordflow">return</span> fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00497"></a><span class="lineno"> 497</span>  }</div><div class="line"><a name="l00498"></a><span class="lineno"> 498</span> </div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span>  res = posix_memalign(&mbuf, pagesize, len);</div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span>  <span class="keywordflow">if</span> (res != 0)</div><div class="line"><a name="l00501"></a><span class="lineno"> 501</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span> </div><div class="line"><a name="l00503"></a><span class="lineno"> 503</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l00504"></a><span class="lineno"> 504</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&mem_buf, buf, 0);</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l00506"></a><span class="lineno"> 506</span>  free(mbuf);</div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>  <span class="keywordflow">return</span> -res;</div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span>  }</div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span>  len = res;</div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span> </div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span>  iov[iov_count].iov_base = mbuf;</div><div class="line"><a name="l00512"></a><span class="lineno"> 512</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00513"></a><span class="lineno"> 513</span>  iov_count++;</div><div class="line"><a name="l00514"></a><span class="lineno"> 514</span>  res = fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00515"></a><span class="lineno"> 515</span>  free(mbuf);</div><div class="line"><a name="l00516"></a><span class="lineno"> 516</span> </div><div class="line"><a name="l00517"></a><span class="lineno"> 517</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00518"></a><span class="lineno"> 518</span> }</div><div class="line"><a name="l00519"></a><span class="lineno"> 519</span> </div><div class="line"><a name="l00520"></a><span class="lineno"> 520</span> <span class="keyword">struct </span>fuse_ll_pipe {</div><div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <span class="keywordtype">size_t</span> size;</div><div class="line"><a name="l00522"></a><span class="lineno"> 522</span>  <span class="keywordtype">int</span> can_grow;</div><div class="line"><a name="l00523"></a><span class="lineno"> 523</span>  <span class="keywordtype">int</span> pipe[2];</div><div class="line"><a name="l00524"></a><span class="lineno"> 524</span> };</div><div class="line"><a name="l00525"></a><span class="lineno"> 525</span> </div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_pipe_free(<span class="keyword">struct</span> fuse_ll_pipe *llp)</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span> {</div><div class="line"><a name="l00528"></a><span class="lineno"> 528</span>  close(llp->pipe[0]);</div><div class="line"><a name="l00529"></a><span class="lineno"> 529</span>  close(llp->pipe[1]);</div><div class="line"><a name="l00530"></a><span class="lineno"> 530</span>  free(llp);</div><div class="line"><a name="l00531"></a><span class="lineno"> 531</span> }</div><div class="line"><a name="l00532"></a><span class="lineno"> 532</span> </div><div class="line"><a name="l00533"></a><span class="lineno"> 533</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l00534"></a><span class="lineno"> 534</span> <span class="preprocessor">#if !defined(HAVE_PIPE2) || !defined(O_CLOEXEC)</span></div><div class="line"><a name="l00535"></a><span class="lineno"> 535</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_pipe(<span class="keywordtype">int</span> fds[2])</div><div class="line"><a name="l00536"></a><span class="lineno"> 536</span> {</div><div class="line"><a name="l00537"></a><span class="lineno"> 537</span>  <span class="keywordtype">int</span> rv = pipe(fds);</div><div class="line"><a name="l00538"></a><span class="lineno"> 538</span> </div><div class="line"><a name="l00539"></a><span class="lineno"> 539</span>  <span class="keywordflow">if</span> (rv == -1)</div><div class="line"><a name="l00540"></a><span class="lineno"> 540</span>  <span class="keywordflow">return</span> rv;</div><div class="line"><a name="l00541"></a><span class="lineno"> 541</span> </div><div class="line"><a name="l00542"></a><span class="lineno"> 542</span>  <span class="keywordflow">if</span> (fcntl(fds[0], F_SETFL, O_NONBLOCK) == -1 ||</div><div class="line"><a name="l00543"></a><span class="lineno"> 543</span>  fcntl(fds[1], F_SETFL, O_NONBLOCK) == -1 ||</div><div class="line"><a name="l00544"></a><span class="lineno"> 544</span>  fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 ||</div><div class="line"><a name="l00545"></a><span class="lineno"> 545</span>  fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) {</div><div class="line"><a name="l00546"></a><span class="lineno"> 546</span>  close(fds[0]);</div><div class="line"><a name="l00547"></a><span class="lineno"> 547</span>  close(fds[1]);</div><div class="line"><a name="l00548"></a><span class="lineno"> 548</span>  rv = -1;</div><div class="line"><a name="l00549"></a><span class="lineno"> 549</span>  }</div><div class="line"><a name="l00550"></a><span class="lineno"> 550</span>  <span class="keywordflow">return</span> rv;</div><div class="line"><a name="l00551"></a><span class="lineno"> 551</span> }</div><div class="line"><a name="l00552"></a><span class="lineno"> 552</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00553"></a><span class="lineno"> 553</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_pipe(<span class="keywordtype">int</span> fds[2])</div><div class="line"><a name="l00554"></a><span class="lineno"> 554</span> {</div><div class="line"><a name="l00555"></a><span class="lineno"> 555</span>  <span class="keywordflow">return</span> pipe2(fds, O_CLOEXEC | O_NONBLOCK);</div><div class="line"><a name="l00556"></a><span class="lineno"> 556</span> }</div><div class="line"><a name="l00557"></a><span class="lineno"> 557</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00558"></a><span class="lineno"> 558</span> </div><div class="line"><a name="l00559"></a><span class="lineno"> 559</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_ll_pipe *fuse_ll_get_pipe(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00560"></a><span class="lineno"> 560</span> {</div><div class="line"><a name="l00561"></a><span class="lineno"> 561</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l00562"></a><span class="lineno"> 562</span>  <span class="keywordflow">if</span> (llp == NULL) {</div><div class="line"><a name="l00563"></a><span class="lineno"> 563</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00564"></a><span class="lineno"> 564</span> </div><div class="line"><a name="l00565"></a><span class="lineno"> 565</span>  llp = malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_ll_pipe));</div><div class="line"><a name="l00566"></a><span class="lineno"> 566</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l00567"></a><span class="lineno"> 567</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00568"></a><span class="lineno"> 568</span> </div><div class="line"><a name="l00569"></a><span class="lineno"> 569</span>  res = fuse_pipe(llp->pipe);</div><div class="line"><a name="l00570"></a><span class="lineno"> 570</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00571"></a><span class="lineno"> 571</span>  free(llp);</div><div class="line"><a name="l00572"></a><span class="lineno"> 572</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00573"></a><span class="lineno"> 573</span>  }</div><div class="line"><a name="l00574"></a><span class="lineno"> 574</span> </div><div class="line"><a name="l00575"></a><span class="lineno"> 575</span>  <span class="comment">/*</span></div><div class="line"><a name="l00576"></a><span class="lineno"> 576</span> <span class="comment"> *the default size is 16 pages on linux</span></div><div class="line"><a name="l00577"></a><span class="lineno"> 577</span> <span class="comment"> */</span></div><div class="line"><a name="l00578"></a><span class="lineno"> 578</span>  llp->size = pagesize * 16;</div><div class="line"><a name="l00579"></a><span class="lineno"> 579</span>  llp->can_grow = 1;</div><div class="line"><a name="l00580"></a><span class="lineno"> 580</span> </div><div class="line"><a name="l00581"></a><span class="lineno"> 581</span>  pthread_setspecific(se->pipe_key, llp);</div><div class="line"><a name="l00582"></a><span class="lineno"> 582</span>  }</div><div class="line"><a name="l00583"></a><span class="lineno"> 583</span> </div><div class="line"><a name="l00584"></a><span class="lineno"> 584</span>  <span class="keywordflow">return</span> llp;</div><div class="line"><a name="l00585"></a><span class="lineno"> 585</span> }</div><div class="line"><a name="l00586"></a><span class="lineno"> 586</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00587"></a><span class="lineno"> 587</span> </div><div class="line"><a name="l00588"></a><span class="lineno"> 588</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_clear_pipe(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l00589"></a><span class="lineno"> 589</span> {</div><div class="line"><a name="l00590"></a><span class="lineno"> 590</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  <span class="keywordflow">if</span> (llp) {</div><div class="line"><a name="l00592"></a><span class="lineno"> 592</span>  pthread_setspecific(se->pipe_key, NULL);</div><div class="line"><a name="l00593"></a><span class="lineno"> 593</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l00594"></a><span class="lineno"> 594</span>  }</div><div class="line"><a name="l00595"></a><span class="lineno"> 595</span> }</div><div class="line"><a name="l00596"></a><span class="lineno"> 596</span> </div><div class="line"><a name="l00597"></a><span class="lineno"> 597</span> <span class="preprocessor">#if defined(HAVE_SPLICE) && defined(HAVE_VMSPLICE)</span></div><div class="line"><a name="l00598"></a><span class="lineno"> 598</span> <span class="keyword">static</span> <span class="keywordtype">int</span> read_back(<span class="keywordtype">int</span> fd, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> len)</div><div class="line"><a name="l00599"></a><span class="lineno"> 599</span> {</div><div class="line"><a name="l00600"></a><span class="lineno"> 600</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00601"></a><span class="lineno"> 601</span> </div><div class="line"><a name="l00602"></a><span class="lineno"> 602</span>  res = read(fd, buf, len);</div><div class="line"><a name="l00603"></a><span class="lineno"> 603</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  fprintf(stderr, <span class="stringliteral">"fuse: internal error: failed to read back from pipe: %s\n"</span>, strerror(errno));</div><div class="line"><a name="l00605"></a><span class="lineno"> 605</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l00606"></a><span class="lineno"> 606</span>  }</div><div class="line"><a name="l00607"></a><span class="lineno"> 607</span>  <span class="keywordflow">if</span> (res != len) {</div><div class="line"><a name="l00608"></a><span class="lineno"> 608</span>  fprintf(stderr, <span class="stringliteral">"fuse: internal error: short read back from pipe: %i from %zi\n"</span>, res, len);</div><div class="line"><a name="l00609"></a><span class="lineno"> 609</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l00610"></a><span class="lineno"> 610</span>  }</div><div class="line"><a name="l00611"></a><span class="lineno"> 611</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00612"></a><span class="lineno"> 612</span> }</div><div class="line"><a name="l00613"></a><span class="lineno"> 613</span> </div><div class="line"><a name="l00614"></a><span class="lineno"> 614</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00616"></a><span class="lineno"> 616</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags)</div><div class="line"><a name="l00617"></a><span class="lineno"> 617</span> {</div><div class="line"><a name="l00618"></a><span class="lineno"> 618</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00619"></a><span class="lineno"> 619</span>  <span class="keywordtype">size_t</span> len = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(buf);</div><div class="line"><a name="l00620"></a><span class="lineno"> 620</span>  <span class="keyword">struct </span>fuse_out_header *out = iov[0].iov_base;</div><div class="line"><a name="l00621"></a><span class="lineno"> 621</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l00622"></a><span class="lineno"> 622</span>  <span class="keywordtype">int</span> splice_flags;</div><div class="line"><a name="l00623"></a><span class="lineno"> 623</span>  <span class="keywordtype">size_t</span> pipesize;</div><div class="line"><a name="l00624"></a><span class="lineno"> 624</span>  <span class="keywordtype">size_t</span> total_fd_size;</div><div class="line"><a name="l00625"></a><span class="lineno"> 625</span>  <span class="keywordtype">size_t</span> idx;</div><div class="line"><a name="l00626"></a><span class="lineno"> 626</span>  <span class="keywordtype">size_t</span> headerlen;</div><div class="line"><a name="l00627"></a><span class="lineno"> 627</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> pipe_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00628"></a><span class="lineno"> 628</span> </div><div class="line"><a name="l00629"></a><span class="lineno"> 629</span>  <span class="keywordflow">if</span> (se->broken_splice_nonblock)</div><div class="line"><a name="l00630"></a><span class="lineno"> 630</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00631"></a><span class="lineno"> 631</span> </div><div class="line"><a name="l00632"></a><span class="lineno"> 632</span>  <span class="keywordflow">if</span> (flags & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18adcef8052c48f314d4d9f9f05a5b4f838">FUSE_BUF_NO_SPLICE</a>)</div><div class="line"><a name="l00633"></a><span class="lineno"> 633</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00634"></a><span class="lineno"> 634</span> </div><div class="line"><a name="l00635"></a><span class="lineno"> 635</span>  total_fd_size = 0;</div><div class="line"><a name="l00636"></a><span class="lineno"> 636</span>  <span class="keywordflow">for</span> (idx = buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>; idx < buf->count; idx++) {</div><div class="line"><a name="l00637"></a><span class="lineno"> 637</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[idx].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>) {</div><div class="line"><a name="l00638"></a><span class="lineno"> 638</span>  total_fd_size = buf-><a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>;</div><div class="line"><a name="l00639"></a><span class="lineno"> 639</span>  <span class="keywordflow">if</span> (idx == buf-><a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a>)</div><div class="line"><a name="l00640"></a><span class="lineno"> 640</span>  total_fd_size -= buf-><a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a>;</div><div class="line"><a name="l00641"></a><span class="lineno"> 641</span>  }</div><div class="line"><a name="l00642"></a><span class="lineno"> 642</span>  }</div><div class="line"><a name="l00643"></a><span class="lineno"> 643</span>  <span class="keywordflow">if</span> (total_fd_size < 2 * pagesize)</div><div class="line"><a name="l00644"></a><span class="lineno"> 644</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00645"></a><span class="lineno"> 645</span> </div><div class="line"><a name="l00646"></a><span class="lineno"> 646</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 14 ||</div><div class="line"><a name="l00647"></a><span class="lineno"> 647</span>  !(se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4f8815e0f48c60c3d9cd6e72be5a84e4">FUSE_CAP_SPLICE_WRITE</a>))</div><div class="line"><a name="l00648"></a><span class="lineno"> 648</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00649"></a><span class="lineno"> 649</span> </div><div class="line"><a name="l00650"></a><span class="lineno"> 650</span>  llp = fuse_ll_get_pipe(se);</div><div class="line"><a name="l00651"></a><span class="lineno"> 651</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l00652"></a><span class="lineno"> 652</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00653"></a><span class="lineno"> 653</span> </div><div class="line"><a name="l00654"></a><span class="lineno"> 654</span> </div><div class="line"><a name="l00655"></a><span class="lineno"> 655</span>  headerlen = iov_length(iov, iov_count);</div><div class="line"><a name="l00656"></a><span class="lineno"> 656</span> </div><div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  out->len = headerlen + len;</div><div class="line"><a name="l00658"></a><span class="lineno"> 658</span> </div><div class="line"><a name="l00659"></a><span class="lineno"> 659</span>  <span class="comment">/*</span></div><div class="line"><a name="l00660"></a><span class="lineno"> 660</span> <span class="comment"> * Heuristic for the required pipe size, does not work if the</span></div><div class="line"><a name="l00661"></a><span class="lineno"> 661</span> <span class="comment"> * source contains less than page size fragments</span></div><div class="line"><a name="l00662"></a><span class="lineno"> 662</span> <span class="comment"> */</span></div><div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  pipesize = pagesize * (iov_count + buf-><a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> + 1) + out->len;</div><div class="line"><a name="l00664"></a><span class="lineno"> 664</span> </div><div class="line"><a name="l00665"></a><span class="lineno"> 665</span>  if (llp->size < pipesize) {</div><div class="line"><a name="l00666"></a><span class="lineno"> 666</span>  <span class="keywordflow">if</span> (llp->can_grow) {</div><div class="line"><a name="l00667"></a><span class="lineno"> 667</span>  res = fcntl(llp->pipe[0], F_SETPIPE_SZ, pipesize);</div><div class="line"><a name="l00668"></a><span class="lineno"> 668</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00669"></a><span class="lineno"> 669</span>  llp->can_grow = 0;</div><div class="line"><a name="l00670"></a><span class="lineno"> 670</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00671"></a><span class="lineno"> 671</span>  }</div><div class="line"><a name="l00672"></a><span class="lineno"> 672</span>  llp->size = res;</div><div class="line"><a name="l00673"></a><span class="lineno"> 673</span>  }</div><div class="line"><a name="l00674"></a><span class="lineno"> 674</span>  <span class="keywordflow">if</span> (llp->size < pipesize)</div><div class="line"><a name="l00675"></a><span class="lineno"> 675</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00676"></a><span class="lineno"> 676</span>  }</div><div class="line"><a name="l00677"></a><span class="lineno"> 677</span> </div><div class="line"><a name="l00678"></a><span class="lineno"> 678</span> </div><div class="line"><a name="l00679"></a><span class="lineno"> 679</span>  res = vmsplice(llp->pipe[1], iov, iov_count, SPLICE_F_NONBLOCK);</div><div class="line"><a name="l00680"></a><span class="lineno"> 680</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00681"></a><span class="lineno"> 681</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00682"></a><span class="lineno"> 682</span> </div><div class="line"><a name="l00683"></a><span class="lineno"> 683</span>  <span class="keywordflow">if</span> (res != headerlen) {</div><div class="line"><a name="l00684"></a><span class="lineno"> 684</span>  res = -EIO;</div><div class="line"><a name="l00685"></a><span class="lineno"> 685</span>  fprintf(stderr, <span class="stringliteral">"fuse: short vmsplice to pipe: %u/%zu\n"</span>, res,</div><div class="line"><a name="l00686"></a><span class="lineno"> 686</span>  headerlen);</div><div class="line"><a name="l00687"></a><span class="lineno"> 687</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00688"></a><span class="lineno"> 688</span>  }</div><div class="line"><a name="l00689"></a><span class="lineno"> 689</span> </div><div class="line"><a name="l00690"></a><span class="lineno"> 690</span>  pipe_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>;</div><div class="line"><a name="l00691"></a><span class="lineno"> 691</span>  pipe_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a62b2ae82904ac4355142984b9dd90d68">fd</a> = llp->pipe[1];</div><div class="line"><a name="l00692"></a><span class="lineno"> 692</span> </div><div class="line"><a name="l00693"></a><span class="lineno"> 693</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&pipe_buf, buf,</div><div class="line"><a name="l00694"></a><span class="lineno"> 694</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18a375767de945f5178e8949d284abf1f5b">FUSE_BUF_FORCE_SPLICE</a> | <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18a32ec833f1eb4b5cd9283cf9d93021037">FUSE_BUF_SPLICE_NONBLOCK</a>);</div><div class="line"><a name="l00695"></a><span class="lineno"> 695</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l00696"></a><span class="lineno"> 696</span>  <span class="keywordflow">if</span> (res == -EAGAIN || res == -EINVAL) {</div><div class="line"><a name="l00697"></a><span class="lineno"> 697</span>  <span class="comment">/*</span></div><div class="line"><a name="l00698"></a><span class="lineno"> 698</span> <span class="comment"> * Should only get EAGAIN on kernels with</span></div><div class="line"><a name="l00699"></a><span class="lineno"> 699</span> <span class="comment"> * broken SPLICE_F_NONBLOCK support (<=</span></div><div class="line"><a name="l00700"></a><span class="lineno"> 700</span> <span class="comment"> * 2.6.35) where this error or a short read is</span></div><div class="line"><a name="l00701"></a><span class="lineno"> 701</span> <span class="comment"> * returned even if the pipe itself is not</span></div><div class="line"><a name="l00702"></a><span class="lineno"> 702</span> <span class="comment"> * full</span></div><div class="line"><a name="l00703"></a><span class="lineno"> 703</span> <span class="comment"> *</span></div><div class="line"><a name="l00704"></a><span class="lineno"> 704</span> <span class="comment"> * EINVAL might mean that splice can't handle</span></div><div class="line"><a name="l00705"></a><span class="lineno"> 705</span> <span class="comment"> * this combination of input and output.</span></div><div class="line"><a name="l00706"></a><span class="lineno"> 706</span> <span class="comment"> */</span></div><div class="line"><a name="l00707"></a><span class="lineno"> 707</span>  <span class="keywordflow">if</span> (res == -EAGAIN)</div><div class="line"><a name="l00708"></a><span class="lineno"> 708</span>  se->broken_splice_nonblock = 1;</div><div class="line"><a name="l00709"></a><span class="lineno"> 709</span> </div><div class="line"><a name="l00710"></a><span class="lineno"> 710</span>  pthread_setspecific(se->pipe_key, NULL);</div><div class="line"><a name="l00711"></a><span class="lineno"> 711</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l00712"></a><span class="lineno"> 712</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l00713"></a><span class="lineno"> 713</span>  }</div><div class="line"><a name="l00714"></a><span class="lineno"> 714</span>  res = -res;</div><div class="line"><a name="l00715"></a><span class="lineno"> 715</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00716"></a><span class="lineno"> 716</span>  }</div><div class="line"><a name="l00717"></a><span class="lineno"> 717</span> </div><div class="line"><a name="l00718"></a><span class="lineno"> 718</span>  <span class="keywordflow">if</span> (res != 0 && res < len) {</div><div class="line"><a name="l00719"></a><span class="lineno"> 719</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> mem_buf = FUSE_BUFVEC_INIT(len);</div><div class="line"><a name="l00720"></a><span class="lineno"> 720</span>  <span class="keywordtype">void</span> *mbuf;</div><div class="line"><a name="l00721"></a><span class="lineno"> 721</span>  <span class="keywordtype">size_t</span> now_len = res;</div><div class="line"><a name="l00722"></a><span class="lineno"> 722</span>  <span class="comment">/*</span></div><div class="line"><a name="l00723"></a><span class="lineno"> 723</span> <span class="comment"> * For regular files a short count is either</span></div><div class="line"><a name="l00724"></a><span class="lineno"> 724</span> <span class="comment"> * 1) due to EOF, or</span></div><div class="line"><a name="l00725"></a><span class="lineno"> 725</span> <span class="comment"> * 2) because of broken SPLICE_F_NONBLOCK (see above)</span></div><div class="line"><a name="l00726"></a><span class="lineno"> 726</span> <span class="comment"> *</span></div><div class="line"><a name="l00727"></a><span class="lineno"> 727</span> <span class="comment"> * For other inputs it's possible that we overflowed</span></div><div class="line"><a name="l00728"></a><span class="lineno"> 728</span> <span class="comment"> * the pipe because of small buffer fragments.</span></div><div class="line"><a name="l00729"></a><span class="lineno"> 729</span> <span class="comment"> */</span></div><div class="line"><a name="l00730"></a><span class="lineno"> 730</span> </div><div class="line"><a name="l00731"></a><span class="lineno"> 731</span>  res = posix_memalign(&mbuf, pagesize, len);</div><div class="line"><a name="l00732"></a><span class="lineno"> 732</span>  <span class="keywordflow">if</span> (res != 0)</div><div class="line"><a name="l00733"></a><span class="lineno"> 733</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00734"></a><span class="lineno"> 734</span> </div><div class="line"><a name="l00735"></a><span class="lineno"> 735</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l00736"></a><span class="lineno"> 736</span>  mem_buf.<a class="code" href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">off</a> = now_len;</div><div class="line"><a name="l00737"></a><span class="lineno"> 737</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&mem_buf, buf, 0);</div><div class="line"><a name="l00738"></a><span class="lineno"> 738</span>  <span class="keywordflow">if</span> (res > 0) {</div><div class="line"><a name="l00739"></a><span class="lineno"> 739</span>  <span class="keywordtype">char</span> *tmpbuf;</div><div class="line"><a name="l00740"></a><span class="lineno"> 740</span>  <span class="keywordtype">size_t</span> extra_len = res;</div><div class="line"><a name="l00741"></a><span class="lineno"> 741</span>  <span class="comment">/*</span></div><div class="line"><a name="l00742"></a><span class="lineno"> 742</span> <span class="comment"> * Trickiest case: got more data. Need to get</span></div><div class="line"><a name="l00743"></a><span class="lineno"> 743</span> <span class="comment"> * back the data from the pipe and then fall</span></div><div class="line"><a name="l00744"></a><span class="lineno"> 744</span> <span class="comment"> * back to regular write.</span></div><div class="line"><a name="l00745"></a><span class="lineno"> 745</span> <span class="comment"> */</span></div><div class="line"><a name="l00746"></a><span class="lineno"> 746</span>  tmpbuf = malloc(headerlen);</div><div class="line"><a name="l00747"></a><span class="lineno"> 747</span>  <span class="keywordflow">if</span> (tmpbuf == NULL) {</div><div class="line"><a name="l00748"></a><span class="lineno"> 748</span>  free(mbuf);</div><div class="line"><a name="l00749"></a><span class="lineno"> 749</span>  res = ENOMEM;</div><div class="line"><a name="l00750"></a><span class="lineno"> 750</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00751"></a><span class="lineno"> 751</span>  }</div><div class="line"><a name="l00752"></a><span class="lineno"> 752</span>  res = read_back(llp->pipe[0], tmpbuf, headerlen);</div><div class="line"><a name="l00753"></a><span class="lineno"> 753</span>  free(tmpbuf);</div><div class="line"><a name="l00754"></a><span class="lineno"> 754</span>  <span class="keywordflow">if</span> (res != 0) {</div><div class="line"><a name="l00755"></a><span class="lineno"> 755</span>  free(mbuf);</div><div class="line"><a name="l00756"></a><span class="lineno"> 756</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00757"></a><span class="lineno"> 757</span>  }</div><div class="line"><a name="l00758"></a><span class="lineno"> 758</span>  res = read_back(llp->pipe[0], mbuf, now_len);</div><div class="line"><a name="l00759"></a><span class="lineno"> 759</span>  <span class="keywordflow">if</span> (res != 0) {</div><div class="line"><a name="l00760"></a><span class="lineno"> 760</span>  free(mbuf);</div><div class="line"><a name="l00761"></a><span class="lineno"> 761</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00762"></a><span class="lineno"> 762</span>  }</div><div class="line"><a name="l00763"></a><span class="lineno"> 763</span>  len = now_len + extra_len;</div><div class="line"><a name="l00764"></a><span class="lineno"> 764</span>  iov[iov_count].iov_base = mbuf;</div><div class="line"><a name="l00765"></a><span class="lineno"> 765</span>  iov[iov_count].iov_len = len;</div><div class="line"><a name="l00766"></a><span class="lineno"> 766</span>  iov_count++;</div><div class="line"><a name="l00767"></a><span class="lineno"> 767</span>  res = fuse_send_msg(se, ch, iov, iov_count);</div><div class="line"><a name="l00768"></a><span class="lineno"> 768</span>  free(mbuf);</div><div class="line"><a name="l00769"></a><span class="lineno"> 769</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00770"></a><span class="lineno"> 770</span>  }</div><div class="line"><a name="l00771"></a><span class="lineno"> 771</span>  free(mbuf);</div><div class="line"><a name="l00772"></a><span class="lineno"> 772</span>  res = now_len;</div><div class="line"><a name="l00773"></a><span class="lineno"> 773</span>  }</div><div class="line"><a name="l00774"></a><span class="lineno"> 774</span>  len = res;</div><div class="line"><a name="l00775"></a><span class="lineno"> 775</span>  out->len = headerlen + len;</div><div class="line"><a name="l00776"></a><span class="lineno"> 776</span> </div><div class="line"><a name="l00777"></a><span class="lineno"> 777</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l00778"></a><span class="lineno"> 778</span>  fprintf(stderr,</div><div class="line"><a name="l00779"></a><span class="lineno"> 779</span>  <span class="stringliteral">" unique: %llu, success, outsize: %i (splice)\n"</span>,</div><div class="line"><a name="l00780"></a><span class="lineno"> 780</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) out->unique, out->len);</div><div class="line"><a name="l00781"></a><span class="lineno"> 781</span>  }</div><div class="line"><a name="l00782"></a><span class="lineno"> 782</span> </div><div class="line"><a name="l00783"></a><span class="lineno"> 783</span>  splice_flags = 0;</div><div class="line"><a name="l00784"></a><span class="lineno"> 784</span>  <span class="keywordflow">if</span> ((flags & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18af239e556066a5d73b3ff542216b157b9">FUSE_BUF_SPLICE_MOVE</a>) &&</div><div class="line"><a name="l00785"></a><span class="lineno"> 785</span>  (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aef5da823dc5f202bbe033c7a5a3de9c4">FUSE_CAP_SPLICE_MOVE</a>))</div><div class="line"><a name="l00786"></a><span class="lineno"> 786</span>  splice_flags |= SPLICE_F_MOVE;</div><div class="line"><a name="l00787"></a><span class="lineno"> 787</span> </div><div class="line"><a name="l00788"></a><span class="lineno"> 788</span>  res = splice(llp->pipe[0], NULL, ch ? ch->fd : se->fd,</div><div class="line"><a name="l00789"></a><span class="lineno"> 789</span>  NULL, out->len, splice_flags);</div><div class="line"><a name="l00790"></a><span class="lineno"> 790</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l00791"></a><span class="lineno"> 791</span>  res = -errno;</div><div class="line"><a name="l00792"></a><span class="lineno"> 792</span>  perror(<span class="stringliteral">"fuse: splice from pipe"</span>);</div><div class="line"><a name="l00793"></a><span class="lineno"> 793</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00794"></a><span class="lineno"> 794</span>  }</div><div class="line"><a name="l00795"></a><span class="lineno"> 795</span>  <span class="keywordflow">if</span> (res != out->len) {</div><div class="line"><a name="l00796"></a><span class="lineno"> 796</span>  res = -EIO;</div><div class="line"><a name="l00797"></a><span class="lineno"> 797</span>  fprintf(stderr, <span class="stringliteral">"fuse: short splice from pipe: %u/%u\n"</span>,</div><div class="line"><a name="l00798"></a><span class="lineno"> 798</span>  res, out->len);</div><div class="line"><a name="l00799"></a><span class="lineno"> 799</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l00800"></a><span class="lineno"> 800</span>  }</div><div class="line"><a name="l00801"></a><span class="lineno"> 801</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00802"></a><span class="lineno"> 802</span> </div><div class="line"><a name="l00803"></a><span class="lineno"> 803</span> clear_pipe:</div><div class="line"><a name="l00804"></a><span class="lineno"> 804</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l00805"></a><span class="lineno"> 805</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00806"></a><span class="lineno"> 806</span> </div><div class="line"><a name="l00807"></a><span class="lineno"> 807</span> fallback:</div><div class="line"><a name="l00808"></a><span class="lineno"> 808</span>  <span class="keywordflow">return</span> fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);</div><div class="line"><a name="l00809"></a><span class="lineno"> 809</span> }</div><div class="line"><a name="l00810"></a><span class="lineno"> 810</span> <span class="preprocessor">#else</span></div><div class="line"><a name="l00811"></a><span class="lineno"> 811</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_send_data_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_chan *ch,</div><div class="line"><a name="l00812"></a><span class="lineno"> 812</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> iov_count,</div><div class="line"><a name="l00813"></a><span class="lineno"> 813</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags)</div><div class="line"><a name="l00814"></a><span class="lineno"> 814</span> {</div><div class="line"><a name="l00815"></a><span class="lineno"> 815</span>  <span class="keywordtype">size_t</span> len = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(buf);</div><div class="line"><a name="l00816"></a><span class="lineno"> 816</span>  (void) flags;</div><div class="line"><a name="l00817"></a><span class="lineno"> 817</span> </div><div class="line"><a name="l00818"></a><span class="lineno"> 818</span>  <span class="keywordflow">return</span> fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);</div><div class="line"><a name="l00819"></a><span class="lineno"> 819</span> }</div><div class="line"><a name="l00820"></a><span class="lineno"> 820</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00821"></a><span class="lineno"> 821</span> </div><div class="line"><a name="l00822"></a><span class="lineno"> 822</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1242694fe0fb6e253a88b57795987302">fuse_reply_data</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *bufv,</div><div class="line"><a name="l00823"></a><span class="lineno"> 823</span>  <span class="keyword">enum</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18">fuse_buf_copy_flags</a> flags)</div><div class="line"><a name="l00824"></a><span class="lineno"> 824</span> {</div><div class="line"><a name="l00825"></a><span class="lineno"> 825</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l00826"></a><span class="lineno"> 826</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l00827"></a><span class="lineno"> 827</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00828"></a><span class="lineno"> 828</span> </div><div class="line"><a name="l00829"></a><span class="lineno"> 829</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l00830"></a><span class="lineno"> 830</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l00831"></a><span class="lineno"> 831</span> </div><div class="line"><a name="l00832"></a><span class="lineno"> 832</span>  out.unique = req->unique;</div><div class="line"><a name="l00833"></a><span class="lineno"> 833</span>  out.error = 0;</div><div class="line"><a name="l00834"></a><span class="lineno"> 834</span> </div><div class="line"><a name="l00835"></a><span class="lineno"> 835</span>  res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv, flags);</div><div class="line"><a name="l00836"></a><span class="lineno"> 836</span>  <span class="keywordflow">if</span> (res <= 0) {</div><div class="line"><a name="l00837"></a><span class="lineno"> 837</span>  fuse_free_req(req);</div><div class="line"><a name="l00838"></a><span class="lineno"> 838</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00839"></a><span class="lineno"> 839</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00840"></a><span class="lineno"> 840</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, res);</div><div class="line"><a name="l00841"></a><span class="lineno"> 841</span>  }</div><div class="line"><a name="l00842"></a><span class="lineno"> 842</span> }</div><div class="line"><a name="l00843"></a><span class="lineno"> 843</span> </div><div class="line"><a name="l00844"></a><span class="lineno"> 844</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa1d95ec3ca674253baac3639ea10f0ff">fuse_reply_statfs</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> statvfs *stbuf)</div><div class="line"><a name="l00845"></a><span class="lineno"> 845</span> {</div><div class="line"><a name="l00846"></a><span class="lineno"> 846</span>  <span class="keyword">struct </span>fuse_statfs_out arg;</div><div class="line"><a name="l00847"></a><span class="lineno"> 847</span>  <span class="keywordtype">size_t</span> size = req->se->conn.proto_minor < 4 ?</div><div class="line"><a name="l00848"></a><span class="lineno"> 848</span>  FUSE_COMPAT_STATFS_SIZE : <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00849"></a><span class="lineno"> 849</span> </div><div class="line"><a name="l00850"></a><span class="lineno"> 850</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00851"></a><span class="lineno"> 851</span>  convert_statfs(stbuf, &arg.st);</div><div class="line"><a name="l00852"></a><span class="lineno"> 852</span> </div><div class="line"><a name="l00853"></a><span class="lineno"> 853</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, size);</div><div class="line"><a name="l00854"></a><span class="lineno"> 854</span> }</div><div class="line"><a name="l00855"></a><span class="lineno"> 855</span> </div><div class="line"><a name="l00856"></a><span class="lineno"> 856</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#afed32e5d3e1f54d390103f79ebb8bd42">fuse_reply_xattr</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00857"></a><span class="lineno"> 857</span> {</div><div class="line"><a name="l00858"></a><span class="lineno"> 858</span>  <span class="keyword">struct </span>fuse_getxattr_out arg;</div><div class="line"><a name="l00859"></a><span class="lineno"> 859</span> </div><div class="line"><a name="l00860"></a><span class="lineno"> 860</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00861"></a><span class="lineno"> 861</span>  arg.size = count;</div><div class="line"><a name="l00862"></a><span class="lineno"> 862</span> </div><div class="line"><a name="l00863"></a><span class="lineno"> 863</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00864"></a><span class="lineno"> 864</span> }</div><div class="line"><a name="l00865"></a><span class="lineno"> 865</span> </div><div class="line"><a name="l00866"></a><span class="lineno"> 866</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a135eda9b7d36fb4eaae2de58526d4f85">fuse_reply_lock</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keyword">const</span> <span class="keyword">struct</span> flock *lock)</div><div class="line"><a name="l00867"></a><span class="lineno"> 867</span> {</div><div class="line"><a name="l00868"></a><span class="lineno"> 868</span>  <span class="keyword">struct </span>fuse_lk_out arg;</div><div class="line"><a name="l00869"></a><span class="lineno"> 869</span> </div><div class="line"><a name="l00870"></a><span class="lineno"> 870</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00871"></a><span class="lineno"> 871</span>  arg.lk.type = lock->l_type;</div><div class="line"><a name="l00872"></a><span class="lineno"> 872</span>  <span class="keywordflow">if</span> (lock->l_type != F_UNLCK) {</div><div class="line"><a name="l00873"></a><span class="lineno"> 873</span>  arg.lk.start = lock->l_start;</div><div class="line"><a name="l00874"></a><span class="lineno"> 874</span>  <span class="keywordflow">if</span> (lock->l_len == 0)</div><div class="line"><a name="l00875"></a><span class="lineno"> 875</span>  arg.lk.end = OFFSET_MAX;</div><div class="line"><a name="l00876"></a><span class="lineno"> 876</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00877"></a><span class="lineno"> 877</span>  arg.lk.end = lock->l_start + lock->l_len - 1;</div><div class="line"><a name="l00878"></a><span class="lineno"> 878</span>  }</div><div class="line"><a name="l00879"></a><span class="lineno"> 879</span>  arg.lk.pid = lock->l_pid;</div><div class="line"><a name="l00880"></a><span class="lineno"> 880</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00881"></a><span class="lineno"> 881</span> }</div><div class="line"><a name="l00882"></a><span class="lineno"> 882</span> </div><div class="line"><a name="l00883"></a><span class="lineno"> 883</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a65431e8196e0533257acad767f7b074f">fuse_reply_bmap</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, uint64_t idx)</div><div class="line"><a name="l00884"></a><span class="lineno"> 884</span> {</div><div class="line"><a name="l00885"></a><span class="lineno"> 885</span>  <span class="keyword">struct </span>fuse_bmap_out arg;</div><div class="line"><a name="l00886"></a><span class="lineno"> 886</span> </div><div class="line"><a name="l00887"></a><span class="lineno"> 887</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00888"></a><span class="lineno"> 888</span>  arg.block = idx;</div><div class="line"><a name="l00889"></a><span class="lineno"> 889</span> </div><div class="line"><a name="l00890"></a><span class="lineno"> 890</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00891"></a><span class="lineno"> 891</span> }</div><div class="line"><a name="l00892"></a><span class="lineno"> 892</span> </div><div class="line"><a name="l00893"></a><span class="lineno"> 893</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_ioctl_iovec *fuse_ioctl_iovec_copy(<span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l00894"></a><span class="lineno"> 894</span>  <span class="keywordtype">size_t</span> count)</div><div class="line"><a name="l00895"></a><span class="lineno"> 895</span> {</div><div class="line"><a name="l00896"></a><span class="lineno"> 896</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *fiov;</div><div class="line"><a name="l00897"></a><span class="lineno"> 897</span>  <span class="keywordtype">size_t</span> i;</div><div class="line"><a name="l00898"></a><span class="lineno"> 898</span> </div><div class="line"><a name="l00899"></a><span class="lineno"> 899</span>  fiov = malloc(<span class="keyword">sizeof</span>(fiov[0]) * count);</div><div class="line"><a name="l00900"></a><span class="lineno"> 900</span>  <span class="keywordflow">if</span> (!fiov)</div><div class="line"><a name="l00901"></a><span class="lineno"> 901</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00902"></a><span class="lineno"> 902</span> </div><div class="line"><a name="l00903"></a><span class="lineno"> 903</span>  <span class="keywordflow">for</span> (i = 0; i < count; i++) {</div><div class="line"><a name="l00904"></a><span class="lineno"> 904</span>  fiov[i].base = (uintptr_t) iov[i].iov_base;</div><div class="line"><a name="l00905"></a><span class="lineno"> 905</span>  fiov[i].len = iov[i].iov_len;</div><div class="line"><a name="l00906"></a><span class="lineno"> 906</span>  }</div><div class="line"><a name="l00907"></a><span class="lineno"> 907</span> </div><div class="line"><a name="l00908"></a><span class="lineno"> 908</span>  <span class="keywordflow">return</span> fiov;</div><div class="line"><a name="l00909"></a><span class="lineno"> 909</span> }</div><div class="line"><a name="l00910"></a><span class="lineno"> 910</span> </div><div class="line"><a name="l00911"></a><span class="lineno"> 911</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a940683d07df12c24f56b4363aed90e4d">fuse_reply_ioctl_retry</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req,</div><div class="line"><a name="l00912"></a><span class="lineno"> 912</span>  <span class="keyword">const</span> <span class="keyword">struct</span> iovec *in_iov, <span class="keywordtype">size_t</span> in_count,</div><div class="line"><a name="l00913"></a><span class="lineno"> 913</span>  <span class="keyword">const</span> <span class="keyword">struct</span> iovec *out_iov, <span class="keywordtype">size_t</span> out_count)</div><div class="line"><a name="l00914"></a><span class="lineno"> 914</span> {</div><div class="line"><a name="l00915"></a><span class="lineno"> 915</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l00916"></a><span class="lineno"> 916</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *in_fiov = NULL;</div><div class="line"><a name="l00917"></a><span class="lineno"> 917</span>  <span class="keyword">struct </span>fuse_ioctl_iovec *out_fiov = NULL;</div><div class="line"><a name="l00918"></a><span class="lineno"> 918</span>  <span class="keyword">struct </span>iovec iov[4];</div><div class="line"><a name="l00919"></a><span class="lineno"> 919</span>  <span class="keywordtype">size_t</span> count = 1;</div><div class="line"><a name="l00920"></a><span class="lineno"> 920</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00921"></a><span class="lineno"> 921</span> </div><div class="line"><a name="l00922"></a><span class="lineno"> 922</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00923"></a><span class="lineno"> 923</span>  arg.flags |= FUSE_IOCTL_RETRY;</div><div class="line"><a name="l00924"></a><span class="lineno"> 924</span>  arg.in_iovs = in_count;</div><div class="line"><a name="l00925"></a><span class="lineno"> 925</span>  arg.out_iovs = out_count;</div><div class="line"><a name="l00926"></a><span class="lineno"> 926</span>  iov[count].iov_base = &arg;</div><div class="line"><a name="l00927"></a><span class="lineno"> 927</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00928"></a><span class="lineno"> 928</span>  count++;</div><div class="line"><a name="l00929"></a><span class="lineno"> 929</span> </div><div class="line"><a name="l00930"></a><span class="lineno"> 930</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor < 16) {</div><div class="line"><a name="l00931"></a><span class="lineno"> 931</span>  <span class="keywordflow">if</span> (in_count) {</div><div class="line"><a name="l00932"></a><span class="lineno"> 932</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)in_iov;</div><div class="line"><a name="l00933"></a><span class="lineno"> 933</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(in_iov[0]) * in_count;</div><div class="line"><a name="l00934"></a><span class="lineno"> 934</span>  count++;</div><div class="line"><a name="l00935"></a><span class="lineno"> 935</span>  }</div><div class="line"><a name="l00936"></a><span class="lineno"> 936</span> </div><div class="line"><a name="l00937"></a><span class="lineno"> 937</span>  <span class="keywordflow">if</span> (out_count) {</div><div class="line"><a name="l00938"></a><span class="lineno"> 938</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)out_iov;</div><div class="line"><a name="l00939"></a><span class="lineno"> 939</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(out_iov[0]) * out_count;</div><div class="line"><a name="l00940"></a><span class="lineno"> 940</span>  count++;</div><div class="line"><a name="l00941"></a><span class="lineno"> 941</span>  }</div><div class="line"><a name="l00942"></a><span class="lineno"> 942</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00943"></a><span class="lineno"> 943</span>  <span class="comment">/* Can't handle non-compat 64bit ioctls on 32bit */</span></div><div class="line"><a name="l00944"></a><span class="lineno"> 944</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span> *) == 4 && req->ioctl_64bit) {</div><div class="line"><a name="l00945"></a><span class="lineno"> 945</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EINVAL);</div><div class="line"><a name="l00946"></a><span class="lineno"> 946</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l00947"></a><span class="lineno"> 947</span>  }</div><div class="line"><a name="l00948"></a><span class="lineno"> 948</span> </div><div class="line"><a name="l00949"></a><span class="lineno"> 949</span>  <span class="keywordflow">if</span> (in_count) {</div><div class="line"><a name="l00950"></a><span class="lineno"> 950</span>  in_fiov = fuse_ioctl_iovec_copy(in_iov, in_count);</div><div class="line"><a name="l00951"></a><span class="lineno"> 951</span>  <span class="keywordflow">if</span> (!in_fiov)</div><div class="line"><a name="l00952"></a><span class="lineno"> 952</span>  <span class="keywordflow">goto</span> enomem;</div><div class="line"><a name="l00953"></a><span class="lineno"> 953</span> </div><div class="line"><a name="l00954"></a><span class="lineno"> 954</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)in_fiov;</div><div class="line"><a name="l00955"></a><span class="lineno"> 955</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(in_fiov[0]) * in_count;</div><div class="line"><a name="l00956"></a><span class="lineno"> 956</span>  count++;</div><div class="line"><a name="l00957"></a><span class="lineno"> 957</span>  }</div><div class="line"><a name="l00958"></a><span class="lineno"> 958</span>  <span class="keywordflow">if</span> (out_count) {</div><div class="line"><a name="l00959"></a><span class="lineno"> 959</span>  out_fiov = fuse_ioctl_iovec_copy(out_iov, out_count);</div><div class="line"><a name="l00960"></a><span class="lineno"> 960</span>  <span class="keywordflow">if</span> (!out_fiov)</div><div class="line"><a name="l00961"></a><span class="lineno"> 961</span>  <span class="keywordflow">goto</span> enomem;</div><div class="line"><a name="l00962"></a><span class="lineno"> 962</span> </div><div class="line"><a name="l00963"></a><span class="lineno"> 963</span>  iov[count].iov_base = (<span class="keywordtype">void</span> *)out_fiov;</div><div class="line"><a name="l00964"></a><span class="lineno"> 964</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(out_fiov[0]) * out_count;</div><div class="line"><a name="l00965"></a><span class="lineno"> 965</span>  count++;</div><div class="line"><a name="l00966"></a><span class="lineno"> 966</span>  }</div><div class="line"><a name="l00967"></a><span class="lineno"> 967</span>  }</div><div class="line"><a name="l00968"></a><span class="lineno"> 968</span> </div><div class="line"><a name="l00969"></a><span class="lineno"> 969</span>  res = send_reply_iov(req, 0, iov, count);</div><div class="line"><a name="l00970"></a><span class="lineno"> 970</span> out:</div><div class="line"><a name="l00971"></a><span class="lineno"> 971</span>  free(in_fiov);</div><div class="line"><a name="l00972"></a><span class="lineno"> 972</span>  free(out_fiov);</div><div class="line"><a name="l00973"></a><span class="lineno"> 973</span> </div><div class="line"><a name="l00974"></a><span class="lineno"> 974</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00975"></a><span class="lineno"> 975</span> </div><div class="line"><a name="l00976"></a><span class="lineno"> 976</span> enomem:</div><div class="line"><a name="l00977"></a><span class="lineno"> 977</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l00978"></a><span class="lineno"> 978</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l00979"></a><span class="lineno"> 979</span> }</div><div class="line"><a name="l00980"></a><span class="lineno"> 980</span> </div><div class="line"><a name="l00981"></a><span class="lineno"> 981</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#adf7f34f470c04f276b7091ad3b3dcb31">fuse_reply_ioctl</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> result, <span class="keyword">const</span> <span class="keywordtype">void</span> *buf, <span class="keywordtype">size_t</span> size)</div><div class="line"><a name="l00982"></a><span class="lineno"> 982</span> {</div><div class="line"><a name="l00983"></a><span class="lineno"> 983</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l00984"></a><span class="lineno"> 984</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l00985"></a><span class="lineno"> 985</span>  <span class="keywordtype">size_t</span> count = 1;</div><div class="line"><a name="l00986"></a><span class="lineno"> 986</span> </div><div class="line"><a name="l00987"></a><span class="lineno"> 987</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l00988"></a><span class="lineno"> 988</span>  arg.result = result;</div><div class="line"><a name="l00989"></a><span class="lineno"> 989</span>  iov[count].iov_base = &arg;</div><div class="line"><a name="l00990"></a><span class="lineno"> 990</span>  iov[count].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l00991"></a><span class="lineno"> 991</span>  count++;</div><div class="line"><a name="l00992"></a><span class="lineno"> 992</span> </div><div class="line"><a name="l00993"></a><span class="lineno"> 993</span>  <span class="keywordflow">if</span> (size) {</div><div class="line"><a name="l00994"></a><span class="lineno"> 994</span>  iov[count].iov_base = (<span class="keywordtype">char</span> *) buf;</div><div class="line"><a name="l00995"></a><span class="lineno"> 995</span>  iov[count].iov_len = size;</div><div class="line"><a name="l00996"></a><span class="lineno"> 996</span>  count++;</div><div class="line"><a name="l00997"></a><span class="lineno"> 997</span>  }</div><div class="line"><a name="l00998"></a><span class="lineno"> 998</span> </div><div class="line"><a name="l00999"></a><span class="lineno"> 999</span>  <span class="keywordflow">return</span> send_reply_iov(req, 0, iov, count);</div><div class="line"><a name="l01000"></a><span class="lineno"> 1000</span> }</div><div class="line"><a name="l01001"></a><span class="lineno"> 1001</span> </div><div class="line"><a name="l01002"></a><span class="lineno"> 1002</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a37381eb84c39e5fe3af9f3ef507aeeb7">fuse_reply_ioctl_iov</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> result, <span class="keyword">const</span> <span class="keyword">struct</span> iovec *iov,</div><div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>  <span class="keywordtype">int</span> count)</div><div class="line"><a name="l01004"></a><span class="lineno"> 1004</span> {</div><div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>  <span class="keyword">struct </span>iovec *padded_iov;</div><div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>  <span class="keyword">struct </span>fuse_ioctl_out arg;</div><div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l01008"></a><span class="lineno"> 1008</span> </div><div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>  padded_iov = malloc((count + 2) * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>  <span class="keywordflow">if</span> (padded_iov == NULL)</div><div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l01012"></a><span class="lineno"> 1012</span> </div><div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>  arg.result = result;</div><div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>  padded_iov[1].iov_base = &arg;</div><div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>  padded_iov[1].iov_len = <span class="keyword">sizeof</span>(arg);</div><div class="line"><a name="l01017"></a><span class="lineno"> 1017</span> </div><div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>  memcpy(&padded_iov[2], iov, count * <span class="keyword">sizeof</span>(<span class="keyword">struct</span> iovec));</div><div class="line"><a name="l01019"></a><span class="lineno"> 1019</span> </div><div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>  res = send_reply_iov(req, 0, padded_iov, count + 2);</div><div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>  free(padded_iov);</div><div class="line"><a name="l01022"></a><span class="lineno"> 1022</span> </div><div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l01024"></a><span class="lineno"> 1024</span> }</div><div class="line"><a name="l01025"></a><span class="lineno"> 1025</span> </div><div class="line"><a name="l01026"></a><span class="lineno"> 1026</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2172d260d34c76c25cd601870aee4220">fuse_reply_poll</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">unsigned</span> revents)</div><div class="line"><a name="l01027"></a><span class="lineno"> 1027</span> {</div><div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>  <span class="keyword">struct </span>fuse_poll_out arg;</div><div class="line"><a name="l01029"></a><span class="lineno"> 1029</span> </div><div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>  memset(&arg, 0, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>  arg.revents = revents;</div><div class="line"><a name="l01032"></a><span class="lineno"> 1032</span> </div><div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>  <span class="keywordflow">return</span> send_reply_ok(req, &arg, <span class="keyword">sizeof</span>(arg));</div><div class="line"><a name="l01034"></a><span class="lineno"> 1034</span> }</div><div class="line"><a name="l01035"></a><span class="lineno"> 1035</span> </div><div class="line"><a name="l01036"></a><span class="lineno"> 1036</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_lookup(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01037"></a><span class="lineno"> 1037</span> {</div><div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01039"></a><span class="lineno"> 1039</span> </div><div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>  <span class="keywordflow">if</span> (req->se->op.lookup)</div><div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>  req->se->op.lookup(req, nodeid, name);</div><div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01044"></a><span class="lineno"> 1044</span> }</div><div class="line"><a name="l01045"></a><span class="lineno"> 1045</span> </div><div class="line"><a name="l01046"></a><span class="lineno"> 1046</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_forget(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01047"></a><span class="lineno"> 1047</span> {</div><div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>  <span class="keyword">struct </span>fuse_forget_in *arg = (<span class="keyword">struct </span>fuse_forget_in *) inarg;</div><div class="line"><a name="l01049"></a><span class="lineno"> 1049</span> </div><div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>  <span class="keywordflow">if</span> (req->se->op.forget)</div><div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>  req->se->op.forget(req, nodeid, arg->nlookup);</div><div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01054"></a><span class="lineno"> 1054</span> }</div><div class="line"><a name="l01055"></a><span class="lineno"> 1055</span> </div><div class="line"><a name="l01056"></a><span class="lineno"> 1056</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_batch_forget(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01058"></a><span class="lineno"> 1058</span> {</div><div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>  <span class="keyword">struct </span>fuse_batch_forget_in *arg = (<span class="keywordtype">void</span> *) inarg;</div><div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>  <span class="keyword">struct </span>fuse_forget_one *param = (<span class="keywordtype">void</span> *) PARAM(arg);</div><div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;</div><div class="line"><a name="l01062"></a><span class="lineno"> 1062</span> </div><div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>  (void) nodeid;</div><div class="line"><a name="l01064"></a><span class="lineno"> 1064</span> </div><div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>  <span class="keywordflow">if</span> (req->se->op.forget_multi) {</div><div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>  req->se->op.forget_multi(req, arg->count,</div><div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>  (<span class="keyword">struct</span> fuse_forget_data *) param);</div><div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (req->se->op.forget) {</div><div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>  <span class="keywordflow">for</span> (i = 0; i < arg->count; i++) {</div><div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>  <span class="keyword">struct </span>fuse_forget_one *forget = &param[i];</div><div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>  <span class="keyword">struct </span>fuse_req *dummy_req;</div><div class="line"><a name="l01072"></a><span class="lineno"> 1072</span> </div><div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>  dummy_req = fuse_ll_alloc_req(req->se);</div><div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>  <span class="keywordflow">if</span> (dummy_req == NULL)</div><div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01076"></a><span class="lineno"> 1076</span> </div><div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>  dummy_req->unique = req->unique;</div><div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>  dummy_req->ctx = req->ctx;</div><div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>  dummy_req->ch = NULL;</div><div class="line"><a name="l01080"></a><span class="lineno"> 1080</span> </div><div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>  req->se->op.forget(dummy_req, forget->nodeid,</div><div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>  forget->nlookup);</div><div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>  }</div><div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>  }</div><div class="line"><a name="l01088"></a><span class="lineno"> 1088</span> }</div><div class="line"><a name="l01089"></a><span class="lineno"> 1089</span> </div><div class="line"><a name="l01090"></a><span class="lineno"> 1090</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01091"></a><span class="lineno"> 1091</span> {</div><div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fip = NULL;</div><div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01094"></a><span class="lineno"> 1094</span> </div><div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 9) {</div><div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>  <span class="keyword">struct </span>fuse_getattr_in *arg = (<span class="keyword">struct </span>fuse_getattr_in *) inarg;</div><div class="line"><a name="l01097"></a><span class="lineno"> 1097</span> </div><div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>  <span class="keywordflow">if</span> (arg->getattr_flags & FUSE_GETATTR_FH) {</div><div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>  fi.fh = arg->fh;</div><div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>  fip = &fi;</div><div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>  }</div><div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>  }</div><div class="line"><a name="l01104"></a><span class="lineno"> 1104</span> </div><div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>  <span class="keywordflow">if</span> (req->se->op.getattr)</div><div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>  req->se->op.getattr(req, nodeid, fip);</div><div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01109"></a><span class="lineno"> 1109</span> }</div><div class="line"><a name="l01110"></a><span class="lineno"> 1110</span> </div><div class="line"><a name="l01111"></a><span class="lineno"> 1111</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01112"></a><span class="lineno"> 1112</span> {</div><div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>  <span class="keyword">struct </span>fuse_setattr_in *arg = (<span class="keyword">struct </span>fuse_setattr_in *) inarg;</div><div class="line"><a name="l01114"></a><span class="lineno"> 1114</span> </div><div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>  <span class="keywordflow">if</span> (req->se->op.setattr) {</div><div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> *fi = NULL;</div><div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi_store;</div><div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>  <span class="keyword">struct </span>stat stbuf;</div><div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>  memset(&stbuf, 0, <span class="keyword">sizeof</span>(stbuf));</div><div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>  convert_attr(arg, &stbuf);</div><div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>  <span class="keywordflow">if</span> (arg->valid & FATTR_FH) {</div><div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>  arg->valid &= ~FATTR_FH;</div><div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>  memset(&fi_store, 0, <span class="keyword">sizeof</span>(fi_store));</div><div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>  fi = &fi_store;</div><div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>  fi-><a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>  }</div><div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>  arg->valid &=</div><div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>  FUSE_SET_ATTR_MODE |</div><div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>  FUSE_SET_ATTR_UID |</div><div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>  FUSE_SET_ATTR_GID |</div><div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>  FUSE_SET_ATTR_SIZE |</div><div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>  FUSE_SET_ATTR_ATIME |</div><div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>  FUSE_SET_ATTR_MTIME |</div><div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>  FUSE_SET_ATTR_ATIME_NOW |</div><div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>  FUSE_SET_ATTR_MTIME_NOW |</div><div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>  FUSE_SET_ATTR_CTIME;</div><div class="line"><a name="l01137"></a><span class="lineno"> 1137</span> </div><div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>  req->se->op.setattr(req, nodeid, &stbuf, arg->valid, fi);</div><div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01141"></a><span class="lineno"> 1141</span> }</div><div class="line"><a name="l01142"></a><span class="lineno"> 1142</span> </div><div class="line"><a name="l01143"></a><span class="lineno"> 1143</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_access(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01144"></a><span class="lineno"> 1144</span> {</div><div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>  <span class="keyword">struct </span>fuse_access_in *arg = (<span class="keyword">struct </span>fuse_access_in *) inarg;</div><div class="line"><a name="l01146"></a><span class="lineno"> 1146</span> </div><div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>  <span class="keywordflow">if</span> (req->se->op.access)</div><div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>  req->se->op.access(req, nodeid, arg->mask);</div><div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01151"></a><span class="lineno"> 1151</span> }</div><div class="line"><a name="l01152"></a><span class="lineno"> 1152</span> </div><div class="line"><a name="l01153"></a><span class="lineno"> 1153</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01154"></a><span class="lineno"> 1154</span> {</div><div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>  (void) inarg;</div><div class="line"><a name="l01156"></a><span class="lineno"> 1156</span> </div><div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>  <span class="keywordflow">if</span> (req->se->op.readlink)</div><div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>  req->se->op.readlink(req, nodeid);</div><div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01161"></a><span class="lineno"> 1161</span> }</div><div class="line"><a name="l01162"></a><span class="lineno"> 1162</span> </div><div class="line"><a name="l01163"></a><span class="lineno"> 1163</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_mknod(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01164"></a><span class="lineno"> 1164</span> {</div><div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>  <span class="keyword">struct </span>fuse_mknod_in *arg = (<span class="keyword">struct </span>fuse_mknod_in *) inarg;</div><div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01167"></a><span class="lineno"> 1167</span> </div><div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>  name = (<span class="keywordtype">char</span> *) inarg + FUSE_COMPAT_MKNOD_IN_SIZE;</div><div class="line"><a name="l01172"></a><span class="lineno"> 1172</span> </div><div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>  <span class="keywordflow">if</span> (req->se->op.mknod)</div><div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>  req->se->op.mknod(req, nodeid, name, arg->mode, arg->rdev);</div><div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01177"></a><span class="lineno"> 1177</span> }</div><div class="line"><a name="l01178"></a><span class="lineno"> 1178</span> </div><div class="line"><a name="l01179"></a><span class="lineno"> 1179</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_mkdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01180"></a><span class="lineno"> 1180</span> {</div><div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>  <span class="keyword">struct </span>fuse_mkdir_in *arg = (<span class="keyword">struct </span>fuse_mkdir_in *) inarg;</div><div class="line"><a name="l01182"></a><span class="lineno"> 1182</span> </div><div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01185"></a><span class="lineno"> 1185</span> </div><div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>  <span class="keywordflow">if</span> (req->se->op.mkdir)</div><div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>  req->se->op.mkdir(req, nodeid, PARAM(arg), arg->mode);</div><div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01190"></a><span class="lineno"> 1190</span> }</div><div class="line"><a name="l01191"></a><span class="lineno"> 1191</span> </div><div class="line"><a name="l01192"></a><span class="lineno"> 1192</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_unlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01193"></a><span class="lineno"> 1193</span> {</div><div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01195"></a><span class="lineno"> 1195</span> </div><div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>  <span class="keywordflow">if</span> (req->se->op.unlink)</div><div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>  req->se->op.unlink(req, nodeid, name);</div><div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01200"></a><span class="lineno"> 1200</span> }</div><div class="line"><a name="l01201"></a><span class="lineno"> 1201</span> </div><div class="line"><a name="l01202"></a><span class="lineno"> 1202</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rmdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01203"></a><span class="lineno"> 1203</span> {</div><div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01205"></a><span class="lineno"> 1205</span> </div><div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>  <span class="keywordflow">if</span> (req->se->op.rmdir)</div><div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>  req->se->op.rmdir(req, nodeid, name);</div><div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01210"></a><span class="lineno"> 1210</span> }</div><div class="line"><a name="l01211"></a><span class="lineno"> 1211</span> </div><div class="line"><a name="l01212"></a><span class="lineno"> 1212</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_symlink(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01213"></a><span class="lineno"> 1213</span> {</div><div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>  <span class="keywordtype">char</span> *linkname = ((<span class="keywordtype">char</span> *) inarg) + strlen((<span class="keywordtype">char</span> *) inarg) + 1;</div><div class="line"><a name="l01216"></a><span class="lineno"> 1216</span> </div><div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>  <span class="keywordflow">if</span> (req->se->op.symlink)</div><div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>  req->se->op.symlink(req, linkname, nodeid, name);</div><div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01221"></a><span class="lineno"> 1221</span> }</div><div class="line"><a name="l01222"></a><span class="lineno"> 1222</span> </div><div class="line"><a name="l01223"></a><span class="lineno"> 1223</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rename(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01224"></a><span class="lineno"> 1224</span> {</div><div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>  <span class="keyword">struct </span>fuse_rename_in *arg = (<span class="keyword">struct </span>fuse_rename_in *) inarg;</div><div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>  <span class="keywordtype">char</span> *oldname = PARAM(arg);</div><div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>  <span class="keywordtype">char</span> *newname = oldname + strlen(oldname) + 1;</div><div class="line"><a name="l01228"></a><span class="lineno"> 1228</span> </div><div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>  <span class="keywordflow">if</span> (req->se->op.rename)</div><div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>  req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,</div><div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>  0);</div><div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01234"></a><span class="lineno"> 1234</span> }</div><div class="line"><a name="l01235"></a><span class="lineno"> 1235</span> </div><div class="line"><a name="l01236"></a><span class="lineno"> 1236</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_rename2(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01237"></a><span class="lineno"> 1237</span> {</div><div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>  <span class="keyword">struct </span>fuse_rename2_in *arg = (<span class="keyword">struct </span>fuse_rename2_in *) inarg;</div><div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>  <span class="keywordtype">char</span> *oldname = PARAM(arg);</div><div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>  <span class="keywordtype">char</span> *newname = oldname + strlen(oldname) + 1;</div><div class="line"><a name="l01241"></a><span class="lineno"> 1241</span> </div><div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>  <span class="keywordflow">if</span> (req->se->op.rename)</div><div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>  req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,</div><div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>  arg->flags);</div><div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01247"></a><span class="lineno"> 1247</span> }</div><div class="line"><a name="l01248"></a><span class="lineno"> 1248</span> </div><div class="line"><a name="l01249"></a><span class="lineno"> 1249</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_link(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01250"></a><span class="lineno"> 1250</span> {</div><div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>  <span class="keyword">struct </span>fuse_link_in *arg = (<span class="keyword">struct </span>fuse_link_in *) inarg;</div><div class="line"><a name="l01252"></a><span class="lineno"> 1252</span> </div><div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>  <span class="keywordflow">if</span> (req->se->op.link)</div><div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>  req->se->op.link(req, arg->oldnodeid, nodeid, PARAM(arg));</div><div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01257"></a><span class="lineno"> 1257</span> }</div><div class="line"><a name="l01258"></a><span class="lineno"> 1258</span> </div><div class="line"><a name="l01259"></a><span class="lineno"> 1259</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_create(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01260"></a><span class="lineno"> 1260</span> {</div><div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>  <span class="keyword">struct </span>fuse_create_in *arg = (<span class="keyword">struct </span>fuse_create_in *) inarg;</div><div class="line"><a name="l01262"></a><span class="lineno"> 1262</span> </div><div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>  <span class="keywordflow">if</span> (req->se->op.create) {</div><div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01266"></a><span class="lineno"> 1266</span> </div><div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01269"></a><span class="lineno"> 1269</span> </div><div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 12)</div><div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>  req->ctx.umask = arg->umask;</div><div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>  name = (<span class="keywordtype">char</span> *) inarg + <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_open_in);</div><div class="line"><a name="l01274"></a><span class="lineno"> 1274</span> </div><div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>  req->se->op.create(req, nodeid, name, arg->mode, &fi);</div><div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01278"></a><span class="lineno"> 1278</span> }</div><div class="line"><a name="l01279"></a><span class="lineno"> 1279</span> </div><div class="line"><a name="l01280"></a><span class="lineno"> 1280</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_open(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01281"></a><span class="lineno"> 1281</span> {</div><div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>  <span class="keyword">struct </span>fuse_open_in *arg = (<span class="keyword">struct </span>fuse_open_in *) inarg;</div><div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01284"></a><span class="lineno"> 1284</span> </div><div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01287"></a><span class="lineno"> 1287</span> </div><div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>  <span class="keywordflow">if</span> (req->se->op.open)</div><div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>  req->se->op.open(req, nodeid, &fi);</div><div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(req, &fi);</div><div class="line"><a name="l01292"></a><span class="lineno"> 1292</span> }</div><div class="line"><a name="l01293"></a><span class="lineno"> 1293</span> </div><div class="line"><a name="l01294"></a><span class="lineno"> 1294</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_read(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01295"></a><span class="lineno"> 1295</span> {</div><div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01297"></a><span class="lineno"> 1297</span> </div><div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>  <span class="keywordflow">if</span> (req->se->op.read) {</div><div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01300"></a><span class="lineno"> 1300</span> </div><div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 9) {</div><div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>  }</div><div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>  req->se->op.read(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01310"></a><span class="lineno"> 1310</span> }</div><div class="line"><a name="l01311"></a><span class="lineno"> 1311</span> </div><div class="line"><a name="l01312"></a><span class="lineno"> 1312</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_write(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01313"></a><span class="lineno"> 1313</span> {</div><div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>  <span class="keyword">struct </span>fuse_write_in *arg = (<span class="keyword">struct </span>fuse_write_in *) inarg;</div><div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>  <span class="keywordtype">char</span> *param;</div><div class="line"><a name="l01317"></a><span class="lineno"> 1317</span> </div><div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>  fi.<a class="code" href="structfuse__file__info.html#a984187caa62aafc15abf9ff621667f3d">writepage</a> = (arg->write_flags & FUSE_WRITE_CACHE) != 0;</div><div class="line"><a name="l01321"></a><span class="lineno"> 1321</span> </div><div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor < 9) {</div><div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>  param = ((<span class="keywordtype">char</span> *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>  param = PARAM(arg);</div><div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>  }</div><div class="line"><a name="l01329"></a><span class="lineno"> 1329</span> </div><div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>  <span class="keywordflow">if</span> (req->se->op.write)</div><div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>  req->se->op.write(req, nodeid, param, arg->size,</div><div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>  arg->offset, &fi);</div><div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01335"></a><span class="lineno"> 1335</span> }</div><div class="line"><a name="l01336"></a><span class="lineno"> 1336</span> </div><div class="line"><a name="l01337"></a><span class="lineno"> 1337</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_write_buf(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg,</div><div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *ibuf)</div><div class="line"><a name="l01339"></a><span class="lineno"> 1339</span> {</div><div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = {</div><div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>  .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *ibuf,</div><div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>  .count = 1,</div><div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>  };</div><div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>  <span class="keyword">struct </span>fuse_write_in *arg = (<span class="keyword">struct </span>fuse_write_in *) inarg;</div><div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01347"></a><span class="lineno"> 1347</span> </div><div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>  fi.<a class="code" href="structfuse__file__info.html#a984187caa62aafc15abf9ff621667f3d">writepage</a> = arg->write_flags & FUSE_WRITE_CACHE;</div><div class="line"><a name="l01351"></a><span class="lineno"> 1351</span> </div><div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 9) {</div><div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = ((<span class="keywordtype">char</span> *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>  FUSE_COMPAT_WRITE_IN_SIZE;</div><div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>  assert(!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD));</div><div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01359"></a><span class="lineno"> 1359</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01360"></a><span class="lineno"> 1360</span>  <span class="keywordflow">if</span> (!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD))</div><div class="line"><a name="l01361"></a><span class="lineno"> 1361</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = PARAM(arg);</div><div class="line"><a name="l01362"></a><span class="lineno"> 1362</span> </div><div class="line"><a name="l01363"></a><span class="lineno"> 1363</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l01364"></a><span class="lineno"> 1364</span>  sizeof(struct fuse_write_in);</div><div class="line"><a name="l01365"></a><span class="lineno"> 1365</span>  }</div><div class="line"><a name="l01366"></a><span class="lineno"> 1366</span>  <span class="keywordflow">if</span> (bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < arg->size) {</div><div class="line"><a name="l01367"></a><span class="lineno"> 1367</span>  fprintf(stderr, <span class="stringliteral">"fuse: do_write_buf: buffer size too small\n"</span>);</div><div class="line"><a name="l01368"></a><span class="lineno"> 1368</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EIO);</div><div class="line"><a name="l01369"></a><span class="lineno"> 1369</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l01370"></a><span class="lineno"> 1370</span>  }</div><div class="line"><a name="l01371"></a><span class="lineno"> 1371</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = arg->size;</div><div class="line"><a name="l01372"></a><span class="lineno"> 1372</span> </div><div class="line"><a name="l01373"></a><span class="lineno"> 1373</span>  se->op.write_buf(req, nodeid, &bufv, arg->offset, &fi);</div><div class="line"><a name="l01374"></a><span class="lineno"> 1374</span> </div><div class="line"><a name="l01375"></a><span class="lineno"> 1375</span> out:</div><div class="line"><a name="l01376"></a><span class="lineno"> 1376</span>  <span class="comment">/* Need to reset the pipe if ->write_buf() didn't consume all data */</span></div><div class="line"><a name="l01377"></a><span class="lineno"> 1377</span>  <span class="keywordflow">if</span> ((ibuf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) && bufv.<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> < bufv.<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a>)</div><div class="line"><a name="l01378"></a><span class="lineno"> 1378</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l01379"></a><span class="lineno"> 1379</span> }</div><div class="line"><a name="l01380"></a><span class="lineno"> 1380</span> </div><div class="line"><a name="l01381"></a><span class="lineno"> 1381</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_flush(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01382"></a><span class="lineno"> 1382</span> {</div><div class="line"><a name="l01383"></a><span class="lineno"> 1383</span>  <span class="keyword">struct </span>fuse_flush_in *arg = (<span class="keyword">struct </span>fuse_flush_in *) inarg;</div><div class="line"><a name="l01384"></a><span class="lineno"> 1384</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01385"></a><span class="lineno"> 1385</span> </div><div class="line"><a name="l01386"></a><span class="lineno"> 1386</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01387"></a><span class="lineno"> 1387</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01388"></a><span class="lineno"> 1388</span>  fi.<a class="code" href="structfuse__file__info.html#a9c1571cb4b6be75827f48aac5891606c">flush</a> = 1;</div><div class="line"><a name="l01389"></a><span class="lineno"> 1389</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 7)</div><div class="line"><a name="l01390"></a><span class="lineno"> 1390</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01391"></a><span class="lineno"> 1391</span> </div><div class="line"><a name="l01392"></a><span class="lineno"> 1392</span>  <span class="keywordflow">if</span> (req->se->op.flush)</div><div class="line"><a name="l01393"></a><span class="lineno"> 1393</span>  req->se->op.flush(req, nodeid, &fi);</div><div class="line"><a name="l01394"></a><span class="lineno"> 1394</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01395"></a><span class="lineno"> 1395</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01396"></a><span class="lineno"> 1396</span> }</div><div class="line"><a name="l01397"></a><span class="lineno"> 1397</span> </div><div class="line"><a name="l01398"></a><span class="lineno"> 1398</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_release(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01399"></a><span class="lineno"> 1399</span> {</div><div class="line"><a name="l01400"></a><span class="lineno"> 1400</span>  <span class="keyword">struct </span>fuse_release_in *arg = (<span class="keyword">struct </span>fuse_release_in *) inarg;</div><div class="line"><a name="l01401"></a><span class="lineno"> 1401</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01402"></a><span class="lineno"> 1402</span> </div><div class="line"><a name="l01403"></a><span class="lineno"> 1403</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01404"></a><span class="lineno"> 1404</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01405"></a><span class="lineno"> 1405</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01406"></a><span class="lineno"> 1406</span>  <span class="keywordflow">if</span> (req->se->conn.proto_minor >= 8) {</div><div class="line"><a name="l01407"></a><span class="lineno"> 1407</span>  fi.<a class="code" href="structfuse__file__info.html#a9c1571cb4b6be75827f48aac5891606c">flush</a> = (arg->release_flags & FUSE_RELEASE_FLUSH) ? 1 : 0;</div><div class="line"><a name="l01408"></a><span class="lineno"> 1408</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01409"></a><span class="lineno"> 1409</span>  }</div><div class="line"><a name="l01410"></a><span class="lineno"> 1410</span>  <span class="keywordflow">if</span> (arg->release_flags & FUSE_RELEASE_FLOCK_UNLOCK) {</div><div class="line"><a name="l01411"></a><span class="lineno"> 1411</span>  fi.flock_release = 1;</div><div class="line"><a name="l01412"></a><span class="lineno"> 1412</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->lock_owner;</div><div class="line"><a name="l01413"></a><span class="lineno"> 1413</span>  }</div><div class="line"><a name="l01414"></a><span class="lineno"> 1414</span> </div><div class="line"><a name="l01415"></a><span class="lineno"> 1415</span>  <span class="keywordflow">if</span> (req->se->op.release)</div><div class="line"><a name="l01416"></a><span class="lineno"> 1416</span>  req->se->op.release(req, nodeid, &fi);</div><div class="line"><a name="l01417"></a><span class="lineno"> 1417</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01418"></a><span class="lineno"> 1418</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, 0);</div><div class="line"><a name="l01419"></a><span class="lineno"> 1419</span> }</div><div class="line"><a name="l01420"></a><span class="lineno"> 1420</span> </div><div class="line"><a name="l01421"></a><span class="lineno"> 1421</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fsync(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01422"></a><span class="lineno"> 1422</span> {</div><div class="line"><a name="l01423"></a><span class="lineno"> 1423</span>  <span class="keyword">struct </span>fuse_fsync_in *arg = (<span class="keyword">struct </span>fuse_fsync_in *) inarg;</div><div class="line"><a name="l01424"></a><span class="lineno"> 1424</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01425"></a><span class="lineno"> 1425</span>  <span class="keywordtype">int</span> datasync = arg->fsync_flags & 1;</div><div class="line"><a name="l01426"></a><span class="lineno"> 1426</span> </div><div class="line"><a name="l01427"></a><span class="lineno"> 1427</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01428"></a><span class="lineno"> 1428</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01429"></a><span class="lineno"> 1429</span> </div><div class="line"><a name="l01430"></a><span class="lineno"> 1430</span>  <span class="keywordflow">if</span> (req->se->op.fsync)</div><div class="line"><a name="l01431"></a><span class="lineno"> 1431</span>  req->se->op.fsync(req, nodeid, datasync, &fi);</div><div class="line"><a name="l01432"></a><span class="lineno"> 1432</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01433"></a><span class="lineno"> 1433</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01434"></a><span class="lineno"> 1434</span> }</div><div class="line"><a name="l01435"></a><span class="lineno"> 1435</span> </div><div class="line"><a name="l01436"></a><span class="lineno"> 1436</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_opendir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01437"></a><span class="lineno"> 1437</span> {</div><div class="line"><a name="l01438"></a><span class="lineno"> 1438</span>  <span class="keyword">struct </span>fuse_open_in *arg = (<span class="keyword">struct </span>fuse_open_in *) inarg;</div><div class="line"><a name="l01439"></a><span class="lineno"> 1439</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01440"></a><span class="lineno"> 1440</span> </div><div class="line"><a name="l01441"></a><span class="lineno"> 1441</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01442"></a><span class="lineno"> 1442</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01443"></a><span class="lineno"> 1443</span> </div><div class="line"><a name="l01444"></a><span class="lineno"> 1444</span>  <span class="keywordflow">if</span> (req->se->op.opendir)</div><div class="line"><a name="l01445"></a><span class="lineno"> 1445</span>  req->se->op.opendir(req, nodeid, &fi);</div><div class="line"><a name="l01446"></a><span class="lineno"> 1446</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01447"></a><span class="lineno"> 1447</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a170f8c6b953d70928e83bcecee43bfdc">fuse_reply_open</a>(req, &fi);</div><div class="line"><a name="l01448"></a><span class="lineno"> 1448</span> }</div><div class="line"><a name="l01449"></a><span class="lineno"> 1449</span> </div><div class="line"><a name="l01450"></a><span class="lineno"> 1450</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01451"></a><span class="lineno"> 1451</span> {</div><div class="line"><a name="l01452"></a><span class="lineno"> 1452</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01453"></a><span class="lineno"> 1453</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01454"></a><span class="lineno"> 1454</span> </div><div class="line"><a name="l01455"></a><span class="lineno"> 1455</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01456"></a><span class="lineno"> 1456</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01457"></a><span class="lineno"> 1457</span> </div><div class="line"><a name="l01458"></a><span class="lineno"> 1458</span>  <span class="keywordflow">if</span> (req->se->op.readdir)</div><div class="line"><a name="l01459"></a><span class="lineno"> 1459</span>  req->se->op.readdir(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01460"></a><span class="lineno"> 1460</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01461"></a><span class="lineno"> 1461</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01462"></a><span class="lineno"> 1462</span> }</div><div class="line"><a name="l01463"></a><span class="lineno"> 1463</span> </div><div class="line"><a name="l01464"></a><span class="lineno"> 1464</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_readdirplus(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01465"></a><span class="lineno"> 1465</span> {</div><div class="line"><a name="l01466"></a><span class="lineno"> 1466</span>  <span class="keyword">struct </span>fuse_read_in *arg = (<span class="keyword">struct </span>fuse_read_in *) inarg;</div><div class="line"><a name="l01467"></a><span class="lineno"> 1467</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01468"></a><span class="lineno"> 1468</span> </div><div class="line"><a name="l01469"></a><span class="lineno"> 1469</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01470"></a><span class="lineno"> 1470</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01471"></a><span class="lineno"> 1471</span> </div><div class="line"><a name="l01472"></a><span class="lineno"> 1472</span>  <span class="keywordflow">if</span> (req->se->op.readdirplus)</div><div class="line"><a name="l01473"></a><span class="lineno"> 1473</span>  req->se->op.readdirplus(req, nodeid, arg->size, arg->offset, &fi);</div><div class="line"><a name="l01474"></a><span class="lineno"> 1474</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01475"></a><span class="lineno"> 1475</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01476"></a><span class="lineno"> 1476</span> }</div><div class="line"><a name="l01477"></a><span class="lineno"> 1477</span> </div><div class="line"><a name="l01478"></a><span class="lineno"> 1478</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_releasedir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01479"></a><span class="lineno"> 1479</span> {</div><div class="line"><a name="l01480"></a><span class="lineno"> 1480</span>  <span class="keyword">struct </span>fuse_release_in *arg = (<span class="keyword">struct </span>fuse_release_in *) inarg;</div><div class="line"><a name="l01481"></a><span class="lineno"> 1481</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01482"></a><span class="lineno"> 1482</span> </div><div class="line"><a name="l01483"></a><span class="lineno"> 1483</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01484"></a><span class="lineno"> 1484</span>  fi.<a class="code" href="structfuse__file__info.html#ae7d31802727be19670193a411647bca5">flags</a> = arg->flags;</div><div class="line"><a name="l01485"></a><span class="lineno"> 1485</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01486"></a><span class="lineno"> 1486</span> </div><div class="line"><a name="l01487"></a><span class="lineno"> 1487</span>  <span class="keywordflow">if</span> (req->se->op.releasedir)</div><div class="line"><a name="l01488"></a><span class="lineno"> 1488</span>  req->se->op.releasedir(req, nodeid, &fi);</div><div class="line"><a name="l01489"></a><span class="lineno"> 1489</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01490"></a><span class="lineno"> 1490</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, 0);</div><div class="line"><a name="l01491"></a><span class="lineno"> 1491</span> }</div><div class="line"><a name="l01492"></a><span class="lineno"> 1492</span> </div><div class="line"><a name="l01493"></a><span class="lineno"> 1493</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fsyncdir(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01494"></a><span class="lineno"> 1494</span> {</div><div class="line"><a name="l01495"></a><span class="lineno"> 1495</span>  <span class="keyword">struct </span>fuse_fsync_in *arg = (<span class="keyword">struct </span>fuse_fsync_in *) inarg;</div><div class="line"><a name="l01496"></a><span class="lineno"> 1496</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01497"></a><span class="lineno"> 1497</span>  <span class="keywordtype">int</span> datasync = arg->fsync_flags & 1;</div><div class="line"><a name="l01498"></a><span class="lineno"> 1498</span> </div><div class="line"><a name="l01499"></a><span class="lineno"> 1499</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01500"></a><span class="lineno"> 1500</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01501"></a><span class="lineno"> 1501</span> </div><div class="line"><a name="l01502"></a><span class="lineno"> 1502</span>  <span class="keywordflow">if</span> (req->se->op.fsyncdir)</div><div class="line"><a name="l01503"></a><span class="lineno"> 1503</span>  req->se->op.fsyncdir(req, nodeid, datasync, &fi);</div><div class="line"><a name="l01504"></a><span class="lineno"> 1504</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01505"></a><span class="lineno"> 1505</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01506"></a><span class="lineno"> 1506</span> }</div><div class="line"><a name="l01507"></a><span class="lineno"> 1507</span> </div><div class="line"><a name="l01508"></a><span class="lineno"> 1508</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_statfs(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01509"></a><span class="lineno"> 1509</span> {</div><div class="line"><a name="l01510"></a><span class="lineno"> 1510</span>  (void) nodeid;</div><div class="line"><a name="l01511"></a><span class="lineno"> 1511</span>  (void) inarg;</div><div class="line"><a name="l01512"></a><span class="lineno"> 1512</span> </div><div class="line"><a name="l01513"></a><span class="lineno"> 1513</span>  <span class="keywordflow">if</span> (req->se->op.statfs)</div><div class="line"><a name="l01514"></a><span class="lineno"> 1514</span>  req->se->op.statfs(req, nodeid);</div><div class="line"><a name="l01515"></a><span class="lineno"> 1515</span>  <span class="keywordflow">else</span> {</div><div class="line"><a name="l01516"></a><span class="lineno"> 1516</span>  <span class="keyword">struct </span>statvfs buf = {</div><div class="line"><a name="l01517"></a><span class="lineno"> 1517</span>  .f_namemax = 255,</div><div class="line"><a name="l01518"></a><span class="lineno"> 1518</span>  .f_bsize = 512,</div><div class="line"><a name="l01519"></a><span class="lineno"> 1519</span>  };</div><div class="line"><a name="l01520"></a><span class="lineno"> 1520</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa1d95ec3ca674253baac3639ea10f0ff">fuse_reply_statfs</a>(req, &buf);</div><div class="line"><a name="l01521"></a><span class="lineno"> 1521</span>  }</div><div class="line"><a name="l01522"></a><span class="lineno"> 1522</span> }</div><div class="line"><a name="l01523"></a><span class="lineno"> 1523</span> </div><div class="line"><a name="l01524"></a><span class="lineno"> 1524</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01525"></a><span class="lineno"> 1525</span> {</div><div class="line"><a name="l01526"></a><span class="lineno"> 1526</span>  <span class="keyword">struct </span>fuse_setxattr_in *arg = (<span class="keyword">struct </span>fuse_setxattr_in *) inarg;</div><div class="line"><a name="l01527"></a><span class="lineno"> 1527</span>  <span class="keywordtype">char</span> *name = PARAM(arg);</div><div class="line"><a name="l01528"></a><span class="lineno"> 1528</span>  <span class="keywordtype">char</span> *value = name + strlen(name) + 1;</div><div class="line"><a name="l01529"></a><span class="lineno"> 1529</span> </div><div class="line"><a name="l01530"></a><span class="lineno"> 1530</span>  <span class="keywordflow">if</span> (req->se->op.setxattr)</div><div class="line"><a name="l01531"></a><span class="lineno"> 1531</span>  req->se->op.setxattr(req, nodeid, name, value, arg->size,</div><div class="line"><a name="l01532"></a><span class="lineno"> 1532</span>  arg->flags);</div><div class="line"><a name="l01533"></a><span class="lineno"> 1533</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01534"></a><span class="lineno"> 1534</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01535"></a><span class="lineno"> 1535</span> }</div><div class="line"><a name="l01536"></a><span class="lineno"> 1536</span> </div><div class="line"><a name="l01537"></a><span class="lineno"> 1537</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01538"></a><span class="lineno"> 1538</span> {</div><div class="line"><a name="l01539"></a><span class="lineno"> 1539</span>  <span class="keyword">struct </span>fuse_getxattr_in *arg = (<span class="keyword">struct </span>fuse_getxattr_in *) inarg;</div><div class="line"><a name="l01540"></a><span class="lineno"> 1540</span> </div><div class="line"><a name="l01541"></a><span class="lineno"> 1541</span>  <span class="keywordflow">if</span> (req->se->op.getxattr)</div><div class="line"><a name="l01542"></a><span class="lineno"> 1542</span>  req->se->op.getxattr(req, nodeid, PARAM(arg), arg->size);</div><div class="line"><a name="l01543"></a><span class="lineno"> 1543</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01544"></a><span class="lineno"> 1544</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01545"></a><span class="lineno"> 1545</span> }</div><div class="line"><a name="l01546"></a><span class="lineno"> 1546</span> </div><div class="line"><a name="l01547"></a><span class="lineno"> 1547</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_listxattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01548"></a><span class="lineno"> 1548</span> {</div><div class="line"><a name="l01549"></a><span class="lineno"> 1549</span>  <span class="keyword">struct </span>fuse_getxattr_in *arg = (<span class="keyword">struct </span>fuse_getxattr_in *) inarg;</div><div class="line"><a name="l01550"></a><span class="lineno"> 1550</span> </div><div class="line"><a name="l01551"></a><span class="lineno"> 1551</span>  <span class="keywordflow">if</span> (req->se->op.listxattr)</div><div class="line"><a name="l01552"></a><span class="lineno"> 1552</span>  req->se->op.listxattr(req, nodeid, arg->size);</div><div class="line"><a name="l01553"></a><span class="lineno"> 1553</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01554"></a><span class="lineno"> 1554</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01555"></a><span class="lineno"> 1555</span> }</div><div class="line"><a name="l01556"></a><span class="lineno"> 1556</span> </div><div class="line"><a name="l01557"></a><span class="lineno"> 1557</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_removexattr(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01558"></a><span class="lineno"> 1558</span> {</div><div class="line"><a name="l01559"></a><span class="lineno"> 1559</span>  <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span> *) inarg;</div><div class="line"><a name="l01560"></a><span class="lineno"> 1560</span> </div><div class="line"><a name="l01561"></a><span class="lineno"> 1561</span>  <span class="keywordflow">if</span> (req->se->op.removexattr)</div><div class="line"><a name="l01562"></a><span class="lineno"> 1562</span>  req->se->op.removexattr(req, nodeid, name);</div><div class="line"><a name="l01563"></a><span class="lineno"> 1563</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01564"></a><span class="lineno"> 1564</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01565"></a><span class="lineno"> 1565</span> }</div><div class="line"><a name="l01566"></a><span class="lineno"> 1566</span> </div><div class="line"><a name="l01567"></a><span class="lineno"> 1567</span> <span class="keyword">static</span> <span class="keywordtype">void</span> convert_fuse_file_lock(<span class="keyword">struct</span> fuse_file_lock *fl,</div><div class="line"><a name="l01568"></a><span class="lineno"> 1568</span>  <span class="keyword">struct</span> flock *flock)</div><div class="line"><a name="l01569"></a><span class="lineno"> 1569</span> {</div><div class="line"><a name="l01570"></a><span class="lineno"> 1570</span>  memset(flock, 0, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> flock));</div><div class="line"><a name="l01571"></a><span class="lineno"> 1571</span>  flock->l_type = fl->type;</div><div class="line"><a name="l01572"></a><span class="lineno"> 1572</span>  flock->l_whence = SEEK_SET;</div><div class="line"><a name="l01573"></a><span class="lineno"> 1573</span>  flock->l_start = fl->start;</div><div class="line"><a name="l01574"></a><span class="lineno"> 1574</span>  <span class="keywordflow">if</span> (fl->end == OFFSET_MAX)</div><div class="line"><a name="l01575"></a><span class="lineno"> 1575</span>  flock->l_len = 0;</div><div class="line"><a name="l01576"></a><span class="lineno"> 1576</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01577"></a><span class="lineno"> 1577</span>  flock->l_len = fl->end - fl->start + 1;</div><div class="line"><a name="l01578"></a><span class="lineno"> 1578</span>  flock->l_pid = fl->pid;</div><div class="line"><a name="l01579"></a><span class="lineno"> 1579</span> }</div><div class="line"><a name="l01580"></a><span class="lineno"> 1580</span> </div><div class="line"><a name="l01581"></a><span class="lineno"> 1581</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_getlk(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01582"></a><span class="lineno"> 1582</span> {</div><div class="line"><a name="l01583"></a><span class="lineno"> 1583</span>  <span class="keyword">struct </span>fuse_lk_in *arg = (<span class="keyword">struct </span>fuse_lk_in *) inarg;</div><div class="line"><a name="l01584"></a><span class="lineno"> 1584</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01585"></a><span class="lineno"> 1585</span>  <span class="keyword">struct </span>flock flock;</div><div class="line"><a name="l01586"></a><span class="lineno"> 1586</span> </div><div class="line"><a name="l01587"></a><span class="lineno"> 1587</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01588"></a><span class="lineno"> 1588</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01589"></a><span class="lineno"> 1589</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->owner;</div><div class="line"><a name="l01590"></a><span class="lineno"> 1590</span> </div><div class="line"><a name="l01591"></a><span class="lineno"> 1591</span>  convert_fuse_file_lock(&arg->lk, &flock);</div><div class="line"><a name="l01592"></a><span class="lineno"> 1592</span>  <span class="keywordflow">if</span> (req->se->op.getlk)</div><div class="line"><a name="l01593"></a><span class="lineno"> 1593</span>  req->se->op.getlk(req, nodeid, &fi, &flock);</div><div class="line"><a name="l01594"></a><span class="lineno"> 1594</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01595"></a><span class="lineno"> 1595</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01596"></a><span class="lineno"> 1596</span> }</div><div class="line"><a name="l01597"></a><span class="lineno"> 1597</span> </div><div class="line"><a name="l01598"></a><span class="lineno"> 1598</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlk_common(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l01599"></a><span class="lineno"> 1599</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg, <span class="keywordtype">int</span> sleep)</div><div class="line"><a name="l01600"></a><span class="lineno"> 1600</span> {</div><div class="line"><a name="l01601"></a><span class="lineno"> 1601</span>  <span class="keyword">struct </span>fuse_lk_in *arg = (<span class="keyword">struct </span>fuse_lk_in *) inarg;</div><div class="line"><a name="l01602"></a><span class="lineno"> 1602</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01603"></a><span class="lineno"> 1603</span>  <span class="keyword">struct </span>flock flock;</div><div class="line"><a name="l01604"></a><span class="lineno"> 1604</span> </div><div class="line"><a name="l01605"></a><span class="lineno"> 1605</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01606"></a><span class="lineno"> 1606</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01607"></a><span class="lineno"> 1607</span>  fi.<a class="code" href="structfuse__file__info.html#a3575f36b21f406c211c41c8c31323688">lock_owner</a> = arg->owner;</div><div class="line"><a name="l01608"></a><span class="lineno"> 1608</span> </div><div class="line"><a name="l01609"></a><span class="lineno"> 1609</span>  <span class="keywordflow">if</span> (arg->lk_flags & FUSE_LK_FLOCK) {</div><div class="line"><a name="l01610"></a><span class="lineno"> 1610</span>  <span class="keywordtype">int</span> op = 0;</div><div class="line"><a name="l01611"></a><span class="lineno"> 1611</span> </div><div class="line"><a name="l01612"></a><span class="lineno"> 1612</span>  <span class="keywordflow">switch</span> (arg->lk.type) {</div><div class="line"><a name="l01613"></a><span class="lineno"> 1613</span>  <span class="keywordflow">case</span> F_RDLCK:</div><div class="line"><a name="l01614"></a><span class="lineno"> 1614</span>  op = LOCK_SH;</div><div class="line"><a name="l01615"></a><span class="lineno"> 1615</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01616"></a><span class="lineno"> 1616</span>  <span class="keywordflow">case</span> F_WRLCK:</div><div class="line"><a name="l01617"></a><span class="lineno"> 1617</span>  op = LOCK_EX;</div><div class="line"><a name="l01618"></a><span class="lineno"> 1618</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01619"></a><span class="lineno"> 1619</span>  <span class="keywordflow">case</span> F_UNLCK:</div><div class="line"><a name="l01620"></a><span class="lineno"> 1620</span>  op = LOCK_UN;</div><div class="line"><a name="l01621"></a><span class="lineno"> 1621</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01622"></a><span class="lineno"> 1622</span>  }</div><div class="line"><a name="l01623"></a><span class="lineno"> 1623</span>  <span class="keywordflow">if</span> (!sleep)</div><div class="line"><a name="l01624"></a><span class="lineno"> 1624</span>  op |= LOCK_NB;</div><div class="line"><a name="l01625"></a><span class="lineno"> 1625</span> </div><div class="line"><a name="l01626"></a><span class="lineno"> 1626</span>  <span class="keywordflow">if</span> (req->se->op.flock)</div><div class="line"><a name="l01627"></a><span class="lineno"> 1627</span>  req->se->op.flock(req, nodeid, &fi, op);</div><div class="line"><a name="l01628"></a><span class="lineno"> 1628</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01629"></a><span class="lineno"> 1629</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01630"></a><span class="lineno"> 1630</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01631"></a><span class="lineno"> 1631</span>  convert_fuse_file_lock(&arg->lk, &flock);</div><div class="line"><a name="l01632"></a><span class="lineno"> 1632</span>  <span class="keywordflow">if</span> (req->se->op.setlk)</div><div class="line"><a name="l01633"></a><span class="lineno"> 1633</span>  req->se->op.setlk(req, nodeid, &fi, &flock, sleep);</div><div class="line"><a name="l01634"></a><span class="lineno"> 1634</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01635"></a><span class="lineno"> 1635</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01636"></a><span class="lineno"> 1636</span>  }</div><div class="line"><a name="l01637"></a><span class="lineno"> 1637</span> }</div><div class="line"><a name="l01638"></a><span class="lineno"> 1638</span> </div><div class="line"><a name="l01639"></a><span class="lineno"> 1639</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlk(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01640"></a><span class="lineno"> 1640</span> {</div><div class="line"><a name="l01641"></a><span class="lineno"> 1641</span>  do_setlk_common(req, nodeid, inarg, 0);</div><div class="line"><a name="l01642"></a><span class="lineno"> 1642</span> }</div><div class="line"><a name="l01643"></a><span class="lineno"> 1643</span> </div><div class="line"><a name="l01644"></a><span class="lineno"> 1644</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_setlkw(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01645"></a><span class="lineno"> 1645</span> {</div><div class="line"><a name="l01646"></a><span class="lineno"> 1646</span>  do_setlk_common(req, nodeid, inarg, 1);</div><div class="line"><a name="l01647"></a><span class="lineno"> 1647</span> }</div><div class="line"><a name="l01648"></a><span class="lineno"> 1648</span> </div><div class="line"><a name="l01649"></a><span class="lineno"> 1649</span> <span class="keyword">static</span> <span class="keywordtype">int</span> find_interrupted(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l01650"></a><span class="lineno"> 1650</span> {</div><div class="line"><a name="l01651"></a><span class="lineno"> 1651</span>  <span class="keyword">struct </span>fuse_req *curr;</div><div class="line"><a name="l01652"></a><span class="lineno"> 1652</span> </div><div class="line"><a name="l01653"></a><span class="lineno"> 1653</span>  <span class="keywordflow">for</span> (curr = se->list.next; curr != &se->list; curr = curr->next) {</div><div class="line"><a name="l01654"></a><span class="lineno"> 1654</span>  <span class="keywordflow">if</span> (curr->unique == req->u.i.unique) {</div><div class="line"><a name="l01655"></a><span class="lineno"> 1655</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1fe719ed24a713bb5d17e4e7a0dde730">fuse_interrupt_func_t</a> func;</div><div class="line"><a name="l01656"></a><span class="lineno"> 1656</span>  <span class="keywordtype">void</span> *data;</div><div class="line"><a name="l01657"></a><span class="lineno"> 1657</span> </div><div class="line"><a name="l01658"></a><span class="lineno"> 1658</span>  curr->ctr++;</div><div class="line"><a name="l01659"></a><span class="lineno"> 1659</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01660"></a><span class="lineno"> 1660</span> </div><div class="line"><a name="l01661"></a><span class="lineno"> 1661</span>  <span class="comment">/* Ugh, ugly locking */</span></div><div class="line"><a name="l01662"></a><span class="lineno"> 1662</span>  pthread_mutex_lock(&curr->lock);</div><div class="line"><a name="l01663"></a><span class="lineno"> 1663</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01664"></a><span class="lineno"> 1664</span>  curr->interrupted = 1;</div><div class="line"><a name="l01665"></a><span class="lineno"> 1665</span>  func = curr->u.ni.func;</div><div class="line"><a name="l01666"></a><span class="lineno"> 1666</span>  data = curr->u.ni.data;</div><div class="line"><a name="l01667"></a><span class="lineno"> 1667</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01668"></a><span class="lineno"> 1668</span>  <span class="keywordflow">if</span> (func)</div><div class="line"><a name="l01669"></a><span class="lineno"> 1669</span>  func(curr, data);</div><div class="line"><a name="l01670"></a><span class="lineno"> 1670</span>  pthread_mutex_unlock(&curr->lock);</div><div class="line"><a name="l01671"></a><span class="lineno"> 1671</span> </div><div class="line"><a name="l01672"></a><span class="lineno"> 1672</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01673"></a><span class="lineno"> 1673</span>  curr->ctr--;</div><div class="line"><a name="l01674"></a><span class="lineno"> 1674</span>  <span class="keywordflow">if</span> (!curr->ctr)</div><div class="line"><a name="l01675"></a><span class="lineno"> 1675</span>  destroy_req(curr);</div><div class="line"><a name="l01676"></a><span class="lineno"> 1676</span> </div><div class="line"><a name="l01677"></a><span class="lineno"> 1677</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l01678"></a><span class="lineno"> 1678</span>  }</div><div class="line"><a name="l01679"></a><span class="lineno"> 1679</span>  }</div><div class="line"><a name="l01680"></a><span class="lineno"> 1680</span>  <span class="keywordflow">for</span> (curr = se->interrupts.next; curr != &se->interrupts;</div><div class="line"><a name="l01681"></a><span class="lineno"> 1681</span>  curr = curr->next) {</div><div class="line"><a name="l01682"></a><span class="lineno"> 1682</span>  <span class="keywordflow">if</span> (curr->u.i.unique == req->u.i.unique)</div><div class="line"><a name="l01683"></a><span class="lineno"> 1683</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l01684"></a><span class="lineno"> 1684</span>  }</div><div class="line"><a name="l01685"></a><span class="lineno"> 1685</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l01686"></a><span class="lineno"> 1686</span> }</div><div class="line"><a name="l01687"></a><span class="lineno"> 1687</span> </div><div class="line"><a name="l01688"></a><span class="lineno"> 1688</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_interrupt(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01689"></a><span class="lineno"> 1689</span> {</div><div class="line"><a name="l01690"></a><span class="lineno"> 1690</span>  <span class="keyword">struct </span>fuse_interrupt_in *arg = (<span class="keyword">struct </span>fuse_interrupt_in *) inarg;</div><div class="line"><a name="l01691"></a><span class="lineno"> 1691</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01692"></a><span class="lineno"> 1692</span> </div><div class="line"><a name="l01693"></a><span class="lineno"> 1693</span>  (void) nodeid;</div><div class="line"><a name="l01694"></a><span class="lineno"> 1694</span>  <span class="keywordflow">if</span> (se->debug)</div><div class="line"><a name="l01695"></a><span class="lineno"> 1695</span>  fprintf(stderr, <span class="stringliteral">"INTERRUPT: %llu\n"</span>,</div><div class="line"><a name="l01696"></a><span class="lineno"> 1696</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) arg->unique);</div><div class="line"><a name="l01697"></a><span class="lineno"> 1697</span> </div><div class="line"><a name="l01698"></a><span class="lineno"> 1698</span>  req->u.i.unique = arg->unique;</div><div class="line"><a name="l01699"></a><span class="lineno"> 1699</span> </div><div class="line"><a name="l01700"></a><span class="lineno"> 1700</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l01701"></a><span class="lineno"> 1701</span>  <span class="keywordflow">if</span> (find_interrupted(se, req))</div><div class="line"><a name="l01702"></a><span class="lineno"> 1702</span>  destroy_req(req);</div><div class="line"><a name="l01703"></a><span class="lineno"> 1703</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01704"></a><span class="lineno"> 1704</span>  list_add_req(req, &se->interrupts);</div><div class="line"><a name="l01705"></a><span class="lineno"> 1705</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l01706"></a><span class="lineno"> 1706</span> }</div><div class="line"><a name="l01707"></a><span class="lineno"> 1707</span> </div><div class="line"><a name="l01708"></a><span class="lineno"> 1708</span> <span class="keyword">static</span> <span class="keyword">struct </span>fuse_req *check_interrupt(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l01709"></a><span class="lineno"> 1709</span>  <span class="keyword">struct</span> fuse_req *req)</div><div class="line"><a name="l01710"></a><span class="lineno"> 1710</span> {</div><div class="line"><a name="l01711"></a><span class="lineno"> 1711</span>  <span class="keyword">struct </span>fuse_req *curr;</div><div class="line"><a name="l01712"></a><span class="lineno"> 1712</span> </div><div class="line"><a name="l01713"></a><span class="lineno"> 1713</span>  <span class="keywordflow">for</span> (curr = se->interrupts.next; curr != &se->interrupts;</div><div class="line"><a name="l01714"></a><span class="lineno"> 1714</span>  curr = curr->next) {</div><div class="line"><a name="l01715"></a><span class="lineno"> 1715</span>  <span class="keywordflow">if</span> (curr->u.i.unique == req->unique) {</div><div class="line"><a name="l01716"></a><span class="lineno"> 1716</span>  req->interrupted = 1;</div><div class="line"><a name="l01717"></a><span class="lineno"> 1717</span>  list_del_req(curr);</div><div class="line"><a name="l01718"></a><span class="lineno"> 1718</span>  free(curr);</div><div class="line"><a name="l01719"></a><span class="lineno"> 1719</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l01720"></a><span class="lineno"> 1720</span>  }</div><div class="line"><a name="l01721"></a><span class="lineno"> 1721</span>  }</div><div class="line"><a name="l01722"></a><span class="lineno"> 1722</span>  curr = se->interrupts.next;</div><div class="line"><a name="l01723"></a><span class="lineno"> 1723</span>  <span class="keywordflow">if</span> (curr != &se->interrupts) {</div><div class="line"><a name="l01724"></a><span class="lineno"> 1724</span>  list_del_req(curr);</div><div class="line"><a name="l01725"></a><span class="lineno"> 1725</span>  list_init_req(curr);</div><div class="line"><a name="l01726"></a><span class="lineno"> 1726</span>  <span class="keywordflow">return</span> curr;</div><div class="line"><a name="l01727"></a><span class="lineno"> 1727</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l01728"></a><span class="lineno"> 1728</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l01729"></a><span class="lineno"> 1729</span> }</div><div class="line"><a name="l01730"></a><span class="lineno"> 1730</span> </div><div class="line"><a name="l01731"></a><span class="lineno"> 1731</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_bmap(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01732"></a><span class="lineno"> 1732</span> {</div><div class="line"><a name="l01733"></a><span class="lineno"> 1733</span>  <span class="keyword">struct </span>fuse_bmap_in *arg = (<span class="keyword">struct </span>fuse_bmap_in *) inarg;</div><div class="line"><a name="l01734"></a><span class="lineno"> 1734</span> </div><div class="line"><a name="l01735"></a><span class="lineno"> 1735</span>  <span class="keywordflow">if</span> (req->se->op.bmap)</div><div class="line"><a name="l01736"></a><span class="lineno"> 1736</span>  req->se->op.bmap(req, nodeid, arg->blocksize, arg->block);</div><div class="line"><a name="l01737"></a><span class="lineno"> 1737</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01738"></a><span class="lineno"> 1738</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01739"></a><span class="lineno"> 1739</span> }</div><div class="line"><a name="l01740"></a><span class="lineno"> 1740</span> </div><div class="line"><a name="l01741"></a><span class="lineno"> 1741</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_ioctl(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01742"></a><span class="lineno"> 1742</span> {</div><div class="line"><a name="l01743"></a><span class="lineno"> 1743</span>  <span class="keyword">struct </span>fuse_ioctl_in *arg = (<span class="keyword">struct </span>fuse_ioctl_in *) inarg;</div><div class="line"><a name="l01744"></a><span class="lineno"> 1744</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> flags = arg->flags;</div><div class="line"><a name="l01745"></a><span class="lineno"> 1745</span>  <span class="keywordtype">void</span> *in_buf = arg->in_size ? PARAM(arg) : NULL;</div><div class="line"><a name="l01746"></a><span class="lineno"> 1746</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01747"></a><span class="lineno"> 1747</span> </div><div class="line"><a name="l01748"></a><span class="lineno"> 1748</span>  <span class="keywordflow">if</span> (flags & FUSE_IOCTL_DIR &&</div><div class="line"><a name="l01749"></a><span class="lineno"> 1749</span>  !(req->se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>)) {</div><div class="line"><a name="l01750"></a><span class="lineno"> 1750</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOTTY);</div><div class="line"><a name="l01751"></a><span class="lineno"> 1751</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01752"></a><span class="lineno"> 1752</span>  }</div><div class="line"><a name="l01753"></a><span class="lineno"> 1753</span> </div><div class="line"><a name="l01754"></a><span class="lineno"> 1754</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01755"></a><span class="lineno"> 1755</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01756"></a><span class="lineno"> 1756</span> </div><div class="line"><a name="l01757"></a><span class="lineno"> 1757</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span> *) == 4 && req->se->conn.proto_minor >= 16 &&</div><div class="line"><a name="l01758"></a><span class="lineno"> 1758</span>  !(flags & FUSE_IOCTL_32BIT)) {</div><div class="line"><a name="l01759"></a><span class="lineno"> 1759</span>  req->ioctl_64bit = 1;</div><div class="line"><a name="l01760"></a><span class="lineno"> 1760</span>  }</div><div class="line"><a name="l01761"></a><span class="lineno"> 1761</span> </div><div class="line"><a name="l01762"></a><span class="lineno"> 1762</span>  <span class="keywordflow">if</span> (req->se->op.ioctl)</div><div class="line"><a name="l01763"></a><span class="lineno"> 1763</span>  req->se->op.ioctl(req, nodeid, arg->cmd,</div><div class="line"><a name="l01764"></a><span class="lineno"> 1764</span>  (<span class="keywordtype">void</span> *)(uintptr_t)arg->arg, &fi, flags,</div><div class="line"><a name="l01765"></a><span class="lineno"> 1765</span>  in_buf, arg->in_size, arg->out_size);</div><div class="line"><a name="l01766"></a><span class="lineno"> 1766</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01767"></a><span class="lineno"> 1767</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01768"></a><span class="lineno"> 1768</span> }</div><div class="line"><a name="l01769"></a><span class="lineno"> 1769</span> </div><div class="line"><a name="l01770"></a><span class="lineno"> 1770</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#adf5027f8a38b2efc03858efd7fdc756a">fuse_pollhandle_destroy</a>(<span class="keyword">struct</span> fuse_pollhandle *ph)</div><div class="line"><a name="l01771"></a><span class="lineno"> 1771</span> {</div><div class="line"><a name="l01772"></a><span class="lineno"> 1772</span>  free(ph);</div><div class="line"><a name="l01773"></a><span class="lineno"> 1773</span> }</div><div class="line"><a name="l01774"></a><span class="lineno"> 1774</span> </div><div class="line"><a name="l01775"></a><span class="lineno"> 1775</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_poll(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01776"></a><span class="lineno"> 1776</span> {</div><div class="line"><a name="l01777"></a><span class="lineno"> 1777</span>  <span class="keyword">struct </span>fuse_poll_in *arg = (<span class="keyword">struct </span>fuse_poll_in *) inarg;</div><div class="line"><a name="l01778"></a><span class="lineno"> 1778</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01779"></a><span class="lineno"> 1779</span> </div><div class="line"><a name="l01780"></a><span class="lineno"> 1780</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01781"></a><span class="lineno"> 1781</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01782"></a><span class="lineno"> 1782</span>  fi.<a class="code" href="structfuse__file__info.html#a51b0d5928ec6112456d2aa50f2c35001">poll_events</a> = arg->events;</div><div class="line"><a name="l01783"></a><span class="lineno"> 1783</span> </div><div class="line"><a name="l01784"></a><span class="lineno"> 1784</span>  <span class="keywordflow">if</span> (req->se->op.poll) {</div><div class="line"><a name="l01785"></a><span class="lineno"> 1785</span>  <span class="keyword">struct </span>fuse_pollhandle *ph = NULL;</div><div class="line"><a name="l01786"></a><span class="lineno"> 1786</span> </div><div class="line"><a name="l01787"></a><span class="lineno"> 1787</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POLL_SCHEDULE_NOTIFY) {</div><div class="line"><a name="l01788"></a><span class="lineno"> 1788</span>  ph = malloc(<span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_pollhandle));</div><div class="line"><a name="l01789"></a><span class="lineno"> 1789</span>  <span class="keywordflow">if</span> (ph == NULL) {</div><div class="line"><a name="l01790"></a><span class="lineno"> 1790</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOMEM);</div><div class="line"><a name="l01791"></a><span class="lineno"> 1791</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01792"></a><span class="lineno"> 1792</span>  }</div><div class="line"><a name="l01793"></a><span class="lineno"> 1793</span>  ph->kh = arg->kh;</div><div class="line"><a name="l01794"></a><span class="lineno"> 1794</span>  ph->se = req->se;</div><div class="line"><a name="l01795"></a><span class="lineno"> 1795</span>  }</div><div class="line"><a name="l01796"></a><span class="lineno"> 1796</span> </div><div class="line"><a name="l01797"></a><span class="lineno"> 1797</span>  req->se->op.poll(req, nodeid, &fi, ph);</div><div class="line"><a name="l01798"></a><span class="lineno"> 1798</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01799"></a><span class="lineno"> 1799</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01800"></a><span class="lineno"> 1800</span>  }</div><div class="line"><a name="l01801"></a><span class="lineno"> 1801</span> }</div><div class="line"><a name="l01802"></a><span class="lineno"> 1802</span> </div><div class="line"><a name="l01803"></a><span class="lineno"> 1803</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_fallocate(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01804"></a><span class="lineno"> 1804</span> {</div><div class="line"><a name="l01805"></a><span class="lineno"> 1805</span>  <span class="keyword">struct </span>fuse_fallocate_in *arg = (<span class="keyword">struct </span>fuse_fallocate_in *) inarg;</div><div class="line"><a name="l01806"></a><span class="lineno"> 1806</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi;</div><div class="line"><a name="l01807"></a><span class="lineno"> 1807</span> </div><div class="line"><a name="l01808"></a><span class="lineno"> 1808</span>  memset(&fi, 0, <span class="keyword">sizeof</span>(fi));</div><div class="line"><a name="l01809"></a><span class="lineno"> 1809</span>  fi.<a class="code" href="structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8">fh</a> = arg->fh;</div><div class="line"><a name="l01810"></a><span class="lineno"> 1810</span> </div><div class="line"><a name="l01811"></a><span class="lineno"> 1811</span>  <span class="keywordflow">if</span> (req->se->op.fallocate)</div><div class="line"><a name="l01812"></a><span class="lineno"> 1812</span>  req->se->op.fallocate(req, nodeid, arg->mode, arg->offset, arg->length, &fi);</div><div class="line"><a name="l01813"></a><span class="lineno"> 1813</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01814"></a><span class="lineno"> 1814</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01815"></a><span class="lineno"> 1815</span> }</div><div class="line"><a name="l01816"></a><span class="lineno"> 1816</span> </div><div class="line"><a name="l01817"></a><span class="lineno"> 1817</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_copy_file_range(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid_in, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01818"></a><span class="lineno"> 1818</span> {</div><div class="line"><a name="l01819"></a><span class="lineno"> 1819</span>  <span class="keyword">struct </span>fuse_copy_file_range_in *arg = (<span class="keyword">struct </span>fuse_copy_file_range_in *) inarg;</div><div class="line"><a name="l01820"></a><span class="lineno"> 1820</span>  <span class="keyword">struct </span><a class="code" href="structfuse__file__info.html">fuse_file_info</a> fi_in, fi_out;</div><div class="line"><a name="l01821"></a><span class="lineno"> 1821</span> </div><div class="line"><a name="l01822"></a><span class="lineno"> 1822</span>  memset(&fi_in, 0, <span class="keyword">sizeof</span>(fi_in));</div><div class="line"><a name="l01823"></a><span class="lineno"> 1823</span>  fi_in.fh = arg->fh_in;</div><div class="line"><a name="l01824"></a><span class="lineno"> 1824</span> </div><div class="line"><a name="l01825"></a><span class="lineno"> 1825</span>  memset(&fi_out, 0, <span class="keyword">sizeof</span>(fi_out));</div><div class="line"><a name="l01826"></a><span class="lineno"> 1826</span>  fi_out.fh = arg->fh_out;</div><div class="line"><a name="l01827"></a><span class="lineno"> 1827</span> </div><div class="line"><a name="l01828"></a><span class="lineno"> 1828</span> </div><div class="line"><a name="l01829"></a><span class="lineno"> 1829</span>  <span class="keywordflow">if</span> (req->se->op.copy_file_range)</div><div class="line"><a name="l01830"></a><span class="lineno"> 1830</span>  req->se->op.copy_file_range(req, nodeid_in, arg->off_in,</div><div class="line"><a name="l01831"></a><span class="lineno"> 1831</span>  &fi_in, arg->nodeid_out,</div><div class="line"><a name="l01832"></a><span class="lineno"> 1832</span>  arg->off_out, &fi_out, arg->len,</div><div class="line"><a name="l01833"></a><span class="lineno"> 1833</span>  arg->flags);</div><div class="line"><a name="l01834"></a><span class="lineno"> 1834</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l01835"></a><span class="lineno"> 1835</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, ENOSYS);</div><div class="line"><a name="l01836"></a><span class="lineno"> 1836</span> }</div><div class="line"><a name="l01837"></a><span class="lineno"> 1837</span> </div><div class="line"><a name="l01838"></a><span class="lineno"> 1838</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_init(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l01839"></a><span class="lineno"> 1839</span> {</div><div class="line"><a name="l01840"></a><span class="lineno"> 1840</span>  <span class="keyword">struct </span>fuse_init_in *arg = (<span class="keyword">struct </span>fuse_init_in *) inarg;</div><div class="line"><a name="l01841"></a><span class="lineno"> 1841</span>  <span class="keyword">struct </span>fuse_init_out outarg;</div><div class="line"><a name="l01842"></a><span class="lineno"> 1842</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l01843"></a><span class="lineno"> 1843</span>  <span class="keywordtype">size_t</span> bufsize = se->bufsize;</div><div class="line"><a name="l01844"></a><span class="lineno"> 1844</span>  <span class="keywordtype">size_t</span> outargsize = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l01845"></a><span class="lineno"> 1845</span> </div><div class="line"><a name="l01846"></a><span class="lineno"> 1846</span>  (void) nodeid;</div><div class="line"><a name="l01847"></a><span class="lineno"> 1847</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l01848"></a><span class="lineno"> 1848</span>  fprintf(stderr, <span class="stringliteral">"INIT: %u.%u\n"</span>, arg->major, arg->minor);</div><div class="line"><a name="l01849"></a><span class="lineno"> 1849</span>  <span class="keywordflow">if</span> (arg->major == 7 && arg->minor >= 6) {</div><div class="line"><a name="l01850"></a><span class="lineno"> 1850</span>  fprintf(stderr, <span class="stringliteral">"flags=0x%08x\n"</span>, arg->flags);</div><div class="line"><a name="l01851"></a><span class="lineno"> 1851</span>  fprintf(stderr, <span class="stringliteral">"max_readahead=0x%08x\n"</span>,</div><div class="line"><a name="l01852"></a><span class="lineno"> 1852</span>  arg->max_readahead);</div><div class="line"><a name="l01853"></a><span class="lineno"> 1853</span>  }</div><div class="line"><a name="l01854"></a><span class="lineno"> 1854</span>  }</div><div class="line"><a name="l01855"></a><span class="lineno"> 1855</span>  se->conn.proto_major = arg->major;</div><div class="line"><a name="l01856"></a><span class="lineno"> 1856</span>  se->conn.proto_minor = arg->minor;</div><div class="line"><a name="l01857"></a><span class="lineno"> 1857</span>  se->conn.capable = 0;</div><div class="line"><a name="l01858"></a><span class="lineno"> 1858</span>  se->conn.want = 0;</div><div class="line"><a name="l01859"></a><span class="lineno"> 1859</span> </div><div class="line"><a name="l01860"></a><span class="lineno"> 1860</span>  memset(&outarg, 0, <span class="keyword">sizeof</span>(outarg));</div><div class="line"><a name="l01861"></a><span class="lineno"> 1861</span>  outarg.major = FUSE_KERNEL_VERSION;</div><div class="line"><a name="l01862"></a><span class="lineno"> 1862</span>  outarg.minor = FUSE_KERNEL_MINOR_VERSION;</div><div class="line"><a name="l01863"></a><span class="lineno"> 1863</span> </div><div class="line"><a name="l01864"></a><span class="lineno"> 1864</span>  <span class="keywordflow">if</span> (arg->major < 7) {</div><div class="line"><a name="l01865"></a><span class="lineno"> 1865</span>  fprintf(stderr, <span class="stringliteral">"fuse: unsupported protocol version: %u.%u\n"</span>,</div><div class="line"><a name="l01866"></a><span class="lineno"> 1866</span>  arg->major, arg->minor);</div><div class="line"><a name="l01867"></a><span class="lineno"> 1867</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01868"></a><span class="lineno"> 1868</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01869"></a><span class="lineno"> 1869</span>  }</div><div class="line"><a name="l01870"></a><span class="lineno"> 1870</span> </div><div class="line"><a name="l01871"></a><span class="lineno"> 1871</span>  <span class="keywordflow">if</span> (arg->major > 7) {</div><div class="line"><a name="l01872"></a><span class="lineno"> 1872</span>  <span class="comment">/* Wait for a second INIT request with a 7.X version */</span></div><div class="line"><a name="l01873"></a><span class="lineno"> 1873</span>  send_reply_ok(req, &outarg, <span class="keyword">sizeof</span>(outarg));</div><div class="line"><a name="l01874"></a><span class="lineno"> 1874</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01875"></a><span class="lineno"> 1875</span>  }</div><div class="line"><a name="l01876"></a><span class="lineno"> 1876</span> </div><div class="line"><a name="l01877"></a><span class="lineno"> 1877</span>  <span class="keywordflow">if</span> (arg->minor >= 6) {</div><div class="line"><a name="l01878"></a><span class="lineno"> 1878</span>  <span class="keywordflow">if</span> (arg->max_readahead < se->conn.max_readahead)</div><div class="line"><a name="l01879"></a><span class="lineno"> 1879</span>  se->conn.max_readahead = arg->max_readahead;</div><div class="line"><a name="l01880"></a><span class="lineno"> 1880</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ASYNC_READ)</div><div class="line"><a name="l01881"></a><span class="lineno"> 1881</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>;</div><div class="line"><a name="l01882"></a><span class="lineno"> 1882</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POSIX_LOCKS)</div><div class="line"><a name="l01883"></a><span class="lineno"> 1883</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>;</div><div class="line"><a name="l01884"></a><span class="lineno"> 1884</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ATOMIC_O_TRUNC)</div><div class="line"><a name="l01885"></a><span class="lineno"> 1885</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>;</div><div class="line"><a name="l01886"></a><span class="lineno"> 1886</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_EXPORT_SUPPORT)</div><div class="line"><a name="l01887"></a><span class="lineno"> 1887</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a7686c11aaf80382189927b10b848d8c8">FUSE_CAP_EXPORT_SUPPORT</a>;</div><div class="line"><a name="l01888"></a><span class="lineno"> 1888</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_DONT_MASK)</div><div class="line"><a name="l01889"></a><span class="lineno"> 1889</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0cd4cebf7ec784886836aa061a1612fe">FUSE_CAP_DONT_MASK</a>;</div><div class="line"><a name="l01890"></a><span class="lineno"> 1890</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_FLOCK_LOCKS)</div><div class="line"><a name="l01891"></a><span class="lineno"> 1891</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>;</div><div class="line"><a name="l01892"></a><span class="lineno"> 1892</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_AUTO_INVAL_DATA)</div><div class="line"><a name="l01893"></a><span class="lineno"> 1893</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>;</div><div class="line"><a name="l01894"></a><span class="lineno"> 1894</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_DO_READDIRPLUS)</div><div class="line"><a name="l01895"></a><span class="lineno"> 1895</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>;</div><div class="line"><a name="l01896"></a><span class="lineno"> 1896</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_READDIRPLUS_AUTO)</div><div class="line"><a name="l01897"></a><span class="lineno"> 1897</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>;</div><div class="line"><a name="l01898"></a><span class="lineno"> 1898</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_ASYNC_DIO)</div><div class="line"><a name="l01899"></a><span class="lineno"> 1899</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>;</div><div class="line"><a name="l01900"></a><span class="lineno"> 1900</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_WRITEBACK_CACHE)</div><div class="line"><a name="l01901"></a><span class="lineno"> 1901</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4839fce31097f4b4da7a1f01169228fa">FUSE_CAP_WRITEBACK_CACHE</a>;</div><div class="line"><a name="l01902"></a><span class="lineno"> 1902</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_NO_OPEN_SUPPORT)</div><div class="line"><a name="l01903"></a><span class="lineno"> 1903</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad4477fe76f57e8b726d0357a637d7aaf">FUSE_CAP_NO_OPEN_SUPPORT</a>;</div><div class="line"><a name="l01904"></a><span class="lineno"> 1904</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_PARALLEL_DIROPS)</div><div class="line"><a name="l01905"></a><span class="lineno"> 1905</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a3311a7f569e9fbf55b3f0bcaadbe4ad0">FUSE_CAP_PARALLEL_DIROPS</a>;</div><div class="line"><a name="l01906"></a><span class="lineno"> 1906</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_POSIX_ACL)</div><div class="line"><a name="l01907"></a><span class="lineno"> 1907</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5b3ef5b12be33295311d6b751846c263">FUSE_CAP_POSIX_ACL</a>;</div><div class="line"><a name="l01908"></a><span class="lineno"> 1908</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_HANDLE_KILLPRIV)</div><div class="line"><a name="l01909"></a><span class="lineno"> 1909</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a24a4a980dff3f7a4ba771a92bb59a4bd">FUSE_CAP_HANDLE_KILLPRIV</a>;</div><div class="line"><a name="l01910"></a><span class="lineno"> 1910</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_NO_OPENDIR_SUPPORT)</div><div class="line"><a name="l01911"></a><span class="lineno"> 1911</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aa573f7b730ea608463d8399659c38ca6">FUSE_CAP_NO_OPENDIR_SUPPORT</a>;</div><div class="line"><a name="l01912"></a><span class="lineno"> 1912</span>  <span class="keywordflow">if</span> (!(arg->flags & FUSE_MAX_PAGES)) {</div><div class="line"><a name="l01913"></a><span class="lineno"> 1913</span>  <span class="keywordtype">size_t</span> max_bufsize =</div><div class="line"><a name="l01914"></a><span class="lineno"> 1914</span>  FUSE_DEFAULT_MAX_PAGES_PER_REQ * getpagesize()</div><div class="line"><a name="l01915"></a><span class="lineno"> 1915</span>  + FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01916"></a><span class="lineno"> 1916</span>  <span class="keywordflow">if</span> (bufsize > max_bufsize) {</div><div class="line"><a name="l01917"></a><span class="lineno"> 1917</span>  bufsize = max_bufsize;</div><div class="line"><a name="l01918"></a><span class="lineno"> 1918</span>  }</div><div class="line"><a name="l01919"></a><span class="lineno"> 1919</span>  }</div><div class="line"><a name="l01920"></a><span class="lineno"> 1920</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01921"></a><span class="lineno"> 1921</span>  se->conn.max_readahead = 0;</div><div class="line"><a name="l01922"></a><span class="lineno"> 1922</span>  }</div><div class="line"><a name="l01923"></a><span class="lineno"> 1923</span> </div><div class="line"><a name="l01924"></a><span class="lineno"> 1924</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 14) {</div><div class="line"><a name="l01925"></a><span class="lineno"> 1925</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l01926"></a><span class="lineno"> 1926</span> <span class="preprocessor">#ifdef HAVE_VMSPLICE</span></div><div class="line"><a name="l01927"></a><span class="lineno"> 1927</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4f8815e0f48c60c3d9cd6e72be5a84e4">FUSE_CAP_SPLICE_WRITE</a> | <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aef5da823dc5f202bbe033c7a5a3de9c4">FUSE_CAP_SPLICE_MOVE</a>;</div><div class="line"><a name="l01928"></a><span class="lineno"> 1928</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l01929"></a><span class="lineno"> 1929</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>;</div><div class="line"><a name="l01930"></a><span class="lineno"> 1930</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l01931"></a><span class="lineno"> 1931</span>  }</div><div class="line"><a name="l01932"></a><span class="lineno"> 1932</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 18)</div><div class="line"><a name="l01933"></a><span class="lineno"> 1933</span>  se->conn.capable |= <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>;</div><div class="line"><a name="l01934"></a><span class="lineno"> 1934</span> </div><div class="line"><a name="l01935"></a><span class="lineno"> 1935</span>  <span class="comment">/* Default settings for modern filesystems.</span></div><div class="line"><a name="l01936"></a><span class="lineno"> 1936</span> <span class="comment"> *</span></div><div class="line"><a name="l01937"></a><span class="lineno"> 1937</span> <span class="comment"> * Most of these capabilities were disabled by default in</span></div><div class="line"><a name="l01938"></a><span class="lineno"> 1938</span> <span class="comment"> * libfuse2 for backwards compatibility reasons. In libfuse3,</span></div><div class="line"><a name="l01939"></a><span class="lineno"> 1939</span> <span class="comment"> * we can finally enable them by default (as long as they're</span></div><div class="line"><a name="l01940"></a><span class="lineno"> 1940</span> <span class="comment"> * supported by the kernel).</span></div><div class="line"><a name="l01941"></a><span class="lineno"> 1941</span> <span class="comment"> */</span></div><div class="line"><a name="l01942"></a><span class="lineno"> 1942</span> <span class="preprocessor">#define LL_SET_DEFAULT(cond, cap) \</span></div><div class="line"><a name="l01943"></a><span class="lineno"> 1943</span> <span class="preprocessor"> if ((cond) && (se->conn.capable & (cap))) \</span></div><div class="line"><a name="l01944"></a><span class="lineno"> 1944</span> <span class="preprocessor"> se->conn.want |= (cap)</span></div><div class="line"><a name="l01945"></a><span class="lineno"> 1945</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>);</div><div class="line"><a name="l01946"></a><span class="lineno"> 1946</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a3311a7f569e9fbf55b3f0bcaadbe4ad0">FUSE_CAP_PARALLEL_DIROPS</a>);</div><div class="line"><a name="l01947"></a><span class="lineno"> 1947</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>);</div><div class="line"><a name="l01948"></a><span class="lineno"> 1948</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a24a4a980dff3f7a4ba771a92bb59a4bd">FUSE_CAP_HANDLE_KILLPRIV</a>);</div><div class="line"><a name="l01949"></a><span class="lineno"> 1949</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>);</div><div class="line"><a name="l01950"></a><span class="lineno"> 1950</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0bfb2ecd448cb5659679df690e75581a">FUSE_CAP_IOCTL_DIR</a>);</div><div class="line"><a name="l01951"></a><span class="lineno"> 1951</span>  LL_SET_DEFAULT(1, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>);</div><div class="line"><a name="l01952"></a><span class="lineno"> 1952</span>  LL_SET_DEFAULT(se->op.write_buf, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>);</div><div class="line"><a name="l01953"></a><span class="lineno"> 1953</span>  LL_SET_DEFAULT(se->op.getlk && se->op.setlk,</div><div class="line"><a name="l01954"></a><span class="lineno"> 1954</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>);</div><div class="line"><a name="l01955"></a><span class="lineno"> 1955</span>  LL_SET_DEFAULT(se->op.flock, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>);</div><div class="line"><a name="l01956"></a><span class="lineno"> 1956</span>  LL_SET_DEFAULT(se->op.readdirplus, <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>);</div><div class="line"><a name="l01957"></a><span class="lineno"> 1957</span>  LL_SET_DEFAULT(se->op.readdirplus && se->op.readdir,</div><div class="line"><a name="l01958"></a><span class="lineno"> 1958</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>);</div><div class="line"><a name="l01959"></a><span class="lineno"> 1959</span>  se->conn.time_gran = 1;</div><div class="line"><a name="l01960"></a><span class="lineno"> 1960</span>  </div><div class="line"><a name="l01961"></a><span class="lineno"> 1961</span>  <span class="keywordflow">if</span> (bufsize < FUSE_MIN_READ_BUFFER) {</div><div class="line"><a name="l01962"></a><span class="lineno"> 1962</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: buffer size too small: %zu\n"</span>,</div><div class="line"><a name="l01963"></a><span class="lineno"> 1963</span>  bufsize);</div><div class="line"><a name="l01964"></a><span class="lineno"> 1964</span>  bufsize = FUSE_MIN_READ_BUFFER;</div><div class="line"><a name="l01965"></a><span class="lineno"> 1965</span>  }</div><div class="line"><a name="l01966"></a><span class="lineno"> 1966</span>  se->bufsize = bufsize;</div><div class="line"><a name="l01967"></a><span class="lineno"> 1967</span> </div><div class="line"><a name="l01968"></a><span class="lineno"> 1968</span>  <span class="keywordflow">if</span> (se->conn.max_write > bufsize - FUSE_BUFFER_HEADER_SIZE)</div><div class="line"><a name="l01969"></a><span class="lineno"> 1969</span>  se->conn.max_write = bufsize - FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01970"></a><span class="lineno"> 1970</span> </div><div class="line"><a name="l01971"></a><span class="lineno"> 1971</span>  se->got_init = 1;</div><div class="line"><a name="l01972"></a><span class="lineno"> 1972</span>  <span class="keywordflow">if</span> (se->op.init)</div><div class="line"><a name="l01973"></a><span class="lineno"> 1973</span>  se->op.init(se->userdata, &se->conn);</div><div class="line"><a name="l01974"></a><span class="lineno"> 1974</span> </div><div class="line"><a name="l01975"></a><span class="lineno"> 1975</span>  <span class="keywordflow">if</span> (se->conn.want & (~se->conn.capable)) {</div><div class="line"><a name="l01976"></a><span class="lineno"> 1976</span>  fprintf(stderr, <span class="stringliteral">"fuse: error: filesystem requested capabilities "</span></div><div class="line"><a name="l01977"></a><span class="lineno"> 1977</span>  <span class="stringliteral">"0x%x that are not supported by kernel, aborting.\n"</span>,</div><div class="line"><a name="l01978"></a><span class="lineno"> 1978</span>  se->conn.want & (~se->conn.capable));</div><div class="line"><a name="l01979"></a><span class="lineno"> 1979</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01980"></a><span class="lineno"> 1980</span>  se->error = -EPROTO;</div><div class="line"><a name="l01981"></a><span class="lineno"> 1981</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l01982"></a><span class="lineno"> 1982</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01983"></a><span class="lineno"> 1983</span>  }</div><div class="line"><a name="l01984"></a><span class="lineno"> 1984</span> </div><div class="line"><a name="l01985"></a><span class="lineno"> 1985</span>  <span class="keywordtype">unsigned</span> max_read_mo = get_max_read(se->mo);</div><div class="line"><a name="l01986"></a><span class="lineno"> 1986</span>  <span class="keywordflow">if</span> (se->conn.max_read != max_read_mo) {</div><div class="line"><a name="l01987"></a><span class="lineno"> 1987</span>  fprintf(stderr, <span class="stringliteral">"fuse: error: init() and fuse_session_new() "</span></div><div class="line"><a name="l01988"></a><span class="lineno"> 1988</span>  <span class="stringliteral">"requested different maximum read size (%u vs %u)\n"</span>,</div><div class="line"><a name="l01989"></a><span class="lineno"> 1989</span>  se->conn.max_read, max_read_mo);</div><div class="line"><a name="l01990"></a><span class="lineno"> 1990</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, EPROTO);</div><div class="line"><a name="l01991"></a><span class="lineno"> 1991</span>  se->error = -EPROTO;</div><div class="line"><a name="l01992"></a><span class="lineno"> 1992</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l01993"></a><span class="lineno"> 1993</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01994"></a><span class="lineno"> 1994</span>  }</div><div class="line"><a name="l01995"></a><span class="lineno"> 1995</span> </div><div class="line"><a name="l01996"></a><span class="lineno"> 1996</span>  <span class="keywordflow">if</span> (se->conn.max_write < bufsize - FUSE_BUFFER_HEADER_SIZE) {</div><div class="line"><a name="l01997"></a><span class="lineno"> 1997</span>  se->bufsize = se->conn.max_write + FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l01998"></a><span class="lineno"> 1998</span>  }</div><div class="line"><a name="l01999"></a><span class="lineno"> 1999</span>  <span class="keywordflow">if</span> (arg->flags & FUSE_MAX_PAGES) {</div><div class="line"><a name="l02000"></a><span class="lineno"> 2000</span>  outarg.flags |= FUSE_MAX_PAGES;</div><div class="line"><a name="l02001"></a><span class="lineno"> 2001</span>  outarg.max_pages = (se->conn.max_write - 1) / getpagesize() + 1;</div><div class="line"><a name="l02002"></a><span class="lineno"> 2002</span>  }</div><div class="line"><a name="l02003"></a><span class="lineno"> 2003</span> </div><div class="line"><a name="l02004"></a><span class="lineno"> 2004</span>  <span class="comment">/* Always enable big writes, this is superseded</span></div><div class="line"><a name="l02005"></a><span class="lineno"> 2005</span> <span class="comment"> by the max_write option */</span></div><div class="line"><a name="l02006"></a><span class="lineno"> 2006</span>  outarg.flags |= FUSE_BIG_WRITES;</div><div class="line"><a name="l02007"></a><span class="lineno"> 2007</span> </div><div class="line"><a name="l02008"></a><span class="lineno"> 2008</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4e1bacbb44d6dca9a82255c8069c3d69">FUSE_CAP_ASYNC_READ</a>)</div><div class="line"><a name="l02009"></a><span class="lineno"> 2009</span>  outarg.flags |= FUSE_ASYNC_READ;</div><div class="line"><a name="l02010"></a><span class="lineno"> 2010</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a76f6b481e6a7c519fea9250daef6177a">FUSE_CAP_POSIX_LOCKS</a>)</div><div class="line"><a name="l02011"></a><span class="lineno"> 2011</span>  outarg.flags |= FUSE_POSIX_LOCKS;</div><div class="line"><a name="l02012"></a><span class="lineno"> 2012</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4c81f2838716f43fe493a61c87a62816">FUSE_CAP_ATOMIC_O_TRUNC</a>)</div><div class="line"><a name="l02013"></a><span class="lineno"> 2013</span>  outarg.flags |= FUSE_ATOMIC_O_TRUNC;</div><div class="line"><a name="l02014"></a><span class="lineno"> 2014</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a7686c11aaf80382189927b10b848d8c8">FUSE_CAP_EXPORT_SUPPORT</a>)</div><div class="line"><a name="l02015"></a><span class="lineno"> 2015</span>  outarg.flags |= FUSE_EXPORT_SUPPORT;</div><div class="line"><a name="l02016"></a><span class="lineno"> 2016</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a0cd4cebf7ec784886836aa061a1612fe">FUSE_CAP_DONT_MASK</a>)</div><div class="line"><a name="l02017"></a><span class="lineno"> 2017</span>  outarg.flags |= FUSE_DONT_MASK;</div><div class="line"><a name="l02018"></a><span class="lineno"> 2018</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#afd06393448dbb60668f5a3bf0006f536">FUSE_CAP_FLOCK_LOCKS</a>)</div><div class="line"><a name="l02019"></a><span class="lineno"> 2019</span>  outarg.flags |= FUSE_FLOCK_LOCKS;</div><div class="line"><a name="l02020"></a><span class="lineno"> 2020</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2568c799f5f90ad2f0c353d48d8b8780">FUSE_CAP_AUTO_INVAL_DATA</a>)</div><div class="line"><a name="l02021"></a><span class="lineno"> 2021</span>  outarg.flags |= FUSE_AUTO_INVAL_DATA;</div><div class="line"><a name="l02022"></a><span class="lineno"> 2022</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#ad808b93c66a58d1b4cd738af7ddcf37f">FUSE_CAP_READDIRPLUS</a>)</div><div class="line"><a name="l02023"></a><span class="lineno"> 2023</span>  outarg.flags |= FUSE_DO_READDIRPLUS;</div><div class="line"><a name="l02024"></a><span class="lineno"> 2024</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87">FUSE_CAP_READDIRPLUS_AUTO</a>)</div><div class="line"><a name="l02025"></a><span class="lineno"> 2025</span>  outarg.flags |= FUSE_READDIRPLUS_AUTO;</div><div class="line"><a name="l02026"></a><span class="lineno"> 2026</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aac172aaeb6d27e2fdcafd086f9f3c0cf">FUSE_CAP_ASYNC_DIO</a>)</div><div class="line"><a name="l02027"></a><span class="lineno"> 2027</span>  outarg.flags |= FUSE_ASYNC_DIO;</div><div class="line"><a name="l02028"></a><span class="lineno"> 2028</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4839fce31097f4b4da7a1f01169228fa">FUSE_CAP_WRITEBACK_CACHE</a>)</div><div class="line"><a name="l02029"></a><span class="lineno"> 2029</span>  outarg.flags |= FUSE_WRITEBACK_CACHE;</div><div class="line"><a name="l02030"></a><span class="lineno"> 2030</span>  <span class="keywordflow">if</span> (se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5b3ef5b12be33295311d6b751846c263">FUSE_CAP_POSIX_ACL</a>)</div><div class="line"><a name="l02031"></a><span class="lineno"> 2031</span>  outarg.flags |= FUSE_POSIX_ACL;</div><div class="line"><a name="l02032"></a><span class="lineno"> 2032</span>  outarg.max_readahead = se->conn.max_readahead;</div><div class="line"><a name="l02033"></a><span class="lineno"> 2033</span>  outarg.max_write = se->conn.max_write;</div><div class="line"><a name="l02034"></a><span class="lineno"> 2034</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 13) {</div><div class="line"><a name="l02035"></a><span class="lineno"> 2035</span>  <span class="keywordflow">if</span> (se->conn.max_background >= (1 << 16))</div><div class="line"><a name="l02036"></a><span class="lineno"> 2036</span>  se->conn.max_background = (1 << 16) - 1;</div><div class="line"><a name="l02037"></a><span class="lineno"> 2037</span>  <span class="keywordflow">if</span> (se->conn.congestion_threshold > se->conn.max_background)</div><div class="line"><a name="l02038"></a><span class="lineno"> 2038</span>  se->conn.congestion_threshold = se->conn.max_background;</div><div class="line"><a name="l02039"></a><span class="lineno"> 2039</span>  <span class="keywordflow">if</span> (!se->conn.congestion_threshold) {</div><div class="line"><a name="l02040"></a><span class="lineno"> 2040</span>  se->conn.congestion_threshold =</div><div class="line"><a name="l02041"></a><span class="lineno"> 2041</span>  se->conn.max_background * 3 / 4;</div><div class="line"><a name="l02042"></a><span class="lineno"> 2042</span>  }</div><div class="line"><a name="l02043"></a><span class="lineno"> 2043</span> </div><div class="line"><a name="l02044"></a><span class="lineno"> 2044</span>  outarg.max_background = se->conn.max_background;</div><div class="line"><a name="l02045"></a><span class="lineno"> 2045</span>  outarg.congestion_threshold = se->conn.congestion_threshold;</div><div class="line"><a name="l02046"></a><span class="lineno"> 2046</span>  }</div><div class="line"><a name="l02047"></a><span class="lineno"> 2047</span>  <span class="keywordflow">if</span> (se->conn.proto_minor >= 23)</div><div class="line"><a name="l02048"></a><span class="lineno"> 2048</span>  outarg.time_gran = se->conn.time_gran;</div><div class="line"><a name="l02049"></a><span class="lineno"> 2049</span> </div><div class="line"><a name="l02050"></a><span class="lineno"> 2050</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l02051"></a><span class="lineno"> 2051</span>  fprintf(stderr, <span class="stringliteral">" INIT: %u.%u\n"</span>, outarg.major, outarg.minor);</div><div class="line"><a name="l02052"></a><span class="lineno"> 2052</span>  fprintf(stderr, <span class="stringliteral">" flags=0x%08x\n"</span>, outarg.flags);</div><div class="line"><a name="l02053"></a><span class="lineno"> 2053</span>  fprintf(stderr, <span class="stringliteral">" max_readahead=0x%08x\n"</span>,</div><div class="line"><a name="l02054"></a><span class="lineno"> 2054</span>  outarg.max_readahead);</div><div class="line"><a name="l02055"></a><span class="lineno"> 2055</span>  fprintf(stderr, <span class="stringliteral">" max_write=0x%08x\n"</span>, outarg.max_write);</div><div class="line"><a name="l02056"></a><span class="lineno"> 2056</span>  fprintf(stderr, <span class="stringliteral">" max_background=%i\n"</span>,</div><div class="line"><a name="l02057"></a><span class="lineno"> 2057</span>  outarg.max_background);</div><div class="line"><a name="l02058"></a><span class="lineno"> 2058</span>  fprintf(stderr, <span class="stringliteral">" congestion_threshold=%i\n"</span>,</div><div class="line"><a name="l02059"></a><span class="lineno"> 2059</span>  outarg.congestion_threshold);</div><div class="line"><a name="l02060"></a><span class="lineno"> 2060</span>  fprintf(stderr, <span class="stringliteral">" time_gran=%u\n"</span>,</div><div class="line"><a name="l02061"></a><span class="lineno"> 2061</span>  outarg.time_gran);</div><div class="line"><a name="l02062"></a><span class="lineno"> 2062</span>  }</div><div class="line"><a name="l02063"></a><span class="lineno"> 2063</span>  <span class="keywordflow">if</span> (arg->minor < 5)</div><div class="line"><a name="l02064"></a><span class="lineno"> 2064</span>  outargsize = FUSE_COMPAT_INIT_OUT_SIZE;</div><div class="line"><a name="l02065"></a><span class="lineno"> 2065</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg->minor < 23)</div><div class="line"><a name="l02066"></a><span class="lineno"> 2066</span>  outargsize = FUSE_COMPAT_22_INIT_OUT_SIZE;</div><div class="line"><a name="l02067"></a><span class="lineno"> 2067</span> </div><div class="line"><a name="l02068"></a><span class="lineno"> 2068</span>  send_reply_ok(req, &outarg, outargsize);</div><div class="line"><a name="l02069"></a><span class="lineno"> 2069</span> }</div><div class="line"><a name="l02070"></a><span class="lineno"> 2070</span> </div><div class="line"><a name="l02071"></a><span class="lineno"> 2071</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_destroy(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid, <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg)</div><div class="line"><a name="l02072"></a><span class="lineno"> 2072</span> {</div><div class="line"><a name="l02073"></a><span class="lineno"> 2073</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02074"></a><span class="lineno"> 2074</span> </div><div class="line"><a name="l02075"></a><span class="lineno"> 2075</span>  (void) nodeid;</div><div class="line"><a name="l02076"></a><span class="lineno"> 2076</span>  (void) inarg;</div><div class="line"><a name="l02077"></a><span class="lineno"> 2077</span> </div><div class="line"><a name="l02078"></a><span class="lineno"> 2078</span>  se->got_destroy = 1;</div><div class="line"><a name="l02079"></a><span class="lineno"> 2079</span>  <span class="keywordflow">if</span> (se->op.destroy)</div><div class="line"><a name="l02080"></a><span class="lineno"> 2080</span>  se->op.destroy(se->userdata);</div><div class="line"><a name="l02081"></a><span class="lineno"> 2081</span> </div><div class="line"><a name="l02082"></a><span class="lineno"> 2082</span>  send_reply_ok(req, NULL, 0);</div><div class="line"><a name="l02083"></a><span class="lineno"> 2083</span> }</div><div class="line"><a name="l02084"></a><span class="lineno"> 2084</span> </div><div class="line"><a name="l02085"></a><span class="lineno"> 2085</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_del_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq)</div><div class="line"><a name="l02086"></a><span class="lineno"> 2086</span> {</div><div class="line"><a name="l02087"></a><span class="lineno"> 2087</span>  <span class="keyword">struct </span>fuse_notify_req *prev = nreq->prev;</div><div class="line"><a name="l02088"></a><span class="lineno"> 2088</span>  <span class="keyword">struct </span>fuse_notify_req *next = nreq->next;</div><div class="line"><a name="l02089"></a><span class="lineno"> 2089</span>  prev->next = next;</div><div class="line"><a name="l02090"></a><span class="lineno"> 2090</span>  next->prev = prev;</div><div class="line"><a name="l02091"></a><span class="lineno"> 2091</span> }</div><div class="line"><a name="l02092"></a><span class="lineno"> 2092</span> </div><div class="line"><a name="l02093"></a><span class="lineno"> 2093</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_add_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq,</div><div class="line"><a name="l02094"></a><span class="lineno"> 2094</span>  <span class="keyword">struct</span> fuse_notify_req *next)</div><div class="line"><a name="l02095"></a><span class="lineno"> 2095</span> {</div><div class="line"><a name="l02096"></a><span class="lineno"> 2096</span>  <span class="keyword">struct </span>fuse_notify_req *prev = next->prev;</div><div class="line"><a name="l02097"></a><span class="lineno"> 2097</span>  nreq->next = next;</div><div class="line"><a name="l02098"></a><span class="lineno"> 2098</span>  nreq->prev = prev;</div><div class="line"><a name="l02099"></a><span class="lineno"> 2099</span>  prev->next = nreq;</div><div class="line"><a name="l02100"></a><span class="lineno"> 2100</span>  next->prev = nreq;</div><div class="line"><a name="l02101"></a><span class="lineno"> 2101</span> }</div><div class="line"><a name="l02102"></a><span class="lineno"> 2102</span> </div><div class="line"><a name="l02103"></a><span class="lineno"> 2103</span> <span class="keyword">static</span> <span class="keywordtype">void</span> list_init_nreq(<span class="keyword">struct</span> fuse_notify_req *nreq)</div><div class="line"><a name="l02104"></a><span class="lineno"> 2104</span> {</div><div class="line"><a name="l02105"></a><span class="lineno"> 2105</span>  nreq->next = nreq;</div><div class="line"><a name="l02106"></a><span class="lineno"> 2106</span>  nreq->prev = nreq;</div><div class="line"><a name="l02107"></a><span class="lineno"> 2107</span> }</div><div class="line"><a name="l02108"></a><span class="lineno"> 2108</span> </div><div class="line"><a name="l02109"></a><span class="lineno"> 2109</span> <span class="keyword">static</span> <span class="keywordtype">void</span> do_notify_reply(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> nodeid,</div><div class="line"><a name="l02110"></a><span class="lineno"> 2110</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02111"></a><span class="lineno"> 2111</span> {</div><div class="line"><a name="l02112"></a><span class="lineno"> 2112</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02113"></a><span class="lineno"> 2113</span>  <span class="keyword">struct </span>fuse_notify_req *nreq;</div><div class="line"><a name="l02114"></a><span class="lineno"> 2114</span>  <span class="keyword">struct </span>fuse_notify_req *head;</div><div class="line"><a name="l02115"></a><span class="lineno"> 2115</span> </div><div class="line"><a name="l02116"></a><span class="lineno"> 2116</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02117"></a><span class="lineno"> 2117</span>  head = &se->notify_list;</div><div class="line"><a name="l02118"></a><span class="lineno"> 2118</span>  <span class="keywordflow">for</span> (nreq = head->next; nreq != head; nreq = nreq->next) {</div><div class="line"><a name="l02119"></a><span class="lineno"> 2119</span>  <span class="keywordflow">if</span> (nreq->unique == req->unique) {</div><div class="line"><a name="l02120"></a><span class="lineno"> 2120</span>  list_del_nreq(nreq);</div><div class="line"><a name="l02121"></a><span class="lineno"> 2121</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l02122"></a><span class="lineno"> 2122</span>  }</div><div class="line"><a name="l02123"></a><span class="lineno"> 2123</span>  }</div><div class="line"><a name="l02124"></a><span class="lineno"> 2124</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02125"></a><span class="lineno"> 2125</span> </div><div class="line"><a name="l02126"></a><span class="lineno"> 2126</span>  <span class="keywordflow">if</span> (nreq != head)</div><div class="line"><a name="l02127"></a><span class="lineno"> 2127</span>  nreq->reply(nreq, req, nodeid, inarg, buf);</div><div class="line"><a name="l02128"></a><span class="lineno"> 2128</span> }</div><div class="line"><a name="l02129"></a><span class="lineno"> 2129</span> </div><div class="line"><a name="l02130"></a><span class="lineno"> 2130</span> <span class="keyword">static</span> <span class="keywordtype">int</span> send_notify_iov(<span class="keyword">struct</span> fuse_session *se, <span class="keywordtype">int</span> notify_code,</div><div class="line"><a name="l02131"></a><span class="lineno"> 2131</span>  <span class="keyword">struct</span> iovec *iov, <span class="keywordtype">int</span> count)</div><div class="line"><a name="l02132"></a><span class="lineno"> 2132</span> {</div><div class="line"><a name="l02133"></a><span class="lineno"> 2133</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l02134"></a><span class="lineno"> 2134</span> </div><div class="line"><a name="l02135"></a><span class="lineno"> 2135</span>  <span class="keywordflow">if</span> (!se->got_init)</div><div class="line"><a name="l02136"></a><span class="lineno"> 2136</span>  <span class="keywordflow">return</span> -ENOTCONN;</div><div class="line"><a name="l02137"></a><span class="lineno"> 2137</span> </div><div class="line"><a name="l02138"></a><span class="lineno"> 2138</span>  out.unique = 0;</div><div class="line"><a name="l02139"></a><span class="lineno"> 2139</span>  out.error = notify_code;</div><div class="line"><a name="l02140"></a><span class="lineno"> 2140</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l02141"></a><span class="lineno"> 2141</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header);</div><div class="line"><a name="l02142"></a><span class="lineno"> 2142</span> </div><div class="line"><a name="l02143"></a><span class="lineno"> 2143</span>  <span class="keywordflow">return</span> fuse_send_msg(se, NULL, iov, count);</div><div class="line"><a name="l02144"></a><span class="lineno"> 2144</span> }</div><div class="line"><a name="l02145"></a><span class="lineno"> 2145</span> </div><div class="line"><a name="l02146"></a><span class="lineno"> 2146</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab078685b1f480188031fc40aa2e2fbca">fuse_lowlevel_notify_poll</a>(<span class="keyword">struct</span> fuse_pollhandle *ph)</div><div class="line"><a name="l02147"></a><span class="lineno"> 2147</span> {</div><div class="line"><a name="l02148"></a><span class="lineno"> 2148</span>  <span class="keywordflow">if</span> (ph != NULL) {</div><div class="line"><a name="l02149"></a><span class="lineno"> 2149</span>  <span class="keyword">struct </span>fuse_notify_poll_wakeup_out outarg;</div><div class="line"><a name="l02150"></a><span class="lineno"> 2150</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02151"></a><span class="lineno"> 2151</span> </div><div class="line"><a name="l02152"></a><span class="lineno"> 2152</span>  outarg.kh = ph->kh;</div><div class="line"><a name="l02153"></a><span class="lineno"> 2153</span> </div><div class="line"><a name="l02154"></a><span class="lineno"> 2154</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02155"></a><span class="lineno"> 2155</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02156"></a><span class="lineno"> 2156</span> </div><div class="line"><a name="l02157"></a><span class="lineno"> 2157</span>  <span class="keywordflow">return</span> send_notify_iov(ph->se, FUSE_NOTIFY_POLL, iov, 2);</div><div class="line"><a name="l02158"></a><span class="lineno"> 2158</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02159"></a><span class="lineno"> 2159</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02160"></a><span class="lineno"> 2160</span>  }</div><div class="line"><a name="l02161"></a><span class="lineno"> 2161</span> }</div><div class="line"><a name="l02162"></a><span class="lineno"> 2162</span> </div><div class="line"><a name="l02163"></a><span class="lineno"> 2163</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a9cb974af9745294ff446d11cba2422f1">fuse_lowlevel_notify_inval_inode</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02164"></a><span class="lineno"> 2164</span>  off_t off, off_t len)</div><div class="line"><a name="l02165"></a><span class="lineno"> 2165</span> {</div><div class="line"><a name="l02166"></a><span class="lineno"> 2166</span>  <span class="keyword">struct </span>fuse_notify_inval_inode_out outarg;</div><div class="line"><a name="l02167"></a><span class="lineno"> 2167</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02168"></a><span class="lineno"> 2168</span> </div><div class="line"><a name="l02169"></a><span class="lineno"> 2169</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02170"></a><span class="lineno"> 2170</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02171"></a><span class="lineno"> 2171</span> </div><div class="line"><a name="l02172"></a><span class="lineno"> 2172</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 12)</div><div class="line"><a name="l02173"></a><span class="lineno"> 2173</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02174"></a><span class="lineno"> 2174</span>  </div><div class="line"><a name="l02175"></a><span class="lineno"> 2175</span>  outarg.ino = ino;</div><div class="line"><a name="l02176"></a><span class="lineno"> 2176</span>  outarg.off = off;</div><div class="line"><a name="l02177"></a><span class="lineno"> 2177</span>  outarg.len = len;</div><div class="line"><a name="l02178"></a><span class="lineno"> 2178</span> </div><div class="line"><a name="l02179"></a><span class="lineno"> 2179</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02180"></a><span class="lineno"> 2180</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02181"></a><span class="lineno"> 2181</span> </div><div class="line"><a name="l02182"></a><span class="lineno"> 2182</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_INVAL_INODE, iov, 2);</div><div class="line"><a name="l02183"></a><span class="lineno"> 2183</span> }</div><div class="line"><a name="l02184"></a><span class="lineno"> 2184</span> </div><div class="line"><a name="l02185"></a><span class="lineno"> 2185</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab14032b74b0a57a2b3155dd6ba8d6095">fuse_lowlevel_notify_inval_entry</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> parent,</div><div class="line"><a name="l02186"></a><span class="lineno"> 2186</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> namelen)</div><div class="line"><a name="l02187"></a><span class="lineno"> 2187</span> {</div><div class="line"><a name="l02188"></a><span class="lineno"> 2188</span>  <span class="keyword">struct </span>fuse_notify_inval_entry_out outarg;</div><div class="line"><a name="l02189"></a><span class="lineno"> 2189</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02190"></a><span class="lineno"> 2190</span> </div><div class="line"><a name="l02191"></a><span class="lineno"> 2191</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02192"></a><span class="lineno"> 2192</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02193"></a><span class="lineno"> 2193</span>  </div><div class="line"><a name="l02194"></a><span class="lineno"> 2194</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 12)</div><div class="line"><a name="l02195"></a><span class="lineno"> 2195</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02196"></a><span class="lineno"> 2196</span> </div><div class="line"><a name="l02197"></a><span class="lineno"> 2197</span>  outarg.parent = parent;</div><div class="line"><a name="l02198"></a><span class="lineno"> 2198</span>  outarg.namelen = namelen;</div><div class="line"><a name="l02199"></a><span class="lineno"> 2199</span>  outarg.padding = 0;</div><div class="line"><a name="l02200"></a><span class="lineno"> 2200</span> </div><div class="line"><a name="l02201"></a><span class="lineno"> 2201</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02202"></a><span class="lineno"> 2202</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02203"></a><span class="lineno"> 2203</span>  iov[2].iov_base = (<span class="keywordtype">void</span> *)name;</div><div class="line"><a name="l02204"></a><span class="lineno"> 2204</span>  iov[2].iov_len = namelen + 1;</div><div class="line"><a name="l02205"></a><span class="lineno"> 2205</span> </div><div class="line"><a name="l02206"></a><span class="lineno"> 2206</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_INVAL_ENTRY, iov, 3);</div><div class="line"><a name="l02207"></a><span class="lineno"> 2207</span> }</div><div class="line"><a name="l02208"></a><span class="lineno"> 2208</span> </div><div class="line"><a name="l02209"></a><span class="lineno"> 2209</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a399a43ff69a20ce42082a81eb1517992">fuse_lowlevel_notify_delete</a>(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02210"></a><span class="lineno"> 2210</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> parent, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> child,</div><div class="line"><a name="l02211"></a><span class="lineno"> 2211</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">size_t</span> namelen)</div><div class="line"><a name="l02212"></a><span class="lineno"> 2212</span> {</div><div class="line"><a name="l02213"></a><span class="lineno"> 2213</span>  <span class="keyword">struct </span>fuse_notify_delete_out outarg;</div><div class="line"><a name="l02214"></a><span class="lineno"> 2214</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02215"></a><span class="lineno"> 2215</span> </div><div class="line"><a name="l02216"></a><span class="lineno"> 2216</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02217"></a><span class="lineno"> 2217</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02218"></a><span class="lineno"> 2218</span> </div><div class="line"><a name="l02219"></a><span class="lineno"> 2219</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 18)</div><div class="line"><a name="l02220"></a><span class="lineno"> 2220</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02221"></a><span class="lineno"> 2221</span> </div><div class="line"><a name="l02222"></a><span class="lineno"> 2222</span>  outarg.parent = parent;</div><div class="line"><a name="l02223"></a><span class="lineno"> 2223</span>  outarg.child = child;</div><div class="line"><a name="l02224"></a><span class="lineno"> 2224</span>  outarg.namelen = namelen;</div><div class="line"><a name="l02225"></a><span class="lineno"> 2225</span>  outarg.padding = 0;</div><div class="line"><a name="l02226"></a><span class="lineno"> 2226</span> </div><div class="line"><a name="l02227"></a><span class="lineno"> 2227</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02228"></a><span class="lineno"> 2228</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02229"></a><span class="lineno"> 2229</span>  iov[2].iov_base = (<span class="keywordtype">void</span> *)name;</div><div class="line"><a name="l02230"></a><span class="lineno"> 2230</span>  iov[2].iov_len = namelen + 1;</div><div class="line"><a name="l02231"></a><span class="lineno"> 2231</span> </div><div class="line"><a name="l02232"></a><span class="lineno"> 2232</span>  <span class="keywordflow">return</span> send_notify_iov(se, FUSE_NOTIFY_DELETE, iov, 3);</div><div class="line"><a name="l02233"></a><span class="lineno"> 2233</span> }</div><div class="line"><a name="l02234"></a><span class="lineno"> 2234</span> </div><div class="line"><a name="l02235"></a><span class="lineno"> 2235</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#af856725ed4a13ed7c17512554043edbc">fuse_lowlevel_notify_store</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02236"></a><span class="lineno"> 2236</span>  off_t offset, <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *bufv,</div><div class="line"><a name="l02237"></a><span class="lineno"> 2237</span>  <span class="keyword">enum</span> <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#aec0ad71a3e8c357ebe7e87cdecbdbe18">fuse_buf_copy_flags</a> flags)</div><div class="line"><a name="l02238"></a><span class="lineno"> 2238</span> {</div><div class="line"><a name="l02239"></a><span class="lineno"> 2239</span>  <span class="keyword">struct </span>fuse_out_header out;</div><div class="line"><a name="l02240"></a><span class="lineno"> 2240</span>  <span class="keyword">struct </span>fuse_notify_store_out outarg;</div><div class="line"><a name="l02241"></a><span class="lineno"> 2241</span>  <span class="keyword">struct </span>iovec iov[3];</div><div class="line"><a name="l02242"></a><span class="lineno"> 2242</span>  <span class="keywordtype">size_t</span> size = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(bufv);</div><div class="line"><a name="l02243"></a><span class="lineno"> 2243</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l02244"></a><span class="lineno"> 2244</span> </div><div class="line"><a name="l02245"></a><span class="lineno"> 2245</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02246"></a><span class="lineno"> 2246</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02247"></a><span class="lineno"> 2247</span> </div><div class="line"><a name="l02248"></a><span class="lineno"> 2248</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 15)</div><div class="line"><a name="l02249"></a><span class="lineno"> 2249</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02250"></a><span class="lineno"> 2250</span> </div><div class="line"><a name="l02251"></a><span class="lineno"> 2251</span>  out.unique = 0;</div><div class="line"><a name="l02252"></a><span class="lineno"> 2252</span>  out.error = FUSE_NOTIFY_STORE;</div><div class="line"><a name="l02253"></a><span class="lineno"> 2253</span> </div><div class="line"><a name="l02254"></a><span class="lineno"> 2254</span>  outarg.nodeid = ino;</div><div class="line"><a name="l02255"></a><span class="lineno"> 2255</span>  outarg.offset = offset;</div><div class="line"><a name="l02256"></a><span class="lineno"> 2256</span>  outarg.size = size;</div><div class="line"><a name="l02257"></a><span class="lineno"> 2257</span>  outarg.padding = 0;</div><div class="line"><a name="l02258"></a><span class="lineno"> 2258</span> </div><div class="line"><a name="l02259"></a><span class="lineno"> 2259</span>  iov[0].iov_base = &out;</div><div class="line"><a name="l02260"></a><span class="lineno"> 2260</span>  iov[0].iov_len = <span class="keyword">sizeof</span>(out);</div><div class="line"><a name="l02261"></a><span class="lineno"> 2261</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02262"></a><span class="lineno"> 2262</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02263"></a><span class="lineno"> 2263</span> </div><div class="line"><a name="l02264"></a><span class="lineno"> 2264</span>  res = fuse_send_data_iov(se, NULL, iov, 2, bufv, flags);</div><div class="line"><a name="l02265"></a><span class="lineno"> 2265</span>  <span class="keywordflow">if</span> (res > 0)</div><div class="line"><a name="l02266"></a><span class="lineno"> 2266</span>  res = -res;</div><div class="line"><a name="l02267"></a><span class="lineno"> 2267</span> </div><div class="line"><a name="l02268"></a><span class="lineno"> 2268</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02269"></a><span class="lineno"> 2269</span> }</div><div class="line"><a name="l02270"></a><span class="lineno"> 2270</span> </div><div class="line"><a name="l02271"></a><span class="lineno"> 2271</span> <span class="keyword">struct </span>fuse_retrieve_req {</div><div class="line"><a name="l02272"></a><span class="lineno"> 2272</span>  <span class="keyword">struct </span>fuse_notify_req nreq;</div><div class="line"><a name="l02273"></a><span class="lineno"> 2273</span>  <span class="keywordtype">void</span> *cookie;</div><div class="line"><a name="l02274"></a><span class="lineno"> 2274</span> };</div><div class="line"><a name="l02275"></a><span class="lineno"> 2275</span> </div><div class="line"><a name="l02276"></a><span class="lineno"> 2276</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_retrieve_reply(<span class="keyword">struct</span> fuse_notify_req *nreq,</div><div class="line"><a name="l02277"></a><span class="lineno"> 2277</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02278"></a><span class="lineno"> 2278</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg,</div><div class="line"><a name="l02279"></a><span class="lineno"> 2279</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *ibuf)</div><div class="line"><a name="l02280"></a><span class="lineno"> 2280</span> {</div><div class="line"><a name="l02281"></a><span class="lineno"> 2281</span>  <span class="keyword">struct </span>fuse_session *se = req->se;</div><div class="line"><a name="l02282"></a><span class="lineno"> 2282</span>  <span class="keyword">struct </span>fuse_retrieve_req *rreq =</div><div class="line"><a name="l02283"></a><span class="lineno"> 2283</span>  container_of(nreq, <span class="keyword">struct</span> fuse_retrieve_req, nreq);</div><div class="line"><a name="l02284"></a><span class="lineno"> 2284</span>  <span class="keyword">const</span> <span class="keyword">struct </span>fuse_notify_retrieve_in *arg = inarg;</div><div class="line"><a name="l02285"></a><span class="lineno"> 2285</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = {</div><div class="line"><a name="l02286"></a><span class="lineno"> 2286</span>  .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *ibuf,</div><div class="line"><a name="l02287"></a><span class="lineno"> 2287</span>  .count = 1,</div><div class="line"><a name="l02288"></a><span class="lineno"> 2288</span>  };</div><div class="line"><a name="l02289"></a><span class="lineno"> 2289</span> </div><div class="line"><a name="l02290"></a><span class="lineno"> 2290</span>  <span class="keywordflow">if</span> (!(bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD))</div><div class="line"><a name="l02291"></a><span class="lineno"> 2291</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = PARAM(arg);</div><div class="line"><a name="l02292"></a><span class="lineno"> 2292</span> </div><div class="line"><a name="l02293"></a><span class="lineno"> 2293</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> -= <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l02294"></a><span class="lineno"> 2294</span>  sizeof(struct fuse_notify_retrieve_in);</div><div class="line"><a name="l02295"></a><span class="lineno"> 2295</span> </div><div class="line"><a name="l02296"></a><span class="lineno"> 2296</span>  <span class="keywordflow">if</span> (bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < arg->size) {</div><div class="line"><a name="l02297"></a><span class="lineno"> 2297</span>  fprintf(stderr, <span class="stringliteral">"fuse: retrieve reply: buffer size too small\n"</span>);</div><div class="line"><a name="l02298"></a><span class="lineno"> 2298</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l02299"></a><span class="lineno"> 2299</span>  <span class="keywordflow">goto</span> out;</div><div class="line"><a name="l02300"></a><span class="lineno"> 2300</span>  }</div><div class="line"><a name="l02301"></a><span class="lineno"> 2301</span>  bufv.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = arg->size;</div><div class="line"><a name="l02302"></a><span class="lineno"> 2302</span> </div><div class="line"><a name="l02303"></a><span class="lineno"> 2303</span>  <span class="keywordflow">if</span> (se->op.retrieve_reply) {</div><div class="line"><a name="l02304"></a><span class="lineno"> 2304</span>  se->op.retrieve_reply(req, rreq->cookie, ino,</div><div class="line"><a name="l02305"></a><span class="lineno"> 2305</span>  arg->offset, &bufv);</div><div class="line"><a name="l02306"></a><span class="lineno"> 2306</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02307"></a><span class="lineno"> 2307</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a85ae91390a6704dc26f8d80fed7d5678">fuse_reply_none</a>(req);</div><div class="line"><a name="l02308"></a><span class="lineno"> 2308</span>  }</div><div class="line"><a name="l02309"></a><span class="lineno"> 2309</span> out:</div><div class="line"><a name="l02310"></a><span class="lineno"> 2310</span>  free(rreq);</div><div class="line"><a name="l02311"></a><span class="lineno"> 2311</span>  <span class="keywordflow">if</span> ((ibuf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) && bufv.<a class="code" href="structfuse__bufvec.html#a41cc18cb303ee16d20b3ae1ebb0ef830">idx</a> < bufv.<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a>)</div><div class="line"><a name="l02312"></a><span class="lineno"> 2312</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02313"></a><span class="lineno"> 2313</span> }</div><div class="line"><a name="l02314"></a><span class="lineno"> 2314</span> </div><div class="line"><a name="l02315"></a><span class="lineno"> 2315</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a58cb3543209d2c29dc2830f2503b5058">fuse_lowlevel_notify_retrieve</a>(<span class="keyword">struct</span> fuse_session *se, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a> ino,</div><div class="line"><a name="l02316"></a><span class="lineno"> 2316</span>  <span class="keywordtype">size_t</span> size, off_t offset, <span class="keywordtype">void</span> *cookie)</div><div class="line"><a name="l02317"></a><span class="lineno"> 2317</span> {</div><div class="line"><a name="l02318"></a><span class="lineno"> 2318</span>  <span class="keyword">struct </span>fuse_notify_retrieve_out outarg;</div><div class="line"><a name="l02319"></a><span class="lineno"> 2319</span>  <span class="keyword">struct </span>iovec iov[2];</div><div class="line"><a name="l02320"></a><span class="lineno"> 2320</span>  <span class="keyword">struct </span>fuse_retrieve_req *rreq;</div><div class="line"><a name="l02321"></a><span class="lineno"> 2321</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02322"></a><span class="lineno"> 2322</span> </div><div class="line"><a name="l02323"></a><span class="lineno"> 2323</span>  <span class="keywordflow">if</span> (!se)</div><div class="line"><a name="l02324"></a><span class="lineno"> 2324</span>  <span class="keywordflow">return</span> -EINVAL;</div><div class="line"><a name="l02325"></a><span class="lineno"> 2325</span> </div><div class="line"><a name="l02326"></a><span class="lineno"> 2326</span>  <span class="keywordflow">if</span> (se->conn.proto_major < 6 || se->conn.proto_minor < 15)</div><div class="line"><a name="l02327"></a><span class="lineno"> 2327</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l02328"></a><span class="lineno"> 2328</span> </div><div class="line"><a name="l02329"></a><span class="lineno"> 2329</span>  rreq = malloc(<span class="keyword">sizeof</span>(*rreq));</div><div class="line"><a name="l02330"></a><span class="lineno"> 2330</span>  <span class="keywordflow">if</span> (rreq == NULL)</div><div class="line"><a name="l02331"></a><span class="lineno"> 2331</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02332"></a><span class="lineno"> 2332</span> </div><div class="line"><a name="l02333"></a><span class="lineno"> 2333</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02334"></a><span class="lineno"> 2334</span>  rreq->cookie = cookie;</div><div class="line"><a name="l02335"></a><span class="lineno"> 2335</span>  rreq->nreq.unique = se->notify_ctr++;</div><div class="line"><a name="l02336"></a><span class="lineno"> 2336</span>  rreq->nreq.reply = fuse_ll_retrieve_reply;</div><div class="line"><a name="l02337"></a><span class="lineno"> 2337</span>  list_add_nreq(&rreq->nreq, &se->notify_list);</div><div class="line"><a name="l02338"></a><span class="lineno"> 2338</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02339"></a><span class="lineno"> 2339</span> </div><div class="line"><a name="l02340"></a><span class="lineno"> 2340</span>  outarg.notify_unique = rreq->nreq.unique;</div><div class="line"><a name="l02341"></a><span class="lineno"> 2341</span>  outarg.nodeid = ino;</div><div class="line"><a name="l02342"></a><span class="lineno"> 2342</span>  outarg.offset = offset;</div><div class="line"><a name="l02343"></a><span class="lineno"> 2343</span>  outarg.size = size;</div><div class="line"><a name="l02344"></a><span class="lineno"> 2344</span>  outarg.padding = 0;</div><div class="line"><a name="l02345"></a><span class="lineno"> 2345</span> </div><div class="line"><a name="l02346"></a><span class="lineno"> 2346</span>  iov[1].iov_base = &outarg;</div><div class="line"><a name="l02347"></a><span class="lineno"> 2347</span>  iov[1].iov_len = <span class="keyword">sizeof</span>(outarg);</div><div class="line"><a name="l02348"></a><span class="lineno"> 2348</span> </div><div class="line"><a name="l02349"></a><span class="lineno"> 2349</span>  err = send_notify_iov(se, FUSE_NOTIFY_RETRIEVE, iov, 2);</div><div class="line"><a name="l02350"></a><span class="lineno"> 2350</span>  <span class="keywordflow">if</span> (err) {</div><div class="line"><a name="l02351"></a><span class="lineno"> 2351</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02352"></a><span class="lineno"> 2352</span>  list_del_nreq(&rreq->nreq);</div><div class="line"><a name="l02353"></a><span class="lineno"> 2353</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02354"></a><span class="lineno"> 2354</span>  free(rreq);</div><div class="line"><a name="l02355"></a><span class="lineno"> 2355</span>  }</div><div class="line"><a name="l02356"></a><span class="lineno"> 2356</span> </div><div class="line"><a name="l02357"></a><span class="lineno"> 2357</span>  <span class="keywordflow">return</span> err;</div><div class="line"><a name="l02358"></a><span class="lineno"> 2358</span> }</div><div class="line"><a name="l02359"></a><span class="lineno"> 2359</span> </div><div class="line"><a name="l02360"></a><span class="lineno"> 2360</span> <span class="keywordtype">void</span> *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aab00273c65d124e44abcf2374f9c504b">fuse_req_userdata</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02361"></a><span class="lineno"> 2361</span> {</div><div class="line"><a name="l02362"></a><span class="lineno"> 2362</span>  <span class="keywordflow">return</span> req->se->userdata;</div><div class="line"><a name="l02363"></a><span class="lineno"> 2363</span> }</div><div class="line"><a name="l02364"></a><span class="lineno"> 2364</span> </div><div class="line"><a name="l02365"></a><span class="lineno"> 2365</span> <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__ctx.html">fuse_ctx</a> *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1d1963190eb93ae5667d32d2b387ca1">fuse_req_ctx</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02366"></a><span class="lineno"> 2366</span> {</div><div class="line"><a name="l02367"></a><span class="lineno"> 2367</span>  <span class="keywordflow">return</span> &req->ctx;</div><div class="line"><a name="l02368"></a><span class="lineno"> 2368</span> }</div><div class="line"><a name="l02369"></a><span class="lineno"> 2369</span> </div><div class="line"><a name="l02370"></a><span class="lineno"> 2370</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab3cdb9744f033e37a72984489343940f">fuse_req_interrupt_func</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a1fe719ed24a713bb5d17e4e7a0dde730">fuse_interrupt_func_t</a> func,</div><div class="line"><a name="l02371"></a><span class="lineno"> 2371</span>  <span class="keywordtype">void</span> *data)</div><div class="line"><a name="l02372"></a><span class="lineno"> 2372</span> {</div><div class="line"><a name="l02373"></a><span class="lineno"> 2373</span>  pthread_mutex_lock(&req->lock);</div><div class="line"><a name="l02374"></a><span class="lineno"> 2374</span>  pthread_mutex_lock(&req->se->lock);</div><div class="line"><a name="l02375"></a><span class="lineno"> 2375</span>  req->u.ni.func = func;</div><div class="line"><a name="l02376"></a><span class="lineno"> 2376</span>  req->u.ni.data = data;</div><div class="line"><a name="l02377"></a><span class="lineno"> 2377</span>  pthread_mutex_unlock(&req->se->lock);</div><div class="line"><a name="l02378"></a><span class="lineno"> 2378</span>  <span class="keywordflow">if</span> (req->interrupted && func)</div><div class="line"><a name="l02379"></a><span class="lineno"> 2379</span>  func(req, data);</div><div class="line"><a name="l02380"></a><span class="lineno"> 2380</span>  pthread_mutex_unlock(&req->lock);</div><div class="line"><a name="l02381"></a><span class="lineno"> 2381</span> }</div><div class="line"><a name="l02382"></a><span class="lineno"> 2382</span> </div><div class="line"><a name="l02383"></a><span class="lineno"> 2383</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a52674fc627647f33e63c74267f0f1f9d">fuse_req_interrupted</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req)</div><div class="line"><a name="l02384"></a><span class="lineno"> 2384</span> {</div><div class="line"><a name="l02385"></a><span class="lineno"> 2385</span>  <span class="keywordtype">int</span> interrupted;</div><div class="line"><a name="l02386"></a><span class="lineno"> 2386</span> </div><div class="line"><a name="l02387"></a><span class="lineno"> 2387</span>  pthread_mutex_lock(&req->se->lock);</div><div class="line"><a name="l02388"></a><span class="lineno"> 2388</span>  interrupted = req->interrupted;</div><div class="line"><a name="l02389"></a><span class="lineno"> 2389</span>  pthread_mutex_unlock(&req->se->lock);</div><div class="line"><a name="l02390"></a><span class="lineno"> 2390</span> </div><div class="line"><a name="l02391"></a><span class="lineno"> 2391</span>  <span class="keywordflow">return</span> interrupted;</div><div class="line"><a name="l02392"></a><span class="lineno"> 2392</span> }</div><div class="line"><a name="l02393"></a><span class="lineno"> 2393</span> </div><div class="line"><a name="l02394"></a><span class="lineno"> 2394</span> <span class="keyword">static</span> <span class="keyword">struct </span>{</div><div class="line"><a name="l02395"></a><span class="lineno"> 2395</span>  void (*func)(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a>, <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad119a72f00b4cd2e4a500fd3364ae1e2">fuse_ino_t</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *);</div><div class="line"><a name="l02396"></a><span class="lineno"> 2396</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *name;</div><div class="line"><a name="l02397"></a><span class="lineno"> 2397</span> } fuse_ll_ops[] = {</div><div class="line"><a name="l02398"></a><span class="lineno"> 2398</span>  [FUSE_LOOKUP] = { do_lookup, <span class="stringliteral">"LOOKUP"</span> },</div><div class="line"><a name="l02399"></a><span class="lineno"> 2399</span>  [FUSE_FORGET] = { do_forget, <span class="stringliteral">"FORGET"</span> },</div><div class="line"><a name="l02400"></a><span class="lineno"> 2400</span>  [FUSE_GETATTR] = { do_getattr, <span class="stringliteral">"GETATTR"</span> },</div><div class="line"><a name="l02401"></a><span class="lineno"> 2401</span>  [FUSE_SETATTR] = { do_setattr, <span class="stringliteral">"SETATTR"</span> },</div><div class="line"><a name="l02402"></a><span class="lineno"> 2402</span>  [FUSE_READLINK] = { do_readlink, <span class="stringliteral">"READLINK"</span> },</div><div class="line"><a name="l02403"></a><span class="lineno"> 2403</span>  [FUSE_SYMLINK] = { do_symlink, <span class="stringliteral">"SYMLINK"</span> },</div><div class="line"><a name="l02404"></a><span class="lineno"> 2404</span>  [FUSE_MKNOD] = { do_mknod, <span class="stringliteral">"MKNOD"</span> },</div><div class="line"><a name="l02405"></a><span class="lineno"> 2405</span>  [FUSE_MKDIR] = { do_mkdir, <span class="stringliteral">"MKDIR"</span> },</div><div class="line"><a name="l02406"></a><span class="lineno"> 2406</span>  [FUSE_UNLINK] = { do_unlink, <span class="stringliteral">"UNLINK"</span> },</div><div class="line"><a name="l02407"></a><span class="lineno"> 2407</span>  [FUSE_RMDIR] = { do_rmdir, <span class="stringliteral">"RMDIR"</span> },</div><div class="line"><a name="l02408"></a><span class="lineno"> 2408</span>  [FUSE_RENAME] = { do_rename, <span class="stringliteral">"RENAME"</span> },</div><div class="line"><a name="l02409"></a><span class="lineno"> 2409</span>  [FUSE_LINK] = { do_link, <span class="stringliteral">"LINK"</span> },</div><div class="line"><a name="l02410"></a><span class="lineno"> 2410</span>  [FUSE_OPEN] = { do_open, <span class="stringliteral">"OPEN"</span> },</div><div class="line"><a name="l02411"></a><span class="lineno"> 2411</span>  [FUSE_READ] = { do_read, <span class="stringliteral">"READ"</span> },</div><div class="line"><a name="l02412"></a><span class="lineno"> 2412</span>  [FUSE_WRITE] = { do_write, <span class="stringliteral">"WRITE"</span> },</div><div class="line"><a name="l02413"></a><span class="lineno"> 2413</span>  [FUSE_STATFS] = { do_statfs, <span class="stringliteral">"STATFS"</span> },</div><div class="line"><a name="l02414"></a><span class="lineno"> 2414</span>  [FUSE_RELEASE] = { do_release, <span class="stringliteral">"RELEASE"</span> },</div><div class="line"><a name="l02415"></a><span class="lineno"> 2415</span>  [FUSE_FSYNC] = { do_fsync, <span class="stringliteral">"FSYNC"</span> },</div><div class="line"><a name="l02416"></a><span class="lineno"> 2416</span>  [FUSE_SETXATTR] = { do_setxattr, <span class="stringliteral">"SETXATTR"</span> },</div><div class="line"><a name="l02417"></a><span class="lineno"> 2417</span>  [FUSE_GETXATTR] = { do_getxattr, <span class="stringliteral">"GETXATTR"</span> },</div><div class="line"><a name="l02418"></a><span class="lineno"> 2418</span>  [FUSE_LISTXATTR] = { do_listxattr, <span class="stringliteral">"LISTXATTR"</span> },</div><div class="line"><a name="l02419"></a><span class="lineno"> 2419</span>  [FUSE_REMOVEXATTR] = { do_removexattr, <span class="stringliteral">"REMOVEXATTR"</span> },</div><div class="line"><a name="l02420"></a><span class="lineno"> 2420</span>  [FUSE_FLUSH] = { do_flush, <span class="stringliteral">"FLUSH"</span> },</div><div class="line"><a name="l02421"></a><span class="lineno"> 2421</span>  [FUSE_INIT] = { do_init, <span class="stringliteral">"INIT"</span> },</div><div class="line"><a name="l02422"></a><span class="lineno"> 2422</span>  [FUSE_OPENDIR] = { do_opendir, <span class="stringliteral">"OPENDIR"</span> },</div><div class="line"><a name="l02423"></a><span class="lineno"> 2423</span>  [FUSE_READDIR] = { do_readdir, <span class="stringliteral">"READDIR"</span> },</div><div class="line"><a name="l02424"></a><span class="lineno"> 2424</span>  [FUSE_RELEASEDIR] = { do_releasedir, <span class="stringliteral">"RELEASEDIR"</span> },</div><div class="line"><a name="l02425"></a><span class="lineno"> 2425</span>  [FUSE_FSYNCDIR] = { do_fsyncdir, <span class="stringliteral">"FSYNCDIR"</span> },</div><div class="line"><a name="l02426"></a><span class="lineno"> 2426</span>  [FUSE_GETLK] = { do_getlk, <span class="stringliteral">"GETLK"</span> },</div><div class="line"><a name="l02427"></a><span class="lineno"> 2427</span>  [FUSE_SETLK] = { do_setlk, <span class="stringliteral">"SETLK"</span> },</div><div class="line"><a name="l02428"></a><span class="lineno"> 2428</span>  [FUSE_SETLKW] = { do_setlkw, <span class="stringliteral">"SETLKW"</span> },</div><div class="line"><a name="l02429"></a><span class="lineno"> 2429</span>  [FUSE_ACCESS] = { do_access, <span class="stringliteral">"ACCESS"</span> },</div><div class="line"><a name="l02430"></a><span class="lineno"> 2430</span>  [FUSE_CREATE] = { do_create, <span class="stringliteral">"CREATE"</span> },</div><div class="line"><a name="l02431"></a><span class="lineno"> 2431</span>  [FUSE_INTERRUPT] = { do_interrupt, <span class="stringliteral">"INTERRUPT"</span> },</div><div class="line"><a name="l02432"></a><span class="lineno"> 2432</span>  [FUSE_BMAP] = { do_bmap, <span class="stringliteral">"BMAP"</span> },</div><div class="line"><a name="l02433"></a><span class="lineno"> 2433</span>  [FUSE_IOCTL] = { do_ioctl, <span class="stringliteral">"IOCTL"</span> },</div><div class="line"><a name="l02434"></a><span class="lineno"> 2434</span>  [FUSE_POLL] = { do_poll, <span class="stringliteral">"POLL"</span> },</div><div class="line"><a name="l02435"></a><span class="lineno"> 2435</span>  [FUSE_FALLOCATE] = { do_fallocate, <span class="stringliteral">"FALLOCATE"</span> },</div><div class="line"><a name="l02436"></a><span class="lineno"> 2436</span>  [FUSE_DESTROY] = { do_destroy, <span class="stringliteral">"DESTROY"</span> },</div><div class="line"><a name="l02437"></a><span class="lineno"> 2437</span>  [FUSE_NOTIFY_REPLY] = { (<span class="keywordtype">void</span> *) 1, <span class="stringliteral">"NOTIFY_REPLY"</span> },</div><div class="line"><a name="l02438"></a><span class="lineno"> 2438</span>  [FUSE_BATCH_FORGET] = { do_batch_forget, <span class="stringliteral">"BATCH_FORGET"</span> },</div><div class="line"><a name="l02439"></a><span class="lineno"> 2439</span>  [FUSE_READDIRPLUS] = { do_readdirplus, <span class="stringliteral">"READDIRPLUS"</span>},</div><div class="line"><a name="l02440"></a><span class="lineno"> 2440</span>  [FUSE_RENAME2] = { do_rename2, <span class="stringliteral">"RENAME2"</span> },</div><div class="line"><a name="l02441"></a><span class="lineno"> 2441</span>  [FUSE_COPY_FILE_RANGE] = { do_copy_file_range, <span class="stringliteral">"COPY_FILE_RANGE"</span> },</div><div class="line"><a name="l02442"></a><span class="lineno"> 2442</span>  [CUSE_INIT] = { cuse_lowlevel_init, <span class="stringliteral">"CUSE_INIT"</span> },</div><div class="line"><a name="l02443"></a><span class="lineno"> 2443</span> };</div><div class="line"><a name="l02444"></a><span class="lineno"> 2444</span> </div><div class="line"><a name="l02445"></a><span class="lineno"> 2445</span> <span class="preprocessor">#define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))</span></div><div class="line"><a name="l02446"></a><span class="lineno"> 2446</span> </div><div class="line"><a name="l02447"></a><span class="lineno"> 2447</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *opname(<span class="keyword">enum</span> fuse_opcode opcode)</div><div class="line"><a name="l02448"></a><span class="lineno"> 2448</span> {</div><div class="line"><a name="l02449"></a><span class="lineno"> 2449</span>  <span class="keywordflow">if</span> (opcode >= FUSE_MAXOP || !fuse_ll_ops[opcode].name)</div><div class="line"><a name="l02450"></a><span class="lineno"> 2450</span>  <span class="keywordflow">return</span> <span class="stringliteral">"???"</span>;</div><div class="line"><a name="l02451"></a><span class="lineno"> 2451</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l02452"></a><span class="lineno"> 2452</span>  <span class="keywordflow">return</span> fuse_ll_ops[opcode].name;</div><div class="line"><a name="l02453"></a><span class="lineno"> 2453</span> }</div><div class="line"><a name="l02454"></a><span class="lineno"> 2454</span> </div><div class="line"><a name="l02455"></a><span class="lineno"> 2455</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_ll_copy_from_pipe(<span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *dst,</div><div class="line"><a name="l02456"></a><span class="lineno"> 2456</span>  <span class="keyword">struct</span> <a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> *src)</div><div class="line"><a name="l02457"></a><span class="lineno"> 2457</span> {</div><div class="line"><a name="l02458"></a><span class="lineno"> 2458</span>  ssize_t res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(dst, src, 0);</div><div class="line"><a name="l02459"></a><span class="lineno"> 2459</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l02460"></a><span class="lineno"> 2460</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: %s\n"</span>, strerror(-res));</div><div class="line"><a name="l02461"></a><span class="lineno"> 2461</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02462"></a><span class="lineno"> 2462</span>  }</div><div class="line"><a name="l02463"></a><span class="lineno"> 2463</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>)res < <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a4327f41b2fe1ca84151b407169bd86c0">fuse_buf_size</a>(dst)) {</div><div class="line"><a name="l02464"></a><span class="lineno"> 2464</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: short read\n"</span>);</div><div class="line"><a name="l02465"></a><span class="lineno"> 2465</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02466"></a><span class="lineno"> 2466</span>  }</div><div class="line"><a name="l02467"></a><span class="lineno"> 2467</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02468"></a><span class="lineno"> 2468</span> }</div><div class="line"><a name="l02469"></a><span class="lineno"> 2469</span> </div><div class="line"><a name="l02470"></a><span class="lineno"> 2470</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a411ee86ec4657ea954402a9ca263e6d0">fuse_session_process_buf</a>(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02471"></a><span class="lineno"> 2471</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02472"></a><span class="lineno"> 2472</span> {</div><div class="line"><a name="l02473"></a><span class="lineno"> 2473</span>  fuse_session_process_buf_int(se, buf, NULL);</div><div class="line"><a name="l02474"></a><span class="lineno"> 2474</span> }</div><div class="line"><a name="l02475"></a><span class="lineno"> 2475</span> </div><div class="line"><a name="l02476"></a><span class="lineno"> 2476</span> <span class="keywordtype">void</span> fuse_session_process_buf_int(<span class="keyword">struct</span> fuse_session *se,</div><div class="line"><a name="l02477"></a><span class="lineno"> 2477</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf, <span class="keyword">struct</span> fuse_chan *ch)</div><div class="line"><a name="l02478"></a><span class="lineno"> 2478</span> {</div><div class="line"><a name="l02479"></a><span class="lineno"> 2479</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> write_header_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_in_header) +</div><div class="line"><a name="l02480"></a><span class="lineno"> 2480</span>  sizeof(struct fuse_write_in);</div><div class="line"><a name="l02481"></a><span class="lineno"> 2481</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> bufv = { .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>, .count = 1 };</div><div class="line"><a name="l02482"></a><span class="lineno"> 2482</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> tmpbuf = FUSE_BUFVEC_INIT(write_header_size);</div><div class="line"><a name="l02483"></a><span class="lineno"> 2483</span>  <span class="keyword">struct </span>fuse_in_header *in;</div><div class="line"><a name="l02484"></a><span class="lineno"> 2484</span>  <span class="keyword">const</span> <span class="keywordtype">void</span> *inarg;</div><div class="line"><a name="l02485"></a><span class="lineno"> 2485</span>  <span class="keyword">struct </span>fuse_req *req;</div><div class="line"><a name="l02486"></a><span class="lineno"> 2486</span>  <span class="keywordtype">void</span> *mbuf = NULL;</div><div class="line"><a name="l02487"></a><span class="lineno"> 2487</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02488"></a><span class="lineno"> 2488</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l02489"></a><span class="lineno"> 2489</span> </div><div class="line"><a name="l02490"></a><span class="lineno"> 2490</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) {</div><div class="line"><a name="l02491"></a><span class="lineno"> 2491</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> < tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>)</div><div class="line"><a name="l02492"></a><span class="lineno"> 2492</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>;</div><div class="line"><a name="l02493"></a><span class="lineno"> 2493</span> </div><div class="line"><a name="l02494"></a><span class="lineno"> 2494</span>  mbuf = malloc(tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>);</div><div class="line"><a name="l02495"></a><span class="lineno"> 2495</span>  <span class="keywordflow">if</span> (mbuf == NULL) {</div><div class="line"><a name="l02496"></a><span class="lineno"> 2496</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate header\n"</span>);</div><div class="line"><a name="l02497"></a><span class="lineno"> 2497</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02498"></a><span class="lineno"> 2498</span>  }</div><div class="line"><a name="l02499"></a><span class="lineno"> 2499</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = mbuf;</div><div class="line"><a name="l02500"></a><span class="lineno"> 2500</span> </div><div class="line"><a name="l02501"></a><span class="lineno"> 2501</span>  res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);</div><div class="line"><a name="l02502"></a><span class="lineno"> 2502</span>  <span class="keywordflow">if</span> (res < 0)</div><div class="line"><a name="l02503"></a><span class="lineno"> 2503</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02504"></a><span class="lineno"> 2504</span> </div><div class="line"><a name="l02505"></a><span class="lineno"> 2505</span>  in = mbuf;</div><div class="line"><a name="l02506"></a><span class="lineno"> 2506</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02507"></a><span class="lineno"> 2507</span>  in = buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>;</div><div class="line"><a name="l02508"></a><span class="lineno"> 2508</span>  }</div><div class="line"><a name="l02509"></a><span class="lineno"> 2509</span> </div><div class="line"><a name="l02510"></a><span class="lineno"> 2510</span>  <span class="keywordflow">if</span> (se->debug) {</div><div class="line"><a name="l02511"></a><span class="lineno"> 2511</span>  fprintf(stderr,</div><div class="line"><a name="l02512"></a><span class="lineno"> 2512</span>  <span class="stringliteral">"unique: %llu, opcode: %s (%i), nodeid: %llu, insize: %zu, pid: %u\n"</span>,</div><div class="line"><a name="l02513"></a><span class="lineno"> 2513</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) in->unique,</div><div class="line"><a name="l02514"></a><span class="lineno"> 2514</span>  opname((<span class="keyword">enum</span> fuse_opcode) in->opcode), in->opcode,</div><div class="line"><a name="l02515"></a><span class="lineno"> 2515</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>) in->nodeid, buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>, in->pid);</div><div class="line"><a name="l02516"></a><span class="lineno"> 2516</span>  }</div><div class="line"><a name="l02517"></a><span class="lineno"> 2517</span> </div><div class="line"><a name="l02518"></a><span class="lineno"> 2518</span>  req = fuse_ll_alloc_req(se);</div><div class="line"><a name="l02519"></a><span class="lineno"> 2519</span>  <span class="keywordflow">if</span> (req == NULL) {</div><div class="line"><a name="l02520"></a><span class="lineno"> 2520</span>  <span class="keyword">struct </span>fuse_out_header out = {</div><div class="line"><a name="l02521"></a><span class="lineno"> 2521</span>  .unique = in->unique,</div><div class="line"><a name="l02522"></a><span class="lineno"> 2522</span>  .error = -ENOMEM,</div><div class="line"><a name="l02523"></a><span class="lineno"> 2523</span>  };</div><div class="line"><a name="l02524"></a><span class="lineno"> 2524</span>  <span class="keyword">struct </span>iovec iov = {</div><div class="line"><a name="l02525"></a><span class="lineno"> 2525</span>  .iov_base = &out,</div><div class="line"><a name="l02526"></a><span class="lineno"> 2526</span>  .iov_len = <span class="keyword">sizeof</span>(<span class="keyword">struct </span>fuse_out_header),</div><div class="line"><a name="l02527"></a><span class="lineno"> 2527</span>  };</div><div class="line"><a name="l02528"></a><span class="lineno"> 2528</span> </div><div class="line"><a name="l02529"></a><span class="lineno"> 2529</span>  fuse_send_msg(se, ch, &iov, 1);</div><div class="line"><a name="l02530"></a><span class="lineno"> 2530</span>  <span class="keywordflow">goto</span> clear_pipe;</div><div class="line"><a name="l02531"></a><span class="lineno"> 2531</span>  }</div><div class="line"><a name="l02532"></a><span class="lineno"> 2532</span> </div><div class="line"><a name="l02533"></a><span class="lineno"> 2533</span>  req->unique = in->unique;</div><div class="line"><a name="l02534"></a><span class="lineno"> 2534</span>  req->ctx.uid = in->uid;</div><div class="line"><a name="l02535"></a><span class="lineno"> 2535</span>  req->ctx.gid = in->gid;</div><div class="line"><a name="l02536"></a><span class="lineno"> 2536</span>  req->ctx.pid = in->pid;</div><div class="line"><a name="l02537"></a><span class="lineno"> 2537</span>  req->ch = ch ? fuse_chan_get(ch) : NULL;</div><div class="line"><a name="l02538"></a><span class="lineno"> 2538</span> </div><div class="line"><a name="l02539"></a><span class="lineno"> 2539</span>  err = EIO;</div><div class="line"><a name="l02540"></a><span class="lineno"> 2540</span>  <span class="keywordflow">if</span> (!se->got_init) {</div><div class="line"><a name="l02541"></a><span class="lineno"> 2541</span>  <span class="keyword">enum</span> fuse_opcode expected;</div><div class="line"><a name="l02542"></a><span class="lineno"> 2542</span> </div><div class="line"><a name="l02543"></a><span class="lineno"> 2543</span>  expected = se->cuse_data ? CUSE_INIT : FUSE_INIT;</div><div class="line"><a name="l02544"></a><span class="lineno"> 2544</span>  <span class="keywordflow">if</span> (in->opcode != expected)</div><div class="line"><a name="l02545"></a><span class="lineno"> 2545</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02546"></a><span class="lineno"> 2546</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (in->opcode == FUSE_INIT || in->opcode == CUSE_INIT)</div><div class="line"><a name="l02547"></a><span class="lineno"> 2547</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02548"></a><span class="lineno"> 2548</span> </div><div class="line"><a name="l02549"></a><span class="lineno"> 2549</span>  err = EACCES;</div><div class="line"><a name="l02550"></a><span class="lineno"> 2550</span>  <span class="comment">/* Implement -o allow_root */</span></div><div class="line"><a name="l02551"></a><span class="lineno"> 2551</span>  <span class="keywordflow">if</span> (se->deny_others && in->uid != se->owner && in->uid != 0 &&</div><div class="line"><a name="l02552"></a><span class="lineno"> 2552</span>  in->opcode != FUSE_INIT && in->opcode != FUSE_READ &&</div><div class="line"><a name="l02553"></a><span class="lineno"> 2553</span>  in->opcode != FUSE_WRITE && in->opcode != FUSE_FSYNC &&</div><div class="line"><a name="l02554"></a><span class="lineno"> 2554</span>  in->opcode != FUSE_RELEASE && in->opcode != FUSE_READDIR &&</div><div class="line"><a name="l02555"></a><span class="lineno"> 2555</span>  in->opcode != FUSE_FSYNCDIR && in->opcode != FUSE_RELEASEDIR &&</div><div class="line"><a name="l02556"></a><span class="lineno"> 2556</span>  in->opcode != FUSE_NOTIFY_REPLY &&</div><div class="line"><a name="l02557"></a><span class="lineno"> 2557</span>  in->opcode != FUSE_READDIRPLUS)</div><div class="line"><a name="l02558"></a><span class="lineno"> 2558</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02559"></a><span class="lineno"> 2559</span> </div><div class="line"><a name="l02560"></a><span class="lineno"> 2560</span>  err = ENOSYS;</div><div class="line"><a name="l02561"></a><span class="lineno"> 2561</span>  <span class="keywordflow">if</span> (in->opcode >= FUSE_MAXOP || !fuse_ll_ops[in->opcode].func)</div><div class="line"><a name="l02562"></a><span class="lineno"> 2562</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02563"></a><span class="lineno"> 2563</span>  <span class="keywordflow">if</span> (in->opcode != FUSE_INTERRUPT) {</div><div class="line"><a name="l02564"></a><span class="lineno"> 2564</span>  <span class="keyword">struct </span>fuse_req *intr;</div><div class="line"><a name="l02565"></a><span class="lineno"> 2565</span>  pthread_mutex_lock(&se->lock);</div><div class="line"><a name="l02566"></a><span class="lineno"> 2566</span>  intr = check_interrupt(se, req);</div><div class="line"><a name="l02567"></a><span class="lineno"> 2567</span>  list_add_req(req, &se->list);</div><div class="line"><a name="l02568"></a><span class="lineno"> 2568</span>  pthread_mutex_unlock(&se->lock);</div><div class="line"><a name="l02569"></a><span class="lineno"> 2569</span>  <span class="keywordflow">if</span> (intr)</div><div class="line"><a name="l02570"></a><span class="lineno"> 2570</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(intr, EAGAIN);</div><div class="line"><a name="l02571"></a><span class="lineno"> 2571</span>  }</div><div class="line"><a name="l02572"></a><span class="lineno"> 2572</span> </div><div class="line"><a name="l02573"></a><span class="lineno"> 2573</span>  <span class="keywordflow">if</span> ((buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD) && write_header_size < buf->size &&</div><div class="line"><a name="l02574"></a><span class="lineno"> 2574</span>  (in->opcode != FUSE_WRITE || !se->op.write_buf) &&</div><div class="line"><a name="l02575"></a><span class="lineno"> 2575</span>  in->opcode != FUSE_NOTIFY_REPLY) {</div><div class="line"><a name="l02576"></a><span class="lineno"> 2576</span>  <span class="keywordtype">void</span> *newmbuf;</div><div class="line"><a name="l02577"></a><span class="lineno"> 2577</span> </div><div class="line"><a name="l02578"></a><span class="lineno"> 2578</span>  err = ENOMEM;</div><div class="line"><a name="l02579"></a><span class="lineno"> 2579</span>  newmbuf = realloc(mbuf, buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a>);</div><div class="line"><a name="l02580"></a><span class="lineno"> 2580</span>  <span class="keywordflow">if</span> (newmbuf == NULL)</div><div class="line"><a name="l02581"></a><span class="lineno"> 2581</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02582"></a><span class="lineno"> 2582</span>  mbuf = newmbuf;</div><div class="line"><a name="l02583"></a><span class="lineno"> 2583</span> </div><div class="line"><a name="l02584"></a><span class="lineno"> 2584</span>  tmpbuf = FUSE_BUFVEC_INIT(buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> - write_header_size);</div><div class="line"><a name="l02585"></a><span class="lineno"> 2585</span>  tmpbuf.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0].<a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = (<span class="keywordtype">char</span> *)mbuf + write_header_size;</div><div class="line"><a name="l02586"></a><span class="lineno"> 2586</span> </div><div class="line"><a name="l02587"></a><span class="lineno"> 2587</span>  res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);</div><div class="line"><a name="l02588"></a><span class="lineno"> 2588</span>  err = -res;</div><div class="line"><a name="l02589"></a><span class="lineno"> 2589</span>  <span class="keywordflow">if</span> (res < 0)</div><div class="line"><a name="l02590"></a><span class="lineno"> 2590</span>  <span class="keywordflow">goto</span> reply_err;</div><div class="line"><a name="l02591"></a><span class="lineno"> 2591</span> </div><div class="line"><a name="l02592"></a><span class="lineno"> 2592</span>  in = mbuf;</div><div class="line"><a name="l02593"></a><span class="lineno"> 2593</span>  }</div><div class="line"><a name="l02594"></a><span class="lineno"> 2594</span> </div><div class="line"><a name="l02595"></a><span class="lineno"> 2595</span>  inarg = (<span class="keywordtype">void</span> *) &in[1];</div><div class="line"><a name="l02596"></a><span class="lineno"> 2596</span>  <span class="keywordflow">if</span> (in->opcode == FUSE_WRITE && se->op.write_buf)</div><div class="line"><a name="l02597"></a><span class="lineno"> 2597</span>  do_write_buf(req, in->nodeid, inarg, buf);</div><div class="line"><a name="l02598"></a><span class="lineno"> 2598</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (in->opcode == FUSE_NOTIFY_REPLY)</div><div class="line"><a name="l02599"></a><span class="lineno"> 2599</span>  do_notify_reply(req, in->nodeid, inarg, buf);</div><div class="line"><a name="l02600"></a><span class="lineno"> 2600</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l02601"></a><span class="lineno"> 2601</span>  fuse_ll_ops[in->opcode].func(req, in->nodeid, inarg);</div><div class="line"><a name="l02602"></a><span class="lineno"> 2602</span> </div><div class="line"><a name="l02603"></a><span class="lineno"> 2603</span> out_free:</div><div class="line"><a name="l02604"></a><span class="lineno"> 2604</span>  free(mbuf);</div><div class="line"><a name="l02605"></a><span class="lineno"> 2605</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l02606"></a><span class="lineno"> 2606</span> </div><div class="line"><a name="l02607"></a><span class="lineno"> 2607</span> reply_err:</div><div class="line"><a name="l02608"></a><span class="lineno"> 2608</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a2553c03f9a63c75e609e67f90a3a5d88">fuse_reply_err</a>(req, err);</div><div class="line"><a name="l02609"></a><span class="lineno"> 2609</span> clear_pipe:</div><div class="line"><a name="l02610"></a><span class="lineno"> 2610</span>  <span class="keywordflow">if</span> (buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> & FUSE_BUF_IS_FD)</div><div class="line"><a name="l02611"></a><span class="lineno"> 2611</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02612"></a><span class="lineno"> 2612</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l02613"></a><span class="lineno"> 2613</span> }</div><div class="line"><a name="l02614"></a><span class="lineno"> 2614</span> </div><div class="line"><a name="l02615"></a><span class="lineno"> 2615</span> <span class="preprocessor">#define LL_OPTION(n,o,v) \</span></div><div class="line"><a name="l02616"></a><span class="lineno"> 2616</span> <span class="preprocessor"> { n, offsetof(struct fuse_session, o), v }</span></div><div class="line"><a name="l02617"></a><span class="lineno"> 2617</span> </div><div class="line"><a name="l02618"></a><span class="lineno"> 2618</span> <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> fuse_ll_opts[] = {</div><div class="line"><a name="l02619"></a><span class="lineno"> 2619</span>  LL_OPTION(<span class="stringliteral">"debug"</span>, debug, 1),</div><div class="line"><a name="l02620"></a><span class="lineno"> 2620</span>  LL_OPTION(<span class="stringliteral">"-d"</span>, debug, 1),</div><div class="line"><a name="l02621"></a><span class="lineno"> 2621</span>  LL_OPTION(<span class="stringliteral">"--debug"</span>, debug, 1),</div><div class="line"><a name="l02622"></a><span class="lineno"> 2622</span>  LL_OPTION(<span class="stringliteral">"allow_root"</span>, deny_others, 1),</div><div class="line"><a name="l02623"></a><span class="lineno"> 2623</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#aca35962e17d189ceb5447f8eea11bd33">FUSE_OPT_END</a></div><div class="line"><a name="l02624"></a><span class="lineno"> 2624</span> };</div><div class="line"><a name="l02625"></a><span class="lineno"> 2625</span> </div><div class="line"><a name="l02626"></a><span class="lineno"> 2626</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ac6e2d0fde62dcf4f0e57afeabeefd7b1">fuse_lowlevel_version</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l02627"></a><span class="lineno"> 2627</span> {</div><div class="line"><a name="l02628"></a><span class="lineno"> 2628</span>  printf(<span class="stringliteral">"using FUSE kernel interface version %i.%i\n"</span>,</div><div class="line"><a name="l02629"></a><span class="lineno"> 2629</span>  FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION);</div><div class="line"><a name="l02630"></a><span class="lineno"> 2630</span>  fuse_mount_version();</div><div class="line"><a name="l02631"></a><span class="lineno"> 2631</span> }</div><div class="line"><a name="l02632"></a><span class="lineno"> 2632</span> </div><div class="line"><a name="l02633"></a><span class="lineno"> 2633</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a990af0becaba1b5e45781d399720f85e">fuse_lowlevel_help</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l02634"></a><span class="lineno"> 2634</span> {</div><div class="line"><a name="l02635"></a><span class="lineno"> 2635</span>  <span class="comment">/* These are not all options, but the ones that are</span></div><div class="line"><a name="l02636"></a><span class="lineno"> 2636</span> <span class="comment"> potentially of interest to an end-user */</span></div><div class="line"><a name="l02637"></a><span class="lineno"> 2637</span>  printf(</div><div class="line"><a name="l02638"></a><span class="lineno"> 2638</span> <span class="stringliteral">" -o allow_other allow access by all users\n"</span></div><div class="line"><a name="l02639"></a><span class="lineno"> 2639</span> <span class="stringliteral">" -o allow_root allow access by root\n"</span></div><div class="line"><a name="l02640"></a><span class="lineno"> 2640</span> <span class="stringliteral">" -o auto_unmount auto unmount on process termination\n"</span>);</div><div class="line"><a name="l02641"></a><span class="lineno"> 2641</span> }</div><div class="line"><a name="l02642"></a><span class="lineno"> 2642</span> </div><div class="line"><a name="l02643"></a><span class="lineno"> 2643</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a08b5503c4e9656f9c4bc88331233cc65">fuse_session_destroy</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02644"></a><span class="lineno"> 2644</span> {</div><div class="line"><a name="l02645"></a><span class="lineno"> 2645</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l02646"></a><span class="lineno"> 2646</span> </div><div class="line"><a name="l02647"></a><span class="lineno"> 2647</span>  <span class="keywordflow">if</span> (se->got_init && !se->got_destroy) {</div><div class="line"><a name="l02648"></a><span class="lineno"> 2648</span>  <span class="keywordflow">if</span> (se->op.destroy)</div><div class="line"><a name="l02649"></a><span class="lineno"> 2649</span>  se->op.destroy(se->userdata);</div><div class="line"><a name="l02650"></a><span class="lineno"> 2650</span>  }</div><div class="line"><a name="l02651"></a><span class="lineno"> 2651</span>  llp = pthread_getspecific(se->pipe_key);</div><div class="line"><a name="l02652"></a><span class="lineno"> 2652</span>  <span class="keywordflow">if</span> (llp != NULL)</div><div class="line"><a name="l02653"></a><span class="lineno"> 2653</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l02654"></a><span class="lineno"> 2654</span>  pthread_key_delete(se->pipe_key);</div><div class="line"><a name="l02655"></a><span class="lineno"> 2655</span>  pthread_mutex_destroy(&se->lock);</div><div class="line"><a name="l02656"></a><span class="lineno"> 2656</span>  free(se->cuse_data);</div><div class="line"><a name="l02657"></a><span class="lineno"> 2657</span>  <span class="keywordflow">if</span> (se->fd != -1)</div><div class="line"><a name="l02658"></a><span class="lineno"> 2658</span>  close(se->fd);</div><div class="line"><a name="l02659"></a><span class="lineno"> 2659</span>  destroy_mount_opts(se->mo);</div><div class="line"><a name="l02660"></a><span class="lineno"> 2660</span>  free(se);</div><div class="line"><a name="l02661"></a><span class="lineno"> 2661</span> }</div><div class="line"><a name="l02662"></a><span class="lineno"> 2662</span> </div><div class="line"><a name="l02663"></a><span class="lineno"> 2663</span> </div><div class="line"><a name="l02664"></a><span class="lineno"> 2664</span> <span class="keyword">static</span> <span class="keywordtype">void</span> fuse_ll_pipe_destructor(<span class="keywordtype">void</span> *data)</div><div class="line"><a name="l02665"></a><span class="lineno"> 2665</span> {</div><div class="line"><a name="l02666"></a><span class="lineno"> 2666</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp = data;</div><div class="line"><a name="l02667"></a><span class="lineno"> 2667</span>  fuse_ll_pipe_free(llp);</div><div class="line"><a name="l02668"></a><span class="lineno"> 2668</span> }</div><div class="line"><a name="l02669"></a><span class="lineno"> 2669</span> </div><div class="line"><a name="l02670"></a><span class="lineno"> 2670</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa434f1c9e7d71c4ed219c4dc3b1deae7">fuse_session_receive_buf</a>(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf)</div><div class="line"><a name="l02671"></a><span class="lineno"> 2671</span> {</div><div class="line"><a name="l02672"></a><span class="lineno"> 2672</span>  <span class="keywordflow">return</span> fuse_session_receive_buf_int(se, buf, NULL);</div><div class="line"><a name="l02673"></a><span class="lineno"> 2673</span> }</div><div class="line"><a name="l02674"></a><span class="lineno"> 2674</span> </div><div class="line"><a name="l02675"></a><span class="lineno"> 2675</span> <span class="keywordtype">int</span> fuse_session_receive_buf_int(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">struct</span> <a class="code" href="structfuse__buf.html">fuse_buf</a> *buf,</div><div class="line"><a name="l02676"></a><span class="lineno"> 2676</span>  <span class="keyword">struct</span> fuse_chan *ch)</div><div class="line"><a name="l02677"></a><span class="lineno"> 2677</span> {</div><div class="line"><a name="l02678"></a><span class="lineno"> 2678</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02679"></a><span class="lineno"> 2679</span>  ssize_t res;</div><div class="line"><a name="l02680"></a><span class="lineno"> 2680</span> <span class="preprocessor">#ifdef HAVE_SPLICE</span></div><div class="line"><a name="l02681"></a><span class="lineno"> 2681</span>  <span class="keywordtype">size_t</span> bufsize = se->bufsize;</div><div class="line"><a name="l02682"></a><span class="lineno"> 2682</span>  <span class="keyword">struct </span>fuse_ll_pipe *llp;</div><div class="line"><a name="l02683"></a><span class="lineno"> 2683</span>  <span class="keyword">struct </span><a class="code" href="structfuse__buf.html">fuse_buf</a> tmpbuf;</div><div class="line"><a name="l02684"></a><span class="lineno"> 2684</span> </div><div class="line"><a name="l02685"></a><span class="lineno"> 2685</span>  <span class="keywordflow">if</span> (se->conn.proto_minor < 14 || !(se->conn.want & <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a2f8a51bc70841ab691660413836a9a14">FUSE_CAP_SPLICE_READ</a>))</div><div class="line"><a name="l02686"></a><span class="lineno"> 2686</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02687"></a><span class="lineno"> 2687</span> </div><div class="line"><a name="l02688"></a><span class="lineno"> 2688</span>  llp = fuse_ll_get_pipe(se);</div><div class="line"><a name="l02689"></a><span class="lineno"> 2689</span>  <span class="keywordflow">if</span> (llp == NULL)</div><div class="line"><a name="l02690"></a><span class="lineno"> 2690</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02691"></a><span class="lineno"> 2691</span> </div><div class="line"><a name="l02692"></a><span class="lineno"> 2692</span>  <span class="keywordflow">if</span> (llp->size < bufsize) {</div><div class="line"><a name="l02693"></a><span class="lineno"> 2693</span>  <span class="keywordflow">if</span> (llp->can_grow) {</div><div class="line"><a name="l02694"></a><span class="lineno"> 2694</span>  res = fcntl(llp->pipe[0], F_SETPIPE_SZ, bufsize);</div><div class="line"><a name="l02695"></a><span class="lineno"> 2695</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02696"></a><span class="lineno"> 2696</span>  llp->can_grow = 0;</div><div class="line"><a name="l02697"></a><span class="lineno"> 2697</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02698"></a><span class="lineno"> 2698</span>  }</div><div class="line"><a name="l02699"></a><span class="lineno"> 2699</span>  llp->size = res;</div><div class="line"><a name="l02700"></a><span class="lineno"> 2700</span>  }</div><div class="line"><a name="l02701"></a><span class="lineno"> 2701</span>  <span class="keywordflow">if</span> (llp->size < bufsize)</div><div class="line"><a name="l02702"></a><span class="lineno"> 2702</span>  <span class="keywordflow">goto</span> fallback;</div><div class="line"><a name="l02703"></a><span class="lineno"> 2703</span>  }</div><div class="line"><a name="l02704"></a><span class="lineno"> 2704</span> </div><div class="line"><a name="l02705"></a><span class="lineno"> 2705</span>  res = splice(ch ? ch->fd : se->fd,</div><div class="line"><a name="l02706"></a><span class="lineno"> 2706</span>  NULL, llp->pipe[1], NULL, bufsize, 0);</div><div class="line"><a name="l02707"></a><span class="lineno"> 2707</span>  err = errno;</div><div class="line"><a name="l02708"></a><span class="lineno"> 2708</span> </div><div class="line"><a name="l02709"></a><span class="lineno"> 2709</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se))</div><div class="line"><a name="l02710"></a><span class="lineno"> 2710</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02711"></a><span class="lineno"> 2711</span> </div><div class="line"><a name="l02712"></a><span class="lineno"> 2712</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02713"></a><span class="lineno"> 2713</span>  <span class="keywordflow">if</span> (err == ENODEV) {</div><div class="line"><a name="l02714"></a><span class="lineno"> 2714</span>  <span class="comment">/* Filesystem was unmounted, or connection was aborted</span></div><div class="line"><a name="l02715"></a><span class="lineno"> 2715</span> <span class="comment"> via /sys/fs/fuse/connections */</span></div><div class="line"><a name="l02716"></a><span class="lineno"> 2716</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l02717"></a><span class="lineno"> 2717</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02718"></a><span class="lineno"> 2718</span>  }</div><div class="line"><a name="l02719"></a><span class="lineno"> 2719</span>  <span class="keywordflow">if</span> (err != EINTR && err != EAGAIN)</div><div class="line"><a name="l02720"></a><span class="lineno"> 2720</span>  perror(<span class="stringliteral">"fuse: splice from device"</span>);</div><div class="line"><a name="l02721"></a><span class="lineno"> 2721</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l02722"></a><span class="lineno"> 2722</span>  }</div><div class="line"><a name="l02723"></a><span class="lineno"> 2723</span> </div><div class="line"><a name="l02724"></a><span class="lineno"> 2724</span>  <span class="keywordflow">if</span> (res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header)) {</div><div class="line"><a name="l02725"></a><span class="lineno"> 2725</span>  fprintf(stderr, <span class="stringliteral">"short splice from fuse device\n"</span>);</div><div class="line"><a name="l02726"></a><span class="lineno"> 2726</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02727"></a><span class="lineno"> 2727</span>  }</div><div class="line"><a name="l02728"></a><span class="lineno"> 2728</span> </div><div class="line"><a name="l02729"></a><span class="lineno"> 2729</span>  tmpbuf = (<span class="keyword">struct </span><a class="code" href="structfuse__buf.html">fuse_buf</a>) {</div><div class="line"><a name="l02730"></a><span class="lineno"> 2730</span>  .size = res,</div><div class="line"><a name="l02731"></a><span class="lineno"> 2731</span>  .flags = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a5e36b839c4dbf0439bd85b61c7213a58affd5b3b7e9cdd5f89b3126eea96e033b">FUSE_BUF_IS_FD</a>,</div><div class="line"><a name="l02732"></a><span class="lineno"> 2732</span>  .fd = llp->pipe[0],</div><div class="line"><a name="l02733"></a><span class="lineno"> 2733</span>  };</div><div class="line"><a name="l02734"></a><span class="lineno"> 2734</span> </div><div class="line"><a name="l02735"></a><span class="lineno"> 2735</span>  <span class="comment">/*</span></div><div class="line"><a name="l02736"></a><span class="lineno"> 2736</span> <span class="comment"> * Don't bother with zero copy for small requests.</span></div><div class="line"><a name="l02737"></a><span class="lineno"> 2737</span> <span class="comment"> * fuse_loop_mt() needs to check for FORGET so this more than</span></div><div class="line"><a name="l02738"></a><span class="lineno"> 2738</span> <span class="comment"> * just an optimization.</span></div><div class="line"><a name="l02739"></a><span class="lineno"> 2739</span> <span class="comment"> */</span></div><div class="line"><a name="l02740"></a><span class="lineno"> 2740</span>  <span class="keywordflow">if</span> (res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header) +</div><div class="line"><a name="l02741"></a><span class="lineno"> 2741</span>  <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_write_in) + pagesize) {</div><div class="line"><a name="l02742"></a><span class="lineno"> 2742</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> src = { .<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = tmpbuf, .<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> = 1 };</div><div class="line"><a name="l02743"></a><span class="lineno"> 2743</span>  <span class="keyword">struct </span><a class="code" href="structfuse__bufvec.html">fuse_bufvec</a> dst = { .<a class="code" href="structfuse__bufvec.html#ac303661a9c39ade1feeb05d8238b4ed6">count</a> = 1 };</div><div class="line"><a name="l02744"></a><span class="lineno"> 2744</span> </div><div class="line"><a name="l02745"></a><span class="lineno"> 2745</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02746"></a><span class="lineno"> 2746</span>  buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = malloc(se->bufsize);</div><div class="line"><a name="l02747"></a><span class="lineno"> 2747</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02748"></a><span class="lineno"> 2748</span>  fprintf(stderr,</div><div class="line"><a name="l02749"></a><span class="lineno"> 2749</span>  <span class="stringliteral">"fuse: failed to allocate read buffer\n"</span>);</div><div class="line"><a name="l02750"></a><span class="lineno"> 2750</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02751"></a><span class="lineno"> 2751</span>  }</div><div class="line"><a name="l02752"></a><span class="lineno"> 2752</span>  }</div><div class="line"><a name="l02753"></a><span class="lineno"> 2753</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = se->bufsize;</div><div class="line"><a name="l02754"></a><span class="lineno"> 2754</span>  buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = 0;</div><div class="line"><a name="l02755"></a><span class="lineno"> 2755</span>  dst.<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>[0] = *<a class="code" href="structfuse__bufvec.html#a4182555be43b16c0778d0dd9eb2bf7c4">buf</a>;</div><div class="line"><a name="l02756"></a><span class="lineno"> 2756</span> </div><div class="line"><a name="l02757"></a><span class="lineno"> 2757</span>  res = <a class="code" href="fuse-3_86_80_2include_2fuse__common_8h.html#a9ca301390fb5e85b85153abb1891a3f7">fuse_buf_copy</a>(&dst, &src, 0);</div><div class="line"><a name="l02758"></a><span class="lineno"> 2758</span>  <span class="keywordflow">if</span> (res < 0) {</div><div class="line"><a name="l02759"></a><span class="lineno"> 2759</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: %s\n"</span>,</div><div class="line"><a name="l02760"></a><span class="lineno"> 2760</span>  strerror(-res));</div><div class="line"><a name="l02761"></a><span class="lineno"> 2761</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02762"></a><span class="lineno"> 2762</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02763"></a><span class="lineno"> 2763</span>  }</div><div class="line"><a name="l02764"></a><span class="lineno"> 2764</span>  <span class="keywordflow">if</span> (res < tmpbuf.size) {</div><div class="line"><a name="l02765"></a><span class="lineno"> 2765</span>  fprintf(stderr, <span class="stringliteral">"fuse: copy from pipe: short read\n"</span>);</div><div class="line"><a name="l02766"></a><span class="lineno"> 2766</span>  fuse_ll_clear_pipe(se);</div><div class="line"><a name="l02767"></a><span class="lineno"> 2767</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02768"></a><span class="lineno"> 2768</span>  }</div><div class="line"><a name="l02769"></a><span class="lineno"> 2769</span>  assert(res == tmpbuf.size);</div><div class="line"><a name="l02770"></a><span class="lineno"> 2770</span> </div><div class="line"><a name="l02771"></a><span class="lineno"> 2771</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l02772"></a><span class="lineno"> 2772</span>  <span class="comment">/* Don't overwrite buf->mem, as that would cause a leak */</span></div><div class="line"><a name="l02773"></a><span class="lineno"> 2773</span>  buf-><a class="code" href="structfuse__buf.html#a62b2ae82904ac4355142984b9dd90d68">fd</a> = tmpbuf.fd;</div><div class="line"><a name="l02774"></a><span class="lineno"> 2774</span>  buf-><a class="code" href="structfuse__buf.html#a1928e204554f2d37cb8dac28a8a2f28c">flags</a> = tmpbuf.flags;</div><div class="line"><a name="l02775"></a><span class="lineno"> 2775</span>  }</div><div class="line"><a name="l02776"></a><span class="lineno"> 2776</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = tmpbuf.size;</div><div class="line"><a name="l02777"></a><span class="lineno"> 2777</span> </div><div class="line"><a name="l02778"></a><span class="lineno"> 2778</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02779"></a><span class="lineno"> 2779</span> </div><div class="line"><a name="l02780"></a><span class="lineno"> 2780</span> fallback:</div><div class="line"><a name="l02781"></a><span class="lineno"> 2781</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l02782"></a><span class="lineno"> 2782</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02783"></a><span class="lineno"> 2783</span>  buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a> = malloc(se->bufsize);</div><div class="line"><a name="l02784"></a><span class="lineno"> 2784</span>  <span class="keywordflow">if</span> (!buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>) {</div><div class="line"><a name="l02785"></a><span class="lineno"> 2785</span>  fprintf(stderr,</div><div class="line"><a name="l02786"></a><span class="lineno"> 2786</span>  <span class="stringliteral">"fuse: failed to allocate read buffer\n"</span>);</div><div class="line"><a name="l02787"></a><span class="lineno"> 2787</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l02788"></a><span class="lineno"> 2788</span>  }</div><div class="line"><a name="l02789"></a><span class="lineno"> 2789</span>  }</div><div class="line"><a name="l02790"></a><span class="lineno"> 2790</span> </div><div class="line"><a name="l02791"></a><span class="lineno"> 2791</span> restart:</div><div class="line"><a name="l02792"></a><span class="lineno"> 2792</span>  res = read(ch ? ch->fd : se->fd, buf-><a class="code" href="structfuse__buf.html#ac431db720526e68fd6c83eb0951ea1de">mem</a>, se->bufsize);</div><div class="line"><a name="l02793"></a><span class="lineno"> 2793</span>  err = errno;</div><div class="line"><a name="l02794"></a><span class="lineno"> 2794</span> </div><div class="line"><a name="l02795"></a><span class="lineno"> 2795</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(se))</div><div class="line"><a name="l02796"></a><span class="lineno"> 2796</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02797"></a><span class="lineno"> 2797</span>  <span class="keywordflow">if</span> (res == -1) {</div><div class="line"><a name="l02798"></a><span class="lineno"> 2798</span>  <span class="comment">/* ENOENT means the operation was interrupted, it's safe</span></div><div class="line"><a name="l02799"></a><span class="lineno"> 2799</span> <span class="comment"> to restart */</span></div><div class="line"><a name="l02800"></a><span class="lineno"> 2800</span>  <span class="keywordflow">if</span> (err == ENOENT)</div><div class="line"><a name="l02801"></a><span class="lineno"> 2801</span>  <span class="keywordflow">goto</span> restart;</div><div class="line"><a name="l02802"></a><span class="lineno"> 2802</span> </div><div class="line"><a name="l02803"></a><span class="lineno"> 2803</span>  <span class="keywordflow">if</span> (err == ENODEV) {</div><div class="line"><a name="l02804"></a><span class="lineno"> 2804</span>  <span class="comment">/* Filesystem was unmounted, or connection was aborted</span></div><div class="line"><a name="l02805"></a><span class="lineno"> 2805</span> <span class="comment"> via /sys/fs/fuse/connections */</span></div><div class="line"><a name="l02806"></a><span class="lineno"> 2806</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(se);</div><div class="line"><a name="l02807"></a><span class="lineno"> 2807</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02808"></a><span class="lineno"> 2808</span>  }</div><div class="line"><a name="l02809"></a><span class="lineno"> 2809</span>  <span class="comment">/* Errors occurring during normal operation: EINTR (read</span></div><div class="line"><a name="l02810"></a><span class="lineno"> 2810</span> <span class="comment"> interrupted), EAGAIN (nonblocking I/O), ENODEV (filesystem</span></div><div class="line"><a name="l02811"></a><span class="lineno"> 2811</span> <span class="comment"> umounted) */</span></div><div class="line"><a name="l02812"></a><span class="lineno"> 2812</span>  <span class="keywordflow">if</span> (err != EINTR && err != EAGAIN)</div><div class="line"><a name="l02813"></a><span class="lineno"> 2813</span>  perror(<span class="stringliteral">"fuse: reading device"</span>);</div><div class="line"><a name="l02814"></a><span class="lineno"> 2814</span>  <span class="keywordflow">return</span> -err;</div><div class="line"><a name="l02815"></a><span class="lineno"> 2815</span>  }</div><div class="line"><a name="l02816"></a><span class="lineno"> 2816</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>) res < <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_in_header)) {</div><div class="line"><a name="l02817"></a><span class="lineno"> 2817</span>  fprintf(stderr, <span class="stringliteral">"short read on fuse device\n"</span>);</div><div class="line"><a name="l02818"></a><span class="lineno"> 2818</span>  <span class="keywordflow">return</span> -EIO;</div><div class="line"><a name="l02819"></a><span class="lineno"> 2819</span>  }</div><div class="line"><a name="l02820"></a><span class="lineno"> 2820</span> </div><div class="line"><a name="l02821"></a><span class="lineno"> 2821</span>  buf-><a class="code" href="structfuse__buf.html#afb58c1e18f434d1d4edb784d00e2e13d">size</a> = res;</div><div class="line"><a name="l02822"></a><span class="lineno"> 2822</span> </div><div class="line"><a name="l02823"></a><span class="lineno"> 2823</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l02824"></a><span class="lineno"> 2824</span> }</div><div class="line"><a name="l02825"></a><span class="lineno"> 2825</span> </div><div class="line"><a name="l02826"></a><span class="lineno"> 2826</span> <span class="keyword">struct </span>fuse_session *<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a9ee52f81d0c63d9bd46b11314ba596cf">fuse_session_new</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args,</div><div class="line"><a name="l02827"></a><span class="lineno"> 2827</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a> *op,</div><div class="line"><a name="l02828"></a><span class="lineno"> 2828</span>  <span class="keywordtype">size_t</span> op_size, <span class="keywordtype">void</span> *userdata)</div><div class="line"><a name="l02829"></a><span class="lineno"> 2829</span> {</div><div class="line"><a name="l02830"></a><span class="lineno"> 2830</span>  <span class="keywordtype">int</span> err;</div><div class="line"><a name="l02831"></a><span class="lineno"> 2831</span>  <span class="keyword">struct </span>fuse_session *se;</div><div class="line"><a name="l02832"></a><span class="lineno"> 2832</span>  <span class="keyword">struct </span>mount_opts *mo;</div><div class="line"><a name="l02833"></a><span class="lineno"> 2833</span> </div><div class="line"><a name="l02834"></a><span class="lineno"> 2834</span>  <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keyword">struct</span> <a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a>) < op_size) {</div><div class="line"><a name="l02835"></a><span class="lineno"> 2835</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: library too old, some operations may not work\n"</span>);</div><div class="line"><a name="l02836"></a><span class="lineno"> 2836</span>  op_size = <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structfuse__lowlevel__ops.html">fuse_lowlevel_ops</a>);</div><div class="line"><a name="l02837"></a><span class="lineno"> 2837</span>  }</div><div class="line"><a name="l02838"></a><span class="lineno"> 2838</span> </div><div class="line"><a name="l02839"></a><span class="lineno"> 2839</span>  <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> == 0) {</div><div class="line"><a name="l02840"></a><span class="lineno"> 2840</span>  fprintf(stderr, <span class="stringliteral">"fuse: empty argv passed to fuse_session_new().\n"</span>);</div><div class="line"><a name="l02841"></a><span class="lineno"> 2841</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l02842"></a><span class="lineno"> 2842</span>  }</div><div class="line"><a name="l02843"></a><span class="lineno"> 2843</span> </div><div class="line"><a name="l02844"></a><span class="lineno"> 2844</span>  se = (<span class="keyword">struct </span>fuse_session *) calloc(1, <span class="keyword">sizeof</span>(<span class="keyword">struct</span> fuse_session));</div><div class="line"><a name="l02845"></a><span class="lineno"> 2845</span>  <span class="keywordflow">if</span> (se == NULL) {</div><div class="line"><a name="l02846"></a><span class="lineno"> 2846</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to allocate fuse object\n"</span>);</div><div class="line"><a name="l02847"></a><span class="lineno"> 2847</span>  <span class="keywordflow">goto</span> out1;</div><div class="line"><a name="l02848"></a><span class="lineno"> 2848</span>  }</div><div class="line"><a name="l02849"></a><span class="lineno"> 2849</span>  se->fd = -1;</div><div class="line"><a name="l02850"></a><span class="lineno"> 2850</span>  se->conn.max_write = UINT_MAX;</div><div class="line"><a name="l02851"></a><span class="lineno"> 2851</span>  se->conn.max_readahead = UINT_MAX;</div><div class="line"><a name="l02852"></a><span class="lineno"> 2852</span> </div><div class="line"><a name="l02853"></a><span class="lineno"> 2853</span>  <span class="comment">/* Parse options */</span></div><div class="line"><a name="l02854"></a><span class="lineno"> 2854</span>  <span class="keywordflow">if</span>(<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e">fuse_opt_parse</a>(args, se, fuse_ll_opts, NULL) == -1)</div><div class="line"><a name="l02855"></a><span class="lineno"> 2855</span>  <span class="keywordflow">goto</span> out2;</div><div class="line"><a name="l02856"></a><span class="lineno"> 2856</span>  <span class="keywordflow">if</span>(se->deny_others) {</div><div class="line"><a name="l02857"></a><span class="lineno"> 2857</span>  <span class="comment">/* Allowing access only by root is done by instructing</span></div><div class="line"><a name="l02858"></a><span class="lineno"> 2858</span> <span class="comment"> * kernel to allow access by everyone, and then restricting</span></div><div class="line"><a name="l02859"></a><span class="lineno"> 2859</span> <span class="comment"> * access to root and mountpoint owner in libfuse.</span></div><div class="line"><a name="l02860"></a><span class="lineno"> 2860</span> <span class="comment"> */</span></div><div class="line"><a name="l02861"></a><span class="lineno"> 2861</span>  <span class="comment">// We may be adding the option a second time, but</span></div><div class="line"><a name="l02862"></a><span class="lineno"> 2862</span>  <span class="comment">// that doesn't hurt.</span></div><div class="line"><a name="l02863"></a><span class="lineno"> 2863</span>  <span class="keywordflow">if</span>(<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(args, <span class="stringliteral">"-oallow_other"</span>) == -1)</div><div class="line"><a name="l02864"></a><span class="lineno"> 2864</span>  <span class="keywordflow">goto</span> out2;</div><div class="line"><a name="l02865"></a><span class="lineno"> 2865</span>  }</div><div class="line"><a name="l02866"></a><span class="lineno"> 2866</span>  mo = parse_mount_opts(args);</div><div class="line"><a name="l02867"></a><span class="lineno"> 2867</span>  <span class="keywordflow">if</span> (mo == NULL)</div><div class="line"><a name="l02868"></a><span class="lineno"> 2868</span>  <span class="keywordflow">goto</span> out3;</div><div class="line"><a name="l02869"></a><span class="lineno"> 2869</span> </div><div class="line"><a name="l02870"></a><span class="lineno"> 2870</span>  <span class="keywordflow">if</span>(args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> == 1 &&</div><div class="line"><a name="l02871"></a><span class="lineno"> 2871</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[0][0] == <span class="charliteral">'-'</span>) {</div><div class="line"><a name="l02872"></a><span class="lineno"> 2872</span>  fprintf(stderr, <span class="stringliteral">"fuse: warning: argv[0] looks like an option, but "</span></div><div class="line"><a name="l02873"></a><span class="lineno"> 2873</span>  <span class="stringliteral">"will be ignored\n"</span>);</div><div class="line"><a name="l02874"></a><span class="lineno"> 2874</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> != 1) {</div><div class="line"><a name="l02875"></a><span class="lineno"> 2875</span>  <span class="keywordtype">int</span> i;</div><div class="line"><a name="l02876"></a><span class="lineno"> 2876</span>  fprintf(stderr, <span class="stringliteral">"fuse: unknown option(s): `"</span>);</div><div class="line"><a name="l02877"></a><span class="lineno"> 2877</span>  <span class="keywordflow">for</span>(i = 1; i < args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>-1; i++)</div><div class="line"><a name="l02878"></a><span class="lineno"> 2878</span>  fprintf(stderr, <span class="stringliteral">"%s "</span>, args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l02879"></a><span class="lineno"> 2879</span>  fprintf(stderr, <span class="stringliteral">"%s'\n"</span>, args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l02880"></a><span class="lineno"> 2880</span>  <span class="keywordflow">goto</span> out4;</div><div class="line"><a name="l02881"></a><span class="lineno"> 2881</span>  }</div><div class="line"><a name="l02882"></a><span class="lineno"> 2882</span> </div><div class="line"><a name="l02883"></a><span class="lineno"> 2883</span>  <span class="keywordflow">if</span> (se->debug)</div><div class="line"><a name="l02884"></a><span class="lineno"> 2884</span>  fprintf(stderr, <span class="stringliteral">"FUSE library version: %s\n"</span>, PACKAGE_VERSION);</div><div class="line"><a name="l02885"></a><span class="lineno"> 2885</span> </div><div class="line"><a name="l02886"></a><span class="lineno"> 2886</span>  se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() +</div><div class="line"><a name="l02887"></a><span class="lineno"> 2887</span>  FUSE_BUFFER_HEADER_SIZE;</div><div class="line"><a name="l02888"></a><span class="lineno"> 2888</span> </div><div class="line"><a name="l02889"></a><span class="lineno"> 2889</span>  list_init_req(&se->list);</div><div class="line"><a name="l02890"></a><span class="lineno"> 2890</span>  list_init_req(&se->interrupts);</div><div class="line"><a name="l02891"></a><span class="lineno"> 2891</span>  list_init_nreq(&se->notify_list);</div><div class="line"><a name="l02892"></a><span class="lineno"> 2892</span>  se->notify_ctr = 1;</div><div class="line"><a name="l02893"></a><span class="lineno"> 2893</span>  fuse_mutex_init(&se->lock);</div><div class="line"><a name="l02894"></a><span class="lineno"> 2894</span> </div><div class="line"><a name="l02895"></a><span class="lineno"> 2895</span>  err = pthread_key_create(&se->pipe_key, fuse_ll_pipe_destructor);</div><div class="line"><a name="l02896"></a><span class="lineno"> 2896</span>  <span class="keywordflow">if</span> (err) {</div><div class="line"><a name="l02897"></a><span class="lineno"> 2897</span>  fprintf(stderr, <span class="stringliteral">"fuse: failed to create thread specific key: %s\n"</span>,</div><div class="line"><a name="l02898"></a><span class="lineno"> 2898</span>  strerror(err));</div><div class="line"><a name="l02899"></a><span class="lineno"> 2899</span>  <span class="keywordflow">goto</span> out5;</div><div class="line"><a name="l02900"></a><span class="lineno"> 2900</span>  }</div><div class="line"><a name="l02901"></a><span class="lineno"> 2901</span> </div><div class="line"><a name="l02902"></a><span class="lineno"> 2902</span>  memcpy(&se->op, op, op_size);</div><div class="line"><a name="l02903"></a><span class="lineno"> 2903</span>  se->owner = getuid();</div><div class="line"><a name="l02904"></a><span class="lineno"> 2904</span>  se->userdata = userdata;</div><div class="line"><a name="l02905"></a><span class="lineno"> 2905</span> </div><div class="line"><a name="l02906"></a><span class="lineno"> 2906</span>  se->mo = mo;</div><div class="line"><a name="l02907"></a><span class="lineno"> 2907</span>  <span class="keywordflow">return</span> se;</div><div class="line"><a name="l02908"></a><span class="lineno"> 2908</span> </div><div class="line"><a name="l02909"></a><span class="lineno"> 2909</span> out5:</div><div class="line"><a name="l02910"></a><span class="lineno"> 2910</span>  pthread_mutex_destroy(&se->lock);</div><div class="line"><a name="l02911"></a><span class="lineno"> 2911</span> out4:</div><div class="line"><a name="l02912"></a><span class="lineno"> 2912</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(args);</div><div class="line"><a name="l02913"></a><span class="lineno"> 2913</span> out3:</div><div class="line"><a name="l02914"></a><span class="lineno"> 2914</span>  free(mo);</div><div class="line"><a name="l02915"></a><span class="lineno"> 2915</span> out2:</div><div class="line"><a name="l02916"></a><span class="lineno"> 2916</span>  free(se);</div><div class="line"><a name="l02917"></a><span class="lineno"> 2917</span> out1:</div><div class="line"><a name="l02918"></a><span class="lineno"> 2918</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l02919"></a><span class="lineno"> 2919</span> }</div><div class="line"><a name="l02920"></a><span class="lineno"> 2920</span> </div><div class="line"><a name="l02921"></a><span class="lineno"> 2921</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#aa6d77679a110582684e9ca2da623bbc2">fuse_session_mount</a>(<span class="keyword">struct</span> fuse_session *se, <span class="keyword">const</span> <span class="keywordtype">char</span> *mountpoint)</div><div class="line"><a name="l02922"></a><span class="lineno"> 2922</span> {</div><div class="line"><a name="l02923"></a><span class="lineno"> 2923</span>  <span class="keywordtype">int</span> fd;</div><div class="line"><a name="l02924"></a><span class="lineno"> 2924</span> </div><div class="line"><a name="l02925"></a><span class="lineno"> 2925</span>  <span class="comment">/*</span></div><div class="line"><a name="l02926"></a><span class="lineno"> 2926</span> <span class="comment"> * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos</span></div><div class="line"><a name="l02927"></a><span class="lineno"> 2927</span> <span class="comment"> * would ensue.</span></div><div class="line"><a name="l02928"></a><span class="lineno"> 2928</span> <span class="comment"> */</span></div><div class="line"><a name="l02929"></a><span class="lineno"> 2929</span>  <span class="keywordflow">do</span> {</div><div class="line"><a name="l02930"></a><span class="lineno"> 2930</span>  fd = open(<span class="stringliteral">"/dev/null"</span>, O_RDWR);</div><div class="line"><a name="l02931"></a><span class="lineno"> 2931</span>  <span class="keywordflow">if</span> (fd > 2)</div><div class="line"><a name="l02932"></a><span class="lineno"> 2932</span>  close(fd);</div><div class="line"><a name="l02933"></a><span class="lineno"> 2933</span>  } <span class="keywordflow">while</span> (fd >= 0 && fd <= 2);</div><div class="line"><a name="l02934"></a><span class="lineno"> 2934</span> </div><div class="line"><a name="l02935"></a><span class="lineno"> 2935</span>  <span class="comment">/*</span></div><div class="line"><a name="l02936"></a><span class="lineno"> 2936</span> <span class="comment"> * To allow FUSE daemons to run without privileges, the caller may open</span></div><div class="line"><a name="l02937"></a><span class="lineno"> 2937</span> <span class="comment"> * /dev/fuse before launching the file system and pass on the file</span></div><div class="line"><a name="l02938"></a><span class="lineno"> 2938</span> <span class="comment"> * descriptor by specifying /dev/fd/N as the mount point. Note that the</span></div><div class="line"><a name="l02939"></a><span class="lineno"> 2939</span> <span class="comment"> * parent process takes care of performing the mount in this case.</span></div><div class="line"><a name="l02940"></a><span class="lineno"> 2940</span> <span class="comment"> */</span></div><div class="line"><a name="l02941"></a><span class="lineno"> 2941</span>  fd = fuse_mnt_parse_fuse_fd(mountpoint);</div><div class="line"><a name="l02942"></a><span class="lineno"> 2942</span>  <span class="keywordflow">if</span> (fd != -1) {</div><div class="line"><a name="l02943"></a><span class="lineno"> 2943</span>  <span class="keywordflow">if</span> (fcntl(fd, F_GETFD) == -1) {</div><div class="line"><a name="l02944"></a><span class="lineno"> 2944</span>  fprintf(stderr,</div><div class="line"><a name="l02945"></a><span class="lineno"> 2945</span>  <span class="stringliteral">"fuse: Invalid file descriptor /dev/fd/%u\n"</span>,</div><div class="line"><a name="l02946"></a><span class="lineno"> 2946</span>  fd);</div><div class="line"><a name="l02947"></a><span class="lineno"> 2947</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02948"></a><span class="lineno"> 2948</span>  }</div><div class="line"><a name="l02949"></a><span class="lineno"> 2949</span>  se->fd = fd;</div><div class="line"><a name="l02950"></a><span class="lineno"> 2950</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02951"></a><span class="lineno"> 2951</span>  }</div><div class="line"><a name="l02952"></a><span class="lineno"> 2952</span> </div><div class="line"><a name="l02953"></a><span class="lineno"> 2953</span>  <span class="comment">/* Open channel */</span></div><div class="line"><a name="l02954"></a><span class="lineno"> 2954</span>  fd = fuse_kern_mount(mountpoint, se->mo);</div><div class="line"><a name="l02955"></a><span class="lineno"> 2955</span>  <span class="keywordflow">if</span> (fd == -1)</div><div class="line"><a name="l02956"></a><span class="lineno"> 2956</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02957"></a><span class="lineno"> 2957</span>  se->fd = fd;</div><div class="line"><a name="l02958"></a><span class="lineno"> 2958</span> </div><div class="line"><a name="l02959"></a><span class="lineno"> 2959</span>  <span class="comment">/* Save mountpoint */</span></div><div class="line"><a name="l02960"></a><span class="lineno"> 2960</span>  se->mountpoint = strdup(mountpoint);</div><div class="line"><a name="l02961"></a><span class="lineno"> 2961</span>  <span class="keywordflow">if</span> (se->mountpoint == NULL)</div><div class="line"><a name="l02962"></a><span class="lineno"> 2962</span>  <span class="keywordflow">goto</span> error_out;</div><div class="line"><a name="l02963"></a><span class="lineno"> 2963</span> </div><div class="line"><a name="l02964"></a><span class="lineno"> 2964</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l02965"></a><span class="lineno"> 2965</span> </div><div class="line"><a name="l02966"></a><span class="lineno"> 2966</span> error_out:</div><div class="line"><a name="l02967"></a><span class="lineno"> 2967</span>  fuse_kern_unmount(mountpoint, fd);</div><div class="line"><a name="l02968"></a><span class="lineno"> 2968</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l02969"></a><span class="lineno"> 2969</span> }</div><div class="line"><a name="l02970"></a><span class="lineno"> 2970</span> </div><div class="line"><a name="l02971"></a><span class="lineno"> 2971</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a4bf19badb53d92d31d6b2fb131546a2d">fuse_session_fd</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02972"></a><span class="lineno"> 2972</span> {</div><div class="line"><a name="l02973"></a><span class="lineno"> 2973</span>  <span class="keywordflow">return</span> se->fd;</div><div class="line"><a name="l02974"></a><span class="lineno"> 2974</span> }</div><div class="line"><a name="l02975"></a><span class="lineno"> 2975</span> </div><div class="line"><a name="l02976"></a><span class="lineno"> 2976</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a6c10d942751ddb214863a8b5e53de5e8">fuse_session_unmount</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l02977"></a><span class="lineno"> 2977</span> {</div><div class="line"><a name="l02978"></a><span class="lineno"> 2978</span>  <span class="keywordflow">if</span> (se->mountpoint != NULL) {</div><div class="line"><a name="l02979"></a><span class="lineno"> 2979</span>  fuse_kern_unmount(se->mountpoint, se->fd);</div><div class="line"><a name="l02980"></a><span class="lineno"> 2980</span>  free(se->mountpoint);</div><div class="line"><a name="l02981"></a><span class="lineno"> 2981</span>  se->mountpoint = NULL;</div><div class="line"><a name="l02982"></a><span class="lineno"> 2982</span>  }</div><div class="line"><a name="l02983"></a><span class="lineno"> 2983</span> }</div><div class="line"><a name="l02984"></a><span class="lineno"> 2984</span> </div><div class="line"><a name="l02985"></a><span class="lineno"> 2985</span> <span class="preprocessor">#ifdef linux</span></div><div class="line"><a name="l02986"></a><span class="lineno"> 2986</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a57f4dabcf044aafcdba6c4682b3a1869">fuse_req_getgroups</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> size, gid_t list[])</div><div class="line"><a name="l02987"></a><span class="lineno"> 2987</span> {</div><div class="line"><a name="l02988"></a><span class="lineno"> 2988</span>  <span class="keywordtype">char</span> *buf;</div><div class="line"><a name="l02989"></a><span class="lineno"> 2989</span>  <span class="keywordtype">size_t</span> bufsize = 1024;</div><div class="line"><a name="l02990"></a><span class="lineno"> 2990</span>  <span class="keywordtype">char</span> path[128];</div><div class="line"><a name="l02991"></a><span class="lineno"> 2991</span>  <span class="keywordtype">int</span> ret;</div><div class="line"><a name="l02992"></a><span class="lineno"> 2992</span>  <span class="keywordtype">int</span> fd;</div><div class="line"><a name="l02993"></a><span class="lineno"> 2993</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> pid = req->ctx.pid;</div><div class="line"><a name="l02994"></a><span class="lineno"> 2994</span>  <span class="keywordtype">char</span> *s;</div><div class="line"><a name="l02995"></a><span class="lineno"> 2995</span> </div><div class="line"><a name="l02996"></a><span class="lineno"> 2996</span>  sprintf(path, <span class="stringliteral">"/proc/%lu/task/%lu/status"</span>, pid, pid);</div><div class="line"><a name="l02997"></a><span class="lineno"> 2997</span> </div><div class="line"><a name="l02998"></a><span class="lineno"> 2998</span> retry:</div><div class="line"><a name="l02999"></a><span class="lineno"> 2999</span>  buf = malloc(bufsize);</div><div class="line"><a name="l03000"></a><span class="lineno"> 3000</span>  <span class="keywordflow">if</span> (buf == NULL)</div><div class="line"><a name="l03001"></a><span class="lineno"> 3001</span>  <span class="keywordflow">return</span> -ENOMEM;</div><div class="line"><a name="l03002"></a><span class="lineno"> 3002</span> </div><div class="line"><a name="l03003"></a><span class="lineno"> 3003</span>  ret = -EIO;</div><div class="line"><a name="l03004"></a><span class="lineno"> 3004</span>  fd = open(path, O_RDONLY);</div><div class="line"><a name="l03005"></a><span class="lineno"> 3005</span>  <span class="keywordflow">if</span> (fd == -1)</div><div class="line"><a name="l03006"></a><span class="lineno"> 3006</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03007"></a><span class="lineno"> 3007</span> </div><div class="line"><a name="l03008"></a><span class="lineno"> 3008</span>  ret = read(fd, buf, bufsize);</div><div class="line"><a name="l03009"></a><span class="lineno"> 3009</span>  close(fd);</div><div class="line"><a name="l03010"></a><span class="lineno"> 3010</span>  <span class="keywordflow">if</span> (ret < 0) {</div><div class="line"><a name="l03011"></a><span class="lineno"> 3011</span>  ret = -EIO;</div><div class="line"><a name="l03012"></a><span class="lineno"> 3012</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03013"></a><span class="lineno"> 3013</span>  }</div><div class="line"><a name="l03014"></a><span class="lineno"> 3014</span> </div><div class="line"><a name="l03015"></a><span class="lineno"> 3015</span>  <span class="keywordflow">if</span> ((<span class="keywordtype">size_t</span>)ret == bufsize) {</div><div class="line"><a name="l03016"></a><span class="lineno"> 3016</span>  free(buf);</div><div class="line"><a name="l03017"></a><span class="lineno"> 3017</span>  bufsize *= 4;</div><div class="line"><a name="l03018"></a><span class="lineno"> 3018</span>  <span class="keywordflow">goto</span> retry;</div><div class="line"><a name="l03019"></a><span class="lineno"> 3019</span>  }</div><div class="line"><a name="l03020"></a><span class="lineno"> 3020</span> </div><div class="line"><a name="l03021"></a><span class="lineno"> 3021</span>  ret = -EIO;</div><div class="line"><a name="l03022"></a><span class="lineno"> 3022</span>  s = strstr(buf, <span class="stringliteral">"\nGroups:"</span>);</div><div class="line"><a name="l03023"></a><span class="lineno"> 3023</span>  <span class="keywordflow">if</span> (s == NULL)</div><div class="line"><a name="l03024"></a><span class="lineno"> 3024</span>  <span class="keywordflow">goto</span> out_free;</div><div class="line"><a name="l03025"></a><span class="lineno"> 3025</span> </div><div class="line"><a name="l03026"></a><span class="lineno"> 3026</span>  s += 8;</div><div class="line"><a name="l03027"></a><span class="lineno"> 3027</span>  ret = 0;</div><div class="line"><a name="l03028"></a><span class="lineno"> 3028</span>  <span class="keywordflow">while</span> (1) {</div><div class="line"><a name="l03029"></a><span class="lineno"> 3029</span>  <span class="keywordtype">char</span> *end;</div><div class="line"><a name="l03030"></a><span class="lineno"> 3030</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> val = strtoul(s, &end, 0);</div><div class="line"><a name="l03031"></a><span class="lineno"> 3031</span>  <span class="keywordflow">if</span> (end == s)</div><div class="line"><a name="l03032"></a><span class="lineno"> 3032</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l03033"></a><span class="lineno"> 3033</span> </div><div class="line"><a name="l03034"></a><span class="lineno"> 3034</span>  s = end;</div><div class="line"><a name="l03035"></a><span class="lineno"> 3035</span>  <span class="keywordflow">if</span> (ret < size)</div><div class="line"><a name="l03036"></a><span class="lineno"> 3036</span>  list[ret] = val;</div><div class="line"><a name="l03037"></a><span class="lineno"> 3037</span>  ret++;</div><div class="line"><a name="l03038"></a><span class="lineno"> 3038</span>  }</div><div class="line"><a name="l03039"></a><span class="lineno"> 3039</span> </div><div class="line"><a name="l03040"></a><span class="lineno"> 3040</span> out_free:</div><div class="line"><a name="l03041"></a><span class="lineno"> 3041</span>  free(buf);</div><div class="line"><a name="l03042"></a><span class="lineno"> 3042</span>  <span class="keywordflow">return</span> ret;</div><div class="line"><a name="l03043"></a><span class="lineno"> 3043</span> }</div><div class="line"><a name="l03044"></a><span class="lineno"> 3044</span> <span class="preprocessor">#else </span><span class="comment">/* linux */</span><span class="preprocessor"></span></div><div class="line"><a name="l03045"></a><span class="lineno"> 3045</span> <span class="comment">/*</span></div><div class="line"><a name="l03046"></a><span class="lineno"> 3046</span> <span class="comment"> * This is currently not implemented on other than Linux...</span></div><div class="line"><a name="l03047"></a><span class="lineno"> 3047</span> <span class="comment"> */</span></div><div class="line"><a name="l03048"></a><span class="lineno"> 3048</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a57f4dabcf044aafcdba6c4682b3a1869">fuse_req_getgroups</a>(<a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a33e2aa4a8905a05397292ae047cd2257">fuse_req_t</a> req, <span class="keywordtype">int</span> size, gid_t list[])</div><div class="line"><a name="l03049"></a><span class="lineno"> 3049</span> {</div><div class="line"><a name="l03050"></a><span class="lineno"> 3050</span>  (void) req; (void) size; (void) list;</div><div class="line"><a name="l03051"></a><span class="lineno"> 3051</span>  <span class="keywordflow">return</span> -ENOSYS;</div><div class="line"><a name="l03052"></a><span class="lineno"> 3052</span> }</div><div class="line"><a name="l03053"></a><span class="lineno"> 3053</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l03054"></a><span class="lineno"> 3054</span> </div><div class="line"><a name="l03055"></a><span class="lineno"> 3055</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a198429f3fbc23ef29ef9971271827690">fuse_session_exit</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03056"></a><span class="lineno"> 3056</span> {</div><div class="line"><a name="l03057"></a><span class="lineno"> 3057</span>  se->exited = 1;</div><div class="line"><a name="l03058"></a><span class="lineno"> 3058</span> }</div><div class="line"><a name="l03059"></a><span class="lineno"> 3059</span> </div><div class="line"><a name="l03060"></a><span class="lineno"> 3060</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ab3d015de77ae0edeb3157321e7a5c434">fuse_session_reset</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03061"></a><span class="lineno"> 3061</span> {</div><div class="line"><a name="l03062"></a><span class="lineno"> 3062</span>  se->exited = 0;</div><div class="line"><a name="l03063"></a><span class="lineno"> 3063</span>  se->error = 0;</div><div class="line"><a name="l03064"></a><span class="lineno"> 3064</span> }</div><div class="line"><a name="l03065"></a><span class="lineno"> 3065</span> </div><div class="line"><a name="l03066"></a><span class="lineno"> 3066</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#a41b12193fa1520ff658d65679f4e513c">fuse_session_exited</a>(<span class="keyword">struct</span> fuse_session *se)</div><div class="line"><a name="l03067"></a><span class="lineno"> 3067</span> {</div><div class="line"><a name="l03068"></a><span class="lineno"> 3068</span>  <span class="keywordflow">return</span> se->exited;</div><div class="line"><a name="l03069"></a><span class="lineno"> 3069</span> }</div><div class="ttc" id="fuse-3_86_80_2include_2fuse__lowlevel_8h_html_ad1d1963190eb93ae5667d32d2b387ca1"><div class="ttname"><a href="fuse-3_86_80_2include_2fuse__lowlevel_8h.html#ad1d1963190eb93ae5667d32d2b387ca1">fuse_req_ctx</a></div><div class="ttdeci">const struct fuse_ctx * fuse_req_ctx(fuse_req_t req)</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2lib_2fuse__lowlevel_8c_source.html#l02365">fuse_lowlevel.c:2365</a></div></div> fuse3-3.10.0/doc/html/fuse-3_86_82_2lib_2fuse__lowlevel_8c_source.html-49-<div class="ttc" id="structfuse__bufvec_html_a0fbb583168d52562f0f848562ecf63bc"><div class="ttname"><a href="structfuse__bufvec.html#a0fbb583168d52562f0f848562ecf63bc">fuse_bufvec::off</a></div><div class="ttdeci">size_t off</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__common_8h_source.html#l00710">fuse_common.h:710</a></div></div> ############################################## fuse3-3.10.0/doc/html/fuse-3_86_81_2lib_2fuse__opt_8c_source.html-47-<div class="contents"> fuse3-3.10.0/doc/html/fuse-3_86_81_2lib_2fuse__opt_8c_source.html:48:<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> FUSE: Filesystem in Userspace</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu></span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> Implementation of option parsing routines (dealing with `struct</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> fuse_args`).</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> This program can be distributed under the terms of the GNU LGPLv2.</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> See the file COPYING.LIB</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">*/</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include "config.h"</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include "fuse_opt.h"</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "fuse_misc.h"</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <stdio.h></span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <stdlib.h></span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <string.h></span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include <assert.h></span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">struct </span>fuse_opt_context {</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordtype">void</span> *data;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__opt.html">fuse_opt</a> *opt;</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a3d2ab809528d409b0ee91cee400c07c2">fuse_opt_proc_t</a> proc;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordtype">int</span> argctr;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordtype">int</span> argc;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordtype">char</span> **argv;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">struct </span><a class="code" href="structfuse__args.html">fuse_args</a> outargs;</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordtype">char</span> *opts;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordtype">int</span> nonopt;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> };</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="keywordtype">void</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args)</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">if</span> (args) {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">if</span> (args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> && args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a>) {</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordtype">int</span> i;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">for</span> (i = 0; i < args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>; i++)</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  free(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[i]);</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  free(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>);</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  }</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> = 0;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> = NULL;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a> = 0;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  }</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> }</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="keyword">static</span> <span class="keywordtype">int</span> alloc_failed(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> {</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  fprintf(stderr, <span class="stringliteral">"fuse: memory allocation failed\n"</span>);</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> }</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> {</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordtype">char</span> **newargv;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">char</span> *newarg;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  assert(!args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> || args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a>);</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  newarg = strdup(arg);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">if</span> (!newarg)</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  newargv = realloc(args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>, (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> + 2) * <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *));</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordflow">if</span> (!newargv) {</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  free(newarg);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  }</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> = newargv;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  args-><a class="code" href="structfuse__args.html#a3fdc7eb5448d89a4ecbabba88cbafe5f">allocated</a> = 1;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>++] = newarg;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>] = NULL;</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> }</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">static</span> <span class="keywordtype">int</span> fuse_opt_insert_arg_common(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">int</span> pos,</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  assert(pos <= args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(args, arg) == -1)</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">if</span> (pos != args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - 1) {</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordtype">char</span> *newarg = args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - 1];</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  memmove(&args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos + 1], &args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos],</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">sizeof</span>(<span class="keywordtype">char</span> *) * (args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a> - pos - 1));</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>[pos] = newarg;</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  }</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> }</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">int</span> pos, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> {</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">return</span> fuse_opt_insert_arg_common(args, pos, arg);</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> }</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="keyword">static</span> <span class="keywordtype">int</span> next_arg(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> {</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (ctx->argctr + 1 >= ctx->argc) {</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  fprintf(stderr, <span class="stringliteral">"fuse: missing argument after `%s'\n"</span>, opt);</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  }</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  ctx->argctr++;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> }</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_arg(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> {</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">return</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a21602e6a0fff64fc9c7b642d12382094">fuse_opt_add_arg</a>(&ctx->outargs, arg);</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> }</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_opt_common(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt, <span class="keywordtype">int</span> esc)</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordtype">unsigned</span> oldlen = *opts ? strlen(*opts) : 0;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordtype">char</span> *d = realloc(*opts, oldlen + 1 + strlen(opt) * 2 + 1);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">if</span> (!d)</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  *opts = d;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">if</span> (oldlen) {</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  d += oldlen;</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  *d++ = <span class="charliteral">','</span>;</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  }</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> </div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">for</span> (; *opt; opt++) {</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">if</span> (esc && (*opt == <span class="charliteral">','</span> || *opt == <span class="charliteral">'\\'</span>))</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  *d++ = <span class="charliteral">'\\'</span>;</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  *d++ = *opt;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  }</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  *d = <span class="charliteral">'\0'</span>;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> }</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#aaae525d5e959c5394bc323be0c1d02b0">fuse_opt_add_opt</a>(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> {</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="keywordflow">return</span> add_opt_common(opts, opt, 0);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> }</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a51a00d087d08bef250a53b9e4979b1cd">fuse_opt_add_opt_escaped</a>(<span class="keywordtype">char</span> **opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> {</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">return</span> add_opt_common(opts, opt, 1);</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> }</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> </div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> <span class="keyword">static</span> <span class="keywordtype">int</span> add_opt(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span> {</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keywordflow">return</span> add_opt_common(&ctx->opts, opt, 1);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> }</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="keyword">static</span> <span class="keywordtype">int</span> call_proc(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> key,</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> {</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">if</span> (key == <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a6e97b6ce492f1baaaf0a4eb4970c9a2f">FUSE_OPT_KEY_DISCARD</a>)</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordflow">if</span> (key != <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a8533ff341f910c1bd05f10c8fcc35a04">FUSE_OPT_KEY_KEEP</a> && ctx->proc) {</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordtype">int</span> res = ctx->proc(ctx->data, arg, key, &ctx->outargs);</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">if</span> (res == -1 || !res)</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  }</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="keywordflow">if</span> (iso)</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordflow">return</span> add_opt(ctx, arg);</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keywordflow">return</span> add_arg(ctx, arg);</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> }</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> </div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="keyword">static</span> <span class="keywordtype">int</span> match_template(<span class="keyword">const</span> <span class="keywordtype">char</span> *t, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">unsigned</span> *sepp)</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span> {</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordtype">int</span> arglen = strlen(arg);</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *sep = strchr(t, <span class="charliteral">'='</span>);</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  sep = sep ? sep : strchr(t, <span class="charliteral">' '</span>);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="keywordflow">if</span> (sep && (!sep[1] || sep[1] == <span class="charliteral">'%'</span>)) {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="keywordtype">int</span> tlen = sep - t;</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="keywordflow">if</span> (sep[0] == <span class="charliteral">'='</span>)</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  tlen ++;</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">if</span> (arglen >= tlen && strncmp(arg, t, tlen) == 0) {</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  *sepp = sep - t;</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  }</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  }</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="keywordflow">if</span> (strcmp(t, arg) == 0) {</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  *sepp = 0;</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  }</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> }</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> </div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> <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> *find_opt(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt,</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">unsigned</span> *sepp)</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> {</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keywordflow">for</span> (; opt && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>; opt++)</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (match_template(opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>, arg, sepp))</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordflow">return</span> opt;</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> NULL;</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#af16c684bd2b10b7ac0ae299afa1e0e06">fuse_opt_match</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opts, <span class="keyword">const</span> <span class="keywordtype">char</span> *opt)</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> {</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="keywordtype">unsigned</span> dummy;</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <span class="keywordflow">return</span> find_opt(opts, opt, &dummy) ? 1 : 0;</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> }</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> </div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt_param(<span class="keywordtype">void</span> *var, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, <span class="keyword">const</span> <span class="keywordtype">char</span> *param,</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> {</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  assert(format[0] == <span class="charliteral">'%'</span>);</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="keywordflow">if</span> (format[1] == <span class="charliteral">'s'</span>) {</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keywordtype">char</span> **s = var;</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keywordtype">char</span> *copy = strdup(param);</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <span class="keywordflow">if</span> (!copy)</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span> </div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  free(*s);</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  *s = copy;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <span class="keywordflow">if</span> (sscanf(param, format, var) != 1) {</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  fprintf(stderr, <span class="stringliteral">"fuse: invalid parameter in option `%s'\n"</span>, arg);</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  }</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  }</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> }</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span> </div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt(<span class="keyword">struct</span> fuse_opt_context *ctx,</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt, <span class="keywordtype">unsigned</span> sep,</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span> {</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <span class="keywordflow">if</span> (opt-><a class="code" href="structfuse__opt.html#a333dcd849a3bd54df06084a69b5a8d39">offset</a> == -1U) {</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordflow">if</span> (call_proc(ctx, arg, opt-><a class="code" href="structfuse__opt.html#aeb76339e1ce6948ad94bd2d4d5d01e20">value</a>, iso) == -1)</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordtype">void</span> *var = (<span class="keywordtype">char</span> *)ctx->data + opt-><a class="code" href="structfuse__opt.html#a333dcd849a3bd54df06084a69b5a8d39">offset</a>;</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  if (sep && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep + 1]) {</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *param = arg + sep;</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">if</span> (opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep] == <span class="charliteral">'='</span>)</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  param ++;</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <span class="keywordflow">if</span> (process_opt_param(var, opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a> + sep + 1,</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  param, arg) == -1)</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  *(<span class="keywordtype">int</span> *)var = opt-><a class="code" href="structfuse__opt.html#aeb76339e1ce6948ad94bd2d4d5d01e20">value</a>;</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  }</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> }</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span> </div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_opt_sep_arg(<span class="keyword">struct</span> fuse_opt_context *ctx,</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> *opt, <span class="keywordtype">unsigned</span> sep,</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span> {</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  <span class="keywordtype">char</span> *newarg;</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  <span class="keywordtype">char</span> *param;</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span> </div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordflow">if</span> (next_arg(ctx, arg) == -1)</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span> </div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  param = ctx->argv[ctx->argctr];</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  newarg = malloc(sep + strlen(param) + 1);</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <span class="keywordflow">if</span> (!newarg)</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keywordflow">return</span> alloc_failed();</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  memcpy(newarg, arg, sep);</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  strcpy(newarg + sep, param);</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  res = process_opt(ctx, opt, sep, newarg, iso);</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  free(newarg);</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> </div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span> }</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span> </div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_gopt(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg, <span class="keywordtype">int</span> iso)</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span> {</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <span class="keywordtype">unsigned</span> sep;</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="structfuse__opt.html">fuse_opt</a> *opt = find_opt(ctx->opt, arg, &sep);</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  <span class="keywordflow">if</span> (opt) {</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <span class="keywordflow">for</span> (; opt; opt = find_opt(opt + 1, arg, &sep)) {</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="keywordflow">if</span> (sep && opt-><a class="code" href="structfuse__opt.html#a49330e9bdac51625d00c0e7d49ba57ef">templ</a>[sep] == <span class="charliteral">' '</span> && !arg[sep])</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  res = process_opt_sep_arg(ctx, opt, sep, arg,</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  iso);</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  res = process_opt(ctx, opt, sep, arg, iso);</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  }</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">return</span> call_proc(ctx, arg, <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a48cb1aea482de904a848651360117748">FUSE_OPT_KEY_OPT</a>, iso);</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span> }</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> </div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_real_option_group(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keywordtype">char</span> *opts)</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> {</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <span class="keywordtype">char</span> *s = opts;</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <span class="keywordtype">char</span> *d = s;</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <span class="keywordtype">int</span> end = 0;</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span> </div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <span class="keywordflow">while</span> (!end) {</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <span class="keywordflow">if</span> (*s == <span class="charliteral">'\0'</span>)</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  end = 1;</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  <span class="keywordflow">if</span> (*s == <span class="charliteral">','</span> || end) {</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> </div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  *d = <span class="charliteral">'\0'</span>;</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  res = process_gopt(ctx, opts, 1);</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">if</span> (res == -1)</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  d = opts;</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  <span class="keywordflow">if</span> (s[0] == <span class="charliteral">'\\'</span> && s[1] != <span class="charliteral">'\0'</span>) {</div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  s++;</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  <span class="keywordflow">if</span> (s[0] >= <span class="charliteral">'0'</span> && s[0] <= <span class="charliteral">'3'</span> &&</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  s[1] >= <span class="charliteral">'0'</span> && s[1] <= <span class="charliteral">'7'</span> &&</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  s[2] >= <span class="charliteral">'0'</span> && s[2] <= <span class="charliteral">'7'</span>) {</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  *d++ = (s[0] - <span class="charliteral">'0'</span>) * 0100 +</div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  (s[1] - <span class="charliteral">'0'</span>) * 0010 +</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  (s[2] - <span class="charliteral">'0'</span>);</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  s += 2;</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  *d++ = *s;</div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  }</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  *d++ = *s;</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  }</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  }</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  s++;</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  }</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span> </div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> }</div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span> </div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_option_group(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *opts)</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span> {</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keywordtype">char</span> *copy = strdup(opts);</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span> </div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keywordflow">if</span> (!copy) {</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  fprintf(stderr, <span class="stringliteral">"fuse: memory allocation failed\n"</span>);</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  }</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  res = process_real_option_group(ctx, copy);</div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  free(copy);</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> }</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span> </div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span> <span class="keyword">static</span> <span class="keywordtype">int</span> process_one(<span class="keyword">struct</span> fuse_opt_context *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *arg)</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span> {</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  <span class="keywordflow">if</span> (ctx->nonopt || arg[0] != <span class="charliteral">'-'</span>)</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <span class="keywordflow">return</span> call_proc(ctx, arg, <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a632b025441794a4e6fe59b7ab53bbfc4">FUSE_OPT_KEY_NONOPT</a>, 0);</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg[1] == <span class="charliteral">'o'</span>) {</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  <span class="keywordflow">if</span> (arg[2])</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  <span class="keywordflow">return</span> process_option_group(ctx, arg + 2);</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="keywordflow">else</span> {</div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  <span class="keywordflow">if</span> (next_arg(ctx, arg) == -1)</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> </div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <span class="keywordflow">return</span> process_option_group(ctx,</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  ctx->argv[ctx->argctr]);</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  }</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (arg[1] == <span class="charliteral">'-'</span> && !arg[2]) {</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">if</span> (add_arg(ctx, arg) == -1)</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  ctx->nonopt = ctx->outargs.argc;</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  } <span class="keywordflow">else</span></div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <span class="keywordflow">return</span> process_gopt(ctx, arg, 0);</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span> }</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span> </div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span> <span class="keyword">static</span> <span class="keywordtype">int</span> opt_parse(<span class="keyword">struct</span> fuse_opt_context *ctx)</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> {</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <span class="keywordflow">if</span> (ctx->argc) {</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <span class="keywordflow">if</span> (add_arg(ctx, ctx->argv[0]) == -1)</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  }</div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span> </div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="keywordflow">for</span> (ctx->argctr = 1; ctx->argctr < ctx->argc; ctx->argctr++)</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  <span class="keywordflow">if</span> (process_one(ctx, ctx->argv[ctx->argctr]) == -1)</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span> </div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  <span class="keywordflow">if</span> (ctx->opts) {</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <span class="keywordflow">if</span> (<a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(&ctx->outargs, 1, <span class="stringliteral">"-o"</span>) == -1 ||</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#adb2922444d67f58e4233d21320386bc0">fuse_opt_insert_arg</a>(&ctx->outargs, 2, ctx->opts) == -1)</div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  }</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> </div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <span class="comment">/* If option separator ("--") is the last argument, remove it */</span></div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keywordflow">if</span> (ctx->nonopt && ctx->nonopt == ctx->outargs.argc &&</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  strcmp(ctx->outargs.argv[ctx->outargs.argc - 1], <span class="stringliteral">"--"</span>) == 0) {</div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  free(ctx->outargs.argv[ctx->outargs.argc - 1]);</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  ctx->outargs.argv[--ctx->outargs.argc] = NULL;</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  }</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span> </div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span> }</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span> </div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span> <span class="keywordtype">int</span> <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a539ef1f571c34f516c60c4cbe2901c0e">fuse_opt_parse</a>(<span class="keyword">struct</span> <a class="code" href="structfuse__args.html">fuse_args</a> *args, <span class="keywordtype">void</span> *data,</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structfuse__opt.html">fuse_opt</a> opts[], <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a3d2ab809528d409b0ee91cee400c07c2">fuse_opt_proc_t</a> proc)</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> {</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <span class="keywordtype">int</span> res;</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="keyword">struct </span>fuse_opt_context ctx = {</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  .data = data,</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  .opt = opts,</div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  .proc = proc,</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  };</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span> </div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="keywordflow">if</span> (!args || !args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a> || !args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>)</div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span> </div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  ctx.argc = args-><a class="code" href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">argc</a>;</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  ctx.argv = args-><a class="code" href="structfuse__args.html#aba205faea1c7b46b912bd509976a074a">argv</a>;</div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span> </div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  res = opt_parse(&ctx);</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordflow">if</span> (res != -1) {</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  <span class="keyword">struct </span><a class="code" href="structfuse__args.html">fuse_args</a> tmp = *args;</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  *args = ctx.outargs;</div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  ctx.outargs = tmp;</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  }</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  free(ctx.opts);</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <a class="code" href="fuse-3_86_80_2include_2fuse__opt_8h.html#a2cdf272429ab3869a5162976141b287d">fuse_opt_free_args</a>(&ctx.outargs);</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <span class="keywordflow">return</span> res;</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span> }</div><div class="ttc" id="fuse-3_86_80_2include_2fuse__opt_8h_html_a8533ff341f910c1bd05f10c8fcc35a04"><div class="ttname"><a href="fuse-3_86_80_2include_2fuse__opt_8h.html#a8533ff341f910c1bd05f10c8fcc35a04">FUSE_OPT_KEY_KEEP</a></div><div class="ttdeci">#define FUSE_OPT_KEY_KEEP</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__opt_8h_source.html#l00145">fuse_opt.h:145</a></div></div> fuse3-3.10.0/doc/html/fuse-3_86_81_2lib_2fuse__opt_8c_source.html-49-<div class="ttc" id="structfuse__args_html_a501883d1eababa08e05b0c802b31e11d"><div class="ttname"><a href="structfuse__args.html#a501883d1eababa08e05b0c802b31e11d">fuse_args::argc</a></div><div class="ttdeci">int argc</div><div class="ttdef"><b>Definition:</b> <a href="fuse-3_86_80_2include_2fuse__opt_8h_source.html#l00111">fuse_opt.h:111</a></div></div>