diff options
author | Niels de Vos <ndevos@redhat.com> | 2015-01-01 13:15:45 +0100 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-15 00:45:50 -0700 |
commit | 0c3d3a796bda37d8439855baf00137ad17714620 (patch) | |
tree | bc01609f0802b967558099df8e30f66075167a09 /xlators/nfs/server/src/exports.h | |
parent | 9f71b25f34a24741496875ab947f6f9c95ec277f (diff) |
nfs: add support for separate 'exports' file
The Linux kernel NFS server uses /etc/exports to manage permissions for
the NFS-clients. Extending the Gluster/NFS server to support a similar
scheme is needed for many deployments in enterprise environments.
BUG: 1143880
Change-Id: I7e6aa6bc6aa1cd5f52458e023387ed38de9823d7
Original-author: Shreyas Siravara <shreyas.siravara@gmail.com>
CC: Richard Wareing <rwareing@fb.com>
CC: Jiffin Tony Thottan <jthottan@redhat.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9361
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/nfs/server/src/exports.h')
-rw-r--r-- | xlators/nfs/server/src/exports.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/exports.h b/xlators/nfs/server/src/exports.h new file mode 100644 index 00000000000..51a3cd668a4 --- /dev/null +++ b/xlators/nfs/server/src/exports.h @@ -0,0 +1,92 @@ +/* + Copyright 2014-present Facebook. All Rights Reserved + + This file is part of GlusterFS. + + Author : + Shreyas Siravara <shreyas.siravara@gmail.com> + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef _EXPORTS_H_ +#define _EXPORTS_H_ + +#include "nfs-mem-types.h" +#include "dict.h" +#include "nfs.h" + +#define GF_EXP GF_NFS"-exports" + +#define NETGROUP_REGEX_PATTERN "(@([a-zA-Z0-9\\(=, .])+)())" +#define HOSTNAME_REGEX_PATTERN "[[:space:]]([a-zA-Z0-9.\\(=,*/)]+)" +#define OPTIONS_REGEX_PATTERN "([a-zA-Z0-9=\\.]+)" + +#define NETGROUP_MAX_LEN 128 +#define FQDN_MAX_LEN 256 + +#define SEC_OPTION_MAX 10 +#define UID_MAX_LEN 6 + +#define DIR_MAX_LEN 1024 + +/* The following 2 definitions are in mount3.h + * but we don't want to include it because mount3.h + * depends on structs in this file so we get a cross + * dependency. + */ +struct mount3_state; + +extern struct mnt3_export * +mnt3_mntpath_to_export (struct mount3_state *ms, const char *dirpath, + gf_boolean_t export_parsing_match); + +struct export_options { + gf_boolean_t rw; /* Read-write option */ + gf_boolean_t nosuid; /* nosuid option */ + gf_boolean_t root; /* root option */ + char *anon_uid; /* anonuid option */ + char *sec_type; /* X, for sec=X */ +}; + +struct export_item { + char *name; /* Name of the export item */ + struct export_options *opts; /* NFS Options */ +}; + +struct export_dir { + char *dir_name; /* Directory */ + dict_t *netgroups; /* Dict of netgroups */ + dict_t *hosts; /* Dict of hosts */ +}; + +struct exports_file { + char *filename; /* Filename */ + dict_t *exports_dict; /* Dict of export_dir_t */ + dict_t *exports_map; /* Map of SuperFastHash(<export>) -> expdir */ +}; + +void +exp_file_deinit (struct exports_file *expfile); + +int +exp_file_parse (const char *filepath, struct exports_file **expfile, + struct mount3_state *ms); + +struct export_dir * +exp_file_get_dir (const struct exports_file *file, const char *dir); + +struct export_item * +exp_dir_get_host (const struct export_dir *expdir, const char *host); + +struct export_item * +exp_dir_get_netgroup (const struct export_dir *expdir, const char *netgroup); + +struct export_dir * +exp_file_dir_from_uuid (const struct exports_file *file, + const uuid_t export_uuid); + +#endif /* _EXPORTS_H_ */ |