LCOV - code coverage report
Current view: top level - examples/VFS - shadow_copy_test.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 2 13 15.4 %
Date: 2024-04-21 15:09:00 Functions: 1 2 50.0 %

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

Generated by: LCOV version 1.14