Commit 2082a97d authored by Alexandre Julliard's avatar Alexandre Julliard

server: Use a standard async I/O event to signal directory changes.

parent a133ad56
......@@ -2148,7 +2148,6 @@ done:
struct read_changes_info
{
HANDLE FileHandle;
HANDLE Event;
PIO_APC_ROUTINE ApcRoutine;
PVOID ApcContext;
PVOID Buffer;
......@@ -2259,7 +2258,6 @@ NtNotifyChangeDirectoryFile( HANDLE FileHandle, HANDLE Event,
return STATUS_NO_MEMORY;
info->FileHandle = FileHandle;
info->Event = Event;
info->Buffer = Buffer;
info->BufferSize = BufferSize;
info->ApcRoutine = ApcRoutine;
......@@ -2268,13 +2266,13 @@ NtNotifyChangeDirectoryFile( HANDLE FileHandle, HANDLE Event,
SERVER_START_REQ( read_directory_changes )
{
req->handle = FileHandle;
req->event = Event;
req->filter = CompletionFilter;
req->want_data = (Buffer != NULL);
req->subtree = WatchTree;
req->async.callback = read_changes_apc;
req->async.iosb = IoStatusBlock;
req->async.arg = info;
req->async.event = Event;
status = wine_server_call( req );
}
SERVER_END_REQ;
......
......@@ -1655,7 +1655,6 @@ struct read_directory_changes_request
struct request_header __header;
unsigned int filter;
obj_handle_t handle;
obj_handle_t event;
int subtree;
int want_data;
async_data_t async;
......@@ -4700,6 +4699,6 @@ union generic_reply
struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply;
};
#define SERVER_PROTOCOL_VERSION 284
#define SERVER_PROTOCOL_VERSION 285
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -282,10 +282,7 @@ void do_change_notify( int unix_fd )
static void dir_signal_changed( struct dir *dir )
{
if (dir->event)
set_event( dir->event );
else
wake_up( &dir->obj, 0 );
if (!dir->event) wake_up( &dir->obj, 0 );
}
/* SIGIO callback, called synchronously with the poll loop */
......@@ -347,11 +344,7 @@ static void dir_destroy( struct object *obj )
async_terminate_queue( &dir->change_q, STATUS_CANCELLED );
while ((record = get_first_change_record( dir ))) free( record );
if (dir->event)
{
set_event( dir->event );
release_object( dir->event );
}
if (dir->event) release_object( dir->event );
release_object( dir->fd );
if (inotify_fd && list_empty( &change_list ))
......@@ -1088,19 +1081,16 @@ DECL_HANDLER(read_directory_changes)
return;
/* possibly send changes through an event flag */
if (req->event)
{
event = get_event_obj( current->process, req->event, EVENT_MODIFY_STATE );
if (!event)
goto end;
}
if (req->async.event &&
!(event = get_event_obj( current->process, req->async.event, EVENT_MODIFY_STATE )))
goto end;
/* discard the current data, and move onto the next event */
if (dir->event) release_object( dir->event );
dir->event = event;
/* requests don't timeout */
if (!create_async( current, NULL, &dir->change_q, &req->async )) return;
if (!create_async( current, NULL, &dir->change_q, &req->async )) goto end;
/* assign it once */
if (!dir->filter)
......@@ -1116,10 +1106,6 @@ DECL_HANDLER(read_directory_changes)
if (dir->signaled>0)
dir->signaled--;
/* clear the event */
if (event)
reset_event( event );
/* if there's already a change in the queue, send it */
if (!list_empty( &dir->change_q ) &&
!list_empty( &dir->change_records ))
......
......@@ -1299,7 +1299,6 @@ enum char_info_mode
@REQ(read_directory_changes)
unsigned int filter; /* notification filter */
obj_handle_t handle; /* handle to the directory */
obj_handle_t event; /* handle to the event */
int subtree; /* watch the subtree? */
int want_data; /* flag indicating whether change data should be collected */
async_data_t async; /* async I/O parameters */
......
......@@ -1655,7 +1655,6 @@ static void dump_read_directory_changes_request( const struct read_directory_cha
{
fprintf( stderr, " filter=%08x,", req->filter );
fprintf( stderr, " handle=%p,", req->handle );
fprintf( stderr, " event=%p,", req->event );
fprintf( stderr, " subtree=%d,", req->subtree );
fprintf( stderr, " want_data=%d,", req->want_data );
fprintf( stderr, " async=" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment