diff options
Diffstat (limited to 'support/include')
-rw-r--r-- | support/include/Makefile.am | 5 | ||||
-rw-r--r-- | support/include/conn.h | 42 | ||||
-rw-r--r-- | support/include/fstab.h | 24 | ||||
-rw-r--r-- | support/include/nfs_mntent.h | 34 | ||||
-rw-r--r-- | support/include/nfs_paths.h | 11 | ||||
-rw-r--r-- | support/include/nls.h | 27 | ||||
-rw-r--r-- | support/include/xcommon.h | 48 | ||||
-rw-r--r-- | support/include/xmalloc.h | 17 |
8 files changed, 192 insertions, 16 deletions
diff --git a/support/include/Makefile.am b/support/include/Makefile.am index 33ecc3c..cdf628b 100644 --- a/support/include/Makefile.am +++ b/support/include/Makefile.am @@ -3,9 +3,13 @@ SUBDIRS = nfs rpcsvc sys noinst_HEADERS = \ + conn.h \ exportfs.h \ + fstab.h \ ha-callout.h \ misc.h \ + nfs_mntent.h \ + nfs_paths.h \ nfslib.h \ rpcdispatch.h \ rpcmisc.h \ @@ -15,6 +19,7 @@ noinst_HEADERS = \ xio.h \ xlog.h \ xmalloc.h \ + xcommon.h \ ypupdate.h MAINTAINERCLEANFILES = Makefile.in diff --git a/support/include/conn.h b/support/include/conn.h new file mode 100644 index 0000000..ae19a3e --- /dev/null +++ b/support/include/conn.h @@ -0,0 +1,42 @@ +/* + * conn.h -- Connection routines for NFS mount / umount code. + * + * 2006-06-06 Amit Gud <agud@redhat.com> + * - Moved code snippets here from util-linux/mount + */ + +#ifndef _CONN_H +#define _CONN_H + +#ifdef HAVE_RPCSVC_NFS_PROT_H +#include <rpcsvc/nfs_prot.h> +#else +#include <linux/nfs.h> +#define nfsstat nfs_stat +#endif + +#include <rpc/pmap_prot.h> +#include <rpc/clnt.h> + +#define MNT_SENDBUFSIZE ((u_int)2048) +#define MNT_RECVBUFSIZE ((u_int)1024) + +typedef struct { + char **hostname; + struct sockaddr_in saddr; + struct pmap pmap; +} clnt_addr_t; + +/* RPC call timeout values */ +static const struct timeval TIMEOUT = { 20, 0 }; +static const struct timeval RETRY_TIMEOUT = { 3, 0 }; + +int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int); +u_long nfsvers_to_mnt(const u_long); +u_long mntvers_to_nfs(const u_long); +int get_socket(struct sockaddr_in *, u_int, int); +CLIENT * mnt_openclnt(clnt_addr_t *, int *); +void mnt_closeclnt(CLIENT *, int); + +#endif /* _CONN_H */ + diff --git a/support/include/fstab.h b/support/include/fstab.h new file mode 100644 index 0000000..52af743 --- /dev/null +++ b/support/include/fstab.h @@ -0,0 +1,24 @@ +#ifndef _NFS_FSTAB_H +#define _NFS_FSTAB_H + +#include "nfs_mntent.h" + +int mtab_is_writable(void); +int mtab_does_not_exist(void); + +struct mntentchn { + struct mntentchn *nxt, *prev; + nfs_mntent_t m; +}; + +struct mntentchn *mtab_head (void); +struct mntentchn *getmntoptfile (const char *file); +struct mntentchn *getmntdirbackward (const char *dir, struct mntentchn *mc); +struct mntentchn *getmntdevbackward (const char *dev, struct mntentchn *mc); + +void lock_mtab (void); +void unlock_mtab (void); +void update_mtab (const char *special, nfs_mntent_t *with); + +#endif /* _NFS_FSTAB_H */ + diff --git a/support/include/nfs_mntent.h b/support/include/nfs_mntent.h new file mode 100644 index 0000000..76f348e --- /dev/null +++ b/support/include/nfs_mntent.h @@ -0,0 +1,34 @@ +/* + * 2006-06-08 Amit Gud <agud@redhat.com> + * - Moved code snippets here from util-linux/mount/my_mntent.h + */ + +#ifndef _NFS_MNTENT_H +#define _NFS_MNTENT_H + +typedef struct nfs_mntent_s { + const char *mnt_fsname; + const char *mnt_dir; + const char *mnt_type; + const char *mnt_opts; + int mnt_freq; + int mnt_passno; +} nfs_mntent_t; + +#define ERR_MAX 5 + +typedef struct mntFILEstruct { + FILE *mntent_fp; + char *mntent_file; + int mntent_lineno; + int mntent_errs; + int mntent_softerrs; +} mntFILE; + +mntFILE *nfs_setmntent (const char *file, char *mode); +void nfs_endmntent (mntFILE *mfp); +int nfs_addmntent (mntFILE *mfp, nfs_mntent_t *mnt); +struct nfs_mntent *my_getmntent (mntFILE *mfp); +nfs_mntent_t *nfs_getmntent (mntFILE *mfp); + +#endif /* _NFS_MNTENT_H */ diff --git a/support/include/nfs_paths.h b/support/include/nfs_paths.h new file mode 100644 index 0000000..de4ac19 --- /dev/null +++ b/support/include/nfs_paths.h @@ -0,0 +1,11 @@ +#ifndef _NFS_PATHS_H +#define _NFS_PATHS_H + +#ifndef _PATH_MOUNTED +#define _PATH_MOUNTED "/etc/fstab" +#endif +#define MOUNTED_LOCK _PATH_MOUNTED "~" +#define MOUNTED_TEMP _PATH_MOUNTED ".tmp" + +#endif /* _NFS_PATHS_H */ + diff --git a/support/include/nls.h b/support/include/nls.h new file mode 100644 index 0000000..899e8d7 --- /dev/null +++ b/support/include/nls.h @@ -0,0 +1,27 @@ +/* + * 2006-06-08 Amit Gud <agud@redhat.com> + * - Copied to nfs-utils/support/include from util-linux/mount + */ + +#ifndef LOCALEDIR +#define LOCALEDIR "/usr/share/locale" +#endif + +#ifdef ENABLE_NLS +# include <libintl.h> +# define _(Text) gettext (Text) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# undef bindtextdomain +# define bindtextdomain(Domain, Directory) /* empty */ +# undef textdomain +# define textdomain(Domain) /* empty */ +# define _(Text) (Text) +# define N_(Text) (Text) +#endif + + diff --git a/support/include/xcommon.h b/support/include/xcommon.h new file mode 100644 index 0000000..9e23d12 --- /dev/null +++ b/support/include/xcommon.h @@ -0,0 +1,48 @@ +/* + * xcommon.h -- Support function prototypes. Functions are in xcommon.c. + * + * 2006-06-06 Amit Gud <agud@redhat.com> + * - Moved code snippets from mount/sundries.h of util-linux + * and merged code from support/nfs/xmalloc.c by Olaf Kirch <okir@monad.swb.de> here. + */ + +#ifndef _XMALLOC_H +#define _MALLOC_H + +#include <sys/types.h> +#include <fcntl.h> +#include <limits.h> +#include <signal.h> +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> + +#define streq(s, t) (strcmp ((s), (t)) == 0) + +/* Functions in sundries.c that are used in mount.c and umount.c */ +char *canonicalize (const char *path); +void nfs_error (const char *fmt, ...); +void *xmalloc (size_t size); +void *xrealloc(void *p, size_t size); +void xfree(void *); +char *xstrdup (const char *s); +char *xstrndup (const char *s, int n); +char *xstrconcat2 (const char *, const char *); +char *xstrconcat3 (const char *, const char *, const char *); +char *xstrconcat4 (const char *, const char *, const char *, const char *); +void die (int errcode, const char *fmt, ...); + +extern void die(int err, const char *fmt, ...); +extern void (*at_die)(void); + +/* exit status - bits below are ORed */ +#define EX_USAGE 1 /* incorrect invocation or permission */ +#define EX_SYSERR 2 /* out of memory, cannot fork, ... */ +#define EX_SOFTWARE 4 /* internal mount bug or wrong version */ +#define EX_USER 8 /* user interrupt */ +#define EX_FILEIO 16 /* problems writing, locking, ... mtab/fstab */ +#define EX_FAIL 32 /* mount failure */ +#define EX_SOMEOK 64 /* some mount succeeded */ +#define EX_BG 256 /* retry in background (internal only) */ + +#endif /* XMALLOC_H */ diff --git a/support/include/xmalloc.h b/support/include/xmalloc.h index 866cfd8..8b82800 100644 --- a/support/include/xmalloc.h +++ b/support/include/xmalloc.h @@ -1,16 +1 @@ -/* - * xmalloc Module for memory allocation. Drop in your - * debugging malloc module if you feel like it. - * - * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> - */ - -#ifndef XMALLOC_H -#define XMALLOC_H - -void *xmalloc(size_t size); -void *xrealloc(void *ptr, size_t size); -char *xstrdup(const char *s); -void xfree(void *ptr); - -#endif /* XMALLOC_H */ +#include "xcommon.h" |