Initial AROS support.
The test app doesnt link yet since we are missing a bunch of symbols but it is a startlibnfs-4.0.0-vitalif
parent
5ba63317ac
commit
d7c6e9aaa9
|
@ -0,0 +1,27 @@
|
||||||
|
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
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
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
|
|
@ -0,0 +1,31 @@
|
||||||
|
#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
|
14
configure.ac
14
configure.ac
|
@ -81,6 +81,10 @@ case $host in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# check for poll.h
|
||||||
|
dnl Check for poll.h
|
||||||
|
AC_CHECK_HEADERS([poll.h])
|
||||||
|
|
||||||
# check for SA_LEN
|
# check for SA_LEN
|
||||||
dnl Check if sockaddr data structure includes a "sa_len"
|
dnl Check if sockaddr data structure includes a "sa_len"
|
||||||
AC_CHECK_MEMBER([struct sockaddr.sa_len],
|
AC_CHECK_MEMBER([struct sockaddr.sa_len],
|
||||||
|
@ -91,6 +95,16 @@ AC_CHECK_MEMBER([struct sockaddr.sa_len],
|
||||||
#include <sys/socket.h>
|
#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
|
#output
|
||||||
AC_CONFIG_FILES([Makefile]
|
AC_CONFIG_FILES([Makefile]
|
||||||
[include/Makefile]
|
[include/Makefile]
|
||||||
|
|
|
@ -14,10 +14,38 @@
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
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/>.
|
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 <sys/socket.h> /* struct sockaddr_storage */
|
||||||
|
|
||||||
#include "libnfs-zdr.h"
|
#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 {
|
||||||
struct rpc_fragment *next;
|
struct rpc_fragment *next;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
* and slightly modified.
|
* and slightly modified.
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBNFS_ZDR_H_
|
#ifndef _LIBNFS_ZDR_H_
|
||||||
#define _LIBNFS_ZDR_H_
|
#define _LIBNFS_ZDR_H_
|
||||||
|
@ -58,8 +60,12 @@ typedef void SVCXPRT;
|
||||||
#define IZDR_PUT_BOOL(...) assert(0)
|
#define IZDR_PUT_BOOL(...) assert(0)
|
||||||
#define IZDR_GET_BOOL(...) (assert(0), 0)
|
#define IZDR_GET_BOOL(...) (assert(0), 0)
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
#ifndef FALSE
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
enum zdr_op {
|
enum zdr_op {
|
||||||
ZDR_ENCODE = 0,
|
ZDR_ENCODE = 0,
|
||||||
|
@ -178,8 +184,8 @@ struct rejected_reply {
|
||||||
enum reject_stat stat;
|
enum reject_stat stat;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u_long low;
|
uint32_t low;
|
||||||
u_long high;
|
uint32_t high;
|
||||||
} mismatch_info;
|
} mismatch_info;
|
||||||
enum auth_stat stat;
|
enum auth_stat stat;
|
||||||
} reject_data;
|
} reject_data;
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(AROS)
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct nfs_context;
|
struct nfs_context;
|
||||||
struct rpc_context;
|
struct rpc_context;
|
||||||
|
|
|
@ -20,27 +20,36 @@
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "win32_compat.h"
|
#include "win32_compat.h"
|
||||||
#define DllExport
|
#define DllExport
|
||||||
|
#define HAVE_POLL_H
|
||||||
#else
|
#else
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <unistd.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 <sys/ioctl.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <net/if.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
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_POLL_H
|
||||||
|
#include <poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "win32_compat.h"
|
#include "win32_compat.h"
|
||||||
#else
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif/*WIN32*/
|
#endif/*WIN32*/
|
||||||
|
|
||||||
|
|
20
lib/libnfs.c
20
lib/libnfs.c
|
@ -21,16 +21,22 @@
|
||||||
#include "win32_compat.h"
|
#include "win32_compat.h"
|
||||||
#define DllExport
|
#define DllExport
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#ifndef ANDROID
|
|
||||||
#include <sys/statvfs.h>
|
|
||||||
#else
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#define statvfs statfs
|
|
||||||
#endif
|
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif/*WIN32*/
|
|
||||||
|
#ifdef AROS
|
||||||
|
#include "aros_compat.h"
|
||||||
|
#else
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include <sys/vfs.h>
|
||||||
|
#define statvfs statfs
|
||||||
|
#else
|
||||||
|
#include <sys/statvfs.h>
|
||||||
|
#endif /*ANDROID*/
|
||||||
|
#endif /*AROS*/
|
||||||
|
#endif /*WIN32*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
|
10
lib/socket.c
10
lib/socket.c
|
@ -18,7 +18,6 @@
|
||||||
#include "win32_compat.h"
|
#include "win32_compat.h"
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -28,6 +27,15 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef AROS
|
||||||
|
#include "aros_compat.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_POLL_H
|
||||||
|
#include <poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -29,7 +29,7 @@ static int dummy ATTRIBUTE((unused));
|
||||||
#include "win32_compat.h"
|
#include "win32_compat.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include < time.h >
|
#include <time.h>
|
||||||
|
|
||||||
#undef poll
|
#undef poll
|
||||||
#undef socket
|
#undef socket
|
||||||
|
|
Loading…
Reference in New Issue