1 | /*
|
---|
2 | * TEST implementation of an Shadow Copy module
|
---|
3 | *
|
---|
4 | * Copyright (C) Stefan Metzmacher 2003
|
---|
5 | *
|
---|
6 | * This program is free software; you can redistribute it and/or modify
|
---|
7 | * it under the terms of the GNU General Public License as published by
|
---|
8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
9 | * (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This program is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | * GNU General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU General Public License
|
---|
17 | * along with this program; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include "includes.h"
|
---|
22 |
|
---|
23 | #undef DBGC_CLASS
|
---|
24 | #define DBGC_CLASS DBGC_VFS
|
---|
25 |
|
---|
26 | /* USE THIS MODULE ONLY FOR TESTING!!!! */
|
---|
27 |
|
---|
28 | /*
|
---|
29 | For this share
|
---|
30 | Z:\
|
---|
31 |
|
---|
32 | the ShadowCopies are in this directories
|
---|
33 |
|
---|
34 | Z:\@GMT-2003.08.05-12.00.00\
|
---|
35 | Z:\@GMT-2003.08.05-12.01.00\
|
---|
36 | Z:\@GMT-2003.08.05-12.02.00\
|
---|
37 |
|
---|
38 | e.g.
|
---|
39 |
|
---|
40 | Z:\testfile.txt
|
---|
41 | Z:\@GMT-2003.08.05-12.02.00\testfile.txt
|
---|
42 |
|
---|
43 | or:
|
---|
44 |
|
---|
45 | Z:\testdir\testfile.txt
|
---|
46 | Z:\@GMT-2003.08.05-12.02.00\testdir\testfile.txt
|
---|
47 |
|
---|
48 |
|
---|
49 | Note: Files must differ to be displayed via Windows Explorer!
|
---|
50 | Directories are always displayed...
|
---|
51 | */
|
---|
52 |
|
---|
53 | static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels)
|
---|
54 | {
|
---|
55 | uint32 num = 3;
|
---|
56 | uint32 i;
|
---|
57 |
|
---|
58 | shadow_copy_data->num_volumes = num;
|
---|
59 |
|
---|
60 | if (labels) {
|
---|
61 | if (num) {
|
---|
62 | shadow_copy_data->labels = TALLOC_ZERO_ARRAY(shadow_copy_data->mem_ctx,SHADOW_COPY_LABEL,num);
|
---|
63 | } else {
|
---|
64 | shadow_copy_data->labels = NULL;
|
---|
65 | }
|
---|
66 | for (i=0;i<num;i++) {
|
---|
67 | snprintf(shadow_copy_data->labels[i], sizeof(SHADOW_COPY_LABEL), "@GMT-2003.08.05-12.%02u.00",i);
|
---|
68 | }
|
---|
69 | } else {
|
---|
70 | shadow_copy_data->labels = NULL;
|
---|
71 | }
|
---|
72 |
|
---|
73 | return 0;
|
---|
74 | }
|
---|
75 |
|
---|
76 | /* VFS operations structure */
|
---|
77 |
|
---|
78 | static vfs_op_tuple shadow_copy_test_ops[] = {
|
---|
79 | {SMB_VFS_OP(test_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE},
|
---|
80 |
|
---|
81 | {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
|
---|
82 | };
|
---|
83 |
|
---|
84 | NTSTATUS init_module(void)
|
---|
85 | {
|
---|
86 | return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "shadow_copy_test", shadow_copy_test_ops);
|
---|
87 | }
|
---|