~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to examples/VFS/shadow_copy_test.c

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 3 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, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#include "includes.h"
 
21
 
 
22
#undef DBGC_CLASS
 
23
#define DBGC_CLASS DBGC_VFS
 
24
 
 
25
/* USE THIS MODULE ONLY FOR TESTING!!!! */
 
26
 
 
27
/*    
 
28
    For this share
 
29
    Z:\
 
30
 
 
31
    the ShadowCopies are in this directories
 
32
 
 
33
    Z:\@GMT-2003.08.05-12.00.00\
 
34
    Z:\@GMT-2003.08.05-12.01.00\
 
35
    Z:\@GMT-2003.08.05-12.02.00\
 
36
 
 
37
    e.g.
 
38
    
 
39
    Z:\testfile.txt
 
40
    Z:\@GMT-2003.08.05-12.02.00\testfile.txt
 
41
 
 
42
    or:
 
43
 
 
44
    Z:\testdir\testfile.txt
 
45
    Z:\@GMT-2003.08.05-12.02.00\testdir\testfile.txt
 
46
 
 
47
 
 
48
    Note: Files must differ to be displayed via Windows Explorer!
 
49
          Directories are always displayed...    
 
50
*/
 
51
 
 
52
static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels)
 
53
{
 
54
        uint32 num = 3;
 
55
        uint32 i;
 
56
        
 
57
        shadow_copy_data->num_volumes = num;
 
58
        
 
59
        if (labels) {   
 
60
                if (num) {
 
61
                        shadow_copy_data->labels = TALLOC_ZERO_ARRAY(shadow_copy_data->mem_ctx,SHADOW_COPY_LABEL,num);
 
62
                } else {
 
63
                        shadow_copy_data->labels = NULL;
 
64
                }
 
65
                for (i=0;i<num;i++) {
 
66
                        snprintf(shadow_copy_data->labels[i], sizeof(SHADOW_COPY_LABEL), "@GMT-2003.08.05-12.%02u.00",i);
 
67
                }
 
68
        } else {
 
69
                shadow_copy_data->labels = NULL;
 
70
        }
 
71
 
 
72
        return 0;
 
73
}
 
74
 
 
75
/* VFS operations structure */
 
76
 
 
77
static vfs_op_tuple shadow_copy_test_ops[] = {  
 
78
        {SMB_VFS_OP(test_get_shadow_copy_data), SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE},
 
79
 
 
80
        {SMB_VFS_OP(NULL),                      SMB_VFS_OP_NOOP,                SMB_VFS_LAYER_NOOP}
 
81
};
 
82
 
 
83
NTSTATUS init_module(void)
 
84
{
 
85
        return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "shadow_copy_test", shadow_copy_test_ops);
 
86
}