Fd type is no longer used, get rid of it.

oldstable
Alexandre Julliard 2004-08-18 00:04:58 +00:00
parent 1ffddb4d0c
commit 6a27b48895
24 changed files with 50 additions and 74 deletions

View File

@ -110,7 +110,7 @@ static int get_comm_fd( HANDLE handle, DWORD access )
{
int fd, ret;
ret = wine_server_handle_to_fd( handle, access, &fd, NULL, NULL );
ret = wine_server_handle_to_fd( handle, access, &fd, NULL );
if (ret) SetLastError( RtlNtStatusToDosError(ret) );
return fd;
}

View File

@ -866,7 +866,7 @@ BOOL WINAPI SetFilePointerEx( HANDLE hFile, LARGE_INTEGER distance,
return ret;
}
if (!(status = wine_server_handle_to_fd( hFile, 0, &fd, NULL, NULL )))
if (!(status = wine_server_handle_to_fd( hFile, 0, &fd, NULL )))
{
off_t pos, res;

View File

@ -1068,7 +1068,7 @@ BOOL WINAPI PeekNamedPipe( HANDLE hPipe, LPVOID lpvBuffer, DWORD cbBuffer,
#ifdef FIONREAD
int avail=0, fd, ret, flags;
ret = wine_server_handle_to_fd( hPipe, GENERIC_READ, &fd, NULL, &flags );
ret = wine_server_handle_to_fd( hPipe, GENERIC_READ, &fd, &flags );
if (ret)
{
SetLastError( RtlNtStatusToDosError(ret) );

View File

@ -135,7 +135,7 @@ static DeviceIoProc get_vxd_proc( HANDLE handle )
DeviceIoProc ret = NULL;
int status, i, fd;
status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL );
status = wine_server_handle_to_fd( handle, 0, &fd, NULL );
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
@ -236,7 +236,7 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa )
FreeLibrary( module );
goto done;
}
wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL );
wine_server_handle_to_fd( handle, 0, &fd, NULL );
if (fstat( fd, &st ) != -1)
{
vxd_modules[i].dev = st.st_dev;

View File

@ -1925,7 +1925,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
piosb->Information = 0;
if ((status = wine_server_handle_to_fd( hDevice, 0, &fd, NULL, NULL ))) goto error;
if ((status = wine_server_handle_to_fd( hDevice, 0, &fd, NULL ))) goto error;
if ((status = CDROM_Open(fd, &dev)))
{
wine_server_release_fd( hDevice, fd );

View File

@ -674,8 +674,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event,
return io->u.Status = STATUS_NOT_IMPLEMENTED;
}
if ((io->u.Status = wine_server_handle_to_fd( handle, GENERIC_READ,
&fd, NULL, NULL )) != STATUS_SUCCESS)
if ((io->u.Status = wine_server_handle_to_fd( handle, GENERIC_READ, &fd, NULL )) != STATUS_SUCCESS)
return io->u.Status;
io->Information = 0;

View File

@ -408,7 +408,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
hFile,hEvent,apc,apc_user,io_status,buffer,length,offset,key);
io_status->Information = 0;
io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_READ, &unix_handle, NULL, &flags );
io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_READ, &unix_handle, &flags );
if (io_status->u.Status) return io_status->u.Status;
if (flags & FD_FLAG_RECV_SHUTDOWN)
@ -604,7 +604,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
hFile,hEvent,apc,apc_user,io_status,buffer,length,offset,key);
io_status->Information = 0;
io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_WRITE, &unix_handle, NULL, &flags );
io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_WRITE, &unix_handle, &flags );
if (io_status->u.Status) return io_status->u.Status;
if (flags & FD_FLAG_SEND_SHUTDOWN)
@ -872,7 +872,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
if (len < info_sizes[class])
return io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
if ((io->u.Status = wine_server_handle_to_fd( hFile, 0, &fd, NULL, NULL )))
if ((io->u.Status = wine_server_handle_to_fd( hFile, 0, &fd, NULL )))
return io->u.Status;
switch (class)
@ -1027,7 +1027,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
TRACE("(%p,%p,%p,0x%08lx,0x%08x)\n", handle, io, ptr, len, class);
if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL )))
if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL )))
return io->u.Status;
io->u.Status = STATUS_SUCCESS;
@ -1230,7 +1230,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io
int fd;
struct stat st;
if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL )) != STATUS_SUCCESS)
if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL )) != STATUS_SUCCESS)
return io->u.Status;
io->u.Status = STATUS_NOT_IMPLEMENTED;

View File

@ -1121,7 +1121,7 @@
# Server interface
@ cdecl -norelay wine_server_call(ptr)
@ cdecl wine_server_fd_to_handle(long long long ptr)
@ cdecl wine_server_handle_to_fd(long long ptr ptr ptr)
@ cdecl wine_server_handle_to_fd(long long ptr ptr)
@ cdecl wine_server_release_fd(long long)
@ cdecl wine_server_send_fd(long)

View File

@ -460,14 +460,12 @@ int wine_server_fd_to_handle( int fd, unsigned int access, int inherit, obj_hand
* handle [I] Wine file handle.
* access [I] Win32 file access rights requested.
* unix_fd [O] Address where Unix file descriptor will be stored.
* type [O] Address where the file type will be stored. Optional.
* flags [O] Address where the Unix flags associated with file will be stored. Optional.
*
* RETURNS
* NTSTATUS code
*/
int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd,
enum fd_type *type, int *flags )
int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, int *flags )
{
obj_handle_t fd_handle;
int ret, fd = -1;
@ -480,7 +478,6 @@ int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *uni
req->handle = handle;
req->access = access;
if (!(ret = wine_server_call( req ))) fd = reply->fd;
if (type) *type = reply->type;
if (flags) *flags = reply->flags;
}
SERVER_END_REQ;

View File

@ -1638,7 +1638,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
SERVER_END_REQ;
if (res) return res;
if ((res = wine_server_handle_to_fd( handle, 0, &unix_handle, NULL, NULL ))) return res;
if ((res = wine_server_handle_to_fd( handle, 0, &unix_handle, NULL ))) return res;
if (NtQueryVolumeInformationFile( handle, &io, &device_info, sizeof(device_info),
FileFsDeviceInformation ) == STATUS_SUCCESS)
@ -1651,7 +1651,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
int shared_fd;
if ((res = wine_server_handle_to_fd( shared_file, GENERIC_READ, &shared_fd,
NULL, NULL ))) goto done;
NULL ))) goto done;
res = map_image( handle, unix_handle, base, size_low, header_size,
shared_fd, removable, addr_ptr );
wine_server_release_fd( shared_file, shared_fd );

View File

@ -122,7 +122,7 @@ static void INT13_ReadFloppyParams( CONTEXT86 *context )
h = CreateFileW(drive_root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (h == INVALID_HANDLE_VALUE ||
wine_server_handle_to_fd(h, GENERIC_READ, &floppy_fd, NULL, NULL))
wine_server_handle_to_fd(h, GENERIC_READ, &floppy_fd, NULL))
{
WARN("Can't determine floppy geometry !\n");
INT13_SetStatus( context, 0x07 ); /* drive parameter activity failed */

View File

@ -908,7 +908,7 @@ static HANDLE INT21_OpenMagicDevice( LPCWSTR name, DWORD access )
struct stat st;
if (!(handle = INT21_CreateMagicDeviceHandle( magic_devices[i].name ))) return 0;
wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL );
wine_server_handle_to_fd( handle, 0, &fd, NULL );
fstat( fd, &st );
wine_server_release_fd( handle, fd );
magic_devices[i].dev = st.st_dev;
@ -2684,7 +2684,7 @@ static void INT21_Ioctl_Char( CONTEXT86 *context )
int status, i, fd;
HANDLE handle = DosFileHandleToWin32Handle(BX_reg(context));
status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL );
status = wine_server_handle_to_fd( handle, 0, &fd, NULL );
if (status)
{
SET_AX( context, RtlNtStatusToDosError(status) );

View File

@ -315,7 +315,7 @@ inline static unsigned int set_error( unsigned int err )
inline static int get_sock_fd( SOCKET s, DWORD access, int *flags )
{
int fd;
if (set_error( wine_server_handle_to_fd( SOCKET2HANDLE(s), access, &fd, NULL, flags ) ))
if (set_error( wine_server_handle_to_fd( SOCKET2HANDLE(s), access, &fd, flags ) ))
return -1;
return fd;
}

View File

@ -53,8 +53,7 @@ struct __server_request_info
extern unsigned int wine_server_call( void *req_ptr );
extern void wine_server_send_fd( int fd );
extern int wine_server_fd_to_handle( int fd, unsigned int access, int inherit, obj_handle_t *handle );
extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd,
enum fd_type *type, int *flags );
extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, int *flags );
extern void wine_server_release_fd( obj_handle_t handle, int unix_fd );
/* do a server call and set the last error code */

View File

@ -792,15 +792,8 @@ struct get_handle_fd_reply
{
struct reply_header __header;
int fd;
int type;
int flags;
};
enum fd_type
{
FD_TYPE_INVALID,
FD_TYPE_DEFAULT,
FD_TYPE_SOCKET
};
#define FD_FLAG_OVERLAPPED 0x01
#define FD_FLAG_TIMEOUT 0x02
#define FD_FLAG_RECV_SHUTDOWN 0x04
@ -3649,6 +3642,6 @@ union generic_reply
struct set_global_windows_reply set_global_windows_reply;
};
#define SERVER_PROTOCOL_VERSION 148
#define SERVER_PROTOCOL_VERSION 149
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1706,7 +1706,7 @@ static void init_cdrom_registry( HANDLE handle )
#ifdef HDIO_GET_DMA
{
int fd, dma;
if (!wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL ))
if (!wine_server_handle_to_fd( handle, 0, &fd, NULL ))
{
if (ioctl(fd,HDIO_GET_DMA, &dma) != -1) value = dma;
wine_server_release_fd( handle, fd );

View File

@ -1117,11 +1117,10 @@ int no_flush( struct fd *fd, struct event **event )
}
/* default get_file_info() routine */
int no_get_file_info( struct fd *fd, int *flags )
int no_get_file_info( struct fd *fd )
{
set_error( STATUS_OBJECT_TYPE_MISMATCH );
*flags = 0;
return FD_TYPE_INVALID;
return 0;
}
/* default queue_async() routine */
@ -1168,7 +1167,6 @@ DECL_HANDLER(get_handle_fd)
struct fd *fd;
reply->fd = -1;
reply->type = FD_TYPE_INVALID;
if ((fd = get_handle_fd_obj( current->process, req->handle, req->access )))
{
@ -1179,7 +1177,7 @@ DECL_HANDLER(get_handle_fd)
assert( fd->unix_fd != -1 );
send_client_fd( current->process, fd->unix_fd, req->handle );
}
reply->type = fd->fd_ops->get_file_info( fd, &reply->flags );
reply->flags = fd->fd_ops->get_file_info( fd );
release_object( fd );
}
}

View File

@ -69,7 +69,7 @@ static void file_destroy( struct object *obj );
static int file_get_poll_events( struct fd *fd );
static void file_poll_event( struct fd *fd, int event );
static int file_flush( struct fd *fd, struct event **event );
static int file_get_info( struct fd *fd, int *flags );
static int file_get_info( struct fd *fd );
static void file_queue_async( struct fd *fd, void *ptr, unsigned int status, int type, int count );
static const struct object_ops file_ops =
@ -258,13 +258,12 @@ static int file_flush( struct fd *fd, struct event **event )
return ret;
}
static int file_get_info( struct fd *fd, int *flags )
static int file_get_info( struct fd *fd )
{
struct file *file = get_fd_user( fd );
*flags = 0;
if (is_overlapped( file )) *flags |= FD_FLAG_OVERLAPPED;
return FD_TYPE_DEFAULT;
if (is_overlapped( file )) return FD_FLAG_OVERLAPPED;
else return 0;
}
static void file_queue_async(struct fd *fd, void *ptr, unsigned int status, int type, int count)

View File

@ -37,7 +37,7 @@ struct fd_ops
/* flush the object buffers */
int (*flush)(struct fd *, struct event **);
/* get file information */
int (*get_file_info)(struct fd *, int *flags);
int (*get_file_info)(struct fd *);
/* queue an async operation - see register_async handler in async.c*/
void (*queue_async)(struct fd *, void* ptr, unsigned int status, int type, int count);
};
@ -64,7 +64,7 @@ extern void default_fd_remove_queue( struct object *obj, struct wait_queue_entry
extern int default_fd_signaled( struct object *obj, struct thread *thread );
extern void default_poll_event( struct fd *fd, int event );
extern int no_flush( struct fd *fd, struct event **event );
extern int no_get_file_info( struct fd *fd, int *flags );
extern int no_get_file_info( struct fd *fd );
extern void no_queue_async( struct fd *fd, void* ptr, unsigned int status, int type, int count );
extern void main_loop(void);

View File

@ -125,7 +125,7 @@ static const struct object_ops named_pipe_ops =
/* common to clients and servers */
static int pipe_end_get_poll_events( struct fd *fd );
static int pipe_end_get_info( struct fd *fd, int *flags );
static int pipe_end_get_info( struct fd *fd );
/* server end functions */
static void pipe_server_dump( struct object *obj, int verbose );
@ -476,10 +476,9 @@ static int pipe_client_flush( struct fd *fd, struct event **event )
return 0;
}
static int pipe_end_get_info( struct fd *fd, int *flags )
static int pipe_end_get_info( struct fd *fd )
{
*flags = 0;
return FD_TYPE_DEFAULT;
return 0;
}
static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len )

View File

@ -603,15 +603,8 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
unsigned int access; /* wanted access rights */
@REPLY
int fd; /* file descriptor */
int type; /* the type of file (see below) */
int flags; /* file read/write flags (see below) */
@END
enum fd_type
{
FD_TYPE_INVALID,
FD_TYPE_DEFAULT,
FD_TYPE_SOCKET
};
#define FD_FLAG_OVERLAPPED 0x01 /* fd opened in overlapped mode */
#define FD_FLAG_TIMEOUT 0x02 /* read/write is synchronous */
#define FD_FLAG_RECV_SHUTDOWN 0x04

View File

@ -61,7 +61,7 @@ static void serial_destroy(struct object *obj);
static int serial_get_poll_events( struct fd *fd );
static void serial_poll_event( struct fd *fd, int event );
static int serial_get_info( struct fd *fd, int *flags );
static int serial_get_info( struct fd *fd );
static int serial_flush( struct fd *fd, struct event **event );
static void serial_queue_async(struct fd *fd, void *ptr, unsigned int status, int type, int count);
@ -201,22 +201,22 @@ static int serial_get_poll_events( struct fd *fd )
return events;
}
static int serial_get_info( struct fd *fd, int *flags )
static int serial_get_info( struct fd *fd )
{
int flags = 0;
struct serial *serial = get_fd_user( fd );
assert( serial->obj.ops == &serial_ops );
*flags = 0;
if (!(serial->options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)))
*flags |= FD_FLAG_OVERLAPPED;
flags |= FD_FLAG_OVERLAPPED;
else if (!(serial->readinterval == MAXDWORD &&
serial->readmult == 0 && serial->readconst == 0))
*flags |= FD_FLAG_TIMEOUT;
if (serial->readinterval == MAXDWORD &&
flags |= FD_FLAG_TIMEOUT;
if (serial->readinterval == MAXDWORD &&
serial->readmult == 0 && serial->readconst == 0)
*flags |= FD_FLAG_AVAILABLE;
flags |= FD_FLAG_AVAILABLE;
return FD_TYPE_DEFAULT;
return flags;
}
static void serial_poll_event(struct fd *fd, int event)

View File

@ -93,7 +93,7 @@ static void sock_destroy( struct object *obj );
static int sock_get_poll_events( struct fd *fd );
static void sock_poll_event( struct fd *fd, int event );
static int sock_get_info( struct fd *fd, int *flags );
static int sock_get_info( struct fd *fd );
static void sock_queue_async( struct fd *fd, void *ptr, unsigned int status, int type, int count );
static int sock_get_error( int err );
@ -475,19 +475,19 @@ static int sock_get_poll_events( struct fd *fd )
return ev;
}
static int sock_get_info( struct fd *fd, int *flags )
static int sock_get_info( struct fd *fd )
{
int flags = FD_FLAG_AVAILABLE;
struct sock *sock = get_fd_user( fd );
assert ( sock->obj.ops == &sock_ops );
*flags = FD_FLAG_AVAILABLE;
if (sock->flags & WSA_FLAG_OVERLAPPED) *flags |= FD_FLAG_OVERLAPPED;
if (sock->flags & WSA_FLAG_OVERLAPPED) flags |= FD_FLAG_OVERLAPPED;
if ( sock->type != SOCK_STREAM || sock->state & FD_WINE_CONNECTED )
{
if ( !(sock->state & FD_READ ) ) *flags |= FD_FLAG_RECV_SHUTDOWN;
if ( !(sock->state & FD_WRITE ) ) *flags |= FD_FLAG_SEND_SHUTDOWN;
if ( !(sock->state & FD_READ ) ) flags |= FD_FLAG_RECV_SHUTDOWN;
if ( !(sock->state & FD_WRITE ) ) flags |= FD_FLAG_SEND_SHUTDOWN;
}
return FD_TYPE_SOCKET;
return flags;
}
static void sock_queue_async(struct fd *fd, void *ptr, unsigned int status, int type, int count)

View File

@ -890,7 +890,6 @@ static void dump_get_handle_fd_request( const struct get_handle_fd_request *req
static void dump_get_handle_fd_reply( const struct get_handle_fd_reply *req )
{
fprintf( stderr, " fd=%d,", req->fd );
fprintf( stderr, " type=%d,", req->type );
fprintf( stderr, " flags=%d", req->flags );
}