bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 5/8] devnode: improve the demuxer function


From: Justus Winter
Subject: [PATCH 5/8] devnode: improve the demuxer function
Date: Fri, 11 Apr 2014 23:09:55 +0200

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.

* devnode/devnode.c (devnode_demuxer): Improve the demuxer function.
---
 devnode/devnode.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/devnode/devnode.c b/devnode/devnode.c
index dbbd40e..789bf51 100644
--- a/devnode/devnode.c
+++ b/devnode/devnode.c
@@ -82,10 +82,17 @@ static int
 devnode_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 *);
-  return device_server (inp, outp) || notify_server (inp, outp)
-    || trivfs_demuxer (inp, outp);
+  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;
 }
 
 /* Implementation of notify interface */
-- 
1.9.1




reply via email to

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