X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/dfe8486473094c0769fd1922329c3f0dfd8f43c0..130f2d53438eb6193accb445aca52fa8e2fe4158:/rpc/rpc.h diff --git a/rpc/rpc.h b/rpc/rpc.h index 723121c..f7245ad 100644 --- a/rpc/rpc.h +++ b/rpc/rpc.h @@ -111,144 +111,40 @@ class rpcc : public chanmgr { template int call_m(unsigned int proc, marshall &req, R & r, TO to); - template - int call(unsigned int proc, R & r, TO to = to_max); - template - int call(unsigned int proc, const A1 & a1, R & r, TO to = to_max); - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, R & r, - TO to = to_max); - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - R & r, TO to = to_max); - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - const A4 & a4, R & r, TO to = to_max); - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - const A4 & a4, const A5 & a5, R & r, TO to = to_max); - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - const A4 & a4, const A5 & a5, const A6 & a6, - R & r, TO to = to_max); - template - int call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, - const A4 & a4, const A5 & a5, const A6 &a6, const A7 &a7, - R & r, TO to = to_max); + template + inline int call(unsigned int proc, R & r, const Args&... args); + template + inline int call_timeout(unsigned int proc, TO to, R & r, const Args&... args); }; template int rpcc::call_m(unsigned int proc, marshall &req, R & r, TO to) { - unmarshall u; - int intret = call1(proc, req, u, to); - if (intret < 0) return intret; - u >> r; - if(u.okdone() != true) { - fprintf(stderr, "rpcc::call_m: failed to unmarshall the reply." - "You are probably calling RPC 0x%x with wrong return " - "type.\n", proc); - VERIFY(0); - return rpc_const::unmarshal_reply_failure; - } - return intret; -} - -template int -rpcc::call(unsigned int proc, R & r, TO to) -{ - marshall m; - return call_m(proc, m, r, to); -} - -template int -rpcc::call(unsigned int proc, const A1 & a1, R & r, TO to) -{ - marshall m; - m << a1; - return call_m(proc, m, r, to); -} - -template int -rpcc::call(unsigned int proc, const A1 & a1, const A2 & a2, - R & r, TO to) -{ - marshall m; - m << a1; - m << a2; - return call_m(proc, m, r, to); -} - -template int -rpcc::call(unsigned int proc, const A1 & a1, const A2 & a2, - const A3 & a3, R & r, TO to) -{ - marshall m; - m << a1; - m << a2; - m << a3; - return call_m(proc, m, r, to); + unmarshall u; + int intret = call1(proc, req, u, to); + if (intret < 0) return intret; + u >> r; + if (u.okdone() != true) { + fprintf(stderr, "rpcc::call_m: failed to unmarshall the reply." + "You are probably calling RPC 0x%x with wrong return " + "type.\n", proc); + VERIFY(0); + return rpc_const::unmarshal_reply_failure; + } + return intret; } -template int -rpcc::call(unsigned int proc, const A1 & a1, const A2 & a2, - const A3 & a3, const A4 & a4, R & r, TO to) +template inline int +rpcc::call(unsigned int proc, R & r, const Args&... args) { - marshall m; - m << a1; - m << a2; - m << a3; - m << a4; - return call_m(proc, m, r, to); -} - -template int -rpcc::call(unsigned int proc, const A1 & a1, const A2 & a2, - const A3 & a3, const A4 & a4, const A5 & a5, R & r, TO to) -{ - marshall m; - m << a1; - m << a2; - m << a3; - m << a4; - m << a5; - return call_m(proc, m, r, to); -} - -template int -rpcc::call(unsigned int proc, const A1 & a1, const A2 & a2, - const A3 & a3, const A4 & a4, const A5 & a5, - const A6 & a6, R & r, TO to) -{ - marshall m; - m << a1; - m << a2; - m << a3; - m << a4; - m << a5; - m << a6; - return call_m(proc, m, r, to); + return call_timeout(proc, rpcc::to_max, r, args...); } -template int -rpcc::call(unsigned int proc, const A1 & a1, const A2 & a2, - const A3 & a3, const A4 & a4, const A5 & a5, - const A6 & a6, const A7 & a7, - R & r, TO to) +template inline int +rpcc::call_timeout(unsigned int proc, const rpcc::TO to, R & r, const Args&... args) { - marshall m; - m << a1; - m << a2; - m << a3; - m << a4; - m << a5; - m << a6; - m << a7; + marshall m{args...}; return call_m(proc, m, r, to); }