2 * support/include/nfslib.h
4 * General support functions for NFS user-space programs.
6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
14 #include <sys/types.h>
15 #include <sys/socket.h>
16 #include <netinet/in.h>
19 #include <rpcsvc/nfs_prot.h>
24 #define _PATH_EXPORTS "/etc/exports"
27 #define _PATH_XTAB NFS_STATEDIR "/xtab"
30 #define _PATH_XTABTMP NFS_STATEDIR "/xtab.tmp"
33 #define _PATH_ETAB NFS_STATEDIR "/etab"
36 #define _PATH_ETABTMP NFS_STATEDIR "/etab.tmp"
39 #define _PATH_RMTAB NFS_STATEDIR "/rmtab"
41 #ifndef _PATH_RMTABTMP
42 #define _PATH_RMTABTMP _PATH_RMTAB ".tmp"
44 #ifndef _PATH_PROC_EXPORTS
45 #define _PATH_PROC_EXPORTS "/proc/fs/nfs/exports"
55 * Data related to a single exports entry as returned by getexportent.
56 * FIXME: export options should probably be parsed at a later time to
57 * allow overrides when using exportfs.
60 char e_hostname[NFSCLNT_IDMAX+1];
61 char e_path[NFS_MAXPATHLEN+1];
62 /* The mount path may be different from the exported path due
63 to submount. It may change for every mount. The idea is we
64 set m_path every time when we process a mount. We should not
65 use it for anything else. */
66 char m_path[NFS_MAXPATHLEN+1];
78 char r_client[NFSCLNT_IDMAX+1];
79 char r_path[NFS_MAXPATHLEN+1];
83 * configuration file parsing
85 void setexportent(char *fname, char *type);
86 struct exportent * getexportent(void);
87 void putexportent(struct exportent *xep);
88 void endexportent(void);
89 struct exportent * mkexportent(char *hname, char *path, char *opts);
90 void dupexportent(struct exportent *dst,
91 struct exportent *src);
92 int updateexportent(struct exportent *eep, char *options);
94 int setrmtabent(char *type);
95 struct rmtabent * getrmtabent(int log);
96 void putrmtabent(struct rmtabent *xep);
97 void endrmtabent(void);
98 void rewindrmtabent(void);
99 FILE * fsetrmtabent(char *fname, char *type);
100 struct rmtabent * fgetrmtabent(FILE *fp, int log);
101 void fputrmtabent(FILE *fp, struct rmtabent *xep);
102 void fendrmtabent(FILE *fp);
103 void frewindrmtabent(FILE *fp);
106 * wildmat borrowed from INN
108 int wildmat(char *text, char *pattern);
111 * nfsd library functions.
113 int nfsctl(int, struct nfsctl_arg *, union nfsctl_res *);
114 int nfssvc(int port, int nrservs);
115 int nfsaddclient(struct nfsctl_client *clp);
116 int nfsdelclient(struct nfsctl_client *clp);
117 int nfsexport(struct nfsctl_export *exp);
118 int nfsunexport(struct nfsctl_export *exp);
119 struct knfs_fh * getfh_old(struct sockaddr *addr, dev_t dev, ino_t ino);
120 struct knfs_fh * getfh(struct sockaddr *addr, const char *);
125 #endif /* NFSLIB_H */