aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpcb_clnt.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-08-09 15:09:44 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-09 15:09:44 -0400
commitf8b761eff1e49fde43dd940ac32b38cf7cee2a95 (patch)
treeea5cc9f68375c6924f2797916f116835fb5542ea /net/sunrpc/rpcb_clnt.c
parent0e47f0d665efcf1b45f293422d21d8383f07d122 (diff)
SUNRPC: Eliminate PROC macro from rpcb_clnt
Clean up: Replace PROC macro with open coded C99 structure initializers to improve readability. The rpcbind v4 GETVERSADDR procedure is never sent by the current implementation, so it is not copied to the new structures. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/rpcb_clnt.c')
-rw-r--r--net/sunrpc/rpcb_clnt.c113
1 files changed, 91 insertions, 22 deletions
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index c4b716cacf2..830faf4d999 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -864,39 +864,108 @@ out_fail:
864 return -EIO; 864 return -EIO;
865} 865}
866 866
867#define PROC(proc, argtype, restype) \
868 [RPCBPROC_##proc] = { \
869 .p_proc = RPCBPROC_##proc, \
870 .p_encode = (kxdrproc_t) rpcb_enc_##argtype, \
871 .p_decode = (kxdrproc_t) rpcb_dec_##restype, \
872 .p_arglen = RPCB_##argtype##args_sz, \
873 .p_replen = RPCB_##restype##res_sz, \
874 .p_statidx = RPCBPROC_##proc, \
875 .p_timer = 0, \
876 .p_name = #proc, \
877 }
878
879/* 867/*
880 * Not all rpcbind procedures described in RFC 1833 are implemented 868 * Not all rpcbind procedures described in RFC 1833 are implemented
881 * since the Linux kernel RPC code requires only these. 869 * since the Linux kernel RPC code requires only these.
882 */ 870 */
871
883static struct rpc_procinfo rpcb_procedures2[] = { 872static struct rpc_procinfo rpcb_procedures2[] = {
884 PROC(SET, mapping, set), 873 [RPCBPROC_SET] = {
885 PROC(UNSET, mapping, set), 874 .p_proc = RPCBPROC_SET,
886 PROC(GETPORT, mapping, getport), 875 .p_encode = (kxdrproc_t)rpcb_enc_mapping,
876 .p_decode = (kxdrproc_t)rpcb_dec_set,
877 .p_arglen = RPCB_mappingargs_sz,
878 .p_replen = RPCB_setres_sz,
879 .p_statidx = RPCBPROC_SET,
880 .p_timer = 0,
881 .p_name = "SET",
882 },
883 [RPCBPROC_UNSET] = {
884 .p_proc = RPCBPROC_UNSET,
885 .p_encode = (kxdrproc_t)rpcb_enc_mapping,
886 .p_decode = (kxdrproc_t)rpcb_dec_set,
887 .p_arglen = RPCB_mappingargs_sz,
888 .p_replen = RPCB_setres_sz,
889 .p_statidx = RPCBPROC_UNSET,
890 .p_timer = 0,
891 .p_name = "UNSET",
892 },
893 [RPCBPROC_GETPORT] = {
894 .p_proc = RPCBPROC_GETPORT,
895 .p_encode = (kxdrproc_t)rpcb_enc_mapping,
896 .p_decode = (kxdrproc_t)rpcb_dec_getport,
897 .p_arglen = RPCB_mappingargs_sz,
898 .p_replen = RPCB_getportres_sz,
899 .p_statidx = RPCBPROC_GETPORT,
900 .p_timer = 0,
901 .p_name = "GETPORT",
902 },
887}; 903};
888 904
889static struct rpc_procinfo rpcb_procedures3[] = { 905static struct rpc_procinfo rpcb_procedures3[] = {
890 PROC(SET, getaddr, set), 906 [RPCBPROC_SET] = {
891 PROC(UNSET, getaddr, set), 907 .p_proc = RPCBPROC_SET,
892 PROC(GETADDR, getaddr, getaddr), 908 .p_encode = (kxdrproc_t)rpcb_enc_getaddr,
909 .p_decode = (kxdrproc_t)rpcb_dec_set,
910 .p_arglen = RPCB_getaddrargs_sz,
911 .p_replen = RPCB_setres_sz,
912 .p_statidx = RPCBPROC_SET,
913 .p_timer = 0,
914 .p_name = "SET",
915 },
916 [RPCBPROC_UNSET] = {
917 .p_proc = RPCBPROC_UNSET,
918 .p_encode = (kxdrproc_t)rpcb_enc_getaddr,
919 .p_decode = (kxdrproc_t)rpcb_dec_set,
920 .p_arglen = RPCB_getaddrargs_sz,
921 .p_replen = RPCB_setres_sz,
922 .p_statidx = RPCBPROC_UNSET,
923 .p_timer = 0,
924 .p_name = "UNSET",
925 },
926 [RPCBPROC_GETADDR] = {
927 .p_proc = RPCBPROC_GETADDR,
928 .p_encode = (kxdrproc_t)rpcb_enc_getaddr,
929 .p_decode = (kxdrproc_t)rpcb_dec_getaddr,
930 .p_arglen = RPCB_getaddrargs_sz,
931 .p_replen = RPCB_getaddrres_sz,
932 .p_statidx = RPCBPROC_GETADDR,
933 .p_timer = 0,
934 .p_name = "GETADDR",
935 },
893}; 936};
894 937
895static struct rpc_procinfo rpcb_procedures4[] = { 938static struct rpc_procinfo rpcb_procedures4[] = {
896 PROC(SET, getaddr, set), 939 [RPCBPROC_SET] = {
897 PROC(UNSET, getaddr, set), 940 .p_proc = RPCBPROC_SET,
898 PROC(GETADDR, getaddr, getaddr), 941 .p_encode = (kxdrproc_t)rpcb_enc_getaddr,
899 PROC(GETVERSADDR, getaddr, getaddr), 942 .p_decode = (kxdrproc_t)rpcb_dec_set,
943 .p_arglen = RPCB_getaddrargs_sz,
944 .p_replen = RPCB_setres_sz,
945 .p_statidx = RPCBPROC_SET,
946 .p_timer = 0,
947 .p_name = "SET",
948 },
949 [RPCBPROC_UNSET] = {
950 .p_proc = RPCBPROC_UNSET,
951 .p_encode = (kxdrproc_t)rpcb_enc_getaddr,
952 .p_decode = (kxdrproc_t)rpcb_dec_set,
953 .p_arglen = RPCB_getaddrargs_sz,
954 .p_replen = RPCB_setres_sz,
955 .p_statidx = RPCBPROC_UNSET,
956 .p_timer = 0,
957 .p_name = "UNSET",
958 },
959 [RPCBPROC_GETADDR] = {
960 .p_proc = RPCBPROC_GETADDR,
961 .p_encode = (kxdrproc_t)rpcb_enc_getaddr,
962 .p_decode = (kxdrproc_t)rpcb_dec_getaddr,
963 .p_arglen = RPCB_getaddrargs_sz,
964 .p_replen = RPCB_getaddrres_sz,
965 .p_statidx = RPCBPROC_GETADDR,
966 .p_timer = 0,
967 .p_name = "GETADDR",
968 },
900}; 969};
901 970
902static struct rpcb_info rpcb_next_version[] = { 971static struct rpcb_info rpcb_next_version[] = {