--- /dev/null
+AR=ar
+CC=gcc
+CFLAGS=-g -O0 -DAROS=1 -D_U_=" " -I. -Iinclude -Iinclude/nfsc -Iaros -Infs -Imount
+
+OBJS=lib/init.o lib/libnfs.o lib/libnfs-sync.o lib/libnfs-zdr.o lib/pdu.o lib/socket.o
+OBJS+=mount/mount.o mount/libnfs-raw-mount.o
+OBJS+=nfs/nfs.o nfs/nfsacl.o nfs/libnfs-raw-nfs.o
+OBJS+=nlm/nlm.o nlm/libnfs-raw-nlm.o
+OBJS+=portmap/portmap.o portmap/libnfs-raw-portmap.o
+OBJS+=rquota/rquota.o rquota/libnfs-raw-rquota.o
+OBJS+=aros/aros_compat.o
+
+EXAMPLES=examples/nfsclient-listservers
+
+all: lib/libnfs.a $(EXAMPLES)
+
+lib/libnfs.a: $(OBJS)
+ $(AR) cru $@ $(OBJS)
+
+.c.o:
+ echo $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+examples/nfsclient-listservers: examples/nfsclient-listservers.c lib/libnfs.a
+
+ $(CC) $(CFLAGS) -o $@ $< lib/libnfs.a
+
--- /dev/null
+/*
+ Copyright (C) 2013 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifdef AROS
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include "aros_compat.h"
+
+#undef poll
+
+
+int aros_poll(struct pollfd *fds, unsigned int nfds, int timo)
+{
+ struct timeval timeout, *toptr;
+ fd_set ifds, ofds, efds, *ip, *op;
+ unsigned int i;
+ int rc;
+
+ // Set up the file-descriptor sets in ifds, ofds and efds.
+ FD_ZERO(&ifds);
+ FD_ZERO(&ofds);
+ FD_ZERO(&efds);
+ for (i = 0, op = ip = 0; i < nfds; ++i)
+ {
+ fds[i].revents = 0;
+ if(fds[i].events & (POLLIN|POLLPRI))
+ {
+ ip = &ifds;
+ FD_SET(fds[i].fd, ip);
+ }
+ if(fds[i].events & POLLOUT)
+ {
+ op = &ofds;
+ FD_SET(fds[i].fd, op);
+ }
+ FD_SET(fds[i].fd, &efds);
+ }
+
+ // Set up the timeval structure for the timeout parameter
+ if(timo < 0)
+ {
+ toptr = 0;
+ }
+ else
+ {
+ toptr = &timeout;
+ timeout.tv_sec = timo / 1000;
+ timeout.tv_usec = (timo - timeout.tv_sec * 1000) * 1000;
+ }
+
+ rc = select(0, ip, op, &efds, toptr);
+
+ if(rc <= 0)
+ return rc;
+
+ if(rc > 0)
+ {
+ for (i = 0; i < nfds; ++i)
+ {
+ int fd = fds[i].fd;
+ if(fds[i].events & (POLLIN|POLLPRI) && FD_ISSET(fd, &ifds))
+ fds[i].revents |= POLLIN;
+ if(fds[i].events & POLLOUT && FD_ISSET(fd, &ofds))
+ fds[i].revents |= POLLOUT;
+ if(FD_ISSET(fd, &efds)) // Some error was detected ... should be some way to know.
+ fds[i].revents |= POLLHUP;
+ }
+ }
+ return rc;
+}
+
+#endif
--- /dev/null
+#ifndef AROS_COMPAT_H
+#define AROS_COMPAT_H
+
+#include <netinet/in.h>
+#include <sys/mount.h>
+
+#define statvfs statfs
+
+#define f_flag f_flags
+#define f_favail f_ffree
+/* we dont have these at all */
+#define f_fsid f_spare[0]
+#define f_frsize f_spare[0]
+#define f_namemax f_spare[0]
+
+#define POLLIN 0x0001 /* There is data to read */
+#define POLLPRI 0x0002 /* There is urgent data to read */
+#define POLLOUT 0x0004 /* Writing now will not block */
+#define POLLERR 0x0008 /* Error condition */
+#define POLLHUP 0x0010 /* Hung up */
+#define POLLNVAL 0x0020 /* Invalid request: fd not open */
+
+struct pollfd {
+ int fd; /* file descriptor */
+ short events; /* requested events */
+ short revents; /* returned events */
+};
+
+#define poll(x, y, z) aros_poll(x, y, z)
+
+#endif
;;
esac
+# check for poll.h
+dnl Check for poll.h
+AC_CHECK_HEADERS([poll.h])
+
# check for SA_LEN
dnl Check if sockaddr data structure includes a "sa_len"
AC_CHECK_MEMBER([struct sockaddr.sa_len],
#include <sys/socket.h>
])
+# check for sockaddr_storage
+dnl Check if sockaddr structure includes a "ss_family"
+AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
+ [ AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether we have sockaddr_Storage]) ],
+ [],
+ [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+
#output
AC_CONFIG_FILES([Makefile]
[include/Makefile]
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h" /* HAVE_SOCKADDR_STORAGE ? */
+#endif
+
#include <sys/socket.h> /* struct sockaddr_storage */
#include "libnfs-zdr.h"
+#ifndef HAVE_SOCKADDR_STORAGE
+/*
+ * RFC 2553: protocol-independent placeholder for socket addresses
+ */
+#define _SS_MAXSIZE 128
+#define _SS_ALIGNSIZE (sizeof(double))
+#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
+#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
+ _SS_PAD1SIZE - _SS_ALIGNSIZE)
+
+struct sockaddr_storage {
+#ifdef HAVE_SA_LEN
+ unsigned char ss_len; /* address length */
+ unsigned char ss_family; /* address family */
+#else
+ unsigned short ss_family;
+#endif
+ char __ss_pad1[_SS_PAD1SIZE];
+ double __ss_align; /* force desired structure storage alignment */
+ char __ss_pad2[_SS_PAD2SIZE];
+};
+#endif
+
+
struct rpc_fragment {
struct rpc_fragment *next;
uint64_t size;
* and slightly modified.
************************************************************/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#ifndef _LIBNFS_ZDR_H_
#define _LIBNFS_ZDR_H_
#define IZDR_PUT_BOOL(...) assert(0)
#define IZDR_GET_BOOL(...) (assert(0), 0)
+#ifndef TRUE
#define TRUE 1
+#endif
+#ifndef FALSE
#define FALSE 0
+#endif
enum zdr_op {
ZDR_ENCODE = 0,
enum reject_stat stat;
union {
struct {
- u_long low;
- u_long high;
+ uint32_t low;
+ uint32_t high;
} mismatch_info;
enum auth_stat stat;
} reject_data;
#if defined(ANDROID)
#include <sys/time.h>
#endif
+#if defined(AROS)
+#include <sys/time.h>
+#endif
struct nfs_context;
struct rpc_context;
#ifdef WIN32
#include "win32_compat.h"
#define DllExport
+#define HAVE_POLL_H
#else
#include <strings.h>
#include <unistd.h>
-#ifndef ANDROID
-#include <sys/statvfs.h>
-#else
-#include <netinet/in.h>
-#include <sys/vfs.h>
-#define statvfs statfs
-#endif
-#include <poll.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <sys/socket.h>
#include <net/if.h>
-#endif
+
+#ifdef AROS
+#include "aros_compat.h"
+#else
+#ifdef ANDROID
+#include <netinet/in.h>
+#include <sys/vfs.h>
+#define statvfs statfs
+#else
+#include <sys/statvfs.h>
+#endif /*ANDRIOD*/
+#endif /*AROS*/
+#endif /*WIN32*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include "win32_compat.h"
#else
+#include <sys/types.h>
#include <arpa/inet.h>
#endif/*WIN32*/
#include "win32_compat.h"
#define DllExport
#else
+
#include <strings.h>
-#ifndef ANDROID
-#include <sys/statvfs.h>
+#include <utime.h>
+#include <unistd.h>
+
+#ifdef AROS
+#include "aros_compat.h"
#else
+#ifdef ANDROID
#include <sys/vfs.h>
#define statvfs statfs
-#endif
-#include <utime.h>
-#include <unistd.h>
-#endif/*WIN32*/
+#else
+#include <sys/statvfs.h>
+#endif /*ANDROID*/
+#endif /*AROS*/
+#endif /*WIN32*/
#define _GNU_SOURCE
#include "win32_compat.h"
#else
#include <unistd.h>
-#include <poll.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
+#ifdef AROS
+#include "aros_compat.h"
+#endif
+
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "win32_compat.h"
#include <errno.h>
#include <stdio.h>
-#include < time.h >
+#include <time.h>
#undef poll
#undef socket