diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-24 13:31:31 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-25 11:16:16 +0100 |
commit | d4129a39dda08e8cfbc002461e1e76103de8f108 (patch) | |
tree | adbcb3f8fd791884df9b1fc88e9e1708ade5b61f /mach-defpager | |
parent | b7521a33ad61286eb9e32915c3a691c824bae719 (diff) |
mach-defpager: improve the default_pager_demux_object function
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.
* mach-defpager/default_pager.c (default_pager_demux_object): Improve
the demuxer function.
Diffstat (limited to 'mach-defpager')
-rw-r--r-- | mach-defpager/default_pager.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index 805e0654..0977a5d8 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -54,7 +54,10 @@ #include <file_io.h> +#include "memory_object_S.h" +#include "memory_object_default_S.h" #include "default_pager_S.h" +#include "exc_S.h" #define debug 0 @@ -3019,7 +3022,6 @@ boolean_t default_pager_notify_server(in, out) return TRUE; } -extern boolean_t seqnos_memory_object_server(); extern boolean_t seqnos_memory_object_default_server(); extern boolean_t default_pager_server(); extern boolean_t exc_server(); @@ -3069,15 +3071,23 @@ default_pager_demux_object(in, out) * the memory_object_default interface. */ -int rval; -ddprintf ("DPAGER DEMUX OBJECT <%p>: %d\n", in, in->msgh_id); -rval = - (seqnos_memory_object_server(in, out) || - seqnos_memory_object_default_server(in, out) || - default_pager_notify_server(in, out) || - default_pager_server(in, out)); -ddprintf ("DPAGER DEMUX OBJECT DONE <%p>: %d\n", in, in->msgh_id); -return rval; + int rval = FALSE; + ddprintf ("DPAGER DEMUX OBJECT <%p>: %d\n", in, in->msgh_id); + mig_reply_setup (in, out); + + mig_routine_t routine; + if ((routine = seqnos_memory_object_server_routine (in)) || + (routine = seqnos_memory_object_default_server_routine (in)) || + (routine = NULL, default_pager_notify_server (in, out)) || + (routine = default_pager_server_routine (in))) + { + if (routine) + (*routine) (in, out); + rval = TRUE; + } + + ddprintf ("DPAGER DEMUX OBJECT DONE <%p>: %d\n", in, in->msgh_id); + return rval; } mach_msg_size_t default_pager_msg_size_default = 8 * 1024; |