bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 7/8] eth-filter: improve the demuxer function


From: Samuel Thibault
Subject: Re: [PATCH 7/8] eth-filter: improve the demuxer function
Date: Fri, 11 Apr 2014 23:15:11 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Fri 11 Apr 2014 23:09:57 +0200, a écrit :
> Handle multiple request types as recommended by the Mach Server
> Writer's Guide section 4, subsection "Handling Multiple Request
> Types".  This avoids initializing the reply message in every X_server
> function.  The reply message has already been properly initialized in
> libports, so there is no need to call mig_reply_setup.

Ack.

> * eth-filter/filter.c (filter_demuxer): Improve the demuxer function.
> Also, move it below the ethernet_demuxer function to avoid the need
> for a forward declaration.  Prioritize the ethernet_demuxer.
> ---
>  eth-filter/filter.c | 29 ++++++++++++++++++-----------
>  1 file changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/eth-filter/filter.c b/eth-filter/filter.c
> index 7a25c10..482b080 100644
> --- a/eth-filter/filter.c
> +++ b/eth-filter/filter.c
> @@ -194,17 +194,6 @@ clean_proxy_device (void *p)
>      device->proxy->device = NULL;
>  }
>  
> -static int
> -filter_demuxer (mach_msg_header_t *inp,
> -             mach_msg_header_t *outp)
> -{
> -  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
> -  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
> -  extern int ethernet_demuxer (mach_msg_header_t *, mach_msg_header_t *);
> -  return device_server (inp, outp) || notify_server (inp, outp)
> -    || ethernet_demuxer (inp, outp) || trivfs_demuxer (inp, outp);
> -}
> -
>  int
>  ethernet_demuxer (mach_msg_header_t *inp,
>                 mach_msg_header_t *outp)
> @@ -233,6 +222,24 @@ ethernet_demuxer (mach_msg_header_t *inp,
>    return 1;
>  }
>  
> +static int
> +filter_demuxer (mach_msg_header_t *inp,
> +             mach_msg_header_t *outp)
> +{
> +  mig_routine_t routine;
> +  if ((routine = NULL, ethernet_demuxer (inp, outp)) ||
> +      (routine = device_server_routine (inp)) ||
> +      (routine = notify_server_routine (inp)) ||
> +      (routine = NULL, trivfs_demuxer (inp, outp)))
> +    {
> +      if (routine)
> +        (*routine) (inp, outp);
> +      return TRUE;
> +    }
> +  else
> +    return FALSE;
> +}
> +
>  /* Implementation of notify interface */
>  kern_return_t
>  do_mach_notify_port_deleted (struct port_info *pi,
> -- 
> 1.9.1
> 

-- 
Samuel
<s> je la connaissais pas celle la : "make: Entering an unknown directory"
 -+- #ens-mim -+-



reply via email to

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