[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] libdiskfs: improve the diskfs_demuxer function
From: |
Justus Winter |
Subject: |
[PATCH] libdiskfs: improve the diskfs_demuxer function |
Date: |
Fri, 29 Nov 2013 14:30:59 +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.
Furthermore, move diskfs_exec_startup_server_routine to the end of the
chain, as the startup related functions are only needed at system
bootstrap time in the root filesystem.
* libdiskfs/demuxer.c (diskfs_demuxer): Improve the demuxer function.
---
libdiskfs/demuxer.c | 43 ++++++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/libdiskfs/demuxer.c b/libdiskfs/demuxer.c
index 7425dc5..b1facdb 100644
--- a/libdiskfs/demuxer.c
+++ b/libdiskfs/demuxer.c
@@ -1,5 +1,5 @@
/* Demultiplexer for diskfs library
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 2013 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -21,20 +21,29 @@ int
diskfs_demuxer (mach_msg_header_t *inp,
mach_msg_header_t *outp)
{
- int diskfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
- int diskfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
- int diskfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
- int diskfs_exec_startup_server (mach_msg_header_t *, mach_msg_header_t *);
- int diskfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *);
- int diskfs_startup_notify_server (mach_msg_header_t *, mach_msg_header_t *);
-
-
- return (diskfs_io_server (inp, outp)
- || diskfs_fs_server (inp, outp)
- || ports_notify_server (inp, outp)
- || diskfs_fsys_server (inp, outp)
- || diskfs_exec_startup_server (inp, outp)
- || ports_interrupt_server (inp, outp)
- || (diskfs_shortcut_ifsock ? diskfs_ifsock_server (inp, outp) : 0)
- || diskfs_startup_notify_server (inp, outp));
+ mig_routine_t diskfs_fs_server_routine (mach_msg_header_t *);
+ mig_routine_t diskfs_io_server_routine (mach_msg_header_t *);
+ mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+ mig_routine_t diskfs_fsys_server_routine (mach_msg_header_t *);
+ mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+ mig_routine_t diskfs_ifsock_server_routine (mach_msg_header_t *);
+ mig_routine_t diskfs_exec_startup_server_routine (mach_msg_header_t *);
+ mig_routine_t diskfs_startup_notify_server_routine (mach_msg_header_t *);
+
+ mig_routine_t routine;
+ if ((routine = diskfs_io_server_routine (inp)) ||
+ (routine = diskfs_fs_server_routine (inp)) ||
+ (routine = ports_notify_server_routine (inp)) ||
+ (routine = diskfs_fsys_server_routine (inp)) ||
+ (routine = ports_interrupt_server_routine (inp)) ||
+ (diskfs_shortcut_ifsock ?
+ (routine = diskfs_ifsock_server_routine (inp)) : 0) ||
+ (routine = diskfs_startup_notify_server_routine (inp)) ||
+ (routine = diskfs_exec_startup_server_routine (inp)))
+ {
+ (*routine) (inp, outp);
+ return TRUE;
+ }
+ else
+ return FALSE;
}
--
1.7.10.4
- Improving the demuxer functions, Justus Winter, 2013/11/29
- [PATCH] libdiskfs: improve the diskfs_demuxer function,
Justus Winter <=
- [PATCH 1/7] libdiskfs: improve the diskfs_demuxer function, Justus Winter, 2013/11/30
- [PATCH 3/7] libtrivfs: improve the trivfs_demuxer function, Justus Winter, 2013/11/30
- [PATCH 2/7] libnetfs: improve the netfs_demuxer function, Justus Winter, 2013/11/30
- [PATCH 5/7] proc: improve the message_demuxer function, Justus Winter, 2013/11/30
- [PATCH 4/7] exec: improve the exec_demuxer function, Justus Winter, 2013/11/30
- [PATCH 6/7] pfinet: improve the pfinet_demuxer function, Justus Winter, 2013/11/30
- [PATCH 7/7] pflocal: improve the demuxer functions, Justus Winter, 2013/11/30