[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] trans: improve the netfs_demuxer function in fakeroot.c
From: |
Justus Winter |
Subject: |
[PATCH 4/7] trans: improve the netfs_demuxer function in fakeroot.c |
Date: |
Wed, 4 Dec 2013 12:11:53 +0100 |
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.
* trans/fakeroot.c (netfs_demuxer): Improve the demuxer function.
---
trans/fakeroot.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index f3df46b..679e476 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -838,20 +838,26 @@ int
netfs_demuxer (mach_msg_header_t *inp,
mach_msg_header_t *outp)
{
- int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
- int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
- int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
-
- if (netfs_io_server (inp, outp)
- || netfs_fs_server (inp, outp)
- || ports_notify_server (inp, outp)
- || netfs_fsys_server (inp, outp)
+ mig_routine_t netfs_io_server_routine (mach_msg_header_t *);
+ mig_routine_t netfs_fs_server_routine (mach_msg_header_t *);
+ mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+ mig_routine_t netfs_fsys_server_routine (mach_msg_header_t *);
+ mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+
+ mig_routine_t routine;
+ if ((routine = netfs_io_server_routine (inp)) ||
+ (routine = netfs_fs_server_routine (inp)) ||
+ (routine = ports_notify_server_routine (inp)) ||
+ (routine = netfs_fsys_server_routine (inp)) ||
/* XXX we should intercept interrupt_operation and do
the ports_S_interrupt_operation work as well as
sending an interrupt_operation to the underlying file.
*/
- || ports_interrupt_server (inp, outp))
- return 1;
+ (routine = ports_interrupt_server_routine (inp)))
+ {
+ (*routine) (inp, outp);
+ return TRUE;
+ }
else
{
/* We didn't recognize the message ID, so pass the message through
--
1.7.10.4
- [PATCH 1/7] auth: improve the auth_demuxer function, Justus Winter, 2013/12/04
- [PATCH 3/7] trans: remove unused declaration from fakeroot.c, Justus Winter, 2013/12/04
- [PATCH 4/7] trans: improve the netfs_demuxer function in fakeroot.c,
Justus Winter <=
- [PATCH 5/7] trans: fix the creation of files in fakeroot, Justus Winter, 2013/12/04
- [PATCH 2/7] utils: improve the auth_demuxer function in fakeauth.c, Justus Winter, 2013/12/04
- [PATCH 7/7] trans: make the fakeroot environment more transparent, Justus Winter, 2013/12/04
- [PATCH 6/7] trans: fix transparent reauthentication in fakeroot, Justus Winter, 2013/12/04
- Re: [PATCH 1/7] auth: improve the auth_demuxer function, Samuel Thibault, 2013/12/04