diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-01-04 17:53:52 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-01-04 18:22:11 -0500 |
commit | 3c726023402a2f3b28f49b9d90ebf9e71151157d (patch) | |
tree | 434ee06a662815327c8bd34aaf7b5258994dc033 /fs/nfsd/nfs4idmap.c | |
parent | 775a1905e1e042e830eae31e70efec9387eb3e1d (diff) |
nfsd4: return nfs errno from name_to_id functions
This avoids the need for the confusing ESRCH mapping.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4idmap.c')
-rw-r--r-- | fs/nfsd/nfs4idmap.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index cbd599732765..6d2c397d458b 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include "idmap.h" | 39 | #include "idmap.h" |
40 | #include "nfsd.h" | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * Cache entry | 43 | * Cache entry |
@@ -514,7 +515,7 @@ rqst_authname(struct svc_rqst *rqstp) | |||
514 | return clp->name; | 515 | return clp->name; |
515 | } | 516 | } |
516 | 517 | ||
517 | static int | 518 | static __be32 |
518 | idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, | 519 | idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, |
519 | uid_t *id) | 520 | uid_t *id) |
520 | { | 521 | { |
@@ -524,15 +525,15 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen | |||
524 | int ret; | 525 | int ret; |
525 | 526 | ||
526 | if (namelen + 1 > sizeof(key.name)) | 527 | if (namelen + 1 > sizeof(key.name)) |
527 | return -ESRCH; /* nfserr_badowner */ | 528 | return nfserr_badowner; |
528 | memcpy(key.name, name, namelen); | 529 | memcpy(key.name, name, namelen); |
529 | key.name[namelen] = '\0'; | 530 | key.name[namelen] = '\0'; |
530 | strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); | 531 | strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); |
531 | ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item); | 532 | ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item); |
532 | if (ret == -ENOENT) | 533 | if (ret == -ENOENT) |
533 | ret = -ESRCH; /* nfserr_badowner */ | 534 | return nfserr_badowner; |
534 | if (ret) | 535 | if (ret) |
535 | return ret; | 536 | return nfserrno(ret); |
536 | *id = item->id; | 537 | *id = item->id; |
537 | cache_put(&item->h, &nametoid_cache); | 538 | cache_put(&item->h, &nametoid_cache); |
538 | return 0; | 539 | return 0; |
@@ -560,14 +561,14 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name) | |||
560 | return ret; | 561 | return ret; |
561 | } | 562 | } |
562 | 563 | ||
563 | int | 564 | __be32 |
564 | nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen, | 565 | nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen, |
565 | __u32 *id) | 566 | __u32 *id) |
566 | { | 567 | { |
567 | return idmap_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, id); | 568 | return idmap_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, id); |
568 | } | 569 | } |
569 | 570 | ||
570 | int | 571 | __be32 |
571 | nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen, | 572 | nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen, |
572 | __u32 *id) | 573 | __u32 *id) |
573 | { | 574 | { |