[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 15/25: libmachdev: improve the demuxer functions
From: |
Samuel Thibault |
Subject: |
[hurd] 15/25: libmachdev: improve the demuxer functions |
Date: |
Tue, 27 May 2014 08:32:03 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch dde
in repository hurd.
commit f24cfd85037c2bf4d1c49fde8efe9038064b0e5c
Author: Justus Winter <address@hidden>
Date: Fri Apr 11 22:45:05 2014 +0200
libmachdev: improve the demuxer functions
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.
* 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
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 21/25: libmachdev: drop unused declarations, (continued)
- [hurd] 21/25: libmachdev: drop unused declarations, Samuel Thibault, 2014/05/27
- [hurd] 14/25: devnode: improve the demuxer function, Samuel Thibault, 2014/05/27
- [hurd] 24/25: Merge remote-tracking branch 'incubator/dde' into dde-upstream, Samuel Thibault, 2014/05/27
- [hurd] 03/25: Drop DIST_FILES from Makefile, Samuel Thibault, 2014/05/27
- [hurd] 22/25: libmachdev: add missing includes, Samuel Thibault, 2014/05/27
- [hurd] 25/25: Merge branch 'dde-upstream' into dde, Samuel Thibault, 2014/05/27
- [hurd] 23/25: libmachdev: add, fix and use declaration for create_device_port, Samuel Thibault, 2014/05/27
- [hurd] 08/25: libmachdev: fix receiver lookups, Samuel Thibault, 2014/05/27
- [hurd] 05/25: eth-multiplexer: fix receiver lookups, Samuel Thibault, 2014/05/27
- [hurd] 13/25: eth-multiplexer: fix argp_program_version, remove argp_program_bug_address, Samuel Thibault, 2014/05/27
- [hurd] 15/25: libmachdev: improve the demuxer functions,
Samuel Thibault <=
- [hurd] 16/25: eth-filter: improve the demuxer function, Samuel Thibault, 2014/05/27
- [hurd] 10/25: devnode: remove the ourdevice hack, Samuel Thibault, 2014/05/27
- [hurd] 04/25: eth-filter: fix receiver lookups, Samuel Thibault, 2014/05/27
- [hurd] 01/25: libports: fix notify_port_t receiver lookups, Samuel Thibault, 2014/05/27