Open a real file handle for drive devices, and get rid of the server

device hacks (based on a patch by Eric Pouech).
This commit is contained in:
Alexandre Julliard 2004-03-04 23:00:18 +00:00
parent 05df86a38f
commit db692c8f39
13 changed files with 129 additions and 346 deletions

View File

@ -2,7 +2,7 @@
/* Main file for CD-ROM support /* Main file for CD-ROM support
* *
* Copyright 1994 Martin Ayotte * Copyright 1994 Martin Ayotte
* Copyright 1999, 2001 Eric Pouech * Copyright 1999, 2001, 2003 Eric Pouech
* Copyright 2000 Andreas Mohr * Copyright 2000 Andreas Mohr
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -83,6 +83,9 @@
#include "ntddstor.h" #include "ntddstor.h"
#include "ntddcdrm.h" #include "ntddcdrm.h"
#include "ntddscsi.h" #include "ntddscsi.h"
#include "ntdll_misc.h"
#include "wine/server.h"
#include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
/* Non-Linux systems do not have linux/cdrom.h and the like, and thus /* Non-Linux systems do not have linux/cdrom.h and the like, and thus
@ -183,13 +186,18 @@ struct linux_cdrom_generic_command
*/ */
struct cdrom_cache { struct cdrom_cache {
int fd; int fd;
int count; dev_t device;
ino_t inode;
char toc_good; /* if false, will reread TOC from disk */ char toc_good; /* if false, will reread TOC from disk */
CDROM_TOC toc; CDROM_TOC toc;
SUB_Q_CURRENT_POSITION CurrentPosition; SUB_Q_CURRENT_POSITION CurrentPosition;
const char *device;
}; };
static struct cdrom_cache cdrom_cache[26]; /* who has more than 5 cdroms on his/her machine ?? */
/* FIXME: this should grow depending on the number of cdroms we install/configure
* at startup
*/
#define MAX_CACHE_ENTRIES 5
static struct cdrom_cache cdrom_cache[MAX_CACHE_ENTRIES];
/* Proposed media change function: not really needed at this time */ /* Proposed media change function: not really needed at this time */
/* This is a 1 or 0 type of function */ /* This is a 1 or 0 type of function */
@ -201,7 +209,7 @@ static int CDROM_MediaChanged(int dev)
struct cdrom_tochdr hdr; struct cdrom_tochdr hdr;
struct cdrom_tocentry entry; struct cdrom_tocentry entry;
if (dev < 0 || dev >= 26) if (dev < 0 || dev >= MAX_CACHE_ENTRIES)
return 0; return 0;
if ( ioctl(cdrom_cache[dev].fd, CDROMREADTOCHDR, &hdr) == -1 ) if ( ioctl(cdrom_cache[dev].fd, CDROMREADTOCHDR, &hdr) == -1 )
return 0; return 0;
@ -365,9 +373,9 @@ static void CDROM_ClearCacheEntry(int dev)
static int CDROM_GetInterfaceInfo(int fd, int* port, int* iface, int* device,int* lun) static int CDROM_GetInterfaceInfo(int fd, int* port, int* iface, int* device,int* lun)
{ {
#if defined(linux) #if defined(linux)
{
struct stat st; struct stat st;
if ( fstat(fd, &st) == -1 || ! S_ISBLK(st.st_mode)) { if ( fstat(fd, &st) == -1 || ! S_ISBLK(st.st_mode))
{
FIXME("cdrom not a block device!!!\n"); FIXME("cdrom not a block device!!!\n");
return 0; return 0;
} }
@ -409,12 +417,12 @@ static int CDROM_GetInterfaceInfo(int fd, int* port, int* iface, int* device,int
} }
} }
return 1; return 1;
}
#elif defined(__NetBSD__) #elif defined(__NetBSD__)
{
struct scsi_addr addr; struct scsi_addr addr;
if (ioctl(fd, SCIOCIDENTIFY, &addr) != -1) { if (ioctl(fd, SCIOCIDENTIFY, &addr) != -1)
switch (addr.type) { {
switch (addr.type)
{
case TYPE_SCSI: *port = 1; case TYPE_SCSI: *port = 1;
*iface = addr.addr.scsi.scbus; *iface = addr.addr.scsi.scbus;
*device = addr.addr.scsi.target; *device = addr.addr.scsi.target;
@ -429,7 +437,6 @@ static int CDROM_GetInterfaceInfo(int fd, int* port, int* iface, int* device,int
return 1; return 1;
} }
return 0; return 0;
}
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
FIXME("not implemented for BSD\n"); FIXME("not implemented for BSD\n");
return 0; return 0;
@ -449,7 +456,7 @@ static int CDROM_GetInterfaceInfo(int fd, int* port, int* iface, int* device,int
* NOTE: programs usually read these registry entries after sending the * NOTE: programs usually read these registry entries after sending the
* IOCTL_SCSI_GET_ADDRESS ioctl to the cdrom * IOCTL_SCSI_GET_ADDRESS ioctl to the cdrom
*/ */
void CDROM_InitRegistry(int fd, int device_id, const char *device ) void CDROM_InitRegistry(int fd)
{ {
int portnum, busid, targetid, lun; int portnum, busid, targetid, lun;
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
@ -465,8 +472,6 @@ void CDROM_InitRegistry(int fd, int device_id, const char *device )
HKEY targetKey; HKEY targetKey;
DWORD disp; DWORD disp;
cdrom_cache[device_id].device = device;
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
attr.RootDirectory = 0; attr.RootDirectory = 0;
attr.ObjectName = &nameW; attr.ObjectName = &nameW;
@ -474,7 +479,7 @@ void CDROM_InitRegistry(int fd, int device_id, const char *device )
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
if ( ! CDROM_GetInterfaceInfo(fd, &portnum, &busid, &targetid, &lun)) if (!CDROM_GetInterfaceInfo(fd, &portnum, &busid, &targetid, &lun))
return; return;
/* Ensure there is Scsi key */ /* Ensure there is Scsi key */
@ -583,47 +588,35 @@ void CDROM_InitRegistry(int fd, int device_id, const char *device )
* CDROM_Open * CDROM_Open
* *
*/ */
static NTSTATUS CDROM_Open(HANDLE hDevice, DWORD clientID, int* dev) static NTSTATUS CDROM_Open(int fd, int* dev)
{ {
*dev = LOWORD(clientID); struct stat st;
int empty = -1;
if (*dev >= 26) return STATUS_NO_SUCH_DEVICE; fstat(fd, &st);
if (!cdrom_cache[*dev].count) for (*dev = 0; *dev < MAX_CACHE_ENTRIES; (*dev)++)
{ {
const char *device; if (empty == -1 &&
cdrom_cache[*dev].device == 0 &&
if (!(device = cdrom_cache[*dev].device)) return STATUS_NO_SUCH_DEVICE; cdrom_cache[*dev].inode == 0)
cdrom_cache[*dev].fd = open(device, O_RDONLY|O_NONBLOCK); empty = *dev;
if (cdrom_cache[*dev].fd == -1) else if (cdrom_cache[*dev].device == st.st_dev &&
cdrom_cache[*dev].inode == st.st_ino)
break;
}
if (*dev == MAX_CACHE_ENTRIES)
{ {
FIXME("Can't open configured CD-ROM drive %c: (device %s): %s\n", if (empty == -1) return STATUS_NOT_IMPLEMENTED;
'A' + *dev, device, strerror(errno)); *dev = empty;
return STATUS_NO_SUCH_DEVICE; cdrom_cache[*dev].device = st.st_dev;
cdrom_cache[*dev].inode = st.st_ino;
} }
} cdrom_cache[*dev].fd = fd;
cdrom_cache[*dev].count++; TRACE("%d, %d\n", *dev, cdrom_cache[*dev].fd);
TRACE("%d, %d, %d\n", *dev, cdrom_cache[*dev].fd, cdrom_cache[*dev].count);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
/******************************************************************
* CDROM_Close
*
*
*/
static void CDROM_Close(DWORD clientID)
{
int dev = LOWORD(clientID);
if (dev >= 26 /*|| fd != cdrom_cache[dev].fd*/) FIXME("how come\n");
if (--cdrom_cache[dev].count == 0)
{
close(cdrom_cache[dev].fd);
cdrom_cache[dev].fd = -1;
}
}
/****************************************************************** /******************************************************************
* CDROM_GetStatusCode * CDROM_GetStatusCode
* *
@ -752,13 +745,11 @@ static NTSTATUS CDROM_ReadTOC(int dev, CDROM_TOC* toc)
{ {
NTSTATUS ret = STATUS_NOT_SUPPORTED; NTSTATUS ret = STATUS_NOT_SUPPORTED;
if (dev < 0 || dev >= 26) if (dev < 0 || dev >= MAX_CACHE_ENTRIES)
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
if ( !cdrom_cache[dev].toc_good ) { if ( !cdrom_cache[dev].toc_good && (ret = CDROM_SyncCache(dev)))
ret = CDROM_SyncCache(dev);
if ( ret )
return ret; return ret;
}
*toc = cdrom_cache[dev].toc; *toc = cdrom_cache[dev].toc;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -1686,7 +1677,7 @@ static NTSTATUS CDROM_GetAddress(int dev, SCSI_ADDRESS* address)
* *
* *
*/ */
NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine, HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
PVOID UserApcContext, PVOID UserApcContext,
PIO_STATUS_BLOCK piosb, PIO_STATUS_BLOCK piosb,
@ -1696,15 +1687,20 @@ NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice,
{ {
DWORD sz = 0; DWORD sz = 0;
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_SUCCESS;
int dev; int fd, dev;
TRACE("%lx[%c] %s %lx %ld %lx %ld %p\n", TRACE("%lx %s %lx %ld %lx %ld %p\n",
(DWORD)hDevice, 'A' + LOWORD(clientID), iocodex(dwIoControlCode), (DWORD)lpInBuffer, nInBufferSize, (DWORD)hDevice, iocodex(dwIoControlCode), (DWORD)lpInBuffer, nInBufferSize,
(DWORD)lpOutBuffer, nOutBufferSize, piosb); (DWORD)lpOutBuffer, nOutBufferSize, piosb);
piosb->Information = 0; piosb->Information = 0;
if ((status = CDROM_Open(hDevice, clientID, &dev))) goto error; if ((status = wine_server_handle_to_fd( hDevice, GENERIC_READ, &fd, NULL, NULL ))) goto error;
if ((status = CDROM_Open(fd, &dev)))
{
wine_server_release_fd( hDevice, fd );
goto error;
}
switch (dwIoControlCode) switch (dwIoControlCode)
{ {
@ -1893,7 +1889,7 @@ NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice,
status = STATUS_INVALID_PARAMETER; status = STATUS_INVALID_PARAMETER;
break; break;
} }
CDROM_Close(clientID); wine_server_release_fd( hDevice, fd );
error: error:
piosb->u.Status = status; piosb->u.Status = status;
piosb->Information = sz; piosb->Information = sz;

View File

@ -665,24 +665,12 @@ NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE DeviceHandle, HANDLE hEvent,
PVOID OutputBuffer, PVOID OutputBuffer,
ULONG OutputBufferSize) ULONG OutputBufferSize)
{ {
DWORD clientID = 0;
TRACE("(%p,%p,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx)\n", TRACE("(%p,%p,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx)\n",
DeviceHandle, hEvent, UserApcRoutine, UserApcContext, DeviceHandle, hEvent, UserApcRoutine, UserApcContext,
IoStatusBlock, IoControlCode, IoStatusBlock, IoControlCode,
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize); InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize);
/* FIXME: clientID hack should disappear */ if (CDROM_DeviceIoControl(DeviceHandle, hEvent,
SERVER_START_REQ( get_device_id )
{
req->handle = DeviceHandle;
if (!wine_server_call( req )) clientID = reply->id;
}
SERVER_END_REQ;
if (!clientID) return STATUS_INVALID_PARAMETER;
if (CDROM_DeviceIoControl(clientID, DeviceHandle, hEvent,
UserApcRoutine, UserApcContext, UserApcRoutine, UserApcContext,
IoStatusBlock, IoControlCode, IoStatusBlock, IoControlCode,
InputBuffer, InputBufferSize, InputBuffer, InputBufferSize,

View File

@ -1084,7 +1084,7 @@
################################################################ ################################################################
# Wine dll separation hacks, these will go away, don't use them # Wine dll separation hacks, these will go away, don't use them
# #
@ cdecl CDROM_InitRegistry(long long str) @ cdecl CDROM_InitRegistry(long)
@ cdecl MODULE_DllThreadAttach(ptr) @ cdecl MODULE_DllThreadAttach(ptr)
@ cdecl MODULE_GetLoadOrderW(ptr wstr wstr) @ cdecl MODULE_GetLoadOrderW(ptr wstr wstr)
@ cdecl VERSION_Init(wstr) @ cdecl VERSION_Init(wstr)

View File

@ -89,7 +89,7 @@ extern HANDLE (WINAPI *pCreateFileW)( LPCWSTR filename, DWORD access, DWORD shar
/* Device IO */ /* Device IO */
/* ntdll/cdrom.c.c */ /* ntdll/cdrom.c.c */
extern NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, extern NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine, HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
PVOID UserApcContext, PVOID UserApcContext,
PIO_STATUS_BLOCK piosb, PIO_STATUS_BLOCK piosb,

View File

@ -141,7 +141,7 @@ inline static char *heap_strdup( const char *str )
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1') #define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
extern void CDROM_InitRegistry(int dev, int id, const char *device); extern void CDROM_InitRegistry(int dev);
/*********************************************************************** /***********************************************************************
* DRIVE_GetDriveType * DRIVE_GetDriveType
@ -334,7 +334,7 @@ int DRIVE_Init(void)
int cd_fd; int cd_fd;
if ((cd_fd = open(drive->device, O_RDONLY|O_NONBLOCK)) != -1) if ((cd_fd = open(drive->device, O_RDONLY|O_NONBLOCK)) != -1)
{ {
CDROM_InitRegistry(cd_fd, i, drive->device); CDROM_InitRegistry(cd_fd);
close(cd_fd); close(cd_fd);
} }
} }

View File

@ -264,28 +264,6 @@ HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
} }
/***********************************************************************
* FILE_CreateDevice
*
* Same as FILE_CreateFile but for a device
* Returns 0 on failure.
*/
HANDLE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa )
{
HANDLE ret;
SERVER_START_REQ( create_device )
{
req->access = access;
req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
req->id = client_id;
SetLastError(0);
wine_server_call_err( req );
ret = reply->handle;
}
SERVER_END_REQ;
return ret;
}
static HANDLE FILE_OpenPipe(LPCWSTR name, DWORD access, LPSECURITY_ATTRIBUTES sa ) static HANDLE FILE_OpenPipe(LPCWSTR name, DWORD access, LPSECURITY_ATTRIBUTES sa )
{ {
HANDLE ret; HANDLE ret;
@ -392,7 +370,17 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
} }
else if (isalphaW(filename[4]) && filename[5] == ':' && filename[6] == '\0') else if (isalphaW(filename[4]) && filename[5] == ':' && filename[6] == '\0')
{ {
ret = FILE_CreateDevice( (toupperW(filename[4]) - 'A') | 0x20000, access, sa ); const char *device = DRIVE_GetDevice( toupperW(filename[4]) - 'A' );
if (device)
{
ret = FILE_CreateFile( device, access, sharing, sa, creation,
attributes, template, TRUE, DRIVE_FIXED );
}
else
{
SetLastError( ERROR_ACCESS_DENIED );
ret = INVALID_HANDLE_VALUE;
}
goto done; goto done;
} }
else if (!RtlIsDosDeviceName_U( filename )) else if (!RtlIsDosDeviceName_U( filename ))

View File

@ -63,12 +63,10 @@ extern int FILE_strcasecmp( const char *str1, const char *str2 );
extern int FILE_strncasecmp( const char *str1, const char *str2, int len ); extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
extern void FILE_SetDosError(void); extern void FILE_SetDosError(void);
extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink ); extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink );
extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );
extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES sa, DWORD creation, LPSECURITY_ATTRIBUTES sa, DWORD creation,
DWORD attributes, HANDLE template, BOOL fail_read_only, DWORD attributes, HANDLE template, BOOL fail_read_only,
UINT drive_type ); UINT drive_type );
extern HANDLE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa );
extern LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG); extern LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG);

View File

@ -1504,34 +1504,6 @@ struct get_mapping_info_reply
}; };
struct create_device_request
{
struct request_header __header;
unsigned int access;
int inherit;
int id;
};
struct create_device_reply
{
struct reply_header __header;
obj_handle_t handle;
};
struct get_device_id_request
{
struct request_header __header;
obj_handle_t handle;
};
struct get_device_id_reply
{
struct reply_header __header;
int id;
};
#define SNAP_HEAPLIST 0x00000001 #define SNAP_HEAPLIST 0x00000001
#define SNAP_PROCESS 0x00000002 #define SNAP_PROCESS 0x00000002
#define SNAP_THREAD 0x00000004 #define SNAP_THREAD 0x00000004
@ -3278,8 +3250,6 @@ enum request
REQ_create_mapping, REQ_create_mapping,
REQ_open_mapping, REQ_open_mapping,
REQ_get_mapping_info, REQ_get_mapping_info,
REQ_create_device,
REQ_get_device_id,
REQ_create_snapshot, REQ_create_snapshot,
REQ_next_process, REQ_next_process,
REQ_next_thread, REQ_next_thread,
@ -3468,8 +3438,6 @@ union generic_request
struct create_mapping_request create_mapping_request; struct create_mapping_request create_mapping_request;
struct open_mapping_request open_mapping_request; struct open_mapping_request open_mapping_request;
struct get_mapping_info_request get_mapping_info_request; struct get_mapping_info_request get_mapping_info_request;
struct create_device_request create_device_request;
struct get_device_id_request get_device_id_request;
struct create_snapshot_request create_snapshot_request; struct create_snapshot_request create_snapshot_request;
struct next_process_request next_process_request; struct next_process_request next_process_request;
struct next_thread_request next_thread_request; struct next_thread_request next_thread_request;
@ -3656,8 +3624,6 @@ union generic_reply
struct create_mapping_reply create_mapping_reply; struct create_mapping_reply create_mapping_reply;
struct open_mapping_reply open_mapping_reply; struct open_mapping_reply open_mapping_reply;
struct get_mapping_info_reply get_mapping_info_reply; struct get_mapping_info_reply get_mapping_info_reply;
struct create_device_reply create_device_reply;
struct get_device_id_reply get_device_id_reply;
struct create_snapshot_reply create_snapshot_reply; struct create_snapshot_reply create_snapshot_reply;
struct next_process_reply next_process_reply; struct next_process_reply next_process_reply;
struct next_thread_reply next_thread_reply; struct next_thread_reply next_thread_reply;
@ -3763,6 +3729,6 @@ union generic_reply
struct set_global_windows_reply set_global_windows_reply; struct set_global_windows_reply set_global_windows_reply;
}; };
#define SERVER_PROTOCOL_VERSION 132 #define SERVER_PROTOCOL_VERSION 133
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -16,7 +16,6 @@ C_SRCS = \
context_powerpc.c \ context_powerpc.c \
context_sparc.c \ context_sparc.c \
debugger.c \ debugger.c \
device.c \
event.c \ event.c \
fd.c \ fd.c \
file.c \ file.c \

View File

@ -1,102 +0,0 @@
/*
* Server-side device management
*
* Copyright (C) 1999 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* FIXME:
* all this stuff is a simple hack to avoid breaking
* client-side device support.
*/
#include <assert.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "handle.h"
#include "thread.h"
#include "request.h"
struct device
{
struct object obj; /* object header */
int id; /* client identifier */
};
static void device_dump( struct object *obj, int verbose );
static const struct object_ops device_ops =
{
sizeof(struct device), /* size */
device_dump, /* dump */
no_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
NULL, /* satisfied */
no_get_fd, /* get_fd */
no_destroy /* destroy */
};
static struct device *create_device( int id )
{
struct device *dev;
if ((dev = alloc_object( &device_ops )))
{
dev->id = id;
}
return dev;
}
static void device_dump( struct object *obj, int verbose )
{
struct device *dev = (struct device *)obj;
assert( obj->ops == &device_ops );
fprintf( stderr, "Device id=%08x\n", dev->id );
}
/* create a device */
DECL_HANDLER(create_device)
{
struct device *dev;
reply->handle = 0;
if ((dev = create_device( req->id )))
{
reply->handle = alloc_handle( current->process, dev, req->access, req->inherit );
release_object( dev );
}
}
/* Retrieve the client private id for a device */
DECL_HANDLER(get_device_id)
{
struct device *dev;
if ((dev = (struct device *)get_handle_obj( current->process, req->handle, 0, &device_ops )))
{
reply->id = dev->id;
release_object( dev );
}
}

View File

@ -1106,24 +1106,6 @@ enum char_info_mode
@END @END
/* Create a device */
@REQ(create_device)
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */
int id; /* client private id */
@REPLY
obj_handle_t handle; /* handle to the device */
@END
/* Retrieve the client private id for a device */
@REQ(get_device_id)
obj_handle_t handle; /* handle to the device */
@REPLY
int id; /* client private id */
@END
#define SNAP_HEAPLIST 0x00000001 #define SNAP_HEAPLIST 0x00000001
#define SNAP_PROCESS 0x00000002 #define SNAP_PROCESS 0x00000002
#define SNAP_THREAD 0x00000004 #define SNAP_THREAD 0x00000004

View File

@ -181,8 +181,6 @@ DECL_HANDLER(next_change_notification);
DECL_HANDLER(create_mapping); DECL_HANDLER(create_mapping);
DECL_HANDLER(open_mapping); DECL_HANDLER(open_mapping);
DECL_HANDLER(get_mapping_info); DECL_HANDLER(get_mapping_info);
DECL_HANDLER(create_device);
DECL_HANDLER(get_device_id);
DECL_HANDLER(create_snapshot); DECL_HANDLER(create_snapshot);
DECL_HANDLER(next_process); DECL_HANDLER(next_process);
DECL_HANDLER(next_thread); DECL_HANDLER(next_thread);
@ -370,8 +368,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_create_mapping, (req_handler)req_create_mapping,
(req_handler)req_open_mapping, (req_handler)req_open_mapping,
(req_handler)req_get_mapping_info, (req_handler)req_get_mapping_info,
(req_handler)req_create_device,
(req_handler)req_get_device_id,
(req_handler)req_create_snapshot, (req_handler)req_create_snapshot,
(req_handler)req_next_process, (req_handler)req_next_process,
(req_handler)req_next_thread, (req_handler)req_next_thread,

View File

@ -1346,28 +1346,6 @@ static void dump_get_mapping_info_reply( const struct get_mapping_info_reply *re
fprintf( stderr, " removable=%d", req->removable ); fprintf( stderr, " removable=%d", req->removable );
} }
static void dump_create_device_request( const struct create_device_request *req )
{
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " id=%d", req->id );
}
static void dump_create_device_reply( const struct create_device_reply *req )
{
fprintf( stderr, " handle=%p", req->handle );
}
static void dump_get_device_id_request( const struct get_device_id_request *req )
{
fprintf( stderr, " handle=%p", req->handle );
}
static void dump_get_device_id_reply( const struct get_device_id_reply *req )
{
fprintf( stderr, " id=%d", req->id );
}
static void dump_create_snapshot_request( const struct create_snapshot_request *req ) static void dump_create_snapshot_request( const struct create_snapshot_request *req )
{ {
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " inherit=%d,", req->inherit );
@ -2681,8 +2659,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_create_mapping_request, (dump_func)dump_create_mapping_request,
(dump_func)dump_open_mapping_request, (dump_func)dump_open_mapping_request,
(dump_func)dump_get_mapping_info_request, (dump_func)dump_get_mapping_info_request,
(dump_func)dump_create_device_request,
(dump_func)dump_get_device_id_request,
(dump_func)dump_create_snapshot_request, (dump_func)dump_create_snapshot_request,
(dump_func)dump_next_process_request, (dump_func)dump_next_process_request,
(dump_func)dump_next_thread_request, (dump_func)dump_next_thread_request,
@ -2867,8 +2843,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_create_mapping_reply, (dump_func)dump_create_mapping_reply,
(dump_func)dump_open_mapping_reply, (dump_func)dump_open_mapping_reply,
(dump_func)dump_get_mapping_info_reply, (dump_func)dump_get_mapping_info_reply,
(dump_func)dump_create_device_reply,
(dump_func)dump_get_device_id_reply,
(dump_func)dump_create_snapshot_reply, (dump_func)dump_create_snapshot_reply,
(dump_func)dump_next_process_reply, (dump_func)dump_next_process_reply,
(dump_func)dump_next_thread_reply, (dump_func)dump_next_thread_reply,
@ -3053,8 +3027,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"create_mapping", "create_mapping",
"open_mapping", "open_mapping",
"get_mapping_info", "get_mapping_info",
"create_device",
"get_device_id",
"create_snapshot", "create_snapshot",
"next_process", "next_process",
"next_thread", "next_thread",