]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kNFSd: Stub support for name lookup
authorNeil Brown <neilb@cse.unsw.edu.au>
Fri, 11 Oct 2002 12:34:38 +0000 (05:34 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 11 Oct 2002 12:34:38 +0000 (05:34 -0700)
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.

include/linux/sunrpc/name_lookup.h [new file with mode: 0644]

diff --git a/include/linux/sunrpc/name_lookup.h b/include/linux/sunrpc/name_lookup.h
new file mode 100644 (file)
index 0000000..0c97ec3
--- /dev/null
@@ -0,0 +1,38 @@
+
+/*
+ * 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);
+}