1 | /*
|
---|
2 | * Skeleton VFS module. Implements dummy versions of all VFS
|
---|
3 | * functions.
|
---|
4 | *
|
---|
5 | * Copyright (C) Tim Potter, 1999-2000
|
---|
6 | * Copyright (C) Alexander Bokovoy, 2002
|
---|
7 | * Copyright (C) Stefan (metze) Metzmacher, 2003
|
---|
8 | * Copyright (C) Jeremy Allison 2009
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 3 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #include "../source3/include/includes.h"
|
---|
25 | #include "lib/util/tevent_ntstatus.h"
|
---|
26 |
|
---|
27 | /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE
|
---|
28 | SAMBA DEVELOPERS GUIDE!!!!!!
|
---|
29 | */
|
---|
30 |
|
---|
31 | /* If you take this file as template for your module
|
---|
32 | * you must re-implement every function.
|
---|
33 | */
|
---|
34 |
|
---|
35 | static int skel_connect(vfs_handle_struct *handle, const char *service,
|
---|
36 | const char *user)
|
---|
37 | {
|
---|
38 | errno = ENOSYS;
|
---|
39 | return -1;
|
---|
40 | }
|
---|
41 |
|
---|
42 | static void skel_disconnect(vfs_handle_struct *handle)
|
---|
43 | {
|
---|
44 | ;
|
---|
45 | }
|
---|
46 |
|
---|
47 | static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path,
|
---|
48 | uint64_t *bsize,
|
---|
49 | uint64_t *dfree, uint64_t *dsize)
|
---|
50 | {
|
---|
51 | *bsize = 0;
|
---|
52 | *dfree = 0;
|
---|
53 | *dsize = 0;
|
---|
54 | return 0;
|
---|
55 | }
|
---|
56 |
|
---|
57 | static int skel_get_quota(vfs_handle_struct *handle, const char *path,
|
---|
58 | enum SMB_QUOTA_TYPE qtype, unid_t id,
|
---|
59 | SMB_DISK_QUOTA *dq)
|
---|
60 | {
|
---|
61 | errno = ENOSYS;
|
---|
62 | return -1;
|
---|
63 | }
|
---|
64 |
|
---|
65 | static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
|
---|
66 | unid_t id, SMB_DISK_QUOTA *dq)
|
---|
67 | {
|
---|
68 | errno = ENOSYS;
|
---|
69 | return -1;
|
---|
70 | }
|
---|
71 |
|
---|
72 | static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
|
---|
73 | files_struct *fsp,
|
---|
74 | struct shadow_copy_data *shadow_copy_data,
|
---|
75 | bool labels)
|
---|
76 | {
|
---|
77 | errno = ENOSYS;
|
---|
78 | return -1;
|
---|
79 | }
|
---|
80 |
|
---|
81 | static int skel_statvfs(struct vfs_handle_struct *handle,
|
---|
82 | const char *path, struct vfs_statvfs_struct *statbuf)
|
---|
83 | {
|
---|
84 | errno = ENOSYS;
|
---|
85 | return -1;
|
---|
86 | }
|
---|
87 |
|
---|
88 | static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle,
|
---|
89 | enum timestamp_set_resolution *p_ts_res)
|
---|
90 | {
|
---|
91 | return 0;
|
---|
92 | }
|
---|
93 |
|
---|
94 | static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle,
|
---|
95 | struct dfs_GetDFSReferral *r)
|
---|
96 | {
|
---|
97 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
98 | }
|
---|
99 |
|
---|
100 | static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname,
|
---|
101 | const char *mask, uint32_t attr)
|
---|
102 | {
|
---|
103 | return NULL;
|
---|
104 | }
|
---|
105 |
|
---|
106 | static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
|
---|
107 | TALLOC_CTX *mem_ctx,
|
---|
108 | const char *service_path,
|
---|
109 | char **base_volume)
|
---|
110 | {
|
---|
111 | return NT_STATUS_NOT_SUPPORTED;
|
---|
112 | }
|
---|
113 |
|
---|
114 | static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle,
|
---|
115 | TALLOC_CTX *mem_ctx,
|
---|
116 | const char *base_volume,
|
---|
117 | time_t *tstamp,
|
---|
118 | bool rw,
|
---|
119 | char **base_path,
|
---|
120 | char **snap_path)
|
---|
121 | {
|
---|
122 | return NT_STATUS_NOT_SUPPORTED;
|
---|
123 | }
|
---|
124 |
|
---|
125 | static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle,
|
---|
126 | TALLOC_CTX *mem_ctx,
|
---|
127 | char *base_path,
|
---|
128 | char *snap_path)
|
---|
129 | {
|
---|
130 | return NT_STATUS_NOT_SUPPORTED;
|
---|
131 | }
|
---|
132 |
|
---|
133 | static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp,
|
---|
134 | const char *mask, uint32_t attr)
|
---|
135 | {
|
---|
136 | return NULL;
|
---|
137 | }
|
---|
138 |
|
---|
139 | static struct dirent *skel_readdir(vfs_handle_struct *handle,
|
---|
140 | DIR *dirp, SMB_STRUCT_STAT *sbuf)
|
---|
141 | {
|
---|
142 | return NULL;
|
---|
143 | }
|
---|
144 |
|
---|
145 | static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
|
---|
146 | {
|
---|
147 | ;
|
---|
148 | }
|
---|
149 |
|
---|
150 | static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
|
---|
151 | {
|
---|
152 | return (long)-1;
|
---|
153 | }
|
---|
154 |
|
---|
155 | static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
|
---|
156 | {
|
---|
157 | ;
|
---|
158 | }
|
---|
159 |
|
---|
160 | static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
|
---|
161 | {
|
---|
162 | errno = ENOSYS;
|
---|
163 | return -1;
|
---|
164 | }
|
---|
165 |
|
---|
166 | static int skel_rmdir(vfs_handle_struct *handle, const char *path)
|
---|
167 | {
|
---|
168 | errno = ENOSYS;
|
---|
169 | return -1;
|
---|
170 | }
|
---|
171 |
|
---|
172 | static int skel_closedir(vfs_handle_struct *handle, DIR *dir)
|
---|
173 | {
|
---|
174 | errno = ENOSYS;
|
---|
175 | return -1;
|
---|
176 | }
|
---|
177 |
|
---|
178 | static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp)
|
---|
179 | {
|
---|
180 | ;
|
---|
181 | }
|
---|
182 |
|
---|
183 | static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
|
---|
184 | files_struct *fsp, int flags, mode_t mode)
|
---|
185 | {
|
---|
186 | errno = ENOSYS;
|
---|
187 | return -1;
|
---|
188 | }
|
---|
189 |
|
---|
190 | static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
|
---|
191 | struct smb_request *req,
|
---|
192 | uint16_t root_dir_fid,
|
---|
193 | struct smb_filename *smb_fname,
|
---|
194 | uint32_t access_mask,
|
---|
195 | uint32_t share_access,
|
---|
196 | uint32_t create_disposition,
|
---|
197 | uint32_t create_options,
|
---|
198 | uint32_t file_attributes,
|
---|
199 | uint32_t oplock_request,
|
---|
200 | struct smb2_lease *lease,
|
---|
201 | uint64_t allocation_size,
|
---|
202 | uint32_t private_flags,
|
---|
203 | struct security_descriptor *sd,
|
---|
204 | struct ea_list *ea_list,
|
---|
205 | files_struct **result, int *pinfo,
|
---|
206 | const struct smb2_create_blobs *in_context_blobs,
|
---|
207 | struct smb2_create_blobs *out_context_blobs)
|
---|
208 | {
|
---|
209 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
210 | }
|
---|
211 |
|
---|
212 | static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
|
---|
213 | {
|
---|
214 | errno = ENOSYS;
|
---|
215 | return -1;
|
---|
216 | }
|
---|
217 |
|
---|
218 | static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
|
---|
219 | void *data, size_t n)
|
---|
220 | {
|
---|
221 | errno = ENOSYS;
|
---|
222 | return -1;
|
---|
223 | }
|
---|
224 |
|
---|
225 | static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
|
---|
226 | void *data, size_t n, off_t offset)
|
---|
227 | {
|
---|
228 | errno = ENOSYS;
|
---|
229 | return -1;
|
---|
230 | }
|
---|
231 |
|
---|
232 | static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle,
|
---|
233 | TALLOC_CTX *mem_ctx,
|
---|
234 | struct tevent_context *ev,
|
---|
235 | struct files_struct *fsp,
|
---|
236 | void *data, size_t n, off_t offset)
|
---|
237 | {
|
---|
238 | return NULL;
|
---|
239 | }
|
---|
240 |
|
---|
241 | static ssize_t skel_pread_recv(struct tevent_req *req, int *err)
|
---|
242 | {
|
---|
243 | *err = ENOSYS;
|
---|
244 | return -1;
|
---|
245 | }
|
---|
246 |
|
---|
247 | static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
|
---|
248 | const void *data, size_t n)
|
---|
249 | {
|
---|
250 | errno = ENOSYS;
|
---|
251 | return -1;
|
---|
252 | }
|
---|
253 |
|
---|
254 | static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
|
---|
255 | const void *data, size_t n, off_t offset)
|
---|
256 | {
|
---|
257 | errno = ENOSYS;
|
---|
258 | return -1;
|
---|
259 | }
|
---|
260 |
|
---|
261 | static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle,
|
---|
262 | TALLOC_CTX *mem_ctx,
|
---|
263 | struct tevent_context *ev,
|
---|
264 | struct files_struct *fsp,
|
---|
265 | const void *data,
|
---|
266 | size_t n, off_t offset)
|
---|
267 | {
|
---|
268 | return NULL;
|
---|
269 | }
|
---|
270 |
|
---|
271 | static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err)
|
---|
272 | {
|
---|
273 | *err = ENOSYS;
|
---|
274 | return -1;
|
---|
275 | }
|
---|
276 |
|
---|
277 | static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp,
|
---|
278 | off_t offset, int whence)
|
---|
279 | {
|
---|
280 | errno = ENOSYS;
|
---|
281 | return (off_t) - 1;
|
---|
282 | }
|
---|
283 |
|
---|
284 | static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd,
|
---|
285 | files_struct *fromfsp, const DATA_BLOB *hdr,
|
---|
286 | off_t offset, size_t n)
|
---|
287 | {
|
---|
288 | errno = ENOSYS;
|
---|
289 | return -1;
|
---|
290 | }
|
---|
291 |
|
---|
292 | static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd,
|
---|
293 | files_struct *tofsp, off_t offset, size_t n)
|
---|
294 | {
|
---|
295 | errno = ENOSYS;
|
---|
296 | return -1;
|
---|
297 | }
|
---|
298 |
|
---|
299 | static int skel_rename(vfs_handle_struct *handle,
|
---|
300 | const struct smb_filename *smb_fname_src,
|
---|
301 | const struct smb_filename *smb_fname_dst)
|
---|
302 | {
|
---|
303 | errno = ENOSYS;
|
---|
304 | return -1;
|
---|
305 | }
|
---|
306 |
|
---|
307 | static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
|
---|
308 | {
|
---|
309 | errno = ENOSYS;
|
---|
310 | return -1;
|
---|
311 | }
|
---|
312 |
|
---|
313 | static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
|
---|
314 | TALLOC_CTX *mem_ctx,
|
---|
315 | struct tevent_context *ev,
|
---|
316 | struct files_struct *fsp)
|
---|
317 | {
|
---|
318 | return NULL;
|
---|
319 | }
|
---|
320 |
|
---|
321 | static int skel_fsync_recv(struct tevent_req *req, int *err)
|
---|
322 | {
|
---|
323 | *err = ENOSYS;
|
---|
324 | return -1;
|
---|
325 | }
|
---|
326 |
|
---|
327 | static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
|
---|
328 | {
|
---|
329 | errno = ENOSYS;
|
---|
330 | return -1;
|
---|
331 | }
|
---|
332 |
|
---|
333 | static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp,
|
---|
334 | SMB_STRUCT_STAT *sbuf)
|
---|
335 | {
|
---|
336 | errno = ENOSYS;
|
---|
337 | return -1;
|
---|
338 | }
|
---|
339 |
|
---|
340 | static int skel_lstat(vfs_handle_struct *handle,
|
---|
341 | struct smb_filename *smb_fname)
|
---|
342 | {
|
---|
343 | errno = ENOSYS;
|
---|
344 | return -1;
|
---|
345 | }
|
---|
346 |
|
---|
347 | static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
|
---|
348 | struct files_struct *fsp,
|
---|
349 | const SMB_STRUCT_STAT *sbuf)
|
---|
350 | {
|
---|
351 | errno = ENOSYS;
|
---|
352 | return -1;
|
---|
353 | }
|
---|
354 |
|
---|
355 | static int skel_unlink(vfs_handle_struct *handle,
|
---|
356 | const struct smb_filename *smb_fname)
|
---|
357 | {
|
---|
358 | errno = ENOSYS;
|
---|
359 | return -1;
|
---|
360 | }
|
---|
361 |
|
---|
362 | static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
|
---|
363 | {
|
---|
364 | errno = ENOSYS;
|
---|
365 | return -1;
|
---|
366 | }
|
---|
367 |
|
---|
368 | static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
|
---|
369 | mode_t mode)
|
---|
370 | {
|
---|
371 | errno = ENOSYS;
|
---|
372 | return -1;
|
---|
373 | }
|
---|
374 |
|
---|
375 | static int skel_chown(vfs_handle_struct *handle, const char *path,
|
---|
376 | uid_t uid, gid_t gid)
|
---|
377 | {
|
---|
378 | errno = ENOSYS;
|
---|
379 | return -1;
|
---|
380 | }
|
---|
381 |
|
---|
382 | static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp,
|
---|
383 | uid_t uid, gid_t gid)
|
---|
384 | {
|
---|
385 | errno = ENOSYS;
|
---|
386 | return -1;
|
---|
387 | }
|
---|
388 |
|
---|
389 | static int skel_lchown(vfs_handle_struct *handle, const char *path,
|
---|
390 | uid_t uid, gid_t gid)
|
---|
391 | {
|
---|
392 | errno = ENOSYS;
|
---|
393 | return -1;
|
---|
394 | }
|
---|
395 |
|
---|
396 | static int skel_chdir(vfs_handle_struct *handle, const char *path)
|
---|
397 | {
|
---|
398 | errno = ENOSYS;
|
---|
399 | return -1;
|
---|
400 | }
|
---|
401 |
|
---|
402 | static char *skel_getwd(vfs_handle_struct *handle)
|
---|
403 | {
|
---|
404 | errno = ENOSYS;
|
---|
405 | return NULL;
|
---|
406 | }
|
---|
407 |
|
---|
408 | static int skel_ntimes(vfs_handle_struct *handle,
|
---|
409 | const struct smb_filename *smb_fname,
|
---|
410 | struct smb_file_time *ft)
|
---|
411 | {
|
---|
412 | errno = ENOSYS;
|
---|
413 | return -1;
|
---|
414 | }
|
---|
415 |
|
---|
416 | static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
|
---|
417 | off_t offset)
|
---|
418 | {
|
---|
419 | errno = ENOSYS;
|
---|
420 | return -1;
|
---|
421 | }
|
---|
422 |
|
---|
423 | static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp,
|
---|
424 | uint32_t mode, off_t offset, off_t len)
|
---|
425 | {
|
---|
426 | errno = ENOSYS;
|
---|
427 | return -1;
|
---|
428 | }
|
---|
429 |
|
---|
430 | static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op,
|
---|
431 | off_t offset, off_t count, int type)
|
---|
432 | {
|
---|
433 | errno = ENOSYS;
|
---|
434 | return false;
|
---|
435 | }
|
---|
436 |
|
---|
437 | static int skel_kernel_flock(struct vfs_handle_struct *handle,
|
---|
438 | struct files_struct *fsp,
|
---|
439 | uint32_t share_mode, uint32_t access_mask)
|
---|
440 | {
|
---|
441 | errno = ENOSYS;
|
---|
442 | return -1;
|
---|
443 | }
|
---|
444 |
|
---|
445 | static int skel_linux_setlease(struct vfs_handle_struct *handle,
|
---|
446 | struct files_struct *fsp, int leasetype)
|
---|
447 | {
|
---|
448 | errno = ENOSYS;
|
---|
449 | return -1;
|
---|
450 | }
|
---|
451 |
|
---|
452 | static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp,
|
---|
453 | off_t *poffset, off_t *pcount, int *ptype,
|
---|
454 | pid_t *ppid)
|
---|
455 | {
|
---|
456 | errno = ENOSYS;
|
---|
457 | return false;
|
---|
458 | }
|
---|
459 |
|
---|
460 | static int skel_symlink(vfs_handle_struct *handle, const char *oldpath,
|
---|
461 | const char *newpath)
|
---|
462 | {
|
---|
463 | errno = ENOSYS;
|
---|
464 | return -1;
|
---|
465 | }
|
---|
466 |
|
---|
467 | static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path,
|
---|
468 | char *buf, size_t bufsiz)
|
---|
469 | {
|
---|
470 | errno = ENOSYS;
|
---|
471 | return -1;
|
---|
472 | }
|
---|
473 |
|
---|
474 | static int skel_link(vfs_handle_struct *handle, const char *oldpath,
|
---|
475 | const char *newpath)
|
---|
476 | {
|
---|
477 | errno = ENOSYS;
|
---|
478 | return -1;
|
---|
479 | }
|
---|
480 |
|
---|
481 | static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode,
|
---|
482 | SMB_DEV_T dev)
|
---|
483 | {
|
---|
484 | errno = ENOSYS;
|
---|
485 | return -1;
|
---|
486 | }
|
---|
487 |
|
---|
488 | static char *skel_realpath(vfs_handle_struct *handle, const char *path)
|
---|
489 | {
|
---|
490 | errno = ENOSYS;
|
---|
491 | return NULL;
|
---|
492 | }
|
---|
493 |
|
---|
494 | static int skel_chflags(vfs_handle_struct *handle, const char *path,
|
---|
495 | uint flags)
|
---|
496 | {
|
---|
497 | errno = ENOSYS;
|
---|
498 | return -1;
|
---|
499 | }
|
---|
500 |
|
---|
501 | static struct file_id skel_file_id_create(vfs_handle_struct *handle,
|
---|
502 | const SMB_STRUCT_STAT *sbuf)
|
---|
503 | {
|
---|
504 | struct file_id id;
|
---|
505 | ZERO_STRUCT(id);
|
---|
506 | errno = ENOSYS;
|
---|
507 | return id;
|
---|
508 | }
|
---|
509 |
|
---|
510 | struct skel_cc_state {
|
---|
511 | uint64_t unused;
|
---|
512 | };
|
---|
513 | static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
|
---|
514 | TALLOC_CTX *mem_ctx,
|
---|
515 | struct tevent_context *ev,
|
---|
516 | struct files_struct *src_fsp,
|
---|
517 | off_t src_off,
|
---|
518 | struct files_struct *dest_fsp,
|
---|
519 | off_t dest_off,
|
---|
520 | off_t num)
|
---|
521 | {
|
---|
522 | struct tevent_req *req;
|
---|
523 | struct skel_cc_state *cc_state;
|
---|
524 |
|
---|
525 | req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
|
---|
526 | if (req == NULL) {
|
---|
527 | return NULL;
|
---|
528 | }
|
---|
529 |
|
---|
530 | tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
|
---|
531 | return tevent_req_post(req, ev);
|
---|
532 | }
|
---|
533 |
|
---|
534 | static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
|
---|
535 | struct tevent_req *req,
|
---|
536 | off_t *copied)
|
---|
537 | {
|
---|
538 | NTSTATUS status;
|
---|
539 |
|
---|
540 | if (tevent_req_is_nterror(req, &status)) {
|
---|
541 | tevent_req_received(req);
|
---|
542 | return status;
|
---|
543 | }
|
---|
544 | tevent_req_received(req);
|
---|
545 |
|
---|
546 | return NT_STATUS_OK;
|
---|
547 | }
|
---|
548 |
|
---|
549 | static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle,
|
---|
550 | TALLOC_CTX *mem_ctx,
|
---|
551 | struct files_struct *fsp,
|
---|
552 | struct smb_filename *smb_fname,
|
---|
553 | uint16_t *_compression_fmt)
|
---|
554 | {
|
---|
555 | return NT_STATUS_INVALID_DEVICE_REQUEST;
|
---|
556 | }
|
---|
557 |
|
---|
558 | static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle,
|
---|
559 | TALLOC_CTX *mem_ctx,
|
---|
560 | struct files_struct *fsp,
|
---|
561 | uint16_t compression_fmt)
|
---|
562 | {
|
---|
563 | return NT_STATUS_INVALID_DEVICE_REQUEST;
|
---|
564 | }
|
---|
565 |
|
---|
566 | static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
|
---|
567 | struct files_struct *fsp,
|
---|
568 | const char *fname,
|
---|
569 | TALLOC_CTX *mem_ctx,
|
---|
570 | unsigned int *num_streams,
|
---|
571 | struct stream_struct **streams)
|
---|
572 | {
|
---|
573 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
574 | }
|
---|
575 |
|
---|
576 | static int skel_get_real_filename(struct vfs_handle_struct *handle,
|
---|
577 | const char *path,
|
---|
578 | const char *name,
|
---|
579 | TALLOC_CTX *mem_ctx, char **found_name)
|
---|
580 | {
|
---|
581 | errno = ENOSYS;
|
---|
582 | return -1;
|
---|
583 | }
|
---|
584 |
|
---|
585 | static const char *skel_connectpath(struct vfs_handle_struct *handle,
|
---|
586 | const char *filename)
|
---|
587 | {
|
---|
588 | errno = ENOSYS;
|
---|
589 | return NULL;
|
---|
590 | }
|
---|
591 |
|
---|
592 | static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
|
---|
593 | struct byte_range_lock *br_lck,
|
---|
594 | struct lock_struct *plock,
|
---|
595 | bool blocking_lock)
|
---|
596 | {
|
---|
597 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
598 | }
|
---|
599 |
|
---|
600 | static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
|
---|
601 | struct messaging_context *msg_ctx,
|
---|
602 | struct byte_range_lock *br_lck,
|
---|
603 | const struct lock_struct *plock)
|
---|
604 | {
|
---|
605 | errno = ENOSYS;
|
---|
606 | return false;
|
---|
607 | }
|
---|
608 |
|
---|
609 | static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
|
---|
610 | struct byte_range_lock *br_lck,
|
---|
611 | struct lock_struct *plock)
|
---|
612 | {
|
---|
613 | errno = ENOSYS;
|
---|
614 | return false;
|
---|
615 | }
|
---|
616 |
|
---|
617 | static bool skel_strict_lock(struct vfs_handle_struct *handle,
|
---|
618 | struct files_struct *fsp,
|
---|
619 | struct lock_struct *plock)
|
---|
620 | {
|
---|
621 | errno = ENOSYS;
|
---|
622 | return false;
|
---|
623 | }
|
---|
624 |
|
---|
625 | static void skel_strict_unlock(struct vfs_handle_struct *handle,
|
---|
626 | struct files_struct *fsp,
|
---|
627 | struct lock_struct *plock)
|
---|
628 | {
|
---|
629 | ;
|
---|
630 | }
|
---|
631 |
|
---|
632 | static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
|
---|
633 | const char *mapped_name,
|
---|
634 | enum vfs_translate_direction direction,
|
---|
635 | TALLOC_CTX *mem_ctx, char **pmapped_name)
|
---|
636 | {
|
---|
637 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
638 | }
|
---|
639 |
|
---|
640 | static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle,
|
---|
641 | struct files_struct *fsp,
|
---|
642 | TALLOC_CTX *ctx,
|
---|
643 | uint32_t function,
|
---|
644 | uint16_t req_flags, /* Needed for UNICODE ... */
|
---|
645 | const uint8_t *_in_data,
|
---|
646 | uint32_t in_len,
|
---|
647 | uint8_t **_out_data,
|
---|
648 | uint32_t max_out_len, uint32_t *out_len)
|
---|
649 | {
|
---|
650 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
651 | }
|
---|
652 |
|
---|
653 | static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle,
|
---|
654 | const struct smb_filename *fname,
|
---|
655 | TALLOC_CTX *mem_ctx,
|
---|
656 | struct readdir_attr_data **pattr_data)
|
---|
657 | {
|
---|
658 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
659 | }
|
---|
660 |
|
---|
661 | static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
662 | uint32_t security_info,
|
---|
663 | TALLOC_CTX *mem_ctx,
|
---|
664 | struct security_descriptor **ppdesc)
|
---|
665 | {
|
---|
666 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
667 | }
|
---|
668 |
|
---|
669 | static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
|
---|
670 | const char *name, uint32_t security_info,
|
---|
671 | TALLOC_CTX *mem_ctx,
|
---|
672 | struct security_descriptor **ppdesc)
|
---|
673 | {
|
---|
674 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
675 | }
|
---|
676 |
|
---|
677 | static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
678 | uint32_t security_info_sent,
|
---|
679 | const struct security_descriptor *psd)
|
---|
680 | {
|
---|
681 | return NT_STATUS_NOT_IMPLEMENTED;
|
---|
682 | }
|
---|
683 |
|
---|
684 | static int skel_chmod_acl(vfs_handle_struct *handle, const char *name,
|
---|
685 | mode_t mode)
|
---|
686 | {
|
---|
687 | errno = ENOSYS;
|
---|
688 | return -1;
|
---|
689 | }
|
---|
690 |
|
---|
691 | static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
692 | mode_t mode)
|
---|
693 | {
|
---|
694 | errno = ENOSYS;
|
---|
695 | return -1;
|
---|
696 | }
|
---|
697 |
|
---|
698 | static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle,
|
---|
699 | const char *path_p,
|
---|
700 | SMB_ACL_TYPE_T type,
|
---|
701 | TALLOC_CTX *mem_ctx)
|
---|
702 | {
|
---|
703 | errno = ENOSYS;
|
---|
704 | return (SMB_ACL_T) NULL;
|
---|
705 | }
|
---|
706 |
|
---|
707 | static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle,
|
---|
708 | files_struct *fsp, TALLOC_CTX *mem_ctx)
|
---|
709 | {
|
---|
710 | errno = ENOSYS;
|
---|
711 | return (SMB_ACL_T) NULL;
|
---|
712 | }
|
---|
713 |
|
---|
714 | static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle,
|
---|
715 | const char *path_p, TALLOC_CTX *mem_ctx,
|
---|
716 | char **blob_description, DATA_BLOB *blob)
|
---|
717 | {
|
---|
718 | errno = ENOSYS;
|
---|
719 | return -1;
|
---|
720 | }
|
---|
721 |
|
---|
722 | static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
|
---|
723 | files_struct *fsp, TALLOC_CTX *mem_ctx,
|
---|
724 | char **blob_description, DATA_BLOB *blob)
|
---|
725 | {
|
---|
726 | errno = ENOSYS;
|
---|
727 | return -1;
|
---|
728 | }
|
---|
729 |
|
---|
730 | static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
|
---|
731 | SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
|
---|
732 | {
|
---|
733 | errno = ENOSYS;
|
---|
734 | return -1;
|
---|
735 | }
|
---|
736 |
|
---|
737 | static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
|
---|
738 | SMB_ACL_T theacl)
|
---|
739 | {
|
---|
740 | errno = ENOSYS;
|
---|
741 | return -1;
|
---|
742 | }
|
---|
743 |
|
---|
744 | static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
|
---|
745 | const char *path)
|
---|
746 | {
|
---|
747 | errno = ENOSYS;
|
---|
748 | return -1;
|
---|
749 | }
|
---|
750 |
|
---|
751 | static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path,
|
---|
752 | const char *name, void *value, size_t size)
|
---|
753 | {
|
---|
754 | errno = ENOSYS;
|
---|
755 | return -1;
|
---|
756 | }
|
---|
757 |
|
---|
758 | static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
|
---|
759 | struct files_struct *fsp, const char *name,
|
---|
760 | void *value, size_t size)
|
---|
761 | {
|
---|
762 | errno = ENOSYS;
|
---|
763 | return -1;
|
---|
764 | }
|
---|
765 |
|
---|
766 | static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
|
---|
767 | char *list, size_t size)
|
---|
768 | {
|
---|
769 | errno = ENOSYS;
|
---|
770 | return -1;
|
---|
771 | }
|
---|
772 |
|
---|
773 | static ssize_t skel_flistxattr(vfs_handle_struct *handle,
|
---|
774 | struct files_struct *fsp, char *list,
|
---|
775 | size_t size)
|
---|
776 | {
|
---|
777 | errno = ENOSYS;
|
---|
778 | return -1;
|
---|
779 | }
|
---|
780 |
|
---|
781 | static int skel_removexattr(vfs_handle_struct *handle, const char *path,
|
---|
782 | const char *name)
|
---|
783 | {
|
---|
784 | errno = ENOSYS;
|
---|
785 | return -1;
|
---|
786 | }
|
---|
787 |
|
---|
788 | static int skel_fremovexattr(vfs_handle_struct *handle,
|
---|
789 | struct files_struct *fsp, const char *name)
|
---|
790 | {
|
---|
791 | errno = ENOSYS;
|
---|
792 | return -1;
|
---|
793 | return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
|
---|
794 | }
|
---|
795 |
|
---|
796 | static int skel_setxattr(vfs_handle_struct *handle, const char *path,
|
---|
797 | const char *name, const void *value, size_t size,
|
---|
798 | int flags)
|
---|
799 | {
|
---|
800 | errno = ENOSYS;
|
---|
801 | return -1;
|
---|
802 | }
|
---|
803 |
|
---|
804 | static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
|
---|
805 | const char *name, const void *value, size_t size,
|
---|
806 | int flags)
|
---|
807 | {
|
---|
808 | errno = ENOSYS;
|
---|
809 | return -1;
|
---|
810 | }
|
---|
811 |
|
---|
812 | static bool skel_aio_force(struct vfs_handle_struct *handle,
|
---|
813 | struct files_struct *fsp)
|
---|
814 | {
|
---|
815 | errno = ENOSYS;
|
---|
816 | return false;
|
---|
817 | }
|
---|
818 |
|
---|
819 | static bool skel_is_offline(struct vfs_handle_struct *handle,
|
---|
820 | const struct smb_filename *fname,
|
---|
821 | SMB_STRUCT_STAT *sbuf)
|
---|
822 | {
|
---|
823 | errno = ENOSYS;
|
---|
824 | return false;
|
---|
825 | }
|
---|
826 |
|
---|
827 | static int skel_set_offline(struct vfs_handle_struct *handle,
|
---|
828 | const struct smb_filename *fname)
|
---|
829 | {
|
---|
830 | errno = ENOSYS;
|
---|
831 | return -1;
|
---|
832 | }
|
---|
833 |
|
---|
834 | /* VFS operations structure */
|
---|
835 |
|
---|
836 | struct vfs_fn_pointers skel_opaque_fns = {
|
---|
837 | /* Disk operations */
|
---|
838 |
|
---|
839 | .connect_fn = skel_connect,
|
---|
840 | .disconnect_fn = skel_disconnect,
|
---|
841 | .disk_free_fn = skel_disk_free,
|
---|
842 | .get_quota_fn = skel_get_quota,
|
---|
843 | .set_quota_fn = skel_set_quota,
|
---|
844 | .get_shadow_copy_data_fn = skel_get_shadow_copy_data,
|
---|
845 | .statvfs_fn = skel_statvfs,
|
---|
846 | .fs_capabilities_fn = skel_fs_capabilities,
|
---|
847 | .get_dfs_referrals_fn = skel_get_dfs_referrals,
|
---|
848 | .snap_check_path_fn = skel_snap_check_path,
|
---|
849 | .snap_create_fn = skel_snap_create,
|
---|
850 | .snap_delete_fn = skel_snap_delete,
|
---|
851 |
|
---|
852 | /* Directory operations */
|
---|
853 |
|
---|
854 | .opendir_fn = skel_opendir,
|
---|
855 | .fdopendir_fn = skel_fdopendir,
|
---|
856 | .readdir_fn = skel_readdir,
|
---|
857 | .seekdir_fn = skel_seekdir,
|
---|
858 | .telldir_fn = skel_telldir,
|
---|
859 | .rewind_dir_fn = skel_rewind_dir,
|
---|
860 | .mkdir_fn = skel_mkdir,
|
---|
861 | .rmdir_fn = skel_rmdir,
|
---|
862 | .closedir_fn = skel_closedir,
|
---|
863 | .init_search_op_fn = skel_init_search_op,
|
---|
864 |
|
---|
865 | /* File operations */
|
---|
866 |
|
---|
867 | .open_fn = skel_open,
|
---|
868 | .create_file_fn = skel_create_file,
|
---|
869 | .close_fn = skel_close_fn,
|
---|
870 | .read_fn = skel_vfs_read,
|
---|
871 | .pread_fn = skel_pread,
|
---|
872 | .pread_send_fn = skel_pread_send,
|
---|
873 | .pread_recv_fn = skel_pread_recv,
|
---|
874 | .write_fn = skel_write,
|
---|
875 | .pwrite_fn = skel_pwrite,
|
---|
876 | .pwrite_send_fn = skel_pwrite_send,
|
---|
877 | .pwrite_recv_fn = skel_pwrite_recv,
|
---|
878 | .lseek_fn = skel_lseek,
|
---|
879 | .sendfile_fn = skel_sendfile,
|
---|
880 | .recvfile_fn = skel_recvfile,
|
---|
881 | .rename_fn = skel_rename,
|
---|
882 | .fsync_fn = skel_fsync,
|
---|
883 | .fsync_send_fn = skel_fsync_send,
|
---|
884 | .fsync_recv_fn = skel_fsync_recv,
|
---|
885 | .stat_fn = skel_stat,
|
---|
886 | .fstat_fn = skel_fstat,
|
---|
887 | .lstat_fn = skel_lstat,
|
---|
888 | .get_alloc_size_fn = skel_get_alloc_size,
|
---|
889 | .unlink_fn = skel_unlink,
|
---|
890 | .chmod_fn = skel_chmod,
|
---|
891 | .fchmod_fn = skel_fchmod,
|
---|
892 | .chown_fn = skel_chown,
|
---|
893 | .fchown_fn = skel_fchown,
|
---|
894 | .lchown_fn = skel_lchown,
|
---|
895 | .chdir_fn = skel_chdir,
|
---|
896 | .getwd_fn = skel_getwd,
|
---|
897 | .ntimes_fn = skel_ntimes,
|
---|
898 | .ftruncate_fn = skel_ftruncate,
|
---|
899 | .fallocate_fn = skel_fallocate,
|
---|
900 | .lock_fn = skel_lock,
|
---|
901 | .kernel_flock_fn = skel_kernel_flock,
|
---|
902 | .linux_setlease_fn = skel_linux_setlease,
|
---|
903 | .getlock_fn = skel_getlock,
|
---|
904 | .symlink_fn = skel_symlink,
|
---|
905 | .readlink_fn = skel_vfs_readlink,
|
---|
906 | .link_fn = skel_link,
|
---|
907 | .mknod_fn = skel_mknod,
|
---|
908 | .realpath_fn = skel_realpath,
|
---|
909 | .chflags_fn = skel_chflags,
|
---|
910 | .file_id_create_fn = skel_file_id_create,
|
---|
911 | .copy_chunk_send_fn = skel_copy_chunk_send,
|
---|
912 | .copy_chunk_recv_fn = skel_copy_chunk_recv,
|
---|
913 | .get_compression_fn = skel_get_compression,
|
---|
914 | .set_compression_fn = skel_set_compression,
|
---|
915 |
|
---|
916 | .streaminfo_fn = skel_streaminfo,
|
---|
917 | .get_real_filename_fn = skel_get_real_filename,
|
---|
918 | .connectpath_fn = skel_connectpath,
|
---|
919 | .brl_lock_windows_fn = skel_brl_lock_windows,
|
---|
920 | .brl_unlock_windows_fn = skel_brl_unlock_windows,
|
---|
921 | .brl_cancel_windows_fn = skel_brl_cancel_windows,
|
---|
922 | .strict_lock_fn = skel_strict_lock,
|
---|
923 | .strict_unlock_fn = skel_strict_unlock,
|
---|
924 | .translate_name_fn = skel_translate_name,
|
---|
925 | .fsctl_fn = skel_fsctl,
|
---|
926 | .readdir_attr_fn = skel_readdir_attr,
|
---|
927 |
|
---|
928 | /* NT ACL operations. */
|
---|
929 |
|
---|
930 | .fget_nt_acl_fn = skel_fget_nt_acl,
|
---|
931 | .get_nt_acl_fn = skel_get_nt_acl,
|
---|
932 | .fset_nt_acl_fn = skel_fset_nt_acl,
|
---|
933 |
|
---|
934 | /* POSIX ACL operations. */
|
---|
935 |
|
---|
936 | .chmod_acl_fn = skel_chmod_acl,
|
---|
937 | .fchmod_acl_fn = skel_fchmod_acl,
|
---|
938 |
|
---|
939 | .sys_acl_get_file_fn = skel_sys_acl_get_file,
|
---|
940 | .sys_acl_get_fd_fn = skel_sys_acl_get_fd,
|
---|
941 | .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
|
---|
942 | .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
|
---|
943 | .sys_acl_set_file_fn = skel_sys_acl_set_file,
|
---|
944 | .sys_acl_set_fd_fn = skel_sys_acl_set_fd,
|
---|
945 | .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
|
---|
946 |
|
---|
947 | /* EA operations. */
|
---|
948 | .getxattr_fn = skel_getxattr,
|
---|
949 | .fgetxattr_fn = skel_fgetxattr,
|
---|
950 | .listxattr_fn = skel_listxattr,
|
---|
951 | .flistxattr_fn = skel_flistxattr,
|
---|
952 | .removexattr_fn = skel_removexattr,
|
---|
953 | .fremovexattr_fn = skel_fremovexattr,
|
---|
954 | .setxattr_fn = skel_setxattr,
|
---|
955 | .fsetxattr_fn = skel_fsetxattr,
|
---|
956 |
|
---|
957 | /* aio operations */
|
---|
958 | .aio_force_fn = skel_aio_force,
|
---|
959 |
|
---|
960 | /* offline operations */
|
---|
961 | .is_offline_fn = skel_is_offline,
|
---|
962 | .set_offline_fn = skel_set_offline
|
---|
963 | };
|
---|
964 |
|
---|
965 | static_decl_vfs;
|
---|
966 | NTSTATUS vfs_skel_opaque_init(void)
|
---|
967 | {
|
---|
968 | return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
|
---|
969 | &skel_opaque_fns);
|
---|
970 | }
|
---|