1 | /*
|
---|
2 | * Skeleton VFS module. Implements passthrough operation of all VFS
|
---|
3 | * calls to disk 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 |
|
---|
25 | #include "includes.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 | * please make sure that you remove all skel_XXX() functions you don't
|
---|
33 | * want to implement!! The passthrough operations are not
|
---|
34 | * neccessary in a real module.
|
---|
35 | *
|
---|
36 | * --metze
|
---|
37 | */
|
---|
38 |
|
---|
39 | static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user)
|
---|
40 | {
|
---|
41 | return SMB_VFS_NEXT_CONNECT(handle, service, user);
|
---|
42 | }
|
---|
43 |
|
---|
44 | static void skel_disconnect(vfs_handle_struct *handle)
|
---|
45 | {
|
---|
46 | SMB_VFS_NEXT_DISCONNECT(handle);
|
---|
47 | }
|
---|
48 |
|
---|
49 | static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path,
|
---|
50 | bool small_query, uint64_t *bsize,
|
---|
51 | uint64_t *dfree, uint64_t *dsize)
|
---|
52 | {
|
---|
53 | return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
|
---|
54 | dfree, dsize);
|
---|
55 | }
|
---|
56 |
|
---|
57 | static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
|
---|
58 | {
|
---|
59 | return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
|
---|
60 | }
|
---|
61 |
|
---|
62 | static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
|
---|
63 | {
|
---|
64 | return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
|
---|
65 | }
|
---|
66 |
|
---|
67 | static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
|
---|
68 | {
|
---|
69 | return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
|
---|
70 | }
|
---|
71 |
|
---|
72 | static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf)
|
---|
73 | {
|
---|
74 | return SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
|
---|
75 | }
|
---|
76 |
|
---|
77 | static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
|
---|
78 | {
|
---|
79 | return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
|
---|
80 | }
|
---|
81 |
|
---|
82 | static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
|
---|
83 | {
|
---|
84 | return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
|
---|
85 | }
|
---|
86 |
|
---|
87 | static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,
|
---|
88 | SMB_STRUCT_DIR *dirp,
|
---|
89 | SMB_STRUCT_STAT *sbuf)
|
---|
90 | {
|
---|
91 | return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
|
---|
92 | }
|
---|
93 |
|
---|
94 | static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset)
|
---|
95 | {
|
---|
96 | SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
|
---|
97 | }
|
---|
98 |
|
---|
99 | static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
|
---|
100 | {
|
---|
101 | return SMB_VFS_NEXT_TELLDIR(handle, dirp);
|
---|
102 | }
|
---|
103 |
|
---|
104 | static void skel_rewind_dir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
|
---|
105 | {
|
---|
106 | SMB_VFS_NEXT_REWINDDIR(handle, dirp);
|
---|
107 | }
|
---|
108 |
|
---|
109 | static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
|
---|
110 | {
|
---|
111 | return SMB_VFS_NEXT_MKDIR(handle, path, mode);
|
---|
112 | }
|
---|
113 |
|
---|
114 | static int skel_rmdir(vfs_handle_struct *handle, const char *path)
|
---|
115 | {
|
---|
116 | return SMB_VFS_NEXT_RMDIR(handle, path);
|
---|
117 | }
|
---|
118 |
|
---|
119 | static int skel_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dir)
|
---|
120 | {
|
---|
121 | return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
|
---|
122 | }
|
---|
123 |
|
---|
124 | static void skel_init_search_op(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
|
---|
125 | {
|
---|
126 | SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
|
---|
127 | }
|
---|
128 |
|
---|
129 | static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
|
---|
130 | files_struct *fsp, int flags, mode_t mode)
|
---|
131 | {
|
---|
132 | return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
|
---|
133 | }
|
---|
134 |
|
---|
135 | static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
|
---|
136 | struct smb_request *req,
|
---|
137 | uint16_t root_dir_fid,
|
---|
138 | struct smb_filename *smb_fname,
|
---|
139 | uint32_t access_mask,
|
---|
140 | uint32_t share_access,
|
---|
141 | uint32_t create_disposition,
|
---|
142 | uint32_t create_options,
|
---|
143 | uint32_t file_attributes,
|
---|
144 | uint32_t oplock_request,
|
---|
145 | uint64_t allocation_size,
|
---|
146 | struct security_descriptor *sd,
|
---|
147 | struct ea_list *ea_list,
|
---|
148 | files_struct **result,
|
---|
149 | int *pinfo)
|
---|
150 | {
|
---|
151 | return SMB_VFS_NEXT_CREATE_FILE(handle,
|
---|
152 | req,
|
---|
153 | root_dir_fid,
|
---|
154 | smb_fname,
|
---|
155 | access_mask,
|
---|
156 | share_access,
|
---|
157 | create_disposition,
|
---|
158 | create_options,
|
---|
159 | file_attributes,
|
---|
160 | oplock_request,
|
---|
161 | allocation_size,
|
---|
162 | sd,
|
---|
163 | ea_list,
|
---|
164 | result,
|
---|
165 | pinfo);
|
---|
166 | }
|
---|
167 |
|
---|
168 | static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
|
---|
169 | {
|
---|
170 | return SMB_VFS_NEXT_CLOSE(handle, fsp);
|
---|
171 | }
|
---|
172 |
|
---|
173 | static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
|
---|
174 | {
|
---|
175 | return SMB_VFS_NEXT_READ(handle, fsp, data, n);
|
---|
176 | }
|
---|
177 |
|
---|
178 | static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
|
---|
179 | {
|
---|
180 | return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
|
---|
181 | }
|
---|
182 |
|
---|
183 | static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
|
---|
184 | {
|
---|
185 | return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
|
---|
186 | }
|
---|
187 |
|
---|
188 | static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
|
---|
189 | {
|
---|
190 | return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
|
---|
191 | }
|
---|
192 |
|
---|
193 | static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence)
|
---|
194 | {
|
---|
195 | return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
|
---|
196 | }
|
---|
197 |
|
---|
198 | static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n)
|
---|
199 | {
|
---|
200 | return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
|
---|
201 | }
|
---|
202 |
|
---|
203 | static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n)
|
---|
204 | {
|
---|
205 | return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
|
---|
206 | }
|
---|
207 |
|
---|
208 | static int skel_rename(vfs_handle_struct *handle,
|
---|
209 | const struct smb_filename *smb_fname_src,
|
---|
210 | const struct smb_filename *smb_fname_dst)
|
---|
211 | {
|
---|
212 | return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
|
---|
213 | }
|
---|
214 |
|
---|
215 | static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
|
---|
216 | {
|
---|
217 | return SMB_VFS_NEXT_FSYNC(handle, fsp);
|
---|
218 | }
|
---|
219 |
|
---|
220 | static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
|
---|
221 | {
|
---|
222 | return SMB_VFS_NEXT_STAT(handle, smb_fname);
|
---|
223 | }
|
---|
224 |
|
---|
225 | static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
|
---|
226 | {
|
---|
227 | return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
|
---|
228 | }
|
---|
229 |
|
---|
230 | static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
|
---|
231 | {
|
---|
232 | return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
|
---|
233 | }
|
---|
234 |
|
---|
235 | static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
|
---|
236 | {
|
---|
237 | return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
|
---|
238 | }
|
---|
239 |
|
---|
240 | static int skel_unlink(vfs_handle_struct *handle,
|
---|
241 | const struct smb_filename *smb_fname)
|
---|
242 | {
|
---|
243 | return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
---|
244 | }
|
---|
245 |
|
---|
246 | static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
|
---|
247 | {
|
---|
248 | return SMB_VFS_NEXT_CHMOD(handle, path, mode);
|
---|
249 | }
|
---|
250 |
|
---|
251 | static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
|
---|
252 | {
|
---|
253 | return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
|
---|
254 | }
|
---|
255 |
|
---|
256 | static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
|
---|
257 | {
|
---|
258 | return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
|
---|
259 | }
|
---|
260 |
|
---|
261 | static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
|
---|
262 | {
|
---|
263 | return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
|
---|
264 | }
|
---|
265 |
|
---|
266 | static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
|
---|
267 | {
|
---|
268 | return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
|
---|
269 | }
|
---|
270 |
|
---|
271 | static int skel_chdir(vfs_handle_struct *handle, const char *path)
|
---|
272 | {
|
---|
273 | return SMB_VFS_NEXT_CHDIR(handle, path);
|
---|
274 | }
|
---|
275 |
|
---|
276 | static char *skel_getwd(vfs_handle_struct *handle, char *buf)
|
---|
277 | {
|
---|
278 | return SMB_VFS_NEXT_GETWD(handle, buf);
|
---|
279 | }
|
---|
280 |
|
---|
281 | static int skel_ntimes(vfs_handle_struct *handle,
|
---|
282 | const struct smb_filename *smb_fname,
|
---|
283 | struct smb_file_time *ft)
|
---|
284 | {
|
---|
285 | return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
|
---|
286 | }
|
---|
287 |
|
---|
288 | static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset)
|
---|
289 | {
|
---|
290 | return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
|
---|
291 | }
|
---|
292 |
|
---|
293 | static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
|
---|
294 | {
|
---|
295 | return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
|
---|
296 | }
|
---|
297 |
|
---|
298 | static int skel_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32 access_mask)
|
---|
299 | {
|
---|
300 | return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
|
---|
301 | }
|
---|
302 |
|
---|
303 | static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype)
|
---|
304 | {
|
---|
305 | return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
|
---|
306 | }
|
---|
307 |
|
---|
308 | static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
|
---|
309 | {
|
---|
310 | return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
|
---|
311 | }
|
---|
312 |
|
---|
313 | static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
|
---|
314 | {
|
---|
315 | return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
|
---|
316 | }
|
---|
317 |
|
---|
318 | static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz)
|
---|
319 | {
|
---|
320 | return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
|
---|
321 | }
|
---|
322 |
|
---|
323 | static int skel_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
|
---|
324 | {
|
---|
325 | return SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
|
---|
326 | }
|
---|
327 |
|
---|
328 | static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev)
|
---|
329 | {
|
---|
330 | return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev);
|
---|
331 | }
|
---|
332 |
|
---|
333 | static char *skel_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path)
|
---|
334 | {
|
---|
335 | return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path);
|
---|
336 | }
|
---|
337 |
|
---|
338 | static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle,
|
---|
339 | struct sys_notify_context *ctx, struct notify_entry *e,
|
---|
340 | void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev),
|
---|
341 | void *private_data, void *handle_p)
|
---|
342 | {
|
---|
343 | return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback,
|
---|
344 | private_data, handle_p);
|
---|
345 | }
|
---|
346 |
|
---|
347 | static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags)
|
---|
348 | {
|
---|
349 | return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
|
---|
350 | }
|
---|
351 |
|
---|
352 | static struct file_id skel_file_id_create(vfs_handle_struct *handle,
|
---|
353 | const SMB_STRUCT_STAT *sbuf)
|
---|
354 | {
|
---|
355 | return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
|
---|
356 | }
|
---|
357 |
|
---|
358 | static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
|
---|
359 | struct files_struct *fsp,
|
---|
360 | const char *fname,
|
---|
361 | TALLOC_CTX *mem_ctx,
|
---|
362 | unsigned int *num_streams,
|
---|
363 | struct stream_struct **streams)
|
---|
364 | {
|
---|
365 | return SMB_VFS_NEXT_STREAMINFO(handle,
|
---|
366 | fsp,
|
---|
367 | fname,
|
---|
368 | mem_ctx,
|
---|
369 | num_streams,
|
---|
370 | streams);
|
---|
371 | }
|
---|
372 |
|
---|
373 | static int skel_get_real_filename(struct vfs_handle_struct *handle,
|
---|
374 | const char *path,
|
---|
375 | const char *name,
|
---|
376 | TALLOC_CTX *mem_ctx,
|
---|
377 | char **found_name)
|
---|
378 | {
|
---|
379 | return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
|
---|
380 | path,
|
---|
381 | name,
|
---|
382 | mem_ctx,
|
---|
383 | found_name);
|
---|
384 | }
|
---|
385 |
|
---|
386 | static const char *skel_connectpath(struct vfs_handle_struct *handle,
|
---|
387 | const char *filename)
|
---|
388 | {
|
---|
389 | return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
|
---|
390 | }
|
---|
391 |
|
---|
392 | static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
|
---|
393 | struct byte_range_lock *br_lck,
|
---|
394 | struct lock_struct *plock,
|
---|
395 | bool blocking_lock,
|
---|
396 | struct blocking_lock_record *blr)
|
---|
397 | {
|
---|
398 | return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
|
---|
399 | br_lck,
|
---|
400 | plock,
|
---|
401 | blocking_lock,
|
---|
402 | blr);
|
---|
403 | }
|
---|
404 |
|
---|
405 | static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
|
---|
406 | struct messaging_context *msg_ctx,
|
---|
407 | struct byte_range_lock *br_lck,
|
---|
408 | const struct lock_struct *plock)
|
---|
409 | {
|
---|
410 | return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle,
|
---|
411 | msg_ctx,
|
---|
412 | br_lck,
|
---|
413 | plock);
|
---|
414 | }
|
---|
415 |
|
---|
416 | static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
|
---|
417 | struct byte_range_lock *br_lck,
|
---|
418 | struct lock_struct *plock,
|
---|
419 | struct blocking_lock_record *blr)
|
---|
420 | {
|
---|
421 | return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle,
|
---|
422 | br_lck,
|
---|
423 | plock,
|
---|
424 | blr);
|
---|
425 | }
|
---|
426 |
|
---|
427 | static bool skel_strict_lock(struct vfs_handle_struct *handle,
|
---|
428 | struct files_struct *fsp,
|
---|
429 | struct lock_struct *plock)
|
---|
430 | {
|
---|
431 | return SMB_VFS_NEXT_STRICT_LOCK(handle,
|
---|
432 | fsp,
|
---|
433 | plock);
|
---|
434 | }
|
---|
435 |
|
---|
436 | static void skel_strict_unlock(struct vfs_handle_struct *handle,
|
---|
437 | struct files_struct *fsp,
|
---|
438 | struct lock_struct *plock)
|
---|
439 | {
|
---|
440 | SMB_VFS_NEXT_STRICT_UNLOCK(handle,
|
---|
441 | fsp,
|
---|
442 | plock);
|
---|
443 | }
|
---|
444 |
|
---|
445 | static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
|
---|
446 | const char *mapped_name,
|
---|
447 | enum vfs_translate_direction direction,
|
---|
448 | TALLOC_CTX *mem_ctx,
|
---|
449 | char **pmapped_name)
|
---|
450 | {
|
---|
451 | return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
|
---|
452 | mem_ctx, pmapped_name);
|
---|
453 | }
|
---|
454 |
|
---|
455 | static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
456 | uint32 security_info, SEC_DESC **ppdesc)
|
---|
457 | {
|
---|
458 | return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
|
---|
459 | }
|
---|
460 |
|
---|
461 | static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
|
---|
462 | const char *name, uint32 security_info, SEC_DESC **ppdesc)
|
---|
463 | {
|
---|
464 | return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
|
---|
465 | }
|
---|
466 |
|
---|
467 | static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
468 | uint32 security_info_sent, const SEC_DESC *psd)
|
---|
469 | {
|
---|
470 | return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
|
---|
471 | }
|
---|
472 |
|
---|
473 | static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode)
|
---|
474 | {
|
---|
475 | return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode);
|
---|
476 | }
|
---|
477 |
|
---|
478 | static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
|
---|
479 | {
|
---|
480 | return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
|
---|
481 | }
|
---|
482 |
|
---|
483 | static int skel_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
|
---|
484 | {
|
---|
485 | return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p);
|
---|
486 | }
|
---|
487 |
|
---|
488 | static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
|
---|
489 | {
|
---|
490 | return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p);
|
---|
491 | }
|
---|
492 |
|
---|
493 | static int skel_sys_acl_get_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
|
---|
494 | {
|
---|
495 | return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p);
|
---|
496 | }
|
---|
497 |
|
---|
498 | static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d)
|
---|
499 | {
|
---|
500 | return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
|
---|
501 | }
|
---|
502 |
|
---|
503 | static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
|
---|
504 | {
|
---|
505 | return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
|
---|
506 | }
|
---|
507 |
|
---|
508 | static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp)
|
---|
509 | {
|
---|
510 | return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
|
---|
511 | }
|
---|
512 |
|
---|
513 | static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset)
|
---|
514 | {
|
---|
515 | return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
|
---|
516 | }
|
---|
517 |
|
---|
518 | static int skel_sys_acl_add_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
|
---|
519 | {
|
---|
520 | return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
|
---|
521 | }
|
---|
522 |
|
---|
523 | static char *skel_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen)
|
---|
524 | {
|
---|
525 | return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
|
---|
526 | }
|
---|
527 |
|
---|
528 | static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, int count)
|
---|
529 | {
|
---|
530 | return SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
|
---|
531 | }
|
---|
532 |
|
---|
533 | static int skel_sys_acl_create_entry(vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
|
---|
534 | {
|
---|
535 | return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
|
---|
536 | }
|
---|
537 |
|
---|
538 | static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
|
---|
539 | {
|
---|
540 | return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry, tagtype);
|
---|
541 | }
|
---|
542 |
|
---|
543 | static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual)
|
---|
544 | {
|
---|
545 | return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
|
---|
546 | }
|
---|
547 |
|
---|
548 | static int skel_sys_acl_set_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
|
---|
549 | {
|
---|
550 | return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
|
---|
551 | }
|
---|
552 |
|
---|
553 | static int skel_sys_acl_valid(vfs_handle_struct *handle, SMB_ACL_T theacl )
|
---|
554 | {
|
---|
555 | return SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
|
---|
556 | }
|
---|
557 |
|
---|
558 | static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
|
---|
559 | {
|
---|
560 | return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
|
---|
561 | }
|
---|
562 |
|
---|
563 | static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
|
---|
564 | {
|
---|
565 | return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
|
---|
566 | }
|
---|
567 |
|
---|
568 | static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path)
|
---|
569 | {
|
---|
570 | return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
|
---|
571 | }
|
---|
572 |
|
---|
573 | static int skel_sys_acl_get_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
|
---|
574 | {
|
---|
575 | return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
|
---|
576 | }
|
---|
577 |
|
---|
578 | static int skel_sys_acl_free_text(vfs_handle_struct *handle, char *text)
|
---|
579 | {
|
---|
580 | return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
|
---|
581 | }
|
---|
582 |
|
---|
583 | static int skel_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl)
|
---|
584 | {
|
---|
585 | return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
|
---|
586 | }
|
---|
587 |
|
---|
588 | static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype)
|
---|
589 | {
|
---|
590 | return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier, tagtype);
|
---|
591 | }
|
---|
592 |
|
---|
593 | static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size)
|
---|
594 | {
|
---|
595 | return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
|
---|
596 | }
|
---|
597 |
|
---|
598 | static ssize_t skel_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t
|
---|
599 | size)
|
---|
600 | {
|
---|
601 | return SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size);
|
---|
602 | }
|
---|
603 |
|
---|
604 | static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size)
|
---|
605 | {
|
---|
606 | return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
|
---|
607 | }
|
---|
608 |
|
---|
609 | static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
|
---|
610 | {
|
---|
611 | return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
|
---|
612 | }
|
---|
613 |
|
---|
614 | static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
|
---|
615 | {
|
---|
616 | return SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size);
|
---|
617 | }
|
---|
618 |
|
---|
619 | static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
|
---|
620 | {
|
---|
621 | return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
|
---|
622 | }
|
---|
623 |
|
---|
624 | static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name)
|
---|
625 | {
|
---|
626 | return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
|
---|
627 | }
|
---|
628 |
|
---|
629 | static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name)
|
---|
630 | {
|
---|
631 | return SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name);
|
---|
632 | }
|
---|
633 |
|
---|
634 | static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name)
|
---|
635 | {
|
---|
636 | return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
|
---|
637 | }
|
---|
638 |
|
---|
639 | static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
|
---|
640 | {
|
---|
641 | return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
|
---|
642 | }
|
---|
643 |
|
---|
644 | static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
|
---|
645 | {
|
---|
646 | return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags);
|
---|
647 | }
|
---|
648 |
|
---|
649 | static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
|
---|
650 | {
|
---|
651 | return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
|
---|
652 | }
|
---|
653 |
|
---|
654 | static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
655 | {
|
---|
656 | return SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
|
---|
657 | }
|
---|
658 |
|
---|
659 | static int skel_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
660 | {
|
---|
661 | return SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
|
---|
662 | }
|
---|
663 |
|
---|
664 | static ssize_t skel_aio_return_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
665 | {
|
---|
666 | return SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
|
---|
667 | }
|
---|
668 |
|
---|
669 | static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
670 | {
|
---|
671 | return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
|
---|
672 | }
|
---|
673 |
|
---|
674 | static int skel_aio_error_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
675 | {
|
---|
676 | return SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
|
---|
677 | }
|
---|
678 |
|
---|
679 | static int skel_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb)
|
---|
680 | {
|
---|
681 | return SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
|
---|
682 | }
|
---|
683 |
|
---|
684 | static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts)
|
---|
685 | {
|
---|
686 | return SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
|
---|
687 | }
|
---|
688 |
|
---|
689 | static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
|
---|
690 | {
|
---|
691 | return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
|
---|
692 | }
|
---|
693 |
|
---|
694 | static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
|
---|
695 | {
|
---|
696 | return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf);
|
---|
697 | }
|
---|
698 |
|
---|
699 | static int skel_set_offline(struct vfs_handle_struct *handle, const char *path)
|
---|
700 | {
|
---|
701 | return SMB_VFS_NEXT_SET_OFFLINE(handle, path);
|
---|
702 | }
|
---|
703 |
|
---|
704 | /* VFS operations structure */
|
---|
705 |
|
---|
706 | struct vfs_fn_pointers skel_transparent_fns = {
|
---|
707 | /* Disk operations */
|
---|
708 |
|
---|
709 | .connect_fn = skel_connect,
|
---|
710 | .disconnect = skel_disconnect,
|
---|
711 | .disk_free = skel_disk_free,
|
---|
712 | .get_quota = skel_get_quota,
|
---|
713 | .set_quota = skel_set_quota,
|
---|
714 | .get_shadow_copy_data = skel_get_shadow_copy_data,
|
---|
715 | .statvfs = skel_statvfs,
|
---|
716 | .fs_capabilities = skel_fs_capabilities,
|
---|
717 |
|
---|
718 | /* Directory operations */
|
---|
719 |
|
---|
720 | .opendir = skel_opendir,
|
---|
721 | .readdir = skel_readdir,
|
---|
722 | .seekdir = skel_seekdir,
|
---|
723 | .telldir = skel_telldir,
|
---|
724 | .rewind_dir = skel_rewind_dir,
|
---|
725 | .mkdir = skel_mkdir,
|
---|
726 | .rmdir = skel_rmdir,
|
---|
727 | .closedir = skel_closedir,
|
---|
728 | .init_search_op = skel_init_search_op,
|
---|
729 |
|
---|
730 | /* File operations */
|
---|
731 |
|
---|
732 | .open = skel_open,
|
---|
733 | .create_file = skel_create_file,
|
---|
734 | .close_fn = skel_close_fn,
|
---|
735 | .vfs_read = skel_vfs_read,
|
---|
736 | .pread = skel_pread,
|
---|
737 | .write = skel_write,
|
---|
738 | .pwrite = skel_pwrite,
|
---|
739 | .lseek = skel_lseek,
|
---|
740 | .sendfile = skel_sendfile,
|
---|
741 | .recvfile = skel_recvfile,
|
---|
742 | .rename = skel_rename,
|
---|
743 | .fsync = skel_fsync,
|
---|
744 | .stat = skel_stat,
|
---|
745 | .fstat = skel_fstat,
|
---|
746 | .lstat = skel_lstat,
|
---|
747 | .get_alloc_size = skel_get_alloc_size,
|
---|
748 | .unlink = skel_unlink,
|
---|
749 | .chmod = skel_chmod,
|
---|
750 | .fchmod = skel_fchmod,
|
---|
751 | .chown = skel_chown,
|
---|
752 | .fchown = skel_fchown,
|
---|
753 | .lchown = skel_lchown,
|
---|
754 | .chdir = skel_chdir,
|
---|
755 | .getwd = skel_getwd,
|
---|
756 | .ntimes = skel_ntimes,
|
---|
757 | .ftruncate = skel_ftruncate,
|
---|
758 | .lock = skel_lock,
|
---|
759 | .kernel_flock = skel_kernel_flock,
|
---|
760 | .linux_setlease = skel_linux_setlease,
|
---|
761 | .getlock = skel_getlock,
|
---|
762 | .symlink = skel_symlink,
|
---|
763 | .vfs_readlink = skel_vfs_readlink,
|
---|
764 | .link = skel_link,
|
---|
765 | .mknod = skel_mknod,
|
---|
766 | .realpath = skel_realpath,
|
---|
767 | .notify_watch = skel_notify_watch,
|
---|
768 | .chflags = skel_chflags,
|
---|
769 | .file_id_create = skel_file_id_create,
|
---|
770 |
|
---|
771 | .streaminfo = skel_streaminfo,
|
---|
772 | .get_real_filename = skel_get_real_filename,
|
---|
773 | .connectpath = skel_connectpath,
|
---|
774 | .brl_lock_windows = skel_brl_lock_windows,
|
---|
775 | .brl_unlock_windows = skel_brl_unlock_windows,
|
---|
776 | .brl_cancel_windows = skel_brl_cancel_windows,
|
---|
777 | .strict_lock = skel_strict_lock,
|
---|
778 | .strict_unlock = skel_strict_unlock,
|
---|
779 | .translate_name = skel_translate_name,
|
---|
780 |
|
---|
781 | /* NT ACL operations. */
|
---|
782 |
|
---|
783 | .fget_nt_acl = skel_fget_nt_acl,
|
---|
784 | .get_nt_acl = skel_get_nt_acl,
|
---|
785 | .fset_nt_acl = skel_fset_nt_acl,
|
---|
786 |
|
---|
787 | /* POSIX ACL operations. */
|
---|
788 |
|
---|
789 | .chmod_acl = skel_chmod_acl,
|
---|
790 | .fchmod_acl = skel_fchmod_acl,
|
---|
791 |
|
---|
792 | .sys_acl_get_entry = skel_sys_acl_get_entry,
|
---|
793 | .sys_acl_get_tag_type = skel_sys_acl_get_tag_type,
|
---|
794 | .sys_acl_get_permset = skel_sys_acl_get_permset,
|
---|
795 | .sys_acl_get_qualifier = skel_sys_acl_get_qualifier,
|
---|
796 | .sys_acl_get_file = skel_sys_acl_get_file,
|
---|
797 | .sys_acl_get_fd = skel_sys_acl_get_fd,
|
---|
798 | .sys_acl_clear_perms = skel_sys_acl_clear_perms,
|
---|
799 | .sys_acl_add_perm = skel_sys_acl_add_perm,
|
---|
800 | .sys_acl_to_text = skel_sys_acl_to_text,
|
---|
801 | .sys_acl_init = skel_sys_acl_init,
|
---|
802 | .sys_acl_create_entry = skel_sys_acl_create_entry,
|
---|
803 | .sys_acl_set_tag_type = skel_sys_acl_set_tag_type,
|
---|
804 | .sys_acl_set_qualifier = skel_sys_acl_set_qualifier,
|
---|
805 | .sys_acl_set_permset = skel_sys_acl_set_permset,
|
---|
806 | .sys_acl_valid = skel_sys_acl_valid,
|
---|
807 | .sys_acl_set_file = skel_sys_acl_set_file,
|
---|
808 | .sys_acl_set_fd = skel_sys_acl_set_fd,
|
---|
809 | .sys_acl_delete_def_file = skel_sys_acl_delete_def_file,
|
---|
810 | .sys_acl_get_perm = skel_sys_acl_get_perm,
|
---|
811 | .sys_acl_free_text = skel_sys_acl_free_text,
|
---|
812 | .sys_acl_free_acl = skel_sys_acl_free_acl,
|
---|
813 | .sys_acl_free_qualifier = skel_sys_acl_free_qualifier,
|
---|
814 |
|
---|
815 | /* EA operations. */
|
---|
816 | .getxattr = skel_getxattr,
|
---|
817 | .lgetxattr = skel_lgetxattr,
|
---|
818 | .fgetxattr = skel_fgetxattr,
|
---|
819 | .listxattr = skel_listxattr,
|
---|
820 | .llistxattr = skel_llistxattr,
|
---|
821 | .flistxattr = skel_flistxattr,
|
---|
822 | .removexattr = skel_removexattr,
|
---|
823 | .lremovexattr = skel_lremovexattr,
|
---|
824 | .fremovexattr = skel_fremovexattr,
|
---|
825 | .setxattr = skel_setxattr,
|
---|
826 | .lsetxattr = skel_lsetxattr,
|
---|
827 | .fsetxattr = skel_fsetxattr,
|
---|
828 |
|
---|
829 | /* aio operations */
|
---|
830 | .aio_read = skel_aio_read,
|
---|
831 | .aio_write = skel_aio_write,
|
---|
832 | .aio_return_fn = skel_aio_return_fn,
|
---|
833 | .aio_cancel = skel_aio_cancel,
|
---|
834 | .aio_error_fn = skel_aio_error_fn,
|
---|
835 | .aio_fsync = skel_aio_fsync,
|
---|
836 | .aio_suspend = skel_aio_suspend,
|
---|
837 | .aio_force = skel_aio_force,
|
---|
838 |
|
---|
839 | /* offline operations */
|
---|
840 | .is_offline = skel_is_offline,
|
---|
841 | .set_offline = skel_set_offline
|
---|
842 | };
|
---|
843 |
|
---|
844 | NTSTATUS vfs_skel_transparent_init(void)
|
---|
845 | {
|
---|
846 | return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", &skel_transparent_fns);
|
---|
847 | }
|
---|