r13658: More moving around of files:
[bbaumbach/samba-autobuild/.git] / source4 / ntvfs / posix / pvfs_ioctl.c
1 /* 
2    Unix SMB/CIFS implementation.
3
4    POSIX NTVFS backend - open and close
5
6    Copyright (C) Andrew Tridgell 2004
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "vfs_posix.h"
25 #include "libcli/raw/ioctl.h"
26
27 /*
28   old ioctl interface 
29 */
30 static NTSTATUS pvfs_ioctl_old(struct ntvfs_module_context *ntvfs,
31                         struct smbsrv_request *req, union smb_ioctl *io)
32 {
33         return NT_STATUS_DOS(ERRSRV, ERRerror);
34 }
35
36 /*
37   nt ioctl interface 
38 */
39 static NTSTATUS pvfs_ntioctl(struct ntvfs_module_context *ntvfs,
40                              struct smbsrv_request *req, union smb_ioctl *io)
41 {
42         struct pvfs_state *pvfs = ntvfs->private_data;
43         struct pvfs_file *f;
44
45         f = pvfs_find_fd(pvfs, req, io->ntioctl.in.fnum);
46         if (!f) {
47                 return NT_STATUS_INVALID_HANDLE;
48         }
49
50         switch (io->ntioctl.in.function) {
51         case FSCTL_SET_SPARSE:
52                 /* maybe some posix systems have a way of marking
53                    a file non-sparse? */
54                 io->ntioctl.out.blob = data_blob(NULL, 0);
55                 return NT_STATUS_OK;
56         }
57
58         return NT_STATUS_NOT_SUPPORTED;
59 }
60
61 /*
62   ioctl interface 
63 */
64 NTSTATUS pvfs_ioctl(struct ntvfs_module_context *ntvfs,
65                     struct smbsrv_request *req, union smb_ioctl *io)
66 {
67         NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
68
69         switch (io->generic.level) {
70         case RAW_IOCTL_IOCTL:
71                 status = pvfs_ioctl_old(ntvfs, req, io);
72                 break;
73
74         case RAW_IOCTL_NTIOCTL:
75                 status = pvfs_ntioctl(ntvfs, req, io);
76                 break;
77         }
78
79         return status;
80 }
81