r19647: Add some GPFS support in a vfs mod. Also adds the kernel flock op to
[tprouty/samba.git] / source / modules / vfs_gpfs.c
1 /*
2    Unix SMB/CIFS implementation.
3    Wrap gpfs calls in vfs functions.
4  
5    Copyright (C) Christian Ambach <cambach1@de.ibm.com> 2006
6    
7    Major code contributions by Chetan Shringarpure <chetan.sh@in.ibm.com>
8    
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.
13    
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.
18    
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.
22   
23
24 */
25
26 #include "includes.h"
27
28
29 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, 
30                                  int fd, uint32 share_mode)
31 {
32
33         START_PROFILE(syscall_kernel_flock);
34
35         kernel_flock(fsp->fh->fd, share_mode);
36
37         if (!set_gpfs_sharemode(fsp, fsp->access_mask, fsp->share_access)) {
38
39                 return -1;
40
41         }
42
43         END_PROFILE(syscall_kernel_flock);
44
45         return 0;
46 }
47
48
49 static vfs_op_tuple gpfs_op_tuples[] = {
50
51         {SMB_VFS_OP(vfs_gpfs_kernel_flock),
52          SMB_VFS_OP_KERNEL_FLOCK,
53          SMB_VFS_LAYER_OPAQUE},
54
55         {SMB_VFS_OP(NULL),
56          SMB_VFS_OP_NOOP,
57          SMB_VFS_LAYER_NOOP}
58
59 };
60
61
62 NTSTATUS vfs_gpfs_init(void)
63 {
64         init_gpfs();
65         
66         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "gpfs",
67                                 gpfs_op_tuples);
68 }