2004-10-26 08:35:29 +00:00
/*
Unix SMB / CIFS implementation .
POSIX NTVFS backend - open and close
Copyright ( C ) Andrew Tridgell 2004
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 02:07:03 +00:00
the Free Software Foundation ; either version 3 of the License , or
2004-10-26 08:35:29 +00:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 02:07:03 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2004-10-26 08:35:29 +00:00
*/
2004-11-05 07:24:25 +00:00
# include "includes.h"
2004-10-26 08:35:29 +00:00
# include "vfs_posix.h"
2006-02-23 15:52:24 +00:00
# include "libcli/raw/ioctl.h"
2004-10-26 08:35:29 +00:00
/*
old ioctl interface
*/
static NTSTATUS pvfs_ioctl_old ( struct ntvfs_module_context * ntvfs ,
2006-03-10 14:31:17 +00:00
struct ntvfs_request * req , union smb_ioctl * io )
2004-10-26 08:35:29 +00:00
{
2005-07-04 05:24:39 +00:00
return NT_STATUS_DOS ( ERRSRV , ERRerror ) ;
2004-10-26 08:35:29 +00:00
}
/*
nt ioctl interface
*/
static NTSTATUS pvfs_ntioctl ( struct ntvfs_module_context * ntvfs ,
2006-03-10 14:31:17 +00:00
struct ntvfs_request * req , union smb_ioctl * io )
2004-10-26 08:35:29 +00:00
{
2009-02-04 08:52:41 +01:00
struct pvfs_state * pvfs = talloc_get_type ( ntvfs - > private_data ,
struct pvfs_state ) ;
2004-10-26 08:35:29 +00:00
struct pvfs_file * f ;
2006-05-20 08:15:22 +00:00
f = pvfs_find_fd ( pvfs , req , io - > ntioctl . in . file . ntvfs ) ;
2004-10-26 08:35:29 +00:00
if ( ! f ) {
return NT_STATUS_INVALID_HANDLE ;
}
switch ( io - > ntioctl . in . function ) {
case FSCTL_SET_SPARSE :
/* maybe some posix systems have a way of marking
a file non - sparse ? */
2004-10-26 09:31:11 +00:00
io - > ntioctl . out . blob = data_blob ( NULL , 0 ) ;
2004-10-26 08:35:29 +00:00
return NT_STATUS_OK ;
}
return NT_STATUS_NOT_SUPPORTED ;
}
/*
ioctl interface
*/
NTSTATUS pvfs_ioctl ( struct ntvfs_module_context * ntvfs ,
2006-03-10 20:49:20 +00:00
struct ntvfs_request * req ,
union smb_ioctl * io )
2004-10-26 08:35:29 +00:00
{
switch ( io - > generic . level ) {
case RAW_IOCTL_IOCTL :
2006-05-20 09:54:10 +00:00
return pvfs_ioctl_old ( ntvfs , req , io ) ;
2004-10-26 08:35:29 +00:00
case RAW_IOCTL_NTIOCTL :
2006-05-20 09:54:10 +00:00
return pvfs_ntioctl ( ntvfs , req , io ) ;
2006-07-09 09:50:41 +00:00
case RAW_IOCTL_SMB2 :
2006-07-10 14:01:53 +00:00
case RAW_IOCTL_SMB2_NO_HANDLE :
2008-05-29 20:46:18 +10:00
/* see WSPP SMB2 test 46 */
return NT_STATUS_INVALID_DEVICE_REQUEST ;
2004-10-26 08:35:29 +00:00
}
2006-05-20 09:54:10 +00:00
return NT_STATUS_INVALID_LEVEL ;
2004-10-26 08:35:29 +00:00
}