winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1030 discussions
Start a n
N
ew thread
Zebediah Figura : server: Return void from the write callback.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 377d18c7b117ba225dd555dbfac62b3d8af423f4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=377d18c7b117ba225dd555db…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 2 19:08:52 2021 -0500 server: Return void from the write callback. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 18 +++++++++--------- server/device.c | 6 +++--- server/fd.c | 3 +-- server/file.h | 4 ++-- server/named_pipe.c | 15 +++++++-------- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/server/console.c b/server/console.c index 597bff994a2..0080e6ed163 100644 --- a/server/console.c +++ b/server/console.c @@ -240,7 +240,7 @@ static const struct object_ops screen_buffer_ops = screen_buffer_destroy /* destroy */ }; -static int screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ); +static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ); static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static const struct fd_ops screen_buffer_fd_ops = @@ -381,7 +381,7 @@ static const struct object_ops console_output_ops = console_output_destroy /* destroy */ }; -static int console_output_write( struct fd *fd, struct async *async, file_pos_t pos ); +static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos ); static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static const struct fd_ops console_output_fd_ops = @@ -972,18 +972,18 @@ static int console_flush( struct fd *fd, struct async *async ) return queue_host_ioctl( console->server, IOCTL_CONDRV_FLUSH, 0, NULL, NULL ); } -static int screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct screen_buffer *screen_buffer = get_fd_user( fd ); if (!screen_buffer->input || !screen_buffer->input->server) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return queue_host_ioctl( screen_buffer->input->server, IOCTL_CONDRV_WRITE_FILE, - screen_buffer->id, async, &screen_buffer->ioctl_q ); + queue_host_ioctl( screen_buffer->input->server, IOCTL_CONDRV_WRITE_FILE, + screen_buffer->id, async, &screen_buffer->ioctl_q ); } static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) @@ -1421,16 +1421,16 @@ static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async return screen_buffer_ioctl( console->active->fd, code, async ); } -static int console_output_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct console *console = current->process->console; if (!console || !console->active) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return screen_buffer_write( console->active->fd, async, pos ); + screen_buffer_write( console->active->fd, async, pos ); } struct object *create_console_device( struct object *root, const struct unicode_str *name, diff --git a/server/device.c b/server/device.c index 4dd9213811a..cc3e0466468 100644 --- a/server/device.c +++ b/server/device.c @@ -202,7 +202,7 @@ static int device_file_close_handle( struct object *obj, struct process *process static void device_file_destroy( struct object *obj ); static enum server_fd_type device_file_get_fd_type( struct fd *fd ); static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); -static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); +static void device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); static int device_file_flush( struct fd *fd, struct async *async ); static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void device_file_reselect_async( struct fd *fd, struct async_queue *queue ); @@ -637,7 +637,7 @@ static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos queue_irp( file, ¶ms, async ); } -static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct device_file *file = get_fd_user( fd ); irp_params_t params; @@ -646,7 +646,7 @@ static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos params.write.type = IRP_CALL_WRITE; params.write.key = 0; params.write.pos = pos; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); } static int device_file_flush( struct fd *fd, struct async *async ) diff --git a/server/fd.c b/server/fd.c index c2cab0da1fe..6b79585147d 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2298,10 +2298,9 @@ void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ) } /* default write() routine */ -int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ) +void no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; } /* default flush() routine */ diff --git a/server/file.h b/server/file.h index e4b8422660a..e200281d03b 100644 --- a/server/file.h +++ b/server/file.h @@ -59,7 +59,7 @@ struct fd_ops /* perform a read on the file */ void (*read)(struct fd *, struct async *, file_pos_t ); /* perform a write on the file */ - int (*write)(struct fd *, struct async *, file_pos_t ); + void (*write)(struct fd *, struct async *, file_pos_t ); /* flush the object buffers */ int (*flush)(struct fd *, struct async *); /* query file info */ @@ -110,7 +110,7 @@ extern void fd_queue_async( struct fd *fd, struct async *async, int type ); extern void fd_async_wake_up( struct fd *fd, int type, unsigned int status ); extern void fd_reselect_async( struct fd *fd, struct async_queue *queue ); extern void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); -extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); +extern void no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); diff --git a/server/named_pipe.c b/server/named_pipe.c index b81e167ddfc..503dda93931 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -144,7 +144,7 @@ static int pipe_end_set_sd( struct object *obj, const struct security_descriptor unsigned int set_info ); static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ); static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); -static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); +static void pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static int pipe_end_flush( struct fd *fd, struct async *async ); static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); @@ -923,7 +923,7 @@ static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) set_error( STATUS_PENDING ); } -static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct pipe_end *pipe_end = get_fd_user( fd ); struct pipe_message *message; @@ -935,27 +935,26 @@ static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) break; case FILE_PIPE_DISCONNECTED_STATE: set_error( STATUS_PIPE_DISCONNECTED ); - return 0; + return; case FILE_PIPE_LISTENING_STATE: set_error( STATUS_PIPE_LISTENING ); - return 0; + return; case FILE_PIPE_CLOSING_STATE: set_error( STATUS_PIPE_CLOSING ); - return 0; + return; } - if (!pipe_end->pipe->message_mode && !get_req_data_size()) return 1; + if (!pipe_end->pipe->message_mode && !get_req_data_size()) return; iosb = async_get_iosb( async ); message = queue_message( pipe_end->connection, iosb ); release_object( iosb ); - if (!message) return 0; + if (!message) return; message->async = (struct async *)grab_object( async ); queue_async( &pipe_end->write_q, async ); reselect_read_queue( pipe_end->connection, 1 ); set_error( STATUS_PENDING ); - return 1; } static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue )
1
0
0
0
Zebediah Figura : server: Return void from the read callback.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 6d499911880df47f6b604dc2df3a24cc63ed667a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6d499911880df47f6b604dc2…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 2 19:08:51 2021 -0500 server: Return void from the read callback. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 16 ++++++++-------- server/device.c | 6 +++--- server/fd.c | 3 +-- server/file.h | 4 ++-- server/named_pipe.c | 13 ++++++------- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/server/console.c b/server/console.c index 9c7fbaa003d..597bff994a2 100644 --- a/server/console.c +++ b/server/console.c @@ -100,7 +100,7 @@ static const struct object_ops console_ops = static enum server_fd_type console_get_fd_type( struct fd *fd ); static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); -static int console_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void console_read( struct fd *fd, struct async *async, file_pos_t pos ); static int console_flush( struct fd *fd, struct async *async ); static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -325,7 +325,7 @@ static const struct object_ops console_input_ops = console_input_destroy /* destroy */ }; -static int console_input_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos ); static int console_input_flush( struct fd *fd, struct async *async ); static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -948,16 +948,16 @@ static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async } } -static int console_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void console_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct console *console = get_fd_user( fd ); if (!console->server) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return queue_host_ioctl( console->server, IOCTL_CONDRV_READ_FILE, 0, async, &console->ioctl_q ); + queue_host_ioctl( console->server, IOCTL_CONDRV_READ_FILE, 0, async, &console->ioctl_q ); } static int console_flush( struct fd *fd, struct async *async ) @@ -1349,16 +1349,16 @@ static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async * return console_ioctl( console->fd, code, async ); } -static int console_input_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct console *console = current->process->console; if (!console) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return console_read( console->fd, async, pos ); + console_read( console->fd, async, pos ); } static int console_input_flush( struct fd *fd, struct async *async ) diff --git a/server/device.c b/server/device.c index e4a5c2f9670..4dd9213811a 100644 --- a/server/device.c +++ b/server/device.c @@ -201,7 +201,7 @@ static struct list *device_file_get_kernel_obj_list( struct object *obj ); static int device_file_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void device_file_destroy( struct object *obj ); static enum server_fd_type device_file_get_fd_type( struct fd *fd ); -static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); static int device_file_flush( struct fd *fd, struct async *async ); static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -625,7 +625,7 @@ static void device_file_get_volume_info( struct fd *fd, struct async *async, uns queue_irp( file, ¶ms, async ); } -static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct device_file *file = get_fd_user( fd ); irp_params_t params; @@ -634,7 +634,7 @@ static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos params.read.type = IRP_CALL_READ; params.read.key = 0; params.read.pos = pos; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); } static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) diff --git a/server/fd.c b/server/fd.c index 93359ea03a5..c2cab0da1fe 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2292,10 +2292,9 @@ static void unmount_device( struct fd *device_fd ) } /* default read() routine */ -int no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ) +void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; } /* default write() routine */ diff --git a/server/file.h b/server/file.h index 6b949537084..e4b8422660a 100644 --- a/server/file.h +++ b/server/file.h @@ -57,7 +57,7 @@ struct fd_ops /* get file information */ enum server_fd_type (*get_fd_type)(struct fd *fd); /* perform a read on the file */ - int (*read)(struct fd *, struct async *, file_pos_t ); + void (*read)(struct fd *, struct async *, file_pos_t ); /* perform a write on the file */ int (*write)(struct fd *, struct async *, file_pos_t ); /* flush the object buffers */ @@ -109,7 +109,7 @@ extern void default_poll_event( struct fd *fd, int event ); extern void fd_queue_async( struct fd *fd, struct async *async, int type ); extern void fd_async_wake_up( struct fd *fd, int type, unsigned int status ); extern void fd_reselect_async( struct fd *fd, struct async_queue *queue ); -extern int no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); +extern void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 72a61253a54..b81e167ddfc 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -143,7 +143,7 @@ static struct security_descriptor *pipe_end_get_sd( struct object *obj ); static int pipe_end_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info ); static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ); -static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static int pipe_end_flush( struct fd *fd, struct async *async ); static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); @@ -893,7 +893,7 @@ static void reselect_write_queue( struct pipe_end *pipe_end ) reselect_read_queue( reader, 0 ); } -static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct pipe_end *pipe_end = get_fd_user( fd ); @@ -903,25 +903,24 @@ static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) if ((pipe_end->flags & NAMED_PIPE_NONBLOCKING_MODE) && list_empty( &pipe_end->message_queue )) { set_error( STATUS_PIPE_EMPTY ); - return 0; + return; } break; case FILE_PIPE_DISCONNECTED_STATE: set_error( STATUS_PIPE_DISCONNECTED ); - return 0; + return; case FILE_PIPE_LISTENING_STATE: set_error( STATUS_PIPE_LISTENING ); - return 0; + return; case FILE_PIPE_CLOSING_STATE: if (!list_empty( &pipe_end->message_queue )) break; set_error( STATUS_PIPE_BROKEN ); - return 0; + return; } queue_async( &pipe_end->read_q, async ); reselect_read_queue( pipe_end, 0 ); set_error( STATUS_PENDING ); - return 1; } static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos )
1
0
0
0
Zebediah Figura : server: Return void from the get_volume_info callback.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 6cc36a46ffb13edcfa97ea9a5dc7aee0ccab696f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6cc36a46ffb13edcfa97ea9a…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 2 19:08:50 2021 -0500 server: Return void from the get_volume_info callback. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 5 ++--- server/device.c | 6 +++--- server/fd.c | 3 +-- server/file.h | 4 ++-- server/named_pipe.c | 5 ++--- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/server/console.c b/server/console.c index 3360f680448..9c7fbaa003d 100644 --- a/server/console.c +++ b/server/console.c @@ -99,7 +99,7 @@ static const struct object_ops console_ops = static enum server_fd_type console_get_fd_type( struct fd *fd ); static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); -static int console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static int console_read( struct fd *fd, struct async *async, file_pos_t pos ); static int console_flush( struct fd *fd, struct async *async ); static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -480,7 +480,7 @@ static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned set_error( STATUS_INVALID_DEVICE_REQUEST ); } -static int console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { switch (info_class) { @@ -500,7 +500,6 @@ static int console_get_volume_info( struct fd *fd, struct async *async, unsigned default: set_error( STATUS_NOT_IMPLEMENTED ); } - return 0; } static struct object *create_console(void) diff --git a/server/device.c b/server/device.c index 8892651d048..e4a5c2f9670 100644 --- a/server/device.c +++ b/server/device.c @@ -206,7 +206,7 @@ static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos static int device_file_flush( struct fd *fd, struct async *async ); static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void device_file_reselect_async( struct fd *fd, struct async_queue *queue ); -static int device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +static void device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static const struct object_ops device_file_ops = { @@ -614,7 +614,7 @@ static enum server_fd_type device_file_get_fd_type( struct fd *fd ) return FD_TYPE_DEVICE; } -static int device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +static void device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { struct device_file *file = get_fd_user( fd ); irp_params_t params; @@ -622,7 +622,7 @@ static int device_file_get_volume_info( struct fd *fd, struct async *async, unsi memset( ¶ms, 0, sizeof(params) ); params.volume.type = IRP_CALL_VOLUME; params.volume.info_class = info_class; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); } static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ) diff --git a/server/fd.c b/server/fd.c index e4ef29806f2..93359ea03a5 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2369,10 +2369,9 @@ void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int } /* default get_volume_info() routine */ -int no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; } /* default ioctl() routine */ diff --git a/server/file.h b/server/file.h index 592ee6b4e6b..6b949537084 100644 --- a/server/file.h +++ b/server/file.h @@ -65,7 +65,7 @@ struct fd_ops /* query file info */ void (*get_file_info)( struct fd *, obj_handle_t, unsigned int ); /* query volume info */ - int (*get_volume_info)( struct fd *, struct async *, unsigned int ); + void (*get_volume_info)( struct fd *, struct async *, unsigned int ); /* perform an ioctl on the file */ int (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async ); /* queue an async operation */ @@ -114,7 +114,7 @@ extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); -extern int no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +extern void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); extern int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 20407badc4c..72a61253a54 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -146,7 +146,7 @@ static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ); static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static int pipe_end_flush( struct fd *fd, struct async *async ); -static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); @@ -740,7 +740,7 @@ static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ) return pipe_end->pipe->obj.ops->get_full_name( &pipe_end->pipe->obj, len ); } -static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { switch (info_class) { @@ -760,7 +760,6 @@ static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigne default: set_error( STATUS_NOT_IMPLEMENTED ); } - return 0; } static void message_queue_read( struct pipe_end *pipe_end, struct async *async )
1
0
0
0
Zebediah Figura : server: Check the status code to determine whether the async has failed.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 15b8f91e247ef7a8838c377da1d7457eec02eb08 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=15b8f91e247ef7a8838c377d…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 2 19:08:49 2021 -0500 server: Check the status code to determine whether the async has failed. Instead of manually specifying success or failure. Based on test_return_status() in ntoskrnl. The changes in this patch don't affect device IRPs, but the tests show the heuristic that Windows uses, and in practice it turns out to be correct for all known asyncs. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ws2_32/tests/sock.c | 4 ++-- server/async.c | 4 ++-- server/fd.c | 15 ++++++++++----- server/file.h | 2 +- server/sock.c | 34 ++++++++++------------------------ 5 files changed, 25 insertions(+), 34 deletions(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index ec010acebc6..8cbb393b542 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -1934,8 +1934,8 @@ static void test_ip_pktinfo(void) todo_wine ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError()); rc = SleepEx(1000, TRUE); - todo_wine ok(rc == WAIT_IO_COMPLETION, "got %d\n", rc); - todo_wine ok(got_ip_pktinfo_apc == 1, "apc was called %u times\n", got_ip_pktinfo_apc); + ok(rc == WAIT_IO_COMPLETION, "got %d\n", rc); + ok(got_ip_pktinfo_apc == 1, "apc was called %u times\n", got_ip_pktinfo_apc); ok(hdr.dwFlags == MSG_CTRUNC, "got flags %#x\n", hdr.dwFlags); got_ip_pktinfo_apc = 0; diff --git a/server/async.c b/server/async.c index 4e9f3253759..50cb47dec92 100644 --- a/server/async.c +++ b/server/async.c @@ -296,7 +296,7 @@ void set_async_pending( struct async *async, int signal ) } /* return async object status and wait handle to client */ -obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ) +obj_handle_t async_handoff( struct async *async, data_size_t *result, int force_blocking ) { if (async->unknown_status) { @@ -305,7 +305,7 @@ obj_handle_t async_handoff( struct async *async, int success, data_size_t *resul return async->wait_handle; } - if (!success) + if (!async->pending && NT_ERROR( get_error() )) { close_handle( async->thread->process, async->wait_handle ); async->wait_handle = 0; diff --git a/server/fd.c b/server/fd.c index a09fc9edfcf..e4ef29806f2 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2692,7 +2692,8 @@ DECL_HANDLER(flush) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->event = async_handoff( async, fd->fd_ops->flush( fd, async ), NULL, 1 ); + fd->fd_ops->flush( fd, async ); + reply->event = async_handoff( async, NULL, 1 ); release_object( async ); } release_object( fd ); @@ -2720,7 +2721,8 @@ DECL_HANDLER(get_volume_info) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->get_volume_info( fd, async, req->info_class ), NULL, 1 ); + fd->fd_ops->get_volume_info( fd, async, req->info_class ); + reply->wait = async_handoff( async, NULL, 1 ); release_object( async ); } release_object( fd ); @@ -2795,7 +2797,8 @@ DECL_HANDLER(read) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->read( fd, async, req->pos ), NULL, 0 ); + fd->fd_ops->read( fd, async, req->pos ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = fd->options; release_object( async ); } @@ -2812,7 +2815,8 @@ DECL_HANDLER(write) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->write( fd, async, req->pos ), &reply->size, 0 ); + fd->fd_ops->write( fd, async, req->pos ); + reply->wait = async_handoff( async, &reply->size, 0 ); reply->options = fd->options; release_object( async ); } @@ -2830,7 +2834,8 @@ DECL_HANDLER(ioctl) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->ioctl( fd, req->code, async ), NULL, 0 ); + fd->fd_ops->ioctl( fd, req->code, async ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = fd->options; release_object( async ); } diff --git a/server/file.h b/server/file.h index 9b8a620359e..592ee6b4e6b 100644 --- a/server/file.h +++ b/server/file.h @@ -219,7 +219,7 @@ typedef void (*async_completion_callback)( void *private ); extern void free_async_queue( struct async_queue *queue ); extern struct async *create_async( struct fd *fd, struct thread *thread, const async_data_t *data, struct iosb *iosb ); extern struct async *create_request_async( struct fd *fd, unsigned int comp_flags, const async_data_t *data ); -extern obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ); +extern obj_handle_t async_handoff( struct async *async, data_size_t *result, int force_blocking ); extern void queue_async( struct async_queue *queue, struct async *async ); extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ); extern void async_set_result( struct object *obj, unsigned int status, apc_param_t total ); diff --git a/server/sock.c b/server/sock.c index bf109eb781a..fc181e85744 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2839,8 +2839,8 @@ static int poll_single_socket( struct sock *sock, int mask ) return get_poll_flags( sock, pollfd.revents ) & mask; } -static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t timeout, - unsigned int count, const struct poll_socket_input *input ) +static void poll_socket( struct sock *poll_sock, struct async *async, timeout_t timeout, + unsigned int count, const struct poll_socket_input *input ) { struct poll_socket_output *output; BOOL signaled = FALSE; @@ -2848,13 +2848,13 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t unsigned int i, j; if (!(output = mem_alloc( count * sizeof(*output) ))) - return 0; + return; memset( output, 0, count * sizeof(*output) ); if (!(req = mem_alloc( offsetof( struct poll_req, sockets[count] ) ))) { free( output ); - return 0; + return; } req->timeout = NULL; @@ -2863,7 +2863,7 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t { free( req ); free( output ); - return 0; + return; } for (i = 0; i < count; ++i) @@ -2875,7 +2875,7 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t if (req->timeout) remove_timeout_user( req->timeout ); free( req ); free( output ); - return 0; + return; } req->sockets[i].flags = input[i].flags; } @@ -2917,7 +2917,6 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t for (i = 0; i < req->count; ++i) sock_reselect( req->sockets[i].sock ); set_error( STATUS_PENDING ); - return 1; } #ifdef HAVE_LINUX_RTNETLINK_H @@ -3249,18 +3248,11 @@ DECL_HANDLER(recv_socket) if ((async = create_request_async( fd, get_fd_comp_flags( fd ), &req->async ))) { - int success = 0; - if (status == STATUS_SUCCESS) { struct iosb *iosb = async_get_iosb( async ); iosb->result = req->total; release_object( iosb ); - success = 1; - } - else if (status == STATUS_PENDING) - { - success = 1; } set_error( status ); @@ -3273,7 +3265,7 @@ DECL_HANDLER(recv_socket) /* always reselect; we changed reported_events above */ sock_reselect( sock ); - reply->wait = async_handoff( async, success, NULL, 0 ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = get_fd_options( fd ); release_object( async ); } @@ -3293,7 +3285,8 @@ DECL_HANDLER(poll_socket) if ((async = create_request_async( sock->fd, get_fd_comp_flags( sock->fd ), &req->async ))) { - reply->wait = async_handoff( async, poll_socket( sock, async, req->timeout, count, input ), NULL, 0 ); + poll_socket( sock, async, req->timeout, count, input ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = get_fd_options( sock->fd ); release_object( async ); } @@ -3357,18 +3350,11 @@ DECL_HANDLER(send_socket) if ((async = create_request_async( fd, get_fd_comp_flags( fd ), &req->async ))) { - int success = 0; - if (status == STATUS_SUCCESS) { struct iosb *iosb = async_get_iosb( async ); iosb->result = req->total; release_object( iosb ); - success = 1; - } - else if (status == STATUS_PENDING) - { - success = 1; } set_error( status ); @@ -3381,7 +3367,7 @@ DECL_HANDLER(send_socket) /* always reselect; we changed reported_events above */ sock_reselect( sock ); - reply->wait = async_handoff( async, success, NULL, 0 ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = get_fd_options( fd ); release_object( async ); }
1
0
0
0
Zebediah Figura : server: Mark the async as pending in IOCTL_AFD_EVENT_SELECT.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 285700a52640762756e0b9186fb218915316b04e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=285700a52640762756e0b918…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 2 19:08:48 2021 -0500 server: Mark the async as pending in IOCTL_AFD_EVENT_SELECT. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/sock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/sock.c b/server/sock.c index e06f914686e..bf109eb781a 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2398,6 +2398,8 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) obj_handle_t event_handle; int mask; + set_async_pending( async, 0 ); + if (is_machine_64bit( current->process->machine )) { const struct afd_event_select_params_64 *params = get_req_data();
1
0
0
0
Zebediah Figura : server: Mark the async as pending in IOCTL_AFD_BIND.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: be3ff3d6588311132f4fe0121cd0a6b49ec249f9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=be3ff3d6588311132f4fe012…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 2 19:08:47 2021 -0500 server: Mark the async as pending in IOCTL_AFD_BIND. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/sock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/sock.c b/server/sock.c index 1e31b806986..e06f914686e 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2527,6 +2527,8 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) #endif } + set_async_pending( async, 0 ); + if (bind( unix_fd, &bind_addr.addr, unix_len ) < 0) { if (errno == EADDRINUSE)
1
0
0
0
Zebediah Figura : server: Use a separate function and flag to communicate that the initial status of an async is not known yet.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: dd58bf9ce236092a584b08e33c0cd16dd0a2e564 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dd58bf9ce236092a584b08e3…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 2 19:08:46 2021 -0500 server: Use a separate function and flag to communicate that the initial status of an async is not known yet. Mostly just to simplify the interface, so that we don't need to use the return value to communicate this. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/async.c | 23 +++++++++++++++++------ server/device.c | 4 ++-- server/file.h | 1 + 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/server/async.c b/server/async.c index e8d95a62d4b..4e9f3253759 100644 --- a/server/async.c +++ b/server/async.c @@ -53,6 +53,7 @@ struct async unsigned int direct_result :1;/* a flag if we're passing result directly from request instead of APC */ unsigned int alerted :1; /* fd is signaled, but we are waiting for client-side I/O */ unsigned int terminated :1; /* async has been terminated */ + unsigned int unknown_status :1; /* initial status is not known yet */ struct completion *completion; /* completion associated with fd */ apc_param_t comp_key; /* completion key associated with fd */ unsigned int comp_flags; /* completion flags */ @@ -258,6 +259,7 @@ struct async *create_async( struct fd *fd, struct thread *thread, const async_da async->direct_result = 0; async->alerted = 0; async->terminated = 0; + async->unknown_status = 0; async->completion = fd_get_completion( fd, &async->comp_key ); async->comp_flags = 0; async->completion_callback = NULL; @@ -284,6 +286,7 @@ void set_async_pending( struct async *async, int signal ) if (!async->terminated) { async->pending = 1; + async->unknown_status = 0; if (signal && !async->signaled) { async->signaled = 1; @@ -295,14 +298,15 @@ void set_async_pending( struct async *async, int signal ) /* return async object status and wait handle to client */ obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ) { + if (async->unknown_status) + { + /* even the initial status is not known yet */ + set_error( STATUS_PENDING ); + return async->wait_handle; + } + if (!success) { - if (get_error() == STATUS_PENDING) - { - /* we don't know the result yet, so client needs to wait */ - async->direct_result = 0; - return async->wait_handle; - } close_handle( async->thread->process, async->wait_handle ); async->wait_handle = 0; return 0; @@ -381,6 +385,13 @@ void async_request_complete_alloc( struct async *async, unsigned int status, dat async_request_complete( async, status, result, out_size, out_data_copy ); } +/* mark an async as having unknown initial status */ +void async_set_unknown_status( struct async *async ) +{ + async->unknown_status = 1; + async->direct_result = 0; +} + /* set the timeout of an async operation */ void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ) { diff --git a/server/device.c b/server/device.c index 29b36845e68..8892651d048 100644 --- a/server/device.c +++ b/server/device.c @@ -605,8 +605,8 @@ static int queue_irp( struct device_file *file, const irp_params_t *params, stru irp->async = (struct async *)grab_object( async ); add_irp_to_queue( file->device->manager, irp, current ); release_object( irp ); - set_error( STATUS_PENDING ); - return 0; + async_set_unknown_status( async ); + return 1; } static enum server_fd_type device_file_get_fd_type( struct fd *fd ) diff --git a/server/file.h b/server/file.h index 8e42cd3704e..9b8a620359e 100644 --- a/server/file.h +++ b/server/file.h @@ -224,6 +224,7 @@ extern void queue_async( struct async_queue *queue, struct async *async ); extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ); extern void async_set_result( struct object *obj, unsigned int status, apc_param_t total ); extern void async_set_completion_callback( struct async *async, async_completion_callback func, void *private ); +extern void async_set_unknown_status( struct async *async ); extern void set_async_pending( struct async *async, int signal ); extern int async_waiting( struct async_queue *queue ); extern void async_terminate( struct async *async, unsigned int status );
1
0
0
0
Rémi Bernon : winebus.sys: Remove the now useless bus_enumerate_hid_devices.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 60740e874551a02b82064b2dd4d5e9ced0e6e5d0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=60740e874551a02b82064b2d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Sep 3 09:30:51 2021 +0200 winebus.sys: Remove the now useless bus_enumerate_hid_devices. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus.h | 3 --- dlls/winebus.sys/main.c | 25 ------------------------- 2 files changed, 28 deletions(-) diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index a5615bb31b5..15238538328 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -27,15 +27,12 @@ #include "unixlib.h" -typedef int(*enum_func)(DEVICE_OBJECT *device, void *context); - struct unix_device *get_unix_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; /* HID Plug and Play Bus */ DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct unix_device *unix_device) DECLSPEC_HIDDEN; DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) DECLSPEC_HIDDEN; void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN; -DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function, void *context) DECLSPEC_HIDDEN; /* General Bus Functions */ BOOL is_xbox_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 0aa3c2b7a63..6093a0b79eb 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -408,31 +408,6 @@ DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) return ret; } -DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function, void *context) -{ - struct device_extension *ext, *next; - DEVICE_OBJECT *ret = NULL; - int cont; - - TRACE("bus_id %s\n", debugstr_w(bus_id)); - - EnterCriticalSection(&device_list_cs); - LIST_FOR_EACH_ENTRY_SAFE(ext, next, &device_list, struct device_extension, entry) - { - if (strcmpW(ext->desc.busid, bus_id)) continue; - LeaveCriticalSection(&device_list_cs); - cont = function(ext->device, context); - EnterCriticalSection(&device_list_cs); - if (!cont) - { - ret = ext->device; - break; - } - } - LeaveCriticalSection(&device_list_cs); - return ret; -} - static void bus_unlink_hid_device(DEVICE_OBJECT *device) { struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
1
0
0
0
Rémi Bernon : winebus.sys: Look for duplicate UDEV devices on the unix side.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 6ce5ba8f2f0940273140fd13229a3ea0344bddaf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6ce5ba8f2f0940273140fd13…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Sep 3 09:30:50 2021 +0200 winebus.sys: Look for duplicate UDEV devices on the unix side. Devices are only added from a single thread but they may be destroyed concurrently so we need to guard the list against race conditions. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_udev.c | 73 ++++++++++++++++++++++++++++------------- dlls/winebus.sys/unix_private.h | 1 + 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index d87ee2c043e..cca1bf5e168 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -88,11 +88,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); WINE_DECLARE_DEBUG_CHANNEL(hid_report); +static CRITICAL_SECTION udev_cs; +static CRITICAL_SECTION_DEBUG udev_cs_debug = +{ + 0, 0, &udev_cs, + { &udev_cs_debug.ProcessLocksList, &udev_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": udev_cs") } +}; +static CRITICAL_SECTION udev_cs = { &udev_cs_debug, -1, 0, 0, 0, 0 }; + static struct udev *udev_context = NULL; static struct udev_monitor *udev_monitor; static int deviceloop_control[2]; static int udev_monitor_fd; static struct list event_queue = LIST_INIT(event_queue); +static struct list device_list = LIST_INIT(device_list); static const WCHAR hidraw_busidW[] = {'H','I','D','R','A','W',0}; static const WCHAR lnxev_busidW[] = {'L','N','X','E','V',0}; @@ -119,6 +129,29 @@ static inline struct platform_private *impl_from_DEVICE_OBJECT(DEVICE_OBJECT *de return impl_from_unix_device(get_unix_device(device)); } +static const char *get_device_syspath(struct udev_device *dev) +{ + struct udev_device *parent; + + if ((parent = udev_device_get_parent_with_subsystem_devtype(dev, "hid", NULL))) + return udev_device_get_syspath(parent); + + if ((parent = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"))) + return udev_device_get_syspath(parent); + + return ""; +} + +static struct platform_private *find_device_from_syspath(const char *path) +{ + struct platform_private *device; + + LIST_FOR_EACH_ENTRY(device, &device_list, struct platform_private, unix_device.entry) + if (!strcmp(get_device_syspath(device->udev_device), path)) return device; + + return NULL; +} + #ifdef HAS_PROPER_INPUT_HEADER static const BYTE ABS_TO_HID_MAP[][2] = { @@ -547,6 +580,10 @@ static void hidraw_device_destroy(struct unix_device *iface) { struct platform_private *private = impl_from_unix_device(iface); + EnterCriticalSection(&udev_cs); + list_remove(&private->unix_device.entry); + LeaveCriticalSection(&udev_cs); + if (private->report_thread) { write(private->control_pipe[1], "q", 1); @@ -858,6 +895,10 @@ static void lnxev_device_destroy(struct unix_device *iface) { struct wine_input_private *ext = input_impl_from_unix_device(iface); + EnterCriticalSection(&udev_cs); + list_remove(&ext->base.unix_device.entry); + LeaveCriticalSection(&udev_cs); + if (ext->base.report_thread) { write(ext->base.control_pipe[1], "q", 1); @@ -1005,25 +1046,6 @@ static const struct unix_device_vtbl lnxev_device_vtbl = }; #endif -static const char *get_device_syspath(struct udev_device *dev) -{ - struct udev_device *parent; - - if ((parent = udev_device_get_parent_with_subsystem_devtype(dev, "hid", NULL))) - return udev_device_get_syspath(parent); - - if ((parent = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"))) - return udev_device_get_syspath(parent); - - return ""; -} - -static int check_device_syspath(DEVICE_OBJECT *device, void* context) -{ - struct platform_private *private = impl_from_DEVICE_OBJECT(device); - return strcmp(get_device_syspath(private->udev_device), context); -} - static void get_device_subsystem_info(struct udev_device *dev, char const *subsystem, struct device_desc *desc) { struct udev_device *parent = NULL; @@ -1093,9 +1115,10 @@ static void udev_add_device(struct udev_device *dev) TRACE("udev %s syspath %s\n", debugstr_a(devnode), udev_device_get_syspath(dev)); #ifdef HAS_PROPER_INPUT_HEADER - device = bus_enumerate_hid_devices(lnxev_busidW, check_device_syspath, (void *)get_device_syspath(dev)); - if (!device) device = bus_enumerate_hid_devices(hidraw_busidW, check_device_syspath, (void *)get_device_syspath(dev)); - if (device) + EnterCriticalSection(&udev_cs); + private = find_device_from_syspath(get_device_syspath(dev)); + LeaveCriticalSection(&udev_cs); + if (private) { TRACE("duplicate device found, not adding the new one\n"); close(fd); @@ -1156,6 +1179,9 @@ static void udev_add_device(struct udev_device *dev) if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) return; private->unix_device.vtbl = &hidraw_device_vtbl; + EnterCriticalSection(&udev_cs); + list_add_tail(&device_list, &private->unix_device.entry); + LeaveCriticalSection(&udev_cs); device = bus_create_hid_device(&desc, &private->unix_device); if (!device) HeapFree(GetProcessHeap(), 0, private); @@ -1166,6 +1192,9 @@ static void udev_add_device(struct udev_device *dev) if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wine_input_private)))) return; private->unix_device.vtbl = &lnxev_device_vtbl; + EnterCriticalSection(&udev_cs); + list_add_tail(&device_list, &private->unix_device.entry); + LeaveCriticalSection(&udev_cs); device = bus_create_hid_device(&desc, &private->unix_device); if (!device) HeapFree(GetProcessHeap(), 0, private); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 874a837deff..81c4658068b 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -44,6 +44,7 @@ struct unix_device_vtbl struct unix_device { const struct unix_device_vtbl *vtbl; + struct list entry; }; extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN;
1
0
0
0
Rémi Bernon : winebus.sys: Move device vtable to the struct unix_device side.
by Alexandre Julliard
03 Sep '21
03 Sep '21
Module: wine Branch: master Commit: 4366cba6e68d248fc4ebd5765280bd9a83dcee04 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4366cba6e68d248fc4ebd576…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Sep 3 09:30:49 2021 +0200 winebus.sys: Move device vtable to the struct unix_device side. And name the callbacks a bit more consistently. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus.h | 19 +----- dlls/winebus.sys/bus_iohid.c | 61 ++++++++--------- dlls/winebus.sys/bus_sdl.c | 53 ++++++++------- dlls/winebus.sys/bus_udev.c | 108 +++++++++++++++++------------- dlls/winebus.sys/main.c | 120 ++++++++++++++++++++++++++++----- dlls/winebus.sys/unix_private.h | 13 ++++ dlls/winebus.sys/unixlib.c | 144 +++++++++++++++++++++++++++++++--------- dlls/winebus.sys/unixlib.h | 44 ++++++++++++ 8 files changed, 390 insertions(+), 172 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=4366cba6e68d248fc4eb…
1
0
0
0
← Newer
1
...
88
89
90
91
92
93
94
...
103
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200