]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
arm darwin port
authorDerrick Brashear <shadow@dementia.org>
Mon, 14 Jun 2010 02:05:27 +0000 (22:05 -0400)
committerDerrick Brashear <shadow@dementia.org>
Mon, 14 Jun 2010 03:27:48 +0000 (20:27 -0700)
make things buildable on arm darwin

Change-Id: I88af2b82e9ed356fd57aa8f05dfee71d7fa6cd8a
Reviewed-on: http://gerrit.openafs.org/2153
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/afsd/afsd.c
src/config/afs_sysnames.h
src/config/param.arm_darwin_100.h [new file with mode: 0644]
src/des/conf-darwin.h
src/des/make_p.c
src/des/misc.c
src/lwp/Makefile.in
src/rx/rx_getaddr.c
src/util/uuid.c
src/viced/afsfileprocs.c
src/vol/devname.c

index 5bc7758776522b9451b512897a9738c9df820ad3..ffbfe256249210ba5451d7d920bd3780bf8e72f7 100644 (file)
 #include <sys/fs_types.h>
 #endif
 
-#ifdef HAVE_SYS_MOUNT_H
+#if defined(HAVE_SYS_MOUNT_H) && !defined(AFS_ARM_DARWIN_ENV)
 #include <sys/mount.h>
 #endif
 
@@ -172,12 +172,15 @@ void set_staticaddrs(void);
 #include <SystemConfiguration/SystemConfiguration.h>
 #include <SystemConfiguration/SCDynamicStore.h>
 
+#ifndef AFS_ARM_DARWIN_ENV
 #include <IOKit/pwr_mgt/IOPMLib.h>
 #include <IOKit/IOMessage.h>
 
 static io_connect_t root_port;
 static IONotificationPortRef notify;
 static io_object_t iterator;
+#endif
+
 static CFRunLoopSourceRef source;
 
 static int event_pid;
@@ -342,7 +345,7 @@ static void fork_rx_syscall();
 #endif
 static void fork_syscall();
 
-#ifdef AFS_DARWIN_ENV
+#if defined(AFS_DARWIN_ENV) && !defined(AFS_ARM_DARWIN_ENV)
 static void
 afsd_sleep_callback(void * refCon, io_service_t service, 
                    natural_t messageType, void * messageArgument )
@@ -423,10 +426,11 @@ afsd_event_cleanup(int signo) {
 
     CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
     CFRelease (source);
+#ifndef AFS_ARM_DARWIN_ENV
     IODeregisterForSystemPower(&iterator);
     IOServiceClose(root_port);
     IONotificationPortDestroy(notify);
-
+#endif
     exit(0);
 }
 
@@ -437,6 +441,7 @@ afsd_install_events(void)
     SCDynamicStoreContext ctx = {0};
     SCDynamicStoreRef store;
 
+#ifndef AFS_ARM_DARWIN_ENV
     root_port = IORegisterForSystemPower(0,&notify,afsd_sleep_callback,&iterator);
     
     if (root_port) {
@@ -483,6 +488,7 @@ afsd_install_events(void)
        
        CFRelease (store); 
     }
+#endif
     
     if (source != NULL) {
        CFRunLoopAddSource (CFRunLoopGetCurrent(),
index a0b680c02e52c86ebe9a22c4a70ee8371a0dee6b..1476140a1127a4295168bd5071fdfb8d28fa1f16 100644 (file)
@@ -66,6 +66,7 @@
 #define SYS_NAME_ID_ppc64_darwin_100     513
 #define SYS_NAME_ID_x86_darwin_100       514
 #define SYS_NAME_ID_amd64_darwin_100     515
+#define SYS_NAME_ID_arm_darwin_100       516
 
 #define SYS_NAME_ID_next_mach20                 601
 #define SYS_NAME_ID_next_mach30                 602
diff --git a/src/config/param.arm_darwin_100.h b/src/config/param.arm_darwin_100.h
new file mode 100644 (file)
index 0000000..21f98d0
--- /dev/null
@@ -0,0 +1,257 @@
+#ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+#define AFS_ENV                 1
+#define AFS_64BIT_ENV           1      /* Defines afs_int32 as int, not long. */
+#define AFS_64BIT_CLIENT        1
+#define AFS_64BIT_IOPS_ENV     1
+#if defined(__ppc__)
+#define AFS_PPC_ENV            1
+#elif defined(__i386__) || defined(__amd64__)
+#define AFS_X86_ENV            1
+#elif defined(__arm__)
+#define AFS_ARM_ENV             1
+#define AFS_ARM_DARWIN_ENV      1
+#else
+#error Unsupported architecture
+#endif
+#ifdef __amd64__
+#define AFS_64BITUSERPOINTER_ENV 1
+#endif
+#define AFS_64BIT_SIZEOF 1 /* seriously? */
+#include <afs/afs_sysnames.h>
+
+#define AFS_DARWIN_ENV
+#define AFS_DARWIN70_ENV
+#define AFS_DARWIN80_ENV
+#define AFS_DARWIN90_ENV
+#define AFS_DARWIN100_ENV
+#undef  AFS_NONFSTRANS
+#define AFS_NONFSTRANS
+#define AFS_SYSCALL             230
+#define AFS_NAMEI_ENV 1
+#define DARWIN_REFBASE 3
+#define AFS_WARNUSER_MARINER_ENV 1
+#define AFS_CACHE_VNODE_PATH
+#define NEED_IOCTL32 
+
+/* File system entry (used if mount.h doesn't define MOUNT_AFS */
+#define AFS_MOUNT_AFS    "afs"
+
+/* Machine / Operating system information */
+#if defined(__ppc__)
+#define sys_ppc_darwin_12      1
+#define sys_ppc_darwin_13      1
+#define sys_ppc_darwin_14      1
+#define sys_ppc_darwin_60      1
+#define sys_ppc_darwin_70      1
+#define sys_ppc_darwin_80      1
+#define sys_ppc_darwin_90      1
+#define sys_ppc_darwin_100     1
+#define SYS_NAME               "ppc_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_ppc_darwin_100
+#define AFSBIG_ENDIAN          1
+#elif defined(__ppc64__)
+#define sys_ppc_darwin_12      1
+#define sys_ppc_darwin_13      1
+#define sys_ppc_darwin_14      1
+#define sys_ppc_darwin_60      1
+#define sys_ppc_darwin_70      1
+#define sys_ppc_darwin_80      1
+#define sys_ppc_darwin_90      1
+#define sys_ppc_darwin_100     1
+#define sys_ppc64_darwin_100   1
+#define SYS_NAME               "ppc64_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_ppc64_darwin_100
+#define AFSBIG_ENDIAN          1
+#elif defined(__i386__) 
+#define sys_x86_darwin_12      1
+#define sys_x86_darwin_13      1
+#define sys_x86_darwin_14      1
+#define sys_x86_darwin_60      1
+#define sys_x86_darwin_70      1
+#define sys_x86_darwin_80      1
+#define sys_x86_darwin_90      1
+#define sys_x86_darwin_100     1
+#define SYS_NAME               "x86_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_x86_darwin_100
+#define AFSLITTLE_ENDIAN       1
+#elif defined(__amd64__) 
+#define sys_x86_darwin_12      1
+#define sys_x86_darwin_13      1
+#define sys_x86_darwin_14      1
+#define sys_x86_darwin_60      1
+#define sys_x86_darwin_70      1
+#define sys_x86_darwin_80      1
+#define sys_x86_darwin_90      1
+#define sys_x86_darwin_100     1
+#define sys_amd64_darwin_100   1
+#define SYS_NAME               "amd64_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_amd64_darwin_100
+#define AFSLITTLE_ENDIAN       1
+#elif defined(__arm__) 
+#define sys_arm_darwin_100     1
+#define SYS_NAME               "arm_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_arm_darwin_100
+#define AFSLITTLE_ENDIAN       1
+#else
+#error Unsupported architecture
+#endif
+#define AFS_HAVE_FFS    1      /* Use system's ffs. */
+
+#define AFS_GCPAGS               0
+#define RXK_LISTENER_ENV         1
+
+#define RTM_NEWADDR     0xc     /* address being added to iface */
+#define RTM_IFINFO      0xe     /* iface going up/down etc. */
+#define RTAX_NETMASK    2       /* netmask sockaddr present */
+#define RTAX_IFA        5       /* interface addr sockaddr present */
+#define RTAX_MAX        8       /* size of array to allocate */
+
+struct rt_addrinfo {
+    int     rti_addrs;
+    struct  sockaddr *rti_info[RTAX_MAX];
+};
+#ifdef KERNEL
+#undef MACRO_BEGIN
+#undef MACRO_END
+#include <kern/macro_help.h>
+#define AFS_GLOBAL_SUNLOCK        1
+#define AFS_VFS34       1      /* What is VFS34??? */
+#define afsio_iov       uio_iov
+#define afsio_iovcnt    uio_iovcnt
+#define afsio_offset    uio_offset
+#define afsio_seg       uio_segflg
+#define afsio_resid     uio_resid
+#define AFS_UIOSYS      UIO_SYSSPACE
+#define AFS_UIOUSER     UIO_USERSPACE
+#define AFS_CLBYTES     CLBYTES
+#define osi_GetTime(x)  microtime(x)
+#define AFS_KALLOC(x)   _MALLOC(x, M_TEMP, M_WAITOK)
+#define AFS_KFREE(x,y)  _FREE(x,M_TEMP)
+#define v_count         v_usecount
+#define v_vfsp          v_mount
+#define vfs_bsize       mnt_stat.f_bsize
+#define vfs_fsid        mnt_stat.f_fsid
+#define va_nodeid       va_fileid
+#define vfs_vnodecovered mnt_vnodecovered
+#define direct          dirent
+
+#define BIND_8_COMPAT
+
+#endif
+#endif /* AFS_PARAM_H */
+
+#else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+#define AFS_ENV                 1
+#define AFS_64BIT_ENV           1      /* Defines afs_int32 as int, not long. */
+#if defined(__ppc__)
+#define AFS_PPC_ENV            1
+#elif defined(__i386__) || defined(__amd64__)
+#define AFS_X86_ENV            1
+#elif defined(__arm__)
+#define AFS_ARM_ENV             1
+#define AFS_ARM_DARWIN_ENV      1
+#else
+#error Unsupported architecture
+#endif
+#ifdef __amd64__
+#define AFS_64BITUSERPOINTER_ENV 1
+#endif
+
+#include <afs/afs_sysnames.h>
+#define AFS_USERSPACE_ENV
+#define AFS_USR_DARWIN_ENV
+#define AFS_USR_DARWIN70_ENV
+#define AFS_USR_DARWIN80_ENV
+#define AFS_USR_DARWIN90_ENV
+#define AFS_USR_DARWIN100_ENV
+#undef  AFS_NONFSTRANS
+#define AFS_NONFSTRANS
+#define AFS_SYSCALL             230
+#define DARWIN_REFBASE 0
+#define AFS_WARNUSER_MARINER_ENV 1
+
+/* File system entry (used if mount.h doesn't define MOUNT_AFS */
+#define AFS_MOUNT_AFS    "afs"
+
+/* Machine / Operating system information */
+#if defined(__ppc__)
+#define sys_ppc_darwin_12      1
+#define sys_ppc_darwin_13      1
+#define sys_ppc_darwin_14      1
+#define sys_ppc_darwin_60      1
+#define sys_ppc_darwin_70      1
+#define sys_ppc_darwin_80      1
+#define sys_ppc_darwin_90      1
+#define sys_ppc_darwin_100     1
+#define SYS_NAME               "ppc_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_ppc_darwin_100
+#define AFSBIG_ENDIAN          1
+#elif defined(__i386__)
+#define sys_x86_darwin_12      1
+#define sys_x86_darwin_13      1
+#define sys_x86_darwin_14      1
+#define sys_x86_darwin_60      1
+#define sys_x86_darwin_70      1
+#define sys_x86_darwin_80      1
+#define sys_x86_darwin_100     1
+#define SYS_NAME               "x86_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_x86_darwin_100
+#define AFSLITTLE_ENDIAN       1
+#elif defined(__amd64__)
+#define sys_x86_darwin_12      1
+#define sys_x86_darwin_13      1
+#define sys_x86_darwin_14      1
+#define sys_x86_darwin_60      1
+#define sys_x86_darwin_70      1
+#define sys_x86_darwin_80      1
+#define sys_x86_darwin_100     1
+#define sys_amd64_darwin_100   1
+#define SYS_NAME               "amd64_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_amd64_darwin_100
+#define AFSLITTLE_ENDIAN       1
+#elif defined(__arm__) 
+#define sys_arm_darwin_100     1
+#define SYS_NAME               "arm_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_arm_darwin_100
+#define AFSLITTLE_ENDIAN       1
+#else
+#error Unsupported architecture
+#endif
+#define AFS_HAVE_FFS    1      /* Use system's ffs. */
+
+#define AFS_UIOSYS      UIO_SYSSPACE
+#define AFS_UIOUSER     UIO_USERSPACE
+
+#define AFS_GCPAGS                0    /* if nonzero, garbage collect PAGs */
+#define RXK_LISTENER_ENV          1
+
+#define AFS_VFS34       1      /* What is VFS34??? */
+#define afsio_iov       uio_iov
+#define afsio_iovcnt    uio_iovcnt
+#define afsio_offset    uio_offset
+#define afsio_seg       uio_segflg
+#define afsio_resid     uio_resid
+#define AFS_UIOSYS      UIO_SYSSPACE
+#define AFS_UIOUSER     UIO_USERSPACE
+#define        VATTR_NULL      usr_vattr_null
+
+#define AFS_DIRENT
+#ifndef CMSERVERPREF
+#define CMSERVERPREF
+#endif
+
+#define BIND_8_COMPAT
+#endif /* AFS_PARAM_H */
+
+#endif /* !defined(UKERNEL) */
index f686e4660ee94c5347058c0b419dc8f8b5178d65..bad6006af5cf17b6c0784a6a4faacc5f5f9e0562 100644 (file)
@@ -3,7 +3,7 @@
 #undef BSDUNIX
 #if defined(__ppc__) || defined(__ppc64__)
 #define MSBFIRST
-#elif defined(__i386__) || defined(__amd64__)
+#elif defined(__i386__) || defined(__amd64__) || defined(__arm__)
 #define LSBFIRST
 #else
 #error "MSBFIRST or LSBFIRST undefined"
index d430679e6151b3e11985022a897a4e4d733fdd3a..9dc954570ae660098f5c0dd98911bab551238b30 100644 (file)
@@ -38,7 +38,7 @@ gen(FILE * stream)
     fprintf(stream, "    P_temp_p = (unsigned char *) &P_temp;\n");
 
 #ifdef AFS_DARWIN80_ENV
-    fprintf(stream, "#if defined(__i386__) || defined(__amd64__)\n");
+    fprintf(stream, "#if defined(__i386__) || defined(__amd64__) || defined(__arm__)\n");
     fprintf(stream, "    R2 = P_prime[0][*P_temp_p++];\n");
     fprintf(stream, "    R2 |= P_prime[1][*P_temp_p++];\n");
     fprintf(stream, "    R2 |= P_prime[2][*P_temp_p++];\n");
index f39d2d60d18ae1cc7fec3ebea3339192b0d22238..be800f2542abeb0a025ec640952667aff07c642e 100644 (file)
@@ -271,7 +271,7 @@ swap_long_bytes_bit_number(afs_uint32 x)
 #if !defined(KERNEL) && defined(AFS_DARWIN80_ENV)
 char *_darwin_whichstr[] = {
     "#if defined(__ppc__) || defined(__ppc64__)\n",
-    "#elif defined(__i386__) || defined(__amd64__)\n",
+    "#elif defined(__i386__) || defined(__amd64__) || defined(__arm__)\n",
     "#else\n#error architecture unsupported\n#endif\n"
 };
 int _darwin_which = 1;
index 5821729b8e0ab6d383c67037599db0d5001ff855..03b6a94f140b0eba11c25f2babac534ee74ab163 100644 (file)
@@ -73,38 +73,45 @@ process.o   : process.s process.i386.s process.c lwp.o
                $(RM) -f process.o ; \
                CURRENTBUILDARCH="${ARCHFLAGS}"; \
                if [ -z "$${CURRENTBUILDARCH}" ] ; then \
-                   CURRENTBUILDARCH=`$(CC) -dM -E -xc /dev/null | grep 'ppc\|i386\|x86_64'`; \
+                   CURRENTBUILDARCH=`$(CC) -dM -E -xc /dev/null | grep 'ppc\|i386\|x86_64\|arm'`; \
                fi; \
                ppc=`echo $${CURRENTBUILDARCH} | grep -q ppc && echo process.ppc.o` ; \
                i386=`echo $${CURRENTBUILDARCH} | grep -q i386 && echo process.i386.o` ; \
                amd64=`echo $${CURRENTBUILDARCH} | grep -q x86_64 && echo process.amd64.o` ; \
-               if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${amd64}" ] ; then \
+               arm=`echo $${CURRENTBUILDARCH} | grep -q arm && echo process.arm.o` ; \
+               if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${amd64}" -a -z "$${arm}" ] ; then \
                        if [ `arch` = ppc ] ; then \
                                ppc=yes ; \
                        else \
                                i386=yes ; \
                        fi ; \
                fi ; \
+               if [ -n "$${arm}" ] ; then \
+                       $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch armv6 -I${TOP_INCDIR} ${srcdir}/process.c -o "$${arm}" ; \
+                       if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" ] ; then \
+                               ${MV} "$${arm}" process.o ; \
+                       fi ; \
+               fi ; \
                if [ -n "$${ppc}" ] ; then \
                        $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch ppc -I${TOP_INCDIR} ${srcdir}/process.s -o "$${ppc}" ; \
-                       if [ -z "$${i386}" -a -z "$${amd64}" ] ; then \
+                       if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${arm}" ] ; then \
                                ${MV} "$${ppc}" process.o ; \
                        fi ; \
                fi ; \
                if [ -n "$${i386}" ] ; then \
                        $(CC) -x assembler-with-cpp -c -arch i386 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s -o "$${i386}" ; \
-                       if [ -z "$${ppc}" -a -z "$${amd64}" ] ; then \
+                       if [ -z "$${ppc}" -a -z "$${amd64}" -a -z "$${arm}" ] ; then \
                                ${MV} "$${i386}" process.o ; \
                        fi ; \
                fi ; \
                if [ -n "$${amd64}" ] ; then \
                        $(CC) -x assembler-with-cpp -c -arch x86_64 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.amd64.s -o "$${amd64}" ; \
-                       if [ -z "$${ppc}" -a -z "$${i386}" ] ; then \
+                       if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${arm}" ] ; then \
                                ${MV} "$${amd64}" process.o ; \
                        fi ; \
                fi ; \
                if [ ! -f process.o ] ; then \
-                       lipo -create $${amd64} $${i386} $${ppc} -output process.o ;\
+                       lipo -create $${amd64} $${i386} $${ppc} $${arm} -output process.o ;\
                fi ;; \
        i386_*bsd*) \
                cp ${srcdir}/process.i386.s process.S ; \
index 928ae17c9447ddf0a67c2bbf8553db9c84c77504..9a5104da7061a95d78310d992b7ba69e193b3b13 100644 (file)
@@ -22,7 +22,9 @@
 #include <string.h>
 #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 #include <sys/sysctl.h>
+#ifndef AFS_ARM_DARWIN_ENV
 #include <net/route.h>
+#endif
 #include <net/if_dl.h>
 #endif
 
index fc29af4d4a0330f66481f91c7938c2e888b30c37..9cd10e36a2e689810a782ac3be4158fe47ac31c0 100644 (file)
@@ -80,7 +80,7 @@
 #endif
 #include <sys/stat.h>
 #include <fcntl.h>
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
 #include <netinet/if_ether.h>
 #endif
 #include "afsutil.h"
index 2b36f62370766456cbceb48a77446efc36686931..b064464a6441fd7c40dc81aed65f263bce0f8d7d 100644 (file)
 
 #ifndef AFS_LINUX20_ENV
 #include <net/if.h>
+#ifndef AFS_ARM_DARWIN_ENV
 #include <netinet/if_ether.h>
 #endif
 #endif
+#endif
 #ifdef AFS_HPUX_ENV
 /* included early because of name conflict on IOPEN */
 #include <sys/inode.h>
index a5df6ff36eb7ade4e99a92eb2f18d2946f47ef88..dbcb362ee899e379216d88b7fa6f1a03894ecf92 100644 (file)
@@ -176,7 +176,7 @@ vol_DevName(dev_t adev, char *wpath)
        if (stat(part, &status) == -1) {
            continue;
        }
-#if !defined(AFS_SGI_XFS_IOPS_ENV) && !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_SGI_XFS_IOPS_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_ARM_DARWIN_ENV)
        if ((status.st_ino !=
             ROOTINO) /*|| ((status.st_mode & S_IFMT) != S_IFBLK) */ ) {
            continue;