xref: /OK3568_Linux_fs/kernel/fs/nfsd/idmap.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  *  Mapping of UID to name and vice versa.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  *  Copyright (c) 2002, 2003 The Regents of the University of
5*4882a593Smuzhiyun  *  Michigan.  All rights reserved.
6*4882a593Smuzhiyun > *
7*4882a593Smuzhiyun  *  Marius Aamodt Eriksen <marius@umich.edu>
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  *  Redistribution and use in source and binary forms, with or without
10*4882a593Smuzhiyun  *  modification, are permitted provided that the following conditions
11*4882a593Smuzhiyun  *  are met:
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  *  1. Redistributions of source code must retain the above copyright
14*4882a593Smuzhiyun  *     notice, this list of conditions and the following disclaimer.
15*4882a593Smuzhiyun  *  2. Redistributions in binary form must reproduce the above copyright
16*4882a593Smuzhiyun  *     notice, this list of conditions and the following disclaimer in the
17*4882a593Smuzhiyun  *     documentation and/or other materials provided with the distribution.
18*4882a593Smuzhiyun  *  3. Neither the name of the University nor the names of its
19*4882a593Smuzhiyun  *     contributors may be used to endorse or promote products derived
20*4882a593Smuzhiyun  *     from this software without specific prior written permission.
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
23*4882a593Smuzhiyun  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24*4882a593Smuzhiyun  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25*4882a593Smuzhiyun  *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*4882a593Smuzhiyun  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27*4882a593Smuzhiyun  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28*4882a593Smuzhiyun  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29*4882a593Smuzhiyun  *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30*4882a593Smuzhiyun  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31*4882a593Smuzhiyun  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32*4882a593Smuzhiyun  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #ifndef LINUX_NFSD_IDMAP_H
36*4882a593Smuzhiyun #define LINUX_NFSD_IDMAP_H
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #include <linux/in.h>
39*4882a593Smuzhiyun #include <linux/sunrpc/svc.h>
40*4882a593Smuzhiyun #include <linux/nfs_idmap.h>
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #ifdef CONFIG_NFSD_V4
43*4882a593Smuzhiyun int nfsd_idmap_init(struct net *);
44*4882a593Smuzhiyun void nfsd_idmap_shutdown(struct net *);
45*4882a593Smuzhiyun #else
nfsd_idmap_init(struct net * net)46*4882a593Smuzhiyun static inline int nfsd_idmap_init(struct net *net)
47*4882a593Smuzhiyun {
48*4882a593Smuzhiyun 	return 0;
49*4882a593Smuzhiyun }
nfsd_idmap_shutdown(struct net * net)50*4882a593Smuzhiyun static inline void nfsd_idmap_shutdown(struct net *net)
51*4882a593Smuzhiyun {
52*4882a593Smuzhiyun }
53*4882a593Smuzhiyun #endif
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun __be32 nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, kuid_t *);
56*4882a593Smuzhiyun __be32 nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, kgid_t *);
57*4882a593Smuzhiyun __be32 nfsd4_encode_user(struct xdr_stream *, struct svc_rqst *, kuid_t);
58*4882a593Smuzhiyun __be32 nfsd4_encode_group(struct xdr_stream *, struct svc_rqst *, kgid_t);
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun #endif /* LINUX_NFSD_IDMAP_H */
61