[PATCH 2/4]Kill PROC macro from NLMv4 server procedures

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

 



In order to make the code more clear, kill PROC macro from NLMv4 server
procedures.

Signed-off-by: Bian Naimeng <biannm@xxxxxxxxxxxxxx>

---
 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



--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux