s3: Plumb smb_filename through SMB_VFS_RENAME
[Samba/fernandojvsilva.git] / source3 / modules / vfs_onefs_shadow_copy.c
blob8d7e109170bbec14e80c10170f929c90498d413e
1 /*
2 * OneFS shadow copy implementation that utilizes the file system's native
3 * snapshot support. This is based on the original shadow copy module from
4 * 2004.
6 * Copyright (C) Stefan Metzmacher 2003-2004
7 * Copyright (C) Tim Prouty 2009
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "includes.h"
25 #include "onefs_shadow_copy.h"
27 static int vfs_onefs_shadow_copy_debug_level = DBGC_VFS;
29 #undef DBGC_CLASS
30 #define DBGC_CLASS vfs_onefs_shadow_copy_debug_level
32 #define SHADOW_COPY_PREFIX "@GMT-"
33 #define SHADOW_COPY_SAMPLE "@GMT-2004.02.18-15.44.00"
35 bool
36 shadow_copy_match_name(const char *name, char **snap_component)
38 uint32 i = 0;
39 char delim[] = SHADOW_COPY_PREFIX;
40 char* start;
42 start = strstr( name, delim );
45 * The name could have SHADOW_COPY_PREFIX in it so we need to keep
46 * trying until we get something that is the full length of the
47 * SHADOW_COPY_SAMPLE.
49 while (start != NULL) {
51 DEBUG(10,("Processing %s\n", name));
53 /* size / correctness check */
54 *snap_component = start;
55 for ( i = sizeof(SHADOW_COPY_PREFIX);
56 i < sizeof(SHADOW_COPY_SAMPLE); i++) {
57 if (start[i] == '/') {
58 if (i == sizeof(SHADOW_COPY_SAMPLE) - 1)
59 return true;
60 else
61 break;
62 } else if (start[i] == '\0')
63 return (i == sizeof(SHADOW_COPY_SAMPLE) - 1);
66 start = strstr( start, delim );
69 return false;
72 static int
73 onefs_shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
74 files_struct *fsp,
75 SHADOW_COPY_DATA *shadow_copy_data,
76 bool labels)
78 void *p = osc_version_opendir();
79 char *snap_component = NULL;
80 shadow_copy_data->num_volumes = 0;
81 shadow_copy_data->labels = NULL;
83 if (!p) {
84 DEBUG(0, ("shadow_copy_get_shadow_copy_data: osc_opendir() "
85 "failed for [%s]\n",fsp->conn->connectpath));
86 return -1;
89 while (true) {
90 SHADOW_COPY_LABEL *tlabels;
91 char *d;
93 d = osc_version_readdir(p);
94 if (d == NULL)
95 break;
97 if (!shadow_copy_match_name(d, &snap_component)) {
98 DEBUG(10,("shadow_copy_get_shadow_copy_data: ignore "
99 "[%s]\n",d));
100 continue;
103 DEBUG(7,("shadow_copy_get_shadow_copy_data: not ignore "
104 "[%s]\n",d));
106 if (!labels) {
107 shadow_copy_data->num_volumes++;
108 continue;
111 tlabels = (SHADOW_COPY_LABEL *)TALLOC_REALLOC(
112 shadow_copy_data->mem_ctx,
113 shadow_copy_data->labels,
114 (shadow_copy_data->num_volumes+1) *
115 sizeof(SHADOW_COPY_LABEL));
117 if (tlabels == NULL) {
118 DEBUG(0,("shadow_copy_get_shadow_copy_data: Out of "
119 "memory\n"));
120 osc_version_closedir(p);
121 return -1;
124 snprintf(tlabels[shadow_copy_data->num_volumes++],
125 sizeof(*tlabels), "%s",d);
127 shadow_copy_data->labels = tlabels;
130 osc_version_closedir(p);
132 return 0;
135 #define SHADOW_NEXT(op, args, rtype) do { \
136 char *cpath = NULL; \
137 char *snap_component = NULL; \
138 rtype ret; \
139 if (shadow_copy_match_name(path, &snap_component)) \
140 cpath = osc_canonicalize_path(path, snap_component); \
141 ret = SMB_VFS_NEXT_ ## op args; \
142 SAFE_FREE(cpath); \
143 return ret; \
144 } while (0) \
147 * XXX: Convert osc_canonicalize_path to use talloc instead of malloc.
149 #define SHADOW_NEXT_SMB_FNAME(op, args, rtype) do { \
150 char *smb_base_name_tmp = NULL; \
151 char *cpath = NULL; \
152 char *snap_component = NULL; \
153 rtype ret; \
154 smb_base_name_tmp = smb_fname->base_name; \
155 if (shadow_copy_match_name(smb_fname->base_name, \
156 &snap_component)) { \
157 cpath = osc_canonicalize_path(smb_fname->base_name, \
158 snap_component); \
159 smb_fname->base_name = cpath; \
161 ret = SMB_VFS_NEXT_ ## op args; \
162 smb_fname->base_name = smb_base_name_tmp; \
163 SAFE_FREE(cpath); \
164 return ret; \
165 } while (0) \
169 static uint64_t
170 onefs_shadow_copy_disk_free(vfs_handle_struct *handle, const char *path,
171 bool small_query, uint64_t *bsize, uint64_t *dfree,
172 uint64_t *dsize)
175 SHADOW_NEXT(DISK_FREE,
176 (handle, cpath ?: path, small_query, bsize, dfree, dsize),
177 uint64_t);
181 static int
182 onefs_shadow_copy_statvfs(struct vfs_handle_struct *handle, const char *path,
183 struct vfs_statvfs_struct *statbuf)
185 SHADOW_NEXT(STATVFS,
186 (handle, cpath ?: path, statbuf),
187 int);
190 static SMB_STRUCT_DIR *
191 onefs_shadow_copy_opendir(vfs_handle_struct *handle, const char *path,
192 const char *mask, uint32_t attr)
194 SHADOW_NEXT(OPENDIR,
195 (handle, cpath ?: path, mask, attr),
196 SMB_STRUCT_DIR *);
199 static int
200 onefs_shadow_copy_mkdir(vfs_handle_struct *handle, const char *path,
201 mode_t mode)
203 SHADOW_NEXT(MKDIR,
204 (handle, cpath ?: path, mode),
205 int);
208 static int
209 onefs_shadow_copy_rmdir(vfs_handle_struct *handle, const char *path)
211 SHADOW_NEXT(RMDIR,
212 (handle, cpath ?: path),
213 int);
216 static int
217 onefs_shadow_copy_open(vfs_handle_struct *handle,
218 struct smb_filename *smb_fname, files_struct *fsp,
219 int flags, mode_t mode)
221 SHADOW_NEXT_SMB_FNAME(OPEN,
222 (handle, smb_fname, fsp, flags, mode),
223 int);
226 static NTSTATUS
227 onefs_shadow_copy_create_file(vfs_handle_struct *handle,
228 struct smb_request *req,
229 uint16_t root_dir_fid,
230 struct smb_filename *smb_fname,
231 uint32_t access_mask,
232 uint32_t share_access,
233 uint32_t create_disposition,
234 uint32_t create_options,
235 uint32_t file_attributes,
236 uint32_t oplock_request,
237 uint64_t allocation_size,
238 struct security_descriptor *sd,
239 struct ea_list *ea_list,
240 files_struct **result,
241 int *pinfo)
243 SHADOW_NEXT_SMB_FNAME(CREATE_FILE,
244 (handle, req, root_dir_fid, smb_fname,
245 access_mask, share_access,
246 create_disposition, create_options,
247 file_attributes, oplock_request,
248 allocation_size, sd, ea_list, result, pinfo),
249 NTSTATUS);
253 * XXX: macro-ize
255 static int
256 onefs_shadow_copy_rename(vfs_handle_struct *handle,
257 const struct smb_filename *smb_fname_src,
258 const struct smb_filename *smb_fname_dst)
260 char *old_cpath = NULL;
261 char *old_snap_component = NULL;
262 char *new_cpath = NULL;
263 char *new_snap_component = NULL;
264 struct smb_filename *smb_fname_src_tmp = NULL;
265 struct smb_filename *smb_fname_dst_tmp = NULL;
266 NTSTATUS status;
267 int ret = -1;
269 status = copy_smb_filename(talloc_tos(), smb_fname_src,
270 &smb_fname_src_tmp);
271 if (!NT_STATUS_IS_OK(status)) {
272 errno = map_errno_from_nt_status(status);
273 goto out;
275 status = copy_smb_filename(talloc_tos(), smb_fname_dst,
276 &smb_fname_dst_tmp);
277 if (!NT_STATUS_IS_OK(status)) {
278 errno = map_errno_from_nt_status(status);
279 goto out;
282 if (shadow_copy_match_name(smb_fname_src_tmp->base_name,
283 &old_snap_component)) {
284 old_cpath = osc_canonicalize_path(smb_fname_src_tmp->base_name,
285 old_snap_component);
286 smb_fname_src_tmp->base_name = old_cpath;
289 if (shadow_copy_match_name(smb_fname_dst_tmp->base_name,
290 &new_snap_component)) {
291 new_cpath = osc_canonicalize_path(smb_fname_dst_tmp->base_name,
292 new_snap_component);
293 smb_fname_dst_tmp->base_name = new_cpath;
296 ret = SMB_VFS_NEXT_RENAME(handle, smb_fname_src_tmp,
297 smb_fname_dst_tmp);
299 out:
300 SAFE_FREE(old_cpath);
301 SAFE_FREE(new_cpath);
302 TALLOC_FREE(smb_fname_src_tmp);
303 TALLOC_FREE(smb_fname_dst_tmp);
305 return ret;
308 static int
309 onefs_shadow_copy_stat(vfs_handle_struct *handle,
310 struct smb_filename *smb_fname)
312 SHADOW_NEXT_SMB_FNAME(STAT,
313 (handle, smb_fname),
314 int);
317 static int
318 onefs_shadow_copy_lstat(vfs_handle_struct *handle,
319 struct smb_filename *smb_fname)
321 SHADOW_NEXT_SMB_FNAME(LSTAT,
322 (handle, smb_fname),
323 int);
326 static int
327 onefs_shadow_copy_unlink(vfs_handle_struct *handle, const char *path)
329 SHADOW_NEXT(UNLINK,
330 (handle, cpath ?: path),
331 int);
334 static int
335 onefs_shadow_copy_chmod(vfs_handle_struct *handle, const char *path,
336 mode_t mode)
338 SHADOW_NEXT(CHMOD,
339 (handle, cpath ?: path, mode),
340 int);
343 static int
344 onefs_shadow_copy_chown(vfs_handle_struct *handle, const char *path,
345 uid_t uid, gid_t gid)
347 SHADOW_NEXT(CHOWN,
348 (handle, cpath ?: path, uid, gid),
349 int);
352 static int
353 onefs_shadow_copy_lchown(vfs_handle_struct *handle, const char *path,
354 uid_t uid, gid_t gid)
356 SHADOW_NEXT(LCHOWN,
357 (handle, cpath ?: path, uid, gid),
358 int);
361 static int
362 onefs_shadow_copy_chdir(vfs_handle_struct *handle, const char *path)
364 SHADOW_NEXT(CHDIR,
365 (handle, cpath ?: path),
366 int);
369 static int
370 onefs_shadow_copy_ntimes(vfs_handle_struct *handle, const char *path,
371 struct smb_file_time *ft)
373 SHADOW_NEXT(NTIMES,
374 (handle, cpath ?: path, ft),
375 int);
380 * XXX: macro-ize
382 static bool
383 onefs_shadow_copy_symlink(vfs_handle_struct *handle,
384 const char *oldpath, const char *newpath)
386 char *old_cpath = NULL;
387 char *old_snap_component = NULL;
388 char *new_cpath = NULL;
389 char *new_snap_component = NULL;
390 bool ret;
392 if (shadow_copy_match_name(oldpath, &old_snap_component))
393 old_cpath = osc_canonicalize_path(oldpath, old_snap_component);
395 if (shadow_copy_match_name(newpath, &new_snap_component))
396 new_cpath = osc_canonicalize_path(newpath, new_snap_component);
398 ret = SMB_VFS_NEXT_SYMLINK(handle, old_cpath ?: oldpath,
399 new_cpath ?: newpath);
401 SAFE_FREE(old_cpath);
402 SAFE_FREE(new_cpath);
404 return ret;
407 static bool
408 onefs_shadow_copy_readlink(vfs_handle_struct *handle, const char *path,
409 char *buf, size_t bufsiz)
411 SHADOW_NEXT(READLINK,
412 (handle, cpath ?: path, buf, bufsiz),
413 bool);
417 * XXX: macro-ize
419 static int
420 onefs_shadow_copy_link(vfs_handle_struct *handle, const char *oldpath,
421 const char *newpath)
423 char *old_cpath = NULL;
424 char *old_snap_component = NULL;
425 char *new_cpath = NULL;
426 char *new_snap_component = NULL;
427 int ret;
429 if (shadow_copy_match_name(oldpath, &old_snap_component))
430 old_cpath = osc_canonicalize_path(oldpath, old_snap_component);
432 if (shadow_copy_match_name(newpath, &new_snap_component))
433 new_cpath = osc_canonicalize_path(newpath, new_snap_component);
435 ret = SMB_VFS_NEXT_LINK(handle, old_cpath ?: oldpath,
436 new_cpath ?: newpath);
438 SAFE_FREE(old_cpath);
439 SAFE_FREE(new_cpath);
441 return ret;
444 static int
445 onefs_shadow_copy_mknod(vfs_handle_struct *handle, const char *path,
446 mode_t mode, SMB_DEV_T dev)
448 SHADOW_NEXT(MKNOD,
449 (handle, cpath ?: path, mode, dev),
450 int);
453 static char *
454 onefs_shadow_copy_realpath(vfs_handle_struct *handle, const char *path,
455 char *resolved_path)
457 SHADOW_NEXT(REALPATH,
458 (handle, cpath ?: path, resolved_path),
459 char *);
462 static int onefs_shadow_copy_chflags(struct vfs_handle_struct *handle,
463 const char *path, unsigned int flags)
465 SHADOW_NEXT(CHFLAGS,
466 (handle, cpath ?: path, flags),
467 int);
470 static NTSTATUS
471 onefs_shadow_copy_streaminfo(struct vfs_handle_struct *handle,
472 struct files_struct *fsp,
473 const char *path,
474 TALLOC_CTX *mem_ctx,
475 unsigned int *num_streams,
476 struct stream_struct **streams)
478 SHADOW_NEXT(STREAMINFO,
479 (handle, fsp, cpath ?: path, mem_ctx, num_streams,
480 streams),
481 NTSTATUS);
484 static int
485 onefs_shadow_copy_get_real_filename(struct vfs_handle_struct *handle,
486 const char *full_path,
487 const char *path,
488 TALLOC_CTX *mem_ctx,
489 char **found_name)
491 SHADOW_NEXT(GET_REAL_FILENAME,
492 (handle, full_path, cpath ?: path, mem_ctx, found_name),
493 int);
496 static NTSTATUS
497 onefs_shadow_copy_get_nt_acl(struct vfs_handle_struct *handle,
498 const char *path, uint32 security_info,
499 struct security_descriptor **ppdesc)
501 SHADOW_NEXT(GET_NT_ACL,
502 (handle, cpath ?: path, security_info, ppdesc),
503 NTSTATUS);
506 static int
507 onefs_shadow_copy_chmod_acl(vfs_handle_struct *handle, const char *path,
508 mode_t mode)
510 SHADOW_NEXT(CHMOD_ACL,
511 (handle, cpath ?: path, mode),
512 int);
515 static SMB_ACL_T
516 onefs_shadow_copy_sys_acl_get_file(vfs_handle_struct *handle,
517 const char *path, SMB_ACL_TYPE_T type)
519 SHADOW_NEXT(SYS_ACL_GET_FILE,
520 (handle, cpath ?: path, type),
521 SMB_ACL_T);
524 static int
525 onefs_shadow_copy_sys_acl_set_file(vfs_handle_struct *handle, const char *path,
526 SMB_ACL_TYPE_T type, SMB_ACL_T theacl)
528 SHADOW_NEXT(SYS_ACL_SET_FILE,
529 (handle, cpath ?: path, type, theacl),
530 int);
533 static int
534 onefs_shadow_copy_sys_acl_delete_def_file(vfs_handle_struct *handle,
535 const char *path)
537 SHADOW_NEXT(SYS_ACL_DELETE_DEF_FILE,
538 (handle, cpath ?: path),
539 int);
542 static ssize_t
543 onefs_shadow_copy_getxattr(vfs_handle_struct *handle, const char *path,
544 const char *name, void *value, size_t size)
546 SHADOW_NEXT(GETXATTR,
547 (handle, cpath ?: path, name, value, size),
548 ssize_t);
551 static ssize_t
552 onefs_shadow_copy_lgetxattr(vfs_handle_struct *handle, const char *path,
553 const char *name, void *value, size_t size)
555 SHADOW_NEXT(LGETXATTR,
556 (handle, cpath ?: path, name, value, size),
557 ssize_t);
560 static ssize_t
561 onefs_shadow_copy_listxattr(vfs_handle_struct *handle, const char *path,
562 char *list, size_t size)
564 SHADOW_NEXT(LISTXATTR,
565 (handle, cpath ?: path, list, size),
566 ssize_t);
569 static ssize_t
570 onefs_shadow_copy_llistxattr(vfs_handle_struct *handle, const char *path,
571 char *list, size_t size)
573 SHADOW_NEXT(LLISTXATTR,
574 (handle, cpath ?: path, list, size),
575 ssize_t);
578 static int
579 onefs_shadow_copy_removexattr(vfs_handle_struct *handle, const char *path,
580 const char *name)
582 SHADOW_NEXT(REMOVEXATTR,
583 (handle, cpath ?: path, name),
584 int);
587 static int
588 onefs_shadow_copy_lremovexattr(vfs_handle_struct *handle, const char *path,
589 const char *name)
591 SHADOW_NEXT(LREMOVEXATTR,
592 (handle, cpath ?: path, name),
593 int);
596 static int
597 onefs_shadow_copy_setxattr(vfs_handle_struct *handle, const char *path,
598 const char *name, const void *value, size_t size,
599 int flags)
601 SHADOW_NEXT(SETXATTR,
602 (handle, cpath ?: path, name, value, size, flags),
603 int);
606 static int
607 onefs_shadow_copy_lsetxattr(vfs_handle_struct *handle, const char *path,
608 const char *name, const void *value, size_t size,
609 int flags)
611 SHADOW_NEXT(LSETXATTR,
612 (handle, cpath ?: path, name, value, size, flags),
613 int);
616 static bool
617 onefs_shadow_copy_is_offline(struct vfs_handle_struct *handle,
618 const char *path, SMB_STRUCT_STAT *sbuf)
620 SHADOW_NEXT(IS_OFFLINE,
621 (handle, cpath ?: path, sbuf),
622 bool);
625 static int
626 onefs_shadow_copy_set_offline(struct vfs_handle_struct *handle,
627 const char *path)
629 SHADOW_NEXT(SET_OFFLINE,
630 (handle, cpath ?: path),
631 int);
634 /* VFS operations structure */
636 static vfs_op_tuple onefs_shadow_copy_ops[] = {
638 /* Disk operations */
640 {SMB_VFS_OP(onefs_shadow_copy_disk_free), SMB_VFS_OP_DISK_FREE,
641 SMB_VFS_LAYER_TRANSPARENT},
642 {SMB_VFS_OP(onefs_shadow_copy_get_shadow_copy_data),
643 SMB_VFS_OP_GET_SHADOW_COPY_DATA, SMB_VFS_LAYER_OPAQUE},
644 {SMB_VFS_OP(onefs_shadow_copy_statvfs), SMB_VFS_OP_STATVFS,
645 SMB_VFS_LAYER_TRANSPARENT},
647 /* Directory operations */
649 {SMB_VFS_OP(onefs_shadow_copy_opendir), SMB_VFS_OP_OPENDIR,
650 SMB_VFS_LAYER_TRANSPARENT},
651 {SMB_VFS_OP(onefs_shadow_copy_mkdir), SMB_VFS_OP_MKDIR,
652 SMB_VFS_LAYER_TRANSPARENT},
653 {SMB_VFS_OP(onefs_shadow_copy_rmdir), SMB_VFS_OP_RMDIR,
654 SMB_VFS_LAYER_TRANSPARENT},
656 /* File operations */
658 {SMB_VFS_OP(onefs_shadow_copy_open), SMB_VFS_OP_OPEN,
659 SMB_VFS_LAYER_TRANSPARENT},
660 {SMB_VFS_OP(onefs_shadow_copy_create_file), SMB_VFS_OP_CREATE_FILE,
661 SMB_VFS_LAYER_TRANSPARENT},
662 {SMB_VFS_OP(onefs_shadow_copy_rename), SMB_VFS_OP_RENAME,
663 SMB_VFS_LAYER_TRANSPARENT},
664 {SMB_VFS_OP(onefs_shadow_copy_stat), SMB_VFS_OP_STAT,
665 SMB_VFS_LAYER_TRANSPARENT},
666 {SMB_VFS_OP(onefs_shadow_copy_stat), SMB_VFS_OP_STAT,
667 SMB_VFS_LAYER_TRANSPARENT},
668 {SMB_VFS_OP(onefs_shadow_copy_lstat), SMB_VFS_OP_LSTAT,
669 SMB_VFS_LAYER_TRANSPARENT},
670 {SMB_VFS_OP(onefs_shadow_copy_unlink), SMB_VFS_OP_UNLINK,
671 SMB_VFS_LAYER_TRANSPARENT},
672 {SMB_VFS_OP(onefs_shadow_copy_chmod), SMB_VFS_OP_CHMOD,
673 SMB_VFS_LAYER_TRANSPARENT},
674 {SMB_VFS_OP(onefs_shadow_copy_chown), SMB_VFS_OP_CHOWN,
675 SMB_VFS_LAYER_TRANSPARENT},
676 {SMB_VFS_OP(onefs_shadow_copy_lchown), SMB_VFS_OP_LCHOWN,
677 SMB_VFS_LAYER_TRANSPARENT},
678 {SMB_VFS_OP(onefs_shadow_copy_chdir), SMB_VFS_OP_CHDIR,
679 SMB_VFS_LAYER_TRANSPARENT},
680 {SMB_VFS_OP(onefs_shadow_copy_ntimes), SMB_VFS_OP_NTIMES,
681 SMB_VFS_LAYER_TRANSPARENT},
682 {SMB_VFS_OP(onefs_shadow_copy_symlink), SMB_VFS_OP_SYMLINK,
683 SMB_VFS_LAYER_TRANSPARENT},
684 {SMB_VFS_OP(onefs_shadow_copy_readlink), SMB_VFS_OP_READLINK,
685 SMB_VFS_LAYER_TRANSPARENT},
686 {SMB_VFS_OP(onefs_shadow_copy_link), SMB_VFS_OP_LINK,
687 SMB_VFS_LAYER_TRANSPARENT},
688 {SMB_VFS_OP(onefs_shadow_copy_mknod), SMB_VFS_OP_MKNOD,
689 SMB_VFS_LAYER_TRANSPARENT},
690 {SMB_VFS_OP(onefs_shadow_copy_realpath), SMB_VFS_OP_REALPATH,
691 SMB_VFS_LAYER_TRANSPARENT},
692 {SMB_VFS_OP(onefs_shadow_copy_chflags), SMB_VFS_OP_CHFLAGS,
693 SMB_VFS_LAYER_TRANSPARENT},
694 {SMB_VFS_OP(onefs_shadow_copy_streaminfo), SMB_VFS_OP_STREAMINFO,
695 SMB_VFS_LAYER_TRANSPARENT},
696 {SMB_VFS_OP(onefs_shadow_copy_get_real_filename),
697 SMB_VFS_OP_GET_REAL_FILENAME, SMB_VFS_LAYER_TRANSPARENT},
699 /* NT File ACL operations */
701 {SMB_VFS_OP(onefs_shadow_copy_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,
702 SMB_VFS_LAYER_TRANSPARENT},
704 /* POSIX ACL operations */
706 {SMB_VFS_OP(onefs_shadow_copy_chmod_acl), SMB_VFS_OP_CHMOD_ACL,
707 SMB_VFS_LAYER_TRANSPARENT},
708 {SMB_VFS_OP(onefs_shadow_copy_sys_acl_get_file),
709 SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT},
710 {SMB_VFS_OP(onefs_shadow_copy_sys_acl_set_file),
711 SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT},
712 {SMB_VFS_OP(onefs_shadow_copy_sys_acl_delete_def_file),
713 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT},
715 /* EA operations. */
717 {SMB_VFS_OP(onefs_shadow_copy_getxattr), SMB_VFS_OP_GETXATTR,
718 SMB_VFS_LAYER_TRANSPARENT},
719 {SMB_VFS_OP(onefs_shadow_copy_lgetxattr), SMB_VFS_OP_LGETXATTR,
720 SMB_VFS_LAYER_TRANSPARENT},
721 {SMB_VFS_OP(onefs_shadow_copy_listxattr), SMB_VFS_OP_LISTXATTR,
722 SMB_VFS_LAYER_TRANSPARENT},
723 {SMB_VFS_OP(onefs_shadow_copy_llistxattr), SMB_VFS_OP_LLISTXATTR,
724 SMB_VFS_LAYER_TRANSPARENT},
725 {SMB_VFS_OP(onefs_shadow_copy_removexattr), SMB_VFS_OP_REMOVEXATTR,
726 SMB_VFS_LAYER_TRANSPARENT},
727 {SMB_VFS_OP(onefs_shadow_copy_lremovexattr), SMB_VFS_OP_LREMOVEXATTR,
728 SMB_VFS_LAYER_TRANSPARENT},
729 {SMB_VFS_OP(onefs_shadow_copy_setxattr), SMB_VFS_OP_SETXATTR,
730 SMB_VFS_LAYER_TRANSPARENT},
731 {SMB_VFS_OP(onefs_shadow_copy_lsetxattr), SMB_VFS_OP_LSETXATTR,
732 SMB_VFS_LAYER_TRANSPARENT},
734 /* offline operations */
735 {SMB_VFS_OP(onefs_shadow_copy_is_offline), SMB_VFS_OP_IS_OFFLINE,
736 SMB_VFS_LAYER_TRANSPARENT},
737 {SMB_VFS_OP(onefs_shadow_copy_set_offline), SMB_VFS_OP_SET_OFFLINE,
738 SMB_VFS_LAYER_TRANSPARENT},
740 {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
743 NTSTATUS vfs_shadow_copy_init(void)
745 NTSTATUS ret;
747 ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
748 "onefs_shadow_copy",
749 onefs_shadow_copy_ops);
751 if (!NT_STATUS_IS_OK(ret))
752 return ret;
754 vfs_onefs_shadow_copy_debug_level = debug_add_class("onefs_shadow_copy");
756 if (vfs_onefs_shadow_copy_debug_level == -1) {
757 vfs_onefs_shadow_copy_debug_level = DBGC_VFS;
758 DEBUG(0, ("Couldn't register custom debugging class!\n"));
759 } else {
760 DEBUG(10, ("Debug class number of 'onefs_shadow_copy': %d\n",
761 vfs_onefs_shadow_copy_debug_level));
764 return ret;