#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/sunrpc/svc_xprt.h>
#include <net/net_namespace.h>
#include "idmap.h"
#include "nfsd.h"
#include "netns.h"
#include "vfs.h"
static bool nfs4_disable_idmapping = …;
module_param(nfs4_disable_idmapping, bool, 0644);
MODULE_PARM_DESC(…) …;
struct ent { … };
#define ENT_HASHBITS …
#define ENT_HASHMAX …
static void
ent_init(struct cache_head *cnew, struct cache_head *citm)
{ … }
static void
ent_put(struct kref *ref)
{ … }
static struct cache_head *
ent_alloc(void)
{ … }
static uint32_t
idtoname_hash(struct ent *ent)
{ … }
static int
idtoname_upcall(struct cache_detail *cd, struct cache_head *h)
{ … }
static void
idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
int *blen)
{ … }
static int
idtoname_match(struct cache_head *ca, struct cache_head *cb)
{ … }
static int
idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
{ … }
static void
warn_no_idmapd(struct cache_detail *detail, int has_died)
{ … }
static int idtoname_parse(struct cache_detail *, char *, int);
static struct ent *idtoname_lookup(struct cache_detail *, struct ent *);
static struct ent *idtoname_update(struct cache_detail *, struct ent *,
struct ent *);
static const struct cache_detail idtoname_cache_template = …;
static int
idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
{ … }
static struct ent *
idtoname_lookup(struct cache_detail *cd, struct ent *item)
{ … }
static struct ent *
idtoname_update(struct cache_detail *cd, struct ent *new, struct ent *old)
{ … }
static inline int
nametoid_hash(struct ent *ent)
{ … }
static int
nametoid_upcall(struct cache_detail *cd, struct cache_head *h)
{ … }
static void
nametoid_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
int *blen)
{ … }
static int
nametoid_match(struct cache_head *ca, struct cache_head *cb)
{ … }
static int
nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
{ … }
static struct ent *nametoid_lookup(struct cache_detail *, struct ent *);
static struct ent *nametoid_update(struct cache_detail *, struct ent *,
struct ent *);
static int nametoid_parse(struct cache_detail *, char *, int);
static const struct cache_detail nametoid_cache_template = …;
static int
nametoid_parse(struct cache_detail *cd, char *buf, int buflen)
{ … }
static struct ent *
nametoid_lookup(struct cache_detail *cd, struct ent *item)
{ … }
static struct ent *
nametoid_update(struct cache_detail *cd, struct ent *new, struct ent *old)
{ … }
int
nfsd_idmap_init(struct net *net)
{ … }
void
nfsd_idmap_shutdown(struct net *net)
{ … }
static int
idmap_lookup(struct svc_rqst *rqstp,
struct ent *(*lookup_fn)(struct cache_detail *, struct ent *),
struct ent *key, struct cache_detail *detail, struct ent **item)
{ … }
static char *
rqst_authname(struct svc_rqst *rqstp)
{ … }
static __be32
idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen,
u32 *id)
{ … }
static __be32 encode_ascii_id(struct xdr_stream *xdr, u32 id)
{ … }
static __be32 idmap_id_to_name(struct xdr_stream *xdr,
struct svc_rqst *rqstp, int type, u32 id)
{ … }
static bool
numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u32 *id)
{ … }
static __be32
do_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, u32 *id)
{ … }
static __be32 encode_name_from_id(struct xdr_stream *xdr,
struct svc_rqst *rqstp, int type, u32 id)
{ … }
__be32
nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen,
kuid_t *uid)
{ … }
__be32
nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
kgid_t *gid)
{ … }
__be32 nfsd4_encode_user(struct xdr_stream *xdr, struct svc_rqst *rqstp,
kuid_t uid)
{ … }
__be32 nfsd4_encode_group(struct xdr_stream *xdr, struct svc_rqst *rqstp,
kgid_t gid)
{ … }