[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/8] libmachdev: improve the demuxer functions
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 6/8] libmachdev: improve the demuxer functions |
Date: |
Fri, 11 Apr 2014 23:14:58 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Fri 11 Apr 2014 23:09:56 +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.
> * libmachdev/ds_routines.c (demuxer): Improve the demuxer function.
> * libmachdev/trivfs_server.c (demuxer): Likewise.
> ---
> libmachdev/ds_routines.c | 14 +++++++++-----
> libmachdev/trivfs_server.c | 17 +++++++++++------
> 2 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
> index bbf5488..0e431a3 100644
> --- a/libmachdev/ds_routines.c
> +++ b/libmachdev/ds_routines.c
> @@ -360,11 +360,15 @@ void mach_device_init()
> static int
> demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
> {
> - int ret;
> - extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
> - extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
> - ret = device_server (inp, outp) || notify_server (inp, outp);
> - return ret;
> + mig_routine_t routine;
> + if ((routine = device_server_routine (inp)) ||
> + (routine = notify_server_routine (inp)))
> + {
> + (*routine) (inp, outp);
> + return TRUE;
> + }
> + else
> + return FALSE;
> }
>
> void reg_dev_emul (struct device_emulation_ops *ops)
> diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
> index 6d5b3ad..0d7fe24 100644
> --- a/libmachdev/trivfs_server.c
> +++ b/libmachdev/trivfs_server.c
> @@ -125,12 +125,17 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
> static int
> demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
> {
> - int ret;
> - extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
> - extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
> - ret = device_server (inp, outp) || notify_server (inp, outp)
> - || trivfs_demuxer (inp, outp);
> - return ret;
> + mig_routine_t routine;
> + if ((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;
> }
>
> void
> --
> 1.9.1
>
--
Samuel
Running Windows on a Pentium is like having a brand new Porsche but only
be able to drive backwards with the handbrake on.
(Unknown source)
- Re: [PATCH 3/8] eth-filter: fix argp_program_version, remove argp_program_bug_address, (continued)
- [PATCH 5/8] devnode: improve the demuxer function, Justus Winter, 2014/04/11
- Re: [PATCH 5/8] devnode: improve the demuxer function, Samuel Thibault, 2014/04/11
- [PATCH 7/8] eth-filter: improve the demuxer function, Justus Winter, 2014/04/11
- Re: [PATCH 7/8] eth-filter: improve the demuxer function, Samuel Thibault, 2014/04/11
- [PATCH 8/8] eth-multiplexer: improve the demuxer function, Justus Winter, 2014/04/11
- Re: [PATCH 8/8] eth-multiplexer: improve the demuxer function, Samuel Thibault, 2014/04/11
- [PATCH 6/8] libmachdev: improve the demuxer functions, Justus Winter, 2014/04/11
- Re: [PATCH 6/8] libmachdev: improve the demuxer functions,
Samuel Thibault <=
- Re: [PATCH 1/8] devnode: remove the ourdevice hack, Samuel Thibault, 2014/04/12
Re: [PATCH] include: fix the definition of device_open, Samuel Thibault, 2014/04/11
Re: [PATCH] include: fix the definition of device_open, Samuel Thibault, 2014/04/12