2 * support/include/exportfs.h
4 * Declarations for exportfs and mountd
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
20 MCL_IPADDR = MCL_SUBNETWORK,
36 #define EXP_LOCKFILE "/var/lib/nfs/export-lock"
39 typedef struct mclient {
40 struct mclient * m_next;
44 union nfs_sockaddr m_addrlist[NFSCLNT_ADDRMAX];
45 int m_exported; /* exported to nfsd */
49 static inline const struct sockaddr *
50 get_addrlist(const nfs_client *clp, const int i)
52 return &clp->m_addrlist[i].sa;
55 static inline const struct sockaddr_in *
56 get_addrlist_in(const nfs_client *clp, const int i)
58 return &clp->m_addrlist[i].s4;
61 static inline const struct sockaddr_in6 *
62 get_addrlist_in6(const nfs_client *clp, const int i)
64 return &clp->m_addrlist[i].s6;
68 set_addrlist_in(nfs_client *clp, const int i, const struct sockaddr_in *sin)
70 memcpy(&clp->m_addrlist[i].s4, sin, sizeof(*sin));
74 set_addrlist_in6(nfs_client *clp, const int i, const struct sockaddr_in6 *sin6)
76 memcpy(&clp->m_addrlist[i].s6, sin6, sizeof(*sin6));
80 set_addrlist(nfs_client *clp, const int i, const struct sockaddr *sap)
82 switch (sap->sa_family) {
84 memcpy(&clp->m_addrlist[i].s4, sap, sizeof(struct sockaddr_in));
88 memcpy(&clp->m_addrlist[i].s6, sap, sizeof(struct sockaddr_in6));
94 typedef struct mexport {
95 struct mexport * m_next;
96 struct mclient * m_client;
97 struct exportent m_export;
98 int m_exported; /* known to knfsd. -1 means not sure */
99 int m_xtabent : 1, /* xtab entry exists */
100 m_mayexport: 1, /* derived from xtabbed */
101 m_changed : 1, /* options (may) have changed */
102 m_warned : 1; /* warned about multiple exports
103 * matching one client */
106 #define HASH_TABLE_SIZE 1021
107 #define DEFAULT_TTL (30 * 60)
109 typedef struct _exp_hash_entry {
110 nfs_export * p_first;
114 typedef struct _exp_hash_table {
116 exp_hash_entry entries[HASH_TABLE_SIZE];
119 extern exp_hash_table exportlist[MCL_MAXTYPES];
121 extern nfs_client * clientlist[MCL_MAXTYPES];
123 nfs_client * client_lookup(char *hname, int canonical);
124 nfs_client * client_dup(const nfs_client *clp,
125 const struct addrinfo *ai);
126 int client_gettype(char *hname);
127 int client_check(const nfs_client *clp,
128 const struct addrinfo *ai);
129 void client_release(nfs_client *);
130 void client_freeall(void);
131 char * client_compose(const struct addrinfo *ai);
132 struct addrinfo * client_resolve(const struct sockaddr *sap);
133 int client_member(const char *client,
136 void export_read(char *fname);
137 void export_reset(nfs_export *);
138 nfs_export * export_lookup(char *hname, char *path, int caconical);
139 nfs_export * export_find(const struct addrinfo *ai,
141 nfs_export * export_allowed(const struct addrinfo *ai,
143 nfs_export * export_create(struct exportent *, int canonical);
144 void export_freeall(void);
145 int export_export(nfs_export *);
146 int export_unexport(nfs_export *);
148 int xtab_mount_read(void);
149 int xtab_export_read(void);
150 int xtab_mount_write(void);
151 int xtab_export_write(void);
152 void xtab_append(nfs_export *);
154 int secinfo_addflavor(struct flav_info *, struct exportent *);
156 char * host_ntop(const struct sockaddr *sap,
157 char *buf, const size_t buflen);
159 struct addrinfo * host_pton(const char *paddr);
161 struct addrinfo * host_addrinfo(const char *hostname);
163 char * host_canonname(const struct sockaddr *sap);
165 struct addrinfo * host_reliable_addrinfo(const struct sockaddr *sap);
167 struct addrinfo * host_numeric_addrinfo(const struct sockaddr *sap);
169 int rmtab_read(void);
171 struct nfskey * key_lookup(char *hname);
173 struct export_features {
175 unsigned int secinfo_flags;
178 struct export_features *get_export_features(void);
180 /* Record export error. */
181 extern int export_errno;
183 #endif /* EXPORTFS_H */