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,
35 typedef struct mclient {
36 struct mclient * m_next;
40 union nfs_sockaddr m_addrlist[NFSCLNT_ADDRMAX];
41 int m_exported; /* exported to nfsd */
45 static inline const struct sockaddr *
46 get_addrlist(const nfs_client *clp, const int i)
48 return &clp->m_addrlist[i].sa;
51 static inline const struct sockaddr_in *
52 get_addrlist_in(const nfs_client *clp, const int i)
54 return &clp->m_addrlist[i].s4;
57 static inline const struct sockaddr_in6 *
58 get_addrlist_in6(const nfs_client *clp, const int i)
60 return &clp->m_addrlist[i].s6;
64 set_addrlist_in(nfs_client *clp, const int i, const struct sockaddr_in *sin)
66 memcpy(&clp->m_addrlist[i].s4, sin, sizeof(*sin));
70 set_addrlist_in6(nfs_client *clp, const int i, const struct sockaddr_in6 *sin6)
72 memcpy(&clp->m_addrlist[i].s6, sin6, sizeof(*sin6));
76 set_addrlist(nfs_client *clp, const int i, const struct sockaddr *sap)
78 switch (sap->sa_family) {
80 memcpy(&clp->m_addrlist[i].s4, sap, sizeof(struct sockaddr_in));
84 memcpy(&clp->m_addrlist[i].s6, sap, sizeof(struct sockaddr_in6));
90 typedef struct mexport {
91 struct mexport * m_next;
92 struct mclient * m_client;
93 struct exportent m_export;
94 int m_exported; /* known to knfsd. -1 means not sure */
95 int m_xtabent : 1, /* xtab entry exists */
96 m_mayexport: 1, /* derived from xtabbed */
97 m_changed : 1, /* options (may) have changed */
98 m_warned : 1; /* warned about multiple exports
99 * matching one client */
102 #define HASH_TABLE_SIZE 1021
104 typedef struct _exp_hash_entry {
105 nfs_export * p_first;
109 typedef struct _exp_hash_table {
111 exp_hash_entry entries[HASH_TABLE_SIZE];
114 extern exp_hash_table exportlist[MCL_MAXTYPES];
116 extern nfs_client * clientlist[MCL_MAXTYPES];
118 nfs_client * client_lookup(char *hname, int canonical);
119 nfs_client * client_dup(const nfs_client *clp,
120 const struct addrinfo *ai);
121 int client_gettype(char *hname);
122 int client_check(const nfs_client *clp,
123 const struct addrinfo *ai);
124 void client_release(nfs_client *);
125 void client_freeall(void);
126 char * client_compose(const struct addrinfo *ai);
127 struct addrinfo * client_resolve(const struct sockaddr *sap);
128 int client_member(const char *client,
131 void export_read(char *fname);
132 void export_reset(nfs_export *);
133 nfs_export * export_lookup(char *hname, char *path, int caconical);
134 nfs_export * export_find(const struct addrinfo *ai,
136 nfs_export * export_allowed(const struct addrinfo *ai,
138 nfs_export * export_create(struct exportent *, int canonical);
139 void export_freeall(void);
140 int export_export(nfs_export *);
141 int export_unexport(nfs_export *);
143 int xtab_mount_read(void);
144 int xtab_export_read(void);
145 int xtab_mount_write(void);
146 int xtab_export_write(void);
147 void xtab_append(nfs_export *);
149 int secinfo_addflavor(struct flav_info *, struct exportent *);
151 char * host_ntop(const struct sockaddr *sap,
152 char *buf, const size_t buflen);
154 struct addrinfo * host_pton(const char *paddr);
156 struct addrinfo * host_addrinfo(const char *hostname);
158 char * host_canonname(const struct sockaddr *sap);
160 struct addrinfo * host_reliable_addrinfo(const struct sockaddr *sap);
162 struct addrinfo * host_numeric_addrinfo(const struct sockaddr *sap);
164 int rmtab_read(void);
166 struct nfskey * key_lookup(char *hname);
168 struct export_features {
170 unsigned int secinfo_flags;
173 struct export_features *get_export_features(void);
175 /* Record export error. */
176 extern int export_errno;
178 #endif /* EXPORTFS_H */