mirror of https://gitee.com/openkylin/linux.git
nfsd: idmap use u32 not uid_t as the intermediate type
u32 and uid_t have the same size and semantics so this change should have no operational effect. This just removes the WTF factor when looking at variables that hold both uids and gids whos type is uid_t. Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
6c1810e040
commit
b5663898ec
|
@ -65,7 +65,7 @@ MODULE_PARM_DESC(nfs4_disable_idmapping,
|
||||||
struct ent {
|
struct ent {
|
||||||
struct cache_head h;
|
struct cache_head h;
|
||||||
int type; /* User / Group */
|
int type; /* User / Group */
|
||||||
uid_t id;
|
u32 id;
|
||||||
char name[IDMAP_NAMESZ];
|
char name[IDMAP_NAMESZ];
|
||||||
char authname[IDMAP_NAMESZ];
|
char authname[IDMAP_NAMESZ];
|
||||||
};
|
};
|
||||||
|
@ -540,7 +540,7 @@ rqst_authname(struct svc_rqst *rqstp)
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen,
|
idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen,
|
||||||
uid_t *id)
|
u32 *id)
|
||||||
{
|
{
|
||||||
struct ent *item, key = {
|
struct ent *item, key = {
|
||||||
.type = type,
|
.type = type,
|
||||||
|
@ -564,7 +564,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
|
idmap_id_to_name(struct svc_rqst *rqstp, int type, u32 id, char *name)
|
||||||
{
|
{
|
||||||
struct ent *item, key = {
|
struct ent *item, key = {
|
||||||
.id = id,
|
.id = id,
|
||||||
|
@ -587,7 +587,7 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, uid_t *id)
|
numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u32 *id)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char buf[11];
|
char buf[11];
|
||||||
|
@ -603,7 +603,7 @@ numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namel
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
do_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, uid_t *id)
|
do_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u32 *id)
|
||||||
{
|
{
|
||||||
if (nfs4_disable_idmapping && rqstp->rq_cred.cr_flavor < RPC_AUTH_GSS)
|
if (nfs4_disable_idmapping && rqstp->rq_cred.cr_flavor < RPC_AUTH_GSS)
|
||||||
if (numeric_name_to_id(rqstp, type, name, namelen, id))
|
if (numeric_name_to_id(rqstp, type, name, namelen, id))
|
||||||
|
@ -616,7 +616,7 @@ do_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
|
do_id_to_name(struct svc_rqst *rqstp, int type, u32 id, char *name)
|
||||||
{
|
{
|
||||||
if (nfs4_disable_idmapping && rqstp->rq_cred.cr_flavor < RPC_AUTH_GSS)
|
if (nfs4_disable_idmapping && rqstp->rq_cred.cr_flavor < RPC_AUTH_GSS)
|
||||||
return sprintf(name, "%u", id);
|
return sprintf(name, "%u", id);
|
||||||
|
|
Loading…
Reference in New Issue