Commit 106c646c authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Stub support for name lookup

NFSv4 need to be able to make from user/group name
to user/group id.  This include file contains some
simple stubs to do this.  They will be replaced with
something that really works later.
parent 700ee9f0
/*
* map between user/group name and id for a given 'client'
*/
struct name_ent {
char name[20];
};
static inline int name_get_user(int uid, struct name_ent **namep)
{
struct name_ent *n = kmalloc(sizeof(*n),GFP_KERNEL);
if (n) sprintf(n->name, "%d",uid);
*namep = n;
return n ? 0 : -ENOMEM;
}
static inline int name_get_group(int uid, struct name_ent **namep)
{
struct name_ent *n = kmalloc(sizeof(*n),GFP_KERNEL);
if (n) sprintf(n->name, "%d",uid);
*namep = n;
return n ? 0 : -ENOMEM;
}
static inline int name_get_uid(char *name, int name_len, int *uidp)
{
*uidp = simple_strtoul(name, NULL, 0);
return 0;
}
static inline int name_get_gid(char *name, int name_len, int *gidp)
{
*gidp = simple_strtoul(name, NULL, 0);
return 0;
}
static inline void name_put(struct name_ent *ent)
{
kfree(ent);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment