server: Move the server part of device unmounting to the ioctl processing.

This commit is contained in:
Alexandre Julliard 2007-04-16 14:54:52 +02:00
parent 8c46095484
commit 2669af73df
7 changed files with 20 additions and 60 deletions

View File

@ -2034,14 +2034,6 @@ NTSTATUS DIR_unmount_device( HANDLE handle )
NTSTATUS status;
int unix_fd, needs_close;
SERVER_START_REQ( unmount_device )
{
req->handle = handle;
status = wine_server_call( req );
}
SERVER_END_REQ;
if (status) return status;
if (!(status = server_get_unix_fd( handle, 0, &unix_fd, &needs_close, NULL, NULL )))
{
struct stat st;

View File

@ -1064,7 +1064,9 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
switch(code)
{
case FSCTL_DISMOUNT_VOLUME:
status = DIR_unmount_device( handle );
status = server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
if (!status) status = DIR_unmount_device( handle );
break;
case FSCTL_PIPE_LISTEN:

View File

@ -1140,18 +1140,6 @@ struct unlock_file_reply
struct unmount_device_request
{
struct request_header __header;
obj_handle_t handle;
};
struct unmount_device_reply
{
struct reply_header __header;
};
struct create_socket_request
{
struct request_header __header;
@ -4052,7 +4040,6 @@ enum request
REQ_flush_file,
REQ_lock_file,
REQ_unlock_file,
REQ_unmount_device,
REQ_create_socket,
REQ_accept_socket,
REQ_set_socket_event,
@ -4276,7 +4263,6 @@ union generic_request
struct flush_file_request flush_file_request;
struct lock_file_request lock_file_request;
struct unlock_file_request unlock_file_request;
struct unmount_device_request unmount_device_request;
struct create_socket_request create_socket_request;
struct accept_socket_request accept_socket_request;
struct set_socket_event_request set_socket_event_request;
@ -4498,7 +4484,6 @@ union generic_reply
struct flush_file_reply flush_file_reply;
struct lock_file_reply lock_file_reply;
struct unlock_file_reply unlock_file_reply;
struct unmount_device_reply unmount_device_reply;
struct create_socket_reply create_socket_reply;
struct accept_socket_reply accept_socket_reply;
struct set_socket_event_reply set_socket_event_reply;
@ -4675,6 +4660,6 @@ union generic_reply
struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply;
};
#define SERVER_PROTOCOL_VERSION 294
#define SERVER_PROTOCOL_VERSION 295
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -77,6 +77,7 @@
#include "request.h"
#include "winternl.h"
#include "winioctl.h"
#if defined(HAVE_SYS_EPOLL_H) && defined(HAVE_EPOLL_CREATE)
# include <sys/epoll.h>
@ -1686,13 +1687,6 @@ void default_poll_event( struct fd *fd, int event )
else if (!fd->inode) set_fd_events( fd, fd->fd_ops->get_poll_events( fd ) );
}
/* default ioctl() routine */
void default_fd_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
const void *data, data_size_t size )
{
set_error( STATUS_NOT_SUPPORTED );
}
struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type, int count )
{
struct async_queue *queue;
@ -1833,6 +1827,21 @@ static void unmount_device( struct fd *device_fd )
release_object( device );
}
/* default ioctl() routine */
void default_fd_ioctl( struct fd *fd, unsigned int code, const async_data_t *async,
const void *data, data_size_t size )
{
switch(code)
{
case FSCTL_DISMOUNT_VOLUME:
unmount_device( fd );
break;
default:
set_error( STATUS_NOT_SUPPORTED );
break;
}
}
/* same as get_handle_obj but retrieve the struct fd associated to the object */
static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handle,
unsigned int access )
@ -1913,18 +1922,6 @@ DECL_HANDLER(get_handle_fd)
}
}
/* get ready to unmount a Unix device */
DECL_HANDLER(unmount_device)
{
struct fd *fd;
if ((fd = get_handle_fd_obj( current->process, req->handle, 0 )))
{
unmount_device( fd );
release_object( fd );
}
}
/* perform an ioctl on a file */
DECL_HANDLER(ioctl)
{

View File

@ -936,12 +936,6 @@ enum server_fd_type
@END
/* Get ready to unmount a Unix device */
@REQ(unmount_device)
obj_handle_t handle; /* handle to a file on the device */
@END
/* Create a socket */
@REQ(create_socket)
unsigned int access; /* wanted access rights */

View File

@ -152,7 +152,6 @@ DECL_HANDLER(get_handle_fd);
DECL_HANDLER(flush_file);
DECL_HANDLER(lock_file);
DECL_HANDLER(unlock_file);
DECL_HANDLER(unmount_device);
DECL_HANDLER(create_socket);
DECL_HANDLER(accept_socket);
DECL_HANDLER(set_socket_event);
@ -375,7 +374,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_flush_file,
(req_handler)req_lock_file,
(req_handler)req_unlock_file,
(req_handler)req_unmount_device,
(req_handler)req_create_socket,
(req_handler)req_accept_socket,
(req_handler)req_set_socket_event,

View File

@ -1321,11 +1321,6 @@ static void dump_unlock_file_request( const struct unlock_file_request *req )
fprintf( stderr, " count_high=%08x", req->count_high );
}
static void dump_unmount_device_request( const struct unmount_device_request *req )
{
fprintf( stderr, " handle=%p", req->handle );
}
static void dump_create_socket_request( const struct create_socket_request *req )
{
fprintf( stderr, " access=%08x,", req->access );
@ -3509,7 +3504,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_flush_file_request,
(dump_func)dump_lock_file_request,
(dump_func)dump_unlock_file_request,
(dump_func)dump_unmount_device_request,
(dump_func)dump_create_socket_request,
(dump_func)dump_accept_socket_request,
(dump_func)dump_set_socket_event_request,
@ -3729,7 +3723,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_flush_file_reply,
(dump_func)dump_lock_file_reply,
(dump_func)0,
(dump_func)0,
(dump_func)dump_create_socket_reply,
(dump_func)dump_accept_socket_reply,
(dump_func)0,
@ -3949,7 +3942,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"flush_file",
"lock_file",
"unlock_file",
"unmount_device",
"create_socket",
"accept_socket",
"set_socket_event",