From: Bian Naimeng <biannm@cn.fujitsu.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/4]Kill PROC macro from NLMv4 server procedures
Date: Thu, 16 Jul 2009 17:30:45 +0800 [thread overview]
Message-ID: <4A5EF345.7050308@cn.fujitsu.com> (raw)
In-Reply-To: <4A5EF29B.1050100@cn.fujitsu.com>
In order to make the code more clear, kill PROC macro from NLMv4 server
procedures.
Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
---
fs/lockd/svc4proc.c | 237 +++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 203 insertions(+), 34 deletions(-)
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index bd173a6..5c31626 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -468,44 +468,213 @@ nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
struct nlm_void { int dummy; };
-#define PROC(name, xargt, xrest, argt, rest, respsize) \
- { .pc_func = (svc_procfunc) nlm4svc_proc_##name, \
- .pc_decode = (kxdrproc_t) nlm4svc_decode_##xargt, \
- .pc_encode = (kxdrproc_t) nlm4svc_encode_##xrest, \
- .pc_release = NULL, \
- .pc_argsize = sizeof(struct nlm_##argt), \
- .pc_ressize = sizeof(struct nlm_##rest), \
- .pc_xdrressize = respsize, \
- }
+#define NLM4SVC_NONE_PROC \
+{ \
+ .pc_func = (svc_procfunc) nlm4svc_proc_none, \
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_void, \
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_void, \
+ .pc_release = NULL, \
+ .pc_argsize = sizeof(struct nlm_void), \
+ .pc_ressize = sizeof(struct nlm_void), \
+ .pc_xdrressize = 0, \
+}
+
#define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN)) /* cookie */
#define No (1+1024/4) /* netobj */
#define St 1 /* status */
#define Rg 4 /* range (offset + length) */
struct svc_procedure nlmsvc_procedures4[] = {
- PROC(null, void, void, void, void, 1),
- PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg),
- PROC(lock, lockargs, res, args, res, Ck+St),
- PROC(cancel, cancargs, res, args, res, Ck+St),
- PROC(unlock, unlockargs, res, args, res, Ck+St),
- PROC(granted, testargs, res, args, res, Ck+St),
- PROC(test_msg, testargs, norep, args, void, 1),
- PROC(lock_msg, lockargs, norep, args, void, 1),
- PROC(cancel_msg, cancargs, norep, args, void, 1),
- PROC(unlock_msg, unlockargs, norep, args, void, 1),
- PROC(granted_msg, testargs, norep, args, void, 1),
- PROC(test_res, testres, norep, res, void, 1),
- PROC(lock_res, lockres, norep, res, void, 1),
- PROC(cancel_res, cancelres, norep, res, void, 1),
- PROC(unlock_res, unlockres, norep, res, void, 1),
- PROC(granted_res, res, norep, res, void, 1),
+ [NLMPROC_NULL] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_null,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_void,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_void,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_void),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_TEST] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_test,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_testargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_testres,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St+2+No+Rg,
+ },
+ [NLMPROC_LOCK] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_lock,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_lockargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_res,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St,
+ },
+ [NLMPROC_CANCEL] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_cancel,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_cancargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_res,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St,
+ },
+ [NLMPROC_UNLOCK] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_unlock,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_unlockargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_res,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St,
+ },
+ [NLMPROC_GRANTED] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_granted,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_testargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_res,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St,
+ },
+ [NLMPROC_TEST_MSG] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_test_msg,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_testargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_LOCK_MSG] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_lock_msg,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_lockargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_CANCEL_MSG] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_cancel_msg,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_cancargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_UNLOCK_MSG] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_unlock_msg,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_unlockargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_GRANTED_MSG] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_granted_msg,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_testargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_TEST_RES] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_test_res,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_testres,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_LOCK_RES] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_lock_res,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_lockres,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_CANCEL_RES] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_cancel_res,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_cancelres,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_UNLOCK_RES] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_unlock_res,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_unlockres,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ [NLMPROC_GRANTED_RES] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_granted_res,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_res,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_norep,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_res),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
/* statd callback */
- PROC(sm_notify, reboot, void, reboot, void, 1),
- PROC(none, void, void, void, void, 0),
- PROC(none, void, void, void, void, 0),
- PROC(none, void, void, void, void, 0),
- PROC(share, shareargs, shareres, args, res, Ck+St+1),
- PROC(unshare, shareargs, shareres, args, res, Ck+St+1),
- PROC(nm_lock, lockargs, res, args, res, Ck+St),
- PROC(free_all, notify, void, args, void, 1),
-
+ [NLMPROC_NSM_NOTIFY] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_sm_notify,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_reboot,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_void,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_reboot),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
+ NLM4SVC_NONE_PROC,
+ NLM4SVC_NONE_PROC,
+ NLM4SVC_NONE_PROC,
+ [NLMPROC_SHARE] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_share,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_shareargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_shareres,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St+1,
+ },
+ [NLMPROC_UNSHARE] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_unshare,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_shareargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_shareres,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St+1,
+ },
+ [NLMPROC_NM_LOCK] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_nm_lock,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_lockargs,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_res,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_res),
+ .pc_xdrressize = Ck+St,
+ },
+ [NLMPROC_FREE_ALL] = {
+ .pc_func = (svc_procfunc) nlm4svc_proc_free_all,
+ .pc_decode = (kxdrproc_t) nlm4svc_decode_notify,
+ .pc_encode = (kxdrproc_t) nlm4svc_encode_void,
+ .pc_release = NULL,
+ .pc_argsize = sizeof(struct nlm_args),
+ .pc_ressize = sizeof(struct nlm_void),
+ .pc_xdrressize = 1,
+ },
};
--
1.6.0.3
next prev parent reply other threads:[~2009-07-16 9:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 9:27 [PATCH 0/4] Kill PROC macro from NLM Bian Naimeng
2009-07-16 9:29 ` [PATCH 1/4] NLM: Kill PROC macro from NLMv1 and NLMv3 server procedures Bian Naimeng
2009-07-16 21:27 ` Trond Myklebust
[not found] ` <1247779647.12292.164.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-07-17 3:33 ` Bian Naimeng
2009-07-16 9:30 ` Bian Naimeng [this message]
2009-07-16 9:31 ` [PATCH 3/4] NLM: Kill PROC macro from NLMv1 and NLMv3 client procedures Bian Naimeng
2009-07-16 9:32 ` [PATCH 4/4]NLM: Kill PROC macro from NLMv4 " Bian Naimeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A5EF345.7050308@cn.fujitsu.com \
--to=biannm@cn.fujitsu.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.