-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathvufuse_default_ops.c
267 lines (229 loc) · 6.59 KB
/
vufuse_default_ops.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/*
* VUOS: view OS project
* Copyright (C) 2018 Renzo Davoli <[email protected]>
* Leonardo Frioli <[email protected]>
* VirtualSquare team.
* (inherited from umfuse Copyright 2005 Renzo Davoli)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <fuse3/fuse.h>
#include <errno.h>
#include <stdio.h>
#include <libgen.h>
#include <vumodule.h>
/* Check fuse.h for the documentation*/
static int vustd_getattr (const char *path, struct stat *stat, struct fuse_file_info *fi)
{
printkdebug(F,"DEFAULT getattr %s\n", path);
return -ENOTSUP;
}
static int vustd_readlink (const char *path, char *link, size_t size)
{
printkdebug(F,"DEFAULT readlink %s\n", path);
return -EINVAL;
}
static int vustd_mknod (const char *path, mode_t mode, dev_t dev)
{
printkdebug(F,"DEFAULT mknod %s\n", path);
return -ENOSYS;
}
static int vustd_mkdir (const char *path, mode_t mode)
{
printkdebug(F,"DEFAULT mkdir %s\n", path);
return -ENOSYS;
}
static int vustd_unlink (const char *path)
{
printkdebug(F,"DEFAULT unlink %s\n", path);
return -ENOSYS;
}
static int vustd_rmdir (const char *path)
{
printkdebug(F,"DEFAULT rmdir %s\n", path);
return -ENOSYS;
}
static int vustd_symlink (const char *path, const char *newpath)
{
printkdebug(F,"DEFAULT symlink %s\n", path);
return -ENOSYS;
}
static int vustd_rename (const char *path, const char *newpath, unsigned int flags)
{
printkdebug(F,"DEFAULT rename %s\n", path);
return -ENOSYS;
}
static int vustd_link (const char *path, const char *newpath)
{
printkdebug(F,"DEFAULT link %s\n", path);
return -ENOSYS;
}
static int vustd_chmod (const char *path, mode_t mode, struct fuse_file_info *fi)
{
printkdebug(F,"DEFAULT chmod %s\n", path);
return -ENOSYS;
}
static int vustd_chown (const char *path, uid_t uid, gid_t gid, struct fuse_file_info *fi)
{
printkdebug(F,"DEFAULT chown %s\n", path);
return -ENOSYS;
}
static int vustd_truncate (const char *path, off_t off, struct fuse_file_info *fi)
{
printkdebug(F,"DEFAULT truncat %s\n", path);
return -ENOSYS;
}
static int vustd_open (const char *path, struct fuse_file_info *fi)
{
printkdebug(F,"DEFAULT open %s\n", path);
return -ENOSYS;
}
static int vustd_read (const char *path, char *buf, size_t size, off_t off, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT read %s\n", path);
return -ENOSYS;
}
static int vustd_write (const char *path, const char *buf, size_t size, off_t off,
struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT write %s\n", path);
return -ENOSYS;
}
/** Get file system statistics
*
* The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
*
*/
#if ( FUSE_MINOR_VERSION >= 5 )
static int vustd_statfs (const char *path, struct statvfs *stat)
#else
static int vustd_statfs (const char *path, struct statfs *stat)
#endif
{
printkdebug(F,"DEFAULT statfs %s\n", path);
return -ENOSYS;
}
static int vustd_flush (const char *path, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT flush %s\n", path);
return 0; //maybe flush is not relevant
}
static int vustd_release (const char *path, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT release %s\n", path);
return 0;
}
static int vustd_fsync (const char *path, int flags, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT fsync %s\n", path);
return 0;
}
/** Set extended attributes */
static int vustd_setxattr (const char *path, const char *name, const char *attr, size_t size, int flags)
{
printkdebug(F,"DEFAULT setxattr %s\n", path);
return -ENOSYS;
}
/** Get extended attributes */
static int vustd_getxattr (const char *path, const char *name, char *attr, size_t size)
{
printkdebug(F,"DEFAULT getxattr %s\n", path);
return -ENOSYS;
}
static int vustd_listxattr (const char *path, char *addrlist, size_t size)
{
printkdebug(F,"DEFAULT listxattr %s\n", path);
return -ENOSYS;
}
static int vustd_removexattr (const char *path, const char *name)
{
printkdebug(F,"DEFAULT removexattr %s\n", path);
return -ENOSYS;
}
static int vustd_opendir (const char *path, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT opendir %s\n", path);
return 0;
}
static int vustd_releasedir (const char *path, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT removexattr %s\n", path);
return 0;
}
static int vustd_fsyncdir (const char *path, int user_meta, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT fsyncdir %s\n", path);
return -ENOSYS;
}
static int vustd_access (const char *path, int mode)
{
printkdebug(F,"DEFAULT access %s\n", path);
return -ENOSYS;
}
static int vustd_create (const char *path, mode_t mode, struct fuse_file_info *fileinfo)
{
printkdebug(F,"DEFAULT create %s\n", path);
return -ENOSYS;
}
static int vustd_lock (const char *path, struct fuse_file_info *fileinfo, int cmd, struct flock *fl)
{
printkdebug(F,"DEFAULT lock %s\n", path);
return -ENOSYS;
}
static int vustd_utimens(const char *path, const struct timespec tv[2], struct fuse_file_info *fi)
{
printkdebug(F,"DEFAULT utimens %s\n", path);
return -ENOSYS;
}
static int vustd_bmap (const char *path, size_t blocksize, uint64_t *idx)
{
printkdebug(F,"DEFAULT bmap %s\n", path);
return -ENOSYS;
}
struct fuse_operations vufuse_default_ops = {
.getattr = vustd_getattr,
.readlink = vustd_readlink,
.mknod = vustd_mknod,
.mkdir = vustd_mkdir,
.unlink = vustd_unlink,
.rmdir = vustd_rmdir,
.symlink = vustd_symlink,
.rename = vustd_rename,
.link = vustd_link,
.chmod = vustd_chmod,
.chown = vustd_chown,
.truncate = vustd_truncate,
.open = vustd_open,
.read = vustd_read,
.write = vustd_write,
.statfs = vustd_statfs,
.flush = vustd_flush,
.release = vustd_release,
.fsync = vustd_fsync,
.setxattr = vustd_setxattr,
.getxattr = vustd_getxattr,
.listxattr = vustd_listxattr,
.removexattr = vustd_removexattr,
.opendir = vustd_opendir,
.releasedir = vustd_releasedir,
.fsyncdir = vustd_fsyncdir,
.init = NULL,
.destroy = NULL,
.access = vustd_access,
.create = vustd_create,
.lock = vustd_lock,
.utimens = vustd_utimens,
.bmap = vustd_bmap,
};