162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * fs/nfs/nfs4idmap.h
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci *  UID and GID to name mapping for clients.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci *  Copyright (c) 2002 The Regents of the University of Michigan.
762306a36Sopenharmony_ci *  All rights reserved.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci *  Marius Aamodt Eriksen <marius@umich.edu>
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci *  Redistribution and use in source and binary forms, with or without
1262306a36Sopenharmony_ci *  modification, are permitted provided that the following conditions
1362306a36Sopenharmony_ci *  are met:
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci *  1. Redistributions of source code must retain the above copyright
1662306a36Sopenharmony_ci *     notice, this list of conditions and the following disclaimer.
1762306a36Sopenharmony_ci *  2. Redistributions in binary form must reproduce the above copyright
1862306a36Sopenharmony_ci *     notice, this list of conditions and the following disclaimer in the
1962306a36Sopenharmony_ci *     documentation and/or other materials provided with the distribution.
2062306a36Sopenharmony_ci *  3. Neither the name of the University nor the names of its
2162306a36Sopenharmony_ci *     contributors may be used to endorse or promote products derived
2262306a36Sopenharmony_ci *     from this software without specific prior written permission.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
2562306a36Sopenharmony_ci *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2662306a36Sopenharmony_ci *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2762306a36Sopenharmony_ci *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2862306a36Sopenharmony_ci *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2962306a36Sopenharmony_ci *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3062306a36Sopenharmony_ci *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
3162306a36Sopenharmony_ci *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
3262306a36Sopenharmony_ci *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
3362306a36Sopenharmony_ci *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3462306a36Sopenharmony_ci *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3562306a36Sopenharmony_ci */
3662306a36Sopenharmony_ci#ifndef NFS_IDMAP_H
3762306a36Sopenharmony_ci#define NFS_IDMAP_H
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#include <linux/uidgid.h>
4062306a36Sopenharmony_ci#include <uapi/linux/nfs_idmap.h>
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/* Forward declaration to make this header independent of others */
4462306a36Sopenharmony_cistruct nfs_client;
4562306a36Sopenharmony_cistruct nfs_server;
4662306a36Sopenharmony_cistruct nfs_fattr;
4762306a36Sopenharmony_cistruct nfs4_string;
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciint nfs_idmap_init(void);
5062306a36Sopenharmony_civoid nfs_idmap_quit(void);
5162306a36Sopenharmony_ciint nfs_idmap_new(struct nfs_client *);
5262306a36Sopenharmony_civoid nfs_idmap_delete(struct nfs_client *);
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_civoid nfs_fattr_init_names(struct nfs_fattr *fattr,
5562306a36Sopenharmony_ci		struct nfs4_string *owner_name,
5662306a36Sopenharmony_ci		struct nfs4_string *group_name);
5762306a36Sopenharmony_civoid nfs_fattr_free_names(struct nfs_fattr *);
5862306a36Sopenharmony_civoid nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *);
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciint nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, kuid_t *);
6162306a36Sopenharmony_ciint nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, kgid_t *);
6262306a36Sopenharmony_ciint nfs_map_uid_to_name(const struct nfs_server *, kuid_t, char *, size_t);
6362306a36Sopenharmony_ciint nfs_map_gid_to_group(const struct nfs_server *, kgid_t, char *, size_t);
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ciint nfs_map_string_to_numeric(const char *name, size_t namelen, __u32 *res);
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciextern unsigned int nfs_idmap_cache_timeout;
6862306a36Sopenharmony_ci#endif /* NFS_IDMAP_H */
69