bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH gnumach] Use c_string for dev_name_t in the device subsystem.


From: Samuel Thibault
Subject: Re: [PATCH gnumach] Use c_string for dev_name_t in the device subsystem.
Date: Sat, 29 Apr 2023 17:12:16 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le mer. 26 avril 2023 01:22:53 -0400, a ecrit:
> Added device_open_new and device_open_new_request and reused the old MiG
> ID for xxx_device_set_status which has not been in used in the past
> decade.
> 
> Note that device_open_new is gated on defining
> DEVICE_ENABLE_DEVICE_OPEN_NEW because otherwise some hurd servers
> wouldn't compile anymore unless patched. This macro allows us to control
> the rollout.
> ---
>  device/ds_routines.c               |  8 ++++++++
>  include/device/device.defs         | 21 +++++++++++++++++++++
>  include/device/device_request.defs |  8 ++++++++
>  include/device/device_types.defs   |  2 ++
>  4 files changed, 39 insertions(+)
> 
> diff --git a/device/ds_routines.c b/device/ds_routines.c
> index 94e61592..1f0bacf4 100644
> --- a/device/ds_routines.c
> +++ b/device/ds_routines.c
> @@ -170,6 +170,14 @@ ds_device_open (ipc_port_t open_port, ipc_port_t 
> reply_port,
>    return err;
>  }
>  
> +io_return_t
> +ds_device_open_new (ipc_port_t open_port, ipc_port_t reply_port,
> +             mach_msg_type_name_t reply_port_type, dev_mode_t mode,
> +             const_dev_name_t name, device_t *devp)
> +{
> +     return ds_device_open (open_port, reply_port, reply_port_type, mode, 
> name, devp);
> +}
> +
>  io_return_t
>  ds_device_close (device_t dev)
>  {
> diff --git a/include/device/device.defs b/include/device/device.defs
> index d1df799d..7f316129 100644
> --- a/include/device/device.defs
> +++ b/include/device/device.defs
> @@ -53,6 +53,7 @@ type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | 
> polymorphic
>  #endif       /* KERNEL_SERVER */
>  ;
>  
> +/* Deprecated in favor of device_open_new.  */
>  routine device_open(
>               master_port     : mach_port_t;
>       sreplyport reply_port   : reply_port_t;
> @@ -110,7 +111,27 @@ routine  device_read_inband(
>       out     data            : io_buf_ptr_inband_t
>       );
>  
> +#if defined(KERNEL_SERVER) || defined(DEVICE_ENABLE_DEVICE_OPEN_NEW)
> +routine device_open_new(
> +             master_port     : mach_port_t;
> +     sreplyport reply_port   : reply_port_t;
> +             mode            : dev_mode_t;
> +             name            : new_dev_name_t;
> +     out     device          : device_t =
> +                                     MACH_MSG_TYPE_PORT_SEND
> +                                     ctype: mach_port_t
> +#if  KERNEL_SERVER
> +             outtran: mach_port_t convert_device_to_port(device_t)
> +#else
> +#ifdef       DEVICE_OUTTRAN
> +             outtran: DEVICE_OUTTRAN
> +#endif
> +#endif       /* KERNEL_SERVER */
> +     );
> +#else
>  skip;        /* old xxx_device_set_status */
> +#endif
> +
>  skip;        /* old xxx_device_get_status */
>  skip;        /* old xxx_device_set_filter*/
>  
> diff --git a/include/device/device_request.defs 
> b/include/device/device_request.defs
> index 7ea8637c..a8af3a89 100644
> --- a/include/device/device_request.defs
> +++ b/include/device/device_request.defs
> @@ -45,6 +45,7 @@ type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE
>  #endif       /* KERNEL_SERVER */
>  ;
>  
> +/* Deprecated in favor of device_open_new_request.  */
>  simpleroutine device_open_request(
>           device_server_port  : mach_port_t;
>    ureplyport reply_port              : reply_port_t;
> @@ -85,3 +86,10 @@ simpleroutine device_read_request_inband(
>       in  recnum              : recnum_t;
>       in  bytes_wanted        : int
>       );
> +
> +simpleroutine device_open_new_request(
> +         device_server_port  : mach_port_t;
> +  ureplyport reply_port              : reply_port_t;
> +     in  mode                : dev_mode_t;
> +     in  name                : new_dev_name_t
> +     );
> diff --git a/include/device/device_types.defs 
> b/include/device/device_types.defs
> index de8dbb02..c74bff51 100644
> --- a/include/device/device_types.defs
> +++ b/include/device/device_types.defs
> @@ -56,6 +56,8 @@ type recnum_t               = rpc_recnum_t
>  type dev_mode_t              = uint32_t;
>  type dev_flavor_t    = uint32_t;
>  type dev_name_t              = (MACH_MSG_TYPE_STRING_C, 8*128);
> +type new_dev_name_t = c_string[128]
> +     ctype: dev_name_t;
>  type dev_status_t    = array[*:1024] of int;
>  type io_buf_ptr_t    = ^array[] of MACH_MSG_TYPE_INTEGER_8;
>  type io_buf_ptr_inband_t= array[*:128] of char;
> -- 
> 2.39.2
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]