1 /*
2  *  Copyright (c) 2014, Facebook, Inc.
3  *  All rights reserved.
4  *
5  *  This source code is licensed under the Boost-style license found in the
6  *  LICENSE file in the root directory of this source tree. An additional grant
7  *  of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 module c.fuse.common;
11 
12 import std.stdint;
13 
14 extern (System) {
15     static assert(fuse_conn_info.sizeof == 128);
16     struct fuse_conn_info
17     {
18         /**
19          * Major version of the protocol (read-only)
20          */
21         uint proto_major;
22 
23         /**
24          * Minor version of the protocol (read-only)
25          */
26         uint proto_minor;
27 
28         /**
29          * Is asynchronous read supported (read-write)
30          */
31         uint async_read;
32 
33         /**
34          * Maximum size of the write buffer
35          */
36         uint max_write;
37 
38         /**
39          * Maximum readahead
40          */
41         uint max_readahead;
42 
43         /**
44          * Capability flags, that the kernel supports
45          */
46         uint capable;
47 
48         /**
49          * Capability flags, that the filesystem wants to enable
50          */
51         uint want;
52 
53         /**
54          * Maximum number of backgrounded requests
55          */
56         uint max_background;
57 
58         /**
59          * Kernel congestion threshold parameter
60          */
61         uint congestion_threshold;
62 
63         /**
64          * For future use.
65          */
66         uint reserved[23];
67     }
68 
69     static assert(fuse_file_info.sizeof == 64);
70     struct fuse_file_info
71     {
72         /** Open flags. Available in open() and release() */
73         int flags;
74 
75         /** Old file handle, don't use */
76         ulong fh_old;
77 
78         /** In case of a write operation indicates if this was caused by a
79           writepage */
80         int writepage;
81 
82         /** Can be filled in by open, to use direct I/O on this file.
83           Introduced in version 2.4 */
84         uint direct_io = 1;
85 
86         /** Can be filled in by open, to indicate, that cached file data
87           need not be invalidated.  Introduced in version 2.4 */
88         uint keep_cache = 1;
89 
90         /** Indicates a flush operation.  Set in flush operation, also
91           maybe set in highlevel lock operation and lowlevel release
92           operation. Introduced in version 2.6 */
93         uint flush = 1;
94 
95         /** Can be filled in by open, to indicate that the file is not
96           seekable.  Introduced in version 2.8 */
97         uint nonseekable = 1;
98 
99         /* Indicates that flock locks for this file should be
100            released.  If set, lock_owner shall contain a valid value.
101            May only be set in ->release().  Introduced in version
102            2.9 */
103         uint flock_release = 1;
104 
105         /** Padding.  Do not use*/
106         uint padding = 27;
107 
108         /** File handle.  May be filled in by filesystem in open().
109           Available in all other file operations */
110         uint64_t fh;
111 
112         /** Lock owner id.  Available in locking operations and flush */
113         uint64_t lock_owner;
114     }
115 }