3 * Copyright (C) 2009 Codethink Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * John Carr <john.carr@unrouted.co.uk>
23 [CCode (cprefix = "fuse_", cheader_filename = "fuse/fuse.h")]
25 [CCode (cname = "struct fuse_file_info", has_type_id = false)]
26 public struct FileInfo {
30 public uint direct_io;
31 public uint keep_cache;
35 public uint64 lock_owner;
38 [CCode (cname = "struct fuse", has_type_id = false)]
42 [CCode (cname = "struct fuse_context", has_type_id = false)]
43 public struct Context {
51 [CCode (cname = "fuse_fill_dir_t", has_target = false)]
52 public delegate int FillDir (void* buf, string name, Posix.Stat? st, Posix.off_t offset);
54 [CCode (has_target = false)]
55 public delegate int GetAttr (string path, Posix.Stat* st);
56 [CCode (has_target = false)]
57 public delegate int Access (string path, int mask);
58 [CCode (has_target = false)]
59 public delegate int ReadLink (string path, char* buf, size_t size);
60 [CCode (has_target = false)]
61 public delegate int ReadDir (string path, void* buf, FillDir filler, Posix.off_t offset, ref FileInfo fi);
62 [CCode (has_target = false)]
63 public delegate int MkNod (string path, Posix.mode_t mode, Posix.dev_t rdev);
64 [CCode (has_target = false)]
65 public delegate int MkDir (string path, Posix.mode_t mode);
66 [CCode (has_target = false)]
67 public delegate int Unlink (string path);
68 [CCode (has_target = false)]
69 public delegate int RmDir (string path);
70 [CCode (has_target = false)]
71 public delegate int Symlink (string from, string to);
72 [CCode (has_target = false)]
73 public delegate int Rename (string from, string to);
74 [CCode (has_target = false)]
75 public delegate int Link (string from, string to);
76 [CCode (has_target = false)]
77 public delegate int Chmod (string path, Posix.mode_t mode);
78 [CCode (has_target = false)]
79 public delegate int Chown (string path, Posix.uid_t uid, Posix.gid_t gid);
80 [CCode (has_target = false)]
81 public delegate int Truncate (string path, Posix.off_t size);
82 [CCode (has_target = false)]
83 public delegate int Utimens (string path, Posix.timespec[] ts);
84 [CCode (has_target = false)]
85 public delegate int Create(string path, Posix.mode_t mode, ref FileInfo fi);
86 [CCode (has_target = false)]
87 public delegate int Open (string path, ref FileInfo fi);
88 [CCode (has_target = false)]
89 public delegate int Read (string path, char* buf, size_t size, Posix.off_t offset, ref FileInfo fi);
90 [CCode (has_target = false)]
91 public delegate int Write (string path, char* buf, size_t size, Posix.off_t offset, ref FileInfo fi);
92 [CCode (has_target = false)]
93 public delegate int StatFs (string path, Posix.statvfs *stbuf);
94 [CCode (has_target = false)]
95 public delegate int Release (string path, ref FileInfo fi);
96 [CCode (has_target = false)]
97 public delegate int Fsync (string path, int isdatasync, ref FileInfo fi);
99 [CCode (has_target = false)]
100 public delegate int SetXAttr (string path, string name, char* value, size_t size, int flags);
101 [CCode (has_target = false)]
102 public delegate int GetXAttr (string path, string name, char* value, size_t size);
103 [CCode (has_target = false)]
104 public delegate int ListXAttr (string path, char* list, size_t size);
105 [CCode (has_target = false)]
106 public delegate int RemoveXAttr (string path, string name);
108 [CCode (cname = "struct fuse_operations", has_type_id = false)]
109 public struct Operations {
110 public GetAttr getattr;
111 public Access access;
112 public ReadLink readlink;
113 public ReadDir readdir;
116 public Symlink symlink;
117 public Unlink unlink;
119 public Rename rename;
123 public Truncate truncate;
124 public Utimens utimens;
125 public Create create;
129 public StatFs statfs;
130 public Release release;
132 public SetXAttr setxattr;
133 public GetXAttr getxattr;
134 public ListXAttr listxattr;
135 public RemoveXAttr removexattr;
138 public int main ([CCode (array_length_pos = 0.9)] string[] args, Operations oper, void *user_data);
139 public Context get_context ();