# define strchr index
# define strrchr rindex
# endif /* not HAVE_STRCHR */
-char *strchr(), *strrchr(), *strdup();
+char *strchr(), *strrchr();
#endif /* not STDC_HEADERS */
/*
extern int strcasecmp(const char *s1, const char *s2);
#endif /* not HAVE_EXTERN_STRCASECMP */
-#ifndef HAVE_EXTERN_STRDUP
-/*
- * define this extern even if function does not exist, for it will
- * be filled in by libamu/strdup.c
- */
-extern char *strdup(const char *s);
-#endif /* not HAVE_EXTERN_STRDUP */
-
#ifndef HAVE_EXTERN_STRLCAT
/*
* define this extern even if function does not exist, for it will
extern voidp xmalloc(int);
extern voidp xrealloc(voidp, int);
extern voidp xzalloc(int);
+extern char *xstrdup(const char *);
extern int check_pmap_up(char *host, struct sockaddr_in* sin);
extern u_long get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const char *proto);
extern long get_server_pid(void);
extern int syslogging;
#endif /* defined(HAVE_SYSLOG_H) || defined(HAVE_SYS_SYSLOG_H) */
-extern void compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig *nfsncp, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name);
+extern void compute_nfs_args(void *nap, mntent_t *mntp, int genflags, struct netconfig *nfsncp, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name);
+extern void destroy_nfs_args(void *nap, u_long nfs_version);
extern int create_amq_service(int *udp_soAMQp, SVCXPRT **udp_amqpp, struct netconfig **udp_amqncpp, int *tcp_soAMQp, SVCXPRT **tcp_amqpp, struct netconfig **tcp_amqncpp, u_short preferred_amq_port);
extern int create_nfs_service(int *soNFSp, u_short *nfs_portp, SVCXPRT **nfs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp));
extern int amu_svc_register(SVCXPRT *, u_long, u_long, void (*)(struct svc_req *, SVCXPRT *), u_long, struct netconfig *);
/*
- * Network File System: the new generation
- * NFS V.3
+ * Network File System: the old faithful generation NFS V.2
+ */
+#ifndef NFS_VERSION2
+# define NFS_VERSION2 ((u_int) 2)
+#endif /* not NFS_VERSION2 */
+
+/*
+ * Network File System: the not so new anymore generation NFS V.3
*/
#ifdef HAVE_FS_NFS3
# ifndef NFS_VERSION3
# endif /* not NFS_VERSION3 */
#endif /* HAVE_FS_NFS3 */
+/*
+ * Network File System: the new generation NFS V.4
+ */
+#ifdef HAVE_FS_NFS4
+# ifndef NFS_VERSION4
+# define NFS_VERSION4 ((u_int) 4)
+# endif /* not NFS_VERSION4 */
+#endif /* HAVE_FS_NFS4 */
/**************************************************************************/
/*** DEBUGGING ***/
# endif /* not DEBUG_MEM */
/* functions that depend solely on debugging */
-extern void print_nfs_args(const nfs_args_t *nap, u_long nfs_version);
+extern void print_nfs_args(const void *, u_long nfs_version);
extern int debug_option (char *opt);
extern void dplog(const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
--- /dev/null
+/*
+ * Copyright (c) 2011 Christos Zoulas
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/include/nfs_common.c
+ *
+ */
+struct nfs_common_args {
+ u_long flags;
+ u_long acdirmin;
+ u_long acdirmax;
+ u_long acregmin;
+ u_long acregmax;
+ u_long timeo;
+ u_long retrans;
+ u_long rsize;
+ u_long wsize;
+};
+
+#ifdef HAVE_NFS_ARGS_T_ACREGMIN
+#define GET_ACREGMIN(nap, a) nap->acregmin = a.acregmin;
+#define PUT_ACREGMIN(nap, a) a.acregmin = nap->acregmin;
+#else
+#define GET_ACREGMIN(nap, a)
+#define PUT_ACREGMIN(nap, a)
+#endif
+#ifdef HAVE_NFS_ARGS_T_ACREGMAX
+#define GET_ACREGMAX(nap, a) nap->acregmax = a.acregmax;
+#define PUT_ACREGMAX(nap, a) a.acregmax = nap->acregmax;
+#else
+#define GET_ACREGMAX(nap, a)
+#define PUT_ACREGMAX(nap, a)
+#endif
+
+#ifdef HAVE_NFS_ARGS_T_ACDIRMIN
+#define GET_ACDIRMIN(nap, a) nap->acdirmin = a.acdirmin;
+#define PUT_ACDIRMIN(nap, a) a.acdirmin = nap->acdirmin;
+#else
+#define GET_ACDIRMIN(nap, a)
+#define PUT_ACDIRMIN(nap, a)
+#endif
+#ifdef HAVE_NFS_ARGS_T_ACDIRMAX
+#define GET_ACDIRMAX(nap, a) nap->acdirmax = a.acdirmax;
+#define PUT_ACDIRMAX(nap, a) a.acdirmax = nap->acdirmax;
+#else
+#define GET_ACDIRMAX(nap, a)
+#define PUT_ACDIRMAX(nap, a)
+#endif
+
+#define get_nfs_common_args(nap, a) \
+ do { \
+ nap->flags = a.flags; \
+ GET_ACREGMIN(nap, a) \
+ GET_ACREGMAX(nap, a) \
+ GET_ACDIRMIN(nap, a) \
+ GET_ACDIRMAX(nap, a) \
+ nap->timeo = a.timeo; \
+ nap->retrans = a.retrans; \
+ nap->rsize = a.rsize; \
+ nap->wsize = a.wsize; \
+ } while (/*CONSTCOND*/0)
+
+#define put_nfs_common_args(nap, a) \
+ do { \
+ a.flags = nap->flags; \
+ PUT_ACREGMIN(nap, a) \
+ PUT_ACREGMAX(nap, a) \
+ PUT_ACDIRMIN(nap, a) \
+ PUT_ACDIRMAX(nap, a) \
+ a.timeo = nap->timeo; \
+ a.retrans = nap->retrans; \
+ a.rsize = nap->rsize; \
+ a.wsize = nap->wsize; \
+ } while (/*CONSTCOND*/0)