i386-user-mode-linux-support-20030513
authorKris Van Hees <kvanhees@sinenomine.net>
Tue, 13 May 2003 05:23:56 +0000 (05:23 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 13 May 2003 05:23:56 +0000 (05:23 +0000)
FIXES 1396

support for usermode linux

13 files changed:
.cvsignore
README
acinclude.m4
src/afs/LINUX/osi_alloc.c
src/afs/Makefile.in
src/cf/osconf.m4
src/config/afs_sysnames.h
src/config/param.i386_umlinux22.h [new file with mode: 0644]
src/config/param.i386_umlinux22_usr.h [new file with mode: 0644]
src/config/param.i386_umlinux24.h [new file with mode: 0644]
src/config/param.i386_umlinux24_usr.h [new file with mode: 0644]
src/libafs/MakefileProto.LINUX.in
src/lwp/Makefile.in

index 620ede7..36ed4a6 100644 (file)
@@ -9,6 +9,8 @@ hp_ux102
 hp_ux110
 i386_linux22
 i386_linux24
+i386_umlinux22
+i386_umlinux24
 include
 lib
 parisc_linux24
diff --git a/README b/README
index dd78fc2..4f45e06 100644 (file)
--- a/README
+++ b/README
@@ -37,6 +37,8 @@ A. Creating the proper directory structure.
               (gnu make is required for building on FreeBSD)
       i386_linux22
       i386_linux24
+      i386_umlinux22
+      i386_umlinux24
       i386_obsd31, i386_obsd32
       rs_aix42
       sgi_65 (file server not tested)
index 4a0515c..ab2b771 100644 (file)
@@ -536,6 +536,11 @@ else
                        fi
                        _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
                        AFS_SYSNAME="$_AFS_SYSNAME"
+                       AFS_ISUML=`echo $LINUX_VERSION | awk 'BEGIN {FS="-[[0-9]]+"} {print $[]2}'`
+                       if test "x${AFS_ISUML}" = "xum"; then
+                        _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
+                       fi
+                       AFS_SYSNAME="$_AFS_SYSNAME"
                        ;;
        esac
         AC_MSG_RESULT($AFS_SYSNAME)
index 1f8d1a4..0e30d67 100644 (file)
@@ -188,7 +188,7 @@ hash_verify(size_t index, unsigned key, void *data)
     int memtype;
 
     memtype = MEMTYPE(lmp->chunk);
-#ifdef AFS_SPARC64_LINUX24_ENV
+#if defined(AFS_SPARC64_LINUX24_ENV) || defined(AFS_I386_UMLINUX20_ENV)
     if ((memtype == KM_TYPE) && (!VALID_PAGE(virt_to_page(lmp->chunk)))) {
        printf("osi_linux_verify_alloced_memory: address 0x%x outside range, index=%d, key=%d\n", lmp->chunk, index, key);
     }
index 874f4eb..7c7c020 100644 (file)
@@ -31,7 +31,7 @@ afszcm.cat: afs_trace.msf
                        gencat -m afszcm.cat afs_trace.msf ;; \
                sun*_4* ) \
                        /usr/etc/gencat afszcm.cat afs_trace.msf ;; \
-               *_linux* ) \
+               *_linux* | *_umlinux* ) \
                        gencat --new afszcm.cat afs_trace.msf ;; \
                ppc_darwin* | i386_fbsd*) \
                        echo No gencat for ${SYS_NAME} ;; \
index 7d9ed85..67a2451 100644 (file)
@@ -270,6 +270,21 @@ case $AFS_SYSNAME in
                SHLIB_LINKER="${MT_CC} -shared"
                ;;
 
+       i386_umlinux22)
+               CC="gcc -pipe"
+               MT_CC="gcc -pipe"
+               KERN_OPTMZ=-O2
+               LEX="flex -l"
+               MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
+               MT_LIBS="-lpthread"
+               PAM_CFLAGS="-O2 -Dlinux -DLINUX_PAM -fPIC"
+               SHLIB_LDFLAGS="-shared -Xlinker -x"
+               TXLIBS="/usr/lib/libncurses.so"
+               XCFLAGS="-O2 -D_LARGEFILE64_SOURCE"
+               YACC="bison -y"
+               SHLIB_LINKER="${MT_CC} -shared"
+               ;;
+
        i386_linux24)
                CC="gcc -pipe"
                MT_CC="gcc -pipe"
@@ -289,6 +304,25 @@ case $AFS_SYSNAME in
                SHLIB_LINKER="${MT_CC} -shared"
                ;;
 
+       i386_umlinux24)
+               CC="gcc -pipe"
+               MT_CC="gcc -pipe"
+               KERN_OPTMZ=-O2
+               LEX="flex -l"
+               MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
+               MT_LIBS="-lpthread"
+               DBG=-g
+               KERN_DBG=-g
+               LWP_DBG=-g
+               LWP_OPTMZ=-O2
+               OPTMZ=-O2
+               PAM_CFLAGS="-g -O2 -Dlinux -DLINUX_PAM -fPIC"
+               SHLIB_LDFLAGS="-shared -Xlinker -x"
+               TXLIBS="/usr/lib/libncurses.so"
+               XCFLAGS="-g -O2 -D_LARGEFILE64_SOURCE"
+               SHLIB_LINKER="${MT_CC} -shared"
+               ;;
+
        *_obsd*)
                LEX="flex -l"
                MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
index 45d0c50..fd93d52 100644 (file)
@@ -7,6 +7,10 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
+#define SYS_NAME_ID_i386_umlinux2      2700
+#define SYS_NAME_ID_i386_umlinux22     2701
+#define SYS_NAME_ID_i386_umlinux24     2702
+
 /*
  * File: afs_sysnames.h
  *
diff --git a/src/config/param.i386_umlinux22.h b/src/config/param.i386_umlinux22.h
new file mode 100644 (file)
index 0000000..47f070f
--- /dev/null
@@ -0,0 +1,155 @@
+#ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ * 
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+ * it's a judgment call. If something is obviously i386 specific, use that
+ * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+ * in the sysname is the current version of the client. This takes into
+ * account the perferred OS user space configuration as well as the kernel.
+ */
+
+#define AFS_LINUX20_ENV        1
+#define AFS_LINUX22_ENV        1
+#define AFS_I386_LINUX20_ENV   1
+#define AFS_I386_LINUX22_ENV   1
+#define AFS_I386_UMLINUX20_ENV 1
+#define AFS_I386_UMLINUX22_ENV 1
+#define AFS_NONFSTRANS 1
+
+#define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+#define AFS_SYSCALL 137
+#define AFS_64BIT_IOPS_ENV  1
+#define AFS_NAMEI_ENV     1   /* User space interface to file system */
+
+#if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+#include <linux/config.h>
+#ifdef CONFIG_SMP
+#undef CONFIG_SMP
+#endif
+/* Using "AFS_SMP" to map to however many #define's are required to get
+ * MP to compile for Linux
+ */
+#ifdef AFS_SMP
+#define CONFIG_SMP 1
+#ifndef CONFIG_X86_LOCAL_APIC
+#define CONFIG_X86_LOCAL_APIC 1
+#endif
+#ifndef __SMP__
+#define __SMP__
+#endif
+#define AFS_GLOBAL_SUNLOCK
+#endif
+
+#if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+#define MODVERSIONS
+#include <linux/modversions.h>
+#endif
+
+#endif /* __KERNEL__  && !DUMP_KERNEL*/
+
+#include <afs/afs_sysnames.h>
+
+#define AFS_USERSPACE_IP_ADDR 1
+#define RXK_LISTENER_ENV 1
+#define AFS_GCPAGS       2 /* Set to Userdisabled, allow sysctl to override */
+
+
+/* Machine / Operating system information */
+#define SYS_NAME       "i386_umlinux22"
+#define SYS_NAME_ID    SYS_NAME_ID_i386_umlinux22
+#define AFSLITTLE_ENDIAN    1
+#define AFS_HAVE_FFS        1       /* Use system's ffs. */
+#define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+#define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+
+#ifdef KERNEL
+#ifndef MIN
+#define MIN(A,B) ((A) < (B) ? (A) : (B))
+#endif
+#ifndef MAX
+#define MAX(A,B) ((A) > (B) ? (A) : (B))
+#endif
+#endif /* KERNEL */
+
+#endif /* AFS_PARAM_H */
+
+#else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ * 
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+ * it's a judgment call. If something is obviously i386 specific, use that
+ * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+ * in the sysname is the current version of the client. This takes into
+ * account the perferred OS user space configuration as well as the kernel.
+ */
+
+#define UKERNEL                        1       /* user space kernel */
+#define AFS_ENV                        1
+#define AFS_USR_LINUX20_ENV    1
+#define AFS_USR_LINUX22_ENV    1
+#define AFS_NONFSTRANS 1
+
+#define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+#define AFS_SYSCALL 137
+#define AFS_64BIT_IOPS_ENV  1
+#define AFS_NAMEI_ENV     1   /* User space interface to file system */
+#include <afs/afs_sysnames.h>
+
+#define AFS_USERSPACE_IP_ADDR 1
+#define RXK_LISTENER_ENV 1
+#define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+
+
+/* Machine / Operating system information */
+#define SYS_NAME       "i386_umlinux22"
+#define SYS_NAME_ID    SYS_NAME_ID_i386_umlinux22
+#define AFSLITTLE_ENDIAN    1
+#define AFS_HAVE_FFS        1       /* Use system's ffs. */
+#define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+#define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+
+#define        afsio_iov       uio_iov
+#define        afsio_iovcnt    uio_iovcnt
+#define        afsio_offset    uio_offset
+#define        afsio_seg       uio_segflg
+#define        afsio_fmode     uio_fmode
+#define        afsio_resid     uio_resid
+#define        AFS_UIOSYS      1
+#define        AFS_UIOUSER     UIO_USERSPACE
+#define        AFS_CLBYTES     MCLBYTES
+#define        AFS_MINCHANGE   2
+#define        VATTR_NULL      usr_vattr_null
+
+#define AFS_DIRENT
+#ifndef CMSERVERPREF
+#define CMSERVERPREF
+#endif
+
+#endif /* AFS_PARAM_H */
+
+#endif /* !defined(UKERNEL) */
diff --git a/src/config/param.i386_umlinux22_usr.h b/src/config/param.i386_umlinux22_usr.h
new file mode 100644 (file)
index 0000000..5f39e4c
--- /dev/null
@@ -0,0 +1 @@
+#error This file is deprecated, do not use or maintain.
diff --git a/src/config/param.i386_umlinux24.h b/src/config/param.i386_umlinux24.h
new file mode 100644 (file)
index 0000000..fb04b1c
--- /dev/null
@@ -0,0 +1,151 @@
+#ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+ * it's a judgment call. If something is obviously i386 specific, use that
+ * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+ * in the sysname is the current version of the client. This takes into
+ * account the perferred OS user space configuration as well as the kernel.
+ */
+
+#define AFS_LINUX20_ENV        1
+#define AFS_LINUX22_ENV        1
+#define AFS_LINUX24_ENV        1
+#define AFS_I386_LINUX20_ENV   1
+#define AFS_I386_LINUX22_ENV   1
+#define AFS_I386_LINUX24_ENV   1
+#define AFS_I386_UMLINUX20_ENV 1
+#define AFS_I386_UMLINUX22_ENV 1
+#define AFS_I386_UMLINUX24_ENV 1
+#define AFS_NONFSTRANS 1
+
+#define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+#define AFS_SYSCALL 137
+#define AFS_64BIT_IOPS_ENV  1
+#define AFS_NAMEI_ENV     1   /* User space interface to file system */
+#define AFS_64BIT_ENV          1
+#define AFS_64BIT_CLIENT       1
+
+#ifdef AFS_LARGEFILE_ENV
+#define _FILE_OFFSET_BITS      64
+#endif
+
+
+#if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+#include <linux/threads.h>
+
+#include <linux/config.h>
+#ifdef CONFIG_SMP
+#undef CONFIG_SMP
+#endif
+/* Using "AFS_SMP" to map to however many #define's are required to get
+ * MP to compile for Linux
+ */
+#ifdef AFS_SMP
+#define CONFIG_SMP 1
+#ifndef CONFIG_X86_LOCAL_APIC
+#define CONFIG_X86_LOCAL_APIC 1
+#endif
+#ifndef __SMP__
+#define __SMP__
+#endif
+#define AFS_GLOBAL_SUNLOCK
+#endif
+
+#if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+#define MODVERSIONS
+#include <linux/modversions.h>
+#endif
+
+#endif /* __KERNEL__  && !DUMP_KERNEL*/
+
+#include <afs/afs_sysnames.h>
+#define AFS_USERSPACE_IP_ADDR 1
+#define RXK_LISTENER_ENV 1
+#define AFS_GCPAGS       2 /* Set to Userdisabled, allow sysctl to override */
+
+#define AFSLITTLE_ENDIAN    1
+#define AFS_HAVE_FFS        1       /* Use system's ffs. */
+#define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+#define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+
+#ifdef KERNEL
+#ifndef MIN
+#define MIN(A,B) ((A) < (B) ? (A) : (B))
+#endif
+#ifndef MAX
+#define MAX(A,B) ((A) > (B) ? (A) : (B))
+#endif
+#endif /* KERNEL */
+
+/* Machine / Operating system information */
+#define SYS_NAME       "i386_umlinux24"
+#define SYS_NAME_ID    SYS_NAME_ID_i386_umlinux24
+
+#endif /* AFS_PARAM_H */
+
+
+
+#else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+ * it's a judgment call. If something is obviously i386 specific, use that
+ * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+ * in the sysname is the current version of the client. This takes into
+ * account the perferred OS user space configuration as well as the kernel.
+ */
+
+#define UKERNEL                        1       /* user space kernel */
+#define AFS_ENV                        1
+#define AFS_USR_LINUX20_ENV    1
+#define AFS_USR_LINUX22_ENV    1
+#define AFS_USR_LINUX24_ENV    1
+#define AFS_NONFSTRANS 1
+
+#define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+#define AFS_SYSCALL 137
+#define AFS_64BIT_IOPS_ENV  1
+#define AFS_NAMEI_ENV     1   /* User space interface to file system */
+#include <afs/afs_sysnames.h>
+
+#define AFS_USERSPACE_IP_ADDR 1
+#define RXK_LISTENER_ENV 1
+#define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+
+
+/* Machine / Operating system information */
+#define SYS_NAME       "i386_umlinux24"
+#define SYS_NAME_ID    SYS_NAME_ID_i386_umlinux24
+#define AFSLITTLE_ENDIAN    1
+#define AFS_HAVE_FFS        1       /* Use system's ffs. */
+#define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+#define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+
+#define        afsio_iov       uio_iov
+#define        afsio_iovcnt    uio_iovcnt
+#define        afsio_offset    uio_offset
+#define        afsio_seg       uio_segflg
+#define        afsio_fmode     uio_fmode
+#define        afsio_resid     uio_resid
+#define        AFS_UIOSYS      1
+#define        AFS_UIOUSER     UIO_USERSPACE
+#define        AFS_CLBYTES     MCLBYTES
+#define        AFS_MINCHANGE   2
+#define        VATTR_NULL      usr_vattr_null
+
+#define AFS_DIRENT
+#ifndef CMSERVERPREF
+#define CMSERVERPREF
+#endif
+
+#endif /* AFS_PARAM_H */
+
+#endif /* !defined(UKERNEL) */
diff --git a/src/config/param.i386_umlinux24_usr.h b/src/config/param.i386_umlinux24_usr.h
new file mode 100644 (file)
index 0000000..5f39e4c
--- /dev/null
@@ -0,0 +1 @@
+#error This file is deprecated, do not use or maintain.
index 1889afe..d6b74c9 100644 (file)
@@ -41,6 +41,10 @@ DEFINES = $(COMMON_DEFINES) -DCPU=586
 CCFLAGS = $(COMMON_KERN_CFLAGS) -mcmodel=kernel
 DEFINES = $(COMMON_DEFINES) 
 
+<i386_umlinux22 i386_umlinux24>
+CCFLAGS = $(COMMON_KERN_CFLAGS) @P5PLUS_KOPTS@ -I/usr/src/linux/arch/um/include -I/usr/src/linux/arch/um/kernel/tt/include -I/usr/src/linux/arch/um/kernel/skas/include
+DEFINES = $(COMMON_DEFINES) -DCPU=586
+
 <alpha_linux_22 alpha_linux_24>
 CCFLAGS = $(COMMON_KERN_CFLAGS) -mno-fp-regs -ffixed-8
 DEFINES = $(COMMON_DEFINES)
@@ -128,6 +132,8 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-alpha asm
 <i386_linux22 i386_linux24>
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-i386 asm
+<i386_umlinux22 i386_umlinux24>
+       ln -fs ${LINUX_KERNEL_PATH}/include/asm-um asm
 <amd64_linux24>
        ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm
 <s390_linux22 s390_linux24>
index 7e14356..7e34540 100644 (file)
@@ -55,7 +55,7 @@ process.o     : process.s process.c
                /usr/bin/cpp -DASSEMBLER -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
                ${AS} -o process.o process.ss; \
                $(RM) process.ss ;; \
-       hp* | *_linux* | sgi_64 | sgi_65 ) \
+       hp* | *_linux* | *_umlinux* | sgi_64 | sgi_65 ) \
                ${CC} ${CFLAGS} -c ${srcdir}/process.c;; \
        ncrx86_*) \
                /usr/ccs/lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s process.ss; \