diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2007-08-09 18:34:32 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2007-10-09 18:31:57 -0400 |
commit | c175b83c4c4be72535c5c12abc155e29a08323a0 (patch) | |
tree | 10f0366f87ca31ba30e7d7edeabf5cdac4097f9d /fs/nfsd/nfs4state.c | |
parent | 246d95ba051101e515670a1cbe2907a88d360b88 (diff) |
knfsd: remove code duplication in nfsd4_setclientid()
Each branch of this if-then-else has a bunch of duplicated code that we
could just put at the end.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Acked-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 09573b9f76c7..6256492b2363 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -774,13 +774,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
774 | new = create_client(clname, dname); | 774 | new = create_client(clname, dname); |
775 | if (new == NULL) | 775 | if (new == NULL) |
776 | goto out; | 776 | goto out; |
777 | copy_verf(new, &clverifier); | ||
778 | new->cl_addr = sin->sin_addr.s_addr; | ||
779 | copy_cred(&new->cl_cred,&rqstp->rq_cred); | ||
780 | gen_clid(new); | 777 | gen_clid(new); |
781 | gen_confirm(new); | ||
782 | gen_callback(new, setclid); | ||
783 | add_to_unconfirmed(new, strhashval); | ||
784 | } else if (same_verf(&conf->cl_verifier, &clverifier)) { | 778 | } else if (same_verf(&conf->cl_verifier, &clverifier)) { |
785 | /* | 779 | /* |
786 | * CASE 1: | 780 | * CASE 1: |
@@ -806,13 +800,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
806 | new = create_client(clname, dname); | 800 | new = create_client(clname, dname); |
807 | if (new == NULL) | 801 | if (new == NULL) |
808 | goto out; | 802 | goto out; |
809 | copy_verf(new,&conf->cl_verifier); | ||
810 | new->cl_addr = sin->sin_addr.s_addr; | ||
811 | copy_cred(&new->cl_cred,&rqstp->rq_cred); | ||
812 | copy_clid(new, conf); | 803 | copy_clid(new, conf); |
813 | gen_confirm(new); | ||
814 | gen_callback(new, setclid); | ||
815 | add_to_unconfirmed(new,strhashval); | ||
816 | } else if (!unconf) { | 804 | } else if (!unconf) { |
817 | /* | 805 | /* |
818 | * CASE 2: | 806 | * CASE 2: |
@@ -825,13 +813,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
825 | new = create_client(clname, dname); | 813 | new = create_client(clname, dname); |
826 | if (new == NULL) | 814 | if (new == NULL) |
827 | goto out; | 815 | goto out; |
828 | copy_verf(new,&clverifier); | ||
829 | new->cl_addr = sin->sin_addr.s_addr; | ||
830 | copy_cred(&new->cl_cred,&rqstp->rq_cred); | ||
831 | gen_clid(new); | 816 | gen_clid(new); |
832 | gen_confirm(new); | ||
833 | gen_callback(new, setclid); | ||
834 | add_to_unconfirmed(new, strhashval); | ||
835 | } else if (!same_verf(&conf->cl_confirm, &unconf->cl_confirm)) { | 817 | } else if (!same_verf(&conf->cl_confirm, &unconf->cl_confirm)) { |
836 | /* | 818 | /* |
837 | * CASE3: | 819 | * CASE3: |
@@ -852,19 +834,19 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
852 | new = create_client(clname, dname); | 834 | new = create_client(clname, dname); |
853 | if (new == NULL) | 835 | if (new == NULL) |
854 | goto out; | 836 | goto out; |
855 | copy_verf(new,&clverifier); | ||
856 | new->cl_addr = sin->sin_addr.s_addr; | ||
857 | copy_cred(&new->cl_cred,&rqstp->rq_cred); | ||
858 | gen_clid(new); | 837 | gen_clid(new); |
859 | gen_confirm(new); | ||
860 | gen_callback(new, setclid); | ||
861 | add_to_unconfirmed(new, strhashval); | ||
862 | } else { | 838 | } else { |
863 | /* No cases hit !!! */ | 839 | /* No cases hit !!! */ |
864 | status = nfserr_inval; | 840 | status = nfserr_inval; |
865 | goto out; | 841 | goto out; |
866 | 842 | ||
867 | } | 843 | } |
844 | copy_verf(new, &clverifier); | ||
845 | new->cl_addr = sin->sin_addr.s_addr; | ||
846 | copy_cred(&new->cl_cred, &rqstp->rq_cred); | ||
847 | gen_confirm(new); | ||
848 | gen_callback(new, setclid); | ||
849 | add_to_unconfirmed(new, strhashval); | ||
868 | setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot; | 850 | setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot; |
869 | setclid->se_clientid.cl_id = new->cl_clientid.cl_id; | 851 | setclid->se_clientid.cl_id = new->cl_clientid.cl_id; |
870 | memcpy(setclid->se_confirm.data, new->cl_confirm.data, sizeof(setclid->se_confirm.data)); | 852 | memcpy(setclid->se_confirm.data, new->cl_confirm.data, sizeof(setclid->se_confirm.data)); |