xref: /openbmc/linux/fs/nfsd/idmap.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
12ca72e17SJ. Bruce Fields /*
22ca72e17SJ. Bruce Fields  *  Mapping of UID to name and vice versa.
32ca72e17SJ. Bruce Fields  *
42ca72e17SJ. Bruce Fields  *  Copyright (c) 2002, 2003 The Regents of the University of
52ca72e17SJ. Bruce Fields  *  Michigan.  All rights reserved.
62ca72e17SJ. Bruce Fields > *
72ca72e17SJ. Bruce Fields  *  Marius Aamodt Eriksen <marius@umich.edu>
82ca72e17SJ. Bruce Fields  *
92ca72e17SJ. Bruce Fields  *  Redistribution and use in source and binary forms, with or without
102ca72e17SJ. Bruce Fields  *  modification, are permitted provided that the following conditions
112ca72e17SJ. Bruce Fields  *  are met:
122ca72e17SJ. Bruce Fields  *
132ca72e17SJ. Bruce Fields  *  1. Redistributions of source code must retain the above copyright
142ca72e17SJ. Bruce Fields  *     notice, this list of conditions and the following disclaimer.
152ca72e17SJ. Bruce Fields  *  2. Redistributions in binary form must reproduce the above copyright
162ca72e17SJ. Bruce Fields  *     notice, this list of conditions and the following disclaimer in the
172ca72e17SJ. Bruce Fields  *     documentation and/or other materials provided with the distribution.
182ca72e17SJ. Bruce Fields  *  3. Neither the name of the University nor the names of its
192ca72e17SJ. Bruce Fields  *     contributors may be used to endorse or promote products derived
202ca72e17SJ. Bruce Fields  *     from this software without specific prior written permission.
212ca72e17SJ. Bruce Fields  *
222ca72e17SJ. Bruce Fields  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
232ca72e17SJ. Bruce Fields  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
242ca72e17SJ. Bruce Fields  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
252ca72e17SJ. Bruce Fields  *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
262ca72e17SJ. Bruce Fields  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
272ca72e17SJ. Bruce Fields  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
282ca72e17SJ. Bruce Fields  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
292ca72e17SJ. Bruce Fields  *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
302ca72e17SJ. Bruce Fields  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
312ca72e17SJ. Bruce Fields  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
322ca72e17SJ. Bruce Fields  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
332ca72e17SJ. Bruce Fields  */
342ca72e17SJ. Bruce Fields 
352ca72e17SJ. Bruce Fields #ifndef LINUX_NFSD_IDMAP_H
362ca72e17SJ. Bruce Fields #define LINUX_NFSD_IDMAP_H
372ca72e17SJ. Bruce Fields 
382ca72e17SJ. Bruce Fields #include <linux/in.h>
392ca72e17SJ. Bruce Fields #include <linux/sunrpc/svc.h>
40*e446d66dSKinglong Mee #include <linux/nfs_idmap.h>
412ca72e17SJ. Bruce Fields 
422ca72e17SJ. Bruce Fields #ifdef CONFIG_NFSD_V4
4343ec1a20SStanislav Kinsbursky int nfsd_idmap_init(struct net *);
4443ec1a20SStanislav Kinsbursky void nfsd_idmap_shutdown(struct net *);
452ca72e17SJ. Bruce Fields #else
nfsd_idmap_init(struct net * net)4643ec1a20SStanislav Kinsbursky static inline int nfsd_idmap_init(struct net *net)
472ca72e17SJ. Bruce Fields {
482ca72e17SJ. Bruce Fields 	return 0;
492ca72e17SJ. Bruce Fields }
nfsd_idmap_shutdown(struct net * net)5043ec1a20SStanislav Kinsbursky static inline void nfsd_idmap_shutdown(struct net *net)
512ca72e17SJ. Bruce Fields {
522ca72e17SJ. Bruce Fields }
532ca72e17SJ. Bruce Fields #endif
542ca72e17SJ. Bruce Fields 
5565e10f6dSEric W. Biederman __be32 nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, kuid_t *);
5665e10f6dSEric W. Biederman __be32 nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, kgid_t *);
57ddd1ea56SJ. Bruce Fields __be32 nfsd4_encode_user(struct xdr_stream *, struct svc_rqst *, kuid_t);
58ddd1ea56SJ. Bruce Fields __be32 nfsd4_encode_group(struct xdr_stream *, struct svc_rqst *, kgid_t);
592ca72e17SJ. Bruce Fields 
602ca72e17SJ. Bruce Fields #endif /* LINUX_NFSD_IDMAP_H */
61