diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/Config.make.in oracleasm-git/Config.make.in
--- oracleasm-2.0.5/Config.make.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/Config.make.in	2010-10-28 22:42:48.000000000 +0200
@@ -48,12 +48,14 @@ DEFS = @DEFS@
 KERNELDIR = @KERNELDIR@
 KERNELINC = $(KERNELDIR)/include
 KERNELVER = @KERNELVER@
+KERNELARCH = @KERNELARCH@
 BUILD_DRIVER = @BUILD_DRIVER@
 
 else
 
 BACKING_DEV_CAPABILITIES = @BACKING_DEV_CAPABILITIES@
 GET_SB_HAS_VFSMOUNT = @GET_SB_HAS_VFSMOUNT@
-EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
+KAPI_COMPAT_CFLAGS = @KAPI_COMPAT_CFLAGS@
+TRANS_COMPAT_CFLAGS = @TRANS_COMPAT_CFLAGS@
 
 endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/Makefile oracleasm-git/Makefile
--- oracleasm-2.0.5/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -18,10 +18,19 @@ SUBDIRS = include kernel documents vendo
 
 KAPI_COMPAT_FILES =					\
 	kapi-compat/include/bio_end_io.h		\
+	kapi-compat/include/bio_map_user.h		\
+	kapi-compat/include/blk_limits.h		\
+	kapi-compat/include/blk_segments.h		\
+	kapi-compat/include/blkdev_get.h		\
+	kapi-compat/include/blkdev_put.h		\
+	kapi-compat/include/clear_inode.h		\
+	kapi-compat/include/current_creds.h		\
 	kapi-compat/include/i_blksize.h			\
 	kapi-compat/include/i_mutex.h			\
 	kapi-compat/include/i_private.h			\
 	kapi-compat/include/kmem_cache_create.h		\
+	kapi-compat/include/kmem_cache_s.h		\
+	kapi-compat/include/simple_sync_file.h		\
 	kapi-compat/include/slab_ctor_three_arg.h	\
 	kapi-compat/include/slab_ctor_two_arg.h		\
 	kapi-compat/include/slab_ctor_verify.h
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/TODO oracleasm-git/TODO
--- oracleasm-2.0.5/TODO	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/TODO	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1 @@
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/autogen.sh oracleasm-git/autogen.sh
--- oracleasm-2.0.5/autogen.sh	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/autogen.sh	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+rm -rf autom4te.cache
+autoconf
+./configure "$@"
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/configure.in oracleasm-git/configure.in
--- oracleasm-2.0.5/configure.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/configure.in	2010-10-28 22:42:48.000000000 +0200
@@ -17,9 +17,9 @@ AC_SUBST(PACKAGE)
 #
 MAJOR_VERSION=2
 MINOR_VERSION=0
-MICRO_VERSION=5
-INTERFACE_AGE=5
-BINARY_AGE=5
+MICRO_VERSION=6
+INTERFACE_AGE=6
+BINARY_AGE=6
 VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}"
 AC_SUBST(MAJOR_VERSION)
 AC_SUBST(MINOR_VERSION)
@@ -77,6 +77,7 @@ fi
 
 KBUILDINC="$KERNELDIR/include"
 OCFS2_CHECK_KVER($KBUILDINC, kbuildversion, , , :)
+OCFS2_CHECK_KARCH($KBUILDINC, kbuildarch, , , :)
 
 kernelsourcedir=
 AC_MSG_CHECKING(for directory with kernel sources)
@@ -168,21 +169,29 @@ AC_SUBST(BUILD_DRIVER)
 
 KERNELVER=$kversion
 AC_SUBST(KERNELVER)
+KERNELARCH=$kbuildarch
+AC_SUBST(KERNELARCH)
 
 KAPI_COMPAT_CFLAGS=
 BACKING_DEV_CAPABILITIES=
 GET_SB_HAS_VFSMOUNT=
 if test x"$BUILD_DRIVER" = "xyes"; then
+
+  AC_MSG_CHECKING(for kernel include directory)
+
   if test x"$vendordir" = x"$kerneldir" ; then
-      kernelincludes="`vendor/${mb_vendor}/kernel.guess include`"
+      kernelincludes="`vendor/${mb_vendor}/kernel.guess include $kversion`"
   else
       kernelincludes="$KBUILDINC"
-      if test "x$BUILDINC" != "x$KERNELINC"; then
+      if test "x$KBUILDINC" != "x$KERNELINC"; then
           kernelincludes="$kernelincludes $KERNELINC"
       fi
   fi
 
+  AC_MSG_RESULT([$kernelincludes])
+
   KAPI_COMPAT_HEADERS=
+  TRANS_COMPAT_HEADERS=
 
   OCFS2_CHECK_KERNEL_INCLUDES([capabilities mask in backing_dev_info],
     linux/backing-dev.h, $kernelincludes,
@@ -196,16 +205,26 @@ if test x"$BUILD_DRIVER" = "xyes"; then
   OCFS2_CHECK_KERNEL_INCLUDES([for mutex API], linux/fs.h,
     $kernelincludes, , mutex_compat_header="i_mutex.h", [i_mutex])
   KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mutex_compat_header"
+  TRANS_COMPAT_HEADERS="$TRANS_COMPAT_HEADERS $mutex_compat_header"
 
   private_compat_header=
   OCFS2_CHECK_KERNEL_INCLUDES([for i_private], linux/fs.h,
     $kernelincludes, , private_compat_header="i_private.h", [i_private])
   KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $private_compat_header"
+  TRANS_COMPAT_HEADERS="$TRANS_COMPAT_HEADERS $private_compat_header"
+
+  clear_inode_compat_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([for clear_inode], linux/fs.h,
+    $kernelincludes, clear_compat_header="clear_inode.h", ,
+    [void (\*clear_inode) (struct inode \*)])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $clear_compat_header"
+  TRANS_COMPAT_HEADERS="$TRANS_COMPAT_HEADERS $clear_compat_header"
 
   blksize_compat_header=
   OCFS2_CHECK_KERNEL_INCLUDES([for i_blksize], linux/fs.h,
     $kernelincludes, blksize_compat_header="i_blksize.h", , [i_blksize])
   KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blksize_compat_header"
+  TRANS_COMPAT_HEADERS="$TRANS_COMPAT_HEADERS $blksize_compat_header"
 
   bio_end_io_compat_header=
   OCFS2_CHECK_KERNEL_INCLUDES([for three argument bio_end_io], linux/bio.h,
@@ -213,15 +232,57 @@ if test x"$BUILD_DRIVER" = "xyes"; then
     [void bio_endio(struct bio \*, unsigned int, int)])
   KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bio_end_io_compat_header"
 
+  bio_map_user_compat_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([for gfp argument to bio_map_user], linux/bio.h,
+    $kernelincludes, , bio_map_user_compat_header="bio_map_user.h",
+    [^.*unsigned long, unsigned int, int, gfp_t)])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bio_map_user_compat_header"
+
+  kmem_cache_s_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([struct kmem_cache_s], linux/slab.h,
+    $kernelincludes, kmem_cache_s_header="kmem_cache_s.h", ,
+    [struct kmem_cache_s])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmem_cache_s_header"
+
   kmem_cache_create_header=
   OCFS2_CHECK_KERNEL_INCLUDES([kmem_cache_create() with dtor arg in slab.h],
     linux/slab.h, $kernelincludes, kmem_cache_create_header="kmem_cache_create.h", ,
     [^.*void (\*)(void \*, .*kmem_cache.* \*, unsigned long),])
   KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmem_cache_create_header"
 
+  blkdev_get_compat_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([for three argument blkdev_get], linux/fs.h,
+    $kernelincludes, blkdev_get_compat_header="blkdev_get.h", ,
+    [extern int blkdev_get(struct block_device \*, f\?mode_t, unsigned)])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_get_compat_header"
+ 
+  blkdev_put_compat_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([for one argument blkdev_put], linux/fs.h,
+    $kernelincludes, blkdev_put_compat_header="blkdev_put.h", ,
+    [extern int blkdev_put(struct block_device \*)])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_put_compat_header"
+
+  blk_limits_compat_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([for old block limits], linux/blkdev.h,
+    $kernelincludes, blk_limits_compat_header="blk_limits.h", ,
+    [extern void blk_queue_hardsect_size])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blk_limits_compat_header"
+
+  blk_segments_compat_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([for old block segments], linux/blkdev.h,
+    $kernelincludes, blk_segments_compat_header="blk_segments.h", ,
+    [extern void blk_queue_max_hw_segments])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blk_segments_compat_header"
+
+  simple_sync_file_compat_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([for simple_sync_file], linux/fs.h,
+    $kernelincludes, simple_sync_file_compat_header="simple_sync_file.h", ,
+    [extern int simple_sync_file])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $simple_sync_file_compat_header"
+
   slab_ctor_header=
   OCFS2_CHECK_KERNEL_INCLUDES([SLAB_CTOR_VERIFY in slab.h], linux/slab.h,
-    $kernel_includes, slab_ctor_headre=slab_ctor_verify.h, ,
+    $kernelincludes, slab_ctor_header=slab_ctor_verify.h, ,
     [SLAB_CTOR_VERIFY])
 
   if test "x$slab_ctor_header" = "x"; then
@@ -244,24 +305,30 @@ if test x"$BUILD_DRIVER" = "xyes"; then
 
   KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $slab_ctor_header"
 
+  current_creds_header=
+  OCFS2_CHECK_KERNEL_INCLUDES([current_fs?id() in cred.h], linux/cred.h,
+    $kernelincludes, , current_creds_header=current_creds.h,
+    [#define current_fsuid(])
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $current_creds_header"
+  TRANS_COMPAT_HEADERS="$TRANS_COMPAT_HEADERS $current_creds_header"
+
   # using -include has two advantages:
   #  the source doesn't need to know to include compat headers
   #  the compat header file names don't go through the search path
   for h in $KAPI_COMPAT_HEADERS; do
     KAPI_COMPAT_CFLAGS="$KAPI_COMPAT_CFLAGS -include \$(OUR_TOPDIR)/kapi-compat/include/$h"
   done
+
+  for h in $TRANS_COMPAT_HEADERS; do
+    TRANS_COMPAT_CFLAGS="$TRANS_COMPAT_CFLAGS -include \$(OUR_TOPDIR)/kapi-compat/include/$h"
+  done
 fi
 AC_SUBST(KAPI_COMPAT_CFLAGS)
+AC_SUBST(TRANS_COMPAT_CFLAGS)
 AC_SUBST(BACKING_DEV_CAPABILITIES)
 AC_SUBST(GET_SB_HAS_VFSMOUNT)
 
 
 AC_OUTPUT([Config.make
 include/linux/oracleasm/module_version.h
-vendor/sles9/oracleasm.spec-generic
-vendor/rhel4/oracleasm.spec-generic
-vendor/fc6/oracleasm.spec-generic
-vendor/sles10/oracleasm.spec-generic
-vendor/rhel5/oracleasm.spec-generic
-vendor/common/oracleasm-headers.spec-generic
 ])
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/include/linux/oracleasm/compat32.h oracleasm-git/include/linux/oracleasm/compat32.h
--- oracleasm-2.0.5/include/linux/oracleasm/compat32.h	2008-09-10 19:32:45.000000000 +0200
+++ oracleasm-git/include/linux/oracleasm/compat32.h	2010-10-28 22:42:48.000000000 +0200
@@ -70,6 +70,8 @@
 #ifndef _ORACLEASM_COMPAT32_H
 #define _ORACLEASM_COMPAT32_H
 
+#include <linux/version.h>
+
 /*
  * This is ugly.  SIZEOF_UNSIGNED_LONG comes from autoconf.
  * Do you have a better way?  I chose not to hand-cook an autoconf
@@ -93,7 +95,7 @@
 #define HIGH_UB4(_ub8)          ((unsigned long)(((_ub8) >> 32) & 0xFFFFFFFFULL))
 #define LOW_UB4(_ub8)           ((unsigned long)((_ub8) & 0xFFFFFFFFULL))
 
-#if defined(CONFIG_COMPAT)
+#if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 # include <linux/ioctl32.h>
 #endif
 
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/include/linux/oracleasm/disk.h oracleasm-git/include/linux/oracleasm/disk.h
--- oracleasm-2.0.5/include/linux/oracleasm/disk.h	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/include/linux/oracleasm/disk.h	2010-10-28 22:42:48.000000000 +0200
@@ -112,7 +112,8 @@ static inline int asmdisk_toupper(unsign
 		if (glob &&
 		    ((c == '*') || (c == '?') ||
 		     (c == '[') || (c == ']') ||
-		     (c == '\\') || (c == '-')))
+		     (c == '\\') || (c == '-') ||
+		     (c == '!')))
 			continue;
 		if (c < '0')
 			return c;
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/include/linux/oracleasm/module_version.h oracleasm-git/include/linux/oracleasm/module_version.h
--- oracleasm-2.0.5/include/linux/oracleasm/module_version.h	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/include/linux/oracleasm/module_version.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-/*
- * NAME
- *	version.h - Hack to make MODULE_VERSION work.
- *
- * AUTHOR
- * 	Joel Becker <joel.becker@oracle.com>
- *
- * Copyright (c) 2004 Oracle Corporation.  All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License, version 2 as published by the Free Software Foundation.
- * 
- * This library 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
- * General Public License for more details.
- * 
- * You should have recieved a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef _ASM_MODULE_VERSION_H
-#define _ASM_MODULE_VERSION_H
-
-#define ASM_MODULE_VERSION "2.0.5"
-
-#endif  /* _ASM_MODULE_VERSION */
-
-
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/bio_map_user.h oracleasm-git/kapi-compat/include/bio_map_user.h
--- oracleasm-2.0.5/kapi-compat/include/bio_map_user.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/bio_map_user.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,6 @@
+#ifndef KAPI_BIO_MAP_USER_H
+#define KAPI_BIO_MAP_USER_H
+
+#define kapi_asm_bio_map_user(a, b, c, d, e, f)         bio_map_user(a, b, c, d, e)
+
+#endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/blk_limits.h oracleasm-git/kapi-compat/include/blk_limits.h
--- oracleasm-2.0.5/kapi-compat/include/blk_limits.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/blk_limits.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,9 @@
+#ifndef KAPI_BLK_LIMITS_H
+#define KAPI_BLK_LIMITS_H
+
+#define queue_max_sectors(a)		((a)->max_sectors)
+#define queue_max_phys_segments(a)	((a)->max_phys_segments)
+#define queue_max_hw_segments(a)	((a)->max_hw_segments)
+#define bdev_physical_block_size(a)	bdev_hardsect_size(a)
+
+#endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/blk_segments.h oracleasm-git/kapi-compat/include/blk_segments.h
--- oracleasm-2.0.5/kapi-compat/include/blk_segments.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/blk_segments.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,6 @@
+#ifndef KAPI_BLK_SEGMENTS_H
+#define KAPI_BLK_SEGMENTS_H
+
+#define queue_max_segments(a)	min(queue_max_hw_segments(a), queue_max_phys_segments(a))
+
+#endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/blkdev_get.h oracleasm-git/kapi-compat/include/blkdev_get.h
--- oracleasm-2.0.5/kapi-compat/include/blkdev_get.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/blkdev_get.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,6 @@
+#ifndef KAPI_BLKDEV_GET_H
+#define KAPI_BLKDEV_GET_H
+
+#define kapi_asm_blkdev_get(a, b)	blkdev_get(a, b, 0)
+
+#endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/blkdev_put.h oracleasm-git/kapi-compat/include/blkdev_put.h
--- oracleasm-2.0.5/kapi-compat/include/blkdev_put.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/blkdev_put.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,6 @@
+#ifndef KAPI_BLKDEV_PUT_H
+#define KAPI_BLKDEV_PUT_H
+
+#define kapi_asm_blkdev_put(a, b)	blkdev_put(a)
+
+#endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/clear_inode.h oracleasm-git/kapi-compat/include/clear_inode.h
--- oracleasm-2.0.5/kapi-compat/include/clear_inode.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/clear_inode.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,7 @@
+#ifndef KAPI_CLEAR_INODE_H
+#define KAPI_CLEAR_INODE_H
+
+#define evict_inode		clear_inode
+#define end_writeback(a)	do {} while(0);
+
+#endif /* KAPI_CLEAR_INODE_H */
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/current_creds.h oracleasm-git/kapi-compat/include/current_creds.h
--- oracleasm-2.0.5/kapi-compat/include/current_creds.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/current_creds.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,7 @@
+#ifndef KAPI_CURRENT_CREDS_H
+#define KAPI_CURRENT_CREDS_H
+
+#define current_fsuid()         (current->fsuid)
+#define current_fsgid()         (current->fsgid)
+
+#endif /* KAPI_CURRENT_CREDS_H */
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/kmem_cache_s.h oracleasm-git/kapi-compat/include/kmem_cache_s.h
--- oracleasm-2.0.5/kapi-compat/include/kmem_cache_s.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/kmem_cache_s.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,6 @@
+#ifndef KAPI_KMEM_CACHE_S_H
+#define KAPI_KMEM_CACHE_S_H
+
+#define kmem_cache kmem_cache_s
+
+#endif /* KAPI_KMEM_CACHE_S_H */
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kapi-compat/include/simple_sync_file.h oracleasm-git/kapi-compat/include/simple_sync_file.h
--- oracleasm-2.0.5/kapi-compat/include/simple_sync_file.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kapi-compat/include/simple_sync_file.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,6 @@
+#ifndef KAPI_SIMPLE_SYNC_FILE_H
+#define KAPI_SIMPLE_SYNC_FILE_H
+
+#define noop_fsync	simple_sync_file
+
+#endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kernel/Makefile oracleasm-git/kernel/Makefile
--- oracleasm-2.0.5/kernel/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/kernel/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -13,8 +13,8 @@ include $(ORACLEASM_SRC_DIR)/../Config.m
 endif
 
 
-UNINST_HEADERS = transaction_file.h proc.h masklog.h
-SOURCES = oracleasm.c transaction_file.c proc.c masklog.c
+UNINST_HEADERS = transaction_file.h proc.h masklog.h compat.h
+SOURCES = driver.c transaction_file.c proc.c masklog.c
 OBJECTS = $(subst .c,.o,$(SOURCES))
 
 ifeq ($(KERNELRELEASE),)
@@ -59,7 +59,10 @@ ifdef GET_SB_HAS_VFSMOUNT
 EXTRA_CFLAGS += -DGET_SB_HAS_VFSMOUNT
 endif
 
-obj-m += oracleasm.o
-#oracleasm-objs := $(OBJECTS)
+CFLAGS_driver.o = $(KAPI_COMPAT_CFLAGS)
+CFLAGS_transaction_file.o = $(TRANS_COMPAT_CFLAGS)
+
+obj-m := oracleasm.o
+oracleasm-objs := $(OBJECTS)
 
 endif
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kernel/compat.h oracleasm-git/kernel/compat.h
--- oracleasm-2.0.5/kernel/compat.h	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kernel/compat.h	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,21 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * compat.h
+ *
+ * Copyright (c) 2004-2009 Oracle Corporation.  All rights reserved.
+ */
+
+
+#ifndef _COMPAT_H
+#define _COMPAT_H
+
+/*
+ * Modern kernels don't need this.  Older kernels will have it defined
+ * by the compat code.
+ */
+#ifndef set_i_blksize
+# define set_i_blksize(i, bs) do { /* Nothing */ } while (0)
+#endif
+
+#endif  /* _COMPAT_H */
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kernel/driver.c oracleasm-git/kernel/driver.c
--- oracleasm-2.0.5/kernel/driver.c	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kernel/driver.c	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,2984 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * NAME
+ *	oracleasm.c - ASM library kernel driver.
+ *
+ * AUTHOR
+ * 	Joel Becker <joel.becker@oracle.com>
+ *
+ * DESCRIPTION
+ *      This file contains the kernel driver of the Oracle Automatic
+ *      Storage Managment userspace library.  It provides the routines
+ *      required to support the userspace library.
+ *
+ * MODIFIED   (YYYY/MM/DD)
+ *      2004/01/02 - Joel Becker <joel.becker@oracle.com>
+ *		Initial GPL header.
+ *      2004/09/10 - Joel Becker <joel.becker@oracle.com>
+ *      	First port to 2.6.
+ *      2004/12/16 - Joel Becker <joel.becker@oracle.com>
+ *      	Change from ioctl to transaction files.
+ *
+ * Copyright (c) 2002-2004 Oracle Corporation.  All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License, version 2 as published by the Free Software Foundation.
+ * 
+ * This library 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
+ * General Public License for more details.
+ * 
+ * You should have recieved a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+/*
+ * This driver's filesystem code is based on the ramfs filesystem.
+ * Copyright information for the original source appears below.
+ */
+
+/* Simple VFS hooks based on: */
+/*
+ * Resizable simple ram filesystem for Linux.
+ *
+ * Copyright (C) 2000 Linus Torvalds.
+ *		 2000 Transmeta Corp.
+ *
+ * Usage limits added by David Gibson, Linuxcare Australia.
+ * This file is released under the GPL.
+ */
+
+
+#include <linux/fs.h>
+#include <linux/file.h>
+#include <linux/module.h>
+#include <linux/pagemap.h>
+#include <linux/init.h>
+#include <linux/string.h>
+#include <linux/highmem.h>
+#include <linux/slab.h>
+#include <linux/blkdev.h>
+#include <linux/mount.h>
+#include <linux/smp_lock.h>
+#include <linux/parser.h>
+#include <linux/backing-dev.h>
+#include <linux/compat.h>
+
+#include <asm/uaccess.h>
+#include <linux/spinlock.h>
+
+#include "linux/oracleasm/compat32.h"
+#include "linux/oracleasm/kernel.h"
+#include "linux/oracleasm/abi.h"
+#include "linux/oracleasm/disk.h"
+#include "linux/oracleasm/manager.h"
+#include "linux/oracleasm/error.h"
+
+#include "linux/oracleasm/module_version.h"
+
+#include "compat.h"
+#include "masklog.h"
+#include "proc.h"
+#include "transaction_file.h"
+
+#if PAGE_CACHE_SIZE % 1024
+#error Oh no, PAGE_CACHE_SIZE is not divisible by 1k! I cannot cope.
+#endif  /* PAGE_CACHE_SIZE % 1024 */
+
+
+
+/*
+ * Compat32
+ */
+#define ASM_BPL_32		32
+#if BITS_PER_LONG == 32
+# define asm_submit_io_32	asm_submit_io_native
+# define asm_maybe_wait_io_32	asm_maybe_wait_io_native
+# define asm_complete_ios_32	asm_complete_ios_native
+#else
+# if BITS_PER_LONG == 64
+#  define ASM_BPL_64		64
+#  define asm_submit_io_32	asm_submit_io_thunk
+#  define asm_submit_io_64	asm_submit_io_native
+#  define asm_maybe_wait_io_32	asm_maybe_wait_io_thunk
+#  define asm_maybe_wait_io_64	asm_maybe_wait_io_native
+#  define asm_complete_ios_32	asm_complete_ios_thunk
+#  define asm_complete_ios_64	asm_complete_ios_native
+# endif  /* BITS_PER_LONG == 64 */
+#endif  /* BITS_PER_LONG == 32 */
+
+
+static struct super_operations asmfs_ops;
+static struct file_operations asmfs_dir_operations;
+static struct file_operations asmfs_file_operations;
+static struct inode_operations asmfs_file_inode_operations;
+static struct inode_operations asmfs_disk_dir_inode_operations;
+static struct inode_operations asmfs_iid_dir_inode_operations;
+
+static struct kmem_cache	*asm_request_cachep;
+static struct kmem_cache	*asmfs_inode_cachep;
+static struct kmem_cache	*asmdisk_cachep;
+#ifndef kapi_kmem_cache_create
+# define kapi_kmem_cache_create kmem_cache_create
+#endif
+
+/*
+ * asmfs super-block data in memory
+ */
+struct asmfs_sb_info {
+	struct super_block *asmfs_super;
+	/* Prevent races accessing the used block
+	 * counts. Conceptually, this could probably be a semaphore,
+	 * but the only thing we do while holding the lock is
+	 * arithmetic, so there's no point */
+	spinlock_t asmfs_lock;
+
+	/* It is important that at least the free counts below be
+	   signed.  free_XXX may become negative if a limit is changed
+	   downwards (by a remount) below the current usage. */	  
+
+	/* max number of inodes - controls # of instances */
+	long max_inodes;
+	/* free_inodes = max_inodes - total number of inodes currently in use */
+	long free_inodes;
+
+	unsigned long next_iid;
+};
+
+#define ASMFS_SB(sb) ((struct asmfs_sb_info *)((sb)->s_fs_info))
+
+
+struct asmfs_file_info {
+	struct file *f_file;
+	spinlock_t f_lock;		/* Lock on the structure */
+	wait_queue_head_t f_wait;	/* Folks waiting on I/O */
+	struct list_head f_ctx;		/* Hook into the i_threads list */
+	struct list_head f_ios;		/* Outstanding I/Os for this thread */
+	struct list_head f_complete;	/* Completed I/Os for this thread */
+	struct list_head f_disks;	/* List of disks opened */
+	struct bio *f_bio_free;		/* bios to free */
+};
+
+#define ASMFS_FILE(_f) ((struct asmfs_file_info *)((_f)->private_data))
+
+
+/*
+ * asmfs inode data in memory
+ *
+ * Note that 'thread' here can mean 'process' too :-)
+ */
+struct asmfs_inode_info {
+	spinlock_t i_lock;		/* lock on the asmfs_inode_info structure */
+	struct list_head i_disks;	/* List of disk handles */
+	struct list_head i_threads;	/* list of context structures for each calling thread */
+	struct inode vfs_inode;
+};
+
+static inline struct asmfs_inode_info *ASMFS_I(struct inode *inode)
+{
+	return container_of(inode, struct asmfs_inode_info, vfs_inode);
+}
+
+static inline struct inode *ASMFS_F2I(struct file *file)
+{
+	return file->f_dentry->d_inode;
+}
+
+/*
+ * asm disk info
+ */
+struct asm_disk_info {
+	struct asmfs_inode_info *d_inode;
+	struct block_device *d_bdev;	/* Block device we I/O to */
+	int d_max_sectors;		/* Maximum sectors per I/O */
+	int d_live;			/* Is the disk alive? */
+	atomic_t d_ios;			/* Count of in-flight I/Os */
+	struct list_head d_open;	/* List of assocated asm_disk_heads */
+	struct inode vfs_inode;
+};
+
+/* Argument to iget5_locked()/ilookup5() to map bdev to disk_inode */
+struct asmdisk_find_inode_args {
+	unsigned long fa_handle;
+	struct asmfs_inode_info *fa_inode;
+};
+
+static inline struct asm_disk_info *ASMDISK_I(struct inode *inode)
+{
+	return container_of(inode, struct asm_disk_info, vfs_inode);
+}
+
+
+/*
+ * asm disk info lists
+ *
+ * Each file_info struct has a list of disks it has opened.  As this
+ * is an M->N mapping, an intermediary structure is needed
+ */
+struct asm_disk_head {
+	struct asm_disk_info *h_disk;	/* Pointer to associated disk */
+	struct asmfs_file_info *h_file;	/* Pointer to owning file */
+	struct list_head h_flist;	/* Hook into file's list */
+	struct list_head h_dlist;	/* Hook into disk's list */
+};
+
+
+/* ASM I/O requests */
+struct asm_request {
+	struct list_head r_list;
+	struct asmfs_file_info *r_file;
+	struct asm_disk_info *r_disk;
+	asm_ioc *r_ioc;				/* User asm_ioc */
+	u16 r_status;				/* status_asm_ioc */
+	int r_error;
+	unsigned long r_elapsed;		/* Start time while in-flight, elapsted time once complete */
+	struct bio *r_bio;			/* The I/O */
+	size_t r_count;				/* Total bytes */
+	atomic_t r_bio_count;			/* Atomic count */
+};
+
+
+/*
+ * Transaction file contexts.
+ */
+static ssize_t asmfs_svc_query_version(struct file *file, char *buf, size_t size);
+static ssize_t asmfs_svc_get_iid(struct file *file, char *buf, size_t size);
+static ssize_t asmfs_svc_check_iid(struct file *file, char *buf, size_t size);
+static ssize_t asmfs_svc_query_disk(struct file *file, char *buf, size_t size);
+static ssize_t asmfs_svc_open_disk(struct file *file, char *buf, size_t size);
+static ssize_t asmfs_svc_close_disk(struct file *file, char *buf, size_t size);
+static ssize_t asmfs_svc_io32(struct file *file, char *buf, size_t size);
+#if BITS_PER_LONG == 64
+static ssize_t asmfs_svc_io64(struct file *file, char *buf, size_t size);
+#endif
+
+static struct transaction_context trans_contexts[] = {
+	[ASMOP_QUERY_VERSION]		= {asmfs_svc_query_version},
+	[ASMOP_GET_IID]			= {asmfs_svc_get_iid},
+	[ASMOP_CHECK_IID]		= {asmfs_svc_check_iid},
+	[ASMOP_QUERY_DISK]		= {asmfs_svc_query_disk},
+	[ASMOP_OPEN_DISK]		= {asmfs_svc_open_disk},
+	[ASMOP_CLOSE_DISK]		= {asmfs_svc_close_disk},
+	[ASMOP_IO32]			= {asmfs_svc_io32},
+#if BITS_PER_LONG == 64
+	[ASMOP_IO64]			= {asmfs_svc_io64},
+#endif
+};
+
+static struct backing_dev_info memory_backing_dev_info = {
+	.ra_pages	= 0,	/* No readahead */
+#ifdef BACKING_DEV_CAPABILITIES
+	.capabilities   = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
+#else
+	.memory_backed	= 1,	/* Does not contribute to dirty memory */
+#endif  /* OLD_BACKING_DEV */
+};
+
+
+static struct inode *asmdisk_alloc_inode(struct super_block *sb)
+{
+	struct asm_disk_info *d = kmem_cache_alloc(asmdisk_cachep, GFP_KERNEL);
+	if (!d)
+		return NULL;
+
+	mlog(ML_DISK, "Allocated disk 0x%p\n", d);
+	return &d->vfs_inode;
+}
+
+static void asmdisk_destroy_inode(struct inode *inode)
+{
+	struct asm_disk_info *d = ASMDISK_I(inode);
+
+	mlog_bug_on_msg(atomic_read(&d->d_ios),
+			"Disk 0x%p has outstanding I/Os\n", d);
+
+	mlog_bug_on_msg(!list_empty(&d->d_open),
+			"Disk 0x%p has openers\n", d);
+
+	mlog(ML_DISK, "Destroying disk 0x%p\n", d);
+
+	kmem_cache_free(asmdisk_cachep, d);
+}
+
+static void init_asmdisk_once(void *foo)
+{
+	struct asm_disk_info *d = foo;
+
+	memset(d, 0, sizeof(*d));
+	INIT_LIST_HEAD(&d->d_open);
+
+	inode_init_once(&d->vfs_inode);
+}
+#ifndef kapi_init_asmdisk_once
+# define kapi_init_asmdisk_once init_asmdisk_once
+#endif
+#ifndef kapi_asm_blkdev_get
+# define kapi_asm_blkdev_get blkdev_get
+#endif
+#ifndef kapi_asm_blkdev_put
+# define kapi_asm_blkdev_put blkdev_put
+#endif
+
+static void asmdisk_evict_inode(struct inode *inode)
+{
+	struct asm_disk_info *d = ASMDISK_I(inode);
+
+	mlog_entry("(0x%p)\n", inode);
+
+	end_writeback(inode);
+
+	mlog_bug_on_msg(atomic_read(&d->d_ios),
+			"Disk 0x%p has outstanding I/Os\n", d);
+
+	mlog_bug_on_msg(!list_empty(&d->d_open),
+			"Disk 0x%p has openers\n", d);
+
+	mlog_bug_on_msg(d->d_live,
+			"Disk 0x%p is live\n", d);
+
+	mlog(ML_DISK, "Clearing disk 0x%p\n", d);
+
+	if (d->d_bdev) {
+		mlog(ML_DISK,
+		     "Releasing disk 0x%p (bdev 0x%p, dev %X)\n",
+		     d, d->d_bdev, d->d_bdev->bd_dev);
+		bd_release(d->d_bdev);
+		kapi_asm_blkdev_put(d->d_bdev, FMODE_WRITE | FMODE_READ);
+		d->d_bdev = NULL;
+	}
+
+	mlog_exit_void();
+}
+
+
+static struct super_operations asmdisk_sops = {
+	.statfs			= simple_statfs,
+	.alloc_inode		= asmdisk_alloc_inode,
+	.destroy_inode		= asmdisk_destroy_inode,
+	.drop_inode		= generic_delete_inode,
+	.evict_inode		= asmdisk_evict_inode,
+};
+
+#ifdef GET_SB_HAS_VFSMOUNT
+static int asmdisk_get_sb(struct file_system_type *fs_type, int flags,
+			  const char *dev_name, void *data,
+			  struct vfsmount *mnt)
+{
+	return get_sb_pseudo(fs_type, "asmdisk:",
+			     &asmdisk_sops, 0x61736D64, mnt);
+}
+#else
+static struct super_block *asmdisk_get_sb(struct file_system_type *fs_type,
+					  int flags,
+					  const char *dev_name,
+					  void *data)
+{
+	return get_sb_pseudo(fs_type, "asmdisk:",
+			     &asmdisk_sops, 0x61736D64);
+}
+#endif
+
+static struct file_system_type asmdisk_type = {
+	.name		= "asmdisk",
+	.get_sb		= asmdisk_get_sb,
+	.kill_sb	= kill_anon_super,
+};
+
+static struct vfsmount *asmdisk_mnt;
+
+static int __init init_asmdiskcache(void)
+{
+	int err;
+	asmdisk_cachep =
+		kapi_kmem_cache_create("asmdisk_cache",
+				       sizeof(struct asm_disk_info),
+				       0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+				       kapi_init_asmdisk_once);
+	if (!asmdisk_cachep)
+		return -ENOMEM;
+	err = register_filesystem(&asmdisk_type);
+	if (err) {
+		kmem_cache_destroy(asmdisk_cachep);
+		return err;
+	}
+	asmdisk_mnt = kern_mount(&asmdisk_type);
+	if (IS_ERR(asmdisk_mnt)) {
+		err = PTR_ERR(asmdisk_mnt);
+		unregister_filesystem(&asmdisk_type);
+		kmem_cache_destroy(asmdisk_cachep);
+		return err;
+	}
+
+	return 0;
+}
+
+static void destroy_asmdiskcache(void)
+{
+	unregister_filesystem(&asmdisk_type);
+	mntput(asmdisk_mnt);
+	kmem_cache_destroy(asmdisk_cachep);
+}
+
+static int asmdisk_test(struct inode *inode, void *data)
+{
+	struct asmdisk_find_inode_args *args = data;
+	struct asm_disk_info *d = ASMDISK_I(inode);
+	unsigned long handle = (unsigned long)(d->d_bdev);
+
+	return (d->d_inode == args->fa_inode) && (handle == args->fa_handle);
+}
+
+static int asmdisk_set(struct inode *inode, void *data)
+{
+	struct asmdisk_find_inode_args *args = data;
+	struct asm_disk_info *d = ASMDISK_I(inode);
+
+	d->d_bdev = (struct block_device *)(args->fa_handle);
+	d->d_inode = args->fa_inode;
+
+	return 0;
+}
+
+
+
+/*
+ * Resource limit helper functions
+ */
+
+
+/* Decrements the free inode count and returns true, or returns false
+ * if there are no free inodes */
+static struct inode *asmfs_alloc_inode(struct super_block *sb)
+{
+	struct asmfs_sb_info *asb = ASMFS_SB(sb);
+	struct asmfs_inode_info *aii;
+
+	aii = (struct asmfs_inode_info *)kmem_cache_alloc(asmfs_inode_cachep, GFP_KERNEL);
+
+	if (!aii)
+		return NULL;
+
+	spin_lock_irq(&asb->asmfs_lock);
+	if (!asb->max_inodes || asb->free_inodes > 0) {
+		asb->free_inodes--;
+		spin_unlock_irq(&asb->asmfs_lock);
+	} else {
+		spin_unlock_irq(&asb->asmfs_lock);
+		kmem_cache_free(asmfs_inode_cachep, aii);
+		return NULL;
+	}
+
+	return &aii->vfs_inode;
+}
+
+/* Increments the free inode count */
+static void asmfs_destroy_inode(struct inode *inode)
+{
+	spin_lock_irq(&ASMFS_SB(inode->i_sb)->asmfs_lock);
+	ASMFS_SB(inode->i_sb)->free_inodes++;
+	spin_unlock_irq(&ASMFS_SB(inode->i_sb)->asmfs_lock);
+
+	kmem_cache_free(asmfs_inode_cachep, ASMFS_I(inode));
+}
+
+static void instance_init_once(void *foo)
+{
+	struct asmfs_inode_info *aii = foo;
+
+	INIT_LIST_HEAD(&aii->i_disks);
+	INIT_LIST_HEAD(&aii->i_threads);
+	spin_lock_init(&aii->i_lock);
+
+	inode_init_once(&aii->vfs_inode);
+}
+#ifndef kapi_instance_init_once
+# define kapi_instance_init_once instance_init_once
+#endif
+
+static int init_inodecache(void)
+{
+	asmfs_inode_cachep =
+		kapi_kmem_cache_create("asmfs_inode_cache",
+				       sizeof(struct asmfs_inode_info),
+				       0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+				       kapi_instance_init_once);
+
+	if (asmfs_inode_cachep == NULL)
+		return -ENOMEM;
+	return 0;
+}
+
+static void destroy_inodecache(void)
+{
+	kmem_cache_destroy(asmfs_inode_cachep);
+}
+
+static int init_requestcache(void)
+{
+	asm_request_cachep =
+		kapi_kmem_cache_create("asm_request",
+				       sizeof(struct asm_request),
+				       0, SLAB_HWCACHE_ALIGN, NULL);
+	if (asm_request_cachep == NULL)
+		return -ENOMEM;
+	return 0;
+}
+
+static void destroy_requestcache(void)
+{
+	kmem_cache_destroy(asm_request_cachep);
+}
+
+
+/*
+ * Disk file creation in the disks directory.
+ */
+static int asmfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
+{
+	struct inode * inode;
+
+	if (!S_ISBLK(mode))
+		return -EINVAL;
+
+	inode = new_inode(dir->i_sb);
+	if (!inode)
+		return -ENOMEM;
+
+	inode->i_ino = (unsigned long)inode;
+	inode->i_mode = mode;
+	inode->i_uid = current_fsuid();
+	inode->i_gid = current_fsgid();
+	set_i_blksize(inode, PAGE_CACHE_SIZE);
+	inode->i_blocks = 0;
+	inode->i_rdev = 0;
+	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	init_special_inode(inode, mode, dev);
+
+	d_instantiate(dentry, inode);
+
+	/* Extra count - pin the dentry in core */
+	dget(dentry);
+
+	return 0;
+}
+
+/*
+ * Instance file creation in the iid directory.
+ */
+static int asmfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
+{
+	struct inode *inode;
+
+	if ((mode & S_IFMT) && !S_ISREG(mode))
+		return -EINVAL;
+
+	mode |= S_IFREG;
+
+	inode = new_inode(dir->i_sb);
+	if (!inode)
+		return -ENOMEM;
+
+	inode->i_ino = (unsigned long)inode;
+	inode->i_mode = mode;
+	inode->i_uid = current_fsuid();
+	inode->i_gid = current_fsgid();
+	set_i_blksize(inode, PAGE_CACHE_SIZE);
+	inode->i_blocks = 0;
+	inode->i_rdev = 0;
+	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	inode->i_op = &asmfs_file_inode_operations;
+	inode->i_fop = &asmfs_file_operations;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+
+	d_instantiate(dentry, inode);
+
+	/* Extra count - pin the dentry in core */
+	dget(dentry);
+
+	return 0;
+}
+
+static void asmfs_put_super(struct super_block *sb)
+{
+	kfree(ASMFS_SB(sb));
+}
+
+enum {
+	OPT_MAX_INSTANCES,
+	OPT_ERR,
+};
+
+static match_table_t tokens = {
+	{OPT_MAX_INSTANCES, "maxinstances=%d"},
+	{OPT_ERR, NULL},
+};
+
+struct asmfs_params {
+	long inodes;
+};
+
+static int parse_options(char * options, struct asmfs_params *p)
+{
+	char *s;
+	substring_t args[MAX_OPT_ARGS];
+	int option;
+
+	p->inodes = -1;
+
+	while ((s = strsep(&options,",")) != NULL) {
+		int token;
+		if (!*s)
+			continue;
+		token = match_token(s, tokens, args);
+		switch (token) {
+			case OPT_MAX_INSTANCES:
+				if (match_int(&args[0], &option))
+					return -EINVAL;
+				p->inodes = option;
+				break;
+
+			default:
+				return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
+static void init_limits(struct asmfs_sb_info *asb, struct asmfs_params *p)
+{
+	struct sysinfo si;
+
+	si_meminfo(&si);
+
+	asb->max_inodes = 0;
+	if (p->inodes >= 0)
+		asb->max_inodes = p->inodes;
+
+	asb->free_inodes = asb->max_inodes;
+
+	return;
+}
+
+/* reset_limits is called during a remount to change the usage limits.
+
+   This will suceed, even if the new limits are lower than current
+   usage. This is the intended behaviour - new allocations will fail
+   until usage falls below the new limit */
+static void reset_limits(struct asmfs_sb_info *asb, struct asmfs_params *p)
+{
+	spin_lock_irq(&asb->asmfs_lock);
+
+	if (p->inodes >= 0) {
+		int used_inodes = asb->max_inodes - asb->free_inodes;
+
+		asb->max_inodes = p->inodes;
+		asb->free_inodes = asb->max_inodes - used_inodes;
+	}
+
+	spin_unlock_irq(&asb->asmfs_lock);
+}
+
+static int asmfs_remount(struct super_block * sb, int * flags, char * data)
+{
+	struct asmfs_params params;
+	struct asmfs_sb_info * asb = ASMFS_SB(sb);
+
+	if (parse_options((char *)data, &params) != 0)
+		return -EINVAL;
+
+	reset_limits(asb, &params);
+
+	printk(KERN_DEBUG
+ 	       "ASM: oracleasmfs remounted with options: %s\n", 
+	       data ? (char *)data : "<defaults>" );
+	printk(KERN_DEBUG "ASM:	maxinstances=%ld\n",
+	       asb->max_inodes);
+
+	return 0;
+}
+
+/*
+ * Compute the maximum number of sectors the bdev can handle in one bio,
+ * as a power of two.
+ */
+static int compute_max_sectors(struct block_device *bdev)
+{
+	int max_pages, max_sectors, pow_two_sectors;
+	char b[BDEVNAME_SIZE];
+
+	struct request_queue *q;
+
+	q = bdev_get_queue(bdev);
+	mlog(ML_DISK, "Computing limits for block device \%s\":\n",
+	     bdevname(bdev, b));
+	mlog(ML_DISK,
+	     "\tq->max_sectors = %u, q->max_segments = %u\n",
+	     queue_max_sectors(q), queue_max_segments(q));
+	max_pages = queue_max_sectors(q) >> (PAGE_SHIFT - 9);
+	mlog(ML_DISK, "\tmax_pages = %d, BIO_MAX_PAGES = %d\n",
+	     max_pages, BIO_MAX_PAGES);
+	if (max_pages > BIO_MAX_PAGES)
+		max_pages = BIO_MAX_PAGES;
+	if (max_pages > queue_max_segments(q))
+		max_pages = queue_max_segments(q);
+	max_pages--; /* Handle I/Os that straddle a page */
+	max_sectors = max_pages << (PAGE_SHIFT - 9);
+
+	/* Why is fls() 1-based???? */
+	pow_two_sectors = 1 << (fls(max_sectors) - 1);
+	mlog(ML_DISK,
+	     "\tresulting max_pages = %d, max_sectors = %d, "
+	     "pow_two_sectors = %d\n",
+	     max_pages, max_sectors, pow_two_sectors);
+
+	return pow_two_sectors;
+}
+
+static int asm_open_disk(struct file *file, struct block_device *bdev)
+{
+	int ret;
+	struct asm_disk_info *d;
+	struct asm_disk_head *h;
+	struct inode *inode = ASMFS_F2I(file);
+	struct inode *disk_inode;
+	struct asmdisk_find_inode_args args;
+
+	mlog_entry("(0x%p, 0x%p)\n", file, bdev);
+
+	ret = kapi_asm_blkdev_get(bdev, FMODE_WRITE | FMODE_READ);
+	if (ret)
+		goto out;
+
+	ret = bd_claim(bdev, inode->i_sb);
+	if (ret)
+		goto out_get;
+
+	ret = set_blocksize(bdev, bdev_physical_block_size(bdev));
+	if (ret)
+		goto out_claim;
+
+	ret = -ENOMEM;
+	h = kmalloc(sizeof(struct asm_disk_head), GFP_KERNEL);
+	if (!h)
+		goto out_claim;
+
+	mlog(ML_DISK, "Looking up disk for bdev %p (dev %X)\n", bdev,
+	     bdev->bd_dev);
+
+	args.fa_handle = (unsigned long)bdev;
+	args.fa_inode = ASMFS_I(inode);
+	disk_inode = iget5_locked(asmdisk_mnt->mnt_sb,
+				  (unsigned long)bdev, asmdisk_test,
+				  asmdisk_set, &args);
+	if (!disk_inode)
+		goto out_head;
+
+	d = ASMDISK_I(disk_inode);
+
+	if (disk_inode->i_state & I_NEW) {
+		mlog_bug_on_msg(atomic_read(&d->d_ios) != 0,
+				"Supposedly new disk 0x%p (dev %X) has outstanding I/O\n",
+				d, bdev->bd_dev);
+		mlog_bug_on_msg(d->d_live,
+				"Supposedly new disk 0x%p (dev %X) is live\n",
+				d, bdev->bd_dev);
+
+		mlog_bug_on_msg(d->d_bdev != bdev,
+				"New disk 0x%p has set bdev 0x%p but we were opening 0x%p\n",
+				d, d->d_bdev, bdev);
+
+		disk_inode->i_mapping->backing_dev_info =
+			&memory_backing_dev_info;
+		d->d_max_sectors = compute_max_sectors(bdev);
+		d->d_live = 1;
+
+		mlog(ML_DISK,
+		     "First open of disk 0x%p (bdev 0x%p, dev %X)\n",
+		     d, d->d_bdev, d->d_bdev->bd_dev);
+		unlock_new_inode(disk_inode);
+	} else {
+		/* Already claimed on first open */
+		mlog(ML_DISK,
+		     "Open of disk 0x%p (bdev 0x%p, dev %X)\n",
+		     d, d->d_bdev, d->d_bdev->bd_dev);
+		bd_release(bdev);
+		kapi_asm_blkdev_put(bdev, FMODE_WRITE | FMODE_READ);
+	}
+
+	h->h_disk = d;
+	h->h_file = ASMFS_FILE(file);
+
+	spin_lock_irq(&ASMFS_FILE(file)->f_lock);
+	list_add(&h->h_flist, &ASMFS_FILE(file)->f_disks);
+	spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
+
+	spin_lock_irq(&ASMFS_I(inode)->i_lock);
+	list_add(&h->h_dlist, &d->d_open);
+	spin_unlock_irq(&ASMFS_I(inode)->i_lock);
+
+	mlog_exit(0);
+	return 0;
+
+out_head:
+	kfree(h);
+
+out_claim:
+	bd_release(bdev);
+
+out_get:
+	kapi_asm_blkdev_put(bdev, FMODE_WRITE | FMODE_READ);
+
+out:
+	mlog_exit(ret);
+	return ret;
+}
+
+static int asm_close_disk(struct file *file, unsigned long handle)
+{
+	struct inode *inode = ASMFS_F2I(file);
+	struct asmdisk_find_inode_args args;
+	struct asm_disk_info *d;
+	struct block_device *bdev;
+	struct inode *disk_inode;
+	struct list_head *p;
+	struct asm_disk_head *h;
+	struct task_struct *tsk = current;
+	DECLARE_WAITQUEUE(wait, tsk);
+
+	mlog_entry("(0x%p, %lu)\n", file, handle);
+
+	mlog_bug_on_msg(!ASMFS_FILE(file) || !ASMFS_I(inode),
+			"Garbage arguments\n");
+
+	args.fa_handle = handle;
+	args.fa_inode = ASMFS_I(inode);
+	disk_inode = ilookup5(asmdisk_mnt->mnt_sb, handle,
+			      asmdisk_test, &args);
+	if (!disk_inode) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	d = ASMDISK_I(disk_inode);
+	bdev = d->d_bdev;
+
+	mlog(ML_DISK, "Closing disk 0x%p (bdev 0x%p, dev %X)\n",
+	     d, d->d_bdev, d->d_bdev->bd_dev);
+
+	/*
+	 * If an additional thread raced us to close the disk, it
+	 * will have removed the disk from the list already.
+	 */
+	
+	spin_lock_irq(&ASMFS_FILE(file)->f_lock);
+	h = NULL;
+	list_for_each(p, &ASMFS_FILE(file)->f_disks) {
+		h = list_entry(p, struct asm_disk_head, h_flist);
+		if (h->h_disk == d)
+			break;
+		h = NULL;
+	}
+	if (!h) {
+		spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
+		iput(disk_inode);
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+	list_del(&h->h_flist);
+	spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
+
+	spin_lock_irq(&ASMFS_I(inode)->i_lock);
+	list_del(&h->h_dlist);
+
+	/* Last close */
+	if (list_empty(&d->d_open)) {
+		mlog(ML_DISK,
+		     "Last close of disk 0x%p (bdev 0x%p, dev %X)\n",
+		     d, d->d_bdev, d->d_bdev->bd_dev);
+
+		/* I/O path can't look up this disk anymore */
+		mlog_bug_on_msg(!d->d_live,
+				"Disk 0x%p (bdev 0x%p, dev %X) isn't live at last close\n",
+				d, d->d_bdev, d->d_bdev->bd_dev);
+		d->d_live = 0;
+		spin_unlock_irq(&ASMFS_I(inode)->i_lock);
+
+		/* No need for a fast path */
+		add_wait_queue(&ASMFS_FILE(file)->f_wait, &wait);
+		do {
+			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+
+			if (!atomic_read(&d->d_ios))
+				break;
+
+			blk_run_address_space(bdev->bd_inode->i_mapping);
+			/*
+			 * Timeout of one second.  This is slightly
+			 * subtle.  In this wait, and *only* this wait,
+			 * we are waiting on I/Os that might have been
+			 * initiated by another process.  In that case,
+			 * the other process's afi will be signaled,
+			 * not ours, so the wake_up() never happens
+			 * here and we need the timeout.
+			 */
+#if 0  /* Damn you, kernel */
+			io_schedule_timeout(HZ);
+#else
+			schedule_timeout(HZ);
+#endif
+		} while (1);
+		set_task_state(tsk, TASK_RUNNING);
+		remove_wait_queue(&ASMFS_FILE(file)->f_wait, &wait);
+	}
+	else
+		spin_unlock_irq(&ASMFS_I(inode)->i_lock);
+
+	kfree(h);
+
+	/* Drop the ref from ilookup5() */
+	iput(disk_inode);
+
+	/* Real put */
+	iput(disk_inode);
+
+	mlog_exit(0);
+	return 0;
+}  /* asm_close_disk() */
+
+
+/* Timeout stuff ripped from aio.c - thanks Ben */
+struct timeout {
+	struct timer_list	timer;
+	int			timed_out;
+	wait_queue_head_t	wait;
+};
+
+static void timeout_func(unsigned long data)
+{
+	struct timeout *to = (struct timeout *)data;
+
+	to->timed_out = 1;
+	wake_up(&to->wait);
+}
+
+static inline void init_timeout(struct timeout *to)
+{
+	init_timer(&to->timer);
+	to->timer.data = (unsigned long)to;
+	to->timer.function = timeout_func;
+	to->timed_out = 0;
+	init_waitqueue_head(&to->wait);
+}
+
+static inline void set_timeout(struct timeout *to, const struct timespec *ts)
+{
+	unsigned long how_long;
+
+	if (!ts->tv_sec && !ts->tv_nsec) {
+		to->timed_out = 1;
+		return;
+	}
+
+	how_long = ts->tv_sec * HZ;
+#define HZ_NS (1000000000 / HZ)
+	how_long += (ts->tv_nsec + HZ_NS - 1) / HZ_NS;
+	
+	to->timer.expires = jiffies + how_long;
+	add_timer(&to->timer);
+}
+
+static inline void clear_timeout(struct timeout *to)
+{
+	del_timer_sync(&to->timer);
+}
+
+/* Must be called with asm_file_info->f_lock held */
+static struct block_device *find_io_bdev(struct file *file)
+{
+	struct asmfs_file_info *afi = ASMFS_FILE(file);
+	struct asm_request *r;
+	struct asm_disk_info *d;
+	struct block_device *bdev = NULL;
+
+	list_for_each_entry(r, &afi->f_ios, r_list) {
+		d = r->r_disk;
+		if (d && d->d_bdev) {
+			bdev = d->d_bdev;
+			break;
+		}
+	}
+
+	return bdev;
+}
+
+static int asm_update_user_ioc(struct file *file, struct asm_request *r)
+{
+	int ret = 0;
+	struct asm_request copy;
+	asm_ioc __user *ioc;
+	u16 tmp_status;
+	unsigned long flags;
+
+	mlog_entry("(0x%p)\n", r);
+
+	ioc = r->r_ioc;
+	mlog(ML_IOC, "User IOC is 0x%p\n", ioc);
+
+	/* Need to get the current userspace bits because ASM_CANCELLED is currently set there */
+	mlog(ML_IOC, "Getting tmp_status\n");
+	if (get_user(tmp_status, &(ioc->status_asm_ioc))) {
+		ret = -EFAULT;
+		goto out;
+	}
+
+	/*
+	 * We're going to store off a copy of the request so we can
+	 * provide a consistent view to userspace.
+	 *
+	 * And so we can get/put_user() without locking :-)
+	 */
+	spin_lock_irqsave(&ASMFS_FILE(file)->f_lock, flags);
+	r->r_status |= tmp_status;
+	copy = *r;
+	spin_unlock_irqrestore(&ASMFS_FILE(file)->f_lock, flags);
+
+	/* From here on, ONLY TRUST copy */
+
+	mlog(ML_IOC, "Putting r_status (0x%08X)\n", copy.r_status);
+	if (put_user(copy.r_status, &(ioc->status_asm_ioc))) {
+		ret = -EFAULT;
+		goto out;
+	}
+	if (copy.r_status & ASM_ERROR) {
+		mlog(ML_IOC, "Putting r_error (0x%08X)\n", copy.r_error);
+		if (put_user(copy.r_error, &(ioc->error_asm_ioc))) {
+			ret = -EFAULT;
+			goto out;
+		}
+	}
+	if (copy.r_status & ASM_COMPLETED) {
+		if (put_user(copy.r_elapsed, &(ioc->elaptime_asm_ioc))) {
+			ret = -EFAULT;
+			goto out;
+		}
+	}
+	mlog(ML_IOC,
+	     "r_status:0x%08X, bitmask:0x%08X, combined:0x%08X\n",
+	     copy.r_status,
+	     (ASM_SUBMITTED | ASM_COMPLETED | ASM_ERROR),
+	     (copy.r_status & (ASM_SUBMITTED | ASM_COMPLETED | ASM_ERROR)));
+	if (copy.r_status & ASM_FREE) {
+		u64 z = 0ULL;
+		if (copy_to_user(&(ioc->reserved_asm_ioc),
+				 &z, sizeof(ioc->reserved_asm_ioc))) {
+			ret = -EFAULT;
+			goto out;
+		}
+	} else if (copy.r_status &
+		   (ASM_SUBMITTED | ASM_ERROR)) {
+		u64 key = (u64)(unsigned long)r;
+		mlog(ML_IOC, "Putting key 0x%p on asm_ioc 0x%p\n",
+		     r, ioc);
+		/* Only on first submit */
+		if (copy_to_user(&(ioc->reserved_asm_ioc),
+				 &key, sizeof(ioc->reserved_asm_ioc))) {
+			ret = -EFAULT;
+			goto out;
+		}
+	}
+
+out:
+	mlog_exit(ret);
+	return ret;
+}  /* asm_update_user_ioc() */
+
+
+static struct asm_request *asm_request_alloc(void)
+{
+	struct asm_request *r;
+
+	r = kmem_cache_alloc(asm_request_cachep, GFP_KERNEL);
+	
+	if (r) {
+		r->r_status = ASM_SUBMITTED;
+		r->r_error = 0;
+		r->r_bio = NULL;
+		r->r_elapsed = 0;
+		r->r_disk = NULL;
+	}
+
+	return r;
+}  /* asm_request_alloc() */
+
+
+static void asm_request_free(struct asm_request *r)
+{
+	/* FIXME: Clean up bh and buffer stuff */
+
+	kmem_cache_free(asm_request_cachep, r);
+}  /* asm_request_free() */
+
+
+static void asm_finish_io(struct asm_request *r)
+{
+	struct asm_disk_info *d;
+	struct asmfs_file_info *afi = r->r_file;
+	unsigned long flags;
+
+	mlog_bug_on_msg(!afi, "Request 0x%p has no file pointer\n", r);
+
+	mlog_entry("(0x%p)\n", r);
+
+	spin_lock_irqsave(&afi->f_lock, flags);
+
+	if (r->r_bio) {
+		mlog(ML_REQUEST|ML_BIO,
+		     "Moving bio 0x%p from request 0x%p to the free list\n",
+		     r->r_bio, r);
+		r->r_bio->bi_private = afi->f_bio_free;
+		afi->f_bio_free = r->r_bio;
+		r->r_bio = NULL;
+	}
+
+ 	d = r->r_disk;
+	r->r_disk = NULL;
+
+	list_del(&r->r_list);
+	list_add(&r->r_list, &afi->f_complete);
+	if (r->r_error)
+		r->r_status |= ASM_ERROR;
+	r->r_status |= ASM_COMPLETED;
+
+	spin_unlock_irqrestore(&afi->f_lock, flags);
+
+	if (d) {
+		atomic_dec(&d->d_ios);
+		if (atomic_read(&d->d_ios) < 0) {
+			mlog(ML_ERROR,
+			     "d_ios underflow on disk 0x%p (dev %X)\n",
+			     d, d->d_bdev->bd_dev);
+			atomic_set(&d->d_ios, 0);
+		}
+	}
+
+	r->r_elapsed = ((jiffies - r->r_elapsed) * 1000000) / HZ;
+
+	mlog(ML_REQUEST, "Finished request 0x%p\n", r);
+
+	wake_up(&afi->f_wait);
+
+	mlog_exit_void();
+}  /* asm_finish_io() */
+
+
+static void asm_end_ioc(struct asm_request *r, unsigned int bytes_done,
+			int error)
+{
+	mlog_entry("(0x%p, %u, %d)\n", r, bytes_done, error);
+
+	mlog_bug_on_msg(!r, "No request\n");
+
+	mlog_bug_on_msg(!(r->r_status & ASM_SUBMITTED),
+			"Request 0x%p wasn't submitted\n", r);
+
+	mlog(ML_REQUEST,
+	     "Ending request 0x%p, bytes_done = %u, error = %d\n",
+	     r, bytes_done, error);
+	mlog(ML_REQUEST|ML_BIO,
+	     "Ending request 0x%p, bio 0x%p, len = %u\n",
+	     r, r->r_bio,
+	     bytes_done + (r->r_bio ? r->r_bio->bi_size : 0));
+
+	switch (error) {
+		default:
+			mlog(ML_REQUEST|ML_ERROR,
+			     "Invalid error of %d on request 0x%p!\n",
+			     error, r);
+			r->r_error = ASM_ERR_INVAL;
+			r->r_status |= ASM_LOCAL_ERROR;
+			break;
+
+		case 0:
+			break;
+
+		case -EFAULT:
+			r->r_error = ASM_ERR_FAULT;
+			r->r_status |= ASM_LOCAL_ERROR;
+			break;
+
+		case -EIO:
+			r->r_error = ASM_ERR_IO;
+			break;
+
+		case -ENODEV:
+			r->r_error = ASM_ERR_NODEV;
+			r->r_status |= ASM_LOCAL_ERROR;
+			break;
+
+		case -ENOMEM:
+			r->r_error = ASM_ERR_NOMEM;
+			r->r_status |= ASM_LOCAL_ERROR;
+			break;
+
+		case -EINVAL:
+			r->r_error = ASM_ERR_INVAL;
+			r->r_status |= ASM_LOCAL_ERROR;
+			break;
+	}
+
+	asm_finish_io(r);
+
+	mlog_exit_void();
+}  /* asm_end_ioc() */
+
+
+static void asm_end_bio_io(struct bio *bio, int error)
+{
+	struct asm_request *r;
+
+	mlog_entry("(0x%p, %d)\n", bio, error);
+
+	mlog(ML_BIO, "bio 0x%p, bi_size is %u\n", bio, bio->bi_size);
+
+	r = bio->bi_private;
+
+	mlog(ML_REQUEST|ML_BIO,
+	     "Completed bio 0x%p for request 0x%p\n", bio, r);
+	if (atomic_dec_and_test(&r->r_bio_count)) {
+		asm_end_ioc(r, r->r_count - (r->r_bio ?
+					     r->r_bio->bi_size : 0),
+			    error);
+	}
+
+	mlog_exit_void();
+}  /* asm_end_bio_io() */
+#ifndef kapi_asm_end_bio_io
+# define kapi_asm_end_bio_io asm_end_bio_io
+#endif
+
+#ifndef kapi_asm_bio_map_user
+# define kapi_asm_bio_map_user bio_map_user
+#endif
+
+static int asm_submit_io(struct file *file,
+			 asm_ioc __user *user_iocp,
+			 asm_ioc *ioc)
+{
+	int ret, rw = READ;
+	struct inode *inode = ASMFS_F2I(file);
+	struct asmdisk_find_inode_args args;
+	struct asm_request *r;
+	struct asm_disk_info *d;
+	struct inode *disk_inode;
+	struct block_device *bdev;
+
+	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, user_iocp, ioc);
+
+	if (!ioc) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	if (ioc->status_asm_ioc) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	r = asm_request_alloc();
+	if (!r) {
+		u16 status = ASM_FREE | ASM_ERROR | ASM_LOCAL_ERROR |
+			ASM_BUSY;
+		if (put_user(status, &(user_iocp->status_asm_ioc))) {
+			mlog_exit(-EFAULT);
+			return -EFAULT;
+		}
+		if (put_user(ASM_ERR_NOMEM, &(user_iocp->error_asm_ioc))) {
+			mlog_exit(-EFAULT);
+			return -EFAULT;
+		}
+
+		mlog_exit(0);
+		return 0;
+	}
+
+	mlog(ML_REQUEST,
+	     "New request at 0x%p alloc()ed for user ioc at 0x%p\n",
+	     r, user_iocp);
+
+	r->r_file = ASMFS_FILE(file);
+	r->r_ioc = user_iocp;  /* Userspace asm_ioc */
+
+	spin_lock_irq(&ASMFS_FILE(file)->f_lock);
+	list_add(&r->r_list, &ASMFS_FILE(file)->f_ios);
+	spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
+
+	ret = -ENODEV;
+	args.fa_handle = (unsigned long)ioc->disk_asm_ioc;
+	args.fa_inode = ASMFS_I(inode);
+	disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
+			      (unsigned long)ioc->disk_asm_ioc,
+			      asmdisk_test, &args);
+	if (!disk_inode)
+		goto out_error;
+
+	spin_lock_irq(&ASMFS_I(inode)->i_lock);
+
+	d = ASMDISK_I(disk_inode);
+	if (!d->d_live) {
+		/* It's in the middle of closing */
+		spin_unlock_irq(&ASMFS_I(inode)->i_lock);
+		iput(disk_inode);
+		goto out_error;
+	}
+
+	atomic_inc(&d->d_ios);
+	r->r_disk = d;
+
+	spin_unlock_irq(&ASMFS_I(inode)->i_lock);
+	iput(disk_inode);
+
+	bdev = d->d_bdev;
+
+	r->r_count = ioc->rcount_asm_ioc * bdev_physical_block_size(bdev);
+
+	/* linux only supports unsigned long size sector numbers */
+	mlog(ML_IOC,
+	     "user_iocp 0x%p: first = 0x%llX, masked = 0x%08lX status = %u, buffer_asm_ioc = 0x%08lX, count = %lu\n",
+	     user_iocp,
+	     (unsigned long long)ioc->first_asm_ioc,
+	     (unsigned long)ioc->first_asm_ioc,
+	     ioc->status_asm_ioc,
+	     (unsigned long)ioc->buffer_asm_ioc,
+	     (unsigned long)r->r_count);
+	/* Note that priority is ignored for now */
+	ret = -EINVAL;
+	if (!ioc->buffer_asm_ioc ||
+	    (ioc->buffer_asm_ioc != (unsigned long)ioc->buffer_asm_ioc) ||
+	    (ioc->first_asm_ioc != (unsigned long)ioc->first_asm_ioc) ||
+	    (ioc->rcount_asm_ioc != (unsigned long)ioc->rcount_asm_ioc) ||
+	    (ioc->priority_asm_ioc > 7) ||
+	    (r->r_count > (queue_max_sectors(bdev_get_queue(bdev)) << 9)) ||
+	    (r->r_count < 0))
+		goto out_error;
+
+	/* Test device size, when known. (massaged from ll_rw_blk.c) */
+	if (bdev->bd_inode->i_size >> 9) {
+		sector_t maxsector = bdev->bd_inode->i_size >> 9;
+		sector_t sector = (sector_t)ioc->first_asm_ioc;
+		sector_t blks = (sector_t)ioc->rcount_asm_ioc;
+
+		if (maxsector < blks || maxsector - blks < sector) {
+			char b[BDEVNAME_SIZE];
+			mlog(ML_NOTICE|ML_IOC,
+			     "Attempt to access beyond end of device\n");
+			mlog(ML_NOTICE|ML_IOC,
+			     "dev %s: want=%llu, limit=%llu\n",
+			     bdevname(bdev, b),
+			     (unsigned long long)(sector + blks),
+			     (unsigned long long)maxsector);
+			goto out_error;
+		}
+	}
+
+
+	mlog(ML_REQUEST|ML_IOC,
+	     "Request 0x%p (user_ioc 0x%p) passed validation checks\n",
+	     r, user_iocp);
+
+	switch (ioc->operation_asm_ioc) {
+		default:
+			goto out_error;
+			break;
+
+		case ASM_READ:
+			rw = READ;
+			break;
+
+		case ASM_WRITE:
+			rw = WRITE;
+			break;
+
+		case ASM_NOOP:
+			/* Trigger an errorless completion */
+			r->r_count = 0;
+			break;
+	}
+	
+	/* Not really an error, but hey, it's an end_io call */
+	ret = 0;
+	if (r->r_count == 0)
+		goto out_error;
+
+	ret = -ENOMEM;
+	r->r_bio = kapi_asm_bio_map_user(bdev_get_queue(bdev), bdev,
+					 (unsigned long)ioc->buffer_asm_ioc,
+					 r->r_count, rw == READ, GFP_KERNEL);
+	if (IS_ERR(r->r_bio)) {
+		ret = PTR_ERR(r->r_bio);
+		r->r_bio = NULL;
+		goto out_error;
+	}
+	mlog(ML_BIO, "Mapped bio 0x%p to request 0x%p\n", r->r_bio, r);
+
+	/* Block layer always uses 512-byte sector addressing,
+	 * regardless of logical and physical block size.
+	 */
+	r->r_bio->bi_sector = ioc->first_asm_ioc *
+		(bdev_physical_block_size(bdev) >> 9);
+
+	/*
+	 * If the bio is a bounced bio, we have to put the
+	 * end_io on the child "real" bio
+	 */
+	r->r_bio->bi_end_io = kapi_asm_end_bio_io;
+	r->r_bio->bi_private = r;
+
+	r->r_elapsed = jiffies;  /* Set start time */
+
+	atomic_set(&r->r_bio_count, 1);
+
+	mlog(ML_REQUEST|ML_BIO,
+	     "Submitting bio 0x%p for request 0x%p\n", r->r_bio, r);
+	submit_bio(rw, r->r_bio);
+
+out:
+	ret = asm_update_user_ioc(file, r);
+
+	mlog_exit(ret);
+	return ret;
+
+out_error:
+	mlog(ML_REQUEST, "Submit-side error %d for request 0x%p\n",
+	     ret,  r);
+	asm_end_ioc(r, 0, ret);
+	goto out;
+}  /* asm_submit_io() */
+
+
+static int asm_maybe_wait_io(struct file *file,
+			     asm_ioc *iocp,
+			     struct timeout *to)
+{
+	long ret;
+	u64 p;
+	struct asmfs_file_info *afi = ASMFS_FILE(file);
+	struct asmdisk_find_inode_args args;
+	struct asm_request *r;
+	struct task_struct *tsk = current;
+	DECLARE_WAITQUEUE(wait, tsk);
+	DECLARE_WAITQUEUE(to_wait, tsk);
+
+	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, iocp, to);
+	
+	if (copy_from_user(&p, &(iocp->reserved_asm_ioc),
+			   sizeof(p))) {
+		ret = -EFAULT;
+		goto out;
+	}
+
+	mlog(ML_REQUEST|ML_IOC, "User asm_ioc 0x%p has key 0x%p\n",
+	     iocp, (struct asm_request *)(unsigned long)p);
+	r = (struct asm_request *)(unsigned long)p;
+	if (!r) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	spin_lock_irq(&afi->f_lock);
+	/* Is it valid? It's surely ugly */
+	if (!r->r_file || (r->r_file != afi) ||
+	    list_empty(&r->r_list) || !(r->r_status & ASM_SUBMITTED)) {
+		spin_unlock_irq(&afi->f_lock);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	mlog(ML_REQUEST|ML_IOC,
+	     "asm_request 0x%p is valid...we think\n", r);
+	if (!(r->r_status & (ASM_COMPLETED |
+			     ASM_BUSY | ASM_ERROR))) {
+		spin_unlock_irq(&afi->f_lock);
+		add_wait_queue(&afi->f_wait, &wait);
+		add_wait_queue(&to->wait, &to_wait);
+		do {
+			struct asm_disk_info *d;
+			struct block_device *bdev = NULL;
+			struct inode *disk_inode;
+
+			ret = 0;
+			set_task_state(tsk, TASK_INTERRUPTIBLE);
+
+			spin_lock_irq(&afi->f_lock);
+			if (r->r_status & (ASM_COMPLETED |
+					   ASM_BUSY | ASM_ERROR))
+				break;
+			d = r->r_disk;
+			if (d && d->d_bdev)
+				bdev = d->d_bdev;
+			spin_unlock_irq(&afi->f_lock);
+
+			args.fa_handle = (unsigned long)bdev;
+			args.fa_inode = ASMFS_I(ASMFS_F2I(file));
+			disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
+					      (unsigned long)bdev,
+					      asmdisk_test, &args);
+			if (disk_inode) {
+				d = ASMDISK_I(disk_inode);
+				if (d->d_bdev)
+					blk_run_address_space(d->d_bdev->bd_inode->i_mapping);
+				iput(&d->vfs_inode);
+			}
+
+			ret = -ETIMEDOUT;
+			if (to->timed_out)
+				break;
+			io_schedule();
+			if (signal_pending(tsk)) {
+				mlog(ML_REQUEST,
+				     "Signal pending waiting for request 0x%p\n",
+				     r);
+				ret = -EINTR;
+				break;
+			}
+		} while (1);
+		set_task_state(tsk, TASK_RUNNING);
+		remove_wait_queue(&afi->f_wait, &wait);
+		remove_wait_queue(&to->wait, &to_wait);
+		
+		if (ret)
+			goto out;
+	}
+
+	ret = 0;
+
+	/* Somebody got here first */
+	/*
+	 * FIXME: This race means that we cannot be shared by two
+	 * threads/processes (this struct file).  If everyone does
+	 * their own open and gets their own struct file, this never
+	 * happens and we're safe.
+	 */
+	if (r->r_status & ASM_FREE)
+		goto out;  /* FIXME: Eek, holding lock */
+	mlog_bug_on_msg(list_empty(&afi->f_complete),
+			"Completion list is empty\n");
+
+	mlog(ML_REQUEST|ML_IOC,
+	     "Removing request 0x%p for asm_ioc 0x%p\n", r, iocp);
+	list_del_init(&r->r_list);
+	r->r_file = NULL;
+	r->r_status |= ASM_FREE;
+
+	spin_unlock_irq(&afi->f_lock);
+
+	ret = asm_update_user_ioc(file, r);
+
+	mlog(ML_REQUEST, "Freeing request 0x%p\n", r);
+	asm_request_free(r);
+
+out:
+	mlog_exit(ret);
+	return ret;
+}  /* asm_maybe_wait_io() */
+
+
+static int asm_complete_io(struct file *file,
+			   asm_ioc **ioc)
+{
+	int ret = 0;
+	struct list_head *l;
+	struct asm_request *r;
+	struct asmfs_file_info *afi = ASMFS_FILE(file);
+
+	mlog_entry("(0x%p, 0x%p)\n", file, ioc);
+
+	spin_lock_irq(&afi->f_lock);
+
+	if (list_empty(&afi->f_complete)) {
+		spin_unlock_irq(&afi->f_lock);
+		*ioc = NULL;
+		mlog_exit(0);
+		return 0;
+	}
+
+	l = afi->f_complete.prev;
+	r = list_entry(l, struct asm_request, r_list);
+	list_del_init(&r->r_list);
+	r->r_file = NULL;
+	r->r_status |= ASM_FREE;
+
+	spin_unlock_irq(&afi->f_lock);
+
+	*ioc = r->r_ioc;
+	
+	ret = asm_update_user_ioc(file, r);
+
+	asm_request_free(r);
+
+	mlog_exit(ret);
+	return ret;
+}  /* asm_complete_io() */
+
+
+static int asm_wait_completion(struct file *file,
+			       struct oracleasm_io_v2 *io,
+			       struct timeout *to,
+			       u32 *status)
+{
+	int ret;
+	struct asmfs_file_info *afi = ASMFS_FILE(file);
+	struct task_struct *tsk = current;
+	DECLARE_WAITQUEUE(wait, tsk);
+	DECLARE_WAITQUEUE(to_wait, tsk);
+
+	mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", file, io, to, status);
+
+	/* Early check - expensive stuff follows */
+	ret = -ETIMEDOUT;
+	if (to->timed_out)
+		goto out;
+
+	spin_lock_irq(&afi->f_lock);
+	if (list_empty(&afi->f_ios) &&
+	    list_empty(&afi->f_complete)) {
+		/* No I/Os left */
+		spin_unlock_irq(&afi->f_lock);
+		ret = 0;
+		*status |= ASM_IO_IDLE;
+		goto out;
+	}
+	spin_unlock_irq(&afi->f_lock);
+
+	add_wait_queue(&afi->f_wait, &wait);
+	add_wait_queue(&to->wait, &to_wait);
+	do {
+		struct block_device *bdev;
+		struct asm_disk_info *d;
+		struct inode *disk_inode;
+		struct asmdisk_find_inode_args args;
+
+		ret = 0;
+		set_task_state(tsk, TASK_INTERRUPTIBLE);
+
+		spin_lock_irq(&afi->f_lock);
+		if (!list_empty(&afi->f_complete)) {
+			spin_unlock_irq(&afi->f_lock);
+			break;
+		}
+
+		bdev = find_io_bdev(file);
+		spin_unlock_irq(&afi->f_lock);
+
+		args.fa_handle = (unsigned long)bdev;
+		args.fa_inode = ASMFS_I(ASMFS_F2I(file));
+		disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
+				      (unsigned long)bdev,
+				      asmdisk_test, &args);
+		if (disk_inode) {
+			d = ASMDISK_I(disk_inode);
+			if (d->d_bdev)
+				blk_run_address_space(d->d_bdev->bd_inode->i_mapping);
+			iput(&d->vfs_inode);
+		}
+
+		ret = -ETIMEDOUT;
+		if (to->timed_out)
+			break;
+		io_schedule();
+		if (signal_pending(tsk)) {
+			ret = -EINTR;
+			break;
+		}
+	} while (1);
+	set_task_state(tsk, TASK_RUNNING);
+	remove_wait_queue(&afi->f_wait, &wait);
+	remove_wait_queue(&to->wait, &to_wait);
+
+out:
+	mlog_exit(ret);
+	return ret;
+}  /* asm_wait_completion() */
+
+
+static inline int asm_submit_io_native(struct file *file,
+       				       struct oracleasm_io_v2 *io)
+{
+	int ret = 0;
+	u32 i;
+	asm_ioc *iocp;
+	asm_ioc tmp;
+
+	mlog_entry("(0x%p, 0x%p)\n", file, io);
+	
+	for (i = 0; i < io->io_reqlen; i++) {
+		ret = -EFAULT;
+		if (get_user(iocp,
+			     ((asm_ioc **)((unsigned long)(io->io_requests))) + i))
+			break;
+
+		if (copy_from_user(&tmp, iocp, sizeof(tmp)))
+			break;
+
+		mlog(ML_IOC, "Submitting user asm_ioc 0x%p\n", iocp);
+		ret = asm_submit_io(file, iocp, &tmp);
+		if (ret)
+			break;
+	}
+
+	mlog_exit(ret);
+	return ret;
+}  /* asm_submit_io_native() */
+
+
+static inline int asm_maybe_wait_io_native(struct file *file,
+					   struct oracleasm_io_v2 *io,
+					   struct timeout *to)
+{
+	int ret = 0;
+	u32 i;
+	asm_ioc *iocp;
+
+	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, io, to);
+	
+	for (i = 0; i < io->io_waitlen; i++) {
+		if (get_user(iocp,
+			     ((asm_ioc **)((unsigned long)(io->io_waitreqs))) + i)) {
+			ret = -EFAULT;
+			break;
+		}
+
+		ret = asm_maybe_wait_io(file, iocp, to);
+		if (ret)
+			break;
+	}
+
+	mlog_exit(ret);
+	return ret;
+}  /* asm_maybe_wait_io_native() */
+
+
+static inline int asm_complete_ios_native(struct file *file,
+					  struct oracleasm_io_v2 *io,
+					  struct timeout *to,
+					  u32 *status)
+{
+	int ret = 0;
+	u32 i;
+	asm_ioc *iocp;
+
+	mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", file, io, to, status);
+
+	for (i = 0; i < io->io_complen; i++) {
+		ret = asm_complete_io(file, &iocp);
+		if (ret)
+			break;
+		if (iocp) {
+			ret = put_user(iocp,
+				       ((asm_ioc **)((unsigned long)(io->io_completions))) + i);
+			       if (ret)
+				   break;
+			continue;
+		}
+
+		/* We had waiters that are full */
+		if (*status & ASM_IO_WAITED)
+			break;
+
+		ret = asm_wait_completion(file, io, to, status);
+		if (ret)
+			break;
+		if (*status & ASM_IO_IDLE)
+			break;
+
+		i--; /* Reset this completion */
+
+	}
+
+	mlog_exit(ret ? ret : i);
+	return (ret ? ret : i);
+}  /* asm_complete_ios_native() */
+
+
+#if BITS_PER_LONG == 64
+static inline void asm_promote_64(asm_ioc64 *ioc)
+{
+	asm_ioc32 *ioc_32 = (asm_ioc32 *)ioc;
+
+	mlog_entry("(0x%p)\n", ioc);
+
+	/*
+	 * Promote the 32bit pointers at the end of the asm_ioc32
+	 * into the asm_ioc64.
+	 *
+	 * Promotion must be done from the tail backwards.
+	 */
+	mlog(ML_IOC, "Promoting (0x%X, 0x%X)\n",
+	     ioc_32->check_asm_ioc,
+	     ioc_32->buffer_asm_ioc);
+	ioc->check_asm_ioc = (u64)ioc_32->check_asm_ioc;
+	ioc->buffer_asm_ioc = (u64)ioc_32->buffer_asm_ioc;
+	mlog(ML_IOC, "Promoted to (0x%"MLFu64", 0x%"MLFu64")\n",
+	     ioc->check_asm_ioc,
+	     ioc->buffer_asm_ioc);
+
+	mlog_exit_void();
+}  /* asm_promote_64() */
+
+
+static inline int asm_submit_io_thunk(struct file *file,
+	       			      struct oracleasm_io_v2 *io)
+{
+	int ret = 0;
+	u32 i;
+	u32 iocp_32;
+	asm_ioc32 *iocp;
+	asm_ioc tmp;
+
+	mlog_entry("(0x%p, 0x%p)\n", file, io);
+
+	for (i = 0; i < io->io_reqlen; i++) {
+		ret = -EFAULT;
+		/*
+		 * io->io_requests is an asm_ioc32**, but the pointers
+		 * are 32bit pointers.
+		 */
+		if (get_user(iocp_32,
+			     ((u32 *)((unsigned long)(io->io_requests))) + i))
+			break;
+
+		iocp = (asm_ioc32 *)(unsigned long)iocp_32;
+
+		if (copy_from_user(&tmp, iocp, sizeof(*iocp)))
+			break;
+
+		asm_promote_64(&tmp);
+
+		mlog(ML_IOC, "Submitting user asm_ioc 0x%p\n", iocp);
+		ret = asm_submit_io(file, (asm_ioc *)iocp, &tmp);
+		if (ret)
+			break;
+	}
+
+	mlog_exit(ret);
+	return ret;
+}  /* asm_submit_io_thunk() */
+
+
+static inline int asm_maybe_wait_io_thunk(struct file *file,
+					  struct oracleasm_io_v2 *io,
+					  struct timeout *to)
+{
+	int ret = 0;
+	u32 i;
+	u32 iocp_32;
+	asm_ioc *iocp;
+
+	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, io, to);
+
+	for (i = 0; i < io->io_waitlen; i++) {
+		/*
+		 * io->io_waitreqs is an asm_ioc32**, but the pointers
+		 * are 32bit pointers.
+		 */
+		if (get_user(iocp_32,
+			     ((u32 *)((unsigned long)(io->io_waitreqs))) + i)) {
+			ret = -EFAULT;
+			break;
+		}
+
+		/* Remember, the this is pointing to 32bit userspace */
+		iocp = (asm_ioc *)(unsigned long)iocp_32;
+
+		ret = asm_maybe_wait_io(file, iocp, to);
+		if (ret)
+			break;
+	}
+
+	mlog_exit(ret);
+	return ret;
+}  /* asm_maybe_wait_io_thunk() */
+
+
+static inline int asm_complete_ios_thunk(struct file *file,
+					 struct oracleasm_io_v2 *io,
+					 struct timeout *to,
+					 u32 *status)
+{
+	int ret = 0;
+	u32 i;
+	u32 iocp_32;
+	asm_ioc *iocp;
+
+	mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", file, io, to, status);
+
+	for (i = 0; i < io->io_complen; i++) {
+		ret = asm_complete_io(file, &iocp);
+		if (ret)
+			break;
+		if (iocp) {
+			iocp_32 = (u32)(unsigned long)iocp;
+
+			ret = put_user(iocp_32,
+				       ((u32 *)((unsigned long)(io->io_completions))) + i);
+			       if (ret)
+				   break;
+			continue;
+		}
+
+		/* We had waiters that are full */
+		if (*status & ASM_IO_WAITED)
+			break;
+
+		ret = asm_wait_completion(file, io, to, status);
+		if (ret)
+			break;
+		if (*status & ASM_IO_IDLE)
+			break;
+
+		i--; /* Reset this completion */
+	}
+
+	mlog_exit(ret ? ret : i);
+	return (ret ? ret : i);
+}  /* asm_complete_ios_thunk() */
+
+#endif  /* BITS_PER_LONG == 64 */
+
+
+static int asm_fill_timeout(struct timespec *ts, unsigned long timeout,
+			    int bpl) 
+{
+	struct timespec __user *ut = (struct timespec __user *)timeout;
+
+#if (BITS_PER_LONG == 64) && defined(CONFIG_COMPAT)
+	struct compat_timespec __user *cut =
+		(struct compat_timespec __user *)timeout;
+
+	/* We open-code get_compat_timespec() because it's not exported */
+	if (bpl == ASM_BPL_32)
+	        return (!access_ok(VERIFY_READ, cut,
+				   sizeof(*cut)) ||
+			__get_user(ts->tv_sec, &cut->tv_sec) ||
+			__get_user(ts->tv_nsec, &cut->tv_nsec)) ? -EFAULT : 0; 
+
+#endif  /* BITS_PER_LONG == 64 && defined(CONFIG_COMPAT) */
+
+	return copy_from_user(ts, ut, sizeof(struct timespec));
+}
+
+static int asm_do_io(struct file *file, struct oracleasm_io_v2 *io,
+		     int bpl)
+{
+	int ret = 0;
+	u32 status = 0;
+	struct timeout to;
+
+	mlog_entry("(0x%p, 0x%p, %d)\n", file, io, bpl);
+
+	init_timeout(&to);
+
+	if (io->io_timeout) {
+		struct timespec ts;
+
+		mlog(ML_ABI, "Passed timeout 0x%"MLFu64"\n",
+		     io->io_timeout);
+		ret = -EFAULT;
+		if (asm_fill_timeout(&ts, (unsigned long)(io->io_timeout),
+				     bpl))
+			goto out;
+
+		set_timeout(&to, &ts);
+		if (to.timed_out) {
+			io->io_timeout = (u64)0;
+			clear_timeout(&to);
+		}
+	}
+
+	ret = 0;
+	if (io->io_requests) {
+		mlog(ML_ABI,
+		     "oracleasm_io_v2 has requests; reqlen %d\n",
+		     io->io_reqlen);
+		ret = -EINVAL;
+		if (bpl == ASM_BPL_32)
+			ret = asm_submit_io_32(file, io);
+#if BITS_PER_LONG == 64
+		else if (bpl == ASM_BPL_64)
+			ret = asm_submit_io_64(file, io);
+#endif  /* BITS_PER_LONG == 64 */
+
+		if (ret)
+			goto out_to;
+	}
+
+	if (io->io_waitreqs) {
+		mlog(ML_ABI, "oracleasm_io_v2 has waits; waitlen %d\n",
+		     io->io_waitlen);
+		ret = -EINVAL;
+		if (bpl == ASM_BPL_32)
+			ret = asm_maybe_wait_io_32(file, io, &to);
+#if BITS_PER_LONG == 64
+		else if (bpl == ASM_BPL_64)
+			ret = asm_maybe_wait_io_64(file, io, &to);
+#endif  /* BITS_PER_LONG == 64 */
+
+		if (ret)
+			goto out_to;
+
+		status |= ASM_IO_WAITED;
+	}
+
+	if (io->io_completions) {
+		mlog(ML_ABI,
+		     "oracleasm_io_v2 has completes; complen %d\n",
+		     io->io_complen);
+		ret = -EINVAL;
+		if (bpl == ASM_BPL_32)
+			ret = asm_complete_ios_32(file, io, &to,
+						  &status);
+#if BITS_PER_LONG == 64
+		else if (bpl == ASM_BPL_64)
+			ret = asm_complete_ios_64(file, io, &to,
+						  &status);
+#endif  /* BITS_PER_LONG == 64 */
+
+		if (ret < 0)
+			goto out_to;
+		if (ret >= io->io_complen)
+			status |= ASM_IO_FULL;
+		ret = 0;
+	}
+
+out_to:
+	if (io->io_timeout)
+		clear_timeout(&to);
+
+out:
+	if (put_user(status, (u32 *)(unsigned long)(io->io_statusp)))
+		ret = -EFAULT;
+	mlog_exit(ret);
+	return ret;
+}  /* asm_do_io() */
+
+static void asm_cleanup_bios(struct file *file)
+{
+	struct asmfs_file_info *afi = ASMFS_FILE(file);
+	struct bio *bio;
+
+	mlog_entry("(0x%p)\n", file);
+
+	spin_lock_irq(&afi->f_lock);
+	while (afi->f_bio_free) {
+		bio = afi->f_bio_free;
+		afi->f_bio_free = bio->bi_private;
+
+		spin_unlock_irq(&afi->f_lock);
+		mlog(ML_BIO, "Unmapping bio 0x%p\n", bio);
+		bio_unmap_user(bio);
+		spin_lock_irq(&afi->f_lock);
+	}
+	spin_unlock_irq(&afi->f_lock);
+
+	mlog_exit_void();
+}
+
+static int asmfs_file_open(struct inode * inode, struct file * file)
+{
+	struct asmfs_inode_info * aii;
+	struct asmfs_file_info * afi;
+
+	mlog_entry("(0x%p, 0x%p)\n", inode, file);
+
+	mlog_bug_on_msg(ASMFS_FILE(file),
+			"Trying to reopen filp 0x%p\n", file);
+
+	mlog(ML_ABI, "Opening filp 0x%p\n", file);
+	afi = (struct asmfs_file_info *)kmalloc(sizeof(*afi),
+						GFP_KERNEL);
+	if (!afi) {
+		mlog_exit(-ENOMEM);
+		return -ENOMEM;
+	}
+
+	afi->f_file = file;
+	afi->f_bio_free = NULL;
+	spin_lock_init(&afi->f_lock);
+	INIT_LIST_HEAD(&afi->f_ctx);
+	INIT_LIST_HEAD(&afi->f_disks);
+	INIT_LIST_HEAD(&afi->f_ios);
+	INIT_LIST_HEAD(&afi->f_complete);
+	init_waitqueue_head(&afi->f_wait);
+
+	aii = ASMFS_I(ASMFS_F2I(file));
+	spin_lock_irq(&aii->i_lock);
+	list_add(&afi->f_ctx, &aii->i_threads);
+	spin_unlock_irq(&aii->i_lock);
+
+	file->private_data = afi;
+
+	mlog(ML_ABI, "Filp 0x%p has afi 0x%p\n", file, afi);
+
+	mlog_exit(0);
+	return 0;
+}  /* asmfs_file_open() */
+
+
+static int asmfs_file_release(struct inode *inode, struct file *file)
+{
+	struct asmfs_inode_info *aii;
+	struct asmfs_file_info *afi;
+	struct asm_disk_head *h, *n;
+	struct list_head *p;
+	struct asm_disk_info *d;
+	struct asm_request *r;
+	struct task_struct *tsk = current;
+	DECLARE_WAITQUEUE(wait, tsk);
+
+	mlog_entry("(0x%p, 0x%p)\n", inode, file);
+
+	aii = ASMFS_I(ASMFS_F2I(file));
+	afi = ASMFS_FILE(file);
+
+	mlog(ML_ABI, "Release for filp 0x%p (afi = 0x%p)\n", file, afi);
+
+	/*
+	 * Shouldn't need the lock, no one else has a reference
+	 * asm_close_disk will need to take it when completing I/O
+	 */
+	list_for_each_entry_safe(h, n, &afi->f_disks, h_flist) {
+		d = h->h_disk;
+		asm_close_disk(file, (unsigned long)d->d_bdev);
+	}
+
+	/* FIXME: Clean up things that hang off of afi */
+
+	spin_lock_irq(&aii->i_lock);
+	list_del(&afi->f_ctx);
+	spin_unlock_irq(&aii->i_lock);
+
+	/* No need for a fastpath */
+	add_wait_queue(&afi->f_wait, &wait);
+	do {
+		struct block_device *bdev;
+		struct asm_disk_info *d;
+		struct inode *disk_inode;
+		struct asmdisk_find_inode_args args;
+
+		set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+
+		spin_lock_irq(&afi->f_lock);
+		if (list_empty(&afi->f_ios))
+		    break;
+
+		bdev = find_io_bdev(file);
+		spin_unlock_irq(&afi->f_lock);
+
+		args.fa_handle = (unsigned long)bdev;
+		args.fa_inode = aii;
+		disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
+				      (unsigned long)bdev,
+				      asmdisk_test, &args);
+		if (disk_inode) {
+			d = ASMDISK_I(disk_inode);
+			if (d->d_bdev)
+				blk_run_address_space(d->d_bdev->bd_inode->i_mapping);
+			iput(&d->vfs_inode);
+		}
+
+		mlog(ML_ABI|ML_REQUEST,
+		     "There are still I/Os hanging off of afi 0x%p\n",
+		     afi);
+		io_schedule();
+	} while (1);
+	set_task_state(tsk, TASK_RUNNING);
+	remove_wait_queue(&afi->f_wait, &wait);
+	
+	/* I don't *think* we need the lock here anymore, but... */
+
+	/* Clear unreaped I/Os */
+	while (!list_empty(&afi->f_complete)) {
+		p = afi->f_complete.prev;
+		r = list_entry(p, struct asm_request, r_list);
+		list_del(&r->r_list);
+		r->r_file = NULL;
+		asm_request_free(r);
+	}
+	spin_unlock_irq(&afi->f_lock);
+
+	/* And cleanup any pages from those I/Os */
+	asm_cleanup_bios(file);
+
+	mlog(ML_ABI, "Done with afi 0x%p from filp 0x%p\n", afi, file);
+	file->private_data = NULL;
+	kfree(afi);
+
+	mlog_exit(0);
+	return 0;
+}  /* asmfs_file_release() */
+
+/*
+ * Verify that the magic and ABI versions are valid.  Future
+ * drivers might support more than one ABI version, so ESRCH is returned
+ * for "valid ABI version not found"
+ */
+static int asmfs_verify_abi(struct oracleasm_abi_info *abi_info)
+{
+	if (abi_info->ai_magic != ASM_ABI_MAGIC)
+		return -EBADR;
+	if (abi_info->ai_version != ASM_ABI_VERSION)
+		return -ESRCH;
+
+	return 0;
+}
+
+static ssize_t asmfs_svc_query_version(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_abi_info *abi_info;
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_abi_info)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+       	abi_info = (struct oracleasm_abi_info *)buf;
+
+	ret = asmfs_verify_abi(abi_info);
+	if (ret) {
+	       	if (ret == -ESRCH) {
+			abi_info->ai_version = ASM_ABI_VERSION;
+			abi_info->ai_status = -ESRCH;
+		} else
+			goto out;
+	}
+
+	ret = -EBADR;
+	if (abi_info->ai_size != sizeof(struct oracleasm_abi_info))
+		goto out;
+	ret = -EBADRQC;
+	if (abi_info->ai_type != ASMOP_QUERY_VERSION)
+		goto out;
+
+	ret = 0;
+
+out:
+	if (!abi_info->ai_status)
+		abi_info->ai_status = ret;
+	
+	mlog_exit(size);
+	return size;
+}
+
+static ssize_t asmfs_svc_get_iid(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_get_iid_v2 *iid_info;
+	struct asmfs_sb_info *asb = ASMFS_SB(ASMFS_F2I(file)->i_sb);
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_get_iid_v2)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	iid_info = (struct oracleasm_get_iid_v2 *)buf;
+
+	ret = asmfs_verify_abi(&iid_info->gi_abi);
+	if (ret)
+		goto out;
+	ret = -EBADR;
+	if (iid_info->gi_abi.ai_size !=
+	    sizeof(struct oracleasm_get_iid_v2))
+		goto out;
+	ret = -EBADRQC;
+	if (iid_info->gi_abi.ai_type != ASMOP_GET_IID)
+		goto out;
+
+	spin_lock_irq(&asb->asmfs_lock);
+	iid_info->gi_iid = (u64)asb->next_iid;
+	asb->next_iid++;
+	spin_unlock_irq(&asb->asmfs_lock);
+
+	ret = 0;
+
+out:
+	iid_info->gi_abi.ai_status = ret;
+
+	mlog_exit(size);
+	return size;
+}
+
+static ssize_t asmfs_svc_check_iid(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_get_iid_v2 *iid_info;
+	struct asmfs_sb_info *asb = ASMFS_SB(ASMFS_F2I(file)->i_sb);
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_get_iid_v2)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	iid_info = (struct oracleasm_get_iid_v2 *)buf;
+
+	ret = asmfs_verify_abi(&iid_info->gi_abi);
+	if (ret)
+		goto out;
+
+	ret = -EBADR;
+	if (iid_info->gi_abi.ai_size !=
+	    sizeof(struct oracleasm_get_iid_v2))
+		goto out;
+	ret = -EBADRQC;
+	if (iid_info->gi_abi.ai_type != ASMOP_CHECK_IID)
+		goto out;
+
+	spin_lock_irq(&asb->asmfs_lock);
+	if (iid_info->gi_iid >= (u64)asb->next_iid)
+		iid_info->gi_iid = (u64)0;
+	spin_unlock_irq(&asb->asmfs_lock);
+
+	ret = 0;
+
+out:
+	iid_info->gi_abi.ai_status = ret;
+
+	mlog_exit(size);
+	return size;
+}
+
+static ssize_t asmfs_svc_query_disk(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_query_disk_v2 *qd_info;
+	struct file *filp;
+	struct block_device *bdev;
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_query_disk_v2)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	qd_info = (struct oracleasm_query_disk_v2 *)buf;
+
+	ret = asmfs_verify_abi(&qd_info->qd_abi);
+	if (ret)
+		goto out;
+
+	ret = -EBADR;
+	if (qd_info->qd_abi.ai_size !=
+	    sizeof(struct oracleasm_query_disk_v2))
+		goto out;
+	ret = -EBADRQC;
+	if (qd_info->qd_abi.ai_type != ASMOP_QUERY_DISK)
+		goto out;
+
+	ret = -ENODEV;
+	filp = fget(qd_info->qd_fd);
+	if (!filp)
+		goto out;
+
+	ret = -ENOTBLK;
+	if (!S_ISBLK(filp->f_mapping->host->i_mode))
+		goto out_put;
+
+	bdev = I_BDEV(filp->f_mapping->host);
+
+	qd_info->qd_max_sectors = compute_max_sectors(bdev);
+	qd_info->qd_hardsect_size = bdev_physical_block_size(bdev);
+	mlog(ML_ABI|ML_DISK,
+	     "Querydisk returning qd_max_sectors = %u and "
+	     "qd_hardsect_size = %d\n",
+	     qd_info->qd_max_sectors, qd_info->qd_hardsect_size);
+
+	ret = 0;
+
+out_put:
+	fput(filp);
+
+out:
+	qd_info->qd_abi.ai_status = ret;
+
+	mlog_exit(size);
+	return size;
+}
+
+static ssize_t asmfs_svc_open_disk(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_open_disk_v2 od_info;
+	struct block_device *bdev = NULL;
+	struct file *filp;
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_open_disk_v2)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	if (copy_from_user(&od_info,
+			   (struct oracleasm_open_disk_v2 __user *)buf,
+			   sizeof(struct oracleasm_open_disk_v2))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	od_info.od_handle = 0; /* Unopened */
+
+	ret = asmfs_verify_abi(&od_info.od_abi);
+	if (ret)
+		goto out_error;
+
+	ret = -EBADR;
+	if (od_info.od_abi.ai_size !=
+	    sizeof(struct oracleasm_open_disk_v2))
+		goto out_error;
+	ret = -EBADRQC;
+	if (od_info.od_abi.ai_type != ASMOP_OPEN_DISK)
+		goto out_error;
+
+	ret = -ENODEV;
+	filp = fget(od_info.od_fd);
+	if (!filp)
+		goto out_error;
+
+	if (igrab(filp->f_mapping->host)) {
+		ret = -ENOTBLK;
+		if (S_ISBLK(filp->f_mapping->host->i_mode)) {
+			bdev = I_BDEV(filp->f_mapping->host);
+
+			ret = asm_open_disk(file, bdev);
+		}
+	}
+	fput(filp);
+	if (ret)
+		goto out_error;
+
+	od_info.od_handle = (u64)(unsigned long)bdev;
+out_error:
+	od_info.od_abi.ai_status = ret;
+	if (copy_to_user((struct oracleasm_open_disk_v2 __user *)buf,
+			 &od_info,
+			 sizeof(struct oracleasm_open_disk_v2))) {
+		if (od_info.od_handle)
+			asm_close_disk(file,
+				       (unsigned long)od_info.od_handle);
+		/* Ignore close errors, this is the real error */
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	mlog_exit(size);
+	return size;
+}
+
+static ssize_t asmfs_svc_close_disk(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_close_disk_v2 cd_info;
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_close_disk_v2)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	if (copy_from_user(&cd_info,
+			   (struct oracleasm_close_disk_v2 __user *)buf,
+			   sizeof(struct oracleasm_close_disk_v2))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	ret = asmfs_verify_abi(&cd_info.cd_abi);
+	if (ret)
+		goto out_error;
+
+	ret = -EBADR;
+	if (cd_info.cd_abi.ai_size !=
+	    sizeof(struct oracleasm_close_disk_v2))
+		goto out_error;
+	ret = -EBADRQC;
+	if (cd_info.cd_abi.ai_type != ASMOP_CLOSE_DISK)
+		goto out_error;
+
+	ret = asm_close_disk(file, (unsigned long)cd_info.cd_handle);
+
+out_error:
+	cd_info.cd_abi.ai_status = ret;
+	if (copy_to_user((struct oracleasm_close_disk_v2 __user *)buf,
+			 &cd_info,
+			 sizeof(struct oracleasm_close_disk_v2))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	mlog_exit(size);
+	return size;
+}
+
+static ssize_t asmfs_svc_io32(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_abi_info __user *user_abi_info;
+	struct oracleasm_io_v2 io_info;
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_io_v2)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	if (copy_from_user(&io_info,
+			   (struct oracleasm_io_v2 __user *)buf,
+			   sizeof(struct oracleasm_io_v2))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	ret = asmfs_verify_abi(&io_info.io_abi);
+	if (ret)
+		goto out_error;
+
+	ret = -EBADR;
+	if (io_info.io_abi.ai_size !=
+	    sizeof(struct oracleasm_io_v2))
+		goto out_error;
+	ret = -EBADRQC;
+	if (io_info.io_abi.ai_type != ASMOP_IO32)
+		goto out_error;
+
+#if (BITS_PER_LONG == 64) && !defined(CONFIG_COMPAT)
+	ret = -EINVAL;
+#else
+	ret = asm_do_io(file, &io_info, ASM_BPL_32);
+#endif  /* (BITS_PER_LONG == 64) && !defined(CONFIG_COMPAT) */
+
+out_error:
+	user_abi_info = (struct oracleasm_abi_info __user *)buf;
+	if (put_user(ret, &(user_abi_info->ai_status))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	mlog_exit(size);
+	return size;
+}
+
+#if BITS_PER_LONG == 64
+static ssize_t asmfs_svc_io64(struct file *file, char *buf, size_t size)
+{
+	struct oracleasm_abi_info __user *user_abi_info;
+	struct oracleasm_io_v2 io_info;
+	int ret;
+
+	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
+
+	if (size != sizeof(struct oracleasm_io_v2)) {
+		mlog_exit(-EINVAL);
+		return -EINVAL;
+	}
+
+	if (copy_from_user(&io_info,
+			   (struct oracleasm_io_v2 __user *)buf,
+			   sizeof(struct oracleasm_io_v2))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	ret = asmfs_verify_abi(&io_info.io_abi);
+	if (ret)
+		goto out_error;
+
+	ret = -EBADR;
+	if (io_info.io_abi.ai_size !=
+	    sizeof(struct oracleasm_io_v2))
+		goto out_error;
+	ret = -EBADRQC;
+	if (io_info.io_abi.ai_type != ASMOP_IO64)
+		goto out_error;
+
+	ret = asm_do_io(file, &io_info, ASM_BPL_64);
+
+out_error:
+	user_abi_info = (struct oracleasm_abi_info __user *)buf;
+	if (put_user(ret, &(user_abi_info->ai_status))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	mlog_exit(size);
+	return size;
+}
+#endif  /* BITS_PER_LONG == 64 */
+
+
+/*
+ * Because each of these operations need to access the filp->private,
+ * we must multiplex.
+ */
+static ssize_t asmfs_file_read(struct file *file, char *buf, size_t size, loff_t *pos)
+{
+	struct oracleasm_abi_info __user *user_abi_info;
+	ssize_t ret;
+	int op;
+
+	asm_cleanup_bios(file);
+
+	user_abi_info = (struct oracleasm_abi_info __user *)buf;
+	if (get_user(op, &((user_abi_info)->ai_type))) {
+		mlog_exit(-EFAULT);
+		return -EFAULT;
+	}
+
+	switch (op) {
+		default:
+			ret = -EBADRQC;
+			break;
+
+		case ASMOP_OPEN_DISK:
+			ret = asmfs_svc_open_disk(file, (char *)buf,
+						  size);
+			break;
+
+		case ASMOP_CLOSE_DISK:
+			ret = asmfs_svc_close_disk(file, (char *)buf,
+						   size);
+			break;
+
+		case ASMOP_IO32:
+			ret = asmfs_svc_io32(file, (char *)buf, size);
+			break;
+
+#if BITS_PER_LONG == 64
+		case ASMOP_IO64:
+			ret = asmfs_svc_io64(file, (char *)buf, size);
+			break;
+#endif  /* BITS_PER_LONG == 64 */
+	}
+
+	return ret;
+}
+
+static struct file_operations asmfs_file_operations = {
+	.open		= asmfs_file_open,
+	.release	= asmfs_file_release,
+	.read		= asmfs_file_read,
+};
+
+static struct inode_operations asmfs_file_inode_operations = {
+	.getattr	= simple_getattr,
+};
+
+/*  See init_asmfs_dir_operations() */
+static struct file_operations asmfs_dir_operations = {0, };
+
+static struct inode_operations asmfs_disk_dir_inode_operations = {
+	.lookup		= simple_lookup,
+	.unlink		= simple_unlink,
+	.mknod		= asmfs_mknod,
+};
+static struct inode_operations asmfs_iid_dir_inode_operations = {
+	.create		= asmfs_create,
+	.lookup		= simple_lookup,
+	.unlink		= simple_unlink,
+};
+
+static struct super_operations asmfs_ops = {
+	.statfs		= simple_statfs,
+	.alloc_inode	= asmfs_alloc_inode,
+	.destroy_inode	= asmfs_destroy_inode,
+	.drop_inode	= generic_delete_inode,
+	/* These last three only required for limited maxinstances */
+	.put_super	= asmfs_put_super,
+	.remount_fs     = asmfs_remount,
+};
+
+/*
+ * Initialisation
+ */
+
+static int asmfs_fill_super(struct super_block *sb,
+			    void *data, int silent)
+{
+	struct inode *inode, *parent;
+	struct dentry *root, *dentry;
+	struct asmfs_sb_info *asb;
+	struct asmfs_params params;
+	struct qstr name;
+
+	sb->s_blocksize = PAGE_CACHE_SIZE;
+	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
+	sb->s_magic = ASMFS_MAGIC;
+	sb->s_op = &asmfs_ops;
+	sb->s_maxbytes = MAX_NON_LFS;	/* Why? */
+
+	asb = kmalloc(sizeof(struct asmfs_sb_info), GFP_KERNEL);
+	if (!asb)
+		return -ENOMEM;
+	sb->s_fs_info = asb;
+
+	asb->asmfs_super = sb;
+	asb->next_iid = 1;
+	spin_lock_init(&asb->asmfs_lock);
+
+	if (parse_options((char *)data, &params) != 0)
+		goto out_free_asb;
+
+	init_limits(asb, &params);
+
+	inode = new_inode(sb);
+	if (!inode)
+		goto out_free_asb;
+
+	inode->i_ino = (unsigned long)inode;
+	inode->i_mode = S_IFDIR | 0755;
+	inode->i_uid = inode->i_gid = 0;
+	set_i_blksize(inode, PAGE_CACHE_SIZE);
+	inode->i_blocks = 0;
+	inode->i_rdev = 0;
+	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	inode->i_op = &simple_dir_inode_operations;
+	inode->i_fop = &asmfs_dir_operations;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+	/* directory inodes start off with i_nlink == 2 (for "." entry) */
+	inode->i_nlink++;
+	parent = inode;
+
+	root = d_alloc_root(inode);
+	if (!root) {
+		iput(inode);
+		goto out_free_asb;
+	}
+
+	name.name = ASM_MANAGER_DISKS;
+	name.len = strlen(ASM_MANAGER_DISKS);
+	name.hash = full_name_hash(name.name, name.len);
+	dentry = d_alloc(root, &name);
+	if (!dentry)
+		goto out_genocide;
+	parent->i_nlink++;
+	inode = new_inode(sb);
+	if (!inode)
+		goto out_genocide;
+	inode->i_ino = (unsigned long)inode;
+	inode->i_mode = S_IFDIR | 0755;
+	inode->i_uid = inode->i_gid = 0;
+	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	inode->i_op = &asmfs_disk_dir_inode_operations;
+	inode->i_fop = &asmfs_dir_operations;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+	d_add(dentry, inode);
+
+	name.name = ASM_MANAGER_INSTANCES;
+	name.len = strlen(ASM_MANAGER_INSTANCES);
+	name.hash = full_name_hash(name.name, name.len);
+	dentry = d_alloc(root, &name);
+	if (!dentry)
+		goto out_genocide;
+	parent->i_nlink++;
+	inode = new_inode(sb);
+	if (!inode)
+		goto out_genocide;
+	inode->i_ino = (unsigned long)inode;
+	inode->i_mode = S_IFDIR | 0770;
+	inode->i_uid = inode->i_gid = 0;
+	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	inode->i_op = &asmfs_iid_dir_inode_operations;
+	inode->i_fop = &asmfs_dir_operations;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+	d_add(dentry, inode);
+
+	name.name = asm_operation_files[ASMOP_QUERY_VERSION];
+	name.len = strlen(asm_operation_files[ASMOP_QUERY_VERSION]);
+	name.hash = full_name_hash(name.name, name.len);
+	dentry = d_alloc(root, &name);
+	if (!dentry)
+		goto out_genocide;
+	inode = new_transaction_inode(sb, 0770,
+				      &trans_contexts[ASMOP_QUERY_VERSION]);
+	if (!inode)
+		goto out_genocide;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+	d_add(dentry, inode);
+
+	name.name = asm_operation_files[ASMOP_GET_IID];
+	name.len = strlen(asm_operation_files[ASMOP_GET_IID]);
+	name.hash = full_name_hash(name.name, name.len);
+	dentry = d_alloc(root, &name);
+	if (!dentry)
+		goto out_genocide;
+	inode = new_transaction_inode(sb, 0770,
+				      &trans_contexts[ASMOP_GET_IID]);
+	if (!inode)
+		goto out_genocide;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+	d_add(dentry, inode);
+
+	name.name = asm_operation_files[ASMOP_CHECK_IID];
+	name.len = strlen(asm_operation_files[ASMOP_CHECK_IID]);
+	name.hash = full_name_hash(name.name, name.len);
+	dentry = d_alloc(root, &name);
+	if (!dentry)
+		goto out_genocide;
+	inode = new_transaction_inode(sb, 0770,
+				      &trans_contexts[ASMOP_CHECK_IID]);
+	if (!inode)
+		goto out_genocide;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+	d_add(dentry, inode);
+
+	name.name = asm_operation_files[ASMOP_QUERY_DISK];
+	name.len = strlen(asm_operation_files[ASMOP_QUERY_DISK]);
+	name.hash = full_name_hash(name.name, name.len);
+	dentry = d_alloc(root, &name);
+	if (!dentry)
+		goto out_genocide;
+	inode = new_transaction_inode(sb, 0770,
+				      &trans_contexts[ASMOP_QUERY_DISK]);
+	if (!inode)
+		goto out_genocide;
+	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
+	d_add(dentry, inode);
+
+	sb->s_root = root;
+
+
+	printk(KERN_DEBUG "ASM: oracleasmfs mounted with options: %s\n", 
+	       data ? (char *)data : "<defaults>" );
+	printk(KERN_DEBUG "ASM:	maxinstances=%ld\n", asb->max_inodes);
+	return 0;
+
+out_genocide:
+	d_genocide(root);
+	dput(root);
+
+out_free_asb:
+	sb->s_fs_info = NULL;
+	kfree(asb);
+
+	return -EINVAL;
+}
+
+
+/*
+ * We want all the simple_dir_operations, but we cannot reference them
+ * directly -- they are not EXPORT_SYMBOL()d.  So, we just copy the
+ * exported simple_dir_operations before adding any specific functions
+ * of our own.
+ *
+ * This means that asmfs_dir_operations can't be const.  Oh, well.
+ */
+static void __init init_asmfs_dir_operations(void) {
+	asmfs_dir_operations		= simple_dir_operations;
+	asmfs_dir_operations.fsync	= noop_fsync;
+};
+
+
+#ifdef GET_SB_HAS_VFSMOUNT
+static int asmfs_get_sb(struct file_system_type *fs_type, int flags,
+			const char *dev_name, void *data,
+			struct vfsmount *mnt)
+{
+	return get_sb_nodev(fs_type, flags, data, asmfs_fill_super, mnt);
+}
+#else
+static struct super_block *asmfs_get_sb(struct file_system_type *fs_type,
+					int flags, const char *dev_name,
+					void *data)
+{
+	return get_sb_nodev(fs_type, flags, data, asmfs_fill_super);
+}
+#endif  /* GET_SB_HAS_VFSMOUNT */
+
+static struct file_system_type asmfs_fs_type = {
+	.owner		= THIS_MODULE,
+	.name		= "oracleasmfs",
+	.get_sb		= asmfs_get_sb,
+	.kill_sb	= kill_litter_super,
+};
+
+static int __init init_asmfs_fs(void)
+{
+	int ret;
+
+	ret = init_inodecache();
+	if (ret) {
+		printk("oracleasmfs: Unable to create asmfs_inode_cache\n");
+		goto out_inodecache;
+	}
+
+	ret = init_requestcache();
+	if (ret) {
+		printk("oracleasmfs: Unable to create asm_request cache\n");
+		goto out_requestcache;
+	}
+
+	ret = init_asmdiskcache();
+	if (ret) {
+		printk("oracleasmfs: Unable to initialize the disk cache\n");
+		goto out_diskcache;
+	}
+
+	ret = init_oracleasm_proc();
+	if (ret) {
+		printk("oracleasmfs: Unable to register proc entries\n");
+		goto out_proc;
+	}
+
+	init_asmfs_dir_operations();
+	ret = register_filesystem(&asmfs_fs_type);
+	if (ret) {
+		printk("oracleasmfs: Unable to register filesystem\n");
+		goto out_register;
+	}
+
+	return 0;
+
+out_register:
+	exit_oracleasm_proc();
+
+out_proc:
+	destroy_asmdiskcache();
+
+out_diskcache:
+	destroy_requestcache();
+
+out_requestcache:
+	destroy_inodecache();
+
+out_inodecache:
+	return ret;
+}
+
+static void __exit exit_asmfs_fs(void)
+{
+	unregister_filesystem(&asmfs_fs_type);
+	exit_oracleasm_proc();
+	destroy_asmdiskcache();
+	destroy_requestcache();
+	destroy_inodecache();
+}
+
+module_init(init_asmfs_fs)
+module_exit(exit_asmfs_fs)
+MODULE_LICENSE("GPL");
+MODULE_VERSION(ASM_MODULE_VERSION);
+MODULE_AUTHOR("Joel Becker <joel.becker@oracle.com>");
+MODULE_DESCRIPTION("Kernel driver backing the Generic Linux ASM Library.");
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kernel/oracleasm.c oracleasm-git/kernel/oracleasm.c
--- oracleasm-2.0.5/kernel/oracleasm.c	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/kernel/oracleasm.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,2946 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * NAME
- *	oracleasm.c - ASM library kernel driver.
- *
- * AUTHOR
- * 	Joel Becker <joel.becker@oracle.com>
- *
- * DESCRIPTION
- *      This file contains the kernel driver of the Oracle Automatic
- *      Storage Managment userspace library.  It provides the routines
- *      required to support the userspace library.
- *
- * MODIFIED   (YYYY/MM/DD)
- *      2004/01/02 - Joel Becker <joel.becker@oracle.com>
- *		Initial GPL header.
- *      2004/09/10 - Joel Becker <joel.becker@oracle.com>
- *      	First port to 2.6.
- *      2004/12/16 - Joel Becker <joel.becker@oracle.com>
- *      	Change from ioctl to transaction files.
- *
- * Copyright (c) 2002-2004 Oracle Corporation.  All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License, version 2 as published by the Free Software Foundation.
- * 
- * This library 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
- * General Public License for more details.
- * 
- * You should have recieved a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-/*
- * This driver's filesystem code is based on the ramfs filesystem.
- * Copyright information for the original source appears below.
- */
-
-/* Simple VFS hooks based on: */
-/*
- * Resizable simple ram filesystem for Linux.
- *
- * Copyright (C) 2000 Linus Torvalds.
- *		 2000 Transmeta Corp.
- *
- * Usage limits added by David Gibson, Linuxcare Australia.
- * This file is released under the GPL.
- */
-
-
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/module.h>
-#include <linux/pagemap.h>
-#include <linux/init.h>
-#include <linux/string.h>
-#include <linux/highmem.h>
-#include <linux/slab.h>
-#include <linux/blkdev.h>
-#include <linux/mount.h>
-#include <linux/smp_lock.h>
-#include <linux/parser.h>
-#include <linux/backing-dev.h>
-
-#include <asm/uaccess.h>
-#include <linux/spinlock.h>
-
-#include "linux/oracleasm/compat32.h"
-#include "linux/oracleasm/kernel.h"
-#include "linux/oracleasm/abi.h"
-#include "linux/oracleasm/disk.h"
-#include "linux/oracleasm/manager.h"
-#include "linux/oracleasm/error.h"
-
-#include "linux/oracleasm/module_version.h"
-
-/*
- * Modern kernels don't need this.  Older kernels will have it defined
- * by the compat code.
- */
-#ifndef set_i_blksize
-# define set_i_blksize(i, bs) do { /* Nothing */ } while (0)
-#endif
-
-
-#include "masklog.h"
-#include "proc.h"
-#if 0
-#include "transaction_file.h"
-#else
-/* XXX ugly for now */
-#include "transaction_file.c"
-#include "proc.c"
-#endif 
-
-#if PAGE_CACHE_SIZE % 1024
-#error Oh no, PAGE_CACHE_SIZE is not divisible by 1k! I cannot cope.
-#endif  /* PAGE_CACHE_SIZE % 1024 */
-
-
-
-/*
- * Compat32
- */
-#define ASM_BPL_32		32
-#if BITS_PER_LONG == 32
-# define asm_submit_io_32	asm_submit_io_native
-# define asm_maybe_wait_io_32	asm_maybe_wait_io_native
-# define asm_complete_ios_32	asm_complete_ios_native
-#else
-# if BITS_PER_LONG == 64
-#  define ASM_BPL_64		64
-#  define asm_submit_io_32	asm_submit_io_thunk
-#  define asm_submit_io_64	asm_submit_io_native
-#  define asm_maybe_wait_io_32	asm_maybe_wait_io_thunk
-#  define asm_maybe_wait_io_64	asm_maybe_wait_io_native
-#  define asm_complete_ios_32	asm_complete_ios_thunk
-#  define asm_complete_ios_64	asm_complete_ios_native
-# endif  /* BITS_PER_LONG == 64 */
-#endif  /* BITS_PER_LONG == 32 */
-
-
-static struct super_operations asmfs_ops;
-static struct file_operations asmfs_dir_operations;
-static struct file_operations asmfs_file_operations;
-static struct inode_operations asmfs_file_inode_operations;
-static struct inode_operations asmfs_disk_dir_inode_operations;
-static struct inode_operations asmfs_iid_dir_inode_operations;
-
-static struct kmem_cache	*asm_request_cachep;
-static struct kmem_cache	*asmfs_inode_cachep;
-static struct kmem_cache	*asmdisk_cachep;
-#ifndef kapi_kmem_cache_create
-# define kapi_kmem_cache_create kmem_cache_create
-#endif
-
-/*
- * asmfs super-block data in memory
- */
-struct asmfs_sb_info {
-	struct super_block *asmfs_super;
-	/* Prevent races accessing the used block
-	 * counts. Conceptually, this could probably be a semaphore,
-	 * but the only thing we do while holding the lock is
-	 * arithmetic, so there's no point */
-	spinlock_t asmfs_lock;
-
-	/* It is important that at least the free counts below be
-	   signed.  free_XXX may become negative if a limit is changed
-	   downwards (by a remount) below the current usage. */	  
-
-	/* max number of inodes - controls # of instances */
-	long max_inodes;
-	/* free_inodes = max_inodes - total number of inodes currently in use */
-	long free_inodes;
-
-	unsigned long next_iid;
-};
-
-#define ASMFS_SB(sb) ((struct asmfs_sb_info *)((sb)->s_fs_info))
-
-
-struct asmfs_file_info {
-	struct file *f_file;
-	spinlock_t f_lock;		/* Lock on the structure */
-	wait_queue_head_t f_wait;	/* Folks waiting on I/O */
-	struct list_head f_ctx;		/* Hook into the i_threads list */
-	struct list_head f_ios;		/* Outstanding I/Os for this thread */
-	struct list_head f_complete;	/* Completed I/Os for this thread */
-	struct list_head f_disks;	/* List of disks opened */
-	struct bio *f_bio_free;		/* bios to free */
-};
-
-#define ASMFS_FILE(_f) ((struct asmfs_file_info *)((_f)->private_data))
-
-
-/*
- * asmfs inode data in memory
- *
- * Note that 'thread' here can mean 'process' too :-)
- */
-struct asmfs_inode_info {
-	spinlock_t i_lock;		/* lock on the asmfs_inode_info structure */
-	struct list_head i_disks;	/* List of disk handles */
-	struct list_head i_threads;	/* list of context structures for each calling thread */
-	struct inode vfs_inode;
-};
-
-static inline struct asmfs_inode_info *ASMFS_I(struct inode *inode)
-{
-	return container_of(inode, struct asmfs_inode_info, vfs_inode);
-}
-
-static inline struct inode *ASMFS_F2I(struct file *file)
-{
-	return file->f_dentry->d_inode;
-}
-
-/*
- * asm disk info
- */
-struct asm_disk_info {
-	struct asmfs_inode_info *d_inode;
-	struct block_device *d_bdev;	/* Block device we I/O to */
-	int d_max_sectors;		/* Maximum sectors per I/O */
-	int d_live;			/* Is the disk alive? */
-	atomic_t d_ios;			/* Count of in-flight I/Os */
-	struct list_head d_open;	/* List of assocated asm_disk_heads */
-	struct inode vfs_inode;
-};
-
-/* Argument to iget5_locked()/ilookup5() to map bdev to disk_inode */
-struct asmdisk_find_inode_args {
-	unsigned long fa_handle;
-	struct asmfs_inode_info *fa_inode;
-};
-
-static inline struct asm_disk_info *ASMDISK_I(struct inode *inode)
-{
-	return container_of(inode, struct asm_disk_info, vfs_inode);
-}
-
-
-/*
- * asm disk info lists
- *
- * Each file_info struct has a list of disks it has opened.  As this
- * is an M->N mapping, an intermediary structure is needed
- */
-struct asm_disk_head {
-	struct asm_disk_info *h_disk;	/* Pointer to associated disk */
-	struct asmfs_file_info *h_file;	/* Pointer to owning file */
-	struct list_head h_flist;	/* Hook into file's list */
-	struct list_head h_dlist;	/* Hook into disk's list */
-};
-
-
-/* ASM I/O requests */
-struct asm_request {
-	struct list_head r_list;
-	struct asmfs_file_info *r_file;
-	struct asm_disk_info *r_disk;
-	asm_ioc *r_ioc;				/* User asm_ioc */
-	u16 r_status;				/* status_asm_ioc */
-	int r_error;
-	unsigned long r_elapsed;		/* Start time while in-flight, elapsted time once complete */
-	struct bio *r_bio;			/* The I/O */
-	size_t r_count;				/* Total bytes */
-	atomic_t r_bio_count;			/* Atomic count */
-};
-
-
-/*
- * Transaction file contexts.
- */
-static ssize_t asmfs_svc_query_version(struct file *file, char *buf, size_t size);
-static ssize_t asmfs_svc_get_iid(struct file *file, char *buf, size_t size);
-static ssize_t asmfs_svc_check_iid(struct file *file, char *buf, size_t size);
-static ssize_t asmfs_svc_query_disk(struct file *file, char *buf, size_t size);
-static ssize_t asmfs_svc_open_disk(struct file *file, char *buf, size_t size);
-static ssize_t asmfs_svc_close_disk(struct file *file, char *buf, size_t size);
-static ssize_t asmfs_svc_io32(struct file *file, char *buf, size_t size);
-#if BITS_PER_LONG == 64
-static ssize_t asmfs_svc_io64(struct file *file, char *buf, size_t size);
-#endif
-
-static struct transaction_context trans_contexts[] = {
-	[ASMOP_QUERY_VERSION]		= {asmfs_svc_query_version},
-	[ASMOP_GET_IID]			= {asmfs_svc_get_iid},
-	[ASMOP_CHECK_IID]		= {asmfs_svc_check_iid},
-	[ASMOP_QUERY_DISK]		= {asmfs_svc_query_disk},
-	[ASMOP_OPEN_DISK]		= {asmfs_svc_open_disk},
-	[ASMOP_CLOSE_DISK]		= {asmfs_svc_close_disk},
-	[ASMOP_IO32]			= {asmfs_svc_io32},
-#if BITS_PER_LONG == 64
-	[ASMOP_IO64]			= {asmfs_svc_io64},
-#endif
-};
-
-static struct backing_dev_info memory_backing_dev_info = {
-	.ra_pages	= 0,	/* No readahead */
-#ifdef BACKING_DEV_CAPABILITIES
-	.capabilities   = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
-#else
-	.memory_backed	= 1,	/* Does not contribute to dirty memory */
-#endif  /* OLD_BACKING_DEV */
-};
-
-
-static struct inode *asmdisk_alloc_inode(struct super_block *sb)
-{
-	struct asm_disk_info *d = kmem_cache_alloc(asmdisk_cachep, GFP_KERNEL);
-	if (!d)
-		return NULL;
-
-	mlog(ML_DISK, "Allocated disk 0x%p\n", d);
-	return &d->vfs_inode;
-}
-
-static void asmdisk_destroy_inode(struct inode *inode)
-{
-	struct asm_disk_info *d = ASMDISK_I(inode);
-
-	mlog_bug_on_msg(atomic_read(&d->d_ios),
-			"Disk 0x%p has outstanding I/Os\n", d);
-
-	mlog_bug_on_msg(!list_empty(&d->d_open),
-			"Disk 0x%p has openers\n", d);
-
-	mlog(ML_DISK, "Destroying disk 0x%p\n", d);
-
-	kmem_cache_free(asmdisk_cachep, d);
-}
-
-static void init_asmdisk_once(void *foo)
-{
-	struct asm_disk_info *d = foo;
-
-	memset(d, 0, sizeof(*d));
-	INIT_LIST_HEAD(&d->d_open);
-
-	inode_init_once(&d->vfs_inode);
-}
-#ifndef kapi_init_asmdisk_once
-# define kapi_init_asmdisk_once init_asmdisk_once
-#endif
-
-static void asmdisk_clear_inode(struct inode *inode)
-{
-	struct asm_disk_info *d = ASMDISK_I(inode);
-
-	mlog_entry("(0x%p)\n", inode);
-
-	mlog_bug_on_msg(atomic_read(&d->d_ios),
-			"Disk 0x%p has outstanding I/Os\n", d);
-
-	mlog_bug_on_msg(!list_empty(&d->d_open),
-			"Disk 0x%p has openers\n", d);
-
-	mlog_bug_on_msg(d->d_live,
-			"Disk 0x%p is live\n", d);
-
-	mlog(ML_DISK, "Clearing disk 0x%p\n", d);
-
-	if (d->d_bdev) {
-		mlog(ML_DISK,
-		     "Releasing disk 0x%p (bdev 0x%p, dev %X)\n",
-		     d, d->d_bdev, d->d_bdev->bd_dev);
-		bd_release(d->d_bdev);
-		blkdev_put(d->d_bdev);
-		d->d_bdev = NULL;
-	}
-
-	mlog_exit_void();
-}
-
-
-static struct super_operations asmdisk_sops = {
-	.statfs			= simple_statfs,
-	.alloc_inode		= asmdisk_alloc_inode,
-	.destroy_inode		= asmdisk_destroy_inode,
-	.drop_inode		= generic_delete_inode,
-	.clear_inode		= asmdisk_clear_inode,
-};
-
-#ifdef GET_SB_HAS_VFSMOUNT
-static int asmdisk_get_sb(struct file_system_type *fs_type, int flags,
-			  const char *dev_name, void *data,
-			  struct vfsmount *mnt)
-{
-	return get_sb_pseudo(fs_type, "asmdisk:",
-			     &asmdisk_sops, 0x61736D64, mnt);
-}
-#else
-static struct super_block *asmdisk_get_sb(struct file_system_type *fs_type,
-					  int flags,
-					  const char *dev_name,
-					  void *data)
-{
-	return get_sb_pseudo(fs_type, "asmdisk:",
-			     &asmdisk_sops, 0x61736D64);
-}
-#endif
-
-static struct file_system_type asmdisk_type = {
-	.name		= "asmdisk",
-	.get_sb		= asmdisk_get_sb,
-	.kill_sb	= kill_anon_super,
-};
-
-static struct vfsmount *asmdisk_mnt;
-
-static int __init init_asmdiskcache(void)
-{
-	int err;
-	asmdisk_cachep =
-		kapi_kmem_cache_create("asmdisk_cache",
-				       sizeof(struct asm_disk_info),
-				       0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-				       kapi_init_asmdisk_once);
-	if (!asmdisk_cachep)
-		return -ENOMEM;
-	err = register_filesystem(&asmdisk_type);
-	if (err) {
-		kmem_cache_destroy(asmdisk_cachep);
-		return err;
-	}
-	asmdisk_mnt = kern_mount(&asmdisk_type);
-	if (IS_ERR(asmdisk_mnt)) {
-		err = PTR_ERR(asmdisk_mnt);
-		unregister_filesystem(&asmdisk_type);
-		kmem_cache_destroy(asmdisk_cachep);
-		return err;
-	}
-
-	return 0;
-}
-
-static void destroy_asmdiskcache(void)
-{
-	unregister_filesystem(&asmdisk_type);
-	mntput(asmdisk_mnt);
-	kmem_cache_destroy(asmdisk_cachep);
-}
-
-static int asmdisk_test(struct inode *inode, void *data)
-{
-	struct asmdisk_find_inode_args *args = data;
-	struct asm_disk_info *d = ASMDISK_I(inode);
-	unsigned long handle = (unsigned long)(d->d_bdev);
-
-	return (d->d_inode == args->fa_inode) && (handle == args->fa_handle);
-}
-
-static int asmdisk_set(struct inode *inode, void *data)
-{
-	struct asmdisk_find_inode_args *args = data;
-	struct asm_disk_info *d = ASMDISK_I(inode);
-
-	d->d_bdev = (struct block_device *)(args->fa_handle);
-	d->d_inode = args->fa_inode;
-
-	return 0;
-}
-
-
-
-/*
- * Resource limit helper functions
- */
-
-
-/* Decrements the free inode count and returns true, or returns false
- * if there are no free inodes */
-static struct inode *asmfs_alloc_inode(struct super_block *sb)
-{
-	struct asmfs_sb_info *asb = ASMFS_SB(sb);
-	struct asmfs_inode_info *aii;
-
-	aii = (struct asmfs_inode_info *)kmem_cache_alloc(asmfs_inode_cachep, GFP_KERNEL);
-
-	if (!aii)
-		return NULL;
-
-	spin_lock_irq(&asb->asmfs_lock);
-	if (!asb->max_inodes || asb->free_inodes > 0) {
-		asb->free_inodes--;
-		spin_unlock_irq(&asb->asmfs_lock);
-	} else {
-		spin_unlock_irq(&asb->asmfs_lock);
-		kmem_cache_free(asmfs_inode_cachep, aii);
-		return NULL;
-	}
-
-	return &aii->vfs_inode;
-}
-
-/* Increments the free inode count */
-static void asmfs_destroy_inode(struct inode *inode)
-{
-	spin_lock_irq(&ASMFS_SB(inode->i_sb)->asmfs_lock);
-	ASMFS_SB(inode->i_sb)->free_inodes++;
-	spin_unlock_irq(&ASMFS_SB(inode->i_sb)->asmfs_lock);
-
-	kmem_cache_free(asmfs_inode_cachep, ASMFS_I(inode));
-}
-
-static void instance_init_once(void *foo)
-{
-	struct asmfs_inode_info *aii = foo;
-
-	INIT_LIST_HEAD(&aii->i_disks);
-	INIT_LIST_HEAD(&aii->i_threads);
-	spin_lock_init(&aii->i_lock);
-
-	inode_init_once(&aii->vfs_inode);
-}
-#ifndef kapi_instance_init_once
-# define kapi_instance_init_once instance_init_once
-#endif
-
-static int init_inodecache(void)
-{
-	asmfs_inode_cachep =
-		kapi_kmem_cache_create("asmfs_inode_cache",
-				       sizeof(struct asmfs_inode_info),
-				       0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-				       kapi_instance_init_once);
-
-	if (asmfs_inode_cachep == NULL)
-		return -ENOMEM;
-	return 0;
-}
-
-static void destroy_inodecache(void)
-{
-	kmem_cache_destroy(asmfs_inode_cachep);
-}
-
-static int init_requestcache(void)
-{
-	asm_request_cachep =
-		kapi_kmem_cache_create("asm_request",
-				       sizeof(struct asm_request),
-				       0, SLAB_HWCACHE_ALIGN, NULL);
-	if (asm_request_cachep == NULL)
-		return -ENOMEM;
-	return 0;
-}
-
-static void destroy_requestcache(void)
-{
-	kmem_cache_destroy(asm_request_cachep);
-}
-
-
-/*
- * Disk file creation in the disks directory.
- */
-static int asmfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
-{
-	struct inode * inode;
-
-	if (!S_ISBLK(mode))
-		return -EINVAL;
-
-	inode = new_inode(dir->i_sb);
-	if (!inode)
-		return -ENOMEM;
-
-	inode->i_ino = (unsigned long)inode;
-	inode->i_mode = mode;
-	inode->i_uid = current->fsuid;
-	inode->i_gid = current->fsgid;
-	set_i_blksize(inode, PAGE_CACHE_SIZE);
-	inode->i_blocks = 0;
-	inode->i_rdev = 0;
-	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	init_special_inode(inode, mode, dev);
-
-	d_instantiate(dentry, inode);
-
-	/* Extra count - pin the dentry in core */
-	dget(dentry);
-
-	return 0;
-}
-
-/*
- * Instance file creation in the iid directory.
- */
-static int asmfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
-{
-	struct inode *inode;
-
-	if ((mode & S_IFMT) && !S_ISREG(mode))
-		return -EINVAL;
-
-	mode |= S_IFREG;
-
-	inode = new_inode(dir->i_sb);
-	if (!inode)
-		return -ENOMEM;
-
-	inode->i_ino = (unsigned long)inode;
-	inode->i_mode = mode;
-	inode->i_uid = current->fsuid;
-	inode->i_gid = current->fsgid;
-	set_i_blksize(inode, PAGE_CACHE_SIZE);
-	inode->i_blocks = 0;
-	inode->i_rdev = 0;
-	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->i_op = &asmfs_file_inode_operations;
-	inode->i_fop = &asmfs_file_operations;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-
-	d_instantiate(dentry, inode);
-
-	/* Extra count - pin the dentry in core */
-	dget(dentry);
-
-	return 0;
-}
-
-static void asmfs_put_super(struct super_block *sb)
-{
-	kfree(ASMFS_SB(sb));
-}
-
-enum {
-	OPT_MAX_INSTANCES,
-	OPT_ERR,
-};
-
-static match_table_t tokens = {
-	{OPT_MAX_INSTANCES, "maxinstances=%d"},
-	{OPT_ERR, NULL},
-};
-
-struct asmfs_params {
-	long inodes;
-};
-
-static int parse_options(char * options, struct asmfs_params *p)
-{
-	char *s;
-	substring_t args[MAX_OPT_ARGS];
-	int option;
-
-	p->inodes = -1;
-
-	while ((s = strsep(&options,",")) != NULL) {
-		int token;
-		if (!*s)
-			continue;
-		token = match_token(s, tokens, args);
-		switch (token) {
-			case OPT_MAX_INSTANCES:
-				if (match_int(&args[0], &option))
-					return -EINVAL;
-				p->inodes = option;
-				break;
-
-			default:
-				return -EINVAL;
-		}
-	}
-
-	return 0;
-}
-
-static void init_limits(struct asmfs_sb_info *asb, struct asmfs_params *p)
-{
-	struct sysinfo si;
-
-	si_meminfo(&si);
-
-	asb->max_inodes = 0;
-	if (p->inodes >= 0)
-		asb->max_inodes = p->inodes;
-
-	asb->free_inodes = asb->max_inodes;
-
-	return;
-}
-
-/* reset_limits is called during a remount to change the usage limits.
-
-   This will suceed, even if the new limits are lower than current
-   usage. This is the intended behaviour - new allocations will fail
-   until usage falls below the new limit */
-static void reset_limits(struct asmfs_sb_info *asb, struct asmfs_params *p)
-{
-	spin_lock_irq(&asb->asmfs_lock);
-
-	if (p->inodes >= 0) {
-		int used_inodes = asb->max_inodes - asb->free_inodes;
-
-		asb->max_inodes = p->inodes;
-		asb->free_inodes = asb->max_inodes - used_inodes;
-	}
-
-	spin_unlock_irq(&asb->asmfs_lock);
-}
-
-static int asmfs_remount(struct super_block * sb, int * flags, char * data)
-{
-	struct asmfs_params params;
-	struct asmfs_sb_info * asb = ASMFS_SB(sb);
-
-	if (parse_options((char *)data, &params) != 0)
-		return -EINVAL;
-
-	reset_limits(asb, &params);
-
-	printk(KERN_DEBUG
- 	       "ASM: oracleasmfs remounted with options: %s\n", 
-	       data ? (char *)data : "<defaults>" );
-	printk(KERN_DEBUG "ASM:	maxinstances=%ld\n",
-	       asb->max_inodes);
-
-	return 0;
-}
-
-/*
- * Compute the maximum number of sectors the bdev can handle in one bio,
- * as a power of two.
- */
-static int compute_max_sectors(struct block_device *bdev)
-{
-	int max_pages, max_sectors, pow_two_sectors;
-
-	struct request_queue *q;
-
-	q = bdev_get_queue(bdev);
-	max_pages = q->max_sectors >> (PAGE_SHIFT - 9);
-	if (max_pages > BIO_MAX_PAGES)
-		max_pages = BIO_MAX_PAGES;
-	if (max_pages > q->max_phys_segments)
-		max_pages = q->max_phys_segments;
-	if (max_pages > q->max_hw_segments)
-		max_pages = q->max_hw_segments;
-	max_pages--; /* Handle I/Os that straddle a page */
-
-	max_sectors = max_pages << (PAGE_SHIFT - 9);
-
-	/* Why is fls() 1-based???? */
-	pow_two_sectors = 1 << (fls(max_sectors) - 1);
-
-	return pow_two_sectors;
-}
-
-static int asm_open_disk(struct file *file, struct block_device *bdev)
-{
-	int ret;
-	struct asm_disk_info *d;
-	struct asm_disk_head *h;
-	struct inode *inode = ASMFS_F2I(file);
-	struct inode *disk_inode;
-	struct asmdisk_find_inode_args args;
-
-	mlog_entry("(0x%p, 0x%p)\n", file, bdev);
-
-	ret = blkdev_get(bdev, FMODE_WRITE | FMODE_READ, 0);
-	if (ret)
-		goto out;
-
-	ret = bd_claim(bdev, inode->i_sb);
-	if (ret)
-		goto out_get;
-
-	ret = set_blocksize(bdev, bdev_hardsect_size(bdev));
-	if (ret)
-		goto out_claim;
-
-	ret = -ENOMEM;
-	h = kmalloc(sizeof(struct asm_disk_head), GFP_KERNEL);
-	if (!h)
-		goto out_claim;
-
-	mlog(ML_DISK, "Looking up disk for bdev %p (dev %X)\n", bdev,
-	     bdev->bd_dev);
-
-	args.fa_handle = (unsigned long)bdev;
-	args.fa_inode = ASMFS_I(inode);
-	disk_inode = iget5_locked(asmdisk_mnt->mnt_sb,
-				  (unsigned long)bdev, asmdisk_test,
-				  asmdisk_set, &args);
-	if (!disk_inode)
-		goto out_head;
-
-	d = ASMDISK_I(disk_inode);
-
-	if (disk_inode->i_state & I_NEW) {
-		mlog_bug_on_msg(atomic_read(&d->d_ios) != 0,
-				"Supposedly new disk 0x%p (dev %X) has outstanding I/O\n",
-				d, bdev->bd_dev);
-		mlog_bug_on_msg(d->d_live,
-				"Supposedly new disk 0x%p (dev %X) is live\n",
-				d, bdev->bd_dev);
-
-		mlog_bug_on_msg(d->d_bdev != bdev,
-				"New disk 0x%p has set bdev 0x%p but we were opening 0x%p\n",
-				d, d->d_bdev, bdev);
-
-		disk_inode->i_mapping->backing_dev_info =
-			&memory_backing_dev_info;
-		d->d_max_sectors = compute_max_sectors(bdev);
-		d->d_live = 1;
-
-		mlog(ML_DISK,
-		     "First open of disk 0x%p (bdev 0x%p, dev %X)\n",
-		     d, d->d_bdev, d->d_bdev->bd_dev);
-		unlock_new_inode(disk_inode);
-	} else {
-		/* Already claimed on first open */
-		mlog(ML_DISK,
-		     "Open of disk 0x%p (bdev 0x%p, dev %X)\n",
-		     d, d->d_bdev, d->d_bdev->bd_dev);
-		bd_release(bdev);
-		blkdev_put(bdev);
-	}
-
-	h->h_disk = d;
-	h->h_file = ASMFS_FILE(file);
-
-	spin_lock_irq(&ASMFS_FILE(file)->f_lock);
-	list_add(&h->h_flist, &ASMFS_FILE(file)->f_disks);
-	spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
-
-	spin_lock_irq(&ASMFS_I(inode)->i_lock);
-	list_add(&h->h_dlist, &d->d_open);
-	spin_unlock_irq(&ASMFS_I(inode)->i_lock);
-
-	mlog_exit(0);
-	return 0;
-
-out_head:
-	kfree(h);
-
-out_claim:
-	bd_release(bdev);
-
-out_get:
-	blkdev_put(bdev);
-
-out:
-	mlog_exit(ret);
-	return ret;
-}
-
-static int asm_close_disk(struct file *file, unsigned long handle)
-{
-	struct inode *inode = ASMFS_F2I(file);
-	struct asmdisk_find_inode_args args;
-	struct asm_disk_info *d;
-	struct block_device *bdev;
-	struct inode *disk_inode;
-	struct list_head *p;
-	struct asm_disk_head *h;
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-
-	mlog_entry("(0x%p, %lu)\n", file, handle);
-
-	mlog_bug_on_msg(!ASMFS_FILE(file) || !ASMFS_I(inode),
-			"Garbage arguments\n");
-
-	args.fa_handle = handle;
-	args.fa_inode = ASMFS_I(inode);
-	disk_inode = ilookup5(asmdisk_mnt->mnt_sb, handle,
-			      asmdisk_test, &args);
-	if (!disk_inode) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	d = ASMDISK_I(disk_inode);
-	bdev = d->d_bdev;
-
-	mlog(ML_DISK, "Closing disk 0x%p (bdev 0x%p, dev %X)\n",
-	     d, d->d_bdev, d->d_bdev->bd_dev);
-
-	/*
-	 * If an additional thread raced us to close the disk, it
-	 * will have removed the disk from the list already.
-	 */
-	
-	spin_lock_irq(&ASMFS_FILE(file)->f_lock);
-	h = NULL;
-	list_for_each(p, &ASMFS_FILE(file)->f_disks) {
-		h = list_entry(p, struct asm_disk_head, h_flist);
-		if (h->h_disk == d)
-			break;
-		h = NULL;
-	}
-	if (!h) {
-		spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
-		iput(disk_inode);
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-	list_del(&h->h_flist);
-	spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
-
-	spin_lock_irq(&ASMFS_I(inode)->i_lock);
-	list_del(&h->h_dlist);
-
-	/* Last close */
-	if (list_empty(&d->d_open)) {
-		mlog(ML_DISK,
-		     "Last close of disk 0x%p (bdev 0x%p, dev %X)\n",
-		     d, d->d_bdev, d->d_bdev->bd_dev);
-
-		/* I/O path can't look up this disk anymore */
-		mlog_bug_on_msg(!d->d_live,
-				"Disk 0x%p (bdev 0x%p, dev %X) isn't live at last close\n",
-				d, d->d_bdev, d->d_bdev->bd_dev);
-		d->d_live = 0;
-		spin_unlock_irq(&ASMFS_I(inode)->i_lock);
-
-		/* No need for a fast path */
-		add_wait_queue(&ASMFS_FILE(file)->f_wait, &wait);
-		do {
-			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-
-			if (!atomic_read(&d->d_ios))
-				break;
-
-			blk_run_address_space(bdev->bd_inode->i_mapping);
-			/*
-			 * Timeout of one second.  This is slightly
-			 * subtle.  In this wait, and *only* this wait,
-			 * we are waiting on I/Os that might have been
-			 * initiated by another process.  In that case,
-			 * the other process's afi will be signaled,
-			 * not ours, so the wake_up() never happens
-			 * here and we need the timeout.
-			 */
-#if 0  /* Damn you, kernel */
-			io_schedule_timeout(HZ);
-#else
-			schedule_timeout(HZ);
-#endif
-		} while (1);
-		set_task_state(tsk, TASK_RUNNING);
-		remove_wait_queue(&ASMFS_FILE(file)->f_wait, &wait);
-	}
-	else
-		spin_unlock_irq(&ASMFS_I(inode)->i_lock);
-
-	kfree(h);
-
-	/* Drop the ref from ilookup5() */
-	iput(disk_inode);
-
-	/* Real put */
-	iput(disk_inode);
-
-	mlog_exit(0);
-	return 0;
-}  /* asm_close_disk() */
-
-
-/* Timeout stuff ripped from aio.c - thanks Ben */
-struct timeout {
-	struct timer_list	timer;
-	int			timed_out;
-	wait_queue_head_t	wait;
-};
-
-static void timeout_func(unsigned long data)
-{
-	struct timeout *to = (struct timeout *)data;
-
-	to->timed_out = 1;
-	wake_up(&to->wait);
-}
-
-static inline void init_timeout(struct timeout *to)
-{
-	init_timer(&to->timer);
-	to->timer.data = (unsigned long)to;
-	to->timer.function = timeout_func;
-	to->timed_out = 0;
-	init_waitqueue_head(&to->wait);
-}
-
-static inline void set_timeout(struct timeout *to, const struct timespec *ts)
-{
-	unsigned long how_long;
-
-	if (!ts->tv_sec && !ts->tv_nsec) {
-		to->timed_out = 1;
-		return;
-	}
-
-	how_long = ts->tv_sec * HZ;
-#define HZ_NS (1000000000 / HZ)
-	how_long += (ts->tv_nsec + HZ_NS - 1) / HZ_NS;
-	
-	to->timer.expires = jiffies + how_long;
-	add_timer(&to->timer);
-}
-
-static inline void clear_timeout(struct timeout *to)
-{
-	del_timer_sync(&to->timer);
-}
-
-/* Must be called with asm_file_info->f_lock held */
-static struct block_device *find_io_bdev(struct file *file)
-{
-	struct asmfs_file_info *afi = ASMFS_FILE(file);
-	struct asm_request *r;
-	struct asm_disk_info *d;
-	struct block_device *bdev = NULL;
-
-	list_for_each_entry(r, &afi->f_ios, r_list) {
-		d = r->r_disk;
-		if (d && d->d_bdev) {
-			bdev = d->d_bdev;
-			break;
-		}
-	}
-
-	return bdev;
-}
-
-static int asm_update_user_ioc(struct file *file, struct asm_request *r)
-{
-	int ret = 0;
-	struct asm_request copy;
-	asm_ioc __user *ioc;
-	u16 tmp_status;
-	unsigned long flags;
-
-	mlog_entry("(0x%p)\n", r);
-
-	ioc = r->r_ioc;
-	mlog(ML_IOC, "User IOC is 0x%p\n", ioc);
-
-	/* Need to get the current userspace bits because ASM_CANCELLED is currently set there */
-	mlog(ML_IOC, "Getting tmp_status\n");
-	if (get_user(tmp_status, &(ioc->status_asm_ioc))) {
-		ret = -EFAULT;
-		goto out;
-	}
-
-	/*
-	 * We're going to store off a copy of the request so we can
-	 * provide a consistent view to userspace.
-	 *
-	 * And so we can get/put_user() without locking :-)
-	 */
-	spin_lock_irqsave(&ASMFS_FILE(file)->f_lock, flags);
-	r->r_status |= tmp_status;
-	copy = *r;
-	spin_unlock_irqrestore(&ASMFS_FILE(file)->f_lock, flags);
-
-	/* From here on, ONLY TRUST copy */
-
-	mlog(ML_IOC, "Putting r_status (0x%08X)\n", copy.r_status);
-	if (put_user(copy.r_status, &(ioc->status_asm_ioc))) {
-		ret = -EFAULT;
-		goto out;
-	}
-	if (copy.r_status & ASM_ERROR) {
-		mlog(ML_IOC, "Putting r_error (0x%08X)\n", copy.r_error);
-		if (put_user(copy.r_error, &(ioc->error_asm_ioc))) {
-			ret = -EFAULT;
-			goto out;
-		}
-	}
-	if (copy.r_status & ASM_COMPLETED) {
-		if (put_user(copy.r_elapsed, &(ioc->elaptime_asm_ioc))) {
-			ret = -EFAULT;
-			goto out;
-		}
-	}
-	mlog(ML_IOC,
-	     "r_status:0x%08X, bitmask:0x%08X, combined:0x%08X\n",
-	     copy.r_status,
-	     (ASM_SUBMITTED | ASM_COMPLETED | ASM_ERROR),
-	     (copy.r_status & (ASM_SUBMITTED | ASM_COMPLETED | ASM_ERROR)));
-	if (copy.r_status & ASM_FREE) {
-		u64 z = 0ULL;
-		if (copy_to_user(&(ioc->reserved_asm_ioc),
-				 &z, sizeof(ioc->reserved_asm_ioc))) {
-			ret = -EFAULT;
-			goto out;
-		}
-	} else if (copy.r_status &
-		   (ASM_SUBMITTED | ASM_ERROR)) {
-		u64 key = (u64)(unsigned long)r;
-		mlog(ML_IOC, "Putting key 0x%p on asm_ioc 0x%p\n",
-		     r, ioc);
-		/* Only on first submit */
-		if (copy_to_user(&(ioc->reserved_asm_ioc),
-				 &key, sizeof(ioc->reserved_asm_ioc))) {
-			ret = -EFAULT;
-			goto out;
-		}
-	}
-
-out:
-	mlog_exit(ret);
-	return ret;
-}  /* asm_update_user_ioc() */
-
-
-static struct asm_request *asm_request_alloc(void)
-{
-	struct asm_request *r;
-
-	r = kmem_cache_alloc(asm_request_cachep, GFP_KERNEL);
-	
-	if (r) {
-		r->r_status = ASM_SUBMITTED;
-		r->r_error = 0;
-		r->r_bio = NULL;
-		r->r_elapsed = 0;
-		r->r_disk = NULL;
-	}
-
-	return r;
-}  /* asm_request_alloc() */
-
-
-static void asm_request_free(struct asm_request *r)
-{
-	/* FIXME: Clean up bh and buffer stuff */
-
-	kmem_cache_free(asm_request_cachep, r);
-}  /* asm_request_free() */
-
-
-static void asm_finish_io(struct asm_request *r)
-{
-	struct asm_disk_info *d;
-	struct asmfs_file_info *afi = r->r_file;
-	unsigned long flags;
-
-	mlog_bug_on_msg(!afi, "Request 0x%p has no file pointer\n", r);
-
-	mlog_entry("(0x%p)\n", r);
-
-	spin_lock_irqsave(&afi->f_lock, flags);
-
-	if (r->r_bio) {
-		mlog(ML_REQUEST|ML_BIO,
-		     "Moving bio 0x%p from request 0x%p to the free list\n",
-		     r->r_bio, r);
-		r->r_bio->bi_private = afi->f_bio_free;
-		afi->f_bio_free = r->r_bio;
-		r->r_bio = NULL;
-	}
-
- 	d = r->r_disk;
-	r->r_disk = NULL;
-
-	list_del(&r->r_list);
-	list_add(&r->r_list, &afi->f_complete);
-	if (r->r_error)
-		r->r_status |= ASM_ERROR;
-	r->r_status |= ASM_COMPLETED;
-
-	spin_unlock_irqrestore(&afi->f_lock, flags);
-
-	if (d) {
-		atomic_dec(&d->d_ios);
-		if (atomic_read(&d->d_ios) < 0) {
-			mlog(ML_ERROR,
-			     "d_ios underflow on disk 0x%p (dev %X)\n",
-			     d, d->d_bdev->bd_dev);
-			atomic_set(&d->d_ios, 0);
-		}
-	}
-
-	r->r_elapsed = ((jiffies - r->r_elapsed) * 1000000) / HZ;
-
-	mlog(ML_REQUEST, "Finished request 0x%p\n", r);
-
-	wake_up(&afi->f_wait);
-
-	mlog_exit_void();
-}  /* asm_finish_io() */
-
-
-static void asm_end_ioc(struct asm_request *r, unsigned int bytes_done,
-			int error)
-{
-	mlog_entry("(0x%p, %u, %d)\n", r, bytes_done, error);
-
-	mlog_bug_on_msg(!r, "No request\n");
-
-	mlog_bug_on_msg(!(r->r_status & ASM_SUBMITTED),
-			"Request 0x%p wasn't submitted\n", r);
-
-	mlog(ML_REQUEST,
-	     "Ending request 0x%p, bytes_done = %u, error = %d\n",
-	     r, bytes_done, error);
-	mlog(ML_REQUEST|ML_BIO,
-	     "Ending request 0x%p, bio 0x%p, len = %u\n",
-	     r, r->r_bio,
-	     bytes_done + (r->r_bio ? r->r_bio->bi_size : 0));
-
-	switch (error) {
-		default:
-			mlog(ML_REQUEST|ML_ERROR,
-			     "Invalid error of %d on request 0x%p!\n",
-			     error, r);
-			r->r_error = ASM_ERR_INVAL;
-			r->r_status |= ASM_LOCAL_ERROR;
-			break;
-
-		case 0:
-			break;
-
-		case -EFAULT:
-			r->r_error = ASM_ERR_FAULT;
-			r->r_status |= ASM_LOCAL_ERROR;
-			break;
-
-		case -EIO:
-			r->r_error = ASM_ERR_IO;
-			break;
-
-		case -ENODEV:
-			r->r_error = ASM_ERR_NODEV;
-			r->r_status |= ASM_LOCAL_ERROR;
-			break;
-
-		case -ENOMEM:
-			r->r_error = ASM_ERR_NOMEM;
-			r->r_status |= ASM_LOCAL_ERROR;
-			break;
-
-		case -EINVAL:
-			r->r_error = ASM_ERR_INVAL;
-			r->r_status |= ASM_LOCAL_ERROR;
-			break;
-	}
-
-	asm_finish_io(r);
-
-	mlog_exit_void();
-}  /* asm_end_ioc() */
-
-
-static void asm_end_bio_io(struct bio *bio, int error)
-{
-	struct asm_request *r;
-
-	mlog_entry("(0x%p, %d)\n", bio, error);
-
-	mlog(ML_BIO, "bio 0x%p, bi_size is %u\n", bio, bio->bi_size);
-
-	r = bio->bi_private;
-
-	mlog(ML_REQUEST|ML_BIO,
-	     "Completed bio 0x%p for request 0x%p\n", bio, r);
-	if (atomic_dec_and_test(&r->r_bio_count)) {
-		asm_end_ioc(r, r->r_count - (r->r_bio ?
-					     r->r_bio->bi_size : 0),
-			    error);
-	}
-
-	mlog_exit_void();
-}  /* asm_end_bio_io() */
-#ifndef kapi_asm_end_bio_io
-# define kapi_asm_end_bio_io asm_end_bio_io
-#endif
-
-
-static int asm_submit_io(struct file *file,
-			 asm_ioc __user *user_iocp,
-			 asm_ioc *ioc)
-{
-	int ret, rw = READ;
-	struct inode *inode = ASMFS_F2I(file);
-	struct asmdisk_find_inode_args args;
-	struct asm_request *r;
-	struct asm_disk_info *d;
-	struct inode *disk_inode;
-	struct block_device *bdev;
-
-	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, user_iocp, ioc);
-
-	if (!ioc) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	if (ioc->status_asm_ioc) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	r = asm_request_alloc();
-	if (!r) {
-		u16 status = ASM_FREE | ASM_ERROR | ASM_LOCAL_ERROR |
-			ASM_BUSY;
-		if (put_user(status, &(user_iocp->status_asm_ioc))) {
-			mlog_exit(-EFAULT);
-			return -EFAULT;
-		}
-		if (put_user(ASM_ERR_NOMEM, &(user_iocp->error_asm_ioc))) {
-			mlog_exit(-EFAULT);
-			return -EFAULT;
-		}
-
-		mlog_exit(0);
-		return 0;
-	}
-
-	mlog(ML_REQUEST,
-	     "New request at 0x%p alloc()ed for user ioc at 0x%p\n",
-	     r, user_iocp);
-
-	r->r_file = ASMFS_FILE(file);
-	r->r_ioc = user_iocp;  /* Userspace asm_ioc */
-
-	spin_lock_irq(&ASMFS_FILE(file)->f_lock);
-	list_add(&r->r_list, &ASMFS_FILE(file)->f_ios);
-	spin_unlock_irq(&ASMFS_FILE(file)->f_lock);
-
-	ret = -ENODEV;
-	args.fa_handle = (unsigned long)ioc->disk_asm_ioc;
-	args.fa_inode = ASMFS_I(inode);
-	disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
-			      (unsigned long)ioc->disk_asm_ioc,
-			      asmdisk_test, &args);
-	if (!disk_inode)
-		goto out_error;
-
-	spin_lock_irq(&ASMFS_I(inode)->i_lock);
-
-	d = ASMDISK_I(disk_inode);
-	if (!d->d_live) {
-		/* It's in the middle of closing */
-		spin_unlock_irq(&ASMFS_I(inode)->i_lock);
-		iput(disk_inode);
-		goto out_error;
-	}
-
-	atomic_inc(&d->d_ios);
-	r->r_disk = d;
-
-	spin_unlock_irq(&ASMFS_I(inode)->i_lock);
-	iput(disk_inode);
-
-	bdev = d->d_bdev;
-
-	r->r_count = ioc->rcount_asm_ioc * bdev_hardsect_size(bdev);
-
-	/* linux only supports unsigned long size sector numbers */
-	mlog(ML_IOC,
-	     "user_iocp 0x%p: first = 0x%llX, masked = 0x%08lX status = %u, buffer_asm_ioc = 0x%08lX, count = %lu\n",
-	     user_iocp,
-	     (unsigned long long)ioc->first_asm_ioc,
-	     (unsigned long)ioc->first_asm_ioc,
-	     ioc->status_asm_ioc,
-	     (unsigned long)ioc->buffer_asm_ioc,
-	     (unsigned long)r->r_count);
-	/* Note that priority is ignored for now */
-	ret = -EINVAL;
-	if (!ioc->buffer_asm_ioc ||
-	    (ioc->buffer_asm_ioc != (unsigned long)ioc->buffer_asm_ioc) ||
-	    (ioc->first_asm_ioc != (unsigned long)ioc->first_asm_ioc) ||
-	    (ioc->rcount_asm_ioc != (unsigned long)ioc->rcount_asm_ioc) ||
-	    (ioc->priority_asm_ioc > 7) ||
-	    (r->r_count > (bdev_get_queue(bdev)->max_sectors << 9)) ||
-	    (r->r_count < 0))
-		goto out_error;
-
-	/* Test device size, when known. (massaged from ll_rw_blk.c) */
-	if (bdev->bd_inode->i_size >> 9) {
-		sector_t maxsector = bdev->bd_inode->i_size >> 9;
-		sector_t sector = (sector_t)ioc->first_asm_ioc;
-		sector_t blks = (sector_t)ioc->rcount_asm_ioc;
-
-		if (maxsector < blks || maxsector - blks < sector) {
-			char b[BDEVNAME_SIZE];
-			mlog(ML_NOTICE|ML_IOC,
-			     "Attempt to access beyond end of device\n");
-			mlog(ML_NOTICE|ML_IOC,
-			     "dev %s: want=%llu, limit=%llu\n",
-			     bdevname(bdev, b),
-			     (unsigned long long)(sector + blks),
-			     (unsigned long long)maxsector);
-			goto out_error;
-		}
-	}
-
-
-	mlog(ML_REQUEST|ML_IOC,
-	     "Request 0x%p (user_ioc 0x%p) passed validation checks\n",
-	     r, user_iocp);
-
-	switch (ioc->operation_asm_ioc) {
-		default:
-			goto out_error;
-			break;
-
-		case ASM_READ:
-			rw = READ;
-			break;
-
-		case ASM_WRITE:
-			rw = WRITE;
-			break;
-
-		case ASM_NOOP:
-			/* Trigger an errorless completion */
-			r->r_count = 0;
-			break;
-	}
-	
-	/* Not really an error, but hey, it's an end_io call */
-	ret = 0;
-	if (r->r_count == 0)
-		goto out_error;
-
-	ret = -ENOMEM;
-	r->r_bio = bio_map_user(bdev_get_queue(bdev), bdev,
-				(unsigned long)ioc->buffer_asm_ioc,
-				r->r_count, rw == READ);
-	if (IS_ERR(r->r_bio)) {
-		ret = PTR_ERR(r->r_bio);
-		r->r_bio = NULL;
-		goto out_error;
-	}
-	mlog(ML_BIO, "Mapped bio 0x%p to request 0x%p\n", r->r_bio, r);
-
-	r->r_bio->bi_sector =
-		ioc->first_asm_ioc * (bdev_hardsect_size(bdev) >> 9);
-
-	/*
-	 * If the bio is a bounced bio, we have to put the
-	 * end_io on the child "real" bio
-	 */
-	r->r_bio->bi_end_io = kapi_asm_end_bio_io;
-	r->r_bio->bi_private = r;
-
-	r->r_elapsed = jiffies;  /* Set start time */
-
-	atomic_set(&r->r_bio_count, 1);
-
-	mlog(ML_REQUEST|ML_BIO,
-	     "Submitting bio 0x%p for request 0x%p\n", r->r_bio, r);
-	submit_bio(rw, r->r_bio);
-
-out:
-	ret = asm_update_user_ioc(file, r);
-
-	mlog_exit(ret);
-	return ret;
-
-out_error:
-	mlog(ML_REQUEST, "Submit-side error %d for request 0x%p\n",
-	     ret,  r);
-	asm_end_ioc(r, 0, ret);
-	goto out;
-}  /* asm_submit_io() */
-
-
-static int asm_maybe_wait_io(struct file *file,
-			     asm_ioc *iocp,
-			     struct timeout *to)
-{
-	long ret;
-	u64 p;
-	struct asmfs_file_info *afi = ASMFS_FILE(file);
-	struct asmdisk_find_inode_args args;
-	struct asm_request *r;
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-	DECLARE_WAITQUEUE(to_wait, tsk);
-
-	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, iocp, to);
-	
-	if (copy_from_user(&p, &(iocp->reserved_asm_ioc),
-			   sizeof(p))) {
-		ret = -EFAULT;
-		goto out;
-	}
-
-	mlog(ML_REQUEST|ML_IOC, "User asm_ioc 0x%p has key 0x%p\n",
-	     iocp, (struct asm_request *)(unsigned long)p);
-	r = (struct asm_request *)(unsigned long)p;
-	if (!r) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	spin_lock_irq(&afi->f_lock);
-	/* Is it valid? It's surely ugly */
-	if (!r->r_file || (r->r_file != afi) ||
-	    list_empty(&r->r_list) || !(r->r_status & ASM_SUBMITTED)) {
-		spin_unlock_irq(&afi->f_lock);
-		ret = -EINVAL;
-		goto out;
-	}
-
-	mlog(ML_REQUEST|ML_IOC,
-	     "asm_request 0x%p is valid...we think\n", r);
-	if (!(r->r_status & (ASM_COMPLETED |
-			     ASM_BUSY | ASM_ERROR))) {
-		spin_unlock_irq(&afi->f_lock);
-		add_wait_queue(&afi->f_wait, &wait);
-		add_wait_queue(&to->wait, &to_wait);
-		do {
-			struct asm_disk_info *d;
-			struct block_device *bdev = NULL;
-			struct inode *disk_inode;
-
-			ret = 0;
-			set_task_state(tsk, TASK_INTERRUPTIBLE);
-
-			spin_lock_irq(&afi->f_lock);
-			if (r->r_status & (ASM_COMPLETED |
-					   ASM_BUSY | ASM_ERROR))
-				break;
-			d = r->r_disk;
-			if (d && d->d_bdev)
-				bdev = d->d_bdev;
-			spin_unlock_irq(&afi->f_lock);
-
-			args.fa_handle = (unsigned long)bdev;
-			args.fa_inode = ASMFS_I(ASMFS_F2I(file));
-			disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
-					      (unsigned long)bdev,
-					      asmdisk_test, &args);
-			if (disk_inode) {
-				d = ASMDISK_I(disk_inode);
-				if (d->d_bdev)
-					blk_run_address_space(d->d_bdev->bd_inode->i_mapping);
-				iput(&d->vfs_inode);
-			}
-
-			ret = -ETIMEDOUT;
-			if (to->timed_out)
-				break;
-			io_schedule();
-			if (signal_pending(tsk)) {
-				mlog(ML_REQUEST,
-				     "Signal pending waiting for request 0x%p\n",
-				     r);
-				ret = -EINTR;
-				break;
-			}
-		} while (1);
-		set_task_state(tsk, TASK_RUNNING);
-		remove_wait_queue(&afi->f_wait, &wait);
-		remove_wait_queue(&to->wait, &to_wait);
-		
-		if (ret)
-			goto out;
-	}
-
-	ret = 0;
-
-	/* Somebody got here first */
-	/*
-	 * FIXME: This race means that we cannot be shared by two
-	 * threads/processes (this struct file).  If everyone does
-	 * their own open and gets their own struct file, this never
-	 * happens and we're safe.
-	 */
-	if (r->r_status & ASM_FREE)
-		goto out;  /* FIXME: Eek, holding lock */
-	mlog_bug_on_msg(list_empty(&afi->f_complete),
-			"Completion list is empty\n");
-
-	mlog(ML_REQUEST|ML_IOC,
-	     "Removing request 0x%p for asm_ioc 0x%p\n", r, iocp);
-	list_del_init(&r->r_list);
-	r->r_file = NULL;
-	r->r_status |= ASM_FREE;
-
-	spin_unlock_irq(&afi->f_lock);
-
-	ret = asm_update_user_ioc(file, r);
-
-	mlog(ML_REQUEST, "Freeing request 0x%p\n", r);
-	asm_request_free(r);
-
-out:
-	mlog_exit(ret);
-	return ret;
-}  /* asm_maybe_wait_io() */
-
-
-static int asm_complete_io(struct file *file,
-			   asm_ioc **ioc)
-{
-	int ret = 0;
-	struct list_head *l;
-	struct asm_request *r;
-	struct asmfs_file_info *afi = ASMFS_FILE(file);
-
-	mlog_entry("(0x%p, 0x%p)\n", file, ioc);
-
-	spin_lock_irq(&afi->f_lock);
-
-	if (list_empty(&afi->f_complete)) {
-		spin_unlock_irq(&afi->f_lock);
-		*ioc = NULL;
-		mlog_exit(0);
-		return 0;
-	}
-
-	l = afi->f_complete.prev;
-	r = list_entry(l, struct asm_request, r_list);
-	list_del_init(&r->r_list);
-	r->r_file = NULL;
-	r->r_status |= ASM_FREE;
-
-	spin_unlock_irq(&afi->f_lock);
-
-	*ioc = r->r_ioc;
-	
-	ret = asm_update_user_ioc(file, r);
-
-	asm_request_free(r);
-
-	mlog_exit(ret);
-	return ret;
-}  /* asm_complete_io() */
-
-
-static int asm_wait_completion(struct file *file,
-			       struct oracleasm_io_v2 *io,
-			       struct timeout *to,
-			       u32 *status)
-{
-	int ret;
-	struct asmfs_file_info *afi = ASMFS_FILE(file);
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-	DECLARE_WAITQUEUE(to_wait, tsk);
-
-	mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", file, io, to, status);
-
-	/* Early check - expensive stuff follows */
-	ret = -ETIMEDOUT;
-	if (to->timed_out)
-		goto out;
-
-	spin_lock_irq(&afi->f_lock);
-	if (list_empty(&afi->f_ios) &&
-	    list_empty(&afi->f_complete)) {
-		/* No I/Os left */
-		spin_unlock_irq(&afi->f_lock);
-		ret = 0;
-		*status |= ASM_IO_IDLE;
-		goto out;
-	}
-	spin_unlock_irq(&afi->f_lock);
-
-	add_wait_queue(&afi->f_wait, &wait);
-	add_wait_queue(&to->wait, &to_wait);
-	do {
-		struct block_device *bdev;
-		struct asm_disk_info *d;
-		struct inode *disk_inode;
-		struct asmdisk_find_inode_args args;
-
-		ret = 0;
-		set_task_state(tsk, TASK_INTERRUPTIBLE);
-
-		spin_lock_irq(&afi->f_lock);
-		if (!list_empty(&afi->f_complete)) {
-			spin_unlock_irq(&afi->f_lock);
-			break;
-		}
-
-		bdev = find_io_bdev(file);
-		spin_unlock_irq(&afi->f_lock);
-
-		args.fa_handle = (unsigned long)bdev;
-		args.fa_inode = ASMFS_I(ASMFS_F2I(file));
-		disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
-				      (unsigned long)bdev,
-				      asmdisk_test, &args);
-		if (disk_inode) {
-			d = ASMDISK_I(disk_inode);
-			if (d->d_bdev)
-				blk_run_address_space(d->d_bdev->bd_inode->i_mapping);
-			iput(&d->vfs_inode);
-		}
-
-		ret = -ETIMEDOUT;
-		if (to->timed_out)
-			break;
-		io_schedule();
-		if (signal_pending(tsk)) {
-			ret = -EINTR;
-			break;
-		}
-	} while (1);
-	set_task_state(tsk, TASK_RUNNING);
-	remove_wait_queue(&afi->f_wait, &wait);
-	remove_wait_queue(&to->wait, &to_wait);
-
-out:
-	mlog_exit(ret);
-	return ret;
-}  /* asm_wait_completion() */
-
-
-static inline int asm_submit_io_native(struct file *file,
-       				       struct oracleasm_io_v2 *io)
-{
-	int ret = 0;
-	u32 i;
-	asm_ioc *iocp;
-	asm_ioc tmp;
-
-	mlog_entry("(0x%p, 0x%p)\n", file, io);
-	
-	for (i = 0; i < io->io_reqlen; i++) {
-		ret = -EFAULT;
-		if (get_user(iocp,
-			     ((asm_ioc **)((unsigned long)(io->io_requests))) + i))
-			break;
-
-		if (copy_from_user(&tmp, iocp, sizeof(tmp)))
-			break;
-
-		mlog(ML_IOC, "Submitting user asm_ioc 0x%p\n", iocp);
-		ret = asm_submit_io(file, iocp, &tmp);
-		if (ret)
-			break;
-	}
-
-	mlog_exit(ret);
-	return ret;
-}  /* asm_submit_io_native() */
-
-
-static inline int asm_maybe_wait_io_native(struct file *file,
-					   struct oracleasm_io_v2 *io,
-					   struct timeout *to)
-{
-	int ret = 0;
-	u32 i;
-	asm_ioc *iocp;
-
-	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, io, to);
-	
-	for (i = 0; i < io->io_waitlen; i++) {
-		if (get_user(iocp,
-			     ((asm_ioc **)((unsigned long)(io->io_waitreqs))) + i)) {
-			ret = -EFAULT;
-			break;
-		}
-
-		ret = asm_maybe_wait_io(file, iocp, to);
-		if (ret)
-			break;
-	}
-
-	mlog_exit(ret);
-	return ret;
-}  /* asm_maybe_wait_io_native() */
-
-
-static inline int asm_complete_ios_native(struct file *file,
-					  struct oracleasm_io_v2 *io,
-					  struct timeout *to,
-					  u32 *status)
-{
-	int ret = 0;
-	u32 i;
-	asm_ioc *iocp;
-
-	mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", file, io, to, status);
-
-	for (i = 0; i < io->io_complen; i++) {
-		ret = asm_complete_io(file, &iocp);
-		if (ret)
-			break;
-		if (iocp) {
-			ret = put_user(iocp,
-				       ((asm_ioc **)((unsigned long)(io->io_completions))) + i);
-			       if (ret)
-				   break;
-			continue;
-		}
-
-		/* We had waiters that are full */
-		if (*status & ASM_IO_WAITED)
-			break;
-
-		ret = asm_wait_completion(file, io, to, status);
-		if (ret)
-			break;
-		if (*status & ASM_IO_IDLE)
-			break;
-
-		i--; /* Reset this completion */
-
-	}
-
-	mlog_exit(ret ? ret : i);
-	return (ret ? ret : i);
-}  /* asm_complete_ios_native() */
-
-
-#if BITS_PER_LONG == 64
-static inline void asm_promote_64(asm_ioc64 *ioc)
-{
-	asm_ioc32 *ioc_32 = (asm_ioc32 *)ioc;
-
-	mlog_entry("(0x%p)\n", ioc);
-
-	/*
-	 * Promote the 32bit pointers at the end of the asm_ioc32
-	 * into the asm_ioc64.
-	 *
-	 * Promotion must be done from the tail backwards.
-	 */
-	mlog(ML_IOC, "Promoting (0x%X, 0x%X)\n",
-	     ioc_32->check_asm_ioc,
-	     ioc_32->buffer_asm_ioc);
-	ioc->check_asm_ioc = (u64)ioc_32->check_asm_ioc;
-	ioc->buffer_asm_ioc = (u64)ioc_32->buffer_asm_ioc;
-	mlog(ML_IOC, "Promoted to (0x%"MLFu64", 0x%"MLFu64")\n",
-	     ioc->check_asm_ioc,
-	     ioc->buffer_asm_ioc);
-
-	mlog_exit_void();
-}  /* asm_promote_64() */
-
-
-static inline int asm_submit_io_thunk(struct file *file,
-	       			      struct oracleasm_io_v2 *io)
-{
-	int ret = 0;
-	u32 i;
-	u32 iocp_32;
-	asm_ioc32 *iocp;
-	asm_ioc tmp;
-
-	mlog_entry("(0x%p, 0x%p)\n", file, io);
-
-	for (i = 0; i < io->io_reqlen; i++) {
-		ret = -EFAULT;
-		/*
-		 * io->io_requests is an asm_ioc32**, but the pointers
-		 * are 32bit pointers.
-		 */
-		if (get_user(iocp_32,
-			     ((u32 *)((unsigned long)(io->io_requests))) + i))
-			break;
-
-		iocp = (asm_ioc32 *)(unsigned long)iocp_32;
-
-		if (copy_from_user(&tmp, iocp, sizeof(*iocp)))
-			break;
-
-		asm_promote_64(&tmp);
-
-		mlog(ML_IOC, "Submitting user asm_ioc 0x%p\n", iocp);
-		ret = asm_submit_io(file, (asm_ioc *)iocp, &tmp);
-		if (ret)
-			break;
-	}
-
-	mlog_exit(ret);
-	return ret;
-}  /* asm_submit_io_thunk() */
-
-
-static inline int asm_maybe_wait_io_thunk(struct file *file,
-					  struct oracleasm_io_v2 *io,
-					  struct timeout *to)
-{
-	int ret = 0;
-	u32 i;
-	u32 iocp_32;
-	asm_ioc *iocp;
-
-	mlog_entry("(0x%p, 0x%p, 0x%p)\n", file, io, to);
-
-	for (i = 0; i < io->io_waitlen; i++) {
-		/*
-		 * io->io_waitreqs is an asm_ioc32**, but the pointers
-		 * are 32bit pointers.
-		 */
-		if (get_user(iocp_32,
-			     ((u32 *)((unsigned long)(io->io_waitreqs))) + i)) {
-			ret = -EFAULT;
-			break;
-		}
-
-		/* Remember, the this is pointing to 32bit userspace */
-		iocp = (asm_ioc *)(unsigned long)iocp_32;
-
-		ret = asm_maybe_wait_io(file, iocp, to);
-		if (ret)
-			break;
-	}
-
-	mlog_exit(ret);
-	return ret;
-}  /* asm_maybe_wait_io_thunk() */
-
-
-static inline int asm_complete_ios_thunk(struct file *file,
-					 struct oracleasm_io_v2 *io,
-					 struct timeout *to,
-					 u32 *status)
-{
-	int ret = 0;
-	u32 i;
-	u32 iocp_32;
-	asm_ioc *iocp;
-
-	mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", file, io, to, status);
-
-	for (i = 0; i < io->io_complen; i++) {
-		ret = asm_complete_io(file, &iocp);
-		if (ret)
-			break;
-		if (iocp) {
-			iocp_32 = (u32)(unsigned long)iocp;
-
-			ret = put_user(iocp_32,
-				       ((u32 *)((unsigned long)(io->io_completions))) + i);
-			       if (ret)
-				   break;
-			continue;
-		}
-
-		/* We had waiters that are full */
-		if (*status & ASM_IO_WAITED)
-			break;
-
-		ret = asm_wait_completion(file, io, to, status);
-		if (ret)
-			break;
-		if (*status & ASM_IO_IDLE)
-			break;
-
-		i--; /* Reset this completion */
-	}
-
-	mlog_exit(ret ? ret : i);
-	return (ret ? ret : i);
-}  /* asm_complete_ios_thunk() */
-
-#endif  /* BITS_PER_LONG == 64 */
-
-
-static int asm_do_io(struct file *file, struct oracleasm_io_v2 *io,
-		     int bpl)
-{
-	int ret = 0;
-	u32 status = 0;
-	struct timeout to;
-
-	mlog_entry("(0x%p, 0x%p, %d)\n", file, io, bpl);
-
-	init_timeout(&to);
-
-	if (io->io_timeout) {
-		struct timespec ts;
-
-		mlog(ML_ABI, "Passed timeout 0x%"MLFu64"\n",
-		     io->io_timeout);
-		ret = -EFAULT;
-		if (copy_from_user(&ts,
-				   (struct timespec *)(unsigned long)(io->io_timeout),
-				   sizeof(ts)))
-			goto out;
-
-		set_timeout(&to, &ts);
-		if (to.timed_out) {
-			io->io_timeout = (u64)0;
-			clear_timeout(&to);
-		}
-	}
-
-	ret = 0;
-	if (io->io_requests) {
-		mlog(ML_ABI,
-		     "oracleasm_io_v2 has requests; reqlen %d\n",
-		     io->io_reqlen);
-		ret = -EINVAL;
-		if (bpl == ASM_BPL_32)
-			ret = asm_submit_io_32(file, io);
-#if BITS_PER_LONG == 64
-		else if (bpl == ASM_BPL_64)
-			ret = asm_submit_io_64(file, io);
-#endif  /* BITS_PER_LONG == 64 */
-
-		if (ret)
-			goto out_to;
-	}
-
-	if (io->io_waitreqs) {
-		mlog(ML_ABI, "oracleasm_io_v2 has waits; waitlen %d\n",
-		     io->io_waitlen);
-		ret = -EINVAL;
-		if (bpl == ASM_BPL_32)
-			ret = asm_maybe_wait_io_32(file, io, &to);
-#if BITS_PER_LONG == 64
-		else if (bpl == ASM_BPL_64)
-			ret = asm_maybe_wait_io_64(file, io, &to);
-#endif  /* BITS_PER_LONG == 64 */
-
-		if (ret)
-			goto out_to;
-
-		status |= ASM_IO_WAITED;
-	}
-
-	if (io->io_completions) {
-		mlog(ML_ABI,
-		     "oracleasm_io_v2 has completes; complen %d\n",
-		     io->io_complen);
-		ret = -EINVAL;
-		if (bpl == ASM_BPL_32)
-			ret = asm_complete_ios_32(file, io, &to,
-						  &status);
-#if BITS_PER_LONG == 64
-		else if (bpl == ASM_BPL_64)
-			ret = asm_complete_ios_64(file, io, &to,
-						  &status);
-#endif  /* BITS_PER_LONG == 64 */
-
-		if (ret < 0)
-			goto out_to;
-		if (ret >= io->io_complen)
-			status |= ASM_IO_FULL;
-		ret = 0;
-	}
-
-out_to:
-	if (io->io_timeout)
-		clear_timeout(&to);
-
-out:
-	if (put_user(status, (u32 *)(unsigned long)(io->io_statusp)))
-		ret = -EFAULT;
-	mlog_exit(ret);
-	return ret;
-}  /* asm_do_io() */
-
-static void asm_cleanup_bios(struct file *file)
-{
-	struct asmfs_file_info *afi = ASMFS_FILE(file);
-	struct bio *bio;
-
-	mlog_entry("(0x%p)\n", file);
-
-	spin_lock_irq(&afi->f_lock);
-	while (afi->f_bio_free) {
-		bio = afi->f_bio_free;
-		afi->f_bio_free = bio->bi_private;
-
-		spin_unlock_irq(&afi->f_lock);
-		mlog(ML_BIO, "Unmapping bio 0x%p\n", bio);
-		bio_unmap_user(bio);
-		spin_lock_irq(&afi->f_lock);
-	}
-	spin_unlock_irq(&afi->f_lock);
-
-	mlog_exit_void();
-}
-
-static int asmfs_file_open(struct inode * inode, struct file * file)
-{
-	struct asmfs_inode_info * aii;
-	struct asmfs_file_info * afi;
-
-	mlog_entry("(0x%p, 0x%p)\n", inode, file);
-
-	mlog_bug_on_msg(ASMFS_FILE(file),
-			"Trying to reopen filp 0x%p\n", file);
-
-	mlog(ML_ABI, "Opening filp 0x%p\n", file);
-	afi = (struct asmfs_file_info *)kmalloc(sizeof(*afi),
-						GFP_KERNEL);
-	if (!afi) {
-		mlog_exit(-ENOMEM);
-		return -ENOMEM;
-	}
-
-	afi->f_file = file;
-	afi->f_bio_free = NULL;
-	spin_lock_init(&afi->f_lock);
-	INIT_LIST_HEAD(&afi->f_ctx);
-	INIT_LIST_HEAD(&afi->f_disks);
-	INIT_LIST_HEAD(&afi->f_ios);
-	INIT_LIST_HEAD(&afi->f_complete);
-	init_waitqueue_head(&afi->f_wait);
-
-	aii = ASMFS_I(ASMFS_F2I(file));
-	spin_lock_irq(&aii->i_lock);
-	list_add(&afi->f_ctx, &aii->i_threads);
-	spin_unlock_irq(&aii->i_lock);
-
-	file->private_data = afi;
-
-	mlog(ML_ABI, "Filp 0x%p has afi 0x%p\n", file, afi);
-
-	mlog_exit(0);
-	return 0;
-}  /* asmfs_file_open() */
-
-
-static int asmfs_file_release(struct inode *inode, struct file *file)
-{
-	struct asmfs_inode_info *aii;
-	struct asmfs_file_info *afi;
-	struct asm_disk_head *h, *n;
-	struct list_head *p;
-	struct asm_disk_info *d;
-	struct asm_request *r;
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-
-	mlog_entry("(0x%p, 0x%p)\n", inode, file);
-
-	aii = ASMFS_I(ASMFS_F2I(file));
-	afi = ASMFS_FILE(file);
-
-	mlog(ML_ABI, "Release for filp 0x%p (afi = 0x%p)\n", file, afi);
-
-	/*
-	 * Shouldn't need the lock, no one else has a reference
-	 * asm_close_disk will need to take it when completing I/O
-	 */
-	list_for_each_entry_safe(h, n, &afi->f_disks, h_flist) {
-		d = h->h_disk;
-		asm_close_disk(file, (unsigned long)d->d_bdev);
-	}
-
-	/* FIXME: Clean up things that hang off of afi */
-
-	spin_lock_irq(&aii->i_lock);
-	list_del(&afi->f_ctx);
-	spin_unlock_irq(&aii->i_lock);
-
-	/* No need for a fastpath */
-	add_wait_queue(&afi->f_wait, &wait);
-	do {
-		struct block_device *bdev;
-		struct asm_disk_info *d;
-		struct inode *disk_inode;
-		struct asmdisk_find_inode_args args;
-
-		set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-
-		spin_lock_irq(&afi->f_lock);
-		if (list_empty(&afi->f_ios))
-		    break;
-
-		bdev = find_io_bdev(file);
-		spin_unlock_irq(&afi->f_lock);
-
-		args.fa_handle = (unsigned long)bdev;
-		args.fa_inode = aii;
-		disk_inode = ilookup5(asmdisk_mnt->mnt_sb,
-				      (unsigned long)bdev,
-				      asmdisk_test, &args);
-		if (disk_inode) {
-			d = ASMDISK_I(disk_inode);
-			if (d->d_bdev)
-				blk_run_address_space(d->d_bdev->bd_inode->i_mapping);
-			iput(&d->vfs_inode);
-		}
-
-		mlog(ML_ABI|ML_REQUEST,
-		     "There are still I/Os hanging off of afi 0x%p\n",
-		     afi);
-		io_schedule();
-	} while (1);
-	set_task_state(tsk, TASK_RUNNING);
-	remove_wait_queue(&afi->f_wait, &wait);
-	
-	/* I don't *think* we need the lock here anymore, but... */
-
-	/* Clear unreaped I/Os */
-	while (!list_empty(&afi->f_complete)) {
-		p = afi->f_complete.prev;
-		r = list_entry(p, struct asm_request, r_list);
-		list_del(&r->r_list);
-		r->r_file = NULL;
-		asm_request_free(r);
-	}
-	spin_unlock_irq(&afi->f_lock);
-
-	/* And cleanup any pages from those I/Os */
-	asm_cleanup_bios(file);
-
-	mlog(ML_ABI, "Done with afi 0x%p from filp 0x%p\n", afi, file);
-	file->private_data = NULL;
-	kfree(afi);
-
-	mlog_exit(0);
-	return 0;
-}  /* asmfs_file_release() */
-
-/*
- * Verify that the magic and ABI versions are valid.  Future
- * drivers might support more than one ABI version, so ESRCH is returned
- * for "valid ABI version not found"
- */
-static int asmfs_verify_abi(struct oracleasm_abi_info *abi_info)
-{
-	if (abi_info->ai_magic != ASM_ABI_MAGIC)
-		return -EBADR;
-	if (abi_info->ai_version != ASM_ABI_VERSION)
-		return -ESRCH;
-
-	return 0;
-}
-
-static ssize_t asmfs_svc_query_version(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_abi_info *abi_info;
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_abi_info)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-       	abi_info = (struct oracleasm_abi_info *)buf;
-
-	ret = asmfs_verify_abi(abi_info);
-	if (ret) {
-	       	if (ret == -ESRCH) {
-			abi_info->ai_version = ASM_ABI_VERSION;
-			abi_info->ai_status = -ESRCH;
-		} else
-			goto out;
-	}
-
-	ret = -EBADR;
-	if (abi_info->ai_size != sizeof(struct oracleasm_abi_info))
-		goto out;
-	ret = -EBADRQC;
-	if (abi_info->ai_type != ASMOP_QUERY_VERSION)
-		goto out;
-
-	ret = 0;
-
-out:
-	if (!abi_info->ai_status)
-		abi_info->ai_status = ret;
-	
-	mlog_exit(size);
-	return size;
-}
-
-static ssize_t asmfs_svc_get_iid(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_get_iid_v2 *iid_info;
-	struct asmfs_sb_info *asb = ASMFS_SB(ASMFS_F2I(file)->i_sb);
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_get_iid_v2)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	iid_info = (struct oracleasm_get_iid_v2 *)buf;
-
-	ret = asmfs_verify_abi(&iid_info->gi_abi);
-	if (ret)
-		goto out;
-	ret = -EBADR;
-	if (iid_info->gi_abi.ai_size !=
-	    sizeof(struct oracleasm_get_iid_v2))
-		goto out;
-	ret = -EBADRQC;
-	if (iid_info->gi_abi.ai_type != ASMOP_GET_IID)
-		goto out;
-
-	spin_lock_irq(&asb->asmfs_lock);
-	iid_info->gi_iid = (u64)asb->next_iid;
-	asb->next_iid++;
-	spin_unlock_irq(&asb->asmfs_lock);
-
-	ret = 0;
-
-out:
-	iid_info->gi_abi.ai_status = ret;
-
-	mlog_exit(size);
-	return size;
-}
-
-static ssize_t asmfs_svc_check_iid(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_get_iid_v2 *iid_info;
-	struct asmfs_sb_info *asb = ASMFS_SB(ASMFS_F2I(file)->i_sb);
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_get_iid_v2)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	iid_info = (struct oracleasm_get_iid_v2 *)buf;
-
-	ret = asmfs_verify_abi(&iid_info->gi_abi);
-	if (ret)
-		goto out;
-
-	ret = -EBADR;
-	if (iid_info->gi_abi.ai_size !=
-	    sizeof(struct oracleasm_get_iid_v2))
-		goto out;
-	ret = -EBADRQC;
-	if (iid_info->gi_abi.ai_type != ASMOP_CHECK_IID)
-		goto out;
-
-	spin_lock_irq(&asb->asmfs_lock);
-	if (iid_info->gi_iid >= (u64)asb->next_iid)
-		iid_info->gi_iid = (u64)0;
-	spin_unlock_irq(&asb->asmfs_lock);
-
-	ret = 0;
-
-out:
-	iid_info->gi_abi.ai_status = ret;
-
-	mlog_exit(size);
-	return size;
-}
-
-static ssize_t asmfs_svc_query_disk(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_query_disk_v2 *qd_info;
-	struct file *filp;
-	struct block_device *bdev;
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_query_disk_v2)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	qd_info = (struct oracleasm_query_disk_v2 *)buf;
-
-	ret = asmfs_verify_abi(&qd_info->qd_abi);
-	if (ret)
-		goto out;
-
-	ret = -EBADR;
-	if (qd_info->qd_abi.ai_size !=
-	    sizeof(struct oracleasm_query_disk_v2))
-		goto out;
-	ret = -EBADRQC;
-	if (qd_info->qd_abi.ai_type != ASMOP_QUERY_DISK)
-		goto out;
-
-	ret = -ENODEV;
-	filp = fget(qd_info->qd_fd);
-	if (!filp)
-		goto out;
-
-	ret = -ENOTBLK;
-	if (!S_ISBLK(filp->f_mapping->host->i_mode))
-		goto out_put;
-
-	bdev = I_BDEV(filp->f_mapping->host);
-
-	qd_info->qd_max_sectors = compute_max_sectors(bdev);
-	qd_info->qd_hardsect_size = bdev_hardsect_size(bdev);
-
-	ret = 0;
-
-out_put:
-	fput(filp);
-
-out:
-	qd_info->qd_abi.ai_status = ret;
-
-	mlog_exit(size);
-	return size;
-}
-
-static ssize_t asmfs_svc_open_disk(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_open_disk_v2 od_info;
-	struct block_device *bdev = NULL;
-	struct file *filp;
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_open_disk_v2)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	if (copy_from_user(&od_info,
-			   (struct oracleasm_open_disk_v2 __user *)buf,
-			   sizeof(struct oracleasm_open_disk_v2))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	od_info.od_handle = 0; /* Unopened */
-
-	ret = asmfs_verify_abi(&od_info.od_abi);
-	if (ret)
-		goto out_error;
-
-	ret = -EBADR;
-	if (od_info.od_abi.ai_size !=
-	    sizeof(struct oracleasm_open_disk_v2))
-		goto out_error;
-	ret = -EBADRQC;
-	if (od_info.od_abi.ai_type != ASMOP_OPEN_DISK)
-		goto out_error;
-
-	ret = -ENODEV;
-	filp = fget(od_info.od_fd);
-	if (!filp)
-		goto out_error;
-
-	if (igrab(filp->f_mapping->host)) {
-		ret = -ENOTBLK;
-		if (S_ISBLK(filp->f_mapping->host->i_mode)) {
-			bdev = I_BDEV(filp->f_mapping->host);
-
-			ret = asm_open_disk(file, bdev);
-		}
-	}
-	fput(filp);
-	if (ret)
-		goto out_error;
-
-	od_info.od_handle = (u64)(unsigned long)bdev;
-out_error:
-	od_info.od_abi.ai_status = ret;
-	if (copy_to_user((struct oracleasm_open_disk_v2 __user *)buf,
-			 &od_info,
-			 sizeof(struct oracleasm_open_disk_v2))) {
-		if (od_info.od_handle)
-			asm_close_disk(file,
-				       (unsigned long)od_info.od_handle);
-		/* Ignore close errors, this is the real error */
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	mlog_exit(size);
-	return size;
-}
-
-static ssize_t asmfs_svc_close_disk(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_close_disk_v2 cd_info;
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_close_disk_v2)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	if (copy_from_user(&cd_info,
-			   (struct oracleasm_close_disk_v2 __user *)buf,
-			   sizeof(struct oracleasm_close_disk_v2))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	ret = asmfs_verify_abi(&cd_info.cd_abi);
-	if (ret)
-		goto out_error;
-
-	ret = -EBADR;
-	if (cd_info.cd_abi.ai_size !=
-	    sizeof(struct oracleasm_close_disk_v2))
-		goto out_error;
-	ret = -EBADRQC;
-	if (cd_info.cd_abi.ai_type != ASMOP_CLOSE_DISK)
-		goto out_error;
-
-	ret = asm_close_disk(file, (unsigned long)cd_info.cd_handle);
-
-out_error:
-	cd_info.cd_abi.ai_status = ret;
-	if (copy_to_user((struct oracleasm_close_disk_v2 __user *)buf,
-			 &cd_info,
-			 sizeof(struct oracleasm_close_disk_v2))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	mlog_exit(size);
-	return size;
-}
-
-static ssize_t asmfs_svc_io32(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_abi_info __user *user_abi_info;
-	struct oracleasm_io_v2 io_info;
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_io_v2)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	if (copy_from_user(&io_info,
-			   (struct oracleasm_io_v2 __user *)buf,
-			   sizeof(struct oracleasm_io_v2))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	ret = asmfs_verify_abi(&io_info.io_abi);
-	if (ret)
-		goto out_error;
-
-	ret = -EBADR;
-	if (io_info.io_abi.ai_size !=
-	    sizeof(struct oracleasm_io_v2))
-		goto out_error;
-	ret = -EBADRQC;
-	if (io_info.io_abi.ai_type != ASMOP_IO32)
-		goto out_error;
-
-	ret = asm_do_io(file, &io_info, ASM_BPL_32);
-
-out_error:
-	user_abi_info = (struct oracleasm_abi_info __user *)buf;
-	if (put_user(ret, &(user_abi_info->ai_status))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	mlog_exit(size);
-	return size;
-}
-
-#if BITS_PER_LONG == 64
-static ssize_t asmfs_svc_io64(struct file *file, char *buf, size_t size)
-{
-	struct oracleasm_abi_info __user *user_abi_info;
-	struct oracleasm_io_v2 io_info;
-	int ret;
-
-	mlog_entry("(0x%p, 0x%p, %u)\n", file, buf, (unsigned int)size);
-
-	if (size != sizeof(struct oracleasm_io_v2)) {
-		mlog_exit(-EINVAL);
-		return -EINVAL;
-	}
-
-	if (copy_from_user(&io_info,
-			   (struct oracleasm_io_v2 __user *)buf,
-			   sizeof(struct oracleasm_io_v2))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	ret = asmfs_verify_abi(&io_info.io_abi);
-	if (ret)
-		goto out_error;
-
-	ret = -EBADR;
-	if (io_info.io_abi.ai_size !=
-	    sizeof(struct oracleasm_io_v2))
-		goto out_error;
-	ret = -EBADRQC;
-	if (io_info.io_abi.ai_type != ASMOP_IO64)
-		goto out_error;
-
-	ret = asm_do_io(file, &io_info, ASM_BPL_64);
-
-out_error:
-	user_abi_info = (struct oracleasm_abi_info __user *)buf;
-	if (put_user(ret, &(user_abi_info->ai_status))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	mlog_exit(size);
-	return size;
-}
-#endif  /* BITS_PER_LONG == 64 */
-
-
-/*
- * Because each of these operations need to access the filp->private,
- * we must multiplex.
- */
-static ssize_t asmfs_file_read(struct file *file, char *buf, size_t size, loff_t *pos)
-{
-	struct oracleasm_abi_info __user *user_abi_info;
-	ssize_t ret;
-	int op;
-
-	asm_cleanup_bios(file);
-
-	user_abi_info = (struct oracleasm_abi_info __user *)buf;
-	if (get_user(op, &((user_abi_info)->ai_type))) {
-		mlog_exit(-EFAULT);
-		return -EFAULT;
-	}
-
-	switch (op) {
-		default:
-			ret = -EBADRQC;
-			break;
-
-		case ASMOP_OPEN_DISK:
-			ret = asmfs_svc_open_disk(file, (char *)buf,
-						  size);
-			break;
-
-		case ASMOP_CLOSE_DISK:
-			ret = asmfs_svc_close_disk(file, (char *)buf,
-						   size);
-			break;
-
-		case ASMOP_IO32:
-			ret = asmfs_svc_io32(file, (char *)buf, size);
-			break;
-
-#if BITS_PER_LONG == 64
-		case ASMOP_IO64:
-			ret = asmfs_svc_io64(file, (char *)buf, size);
-			break;
-#endif  /* BITS_PER_LONG == 64 */
-	}
-
-	return ret;
-}
-
-static struct file_operations asmfs_file_operations = {
-	.open		= asmfs_file_open,
-	.release	= asmfs_file_release,
-	.read		= asmfs_file_read,
-};
-
-static struct inode_operations asmfs_file_inode_operations = {
-	.getattr	= simple_getattr,
-};
-
-/*  See init_asmfs_dir_operations() */
-static struct file_operations asmfs_dir_operations = {0, };
-
-static struct inode_operations asmfs_disk_dir_inode_operations = {
-	.lookup		= simple_lookup,
-	.unlink		= simple_unlink,
-	.mknod		= asmfs_mknod,
-};
-static struct inode_operations asmfs_iid_dir_inode_operations = {
-	.create		= asmfs_create,
-	.lookup		= simple_lookup,
-	.unlink		= simple_unlink,
-};
-
-static struct super_operations asmfs_ops = {
-	.statfs		= simple_statfs,
-	.alloc_inode	= asmfs_alloc_inode,
-	.destroy_inode	= asmfs_destroy_inode,
-	.drop_inode	= generic_delete_inode,
-	/* These last three only required for limited maxinstances */
-	.put_super	= asmfs_put_super,
-	.remount_fs     = asmfs_remount,
-};
-
-/*
- * Initialisation
- */
-
-static int asmfs_fill_super(struct super_block *sb,
-			    void *data, int silent)
-{
-	struct inode *inode, *parent;
-	struct dentry *root, *dentry;
-	struct asmfs_sb_info *asb;
-	struct asmfs_params params;
-	struct qstr name;
-
-	sb->s_blocksize = PAGE_CACHE_SIZE;
-	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
-	sb->s_magic = ASMFS_MAGIC;
-	sb->s_op = &asmfs_ops;
-	sb->s_maxbytes = MAX_NON_LFS;	/* Why? */
-
-	asb = kmalloc(sizeof(struct asmfs_sb_info), GFP_KERNEL);
-	if (!asb)
-		return -ENOMEM;
-	sb->s_fs_info = asb;
-
-	asb->asmfs_super = sb;
-	asb->next_iid = 1;
-	spin_lock_init(&asb->asmfs_lock);
-
-	if (parse_options((char *)data, &params) != 0)
-		goto out_free_asb;
-
-	init_limits(asb, &params);
-
-	inode = new_inode(sb);
-	if (!inode)
-		goto out_free_asb;
-
-	inode->i_ino = (unsigned long)inode;
-	inode->i_mode = S_IFDIR | 0755;
-	inode->i_uid = inode->i_gid = 0;
-	set_i_blksize(inode, PAGE_CACHE_SIZE);
-	inode->i_blocks = 0;
-	inode->i_rdev = 0;
-	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->i_op = &simple_dir_inode_operations;
-	inode->i_fop = &asmfs_dir_operations;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-	/* directory inodes start off with i_nlink == 2 (for "." entry) */
-	inode->i_nlink++;
-	parent = inode;
-
-	root = d_alloc_root(inode);
-	if (!root) {
-		iput(inode);
-		goto out_free_asb;
-	}
-
-	name.name = ASM_MANAGER_DISKS;
-	name.len = strlen(ASM_MANAGER_DISKS);
-	name.hash = full_name_hash(name.name, name.len);
-	dentry = d_alloc(root, &name);
-	if (!dentry)
-		goto out_genocide;
-	parent->i_nlink++;
-	inode = new_inode(sb);
-	if (!inode)
-		goto out_genocide;
-	inode->i_ino = (unsigned long)inode;
-	inode->i_mode = S_IFDIR | 0755;
-	inode->i_uid = inode->i_gid = 0;
-	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->i_op = &asmfs_disk_dir_inode_operations;
-	inode->i_fop = &asmfs_dir_operations;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-	d_add(dentry, inode);
-
-	name.name = ASM_MANAGER_INSTANCES;
-	name.len = strlen(ASM_MANAGER_INSTANCES);
-	name.hash = full_name_hash(name.name, name.len);
-	dentry = d_alloc(root, &name);
-	if (!dentry)
-		goto out_genocide;
-	parent->i_nlink++;
-	inode = new_inode(sb);
-	if (!inode)
-		goto out_genocide;
-	inode->i_ino = (unsigned long)inode;
-	inode->i_mode = S_IFDIR | 0770;
-	inode->i_uid = inode->i_gid = 0;
-	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->i_op = &asmfs_iid_dir_inode_operations;
-	inode->i_fop = &asmfs_dir_operations;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-	d_add(dentry, inode);
-
-	name.name = asm_operation_files[ASMOP_QUERY_VERSION];
-	name.len = strlen(asm_operation_files[ASMOP_QUERY_VERSION]);
-	name.hash = full_name_hash(name.name, name.len);
-	dentry = d_alloc(root, &name);
-	if (!dentry)
-		goto out_genocide;
-	inode = new_transaction_inode(sb, 0770,
-				      &trans_contexts[ASMOP_QUERY_VERSION]);
-	if (!inode)
-		goto out_genocide;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-	d_add(dentry, inode);
-
-	name.name = asm_operation_files[ASMOP_GET_IID];
-	name.len = strlen(asm_operation_files[ASMOP_GET_IID]);
-	name.hash = full_name_hash(name.name, name.len);
-	dentry = d_alloc(root, &name);
-	if (!dentry)
-		goto out_genocide;
-	inode = new_transaction_inode(sb, 0770,
-				      &trans_contexts[ASMOP_GET_IID]);
-	if (!inode)
-		goto out_genocide;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-	d_add(dentry, inode);
-
-	name.name = asm_operation_files[ASMOP_CHECK_IID];
-	name.len = strlen(asm_operation_files[ASMOP_CHECK_IID]);
-	name.hash = full_name_hash(name.name, name.len);
-	dentry = d_alloc(root, &name);
-	if (!dentry)
-		goto out_genocide;
-	inode = new_transaction_inode(sb, 0770,
-				      &trans_contexts[ASMOP_CHECK_IID]);
-	if (!inode)
-		goto out_genocide;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-	d_add(dentry, inode);
-
-	name.name = asm_operation_files[ASMOP_QUERY_DISK];
-	name.len = strlen(asm_operation_files[ASMOP_QUERY_DISK]);
-	name.hash = full_name_hash(name.name, name.len);
-	dentry = d_alloc(root, &name);
-	if (!dentry)
-		goto out_genocide;
-	inode = new_transaction_inode(sb, 0770,
-				      &trans_contexts[ASMOP_QUERY_DISK]);
-	if (!inode)
-		goto out_genocide;
-	inode->i_mapping->backing_dev_info = &memory_backing_dev_info;
-	d_add(dentry, inode);
-
-	sb->s_root = root;
-
-
-	printk(KERN_DEBUG "ASM: oracleasmfs mounted with options: %s\n", 
-	       data ? (char *)data : "<defaults>" );
-	printk(KERN_DEBUG "ASM:	maxinstances=%ld\n", asb->max_inodes);
-	return 0;
-
-out_genocide:
-	d_genocide(root);
-	dput(root);
-
-out_free_asb:
-	sb->s_fs_info = NULL;
-	kfree(asb);
-
-	return -EINVAL;
-}
-
-
-/*
- * We want all the simple_dir_operations, but we cannot reference them
- * directly -- they are not EXPORT_SYMBOL()d.  So, we just copy the
- * exported simple_dir_operations before adding any specific functions
- * of our own.
- *
- * This means that asmfs_dir_operations can't be const.  Oh, well.
- */
-static void __init init_asmfs_dir_operations(void) {
-	asmfs_dir_operations		= simple_dir_operations;
-	asmfs_dir_operations.fsync	= simple_sync_file;
-};
-
-
-#ifdef GET_SB_HAS_VFSMOUNT
-static int asmfs_get_sb(struct file_system_type *fs_type, int flags,
-			const char *dev_name, void *data,
-			struct vfsmount *mnt)
-{
-	return get_sb_nodev(fs_type, flags, data, asmfs_fill_super, mnt);
-}
-#else
-static struct super_block *asmfs_get_sb(struct file_system_type *fs_type,
-					int flags, const char *dev_name,
-					void *data)
-{
-	return get_sb_nodev(fs_type, flags, data, asmfs_fill_super);
-}
-#endif  /* GET_SB_HAS_VFSMOUNT */
-
-static struct file_system_type asmfs_fs_type = {
-	.owner		= THIS_MODULE,
-	.name		= "oracleasmfs",
-	.get_sb		= asmfs_get_sb,
-	.kill_sb	= kill_litter_super,
-};
-
-static int __init init_asmfs_fs(void)
-{
-	int ret;
-
-	ret = init_inodecache();
-	if (ret) {
-		printk("oracleasmfs: Unable to create asmfs_inode_cache\n");
-		goto out_inodecache;
-	}
-
-	ret = init_requestcache();
-	if (ret) {
-		printk("oracleasmfs: Unable to create asm_request cache\n");
-		goto out_requestcache;
-	}
-
-	ret = init_asmdiskcache();
-	if (ret) {
-		printk("oracleasmfs: Unable to initialize the disk cache\n");
-		goto out_diskcache;
-	}
-
-	ret = init_oracleasm_proc();
-	if (ret) {
-		printk("oracleasmfs: Unable to register proc entries\n");
-		goto out_proc;
-	}
-
-	init_asmfs_dir_operations();
-	ret = register_filesystem(&asmfs_fs_type);
-	if (ret) {
-		printk("oracleasmfs: Unable to register filesystem\n");
-		goto out_register;
-	}
-
-	return 0;
-
-out_register:
-	exit_oracleasm_proc();
-
-out_proc:
-	destroy_asmdiskcache();
-
-out_diskcache:
-	destroy_requestcache();
-
-out_requestcache:
-	destroy_inodecache();
-
-out_inodecache:
-	return ret;
-}
-
-static void __exit exit_asmfs_fs(void)
-{
-	unregister_filesystem(&asmfs_fs_type);
-	exit_oracleasm_proc();
-	destroy_asmdiskcache();
-	destroy_requestcache();
-	destroy_inodecache();
-}
-
-module_init(init_asmfs_fs)
-module_exit(exit_asmfs_fs)
-MODULE_LICENSE("GPL");
-MODULE_VERSION(ASM_MODULE_VERSION);
-MODULE_AUTHOR("Joel Becker <joel.becker@oracle.com>");
-MODULE_DESCRIPTION("Kernel driver backing the Generic Linux ASM Library.");
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kernel/proc.c oracleasm-git/kernel/proc.c
--- oracleasm-2.0.5/kernel/proc.c	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/kernel/proc.c	2010-10-28 22:42:48.000000000 +0200
@@ -24,9 +24,6 @@
 #include "proc.h"
 #include "masklog.h"
 
-/* Yuk, but whatever */
-#include "masklog.c"
-
 static struct proc_dir_entry *asm_proc;
 #define ASM_PROC_PATH "fs/oracleasm"
 
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kernel/transaction_file.c oracleasm-git/kernel/transaction_file.c
--- oracleasm-2.0.5/kernel/transaction_file.c	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/kernel/transaction_file.c	2010-10-28 22:42:48.000000000 +0200
@@ -14,10 +14,12 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/slab.h>
+#include <linux/sched.h>
 
 #include <asm/uaccess.h>
 
 #include "transaction_file.h"
+#include "compat.h"
 
 #define TRANSACTION_CONTEXT(i) ((i)->i_private)
 
@@ -148,8 +150,8 @@ struct inode *new_transaction_inode(stru
 	if (!inode)
 		return NULL;
 	inode->i_mode = S_IFREG | mode;
-	inode->i_uid = current->fsuid;
-	inode->i_gid = current->fsgid;
+	inode->i_uid = current_fsuid();
+	inode->i_gid = current_fsgid();
 	set_i_blksize(inode, PAGE_CACHE_SIZE);
 	inode->i_blocks = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/kver.m4 oracleasm-git/kver.m4
--- oracleasm-2.0.5/kver.m4	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/kver.m4	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,109 @@
+dnl OCFS2_CHECK_KVER(INCLUDE-PATH, VERSION-VARIABLE, [DESCRIPTION],
+dnl                             [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+AC_DEFUN([OCFS2_CHECK_KVER],
+  [AC_LANG_PREPROC_REQUIRE()dnl
+   AC_REQUIRE([AC_PROG_EGREP])dnl
+
+   check_kver_DESC="$3"
+
+   if test -n "$check_kver_DESC"; then
+     check_kver_DESC=" $check_kver_DESC"
+   fi
+
+   if test -f "$1/linux/utsrelease.h"; then
+     UTS_HEADER=linux/utsrelease.h
+   elif test -f "$1/generated/utsrelease.h"; then
+     UTS_HEADER=generated/utsrelease.h
+   else
+     UTS_HEADER=linux/version.h
+   fi
+
+   check_kver_saved_CPPFLAGS="$CPPFLAGS"
+   CPPFLAGS="-I$1 $CPPFLAGS -nostdinc"
+
+   AC_MSG_CHECKING(for kernel$check_kver_DESC version)
+
+   AC_LANG_CONFTEST([AC_LANG_SOURCE([
+#include <${UTS_HEADER}>
+
+#ifdef UTS_RELEASE
+check_kver_RESULT=UTS_RELEASE
+#else
+check_kver_RESULT=none
+#endif
+])])
+
+   if (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+     $EGREP "^check_kver_RESULT=" > conftest.kver 2>&1; then
+     . ./conftest.kver
+   else
+     check_kver_RESULT='none'
+   fi
+
+   AC_MSG_RESULT($check_kver_RESULT)
+   rm -f conftest*
+
+   CPPFLAGS="$check_kver_saved_CPPFLAGS"
+
+   if test "x$check_kver_RESULT" != "xnone"; then
+     $2=$check_kver_RESULT
+     m4_default([$4], :)
+   else
+     m4_default([$5],
+       [AC_MSG_ERROR([Could not determine kernel$check_kver_DESC version.])])
+   fi
+])# OCFS2_CHECK_KVER
+
+dnl OCFS2_CHECK_KARCH(INCLUDE-PATH, ARCH-VARIABLE, [DESCRIPTION],
+dnl                             [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+AC_DEFUN([OCFS2_CHECK_KARCH],
+  [AC_LANG_PREPROC_REQUIRE()dnl
+   AC_REQUIRE([AC_PROG_EGREP])dnl
+
+   check_karch_DESC="$3"
+
+   if test -n "$check_karch_DESC"; then
+     check_karch_DESC=" $check_karch_DESC"
+   fi
+
+   if test -f "$1/generated/compile.h"; then
+     UTS_HEADER=generated/compile.h
+   else
+     UTS_HEADER=linux/compile.h
+   fi
+
+   check_karch_saved_CPPFLAGS="$CPPFLAGS"
+   CPPFLAGS="-I$1 $CPPFLAGS -nostdinc"
+
+   AC_MSG_CHECKING(for kernel$check_karch_DESC arch)
+
+   AC_LANG_CONFTEST([AC_LANG_SOURCE([
+#include <${UTS_HEADER}>
+
+#ifdef UTS_MACHINE
+check_karch_RESULT=UTS_MACHINE
+#else
+check_karch_RESULT=none
+#endif
+])])
+
+   if (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+     $EGREP "^check_karch_RESULT=" > conftest.karch 2>&1; then
+     . ./conftest.karch
+   else
+     check_karch_RESULT='none'
+   fi
+
+   AC_MSG_RESULT($check_karch_RESULT)
+   rm -f conftest*
+
+   CPPFLAGS="$check_karch_saved_CPPFLAGS"
+
+   if test "x$check_karch_RESULT" != "xnone"; then
+     $2=$check_karch_RESULT
+     m4_default([$4], :)
+   else
+     m4_default([$5],
+       [AC_MSG_ERROR([Could not determine kernel$check_karch_DESC version.])])
+   fi
+])# OCFS2_CHECK_KARCH
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/Makefile oracleasm-git/vendor/Makefile
--- oracleasm-2.0.5/vendor/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -11,7 +11,7 @@ include $(TOPDIR)/Preamble.make
 #
 # Add any directories to recurse into via the SUBDIRS variable.
 # 
-SUBDIRS = common rhel5 sles10 fc6 rhel4 sles9 rhel3 sles8 rhas21
+SUBDIRS = common rhel5 sles11 sles10 rhel4 sles9 rhel3 sles8 rhas21 fedora
 
 #
 # Include this at the very end of the Makefile
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/Makefile oracleasm-git/vendor/common/Makefile
--- oracleasm-2.0.5/vendor/common/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/common/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -3,7 +3,11 @@ TOPDIR = ../..
 include $(TOPDIR)/Preamble.make
 
 DIST_FILES =					\
-	oracleasm-headers.spec-generic.in	\
+	binrpm.spec-generic			\
+	oracleasm-headers.spec-generic		\
+	gmsl					\
+	__gmsl					\
+	subst.make				\
 	Vendor.make
 
 include $(TOPDIR)/Postamble.make
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/Vendor.make oracleasm-git/vendor/common/Vendor.make
--- oracleasm-2.0.5/vendor/common/Vendor.make	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/common/Vendor.make	2010-10-28 22:42:48.000000000 +0200
@@ -6,6 +6,8 @@
 # It also expects PKG_VERSION, INCLUDE_REQUIRES, and VENDOR_EXTENSION to be
 # set.
 
+include $(TOPDIR)/vendor/common/subst.make
+include $(TOPDIR)/vendor/common/gmsl
 
 RPMBUILD = $(shell /usr/bin/which rpmbuild 2>/dev/null || /usr/bin/which rpm 2>/dev/null || echo /bin/false)
 RPM_TOPDIR = `pwd`
@@ -14,17 +16,32 @@ ifndef VENDOR_EXTENSION
 VENDOR_EXTENSION = common
 endif
 
-$(TOPDIR)/oracleasm-headers-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm: dist $(TOPDIR)/vendor/common/oracleasm-headers.spec-generic
-	sed -e 's,@@PKG_VERSION@@,'$(PKG_VERSION)',g' \
-		-e 's,@@INCLUDE_REQUIRES@@,'$(INCLUDE_REQUIRES)',g' \
-		-e 's,@@VENDOR_EXTENSION@@,'$(VENDOR_EXTENSION)',g' \
-		< "$(TOPDIR)/vendor/common/oracleasm-headers.spec-generic" \
-		> "$(TOPDIR)/vendor/common/oracleasm-headers.spec"
-	$(RPMBUILD) -bs --define "_sourcedir $(RPM_TOPDIR)" --define "_srcrpmdir $(RPM_TOPDIR)" "$(TOPDIR)/vendor/common/oracleasm-headers.spec"
-	rm "$(TOPDIR)/vendor/common/oracleasm-headers.spec"
+DPV=$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION)
+HEADER_SPEC_IN=$(TOPDIR)/vendor/common/oracleasm-headers.spec-generic
+HEADER_SPEC_OUT=$(TOPDIR)/vendor/common/oracleasm-headers.spec
+
+$(TOPDIR)/oracleasm-headers-$(DPV).src.rpm: $(HEADER_SPEC_IN)
+	$(spec_subst) > $(HEADER_SPEC_OUT)
+	$(RPMBUILD) -bs --define "_sourcedir $(RPM_TOPDIR)" \
+		--define "_srcrpmdir $(RPM_TOPDIR)" "$(HEADER_SPEC_OUT)"
 
-headers_srpm: $(TOPDIR)/oracleasm-headers-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm
+headers_srpm: $(TOPDIR)/oracleasm-headers-$(DPV).src.rpm
 
 headers_rpm: headers_srpm
-	$(RPMBUILD) --rebuild $(TOOLSARCH) "oracleasm-headers-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm"
+	$(RPMBUILD) --rebuild $(TOOLSARCH) "oracleasm-headers-$(DPV).src.rpm"
+
+#
+# Build a package out of the compiled source tree
+#
+
+BIN_SPEC_IN=$(TOPDIR)/vendor/common/binrpm.spec-generic
+
+$(TOPDIR)/vendor/common/binrpm.spec:\
+	KERNEL_VERSION=$(KERNELVER)
+
+$(TOPDIR)/vendor/common/binrpm.spec: $(BIN_SPEC_IN) dist
+	$(spec_subst) > $@
+
+binrpm-pkg: $(TOPDIR)/vendor/common/binrpm.spec
+	$(RPMBUILD) --define "_builddir $(TOPDIR)" --target $(KERNELARCH) -bb $<
 
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/__gmsl oracleasm-git/vendor/common/__gmsl
--- oracleasm-2.0.5/vendor/common/__gmsl	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/common/__gmsl	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,854 @@
+# ----------------------------------------------------------------------------
+#
+# GNU Make Standard Library (GMSL)
+#
+# A library of functions to be used with GNU Make's $(call) that
+# provides functionality not available in standard GNU Make.
+#
+# Copyright (c) 2005-2007 John Graham-Cumming
+#
+# This file is part of GMSL
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 
+# 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.
+#
+# Neither the name of the John Graham-Cumming 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 COPYRIGHT HOLDERS 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
+# COPYRIGHT OWNER 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.
+#
+# ----------------------------------------------------------------------------
+
+# This is the GNU Make Standard Library version number as a list with
+# three items: major, minor, revision
+
+gmsl_version := 1 0 11
+
+# Used to output warnings and error from the library, it's possible to
+# disable any warnings or errors by overriding these definitions
+# manually or by setting GMSL_NO_WARNINGS or GMSL_NO_ERRORS
+
+__gmsl_name := GNU Make Standard Library
+__gmsl_warning = $(warning $(__gmsl_name): $1)
+__gmsl_error = $(error $(__gmsl_name): $1)
+
+ifdef GMSL_NO_WARNINGS
+__gmsl_warning :=
+endif
+ifdef GMSL_NO_ERRORS
+__gmsl_error :=
+endif
+
+# If GMSL_TRACE is enabled then calls to the library functions are
+# traced to stdout using warning messages with their arguments
+
+ifdef GMSL_TRACE
+__gmsl_tr1 = $(warning $0('$1'))
+__gmsl_tr2 = $(warning $0('$1','$2'))
+__gmsl_tr3 = $(warning $0('$1','$2','$3'))
+else
+__gmsl_tr1 :=
+__gmsl_tr2 :=
+__gmsl_tr3 :=
+endif
+
+# Figure out whether we have $(eval) or not (GNU Make 3.80 and above)
+# if we do not then output a warning message, if we do then some
+# functions will be enabled.
+
+__gmsl_have_eval := $(false)
+__gmsl_ignore := $(eval __gmsl_have_eval := $(true))
+
+# If this is being run with Electric Cloud's emake then warn that
+# their $(eval) support is incomplete.
+
+ifdef ECLOUD_BUILD_ID
+$(warning You are using Electric Cloud's emake which has incomplete $$(eval) support)
+__gmsl_have_eval := $(false)
+endif
+
+# See if we have $(lastword) (GNU Make 3.81 and above)
+
+__gmsl_have_lastword := $(lastword $(false) $(true))
+
+# See if we have native or and and (GNU Make 3.81 and above)
+
+__gmsl_have_or := $(if $(filter-out undefined,  \
+    $(origin or)),$(call or,$(true),$(false)))
+__gmsl_have_and := $(if $(filter-out undefined, \
+    $(origin and)),$(call and,$(true),$(true)))
+
+ifneq ($(__gmsl_have_eval),$(true))
+$(call __gmsl_warning,GNU Make $(MAKE_VERSION) does not support $$$$(eval): some functions disabled)
+endif
+
+# ----------------------------------------------------------------------------
+# Function:  gmsl_compatible
+# Arguments: List containing the desired library version number (maj min rev)
+# Returns:   $(true) if this version of the library is compatible
+#            with the requested version number, otherwise $(false)
+# ----------------------------------------------------------------------------
+gmsl_compatible = $(strip                                                 \
+    $(if $(call gt,$(word 1,$1),$(word 1,$(gmsl_version))),               \
+        $(false),                                                         \
+        $(if $(call lt,$(word 1,$1),$(word 1,$(gmsl_version))),           \
+            $(true),                                                      \
+            $(if $(call gt,$(word 2,$1),$(word 2,$(gmsl_version))),       \
+                $(false),                                                 \
+                $(if $(call lt,$(word 2,$1),$(word 2,$(gmsl_version))),   \
+                    $(true),                                              \
+                    $(call lte,$(word 3,$1),$(word 3,$(gmsl_version))))))))
+
+# ###########################################################################
+# LOGICAL OPERATORS
+# ###########################################################################
+
+# not is defined in gmsl
+
+# ----------------------------------------------------------------------------
+# Function:  and
+# Arguments: Two boolean values
+# Returns:   Returns $(true) if both of the booleans are true
+# ----------------------------------------------------------------------------
+ifneq ($(__gmsl_have_and),$(true))
+and = $(__gmsl_tr2)$(if $1,$(if $2,$(true),$(false)),$(false))
+endif
+
+# ----------------------------------------------------------------------------
+# Function:  or
+# Arguments: Two boolean values
+# Returns:   Returns $(true) if either of the booleans is true
+# ----------------------------------------------------------------------------
+ifneq ($(__gmsl_have_or),$(true))
+or = $(__gmsl_tr2)$(if $1$2,$(true),$(false))
+endif
+
+# ----------------------------------------------------------------------------
+# Function:  xor
+# Arguments: Two boolean values
+# Returns:   Returns $(true) if exactly one of the booleans is true
+# ----------------------------------------------------------------------------
+xor = $(__gmsl_tr2)$(if $1,$(if $2,$(false),$(true)),$(if $2,$(true),$(false)))
+
+# ----------------------------------------------------------------------------
+# Function:  nand
+# Arguments: Two boolean values
+# Returns:   Returns value of 'not and'
+# ----------------------------------------------------------------------------
+nand = $(__gmsl_tr2)$(if $1,$(if $2,$(false),$(true)),$(true))
+
+# ----------------------------------------------------------------------------
+# Function:  nor
+# Arguments: Two boolean values
+# Returns:   Returns value of 'not or'
+# ----------------------------------------------------------------------------
+nor = $(__gmsl_tr2)$(if $1$2,$(false),$(true))
+
+# ----------------------------------------------------------------------------
+# Function:  xnor
+# Arguments: Two boolean values
+# Returns:   Returns value of 'not xor'
+# ----------------------------------------------------------------------------
+xnor =$(__gmsl_tr2)$(if $1,$(if $2,$(true),$(false)),$(if $2,$(false),$(true)))
+
+# ###########################################################################
+# LIST MANIPULATION FUNCTIONS
+# ###########################################################################
+
+# ----------------------------------------------------------------------------
+# Function:  first (same as LISP's car, or head)
+# Arguments: 1: A list
+# Returns:   Returns the first element of a list
+# ----------------------------------------------------------------------------
+first = $(__gmsl_tr1)$(firstword $1)
+
+# ----------------------------------------------------------------------------
+# Function:  last
+# Arguments: 1: A list
+# Returns:   Returns the last element of a list
+# ----------------------------------------------------------------------------
+ifeq ($(__gmsl_have_lastword),$(true))
+last = $(__gmsl_tr1)$(lastword $1)
+else
+last = $(__gmsl_tr1)$(if $1,$(word $(words $1),$1))
+endif
+
+# ----------------------------------------------------------------------------
+# Function:  rest (same as LISP's cdr, or tail)
+# Arguments: 1: A list
+# Returns:   Returns the list with the first element removed
+# ----------------------------------------------------------------------------
+rest = $(__gmsl_tr1)$(wordlist 2,$(words $1),$1)
+
+# ----------------------------------------------------------------------------
+# Function:  chop
+# Arguments: 1: A list
+# Returns:   Returns the list with the last element removed
+# ----------------------------------------------------------------------------
+chop = $(__gmsl_tr1)$(wordlist 2,$(words $1),x $1)
+
+# ----------------------------------------------------------------------------
+# Function:  map
+# Arguments: 1: Name of function to $(call) for each element of list
+#            2: List to iterate over calling the function in 1
+# Returns:   The list after calling the function on each element
+# ----------------------------------------------------------------------------
+map = $(__gmsl_tr2)$(strip $(foreach a,$2,$(call $1,$a)))
+
+# ----------------------------------------------------------------------------
+# Function:  pairmap
+# Arguments: 1: Name of function to $(call) for each pair of elements
+#            2: List to iterate over calling the function in 1
+#            3: Second list to iterate over calling the function in 1
+# Returns:   The list after calling the function on each pair of elements
+# ----------------------------------------------------------------------------
+pairmap = $(strip $(__gmsl_tr3)\
+          $(if $2$3,$(call $1,$(call first,$2),$(call first,$3))     \
+                        $(call pairmap,$1,$(call rest,$2),$(call rest,$3))))
+
+# ----------------------------------------------------------------------------
+# Function:  leq
+# Arguments: 1: A list to compare against...
+#            2: ...this list
+# Returns:   Returns $(true) if the two lists are identical
+# ----------------------------------------------------------------------------
+leq = $(__gmsl_tr2)$(strip $(if $(call seq,$(words $1),$(words $2)),     \
+          $(call __gmsl_list_equal,$1,$2),$(false)))
+
+__gmsl_list_equal = $(if $(strip $1),                                       \
+                        $(if $(call seq,$(call first,$1),$(call first,$2)), \
+                            $(call __gmsl_list_equal,                       \
+                                $(call rest,$1),                            \
+                                $(call rest,$2)),                           \
+                            $(false)),                                      \
+                     $(true))
+
+# ----------------------------------------------------------------------------
+# Function:  lne
+# Arguments: 1: A list to compare against...
+#            2: ...this list
+# Returns:   Returns $(true) if the two lists are different
+# ----------------------------------------------------------------------------
+lne = $(__gmsl_tr2)$(call not,$(call leq,$1,$2))
+
+# ----------------------------------------------------------------------------
+# Function:  reverse
+# Arguments: 1: A list to reverse
+# Returns:   The list with its elements in reverse order
+# ----------------------------------------------------------------------------
+reverse =$(__gmsl_tr1)$(strip $(if $1,$(call reverse,$(call rest,$1)) \
+                        $(call first,$1)))
+
+# ----------------------------------------------------------------------------
+# Function:  uniq
+# Arguments: 1: A list from which to remove repeated elements
+# Returns:   The list with duplicate elements removed without reordering
+# ----------------------------------------------------------------------------
+uniq = $(strip $(__gmsl_tr1)$(if $1,$(call uniq,$(call chop,$1)) \
+            $(if $(filter $(call last,$1),$(call chop,$1)),,$(call last,$1))))
+
+# ----------------------------------------------------------------------------
+# Function:  length
+# Arguments: 1: A list
+# Returns:   The number of elements in the list
+# ----------------------------------------------------------------------------
+length = $(__gmsl_tr1)$(words $1)
+
+# ###########################################################################
+# STRING MANIPULATION FUNCTIONS
+# ###########################################################################
+
+# Helper function that translates any GNU Make 'true' value (i.e. a
+# non-empty string) to our $(true)
+
+__gmsl_make_bool = $(if $(strip $1),$(true),$(false))
+
+# ----------------------------------------------------------------------------
+# Function:  seq
+# Arguments: 1: A string to compare against...
+#            2: ...this string
+# Returns:   Returns $(true) if the two strings are identical
+# ----------------------------------------------------------------------------
+seq = $(__gmsl_tr2)$(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),$(false),$(true))
+
+# ----------------------------------------------------------------------------
+# Function:  sne
+# Arguments: 1: A string to compare against...
+#            2: ...this string
+# Returns:   Returns $(true) if the two strings are not the same
+# ----------------------------------------------------------------------------
+sne = $(__gmsl_tr2)$(call not,$(call seq,$1,$2))
+
+# ----------------------------------------------------------------------------
+# Function:  split
+# Arguments: 1: The character to split on
+#            2: A string to split
+# Returns:   Splits a string into a list separated by spaces at the split
+#            character in the first argument
+# ----------------------------------------------------------------------------
+split = $(__gmsl_tr2)$(strip $(subst $1, ,$2))
+
+# ----------------------------------------------------------------------------
+# Function:  merge
+# Arguments: 1: The character to put between fields
+#            2: A list to merge into a string
+# Returns:   Merges a list into a single string, list elements are separated
+#            by the character in the first argument
+# ----------------------------------------------------------------------------
+merge = $(__gmsl_tr2)$(strip $(if $2,                                     \
+            $(if $(call seq,1,$(words $2)),                               \
+                $2,$(call first,$2)$1$(call merge,$1,$(call rest,$2)))))
+
+ifdef __gmsl_have_eval
+# ----------------------------------------------------------------------------
+# Function:  tr
+# Arguments: 1: The list of characters to translate from 
+#            2: The list of characters to translate to
+#            3: The text to translate
+# Returns:   Returns the text after translating characters
+# ----------------------------------------------------------------------------
+tr = $(strip $(__gmsl_tr3)$(call assert_no_dollar,$0,$1$2$3)              \
+     $(eval __gmsl_t := $3)                                               \
+     $(foreach c,                                                         \
+         $(join $(addsuffix :,$1),$2),                                    \
+         $(eval __gmsl_t :=                                               \
+             $(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)), \
+                 $(__gmsl_t))))$(__gmsl_t))
+
+# Common character classes for use with the tr function.  Each of
+# these is actually a variable declaration and must be wrapped with
+# $() or ${} to be used.
+
+[A-Z] := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
+[a-z] := a b c d e f g h i j k l m n o p q r s t u v w x y z #
+[0-9] := 0 1 2 3 4 5 6 7 8 9 #
+[A-F] := A B C D E F #
+
+# ----------------------------------------------------------------------------
+# Function:  uc
+# Arguments: 1: Text to upper case
+# Returns:   Returns the text in upper case
+# ----------------------------------------------------------------------------
+uc = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(call tr,$([a-z]),$([A-Z]),$1)
+
+# ----------------------------------------------------------------------------
+# Function:  lc
+# Arguments: 1: Text to lower case
+# Returns:   Returns the text in lower case
+# ----------------------------------------------------------------------------
+lc = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(call tr,$([A-Z]),$([a-z]),$1)
+
+# ----------------------------------------------------------------------------
+# Function:  strlen
+# Arguments: 1: A string
+# Returns:   Returns the length of the string
+# ----------------------------------------------------------------------------
+__gmsl_characters := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+__gmsl_characters += a b c d e f g h i j k l m n o p q r s t u v w x y z
+__gmsl_characters += 0 1 2 3 4 5 6 7 8 9
+__gmsl_characters += ` ~ ! @ \# $$ % ^ & * ( ) - _ = +
+__gmsl_characters += { } [ ] \ : ; ' " < > , . / ? |
+
+# Aside: if you read the above you might think that the lower-case
+# letter x is missing, and that that's an error.  It is missing, but
+# it's not an error.  __gmsl_characters is used by the strlen
+# function.  strlen works by transforming every character and space
+# into the letter x and then counting the x's.  Since there's no need
+# to transform x into x I omitted it.
+
+# This results in __gmsl_space containing just a space
+
+__gmsl_space := 
+__gmsl_space +=
+
+strlen = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(strip $(eval __temp := $(subst $(__gmsl_space),x,$1))$(foreach a,$(__gmsl_characters),$(eval __temp := $$(subst $$a,x,$(__temp))))$(eval __temp := $(subst x,x ,$(__temp)))$(words $(__temp)))
+
+# This results in __gmsl_newline containing just a newline
+
+define __gmsl_newline
+
+
+endef
+
+# This results in __gmsl_tab containing a tab
+
+__gmsl_tab :=	#
+
+# ----------------------------------------------------------------------------
+# Function:  substr
+# Arguments: 1: A string
+# 	     2: Start position (first character is 1)
+#	     3: End position (inclusive)
+# Returns:   A substring.  
+# Note:      The string in $1 must not contain a §
+# ----------------------------------------------------------------------------
+
+substr = $(__gmsl_tr3)$(call assert_no_dollar,$0,$1$2$3)$(strip $(eval __temp := $$(subst $$(__gmsl_space),§ ,$$1))$(foreach a,$(__gmsl_characters),$(eval __temp := $$(subst $$a,$$a$$(__gmsl_space),$(__temp))))$(eval __temp := $(wordlist $2,$3,$(__temp))))$(subst §,$(__gmsl_space),$(subst $(__gmsl_space),,$(__temp)))
+
+endif # __gmsl_have_eval
+
+# ###########################################################################
+# SET MANIPULATION FUNCTIONS
+# ###########################################################################
+
+# Sets are represented by sorted, deduplicated lists.  To create a set
+# from a list use set_create, or start with the empty_set and
+# set_insert individual elements
+
+# This is the empty set
+empty_set := 
+
+# ----------------------------------------------------------------------------
+# Function:  set_create
+# Arguments: 1: A list of set elements
+# Returns:   Returns the newly created set
+# ----------------------------------------------------------------------------
+set_create = $(__gmsl_tr1)$(sort $1)
+
+# ----------------------------------------------------------------------------
+# Function:  set_insert
+# Arguments: 1: A single element to add to a set
+#            2: A set
+# Returns:   Returns the set with the element added
+# ----------------------------------------------------------------------------
+set_insert = $(__gmsl_tr2)$(sort $1 $2)
+
+# ----------------------------------------------------------------------------
+# Function:  set_remove
+# Arguments: 1: A single element to remove from a set
+#            2: A set
+# Returns:   Returns the set with the element removed
+# ----------------------------------------------------------------------------
+set_remove = $(__gmsl_tr2)$(filter-out $1,$2)
+
+# ----------------------------------------------------------------------------
+# Function:  set_is_member
+# Arguments: 1: A single element 
+#            2: A set
+# Returns:   Returns $(true) if the element is in the set
+# ----------------------------------------------------------------------------
+set_is_member = $(__gmsl_tr2)$(if $(filter $1,$2),$(true),$(false))
+
+# ----------------------------------------------------------------------------
+# Function:  set_union
+# Arguments: 1: A set
+#            2: Another set
+# Returns:   Returns the union of the two sets
+# ----------------------------------------------------------------------------
+set_union = $(__gmsl_tr2)$(sort $1 $2)
+
+# ----------------------------------------------------------------------------
+# Function:  set_intersection
+# Arguments: 1: A set
+#            2: Another set
+# Returns:   Returns the intersection of the two sets
+# ----------------------------------------------------------------------------
+set_intersection = $(__gmsl_tr2)$(filter $1,$2)
+
+# ----------------------------------------------------------------------------
+# Function:  set_is_subset
+# Arguments: 1: A set
+#            2: Another set
+# Returns:   Returns $(true) if the first set is a subset of the second
+# ----------------------------------------------------------------------------
+set_is_subset = $(__gmsl_tr2)$(call set_equal,$(call set_intersection,$1,$2),$1)
+
+# ----------------------------------------------------------------------------
+# Function:  set_equal
+# Arguments: 1: A set
+#            2: Another set
+# Returns:   Returns $(true) if the two sets are identical
+# ----------------------------------------------------------------------------
+set_equal = $(__gmsl_tr2)$(call seq,$1,$2)
+
+# ###########################################################################
+# ARITHMETIC LIBRARY
+# ###########################################################################
+
+# Integers a represented by lists with the equivalent number of x's.
+# For example the number 4 is x x x x.  The maximum integer that the
+# library can handle as _input_ is __gmsl_input_int which is defined
+# here as 65536
+
+__gmsl_sixteen := x x x x x x x x x x x x x x x x
+__gmsl_input_int := $(foreach a,$(__gmsl_sixteen),         \
+                        $(foreach b,$(__gmsl_sixteen),     \
+                            $(foreach c,$(__gmsl_sixteen), \
+                                $(__gmsl_sixteen)))))
+
+# ----------------------------------------------------------------------------
+# Function:  int_decode
+# Arguments: 1: A number of x's representation
+# Returns:   Returns the integer for human consumption that is represented
+#            by the string of x's
+# ----------------------------------------------------------------------------
+int_decode = $(__gmsl_tr1)$(words $1)
+
+# ----------------------------------------------------------------------------
+# Function:  int_encode
+# Arguments: 1: A number in human-readable integer form
+# Returns:   Returns the integer encoded as a string of x's
+# ----------------------------------------------------------------------------
+int_encode = $(__gmsl_tr1)$(wordlist 1,$1,$(__gmsl_input_int))
+
+# The arithmetic library functions come in two forms: one form of each
+# function takes integers as arguments and the other form takes the
+# encoded form (x's created by a call to int_encode).  For example,
+# there are two plus functions:
+#
+# plus        Called with integer arguments and returns an integer
+# int_plus    Called with encoded arguments and returns an encoded result
+#
+# plus will be slower than int_plus because its arguments and result
+# have to be translated between the x's format and integers.  If doing
+# a complex calculation use the int_* forms with a single encoding of
+# inputs and single decoding of the output.  For simple calculations
+# the direct forms can be used.
+
+# Helper function used to wrap an int_* function into a function that
+# takes a pair of integers, perhaps a function and returns an integer
+# result
+__gmsl_int_wrap = $(call int_decode,$(call $1,$(call int_encode,$2),$(call int_encode,$3)))
+__gmsl_int_wrap1 = $(call int_decode,$(call $1,$(call int_encode,$2)))
+__gmsl_int_wrap2 = $(call $1,$(call int_encode,$2),$(call int_encode,$3))
+
+# ----------------------------------------------------------------------------
+# Function:  int_plus
+# Arguments: 1: A number in x's representation
+#            2: Another number in x's represntation
+# Returns:   Returns the sum of the two numbers in x's representation
+# ----------------------------------------------------------------------------
+int_plus = $(strip $(__gmsl_tr2)$1 $2)
+
+# ----------------------------------------------------------------------------
+# Function:  plus (wrapped version of int_plus)
+# Arguments: 1: An integer
+#            2: Another integer
+# Returns:   Returns the sum of the two integers
+# ----------------------------------------------------------------------------
+plus = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_plus,$1,$2)
+
+# ----------------------------------------------------------------------------
+# Function:  int_subtract
+# Arguments: 1: A number in x's representation
+#            2: Another number in x's represntation
+# Returns:   Returns the difference of the two numbers in x's representation,
+#            or outputs an error on a numeric underflow
+# ----------------------------------------------------------------------------
+int_subtract = $(strip $(__gmsl_tr2)$(if $(call int_gte,$1,$2), \
+                $(filter-out xx,$(join $1,$2)),                 \
+                $(call __gmsl_warning,Subtraction underflow)))
+
+# ----------------------------------------------------------------------------
+# Function:  subtract (wrapped version of int_subtract)
+# Arguments: 1: An integer
+#            2: Another integer
+# Returns:   Returns the difference of the two integers,
+#            or outputs an error on a numeric underflow
+# ----------------------------------------------------------------------------
+subtract = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_subtract,$1,$2)
+
+# ----------------------------------------------------------------------------
+# Function:  int_multiply
+# Arguments: 1: A number in x's representation
+#            2: Another number in x's represntation
+# Returns:   Returns the product of the two numbers in x's representation
+# ----------------------------------------------------------------------------
+int_multiply = $(strip $(__gmsl_tr2)$(foreach a,$1,$2))
+
+# ----------------------------------------------------------------------------
+# Function:  multiply (wrapped version of int_multiply)
+# Arguments: 1: An integer
+#            2: Another integer
+# Returns:   Returns the product of the two integers
+# ----------------------------------------------------------------------------
+multiply = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_multiply,$1,$2)
+
+# ----------------------------------------------------------------------------
+# Function:  int_divide
+# Arguments: 1: A number in x's representation
+#            2: Another number in x's represntation
+# Returns:   Returns the result of integer division of argument 1 divided
+#            by argument 2 in x's representation
+# ----------------------------------------------------------------------------
+int_divide = $(__gmsl_tr2)$(strip $(if $2,                                 \
+                 $(if $(call int_gte,$1,$2),                               \
+                     x $(call int_divide,$(call int_subtract,$1,$2),$2),), \
+                 $(call __gmsl_error,Division by zero)))
+
+# ----------------------------------------------------------------------------
+# Function:  divide (wrapped version of int_divide)
+# Arguments: 1: An integer
+#            2: Another integer
+# Returns:   Returns the integer division of the first argument by the second
+# ----------------------------------------------------------------------------
+divide = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_divide,$1,$2)
+
+# ----------------------------------------------------------------------------
+# Function:  int_max, int_min
+# Arguments: 1: A number in x's representation
+#            2: Another number in x's represntation
+# Returns:   Returns the maximum or minimum of its arguments in x's
+#            representation
+# ----------------------------------------------------------------------------
+int_max = $(__gmsl_tr2)$(subst xx,x,$(join $1,$2))
+int_min = $(__gmsl_tr2)$(subst xx,x,$(filter xx,$(join $1,$2)))
+
+# ----------------------------------------------------------------------------
+# Function:  max, min
+# Arguments: 1: An integer
+#            2: Another integer
+# Returns:   Returns the maximum or minimum of its integer arguments
+# ----------------------------------------------------------------------------
+max = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_max,$1,$2)
+min = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_min,$1,$2)
+
+# ----------------------------------------------------------------------------
+# Function: int_gt, int_gte, int_lt, int_lte, int_eq, int_ne
+# Arguments: Two x's representation numbers to be compared
+# Returns:   $(true) or $(false)
+#
+# int_gt    First argument greater than second argument
+# int_gte   First argument greater than or equal to second argument
+# int_lt    First argument less than second argument 
+# int_lte   First argument less than or equal to second argument
+# int_eq    First argument is numerically equal to the second argument
+# int_ne    First argument is not numerically equal to the second argument
+# ----------------------------------------------------------------------------
+int_gt = $(__gmsl_tr2)$(call __gmsl_make_bool,      \
+                          $(filter-out $(words $2), \
+                              $(words $(call int_max,$1,$2))))
+int_gte = $(__gmsl_tr2)$(call __gmsl_make_bool,     \
+                           $(call int_gt,$1,$2)$(call int_eq,$1,$2))
+int_lt = $(__gmsl_tr2)$(call __gmsl_make_bool,      \
+                          $(filter-out $(words $1), \
+                              $(words $(call int_max,$1,$2))))
+int_lte = $(__gmsl_tr2)$(call __gmsl_make_bool,     \
+                           $(call int_lt,$1,$2)$(call int_eq,$1,$2))
+int_eq = $(__gmsl_tr2)$(call __gmsl_make_bool,      \
+                          $(filter $(words $1),$(words $2)))
+int_ne = $(__gmsl_tr2)$(call __gmsl_make_bool,      \
+                          $(filter-out $(words $1),$(words $2)))
+
+# ----------------------------------------------------------------------------
+# Function: gt, gte, lt, lte, eq, ne
+# Arguments: Two integers to be compared
+# Returns:   $(true) or $(false)
+#
+# gt    First argument greater than second argument
+# gte   First argument greater than or equal to second argument
+# lt    First argument less than second argument 
+# lte   First argument less than or equal to second argument
+# eq    First argument is numerically equal to the second argument
+# ne    First argument is not numerically equal to the second argument
+# ----------------------------------------------------------------------------
+gt = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_gt,$1,$2)
+gte = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_gte,$1,$2)
+lt = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_lt,$1,$2)
+lte = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_lte,$1,$2)
+eq = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_eq,$1,$2)
+ne = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_ne,$1,$2)
+
+# increment adds 1 to its argument, decrement subtracts 1.  Note that
+# decrement does not range check and hence will not underflow, but
+# will incorrectly say that 0 - 1 = 0
+
+# ----------------------------------------------------------------------------
+# Function:  int_inc
+# Arguments: 1: A number in x's representation
+# Returns:   The number incremented by 1 in x's representation
+# ----------------------------------------------------------------------------
+int_inc = $(strip $(__gmsl_tr1)$1 x)
+
+# ----------------------------------------------------------------------------
+# Function:  inc
+# Arguments: 1: An integer
+# Returns:   The argument incremented by 1
+# ----------------------------------------------------------------------------
+inc = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_inc,$1)
+
+# ----------------------------------------------------------------------------
+# Function:  int_dec
+# Arguments: 1: A number in x's representation
+# Returns:   The number decremented by 1 in x's representation
+# ----------------------------------------------------------------------------
+int_dec = $(__gmsl_tr1)$(strip $(if $(call sne,0,$(words $1)), \
+              $(wordlist 2,$(words $1),$1),                    \
+              $(call __gmsl_warning,Decrement underflow)))
+
+# ----------------------------------------------------------------------------
+# Function:  dec
+# Arguments: 1: An integer
+# Returns:   The argument decremented by 1
+# ----------------------------------------------------------------------------
+dec = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_dec,$1)
+
+# double doubles its argument, and halve halves it
+
+# ----------------------------------------------------------------------------
+# Function:  int_double
+# Arguments: 1: A number in x's representation
+# Returns:   The number doubled (i.e. * 2) and returned in x's representation
+# ----------------------------------------------------------------------------
+int_double = $(strip $(__gmsl_tr1)$1 $1)
+
+# ----------------------------------------------------------------------------
+# Function:  double
+# Arguments: 1: An integer
+# Returns:   The integer times 2
+# ----------------------------------------------------------------------------
+double = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_double,$1)
+
+# ----------------------------------------------------------------------------
+# Function:  int_halve
+# Arguments: 1: A number in x's representation
+# Returns:   The number halved (i.e. / 2) and returned in x's representation
+# ----------------------------------------------------------------------------
+int_halve = $(__gmsl_tr1)$(strip $(subst xx,x,$(filter-out xy x y, \
+                             $(join $1,$(foreach a,$1,y x)))))
+
+# ----------------------------------------------------------------------------
+# Function:  halve
+# Arguments: 1: An integer
+# Returns:   The integer divided by 2
+# ----------------------------------------------------------------------------
+halve = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_halve,$1)
+
+ifdef __gmsl_have_eval
+# ###########################################################################
+# ASSOCIATIVE ARRAYS
+# ###########################################################################
+
+# ----------------------------------------------------------------------------
+# Function:  set
+# Arguments: 1: Name of associative array
+#            2: The key value to associate
+#            3: The value associated with the key
+# Returns:   None
+# ----------------------------------------------------------------------------
+set = $(__gmsl_tr3)$(call assert_no_dollar,$0,$1$2$3)$(eval __gmsl_aa_$1_$2 = $3)
+
+# ----------------------------------------------------------------------------
+# Function:  get
+# Arguments: 1: Name of associative array
+#            2: The key to retrieve
+# Returns:   The value stored in the array for that key
+# ----------------------------------------------------------------------------
+get = $(strip $(__gmsl_tr2)$(call assert_no_dollar,$0,$1$2)$(if $(filter-out undefined,$(origin __gmsl_aa_$1_$2)), \
+    $(__gmsl_aa_$1_$2)))
+
+# ----------------------------------------------------------------------------
+# Function:  keys
+# Arguments: 1: Name of associative array
+# Returns:   Returns a list of all defined keys in the array
+# ----------------------------------------------------------------------------
+keys = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(sort $(patsubst __gmsl_aa_$1_%,%, \
+                  $(filter __gmsl_aa_$1_%,$(.VARIABLES))))
+
+# ----------------------------------------------------------------------------
+# Function:  defined
+# Arguments: 1: Name of associative array
+#            2: The key to test
+# Returns:   Returns true if the key is defined (i.e. not empty)
+# ----------------------------------------------------------------------------
+defined = $(__gmsl_tr2)$(call assert_no_dollar,$0,$1$2)$(call sne,$(call get,$1,$2),)
+
+endif # __gmsl_have_eval
+
+ifdef __gmsl_have_eval
+# ###########################################################################
+# NAMED STACKS
+# ###########################################################################
+
+# ----------------------------------------------------------------------------
+# Function:  push
+# Arguments: 1: Name of stack
+#            2: Value to push onto the top of the stack (must not contain
+#               a space)
+# Returns:   None
+# ----------------------------------------------------------------------------
+push = $(__gmsl_tr2)$(call assert_no_dollar,$0,$1$2)$(eval __gmsl_stack_$1 := $2 $(if $(filter-out undefined,\
+    $(origin __gmsl_stack_$1)),$(__gmsl_stack_$1)))
+
+# ----------------------------------------------------------------------------
+# Function:  pop
+# Arguments: 1: Name of stack
+# Returns:   Top element from the stack after removing it
+# ----------------------------------------------------------------------------
+pop = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(strip $(if $(filter-out undefined,$(origin __gmsl_stack_$1)), \
+    $(call first,$(__gmsl_stack_$1))                                       \
+    $(eval __gmsl_stack_$1 := $(call rest,$(__gmsl_stack_$1)))))
+
+# ----------------------------------------------------------------------------
+# Function:  peek
+# Arguments: 1: Name of stack
+# Returns:   Top element from the stack without removing it
+# ----------------------------------------------------------------------------
+peek = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(call first,$(__gmsl_stack_$1))
+
+# ----------------------------------------------------------------------------
+# Function:  depth
+# Arguments: 1: Name of stack
+# Returns:   Number of items on the stack
+# ----------------------------------------------------------------------------
+depth = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(words $(__gmsl_stack_$1))
+
+endif # __gmsl_have_eval
+
+# ###########################################################################
+# DEBUGGING FACILITIES
+# ###########################################################################
+
+# ----------------------------------------------------------------------------
+# Target:    gmsl-print-%
+# Arguments: The % should be replaced by the name of a variable that you
+#            wish to print out.
+# Action:    Echos the name of the variable that matches the % and its value.
+#            For example, 'make gmsl-print-SHELL' will output the value of
+#            the SHELL variable
+# ----------------------------------------------------------------------------
+gmsl-print-%: ; @echo $* = $($*)
+
+# ----------------------------------------------------------------------------
+# Function:  assert
+# Arguments: 1: A boolean that must be true or the assertion will fail
+#            2: The message to print with the assertion
+# Returns:   None
+# ----------------------------------------------------------------------------
+assert = $(if $1,,$(call __gmsl_error,Assertion failure: $2))
+
+# ----------------------------------------------------------------------------
+# Function:  assert_exists
+# Arguments: 1: Name of file that must exist, if it is missing an assertion
+#               will be generated
+# Returns:   None
+# ----------------------------------------------------------------------------
+assert_exists = $(call assert,$(wildcard $1),file '$1' missing)
+
+# ----------------------------------------------------------------------------
+# Function:  assert_no_dollar
+# Arguments: 1: Name of a function being executd
+#            2: Arguments to check
+# Returns:   None
+# ----------------------------------------------------------------------------
+assert_no_dollar = $(call assert,$(call not,$(findstring $$,$2)),$1 called with a dollar sign in argument)
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/binrpm.spec-generic oracleasm-git/vendor/common/binrpm.spec-generic
--- oracleasm-2.0.5/vendor/common/binrpm.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/common/binrpm.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,100 @@
+#
+# Spec file for a pre-built oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+# This must be changed to the minimum ABI compat kernel version expected
+%define kver		@@KERNEL_VERSION@@
+
+# The minimum -support package required for the kernel bits.
+%define support_ver     2.0.0
+# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
+%define min_enodev	2.0.1
+
+Summary: The Oracle Automatic Storage Management library driver.
+Name: oracleasm-%{kver}
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@.built
+License: GPL
+Group: System Environment/Kernel
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+%description
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is built out of a compiled source tree.
+
+
+%build
+%install
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+%clean
+#echo rm -rf "$RPM_BUILD_ROOT"
+
+
+%post
+depmod -ae %{kver}
+
+%files
+%defattr(-,root,root)
+/lib/modules/
+
+
+%changelog
+* Thu Jan 15 2009 Joel Becker <joel.becker@oracle.com>
+- Build a package out of a compiled tree.
+
+* Mon Nov 12 2007 Sunil Mushran <sunil.mushran@oracle.com>
+- Add support to build modules for kernel-debug for RHEL5
+
+* Wed Apr 18 2007 Joel Becker <joel.becker@oracle.com>
+- Add RHEL5
+
+* Fri Feb 09 2007 Joel Becker <joel.becker@oracle.com>
+- Strip down for Fedora Core 6
+
+* Thu May 25 2006 Joel Becker <joel.becker@oracle.com>
+- Add largesmp
+
+* Fri Feb 04 2005 Joel Becker <joel.becker@oracle.com>
+- Make RHEL4 specfile.
+
+* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
+- Make SLES9 specfile.
+
+* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
+- Make kernel-only.
+
+* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
+- Add x86 and ia64 targets.
+
+* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
+- Make the UL SP3 changes.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/gmsl oracleasm-git/vendor/common/gmsl
--- oracleasm-2.0.5/vendor/common/gmsl	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/common/gmsl	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,89 @@
+# ----------------------------------------------------------------------------
+#
+# GNU Make Standard Library (GMSL)
+#
+# A library of functions to be used with GNU Make's $(call) that
+# provides functionality not available in standard GNU Make.
+#
+# Copyright (c) 2005-2008 John Graham-Cumming
+#
+# This file is part of GMSL
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 
+# 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.
+#
+# Neither the name of the John Graham-Cumming 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 COPYRIGHT HOLDERS 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
+# COPYRIGHT OWNER 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.
+#
+# ----------------------------------------------------------------------------
+
+# Determine if the library has already been included and if so don't
+# bother including it again
+
+ifndef __gmsl_included
+
+# Standard definitions for true and false.  true is any non-empty
+# string, false is an empty string. These are intended for use with
+# $(if).
+
+true  := T
+false :=
+
+# ----------------------------------------------------------------------------
+# Function:  not
+# Arguments: 1: A boolean value
+# Returns:   Returns the opposite of the arg. (true -> false, false -> true)
+# ----------------------------------------------------------------------------
+not = $(if $1,$(false),$(true))
+
+# Prevent reinclusion of the library
+
+__gmsl_included := $(true)
+
+# Try to determine where this file is located.  If the caller did
+# include /foo/gmsl then extract the /foo/ so that __gmsl gets
+# included transparently
+
+ifneq ($(MAKEFILE_LIST),)
+__gmsl_root := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+
+# If there are any spaces in the path in __gmsl_root then give up
+
+ifeq (1,$(words $(__gmsl_root)))
+__gmsl_root := $(patsubst %gmsl,%,$(__gmsl_root))
+else
+__gmsl_root :=
+endif
+
+include $(__gmsl_root)__gmsl
+
+else
+
+include __gmsl
+
+endif
+
+endif # __gmsl_included
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/oracleasm-headers.spec-generic oracleasm-git/vendor/common/oracleasm-headers.spec-generic
--- oracleasm-2.0.5/vendor/common/oracleasm-headers.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/common/oracleasm-headers.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,102 @@
+#
+# Spec file for oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+# Turn on's and off's (summit and debug not used but added
+# for future proofing)
+
+
+
+Summary: The Oracle Automatic Storage Management driver ABI headers.
+Name: oracleasm-headers
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@.@@VENDOR_EXTENSION@@
+License: GPL
+Group: System Environment/Kernel
+Source: oracleasm-@@DIST_VERSION@@.tar.gz
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+# Requires: What, for /usr/include/linux??
+Requires: @@INCLUDE_REQUIRES@@
+AutoReqProv: no
+
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+
+
+%description
+Headers that define the ABI between the Oracle Linux ASMLib kernel driver
+and userspace programs.
+
+
+%prep
+%setup -n oracleasm-%{version}
+
+
+%build
+./configure					\
+	--prefix=%{_prefix}			\
+	--exec-prefix=%{_exec_prefix}		\
+	--bindir=%{_bindir}			\
+	--sbindir=%{_sbindir}			\
+	--sysconfdir=%{_sysconfdir}		\
+	--datadir=%{_datadir}			\
+	--includedir=%{_includedir}		\
+	--libdir=%{_libdir}			\
+	--libexecdir=%{_libexecdir}		\
+	--localstatedir=%{_localstatedir}	\
+	--sharedstatedir=%{_sharedstatedir}	\
+	--mandir=%{_mandir}			\
+	--infodir=%{_infodir}			\
+	--sbindir=/usr/sbin
+
+#make
+
+
+%install
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' -C include install
+
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+
+%post
+
+%files
+%defattr(-,root,root)
+/usr/include/linux/oracleasm
+
+
+
+%changelog
+* Tue Jul 04 2006 Joel Becker <joel.becker@oracle.com>
+- Make headers package
+
+* Wed Jan 07 2004 Joel Becker <joel.becker@oracle.com>
+- Make open package.
+
+* Thu Dec 11 2003 Joel Becker <joel.becker@oracle.com>
+- Try at userspace thingie.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/oracleasm-headers.spec-generic.in oracleasm-git/vendor/common/oracleasm-headers.spec-generic.in
--- oracleasm-2.0.5/vendor/common/oracleasm-headers.spec-generic.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/common/oracleasm-headers.spec-generic.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,102 +0,0 @@
-#
-# Spec file for oracleasm
-#
-
-# Macros
-# This one is hardcoded because, well, it belongs there
-%define _prefix /usr
-# Because RPM is dumb
-%define _unpackaged_files_terminate_build 0
-
-# Turn on's and off's (summit and debug not used but added
-# for future proofing)
-
-
-
-Summary: The Oracle Automatic Storage Management driver ABI headers.
-Name: oracleasm-headers
-Version: @DIST_VERSION@
-Release: @@PKG_VERSION@@.@@VENDOR_EXTENSION@@
-License: GPL
-Group: System Environment/Kernel
-Source: oracleasm-@DIST_VERSION@.tar.gz
-URL: http://oss.oracle.com/projects/oracleasm/
-Distribution: Oracle
-Vendor: Oracle Corporation
-Packager: Joel Becker <joel.becker@oracle.com>
-# Requires: What, for /usr/include/linux??
-Requires: @@INCLUDE_REQUIRES@@
-AutoReqProv: no
-
-
-BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
-
-
-
-%description
-Headers that define the ABI between the Oracle Linux ASMLib kernel driver
-and userspace programs.
-
-
-%prep
-%setup -n oracleasm-%{version}
-
-
-%build
-./configure					\
-	--prefix=%{_prefix}			\
-	--exec-prefix=%{_exec_prefix}		\
-	--bindir=%{_bindir}			\
-	--sbindir=%{_sbindir}			\
-	--sysconfdir=%{_sysconfdir}		\
-	--datadir=%{_datadir}			\
-	--includedir=%{_includedir}		\
-	--libdir=%{_libdir}			\
-	--libexecdir=%{_libexecdir}		\
-	--localstatedir=%{_localstatedir}	\
-	--sharedstatedir=%{_sharedstatedir}	\
-	--mandir=%{_mandir}			\
-	--infodir=%{_infodir}			\
-	--sbindir=/usr/sbin
-
-make
-
-
-%install
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install
-
-
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
-
-%post
-
-%files
-%defattr(-,root,root)
-/usr/include/linux/oracleasm
-
-
-
-%changelog
-* Tue Jul 04 2006 Joel Becker <joel.becker@oracle.com>
-- Make headers package
-
-* Wed Jan 07 2004 Joel Becker <joel.becker@oracle.com>
-- Make open package.
-
-* Thu Dec 11 2003 Joel Becker <joel.becker@oracle.com>
-- Try at userspace thingie.
-
-* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
-- Start the ASM rename.
-
-* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
-- Created EL3 version
-
-* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
-- Added osm-lib bits
-
-* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
-- Initial RPM
-
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/common/subst.make oracleasm-git/vendor/common/subst.make
--- oracleasm-2.0.5/vendor/common/subst.make	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/common/subst.make	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,67 @@
+#
+# Substitution helpers
+#
+# Written by Martin K. Petersen <martin.petersen@oracle.com>
+#
+
+#
+# Available for substitution in spec files
+#
+SUBST_VARS := PKG_VERSION DIST_VERSION VENDOR_EXTENSION INCLUDE_REQUIRES \
+	    KERNEL_VERSION KERNEL_REQUIRES LARGESMP XEN DEBUG
+
+#
+# Substitute @@VAR@@ from list above in $<
+#
+define spec_subst
+sed $(foreach SUB, $(SUBST_VARS), $(shell echo "-e s/@@$(SUB)@@/$($(SUB))/")) < $<
+endef
+
+#
+# Helpers for extracting kernel version information from a spec file
+# name.  foo/bar/baz/kernel-2.6.32.9-0315.43.OLE.spec will yield:
+#
+
+# kernel
+define get_name
+$(shell echo $(notdir $@) | sed -re "s/\.spec//" -e \
+	"s/(^[A-Za-z0-9_+\.\-]+)-([A-Za-z0-9_+\.]+)-([A-Za-z0-9_+\.]+)/\1/;")
+endef
+
+# 2.6.32.9-0315.43.OLE
+define get_version_release
+$(shell echo $(notdir $@) | sed -re "s/\.spec//" -e \
+	"s/(^[A-Za-z0-9_+\.\-]+)-([A-Za-z0-9_+\.]+)-([A-Za-z0-9_+\.]+)/\2-\3/;")
+endef
+
+# 2.6.32.9
+define get_version
+$(shell echo $(notdir $@) | sed -re "s/\.spec//" -e \
+	"s/(^[A-Za-z0-9_+\.\-]+)-([A-Za-z0-9_+\.]+)-([A-Za-z0-9_+\.]+)/\2/;")
+endef
+
+# 2.6
+define get_version_major
+$(shell echo $(notdir $@) | sed -re "s/\.spec//" -e \
+	"s/(^[A-Za-z0-9_+\.\-]+)-([0-9]+\.[0-9]+)(\.[0-9\.]+)?-([A-Za-z0-9_+\.]+)/\2/;")
+endef
+
+# 32.9
+define get_version_minor
+$(shell echo $(notdir $@) | sed -re "s/\.spec//" -e \
+	"s/(^[A-Za-z0-9_+\.\-]+)-([0-9]+\.[0-9]+)(\.[0-9\.]+)?-([A-Za-z0-9_+\.]+)/\3/;" \
+	-e "s/^\.//")
+endef
+
+# 0315.43.OLE
+define get_release
+$(shell echo $(notdir $@) | sed -re "s/\.spec//" -e \
+	"s/(^[A-Za-z0-9_+\.\-]+)-([A-Za-z0-9_+\.]+)-([A-Za-z0-9_+\.]+)/\3/;")
+endef
+
+# 0315
+define get_release_major
+$(shell echo $(notdir $@) | sed -re "s/\.spec//" -e \
+	"s/(^[A-Za-z0-9_+\.\-]+)-([A-Za-z0-9_+\.]+)-([0-9]+).*/\3/;")
+endef
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fc6/Makefile oracleasm-git/vendor/fc6/Makefile
--- oracleasm-2.0.5/vendor/fc6/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/fc6/Makefile	1970-01-01 01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-TOPDIR = ../..
-
-include $(TOPDIR)/Preamble.make
-
-DIST_FILES = 				\
-	oracleasm.spec-generic.in	\
-	kernel.guess			\
-	rpmarch.guess			\
-	Vendor.make			\
-	vendor.guess
-
-include $(TOPDIR)/Postamble.make
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fc6/Vendor.make oracleasm-git/vendor/fc6/Vendor.make
--- oracleasm-2.0.5/vendor/fc6/Vendor.make	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/fc6/Vendor.make	1970-01-01 01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
-#
-# FC6
-#
-
-TOOLSARCH = $(shell $(TOPDIR)/vendor/fc6/rpmarch.guess tools $(TOPDIR))
-MODULEARCH = $(shell $(TOPDIR)/vendor/fc6/rpmarch.guess module $(TOPDIR))
-VENDOR_EXTENSION = fc6
-
-$(TOPDIR)/vendor/fc6/oracleasm-%.spec: $(TOPDIR)/vendor/fc6/oracleasm.spec-generic
-	SPECVER="$@"; \
-		SPECVER="$${SPECVER#*oracleasm-}"; \
-		SPECVER="$${SPECVER%.spec}"; \
-		LARGEVER="$${SPECVER#2.6.9-}"; \
-		LARGEVER="$${LARGEVER%%.*}"; \
-		if [ "$${LARGEVER}" -lt 34 ]; \
-		then \
-			LARGESMP=0; \
-		else \
-			LARGESMP=1; \
-		fi; \
-		sed -e 's/@@KVER@@/'$${SPECVER}'/' -e 's/@@PKG_VERSION@@/'$(PKG_VERSION)'/' -e 's/@@LARGESMP@@/'$${LARGESMP}'/' < $< > $@
-
-fc6_%_srpm: dist $(TOPDIR)/vendor/fc6/oracleasm-%.spec
-	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" $(TOPDIR)/vendor/fc6/oracleasm-$(patsubst fc6_%_srpm,%,$@).spec
-
-fc6_%_rpm: fc6_%_srpm
-	rpmbuild --rebuild $(MODULEARCH) "oracleasm-$(patsubst fc6_%_rpm,%,$@)-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm"
-
-
-# Package required for /usr/include/linux
-INCLUDE_REQUIRES = glibc-kernheaders
-include $(TOPDIR)/vendor/common/Vendor.make
-
-packages: $(shell $(TOPDIR)/vendor/fc6/kernel.guess targets) headers_rpm
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fc6/kernel.guess oracleasm-git/vendor/fc6/kernel.guess
--- oracleasm-2.0.5/vendor/fc6/kernel.guess	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/fc6/kernel.guess	1970-01-01 01:00:00.000000000 +0100
@@ -1,221 +0,0 @@
-#!/bin/sh
-
-
-FC6_KERNEL_BASE="/usr/src/kernels"
-
-#
-# This is a simple mapping of architectures to kernel flavors.  One
-# entry per architecture, <arch>:<flavor1>[,<flavor> ...]
-#
-# This is used when detecting kernels to build packages for.  A kernel
-# is only built if build trees for all flavors are installed.
-#
-# Unique to redhat, empty types (the 'default' kernel) are allowed.
-# Be careful parsing this!
-#
-# Fedora Core only has one type of kernel.  It's always SMP.  So we have
-# a very simple type list :-)
-#
-FC6_KERNEL_TYPES="
-    i686:
-    x86_64:
-    ia64:
-    ppc64:
-    s390x:
-"
-
-
-
-guess_fc6_arch()
-{
-    # This appears to DTRT (i686 on x86, ppc64 on pSeries).
-    uname -m
-}
-
-guess_fc6_type()
-{
-    # Only one type for fc6
-    case "$1" in
-    *)
-        echo ""
-        ;;
-    esac
-}
-
-guess_fc6_dir()
-{
-    KVER="$1"
-
-    DIRTYPE=$(guess_fc6_type "$KVER")
-    ARCH=$(guess_fc6_arch)
-
-    if [ -z "$DIRTYPE" ]
-    then
-        echo "${1%${DIRTYPE}}-${ARCH}"
-    else
-        echo "${1%${DIRTYPE}}-${DIRTYPE}-${ARCH}"
-    fi
-}
-
-verfromdir()
-{
-    TESTDIR="$1"
-    if [ -r "${TESTDIR}/include/linux/utsrelease.h" ]
-    then
-        awk '/UTS_RELEASE/{gsub(/"/,"",$3); print $3}' "${TESTDIR}/include/linux/utsrelease.h"
-    fi
-}
-
-validate_dir()
-{
-    KVER="$1"
-    DIR="$2"
-
-    if [ ! -d "${FC6_KERNEL_BASE}/${DIR}" ]
-    then
-        return 1
-    elif [ ! -f "${FC6_KERNEL_BASE}/${DIR}/include/linux/autoconf.h" ]
-    then
-        return 1
-    elif [ ! -f "${FC6_KERNEL_BASE}/${DIR}/include/linux/version.h" ]
-    then
-        return 1
-    fi
-
-    if [ "$KVER" != "$(verfromdir "${FC6_KERNEL_BASE}/${DIR}")" ]
-    then
-        return 1
-    fi
-
-    return 0
-}
-
-# Takes a `uname -r` and returns "ver type", where ver
-# is 2.6.9-NN.EL and type is "smp" or the like.
-validate_version()
-{
-    KVER="$1"
-
-    dir=$(guess_fc6_dir "$KVER")
-    if validate_dir "$KVER" "$dir"
-    then
-        echo "${FC6_KERNEL_BASE}/${dir}"
-    fi
-}
-
-find_version()
-{
-    # Find the most recent valid kernel
-    ls -1 -t "$FC6_KERNEL_BASE" | while read kdir
-    do
-        KVER="$(verfromdir "${FC6_KERNEL_BASE}/${kdir}")"
-        if validate_dir "$KVER" "$kdir"
-        then
-            echo "${FC6_KERNEL_BASE}/${kdir}"
-            break
-        fi
-    done
-}
-
-# For a given KVER, see if all the -devel packages exist
-validate_target()
-{
-    KVER="$1"
-    ARCH="$2"
-    TYPELIST="$3"
-
-    typelist="${TYPELIST#$ARCH:}"
-    while :
-    do
-        type="${typelist%%,*}"
-        VERDIR="$(validate_version ${KVER}${type})"
-        if [ -z "$VERDIR" ]
-        then
-            return 1
-        fi
-    
-        # This loop walks the list of types being careful of the empty
-        # typename
-        tmp="${typelist#*,}"
-        if [ -z "$tmp" -o "$tmp" = "$typelist" ]
-        then
-            break
-        fi
-        typelist="$tmp"
-    done
-
-    return 0
-}
-
-find_targets()
-{
-    # Pre-calculate ARCH and TYPELIST, at least
-    ARCH="$(guess_fc6_arch)"
-    if [ -z "$ARCH" ]
-    then
-        return
-    fi
-
-    TYPELIST=
-    for typelist in $FC6_KERNEL_TYPES
-    do
-        TARCH=$(echo "$typelist" | cut -f1 -d:)
-        if [ "$TARCH" = "$ARCH" ]
-        then
-            TYPELIST="$typelist"
-            break
-        fi
-    done
-
-    if [ -z "$TYPELIST" ]
-    then
-        return
-    fi
-    
-    ls -1 -t "$FC6_KERNEL_BASE" | while read kdir
-    do
-        KVER="$(verfromdir "${FC6_KERNEL_BASE}/${kdir}")"
-        if ! validate_dir "$KVER" "$kdir"
-        then
-            continue
-        fi
-        if validate_target "$KVER" "$ARCH" "$TYPELIST"
-        then
-            echo "fc6_${KVER}_rpm"
-        fi
-    done
-}
-
-case "$1" in
-include|build)
-    if [ -n "$2" ]
-    then
-        KPATH="$(validate_version "$2")"
-    else
-        KVER="$(uname -r)"
-        KPATH="$(validate_version "$KVER")"
-        if [ -z "$KPATH" ]
-        then
-            KPATH="$(find_version)"
-        fi
-    fi
-    if [ -n "$KPATH" ]
-    then
-        if [ "$1" = "include" ]
-        then
-            KPATH="${KPATH}/include"
-        fi
-        echo "${KPATH}"
-    fi
-    ;;
-targets)
-    find_targets
-    ;;
-"")
-    echo "Missing operation" >&2
-    ;;
-*)
-    echo "Invalid operation: $1" >&2
-    exit 1
-    ;;
-esac
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fc6/oracleasm.spec-generic.in oracleasm-git/vendor/fc6/oracleasm.spec-generic.in
--- oracleasm-2.0.5/vendor/fc6/oracleasm.spec-generic.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/fc6/oracleasm.spec-generic.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,160 +0,0 @@
-#
-# Spec file for oracleasm
-#
-
-# Macros
-# This one is hardcoded because, well, it belongs there
-%define _prefix /usr
-# Because RPM is dumb
-%define _unpackaged_files_terminate_build 0
-
-%ifarch i686
-%define karch		i686
-%endif
-
-%ifarch x86_64
-%define karch		x86_64
-%endif
-
-%ifarch ia64
-%define karch		ia64
-%endif
-
-%ifarch ppc64
-%define karch		ppc64
-%endif
-
-%ifarch s390x
-%define karch		s390x
-%endif
-
-
-# This must be changed to the minimum ABI compat kernel version expected
-%define kver		@@KVER@@
-
-# The minimum -support package required for the kernel bits.
-%define support_ver     2.0.0
-# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
-%define min_enodev	2.0.1
-
-Summary: The Oracle Automatic Storage Management library driver.
-Name: oracleasm-%{kver}
-Version: @DIST_VERSION@
-Release: @@PKG_VERSION@@.fc6
-License: GPL
-Group: System Environment/Kernel
-Source: oracleasm-@DIST_VERSION@.tar.gz
-URL: http://oss.oracle.com/projects/oracleasm/
-Distribution: Oracle
-Vendor: Oracle Corporation
-Packager: Joel Becker <joel.becker@oracle.com>
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-devel = %{kver}
-
-
-BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
-
-
-%description
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the default kernel.
-
-
-
-%prep
-%setup -n oracleasm-%{version}
-
-
-%build
-
-local_configure()
-{
-	./configure					\
-		--prefix=%{_prefix}			\
-		--exec-prefix=%{_exec_prefix}		\
-		--bindir=%{_bindir}			\
-		--sbindir=%{_sbindir}			\
-		--sysconfdir=%{_sysconfdir}		\
-		--datadir=%{_datadir}			\
-		--includedir=%{_includedir}		\
-		--libdir=%{_libdir}			\
-		--libexecdir=%{_libexecdir}		\
-		--localstatedir=%{_localstatedir}	\
-		--sharedstatedir=%{_sharedstatedir}	\
-		--mandir=%{_mandir}			\
-		--infodir=%{_infodir}			\
-		--with-vendor=fc6			\
-		--with-vendorkernel="$1"
-}
-
-local_configure "%{kver}"
-
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-
-
-
-%install
-
-
-
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
-
-
-%post -n oracleasm-%{kver}
-depmod -ae %{kver}
-
-%files -n oracleasm-%{kver}
-%defattr(-,root,root)
-/lib/modules/%{kver}/kernel/drivers/addon/oracleasm
-
-
-
-%changelog
-* Fri Feb 09 2007 Joel Becker <joel.becker@oracle.com>
-- Strip down for Fedora Core 6
-
-* Thu May 25 2006 Joel Becker <joel.becker@oracle.com>
-- Add largesmp
-
-* Fri Feb 04 2005 Joel Becker <joel.becker@oracle.com>
-- Make RHEL4 specfile.
-
-* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
-- Make SLES9 specfile.
-
-* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
-- Make kernel-only.
-
-* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
-- Add x86 and ia64 targets.
-
-* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
-- Make the UL SP3 changes.
-
-* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
-- Start the ASM rename.
-
-* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
-- Created EL3 version
-
-* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
-- Added osm-lib bits
-
-* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
-- Initial RPM
-
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fc6/rpmarch.guess oracleasm-git/vendor/fc6/rpmarch.guess
--- oracleasm-2.0.5/vendor/fc6/rpmarch.guess	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/fc6/rpmarch.guess	1970-01-01 01:00:00.000000000 +0100
@@ -1,68 +0,0 @@
-#! /bin/sh
-
-mode="$1"
-srcdir="$2"
-
-host_cpu=
-
-
-QUERYFILE=/etc/fedora-release
-
-if test -n "$QUERYFILE"; then
-  host_cpu="`rpm -qf $QUERYFILE --queryformat \"%{ARCH}\"`"
-fi
-
-if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then
-  host_alias=`$srcdir/config.guess`
-  host=`$srcdir/config.sub $host_alias`
-  host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-fi
-
-case "$host_cpu" in
-  x86_64|ia64|s390x)
-    TOOLSARCH="$host_cpu"
-    ;;
-  i386|i486|i586|i686|i786|k6|k7)
-    TOOLSARCH="i386"
-    ;;
-  ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
-    TOOLSARCH="ppc64"
-    ;;
-  *)
-    echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2
-    TOOLSARCH=""
-    ;;
-esac
-
-# Only a few of these need to be overwritten from RPM's default
-case "$host_cpu" in
-  i386|i586)
-    MODULEARCH="i686"
-    ;;
-  ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
-    MODULEARCH="ppc64"
-    ;;
-  *)
-    MODULEARCH=""
-    ;;
-esac
-
-case "$mode" in
-  module)
-    if [ -n "$MODULEARCH" ] ; then
-      echo "--target $MODULEARCH"
-    fi
-    ;;
-  tools)
-    if [ -n "$TOOLSARCH" ] ; then
-      echo "--target $TOOLSARCH"
-    fi
-    ;;
-  *)
-    echo "rpmarch.guess: Invalid mode: $mode" >&2
-    echo "error"
-    exit 1
-    ;;
-esac
-
-exit 0
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fc6/vendor.guess oracleasm-git/vendor/fc6/vendor.guess
--- oracleasm-2.0.5/vendor/fc6/vendor.guess	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/fc6/vendor.guess	1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-if [ ! -f /etc/fedora-release ]
-then
-    exit 1
-fi
-
-if [ "`rpm -qf /etc/fedora-release --qf '%{VERSION}' 2>/dev/null`" != "6" ]
-then
-    exit 1
-fi
-
-exit 0
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fedora/Makefile oracleasm-git/vendor/fedora/Makefile
--- oracleasm-2.0.5/vendor/fedora/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/fedora/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,13 @@
+TOPDIR = ../..
+
+include $(TOPDIR)/Preamble.make
+
+DIST_FILES = 				\
+	oracleasm.spec-generic		\
+	kernel.guess			\
+	rpmarch.guess			\
+	rpmdist.guess			\
+	Vendor.make			\
+	vendor.guess
+
+include $(TOPDIR)/Postamble.make
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fedora/Vendor.make oracleasm-git/vendor/fedora/Vendor.make
--- oracleasm-2.0.5/vendor/fedora/Vendor.make	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/fedora/Vendor.make	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,30 @@
+#
+# Fedora
+#
+
+TOOLSARCH = $(shell $(TOPDIR)/vendor/fedora/rpmarch.guess tools $(TOPDIR))
+MODULEARCH = $(shell $(TOPDIR)/vendor/fedora/rpmarch.guess module $(TOPDIR))
+VENDOR_EXTENSION = $(shell $(TOPDIR)/vendor/fedora/rpmdist.guess)
+INCLUDE_REQUIRES = glibc-kernheaders
+
+$(TOPDIR)/vendor/fedora/oracleasm-%.spec: \
+	KERNEL_VERSION = $(get_version_release)
+
+$(TOPDIR)/vendor/fedora/oracleasm-%.spec: $(TOPDIR)/vendor/fedora/oracleasm.spec-generic
+	$(spec_subst) > $@
+
+fedora_%_srpm: $(TOPDIR)/vendor/fedora/oracleasm-%.spec dist
+	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" \
+		$(TOPDIR)/vendor/fedora/oracleasm-$(patsubst fedora_%_srpm,%,$@).spec
+	@rm $(TOPDIR)/vendor/fedora/oracleasm-$(patsubst fedora_%_srpm,%,$@).spec
+
+fedora_%_rpm: fedora_%_srpm
+	rpmbuild --rebuild $(MODULEARCH) \
+		"oracleasm-$(patsubst fedora_%_rpm,%,$@)-$(DPV).src.rpm"
+
+include $(TOPDIR)/vendor/common/Vendor.make
+
+packages: $(shell $(TOPDIR)/vendor/fedora/kernel.guess targets) headers_rpm
+
+targets:
+	$(TOPDIR)/vendor/fedora/kernel.guess targets
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fedora/kernel.guess oracleasm-git/vendor/fedora/kernel.guess
--- oracleasm-2.0.5/vendor/fedora/kernel.guess	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/fedora/kernel.guess	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,104 @@
+#!/bin/sh
+
+FEDORA_KERNEL_BASE="/usr/src/kernels"
+
+verfromdir()
+{
+    TESTDIR="$1"
+    if [ -r "${TESTDIR}/include/linux/utsrelease.h" ]
+    then
+        awk '/UTS_RELEASE/{gsub(/"/,"",$3); print $3}' "${TESTDIR}/include/linux/utsrelease.h"
+    fi
+}
+
+validate_dir()
+{
+    KVER="$1"
+
+    if [ ! -d "${FEDORA_KERNEL_BASE}/${KVER}" ]
+    then
+        return 1
+    elif [ ! -f "${FEDORA_KERNEL_BASE}/${KVER}/include/linux/autoconf.h" ]
+    then
+        return 1
+    elif [ ! -f "${FEDORA_KERNEL_BASE}/${KVER}/include/linux/version.h" ]
+    then
+        return 1
+    fi
+
+    return 0
+}
+
+# Takes a `uname -r` and returns "ver type", where ver
+# is 2.6.9-NN.EL and type is "smp" or the like.
+validate_version()
+{
+    KVER="$1"
+
+    if validate_dir "$KVER"
+    then
+        echo "${FEDORA_KERNEL_BASE}/${KVER}"
+    fi
+}
+
+find_version()
+{
+    # Find the most recent valid kernel
+    ls -1 -t "$FEDORA_KERNEL_BASE" | while read kdir
+    do
+        KVER="$(verfromdir "${FEDORA_KERNEL_BASE}/${kdir}")"
+        if validate_dir "$KVER" "$kdir"
+        then
+            echo "${FEDORA_KERNEL_BASE}/${kdir}"
+            break
+        fi
+    done
+}
+
+find_targets()
+{
+    ls -1 -t "$FEDORA_KERNEL_BASE" | while read kdir
+    do
+        KVER="$(verfromdir "${FEDORA_KERNEL_BASE}/${kdir}")"
+        if ! validate_dir "$KVER" "$kdir"
+        then
+            continue
+        fi
+
+        echo "fedora_${KVER}_rpm"
+    done
+}
+
+case "$1" in
+include|build)
+    if [ -n "$2" ]
+    then
+        KPATH="$(validate_version "$2")"
+    else
+        KVER="$(uname -r)"
+        KPATH="$(validate_version "$KVER")"
+        if [ -z "$KPATH" ]
+        then
+            KPATH="$(find_version)"
+        fi
+    fi
+    if [ -n "$KPATH" ]
+    then
+        if [ "$1" = "include" ]
+        then
+            KPATH="${KPATH}/include"
+        fi
+        echo "${KPATH}"
+    fi
+    ;;
+targets)
+    find_targets
+    ;;
+"")
+    echo "Missing operation" >&2
+    ;;
+*)
+    echo "Invalid operation: $1" >&2
+    exit 1
+    ;;
+esac
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fedora/oracleasm.spec-generic oracleasm-git/vendor/fedora/oracleasm.spec-generic
--- oracleasm-2.0.5/vendor/fedora/oracleasm.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/fedora/oracleasm.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,148 @@
+#
+# Spec file for oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+%ifarch i686
+%define karch		i686
+%endif
+
+%ifarch x86_64
+%define karch		x86_64
+%endif
+
+%ifarch ia64
+%define karch		ia64
+%endif
+
+%ifarch ppc64
+%define karch		ppc64
+%endif
+
+%ifarch s390x
+%define karch		s390x
+%endif
+
+
+# This must be changed to the minimum ABI compat kernel version expected
+%define kver		@@KERNEL_VERSION@@
+
+# The minimum -support package required for the kernel bits.
+%define support_ver     2.0.0
+# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
+%define min_enodev	2.0.1
+
+Summary: The Oracle Automatic Storage Management library driver.
+Name: oracleasm-%{kver}
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@%{?dist}
+License: GPL
+Group: System Environment/Kernel
+Source: oracleasm-@@DIST_VERSION@@.tar.gz
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-devel-uname-r = %{kver}
+
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+
+%description
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+
+
+
+%prep
+%setup -n oracleasm-%{version}
+
+
+%build
+
+local_configure()
+{
+	./configure					\
+		--prefix=%{_prefix}			\
+		--exec-prefix=%{_exec_prefix}		\
+		--bindir=%{_bindir}			\
+		--sbindir=%{_sbindir}			\
+		--sysconfdir=%{_sysconfdir}		\
+		--datadir=%{_datadir}			\
+		--includedir=%{_includedir}		\
+		--libdir=%{_libdir}			\
+		--libexecdir=%{_libexecdir}		\
+		--localstatedir=%{_localstatedir}	\
+		--sharedstatedir=%{_sharedstatedir}	\
+		--mandir=%{_mandir}			\
+		--infodir=%{_infodir}			\
+		--with-vendor=fedora			\
+		--with-vendorkernel="$1"
+}
+
+local_configure "%{kver}"
+
+make QUIET=1
+
+%install
+
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+%post -n oracleasm-%{kver}
+depmod -ae %{kver}
+
+%files -n oracleasm-%{kver}
+%defattr(-,root,root)
+/lib/modules/
+
+%changelog
+* Mon Mar 29 2010 Martin K. Petersen <martin.petersen@oracle.com>
+- Generic Fedora version
+
+* Fri Feb 09 2007 Joel Becker <joel.becker@oracle.com>
+- Strip down for Fedora Core 6
+
+* Thu May 25 2006 Joel Becker <joel.becker@oracle.com>
+- Add largesmp
+
+* Fri Feb 04 2005 Joel Becker <joel.becker@oracle.com>
+- Make RHEL4 specfile.
+
+* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
+- Make SLES9 specfile.
+
+* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
+- Make kernel-only.
+
+* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
+- Add x86 and ia64 targets.
+
+* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
+- Make the UL SP3 changes.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fedora/rpmarch.guess oracleasm-git/vendor/fedora/rpmarch.guess
--- oracleasm-2.0.5/vendor/fedora/rpmarch.guess	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/fedora/rpmarch.guess	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,68 @@
+#! /bin/sh
+
+mode="$1"
+srcdir="$2"
+
+host_cpu=
+
+
+QUERYFILE=/etc/fedora-release
+
+if test -n "$QUERYFILE"; then
+  host_cpu="`rpm -qf $QUERYFILE --queryformat \"%{ARCH}\"`"
+fi
+
+if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then
+  host_alias=`$srcdir/config.guess`
+  host=`$srcdir/config.sub $host_alias`
+  host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+fi
+
+case "$host_cpu" in
+  x86_64|ia64|s390x)
+    TOOLSARCH="$host_cpu"
+    ;;
+  i386|i486|i586|i686|i786|k6|k7)
+    TOOLSARCH="i386"
+    ;;
+  ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+    TOOLSARCH="ppc64"
+    ;;
+  *)
+    echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2
+    TOOLSARCH=""
+    ;;
+esac
+
+# Only a few of these need to be overwritten from RPM's default
+case "$host_cpu" in
+  i386|i586)
+    MODULEARCH="i686"
+    ;;
+  ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+    MODULEARCH="ppc64"
+    ;;
+  *)
+    MODULEARCH=""
+    ;;
+esac
+
+case "$mode" in
+  module)
+    if [ -n "$MODULEARCH" ] ; then
+      echo "--target $MODULEARCH"
+    fi
+    ;;
+  tools)
+    if [ -n "$TOOLSARCH" ] ; then
+      echo "--target $TOOLSARCH"
+    fi
+    ;;
+  *)
+    echo "rpmarch.guess: Invalid mode: $mode" >&2
+    echo "error"
+    exit 1
+    ;;
+esac
+
+exit 0
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fedora/rpmdist.guess oracleasm-git/vendor/fedora/rpmdist.guess
--- oracleasm-2.0.5/vendor/fedora/rpmdist.guess	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/fedora/rpmdist.guess	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,2 @@
+#!/bin/sh
+rpm --showrc | grep ": dist" | awk '{ print $3 }' | sed -e 's/\.//'
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/fedora/vendor.guess oracleasm-git/vendor/fedora/vendor.guess
--- oracleasm-2.0.5/vendor/fedora/vendor.guess	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/fedora/vendor.guess	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ -f /etc/fedora-release ]; then
+    exit 0
+fi
+
+exit 1
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel4/Makefile oracleasm-git/vendor/rhel4/Makefile
--- oracleasm-2.0.5/vendor/rhel4/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/rhel4/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -3,7 +3,7 @@ TOPDIR = ../..
 include $(TOPDIR)/Preamble.make
 
 DIST_FILES = 				\
-	oracleasm.spec-generic.in	\
+	oracleasm.spec-generic		\
 	kernel.guess			\
 	rpmarch.guess			\
 	Vendor.make			\
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel4/Vendor.make oracleasm-git/vendor/rhel4/Vendor.make
--- oracleasm-2.0.5/vendor/rhel4/Vendor.make	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/rhel4/Vendor.make	2010-10-28 22:42:48.000000000 +0200
@@ -5,36 +5,32 @@
 TOOLSARCH = $(shell $(TOPDIR)/vendor/rhel4/rpmarch.guess tools $(TOPDIR))
 MODULEARCH = $(shell $(TOPDIR)/vendor/rhel4/rpmarch.guess module $(TOPDIR))
 VENDOR_EXTENSION = el4
+INCLUDE_REQUIRES = glibc-kernheaders
+
+$(TOPDIR)/vendor/rhel4/oracleasm-%.spec: \
+	KERNEL_VERSION = $(get_version_release)
+
+	# Build large SMP variants if 2.6.9-34
+	LARGESMP = $(if $(call lt,$(get_release_major),34),1,0)
+
+	# Build xenU for versions less than 55
+	XEN = $(if $(call lt,$(get_release_major),55),1,0)
 
 $(TOPDIR)/vendor/rhel4/oracleasm-%.spec: $(TOPDIR)/vendor/rhel4/oracleasm.spec-generic
-	SPECVER="$@"; \
-		SPECVER="$${SPECVER#*oracleasm-}"; \
-		SPECVER="$${SPECVER%.spec}"; \
-		SUBVER="$${SPECVER#2.6.9-}"; \
-		SUBVER="$${SUBVER%%.*}"; \
-		if [ "$${SUBVER}" -lt 34 ]; \
-		then \
-			LARGESMP=0; \
-		else \
-			LARGESMP=1; \
-		fi; \
-		if [ "$${SUBVER}" -lt 55 ]; \
-		then \
-			XENU=0; \
-		else \
-			XENU=1; \
-		fi; \
-		sed -e 's/@@KVER@@/'$${SPECVER}'/' -e 's/@@PKG_VERSION@@/'$(PKG_VERSION)'/' -e 's/@@LARGESMP@@/'$${LARGESMP}'/' -e 's/@@XENU@@/'$${XENU}'/' < $< > $@
+	$(spec_subst) > $@
 
-rhel4_%_srpm: dist $(TOPDIR)/vendor/rhel4/oracleasm-%.spec
-	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" $(TOPDIR)/vendor/rhel4/oracleasm-$(patsubst rhel4_%_srpm,%,$@).spec
+rhel4_%_srpm: $(TOPDIR)/vendor/rhel4/oracleasm-%.spec dist
+	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" \
+		$(TOPDIR)/vendor/rhel4/oracleasm-$(patsubst rhel4_%_srpm,%,$@).spec
+	@rm $(TOPDIR)/vendor/rhel4/oracleasm-$(patsubst rhel4_%_srpm,%,$@).spec
 
 rhel4_%_rpm: rhel4_%_srpm
-	rpmbuild --rebuild $(MODULEARCH) "oracleasm-$(patsubst rhel4_%_rpm,%,$@)-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm"
+	rpmbuild --rebuild $(MODULEARCH) \
+		"oracleasm-$(patsubst rhel4_%_rpm,%,$@)-$(DPV).src.rpm"
 
-
-# Package required for /usr/include/linux
-INCLUDE_REQUIRES = glibc-kernheaders
 include $(TOPDIR)/vendor/common/Vendor.make
 
 packages: $(shell $(TOPDIR)/vendor/rhel4/kernel.guess targets) headers_rpm
+
+targets:
+	$(TOPDIR)/vendor/rhel4/kernel.guess targets
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel4/oracleasm.spec-generic oracleasm-git/vendor/rhel4/oracleasm.spec-generic
--- oracleasm-2.0.5/vendor/rhel4/oracleasm.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/rhel4/oracleasm.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,344 @@
+#
+# Spec file for oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+# Turn on's and off's
+%define buildup		1
+%define buildsmp	0
+%define buildhugemem	0
+%define buildlargesmp	0
+%define buildxenu	0
+
+%ifarch i686
+%define karch		i686
+%define buildsmp	1
+%define buildhugemem	1
+%define buildxenu	@@XEN@@
+%endif
+
+%ifarch x86_64
+%define karch		x86_64
+%define buildsmp	1
+%define buildlargesmp	@@LARGESMP@@
+%define buildxenu	@@XEN@@
+%endif
+
+%ifarch ia32e
+%define karch		ia32e
+%endif
+
+%ifarch ia64
+%define karch		ia64
+%define buildlargesmp	@@LARGESMP@@
+%endif
+
+%ifarch ppc64
+%define karch		ppc64
+%define buildlargesmp	@@LARGESMP@@
+%endif
+
+%ifarch s390x
+%define karch		s390x
+%endif
+
+
+# This must be changed to the minimum ABI compat kernel version expected
+%define kver		@@KERNEL_VERSION@@
+
+# The minimum -support package required for the kernel bits.
+%define support_ver     2.0.0
+# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
+%define min_enodev	2.0.1
+
+Summary: The Oracle Automatic Storage Management library driver.
+Name: oracleasm-%{kver}
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@.el4
+License: GPL
+Group: System Environment/Kernel
+Source: oracleasm-@@DIST_VERSION@@.tar.gz
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-devel = %{kver}
+
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+
+%description
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+
+%if %{buildsmp}
+%package -n oracleasm-%{kver}smp
+Summary: The Oracle Automatic Storage Management library driver for SMP systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-smp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-smp-devel = %{kver}
+
+%description -n oracleasm-%{kver}smp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for symmetric multiprocessor kernels.
+%endif
+
+
+%if %{buildhugemem}
+%package -n oracleasm-%{kver}hugemem
+Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-hugemem = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-hugemem-devel = %{kver}
+
+%description -n oracleasm-%{kver}hugemem
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for large memory SMP kernels.
+%endif
+
+
+%if %{buildlargesmp}
+%package -n oracleasm-%{kver}largesmp
+Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-largesmp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-largesmp-devel = %{kver}
+
+%description -n oracleasm-%{kver}largesmp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for large SMP kernels.
+%endif
+
+%if %{buildxenu}
+%package -n oracleasm-%{kver}xenU
+Summary: The Oracle Automatic Storage Management library driver for Xen DomU kernels.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-xenU = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-xenU-devel = %{kver}
+
+%description -n oracleasm-%{kver}xenU
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for Xen DomU kernels.
+%endif
+
+
+%prep
+%setup -n oracleasm-%{version}
+
+
+%build
+
+local_configure()
+{
+	./configure					\
+		--prefix=%{_prefix}			\
+		--exec-prefix=%{_exec_prefix}		\
+		--bindir=%{_bindir}			\
+		--sbindir=%{_sbindir}			\
+		--sysconfdir=%{_sysconfdir}		\
+		--datadir=%{_datadir}			\
+		--includedir=%{_includedir}		\
+		--libdir=%{_libdir}			\
+		--libexecdir=%{_libexecdir}		\
+		--localstatedir=%{_localstatedir}	\
+		--sharedstatedir=%{_sharedstatedir}	\
+		--mandir=%{_mandir}			\
+		--infodir=%{_infodir}			\
+		--with-vendor=rhel4			\
+		--with-vendorkernel="$1"
+}
+
+%if %{buildup}
+local_configure "%{kver}"
+
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildsmp}
+local_configure "%{kver}smp"
+
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}smp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}smp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildhugemem}
+local_configure "%{kver}hugemem"
+
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}hugemem/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}hugemem/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildlargesmp}
+local_configure "%{kver}largesmp"
+
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}largesmp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}largesmp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildxenu}
+local_configure "%{kver}xenU"
+
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xenU/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xenU/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+
+%install
+
+
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+
+
+%if %{buildup}
+%post -n oracleasm-%{kver}
+depmod -ae %{kver}
+
+%files -n oracleasm-%{kver}
+%defattr(-,root,root)
+/lib/modules/%{kver}/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildsmp}
+%post -n oracleasm-%{kver}smp
+depmod -ae %{kver}smp
+
+%files -n oracleasm-%{kver}smp
+%defattr(-,root,root)
+/lib/modules/%{kver}smp/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildhugemem}
+%post -n oracleasm-%{kver}hugemem
+depmod -ae %{kver}hugemem
+
+%files -n oracleasm-%{kver}hugemem
+%defattr(-,root,root)
+/lib/modules/%{kver}hugemem/kernel/drivers/addon/oracleasm
+%endif
+
+%if %{buildlargesmp}
+%post -n oracleasm-%{kver}largesmp
+depmod -ae %{kver}largesmp
+
+%files -n oracleasm-%{kver}largesmp
+%defattr(-,root,root)
+/lib/modules/%{kver}largesmp/kernel/drivers/addon/oracleasm
+%endif
+
+%if %{buildxenu}
+%post -n oracleasm-%{kver}xenU
+depmod -ae %{kver}xenU
+
+%files -n oracleasm-%{kver}xenU
+%defattr(-,root,root)
+/lib/modules/%{kver}xenU/kernel/drivers/addon/oracleasm
+%endif
+
+
+%changelog
+* Fri Oct 26 2007 Sunil Mushran <sunil.mushran@oracle.com>
+- Add xenU
+
+* Thu May 25 2006 Joel Becker <joel.becker@oracle.com>
+- Add largesmp
+
+* Fri Feb 04 2005 Joel Becker <joel.becker@oracle.com>
+- Make RHEL4 specfile.
+
+* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
+- Make SLES9 specfile.
+
+* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
+- Make kernel-only.
+
+* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
+- Add x86 and ia64 targets.
+
+* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
+- Make the UL SP3 changes.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel4/oracleasm.spec-generic.in oracleasm-git/vendor/rhel4/oracleasm.spec-generic.in
--- oracleasm-2.0.5/vendor/rhel4/oracleasm.spec-generic.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/rhel4/oracleasm.spec-generic.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,344 +0,0 @@
-#
-# Spec file for oracleasm
-#
-
-# Macros
-# This one is hardcoded because, well, it belongs there
-%define _prefix /usr
-# Because RPM is dumb
-%define _unpackaged_files_terminate_build 0
-
-# Turn on's and off's
-%define buildup		1
-%define buildsmp	0
-%define buildhugemem	0
-%define buildlargesmp	0
-%define buildxenu	0
-
-%ifarch i686
-%define karch		i686
-%define buildsmp	1
-%define buildhugemem	1
-%define buildxenu	@@XENU@@
-%endif
-
-%ifarch x86_64
-%define karch		x86_64
-%define buildsmp	1
-%define buildlargesmp	@@LARGESMP@@
-%define buildxenu	@@XENU@@
-%endif
-
-%ifarch ia32e
-%define karch		ia32e
-%endif
-
-%ifarch ia64
-%define karch		ia64
-%define buildlargesmp	@@LARGESMP@@
-%endif
-
-%ifarch ppc64
-%define karch		ppc64
-%define buildlargesmp	@@LARGESMP@@
-%endif
-
-%ifarch s390x
-%define karch		s390x
-%endif
-
-
-# This must be changed to the minimum ABI compat kernel version expected
-%define kver		@@KVER@@
-
-# The minimum -support package required for the kernel bits.
-%define support_ver     2.0.0
-# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
-%define min_enodev	2.0.1
-
-Summary: The Oracle Automatic Storage Management library driver.
-Name: oracleasm-%{kver}
-Version: @DIST_VERSION@
-Release: @@PKG_VERSION@@.el4
-License: GPL
-Group: System Environment/Kernel
-Source: oracleasm-@DIST_VERSION@.tar.gz
-URL: http://oss.oracle.com/projects/oracleasm/
-Distribution: Oracle
-Vendor: Oracle Corporation
-Packager: Joel Becker <joel.becker@oracle.com>
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-devel = %{kver}
-
-
-BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
-
-
-%description
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the default kernel.
-
-%if %{buildsmp}
-%package -n oracleasm-%{kver}smp
-Summary: The Oracle Automatic Storage Management library driver for SMP systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-smp = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-smp-devel = %{kver}
-
-%description -n oracleasm-%{kver}smp
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for symmetric multiprocessor kernels.
-%endif
-
-
-%if %{buildhugemem}
-%package -n oracleasm-%{kver}hugemem
-Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-hugemem = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-hugemem-devel = %{kver}
-
-%description -n oracleasm-%{kver}hugemem
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for large memory SMP kernels.
-%endif
-
-
-%if %{buildlargesmp}
-%package -n oracleasm-%{kver}largesmp
-Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-largesmp = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-largesmp-devel = %{kver}
-
-%description -n oracleasm-%{kver}largesmp
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for large SMP kernels.
-%endif
-
-%if %{buildxenu}
-%package -n oracleasm-%{kver}xenU
-Summary: The Oracle Automatic Storage Management library driver for Xen DomU kernels.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-xenU = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-xenU-devel = %{kver}
-
-%description -n oracleasm-%{kver}xenU
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for Xen DomU kernels.
-%endif
-
-
-%prep
-%setup -n oracleasm-%{version}
-
-
-%build
-
-local_configure()
-{
-	./configure					\
-		--prefix=%{_prefix}			\
-		--exec-prefix=%{_exec_prefix}		\
-		--bindir=%{_bindir}			\
-		--sbindir=%{_sbindir}			\
-		--sysconfdir=%{_sysconfdir}		\
-		--datadir=%{_datadir}			\
-		--includedir=%{_includedir}		\
-		--libdir=%{_libdir}			\
-		--libexecdir=%{_libexecdir}		\
-		--localstatedir=%{_localstatedir}	\
-		--sharedstatedir=%{_sharedstatedir}	\
-		--mandir=%{_mandir}			\
-		--infodir=%{_infodir}			\
-		--with-vendor=rhel4			\
-		--with-vendorkernel="$1"
-}
-
-%if %{buildup}
-local_configure "%{kver}"
-
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildsmp}
-local_configure "%{kver}smp"
-
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}smp/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}smp/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildhugemem}
-local_configure "%{kver}hugemem"
-
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}hugemem/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}hugemem/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildlargesmp}
-local_configure "%{kver}largesmp"
-
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}largesmp/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}largesmp/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildxenu}
-local_configure "%{kver}xenU"
-
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xenU/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xenU/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-
-%install
-
-
-
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
-
-
-%if %{buildup}
-%post -n oracleasm-%{kver}
-depmod -ae %{kver}
-
-%files -n oracleasm-%{kver}
-%defattr(-,root,root)
-/lib/modules/%{kver}/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildsmp}
-%post -n oracleasm-%{kver}smp
-depmod -ae %{kver}smp
-
-%files -n oracleasm-%{kver}smp
-%defattr(-,root,root)
-/lib/modules/%{kver}smp/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildhugemem}
-%post -n oracleasm-%{kver}hugemem
-depmod -ae %{kver}hugemem
-
-%files -n oracleasm-%{kver}hugemem
-%defattr(-,root,root)
-/lib/modules/%{kver}hugemem/kernel/drivers/addon/oracleasm
-%endif
-
-%if %{buildlargesmp}
-%post -n oracleasm-%{kver}largesmp
-depmod -ae %{kver}largesmp
-
-%files -n oracleasm-%{kver}largesmp
-%defattr(-,root,root)
-/lib/modules/%{kver}largesmp/kernel/drivers/addon/oracleasm
-%endif
-
-%if %{buildxenu}
-%post -n oracleasm-%{kver}xenU
-depmod -ae %{kver}xenU
-
-%files -n oracleasm-%{kver}xenU
-%defattr(-,root,root)
-/lib/modules/%{kver}xenU/kernel/drivers/addon/oracleasm
-%endif
-
-
-%changelog
-* Fri Oct 26 2007 Sunil Mushran <sunil.mushran@oracle.com>
-- Add xenU
-
-* Thu May 25 2006 Joel Becker <joel.becker@oracle.com>
-- Add largesmp
-
-* Fri Feb 04 2005 Joel Becker <joel.becker@oracle.com>
-- Make RHEL4 specfile.
-
-* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
-- Make SLES9 specfile.
-
-* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
-- Make kernel-only.
-
-* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
-- Add x86 and ia64 targets.
-
-* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
-- Make the UL SP3 changes.
-
-* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
-- Start the ASM rename.
-
-* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
-- Created EL3 version
-
-* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
-- Added osm-lib bits
-
-* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
-- Initial RPM
-
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel5/Makefile oracleasm-git/vendor/rhel5/Makefile
--- oracleasm-2.0.5/vendor/rhel5/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/rhel5/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -3,7 +3,7 @@ TOPDIR = ../..
 include $(TOPDIR)/Preamble.make
 
 DIST_FILES = 				\
-	oracleasm.spec-generic.in	\
+	oracleasm.spec-generic		\
 	kernel.guess			\
 	rpmarch.guess			\
 	Vendor.make			\
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel5/Vendor.make oracleasm-git/vendor/rhel5/Vendor.make
--- oracleasm-2.0.5/vendor/rhel5/Vendor.make	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/rhel5/Vendor.make	2010-10-28 22:42:48.000000000 +0200
@@ -5,30 +5,37 @@
 TOOLSARCH = $(shell $(TOPDIR)/vendor/rhel5/rpmarch.guess tools $(TOPDIR))
 MODULEARCH = $(shell $(TOPDIR)/vendor/rhel5/rpmarch.guess module $(TOPDIR))
 VENDOR_EXTENSION = el5
+INCLUDE_REQUIRES = glibc-kernheaders
+
+$(TOPDIR)/vendor/rhel5/oracleasm-%.spec: \
+	KERNEL_VERSION = $(get_version_release)
+
+	# If kernel is bigger than 2.6.18 append "-uname-r" to BuildRequires
+	KERNEL_REQUIRES = $(if $(call gt,$(get_version_minor),18),-uname-r)
+
+	# If kernel is 2.6.18 build Xen modules
+	XEN = $(if $(call eq,$(get_version_minor),18),1,0)
+
+	# If kernel is smaller than 2.6.18 release 53 build debug modules
+	DEBUG = $(if $(call and,\
+		$(call eq,$(get_version_minor),18),\
+		$(call lt,$(get_release_major),53)),1,0)
 
 $(TOPDIR)/vendor/rhel5/oracleasm-%.spec: $(TOPDIR)/vendor/rhel5/oracleasm.spec-generic
-	SPECVER="$@"; \
-		SPECVER="$${SPECVER#*oracleasm-}"; \
-		SPECVER="$${SPECVER%.spec}"; \
-		SUBVER="$${SPECVER#2.6.18-}"; \
-		SUBVER="$${SUBVER%%.*}"; \
-		if [ "$${SUBVER}" -lt 53 ]; \
-		then \
-			DEBUG=0; \
-		else \
-			DEBUG=1; \
-		fi; \
-		sed -e 's/@@KVER@@/'$${SPECVER}'/' -e 's/@@PKG_VERSION@@/'$(PKG_VERSION)'/' -e 's/@@DEBUG@@/'$${DEBUG}'/' < $< > $@
+	$(spec_subst) > $@
 
-rhel5_%_srpm: dist $(TOPDIR)/vendor/rhel5/oracleasm-%.spec
-	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" $(TOPDIR)/vendor/rhel5/oracleasm-$(patsubst rhel5_%_srpm,%,$@).spec
+rhel5_%_srpm: $(TOPDIR)/vendor/rhel5/oracleasm-%.spec dist
+	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" \
+		$(TOPDIR)/vendor/rhel5/oracleasm-$(patsubst rhel5_%_srpm,%,$@).spec
+	@rm $(TOPDIR)/vendor/rhel5/oracleasm-$(patsubst rhel5_%_srpm,%,$@).spec
 
 rhel5_%_rpm: rhel5_%_srpm
-	rpmbuild --rebuild $(MODULEARCH) "oracleasm-$(patsubst rhel5_%_rpm,%,$@)-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm"
-
+	rpmbuild --rebuild $(MODULEARCH) \
+		"oracleasm-$(patsubst rhel5_%_rpm,%,$@)-$(DPV).src.rpm"
 
-# Package required for /usr/include/linux
-INCLUDE_REQUIRES = glibc-kernheaders
 include $(TOPDIR)/vendor/common/Vendor.make
 
 packages: $(shell $(TOPDIR)/vendor/rhel5/kernel.guess targets) headers_rpm
+
+targets:
+	$(TOPDIR)/vendor/rhel5/kernel.guess targets
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel5/kernel.guess oracleasm-git/vendor/rhel5/kernel.guess
--- oracleasm-2.0.5/vendor/rhel5/kernel.guess	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/rhel5/kernel.guess	2010-10-28 22:42:48.000000000 +0200
@@ -53,23 +53,31 @@ guess_rhel5_type()
 
 guess_rhel5_dir()
 {
-    KVER="$1"
-
-    DIRTYPE=$(guess_rhel5_type "$KVER")
-    ARCH=$(guess_rhel5_arch)
+    declare -i VERSION
+    VERSION=`echo $1 | sed 's/^2\.6\.\([0-9]*\).*/\1/'`
 
-    if [ -z "$DIRTYPE" ]
-    then
-        echo "${1%${DIRTYPE}}-${ARCH}"
+    if [ $VERSION -gt 18 ]; then
+	echo $1
     else
-        echo "${1%${DIRTYPE}}-${DIRTYPE}-${ARCH}"
+	DIRTYPE=$(guess_rhel5_type "$KVER")
+	ARCH=$(guess_rhel5_arch)
+
+	if [ -z "$DIRTYPE" ]
+	then
+            echo "${1%${DIRTYPE}}-${ARCH}"
+	else
+            echo "${1%${DIRTYPE}}-${DIRTYPE}-${ARCH}"
+	fi
     fi
 }
 
 verfromdir()
 {
     TESTDIR="$1"
-    if [ -r "${TESTDIR}/include/linux/utsrelease.h" ]
+    if [ -r "${TESTDIR}/include/generated/utsrelease.h" ]
+    then
+        awk '/UTS_RELEASE/{gsub(/"/,"",$3); print $3}' "${TESTDIR}/include/generated/utsrelease.h"
+    elif [ -r "${TESTDIR}/include/linux/utsrelease.h" ]
     then
         awk '/UTS_RELEASE/{gsub(/"/,"",$3); print $3}' "${TESTDIR}/include/linux/utsrelease.h"
     fi
@@ -133,16 +141,26 @@ validate_target()
     ARCH="$2"
     TYPELIST="$3"
 
-    SUBVER="${KVER#2.6.18-}"
-    SUBVER="${SUBVER%%.*}"
+    declare -i VERSION
+    VERSION=`echo $1 | sed 's/^2\.6\.\([0-9]*\).*/\1/'`
+
+    declare -i RELEASE
+    RELEASE=`echo $1 | sed 's/^2\.6\.[0-9.]*\-\([0-9]*\).*/\1/'`
 
-    # Red Hat introduced the "debug" type in 53.el5. Anything older can ignore it.
-    if [ $SUBVER -lt 53 ]
+    if [ $VERSION -le 18 ]
     then
-        TYPELIST="${TYPELIST%,debug}"
+	# Red Hat introduced the "debug" type in 53.el5. Anything older can
+	# ignore it.
+	if [ $RELEASE -lt 53 ] ; then
+	    TYPELIST="${TYPELIST%,debug}"
+	fi
+
+	typelist="${TYPELIST#$ARCH:}"
+    else
+	# Later kernels don't have any variants
+	typelist=""
     fi
 
-    typelist="${TYPELIST#$ARCH:}"
     while :
     do
         type="${typelist%%,*}"
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel5/oracleasm.spec-generic oracleasm-git/vendor/rhel5/oracleasm.spec-generic
--- oracleasm-2.0.5/vendor/rhel5/oracleasm.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/rhel5/oracleasm.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,304 @@
+#
+# Spec file for oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+%define builddef	1
+%define buildpae	0
+%define buildxen	0
+%define builddebug	0
+
+%ifarch i686
+%define karch		i686
+%define buildpae	1
+%define buildxen	@@XEN@@
+%define builddebug	@@DEBUG@@
+%endif
+
+%ifarch x86_64
+%define karch		x86_64
+%define buildxen	@@XEN@@
+%define builddebug	@@DEBUG@@
+%endif
+
+%ifarch ia64
+%define karch		ia64
+%define buildxen	@@XEN@@
+%define builddebug	@@DEBUG@@
+%endif
+
+%ifarch ppc64
+%define karch		ppc64
+%define builddebug	@@DEBUG@@
+%endif
+
+%ifarch s390x
+%define karch		s390x
+%define builddebug	@@DEBUG@@
+%endif
+
+
+# This must be changed to the minimum ABI compat kernel version expected
+%define kver		@@KERNEL_VERSION@@
+
+# The minimum -support package required for the kernel bits.
+%define support_ver     2.0.0
+# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
+%define min_enodev	2.0.1
+
+Summary: The Oracle Automatic Storage Management library driver.
+Name: oracleasm-%{kver}
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@.el5
+License: GPL
+Group: System Environment/Kernel
+Source: oracleasm-@@DIST_VERSION@@.tar.gz
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel@@KERNEL_REQUIRES@@ = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-devel@@KERNEL_REQUIRES@@ = %{kver}
+
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+
+%description
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+
+
+%if %{buildpae}
+%package -n oracleasm-%{kver}PAE
+Summary: The Oracle Automatic Storage Management library driver for PAE systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-PAE = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-PAE-devel = %{kver}
+
+%description -n oracleasm-%{kver}PAE
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the PAE kernel.
+%endif
+
+
+%if %{buildxen}
+%package -n oracleasm-%{kver}xen
+Summary: The Oracle Automatic Storage Management library driver for Xen systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-xen = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-xen-devel = %{kver}
+
+%description -n oracleasm-%{kver}xen
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the Xen virtualized systems.
+%endif
+
+
+%if %{builddebug}
+%package -n oracleasm-%{kver}debug
+Summary: The Oracle Automatic Storage Management library driver for debug systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-debug = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-debug-devel = %{kver}
+
+%description -n oracleasm-%{kver}debug
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the debug kernel.
+%endif
+
+
+%prep
+%setup -n oracleasm-%{version}
+
+
+%build
+
+local_configure()
+{
+	./configure					\
+		--prefix=%{_prefix}			\
+		--exec-prefix=%{_exec_prefix}		\
+		--bindir=%{_bindir}			\
+		--sbindir=%{_sbindir}			\
+		--sysconfdir=%{_sysconfdir}		\
+		--datadir=%{_datadir}			\
+		--includedir=%{_includedir}		\
+		--libdir=%{_libdir}			\
+		--libexecdir=%{_libexecdir}		\
+		--localstatedir=%{_localstatedir}	\
+		--sharedstatedir=%{_sharedstatedir}	\
+		--mandir=%{_mandir}			\
+		--infodir=%{_infodir}			\
+		--with-vendor=rhel5			\
+		--with-vendorkernel="$1"
+}
+
+%if %{builddef}
+local_configure "%{kver}"
+
+make V=0
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildpae}
+local_configure "%{kver}PAE"
+
+make V=0
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}PAE/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}PAE/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildxen}
+local_configure "%{kver}xen"
+
+make V=0
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xen/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xen/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{builddebug}
+local_configure "%{kver}debug"
+
+make V=0
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}debug/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}debug/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+
+%install
+
+
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+
+
+%if %{builddef}
+%post -n oracleasm-%{kver}
+depmod -ae %{kver}
+
+%files -n oracleasm-%{kver}
+%defattr(-,root,root)
+/lib/modules/%{kver}/kernel/drivers/addon/oracleasm
+%endif
+
+%if %{buildpae}
+%post -n oracleasm-%{kver}PAE
+depmod -ae %{kver}PAE
+
+%files -n oracleasm-%{kver}PAE
+%defattr(-,root,root)
+/lib/modules/%{kver}PAE/kernel/drivers/addon/oracleasm
+%endif
+
+%if %{buildxen}
+%post -n oracleasm-%{kver}xen
+depmod -ae %{kver}xen
+
+%files -n oracleasm-%{kver}xen
+%defattr(-,root,root)
+/lib/modules/%{kver}xen/kernel/drivers/addon/oracleasm
+%endif
+
+%if %{builddebug}
+%post -n oracleasm-%{kver}debug
+depmod -ae %{kver}debug
+
+%files -n oracleasm-%{kver}debug
+%defattr(-,root,root)
+/lib/modules/%{kver}debug/kernel/drivers/addon/oracleasm
+%endif
+
+
+%changelog
+* Mon Nov 12 2007 Sunil Mushran <sunil.mushran@oracle.com>
+- Add support to build modules for kernel-debug for RHEL5
+
+* Wed Apr 18 2007 Joel Becker <joel.becker@oracle.com>
+- Add RHEL5
+
+* Fri Feb 09 2007 Joel Becker <joel.becker@oracle.com>
+- Strip down for Fedora Core 6
+
+* Thu May 25 2006 Joel Becker <joel.becker@oracle.com>
+- Add largesmp
+
+* Fri Feb 04 2005 Joel Becker <joel.becker@oracle.com>
+- Make RHEL4 specfile.
+
+* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
+- Make SLES9 specfile.
+
+* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
+- Make kernel-only.
+
+* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
+- Add x86 and ia64 targets.
+
+* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
+- Make the UL SP3 changes.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/rhel5/oracleasm.spec-generic.in oracleasm-git/vendor/rhel5/oracleasm.spec-generic.in
--- oracleasm-2.0.5/vendor/rhel5/oracleasm.spec-generic.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/rhel5/oracleasm.spec-generic.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,304 +0,0 @@
-#
-# Spec file for oracleasm
-#
-
-# Macros
-# This one is hardcoded because, well, it belongs there
-%define _prefix /usr
-# Because RPM is dumb
-%define _unpackaged_files_terminate_build 0
-
-%define builddef	1
-%define buildpae	0
-%define buildxen	0
-%define builddebug	0
-
-%ifarch i686
-%define karch		i686
-%define buildpae	1
-%define buildxen	1
-%define builddebug	@@DEBUG@@
-%endif
-
-%ifarch x86_64
-%define karch		x86_64
-%define buildxen	1
-%define builddebug	@@DEBUG@@
-%endif
-
-%ifarch ia64
-%define karch		ia64
-%define buildxen	1
-%define builddebug	@@DEBUG@@
-%endif
-
-%ifarch ppc64
-%define karch		ppc64
-%define builddebug	@@DEBUG@@
-%endif
-
-%ifarch s390x
-%define karch		s390x
-%define builddebug	@@DEBUG@@
-%endif
-
-
-# This must be changed to the minimum ABI compat kernel version expected
-%define kver		@@KVER@@
-
-# The minimum -support package required for the kernel bits.
-%define support_ver     2.0.0
-# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
-%define min_enodev	2.0.1
-
-Summary: The Oracle Automatic Storage Management library driver.
-Name: oracleasm-%{kver}
-Version: @DIST_VERSION@
-Release: @@PKG_VERSION@@.el5
-License: GPL
-Group: System Environment/Kernel
-Source: oracleasm-@DIST_VERSION@.tar.gz
-URL: http://oss.oracle.com/projects/oracleasm/
-Distribution: Oracle
-Vendor: Oracle Corporation
-Packager: Joel Becker <joel.becker@oracle.com>
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-devel = %{kver}
-
-
-BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
-
-
-%description
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the default kernel.
-
-
-%if %{buildpae}
-%package -n oracleasm-%{kver}PAE
-Summary: The Oracle Automatic Storage Management library driver for PAE systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-PAE = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-PAE-devel = %{kver}
-
-%description -n oracleasm-%{kver}PAE
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the PAE kernel.
-%endif
-
-
-%if %{buildxen}
-%package -n oracleasm-%{kver}xen
-Summary: The Oracle Automatic Storage Management library driver for Xen systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-xen = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-xen-devel = %{kver}
-
-%description -n oracleasm-%{kver}xen
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the Xen virtualized systems.
-%endif
-
-
-%if %{builddebug}
-%package -n oracleasm-%{kver}debug
-Summary: The Oracle Automatic Storage Management library driver for debug systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-debug = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-debug-devel = %{kver}
-
-%description -n oracleasm-%{kver}debug
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the debug kernel.
-%endif
-
-
-%prep
-%setup -n oracleasm-%{version}
-
-
-%build
-
-local_configure()
-{
-	./configure					\
-		--prefix=%{_prefix}			\
-		--exec-prefix=%{_exec_prefix}		\
-		--bindir=%{_bindir}			\
-		--sbindir=%{_sbindir}			\
-		--sysconfdir=%{_sysconfdir}		\
-		--datadir=%{_datadir}			\
-		--includedir=%{_includedir}		\
-		--libdir=%{_libdir}			\
-		--libexecdir=%{_libexecdir}		\
-		--localstatedir=%{_localstatedir}	\
-		--sharedstatedir=%{_sharedstatedir}	\
-		--mandir=%{_mandir}			\
-		--infodir=%{_infodir}			\
-		--with-vendor=rhel5			\
-		--with-vendorkernel="$1"
-}
-
-%if %{builddef}
-local_configure "%{kver}"
-
-make V=0
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildpae}
-local_configure "%{kver}PAE"
-
-make V=0
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}PAE/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}PAE/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildxen}
-local_configure "%{kver}xen"
-
-make V=0
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xen/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}xen/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{builddebug}
-local_configure "%{kver}debug"
-
-make V=0
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}debug/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}debug/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-
-%install
-
-
-
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
-
-
-%if %{builddef}
-%post -n oracleasm-%{kver}
-depmod -ae %{kver}
-
-%files -n oracleasm-%{kver}
-%defattr(-,root,root)
-/lib/modules/%{kver}/kernel/drivers/addon/oracleasm
-%endif
-
-%if %{buildpae}
-%post -n oracleasm-%{kver}PAE
-depmod -ae %{kver}PAE
-
-%files -n oracleasm-%{kver}PAE
-%defattr(-,root,root)
-/lib/modules/%{kver}PAE/kernel/drivers/addon/oracleasm
-%endif
-
-%if %{buildxen}
-%post -n oracleasm-%{kver}xen
-depmod -ae %{kver}xen
-
-%files -n oracleasm-%{kver}xen
-%defattr(-,root,root)
-/lib/modules/%{kver}xen/kernel/drivers/addon/oracleasm
-%endif
-
-%if %{builddebug}
-%post -n oracleasm-%{kver}debug
-depmod -ae %{kver}debug
-
-%files -n oracleasm-%{kver}debug
-%defattr(-,root,root)
-/lib/modules/%{kver}debug/kernel/drivers/addon/oracleasm
-%endif
-
-
-%changelog
-* Mon Nov 12 2007 Sunil Mushran <sunil.mushran@oracle.com>
-- Add support to build modules for kernel-debug for RHEL5
-
-* Wed Apr 18 2007 Joel Becker <joel.becker@oracle.com>
-- Add RHEL5
-
-* Fri Feb 09 2007 Joel Becker <joel.becker@oracle.com>
-- Strip down for Fedora Core 6
-
-* Thu May 25 2006 Joel Becker <joel.becker@oracle.com>
-- Add largesmp
-
-* Fri Feb 04 2005 Joel Becker <joel.becker@oracle.com>
-- Make RHEL4 specfile.
-
-* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
-- Make SLES9 specfile.
-
-* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
-- Make kernel-only.
-
-* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
-- Add x86 and ia64 targets.
-
-* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
-- Make the UL SP3 changes.
-
-* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
-- Start the ASM rename.
-
-* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
-- Created EL3 version
-
-* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
-- Added osm-lib bits
-
-* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
-- Initial RPM
-
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles10/Makefile oracleasm-git/vendor/sles10/Makefile
--- oracleasm-2.0.5/vendor/sles10/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/sles10/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -3,7 +3,7 @@ TOPDIR = ../..
 include $(TOPDIR)/Preamble.make
 
 DIST_FILES =				\
-	oracleasm.spec-generic.in	\
+	oracleasm.spec-generic		\
 	kernel.guess			\
 	rpmarch.guess			\
 	Vendor.make			\
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles10/Vendor.make oracleasm-git/vendor/sles10/Vendor.make
--- oracleasm-2.0.5/vendor/sles10/Vendor.make	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/sles10/Vendor.make	2010-10-28 22:42:48.000000000 +0200
@@ -5,21 +5,26 @@
 TOOLSARCH = $(shell $(TOPDIR)/vendor/sles10/rpmarch.guess tools $(TOPDIR))
 MODULEARCH = $(shell $(TOPDIR)/vendor/sles10/rpmarch.guess module $(TOPDIR))
 VENDOR_EXTENSION = SLE10
+INCLUDE_REQUIRES = glibc-devel
 
+$(TOPDIR)/vendor/sles10/oracleasm-%.spec: \
+	KERNEL_VERSION = $(get_version_release)
 
-$(TOPDIR)/vendor/sles10/oracleasm-%.spec: $(TOPDIR)/vendor/sles10/oracleasm.spec-generic
-	SPECVER="$@"; \
-		SPECVER="$${SPECVER#*oracleasm-}"; \
-		SPECVER="$${SPECVER%.spec}"; \
-		sed -e 's/@@KVER@@/'$${SPECVER}'/' -e 's/@@PKG_VERSION@@/'$(PKG_VERSION)'/' < $< > $@
+$(TOPDIR)/vendor/sles10/oracleasm-%.spec: $(TOPDIR)/vendor/sles10/oracleasm.spec-generic dist
+	$(spec_subst) > $@
 
-sles10_%_srpm: dist $(TOPDIR)/vendor/sles10/oracleasm-%.spec
-	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" $(TOPDIR)/vendor/sles10/oracleasm-$(patsubst sles10_%_srpm,%,$@).spec
+sles10_%_srpm: $(TOPDIR)/vendor/sles10/oracleasm-%.spec dist
+	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" \
+		$(TOPDIR)/vendor/sles10/oracleasm-$(patsubst sles10_%_srpm,%,$@).spec
+	@rm $(TOPDIR)/vendor/sles10/oracleasm-$(patsubst sles10_%_srpm,%,$@).spec
 
 sles10_%_rpm: sles10_%_srpm
-	rpmbuild --rebuild $(MODULEARCH) "oracleasm-$(patsubst sles10_%_rpm,%,$@)-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm"
-
+	rpmbuild --rebuild $(MODULEARCH) \
+		"oracleasm-$(patsubst sles10_%_rpm,%,$@)-$(DPV).src.rpm"
 
 include $(TOPDIR)/vendor/common/Vendor.make
 
-packages: $(shell $(TOPDIR)/vendor/sles10/kernel.guess targets) support_rpm
+packages: $(shell $(TOPDIR)/vendor/sles10/kernel.guess targets) headers_rpm
+
+targets:
+	$(TOPDIR)/vendor/sles10/kernel.guess targets
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles10/kernel.guess oracleasm-git/vendor/sles10/kernel.guess
--- oracleasm-2.0.5/vendor/sles10/kernel.guess	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/sles10/kernel.guess	2010-10-28 22:42:48.000000000 +0200
@@ -16,7 +16,7 @@ SLES10_KERNEL_TYPES="
     ppc64:pseries64,iseries64,pmac64
     ia64:default,64k-pagesize,sn2
     i386:default,smp,bigsmp
-    s390:s390x
+    s390:default
 "
     
 
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles10/oracleasm.spec-generic oracleasm-git/vendor/sles10/oracleasm.spec-generic
--- oracleasm-2.0.5/vendor/sles10/oracleasm.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles10/oracleasm.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,491 @@
+#
+# Spec file for oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+# Turn on's and off's
+%define builddefault		1
+%define buildsmp		1
+%define buildbigsmp		1
+%define build64kpagesize	0
+%define buildsn2		0
+%define buildiseries64		0
+%define buildpmac64		0
+%define buildpseries64		0
+
+%ifarch %{ix86}
+%define karch i386
+%endif
+
+%ifarch x86_64 ia32e
+%define karch x86_64
+
+%define buildbigsmp		0
+%endif
+
+%ifarch ia64
+%define karch ia64
+
+%define buildsmp		0
+%define buildbigsmp		0
+%define build64kpagesize	1
+%define buildsn2		1
+%endif
+
+%ifarch ppc64
+%define karch ppc64
+
+%define builddefault		0
+%define buildsmp		0
+%define buildbigsmp		0
+%define buildiseries64		1
+%define buildpmac64		1
+%define buildpseries64		1
+%endif
+
+%ifarch s390
+%define karch s390
+
+%define buildsmp		0
+%define buildbigsmp		0
+%endif
+
+%ifarch s390x
+%define karch s390
+
+%define buildsmp		0
+%define buildbigsmp		0
+%endif
+
+
+# This must be changed to the minimum ABI compat kernel version expected
+%define kver		@@KERNEL_VERSION@@
+
+# The minimum -support package required for the kernel bits.
+%define support_ver     2.0.0
+# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
+%define min_enodev	2.0.1
+
+Summary: The Oracle Automatic Storage Management library driver.
+Name: oracleasm-%{kver}
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@.SLE10
+License: GPL
+Group: System Environment/Kernel
+Source: oracleasm-@@DIST_VERSION@@.tar.gz
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-default = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+
+%description
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+
+%if %{builddefault}
+%package default
+Summary: The Oracle Automatic Storage Management library driver for UP systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-default = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description default
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+%endif
+
+
+%if %{buildsmp}
+%package smp
+Summary: The Oracle Automatic Storage Management library driver for SMP systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-smp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description smp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for symmetric multiprocessor kernels.
+%endif
+
+
+%if %{buildbigsmp}
+%package bigsmp
+Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-bigsmp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description bigsmp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for large memory SMP kernels.
+%endif
+
+
+%if %{build64kpagesize}
+%package 64k-pagesize
+Summary: The Oracle Automatic Storage Management library driver for Itanium kernels with a 64KB pagesize.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-64k-pagesize = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description 64k-pagesize
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for Itanium kernels with a 64KB pagesize.
+%endif
+
+
+%if %{buildsn2}
+%package sn2
+Summary: The Oracle Automatic Storage Management library driver for Altix systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-sn2 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description sn2
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for UP Itanium2 kernels.
+%endif
+
+
+%if %{buildiseries64}
+%package iseries64
+Summary: The Oracle Automatic Storage Management library driver for IBM iSeries systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-iseries64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description iseries64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM iSeries systems.
+%endif
+
+
+%if %{buildpmac64}
+%package pmac64
+Summary: The Oracle Automatic Storage Management library driver for 64-bit Power Macintosh kernels.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-pmac64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description pmac64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for 64-bit Power Macintosh kernels.
+%endif
+
+
+%if %{buildpseries64}
+%package pseries64
+Summary: The Oracle Automatic Storage Management library driver for IBM pSeries systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-pseries64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description pseries64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM pSeries systems.
+%endif
+
+
+%prep
+%setup -n oracleasm-%{version}
+
+
+%build
+
+local_configure()
+{
+	./configure					\
+		--prefix=%{_prefix}			\
+		--exec-prefix=%{_exec_prefix}		\
+		--bindir=%{_bindir}			\
+		--sbindir=%{_sbindir}			\
+		--sysconfdir=%{_sysconfdir}		\
+		--datadir=%{_datadir}			\
+		--includedir=%{_includedir}		\
+		--libdir=%{_libdir}			\
+		--libexecdir=%{_libexecdir}		\
+		--localstatedir=%{_localstatedir}	\
+		--sharedstatedir=%{_sharedstatedir}	\
+		--mandir=%{_mandir}			\
+		--infodir=%{_infodir}			\
+		--with-vendor=sles10			\
+		--with-vendorkernel="$1"
+}
+
+%if %{builddefault}
+local_configure "%{kver}-default"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildsmp}
+local_configure "%{kver}-smp"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildbigsmp}
+local_configure "%{kver}-bigsmp"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{build64kpagesize}
+local_configure "%{kver}-64k-pagesize"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildsn2}
+local_configure "%{kver}-sn2"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildiseries64}
+local_configure "%{kver}-iseries64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildpmac64}
+local_configure "%{kver}-pmac64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildpseries64}
+local_configure "%{kver}-pseries64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+
+%install
+
+
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+
+
+%if %{builddefault}
+%post default
+depmod -ae %{kver}-default
+
+%files default
+%defattr(-,root,root)
+/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildsmp}
+%post smp
+depmod -ae %{kver}-smp
+
+%files smp
+%defattr(-,root,root)
+/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildbigsmp}
+%post bigsmp
+depmod -ae %{kver}-bigsmp
+
+%files bigsmp
+%defattr(-,root,root)
+/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{build64kpagesize}
+%post 64k-pagesize
+depmod -ae %{kver}-64k-pagesize
+
+%files 64k-pagesize
+%defattr(-,root,root)
+/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildsn2}
+%post sn2
+depmod -ae %{kver}-sn2/
+
+%files sn2
+%defattr(-,root,root)
+/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildiseries64}
+%post iseries64
+depmod -ae %{kver}-iseries64
+
+%files iseries64
+%defattr(-,root,root)
+/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildpmac64}
+%post pmac64
+depmod -ae %{kver}-pmac64
+
+%files pmac64
+%defattr(-,root,root)
+/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildpseries64}
+%post pseries64
+depmod -ae %{kver}-pseries64
+
+%files pseries64
+%defattr(-,root,root)
+/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm
+%endif
+
+
+
+%changelog
+* Thu Oct 23 2008 Joel Becker <joel.becker@oracle.com>
+- Remove s390 sections, as it now uses -default.
+
+* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
+- Make SLES9 specfile.
+
+* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
+- Make kernel-only.
+
+* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
+- Add x86 and ia64 targets.
+
+* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
+- Make the UL SP3 changes.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles10/oracleasm.spec-generic.in oracleasm-git/vendor/sles10/oracleasm.spec-generic.in
--- oracleasm-2.0.5/vendor/sles10/oracleasm.spec-generic.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/sles10/oracleasm.spec-generic.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,578 +0,0 @@
-#
-# Spec file for oracleasm
-#
-
-# Macros
-# This one is hardcoded because, well, it belongs there
-%define _prefix /usr
-# Because RPM is dumb
-%define _unpackaged_files_terminate_build 0
-
-# Turn on's and off's
-%define builddefault		1
-%define buildsmp		1
-%define buildbigsmp		1
-%define build64kpagesize	0
-%define buildsn2		0
-%define buildiseries64		0
-%define buildpmac64		0
-%define buildpseries64		0
-%define builds390		0
-%define builds390x		0
-
-%ifarch %{ix86}
-%define karch i386
-%endif
-
-%ifarch x86_64 ia32e
-%define karch x86_64
-
-%define buildbigsmp		0
-%endif
-
-%ifarch ia64
-%define karch ia64
-
-%define buildsmp		0
-%define buildbigsmp		0
-%define build64kpagesize	1
-%define buildsn2		1
-%endif
-
-%ifarch ppc64
-%define karch ppc64
-
-%define builddefault		0
-%define buildsmp		0
-%define buildbigsmp		0
-%define buildiseries64		1
-%define buildpmac64		1
-%define buildpseries64		1
-%endif
-
-%ifarch s390
-%define karch s390
-
-%define builddefault		0
-%define buildsmp		0
-%define buildbigsmp		0
-%define builds390		1
-%endif
-
-%ifarch s390x
-%define karch s390
-
-%define builddefault		0
-%define buildsmp		0
-%define buildbigsmp		0
-%define builds390x		1
-%endif
-
-
-# This must be changed to the minimum ABI compat kernel version expected
-%define kver		@@KVER@@
-
-# The minimum -support package required for the kernel bits.
-%define support_ver     2.0.0
-# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
-%define min_enodev	2.0.1
-
-Summary: The Oracle Automatic Storage Management library driver.
-Name: oracleasm-%{kver}
-Version: @DIST_VERSION@
-Release: @@PKG_VERSION@@.SLE10
-License: GPL
-Group: System Environment/Kernel
-Source: oracleasm-@DIST_VERSION@.tar.gz
-URL: http://oss.oracle.com/projects/oracleasm/
-Distribution: Oracle
-Vendor: Oracle Corporation
-Packager: Joel Becker <joel.becker@oracle.com>
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-default = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-
-BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
-
-
-%description
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the default kernel.
-
-%if %{builddefault}
-%package default
-Summary: The Oracle Automatic Storage Management library driver for UP systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-default = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description default
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the default kernel.
-%endif
-
-
-%if %{buildsmp}
-%package smp
-Summary: The Oracle Automatic Storage Management library driver for SMP systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-smp = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description smp
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for symmetric multiprocessor kernels.
-%endif
-
-
-%if %{buildbigsmp}
-%package bigsmp
-Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-bigsmp = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description bigsmp
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for large memory SMP kernels.
-%endif
-
-
-%if %{build64kpagesize}
-%package 64k-pagesize
-Summary: The Oracle Automatic Storage Management library driver for Itanium kernels with a 64KB pagesize.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-64k-pagesize = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description 64k-pagesize
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for Itanium kernels with a 64KB pagesize.
-%endif
-
-
-%if %{buildsn2}
-%package sn2
-Summary: The Oracle Automatic Storage Management library driver for Altix systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-sn2 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description sn2
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for UP Itanium2 kernels.
-%endif
-
-
-%if %{buildiseries64}
-%package iseries64
-Summary: The Oracle Automatic Storage Management library driver for IBM iSeries systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-iseries64 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description iseries64
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM iSeries systems.
-%endif
-
-
-%if %{buildpmac64}
-%package pmac64
-Summary: The Oracle Automatic Storage Management library driver for 64-bit Power Macintosh kernels.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-pmac64 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description pmac64
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for 64-bit Power Macintosh kernels.
-%endif
-
-
-%if %{buildpseries64}
-%package pseries64
-Summary: The Oracle Automatic Storage Management library driver for IBM pSeries systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-pseries64 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description pseries64
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM pSeries systems.
-%endif
-
-
-%if %{builds390}
-%package s390
-Summary: The Oracle Automatic Storage Management library driver for IBM S/390 31-bit systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-s390 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description s390
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM S/390 31-bit systems.
-%endif
-
-
-%if %{builds390x}
-%package s390x
-Summary: The Oracle Automatic Storage Management library driver for IBM zSeries systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-s390x = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description s390x
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM zSeries systems.
-%endif
-
-
-
-%prep
-%setup -n oracleasm-%{version}
-
-
-%build
-
-local_configure()
-{
-	./configure					\
-		--prefix=%{_prefix}			\
-		--exec-prefix=%{_exec_prefix}		\
-		--bindir=%{_bindir}			\
-		--sbindir=%{_sbindir}			\
-		--sysconfdir=%{_sysconfdir}		\
-		--datadir=%{_datadir}			\
-		--includedir=%{_includedir}		\
-		--libdir=%{_libdir}			\
-		--libexecdir=%{_libexecdir}		\
-		--localstatedir=%{_localstatedir}	\
-		--sharedstatedir=%{_sharedstatedir}	\
-		--mandir=%{_mandir}			\
-		--infodir=%{_infodir}			\
-		--with-vendor=sles10			\
-		--with-vendorkernel="$1"
-}
-
-%if %{builddefault}
-local_configure "%{kver}-default"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildsmp}
-local_configure "%{kver}-smp"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildbigsmp}
-local_configure "%{kver}-bigsmp"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{build64kpagesize}
-local_configure "%{kver}-64k-pagesize"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildsn2}
-local_configure "%{kver}-sn2"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildiseries64}
-local_configure "%{kver}-iseries64"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildpmac64}
-local_configure "%{kver}-pmac64"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildpseries64}
-local_configure "%{kver}-pseries64"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{builds390}
-local_configure "%{kver}-s390"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{builds390x}
-local_configure "%{kver}-s390x"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390x/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390x/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-
-
-%install
-
-
-
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
-
-
-%if %{builddefault}
-%post default
-depmod -ae %{kver}-default
-
-%files default
-%defattr(-,root,root)
-/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildsmp}
-%post smp
-depmod -ae %{kver}-smp
-
-%files smp
-%defattr(-,root,root)
-/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildbigsmp}
-%post bigsmp
-depmod -ae %{kver}-bigsmp
-
-%files bigsmp
-%defattr(-,root,root)
-/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{build64kpagesize}
-%post 64k-pagesize
-depmod -ae %{kver}-64k-pagesize
-
-%files 64k-pagesize
-%defattr(-,root,root)
-/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildsn2}
-%post sn2
-depmod -ae %{kver}-sn2/
-
-%files sn2
-%defattr(-,root,root)
-/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildiseries64}
-%post iseries64
-depmod -ae %{kver}-iseries64
-
-%files iseries64
-%defattr(-,root,root)
-/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildpmac64}
-%post pmac64
-depmod -ae %{kver}-pmac64
-
-%files pmac64
-%defattr(-,root,root)
-/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildpseries64}
-%post pseries64
-depmod -ae %{kver}-pseries64
-
-%files pseries64
-%defattr(-,root,root)
-/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{builds390}
-%post s390
-depmod -ae %{kver}-s390
-
-%files s390
-%defattr(-,root,root)
-/lib/modules/%{kver}-s390/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{builds390x}
-%post s390x
-depmod -ae %{kver}-s390x
-
-%files s390x
-%defattr(-,root,root)
-/lib/modules/%{kver}-s390x/kernel/drivers/addon/oracleasm
-%endif
-
-
-
-%changelog
-* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
-- Make SLES9 specfile.
-
-* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
-- Make kernel-only.
-
-* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
-- Add x86 and ia64 targets.
-
-* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
-- Make the UL SP3 changes.
-
-* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
-- Start the ASM rename.
-
-* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
-- Created EL3 version
-
-* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
-- Added osm-lib bits
-
-* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
-- Initial RPM
-
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles11/Makefile oracleasm-git/vendor/sles11/Makefile
--- oracleasm-2.0.5/vendor/sles11/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles11/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,12 @@
+TOPDIR = ../..
+
+include $(TOPDIR)/Preamble.make
+
+DIST_FILES =				\
+	oracleasm.spec-generic		\
+	kernel.guess			\
+	rpmarch.guess			\
+	Vendor.make			\
+	vendor.guess
+
+include $(TOPDIR)/Postamble.make
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles11/Vendor.make oracleasm-git/vendor/sles11/Vendor.make
--- oracleasm-2.0.5/vendor/sles11/Vendor.make	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles11/Vendor.make	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,30 @@
+#
+# SLES 11
+#
+
+TOOLSARCH = $(shell $(TOPDIR)/vendor/sles11/rpmarch.guess tools $(TOPDIR))
+MODULEARCH = $(shell $(TOPDIR)/vendor/sles11/rpmarch.guess module $(TOPDIR))
+VENDOR_EXTENSION = SLE11
+INCLUDE_REQUIRES = glibc-devel
+
+$(TOPDIR)/vendor/sles11/oracleasm-%.spec: \
+	KERNEL_VERSION = $(get_version_release)
+
+$(TOPDIR)/vendor/sles11/oracleasm-%.spec: $(TOPDIR)/vendor/sles11/oracleasm.spec-generic dist
+	$(spec_subst) > $@
+
+sles11_%_srpm: $(TOPDIR)/vendor/sles11/oracleasm-%.spec dist
+	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" \
+		$(TOPDIR)/vendor/sles11/oracleasm-$(patsubst sles11_%_srpm,%,$@).spec
+	@rm $(TOPDIR)/vendor/sles11/oracleasm-$(patsubst sles11_%_srpm,%,$@).spec
+
+sles11_%_rpm: sles11_%_srpm
+	rpmbuild --rebuild $(MODULEARCH) \
+		"oracleasm-$(patsubst sles11_%_rpm,%,$@)-$(DPV).src.rpm"
+
+include $(TOPDIR)/vendor/common/Vendor.make
+
+packages: $(shell $(TOPDIR)/vendor/sles11/kernel.guess targets) headers_rpm
+
+targets:
+	$(TOPDIR)/vendor/sles11/kernel.guess targets
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles11/kernel.guess oracleasm-git/vendor/sles11/kernel.guess
--- oracleasm-2.0.5/vendor/sles11/kernel.guess	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles11/kernel.guess	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,299 @@
+#!/bin/sh
+
+SLES11_KERNEL_BASE="/usr/src"
+
+#
+# SLES11 has wacky names for its kernel flavors.  So we'll just create
+# a list here of the mappings.  It's pretty simple.  One entry per
+# architecture, <arch>:<flavor1>[,<flavor> ...]
+#
+# Anyway, we can even reuse this when detecting kernels to build
+# packages for.  A kernel is only built if build trees for all flavors
+# are installed.
+#
+SLES11_KERNEL_TYPES="
+    x86_64:default,xen
+    ppc64:pseries64,iseries64,pmac64
+    ia64:default,64k-pagesize,sn2
+    i386:default,pae,vmi,xen
+    s390:default
+"
+    
+
+
+guess_sles11_arch()
+{
+    ARCH=$(uname -m)
+    case "$ARCH" in
+    i386|i586|i686)
+	echo "i386"
+        ;;
+    s390x)
+        echo "s390"
+        ;;
+    *)
+        # This appears to be correct on ppc64
+        echo "$ARCH"
+        ;;
+    esac
+}
+
+guess_sles11_type()
+{
+    KVER="$1"
+
+    ARCH="$(guess_sles11_arch)"
+    if [ -z "$ARCH" ]
+    then
+        return
+    fi
+
+    for typelist in $SLES11_KERNEL_TYPES
+    do
+        TARCH=$(echo $typelist | cut -f1 -d:)
+        if [ "$TARCH" = "$ARCH" ]
+        then
+            for type in $(echo $typelist | cut -f2 -d: | sed -e 's/,/ /g')
+            do
+                case "$KVER" in
+                *-${type})
+                    echo "$type"
+                    break
+                    ;;
+                *)
+                    ;;
+                esac
+            done
+            break
+        fi
+    done
+}
+
+guess_sles11_dir()
+{
+    KVER="$1"
+
+    DIRTYPE=$(guess_sles11_type "$KVER")
+    ARCH=$(guess_sles11_arch)
+
+    if [ -n "$DIRTYPE" ]
+    then
+        echo "linux-${1%-${DIRTYPE}}-obj/${ARCH}/${DIRTYPE}"
+    fi
+}
+
+verfromdir()
+{
+    TESTDIR="$1"
+    if [ -r "${TESTDIR}/include/linux/utsrelease.h" ]
+    then
+        awk '/UTS_RELEASE/{gsub(/"/,"",$3); print $3}' "${TESTDIR}/include/linux/utsrelease.h"
+    fi
+}
+
+validate_dir()
+{
+    KVER="$1"
+    DIR="$2"
+
+    if [ ! -d "${SLES11_KERNEL_BASE}/${DIR}" ]
+    then
+        return 1
+    elif [ ! -f "${SLES11_KERNEL_BASE}/${DIR}/include/linux/autoconf.h" ]
+    then
+        return 1
+    elif [ ! -f "${SLES11_KERNEL_BASE}/${DIR}/include/linux/version.h" ]
+    then
+        return 1
+    fi
+
+    if [ "$KVER" != "`verfromdir "${SLES11_KERNEL_BASE}/${DIR}"`" ]
+    then
+        return 1
+    fi
+
+    return 0
+}
+
+# Takes a `uname -r` and returns "ver type", where ver
+# is 2.6.9-NN.EL and type is "smp" or the like.
+validate_version()
+{
+    KVER="$1"
+
+    dir=`guess_sles11_dir "$KVER"`
+    if validate_dir "$KVER" "$dir"
+    then
+        echo "${SLES11_KERNEL_BASE}/${dir}"
+    fi
+}
+
+find_version()
+{
+    ARCH="$(guess_sles11_arch)"
+    if [ -z "$ARCH" ]
+    then
+        return
+    fi
+
+    types=
+    for typelist in $SLES11_KERNEL_TYPES
+    do
+        TARCH=$(echo $typelist | cut -f1 -d:)
+        if [ "$TARCH" = "$ARCH" ]
+        then
+            types=$(echo $typelist | cut -f2 -d: | sed -e 's/,/ /g')
+            break
+        fi
+    done
+
+    if [ -z "$types" ]
+    then
+        return
+    fi
+
+     # Find the most recent valid kernel
+    ls -1 -t "$SLES11_KERNEL_BASE" | while read kdir
+    do
+        if [ -L "${SLES11_KERNEL_BASE}/${kdir}" -o ! -d "${SLES11_KERNEL_BASE}/${kdir}" ]
+        then
+            continue
+        fi
+
+        case "$kdir" in
+        *-obj)
+            ;;
+        *)
+            continue
+            ;;
+        esac
+        KERNELDIR=
+        for type in $types
+        do
+            KVER="`verfromdir "${SLES11_KERNEL_BASE}/${kdir}/${ARCH}/${type}"`"
+            if validate_dir "$KVER" "$kdir/${ARCH}/${type}"
+            then
+                KERNELDIR="${SLES11_KERNEL_BASE}/${kdir}/${ARCH}/${type}"
+                break
+            fi
+        done
+        if [ -n "$KERNELDIR" ]
+        then
+            echo "$KERNELDIR"
+            break
+        fi
+    done
+}
+
+validate_target()
+{
+    DIR="$1"
+    ARCH="$2"
+    types="$3"
+    for type in $types
+    do
+        KVER="`verfromdir "${SLES11_KERNEL_BASE}/${kdir}/${ARCH}/${type}"`"
+        if ! validate_dir "$KVER" "$kdir/${ARCH}/${type}"
+        then
+            return 1
+        fi
+    done
+
+    return 0
+}
+
+find_targets()
+{
+    ARCH="$(guess_sles11_arch)"
+    if [ -z "$ARCH" ]
+    then
+        return
+    fi
+
+    types=
+    for typelist in $SLES11_KERNEL_TYPES
+    do
+        TARCH=$(echo $typelist | cut -f1 -d:)
+        if [ "$TARCH" = "$ARCH" ]
+        then
+            types=$(echo $typelist | cut -f2 -d: | sed -e 's/,/ /g')
+            break
+        fi
+    done
+
+    if [ -z "$types" ]
+    then
+        return
+    fi
+
+    ls -1 -t "$SLES11_KERNEL_BASE" | while read kdir
+    do
+        # Avoid the symlinks
+        if [ -L "${SLES11_KERNEL_BASE}/${kdir}" -o ! -d "${SLES11_KERNEL_BASE}/${kdir}" ]
+        then
+            continue
+        fi
+        case "$kdir" in
+        linux-*-obj)
+            if validate_target "$kdir" "$ARCH" "$types"
+            then
+                KVER="${kdir#linux-}"
+                KVER="${KVER%-obj}"
+		SYMS="$(rpm -qa 2>/dev/null | grep "^kernel-syms-${KVER}" 2>/dev/null)"
+                if [ -n "$SYMS" ]
+                then
+                    echo "sles11_${KVER}_rpm"
+                fi
+            fi
+            ;;
+        *)
+            ;;
+        esac
+    done
+}
+
+sles11_includes()
+{
+    DIR="$1"
+    kernelsrc=`awk '/^KERNELSRC/{print $3}' "${DIR}/Makefile" 2>/dev/null`
+
+    INCLUDES="$DIR/include"
+    [ -n "$kernelsrc" ] && INCLUDES="${INCLUDES} ${DIR}/${kernelsrc}/include"
+
+    echo "$INCLUDES"
+}
+
+case "$1" in
+include|build)
+    if [ -n "$2" ]
+    then
+        KPATH="`validate_version "$2"`"
+    else
+        KVER="`uname -r`"
+        KPATH="`validate_version "$KVER"`"
+        if [ -z "$KPATH" ]
+        then
+            KPATH="`find_version`"
+        fi
+    fi
+    if [ -n "$KPATH" ]
+    then
+        if [ "$1" = "include" ]
+        then
+            sles11_includes "${KPATH}"
+        else
+            echo "${KPATH}"
+        fi
+    fi
+    ;;
+targets)
+    find_targets
+    ;;
+"")
+    echo "Missing operation" >&2
+    ;;
+*)
+    echo "Invalid operation: $1" >&2
+    exit 1
+    ;;
+esac
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles11/oracleasm.spec-generic oracleasm-git/vendor/sles11/oracleasm.spec-generic
--- oracleasm-2.0.5/vendor/sles11/oracleasm.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles11/oracleasm.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,491 @@
+#
+# Spec file for oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+# Turn on's and off's
+%define builddefault		1
+%define buildsmp		1
+%define buildbigsmp		1
+%define build64kpagesize	0
+%define buildsn2		0
+%define buildiseries64		0
+%define buildpmac64		0
+%define buildpseries64		0
+
+%ifarch %{ix86}
+%define karch i386
+%endif
+
+%ifarch x86_64 ia32e
+%define karch x86_64
+
+%define buildbigsmp		0
+%endif
+
+%ifarch ia64
+%define karch ia64
+
+%define buildsmp		0
+%define buildbigsmp		0
+%define build64kpagesize	1
+%define buildsn2		1
+%endif
+
+%ifarch ppc64
+%define karch ppc64
+
+%define builddefault		0
+%define buildsmp		0
+%define buildbigsmp		0
+%define buildiseries64		1
+%define buildpmac64		1
+%define buildpseries64		1
+%endif
+
+%ifarch s390
+%define karch s390
+
+%define buildsmp		0
+%define buildbigsmp		0
+%endif
+
+%ifarch s390x
+%define karch s390
+
+%define buildsmp		0
+%define buildbigsmp		0
+%endif
+
+
+# This must be changed to the minimum ABI compat kernel version expected
+%define kver		@@KERNEL_VERSION@@
+
+# The minimum -support package required for the kernel bits.
+%define support_ver     2.0.0
+# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
+%define min_enodev	2.0.1
+
+Summary: The Oracle Automatic Storage Management library driver.
+Name: oracleasm-%{kver}
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@.SLE10
+License: GPL
+Group: System Environment/Kernel
+Source: oracleasm-@@DIST_VERSION@@.tar.gz
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-default = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+
+%description
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+
+%if %{builddefault}
+%package default
+Summary: The Oracle Automatic Storage Management library driver for UP systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-default = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description default
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+%endif
+
+
+%if %{buildsmp}
+%package smp
+Summary: The Oracle Automatic Storage Management library driver for SMP systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-smp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description smp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for symmetric multiprocessor kernels.
+%endif
+
+
+%if %{buildbigsmp}
+%package bigsmp
+Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-bigsmp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description bigsmp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for large memory SMP kernels.
+%endif
+
+
+%if %{build64kpagesize}
+%package 64k-pagesize
+Summary: The Oracle Automatic Storage Management library driver for Itanium kernels with a 64KB pagesize.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-64k-pagesize = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description 64k-pagesize
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for Itanium kernels with a 64KB pagesize.
+%endif
+
+
+%if %{buildsn2}
+%package sn2
+Summary: The Oracle Automatic Storage Management library driver for Altix systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-sn2 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description sn2
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for UP Itanium2 kernels.
+%endif
+
+
+%if %{buildiseries64}
+%package iseries64
+Summary: The Oracle Automatic Storage Management library driver for IBM iSeries systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-iseries64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description iseries64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM iSeries systems.
+%endif
+
+
+%if %{buildpmac64}
+%package pmac64
+Summary: The Oracle Automatic Storage Management library driver for 64-bit Power Macintosh kernels.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-pmac64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description pmac64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for 64-bit Power Macintosh kernels.
+%endif
+
+
+%if %{buildpseries64}
+%package pseries64
+Summary: The Oracle Automatic Storage Management library driver for IBM pSeries systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-pseries64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description pseries64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM pSeries systems.
+%endif
+
+
+%prep
+%setup -n oracleasm-%{version}
+
+
+%build
+
+local_configure()
+{
+	./configure					\
+		--prefix=%{_prefix}			\
+		--exec-prefix=%{_exec_prefix}		\
+		--bindir=%{_bindir}			\
+		--sbindir=%{_sbindir}			\
+		--sysconfdir=%{_sysconfdir}		\
+		--datadir=%{_datadir}			\
+		--includedir=%{_includedir}		\
+		--libdir=%{_libdir}			\
+		--libexecdir=%{_libexecdir}		\
+		--localstatedir=%{_localstatedir}	\
+		--sharedstatedir=%{_sharedstatedir}	\
+		--mandir=%{_mandir}			\
+		--infodir=%{_infodir}			\
+		--with-vendor=sles10			\
+		--with-vendorkernel="$1"
+}
+
+%if %{builddefault}
+local_configure "%{kver}-default"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildsmp}
+local_configure "%{kver}-smp"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildbigsmp}
+local_configure "%{kver}-bigsmp"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{build64kpagesize}
+local_configure "%{kver}-64k-pagesize"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildsn2}
+local_configure "%{kver}-sn2"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildiseries64}
+local_configure "%{kver}-iseries64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildpmac64}
+local_configure "%{kver}-pmac64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildpseries64}
+local_configure "%{kver}-pseries64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+
+%install
+
+
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+
+
+%if %{builddefault}
+%post default
+depmod -ae %{kver}-default
+
+%files default
+%defattr(-,root,root)
+/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildsmp}
+%post smp
+depmod -ae %{kver}-smp
+
+%files smp
+%defattr(-,root,root)
+/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildbigsmp}
+%post bigsmp
+depmod -ae %{kver}-bigsmp
+
+%files bigsmp
+%defattr(-,root,root)
+/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{build64kpagesize}
+%post 64k-pagesize
+depmod -ae %{kver}-64k-pagesize
+
+%files 64k-pagesize
+%defattr(-,root,root)
+/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildsn2}
+%post sn2
+depmod -ae %{kver}-sn2/
+
+%files sn2
+%defattr(-,root,root)
+/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildiseries64}
+%post iseries64
+depmod -ae %{kver}-iseries64
+
+%files iseries64
+%defattr(-,root,root)
+/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildpmac64}
+%post pmac64
+depmod -ae %{kver}-pmac64
+
+%files pmac64
+%defattr(-,root,root)
+/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildpseries64}
+%post pseries64
+depmod -ae %{kver}-pseries64
+
+%files pseries64
+%defattr(-,root,root)
+/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm
+%endif
+
+
+
+%changelog
+* Thu Oct 23 2008 Joel Becker <joel.becker@oracle.com>
+- Remove s390 sections, as it now uses -default.
+
+* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
+- Make SLES9 specfile.
+
+* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
+- Make kernel-only.
+
+* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
+- Add x86 and ia64 targets.
+
+* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
+- Make the UL SP3 changes.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles11/rpmarch.guess oracleasm-git/vendor/sles11/rpmarch.guess
--- oracleasm-2.0.5/vendor/sles11/rpmarch.guess	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles11/rpmarch.guess	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,70 @@
+#! /bin/sh
+
+mode="$1"
+srcdir="$2"
+
+host_cpu=
+
+QUERYFILE=/etc/SuSE-release
+
+if test -n "$QUERYFILE"; then
+  host_cpu="`rpm -qf $QUERYFILE --queryformat \"%{ARCH}\"`"
+fi
+
+if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then
+  host_alias=`$srcdir/config.guess`
+  host=`$srcdir/config.sub $host_alias`
+  host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+fi
+
+case "$host_cpu" in
+  x86_64|ia64|s390x)
+    TOOLSARCH="$host_cpu"
+    ;;
+  i386|i486|i586|i686|i786|k6|k7)
+    TOOLSARCH="i386"
+    ;;
+  ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+    TOOLSARCH="ppc64"
+    ;;
+  *)
+    echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2
+    TOOLSARCH=""
+    ;;
+esac
+
+# Only a few of these need to be overwritten from RPM's default
+case "$host_cpu" in
+  i586)
+    MODULEARCH="$host_cpu"
+    ;;
+  i386|i686)
+    MODULEARCH="i586"
+    ;;
+  ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+    MODULEARCH="ppc64"
+    ;;
+  *)
+    MODULEARCH=""
+    ;;
+esac
+
+case "$mode" in
+  module)
+    if [ -n "$MODULEARCH" ] ; then
+      echo "--target $MODULEARCH"
+    fi
+    ;;
+  tools)
+    if [ -n "$TOOLSARCH" ] ; then
+      echo "--target $TOOLSARCH"
+    fi
+    ;;
+  *)
+    echo "rpmarch.guess: Invalid mode: $mode" >&2
+    echo "error"
+    exit 1
+    ;;
+esac
+
+exit 0
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles11/vendor.guess oracleasm-git/vendor/sles11/vendor.guess
--- oracleasm-2.0.5/vendor/sles11/vendor.guess	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles11/vendor.guess	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ ! -f /etc/SuSE-release ]
+then
+    exit 1
+fi
+
+if [ "`rpm -qf /etc/SuSE-release --qf '%{VERSION}' 2>/dev/null`" != "11" ]
+then
+    exit 1
+fi
+
+exit 0
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles9/Makefile oracleasm-git/vendor/sles9/Makefile
--- oracleasm-2.0.5/vendor/sles9/Makefile	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/sles9/Makefile	2010-10-28 22:42:48.000000000 +0200
@@ -3,7 +3,7 @@ TOPDIR = ../..
 include $(TOPDIR)/Preamble.make
 
 DIST_FILES =				\
-	oracleasm.spec-generic.in	\
+	oracleasm.spec-generic		\
 	kernel.guess			\
 	rpmarch.guess			\
 	Vendor.make			\
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles9/Vendor.make oracleasm-git/vendor/sles9/Vendor.make
--- oracleasm-2.0.5/vendor/sles9/Vendor.make	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/sles9/Vendor.make	2010-10-28 22:42:48.000000000 +0200
@@ -5,23 +5,26 @@
 TOOLSARCH = $(shell $(TOPDIR)/vendor/sles9/rpmarch.guess tools $(TOPDIR))
 MODULEARCH = $(shell $(TOPDIR)/vendor/sles9/rpmarch.guess module $(TOPDIR))
 VENDOR_EXTENSION = SLE9
+INCLUDE_REQUIRES = glibc-devel
 
+$(TOPDIR)/vendor/sles9/oracleasm-%.spec: \
+	KERNEL_VERSION = $(get_version_release)
 
-$(TOPDIR)/vendor/sles9/oracleasm-%.spec: $(TOPDIR)/vendor/sles9/oracleasm.spec-generic
-	SPECVER="$@"; \
-		SPECVER="$${SPECVER#*oracleasm-}"; \
-		SPECVER="$${SPECVER%.spec}"; \
-		sed -e 's/@@KVER@@/'$${SPECVER}'/' -e 's/@@PKG_VERSION@@/'$(PKG_VERSION)'/' < $< > $@
+$(TOPDIR)/vendor/sles9/oracleasm-%.spec: $(TOPDIR)/vendor/sles9/oracleasm.spec-generic dist
+	$(spec_subst) > $@
 
-sles9_%_srpm: dist $(TOPDIR)/vendor/sles9/oracleasm-%.spec
-	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" $(TOPDIR)/vendor/sles9/oracleasm-$(patsubst sles9_%_srpm,%,$@).spec
+sles9_%_srpm: $(TOPDIR)/vendor/sles9/oracleasm-%.spec dist
+	rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" \
+		$(TOPDIR)/vendor/sles9/oracleasm-$(patsubst sles9_%_srpm,%,$@).spec
+	@rm $(TOPDIR)/vendor/sles9/oracleasm-$(patsubst sles9_%_srpm,%,$@).spec
 
 sles9_%_rpm: sles9_%_srpm
-	rpmbuild --rebuild $(MODULEARCH) "oracleasm-$(patsubst sles9_%_rpm,%,$@)-$(DIST_VERSION)-$(PKG_VERSION).$(VENDOR_EXTENSION).src.rpm"
-
+	rpmbuild --rebuild $(MODULEARCH) \
+		"oracleasm-$(patsubst sles9_%_rpm,%,$@)-$(DPV).src.rpm"
 
-# Package required for /usr/include/linux
-INCLUDE_REQUIRES = glibc-devel
 include $(TOPDIR)/vendor/common/Vendor.make
 
 packages: $(shell $(TOPDIR)/vendor/sles9/kernel.guess targets) headers_rpm
+
+targets:
+	$(TOPDIR)/vendor/sles9/kernel.guess targets
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles9/oracleasm.spec-generic oracleasm-git/vendor/sles9/oracleasm.spec-generic
--- oracleasm-2.0.5/vendor/sles9/oracleasm.spec-generic	1970-01-01 01:00:00.000000000 +0100
+++ oracleasm-git/vendor/sles9/oracleasm.spec-generic	2010-10-28 22:42:48.000000000 +0200
@@ -0,0 +1,578 @@
+#
+# Spec file for oracleasm
+#
+
+# Macros
+# This one is hardcoded because, well, it belongs there
+%define _prefix /usr
+# Because RPM is dumb
+%define _unpackaged_files_terminate_build 0
+
+# Turn on's and off's
+%define builddefault		1
+%define buildsmp		1
+%define buildbigsmp		1
+%define build64kpagesize	0
+%define buildsn2		0
+%define buildiseries64		0
+%define buildpmac64		0
+%define buildpseries64		0
+%define builds390		0
+%define builds390x		0
+
+%ifarch %{ix86}
+%define karch i386
+%endif
+
+%ifarch x86_64 ia32e
+%define karch x86_64
+
+%define buildbigsmp		0
+%endif
+
+%ifarch ia64
+%define karch ia64
+
+%define buildsmp		0
+%define buildbigsmp		0
+%define build64kpagesize	1
+%define buildsn2		1
+%endif
+
+%ifarch ppc64
+%define karch ppc64
+
+%define builddefault		0
+%define buildsmp		0
+%define buildbigsmp		0
+%define buildiseries64		1
+%define buildpmac64		1
+%define buildpseries64		1
+%endif
+
+%ifarch s390
+%define karch s390
+
+%define builddefault		0
+%define buildsmp		0
+%define buildbigsmp		0
+%define builds390		1
+%endif
+
+%ifarch s390x
+%define karch s390
+
+%define builddefault		0
+%define buildsmp		0
+%define buildbigsmp		0
+%define builds390x		1
+%endif
+
+
+# This must be changed to the minimum ABI compat kernel version expected
+%define kver		@@KERNEL_VERSION@@
+
+# The minimum -support package required for the kernel bits.
+%define support_ver     2.0.0
+# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
+%define min_enodev	2.0.1
+
+Summary: The Oracle Automatic Storage Management library driver.
+Name: oracleasm-%{kver}
+Version: @@DIST_VERSION@@
+Release: @@PKG_VERSION@@.SLE9
+License: GPL
+Group: System Environment/Kernel
+Source: oracleasm-@@DIST_VERSION@@.tar.gz
+URL: http://oss.oracle.com/projects/oracleasm/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: Joel Becker <joel.becker@oracle.com>
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-default = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+
+BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
+
+
+%description
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+
+%if %{builddefault}
+%package default
+Summary: The Oracle Automatic Storage Management library driver for UP systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-default = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description default
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for the default kernel.
+%endif
+
+
+%if %{buildsmp}
+%package smp
+Summary: The Oracle Automatic Storage Management library driver for SMP systems.
+Group: System Environment/Kernel
+AutoReqProv: no
+Provides: oracleasm = %{version}
+Requires: kernel-smp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description smp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for symmetric multiprocessor kernels.
+%endif
+
+
+%if %{buildbigsmp}
+%package bigsmp
+Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-bigsmp = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description bigsmp
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for large memory SMP kernels.
+%endif
+
+
+%if %{build64kpagesize}
+%package 64k-pagesize
+Summary: The Oracle Automatic Storage Management library driver for Itanium kernels with a 64KB pagesize.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-64k-pagesize = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description 64k-pagesize
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for Itanium kernels with a 64KB pagesize.
+%endif
+
+
+%if %{buildsn2}
+%package sn2
+Summary: The Oracle Automatic Storage Management library driver for Altix systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-sn2 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description sn2
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for UP Itanium2 kernels.
+%endif
+
+
+%if %{buildiseries64}
+%package iseries64
+Summary: The Oracle Automatic Storage Management library driver for IBM iSeries systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-iseries64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description iseries64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM iSeries systems.
+%endif
+
+
+%if %{buildpmac64}
+%package pmac64
+Summary: The Oracle Automatic Storage Management library driver for 64-bit Power Macintosh kernels.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-pmac64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description pmac64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for 64-bit Power Macintosh kernels.
+%endif
+
+
+%if %{buildpseries64}
+%package pseries64
+Summary: The Oracle Automatic Storage Management library driver for IBM pSeries systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-pseries64 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description pseries64
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM pSeries systems.
+%endif
+
+
+%if %{builds390}
+%package s390
+Summary: The Oracle Automatic Storage Management library driver for IBM S/390 31-bit systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-s390 = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description s390
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM S/390 31-bit systems.
+%endif
+
+
+%if %{builds390x}
+%package s390x
+Summary: The Oracle Automatic Storage Management library driver for IBM zSeries systems.
+Group: System Environment/Kernel
+Provides: oracleasm = %{version}
+AutoReqProv: no
+Requires: kernel-s390x = %{kver}
+Requires: oracleasm-support >= %{support_ver}
+Conflicts: oracleasmlib < %{min_enodev}
+BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
+
+%description s390x
+Kernel driver for the Oracle Automatic Storage Management library.
+This package is compiled for IBM zSeries systems.
+%endif
+
+
+
+%prep
+%setup -n oracleasm-%{version}
+
+
+%build
+
+local_configure()
+{
+	./configure					\
+		--prefix=%{_prefix}			\
+		--exec-prefix=%{_exec_prefix}		\
+		--bindir=%{_bindir}			\
+		--sbindir=%{_sbindir}			\
+		--sysconfdir=%{_sysconfdir}		\
+		--datadir=%{_datadir}			\
+		--includedir=%{_includedir}		\
+		--libdir=%{_libdir}			\
+		--libexecdir=%{_libexecdir}		\
+		--localstatedir=%{_localstatedir}	\
+		--sharedstatedir=%{_sharedstatedir}	\
+		--mandir=%{_mandir}			\
+		--infodir=%{_infodir}			\
+		--with-vendor=sles9			\
+		--with-vendorkernel="$1"
+}
+
+%if %{builddefault}
+local_configure "%{kver}-default"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildsmp}
+local_configure "%{kver}-smp"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildbigsmp}
+local_configure "%{kver}-bigsmp"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{build64kpagesize}
+local_configure "%{kver}-64k-pagesize"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildsn2}
+local_configure "%{kver}-sn2"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildiseries64}
+local_configure "%{kver}-iseries64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildpmac64}
+local_configure "%{kver}-pmac64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{buildpseries64}
+local_configure "%{kver}-pseries64"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{builds390}
+local_configure "%{kver}-s390"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+%if %{builds390x}
+local_configure "%{kver}-s390x"
+make QUIET=1
+make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
+
+# 2.6 kbuild can't do this install nicely
+EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390x/extra"
+INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390x/kernel/drivers/addon/oracleasm"
+mkdir -p "${INST_MODLIB}"
+mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
+
+make clean
+%endif
+
+
+
+%install
+
+
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+
+
+%if %{builddefault}
+%post default
+depmod -ae %{kver}-default
+
+%files default
+%defattr(-,root,root)
+/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildsmp}
+%post smp
+depmod -ae %{kver}-smp
+
+%files smp
+%defattr(-,root,root)
+/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildbigsmp}
+%post bigsmp
+depmod -ae %{kver}-bigsmp
+
+%files bigsmp
+%defattr(-,root,root)
+/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{build64kpagesize}
+%post 64k-pagesize
+depmod -ae %{kver}-64k-pagesize
+
+%files 64k-pagesize
+%defattr(-,root,root)
+/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildsn2}
+%post sn2
+depmod -ae %{kver}-sn2/
+
+%files sn2
+%defattr(-,root,root)
+/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildiseries64}
+%post iseries64
+depmod -ae %{kver}-iseries64
+
+%files iseries64
+%defattr(-,root,root)
+/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildpmac64}
+%post pmac64
+depmod -ae %{kver}-pmac64
+
+%files pmac64
+%defattr(-,root,root)
+/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{buildpseries64}
+%post pseries64
+depmod -ae %{kver}-pseries64
+
+%files pseries64
+%defattr(-,root,root)
+/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{builds390}
+%post s390
+depmod -ae %{kver}-s390
+
+%files s390
+%defattr(-,root,root)
+/lib/modules/%{kver}-s390/kernel/drivers/addon/oracleasm
+%endif
+
+
+%if %{builds390x}
+%post s390x
+depmod -ae %{kver}-s390x
+
+%files s390x
+%defattr(-,root,root)
+/lib/modules/%{kver}-s390x/kernel/drivers/addon/oracleasm
+%endif
+
+
+
+%changelog
+* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
+- Make SLES9 specfile.
+
+* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
+- Make kernel-only.
+
+* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
+- Add x86 and ia64 targets.
+
+* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
+- Make the UL SP3 changes.
+
+* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
+- Start the ASM rename.
+
+* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
+- Created EL3 version
+
+* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
+- Added osm-lib bits
+
+* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
+- Initial RPM
+
diff -ruNp -x .gitignore -x configure -x ChangeLog -x README.bugs oracleasm-2.0.5/vendor/sles9/oracleasm.spec-generic.in oracleasm-git/vendor/sles9/oracleasm.spec-generic.in
--- oracleasm-2.0.5/vendor/sles9/oracleasm.spec-generic.in	2008-09-10 19:32:11.000000000 +0200
+++ oracleasm-git/vendor/sles9/oracleasm.spec-generic.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,578 +0,0 @@
-#
-# Spec file for oracleasm
-#
-
-# Macros
-# This one is hardcoded because, well, it belongs there
-%define _prefix /usr
-# Because RPM is dumb
-%define _unpackaged_files_terminate_build 0
-
-# Turn on's and off's
-%define builddefault		1
-%define buildsmp		1
-%define buildbigsmp		1
-%define build64kpagesize	0
-%define buildsn2		0
-%define buildiseries64		0
-%define buildpmac64		0
-%define buildpseries64		0
-%define builds390		0
-%define builds390x		0
-
-%ifarch %{ix86}
-%define karch i386
-%endif
-
-%ifarch x86_64 ia32e
-%define karch x86_64
-
-%define buildbigsmp		0
-%endif
-
-%ifarch ia64
-%define karch ia64
-
-%define buildsmp		0
-%define buildbigsmp		0
-%define build64kpagesize	1
-%define buildsn2		1
-%endif
-
-%ifarch ppc64
-%define karch ppc64
-
-%define builddefault		0
-%define buildsmp		0
-%define buildbigsmp		0
-%define buildiseries64		1
-%define buildpmac64		1
-%define buildpseries64		1
-%endif
-
-%ifarch s390
-%define karch s390
-
-%define builddefault		0
-%define buildsmp		0
-%define buildbigsmp		0
-%define builds390		1
-%endif
-
-%ifarch s390x
-%define karch s390
-
-%define builddefault		0
-%define buildsmp		0
-%define buildbigsmp		0
-%define builds390x		1
-%endif
-
-
-# This must be changed to the minimum ABI compat kernel version expected
-%define kver		@@KVER@@
-
-# The minimum -support package required for the kernel bits.
-%define support_ver     2.0.0
-# Minimum oracleasmlib version that supports positive ASM_ERR_NODEV.
-%define min_enodev	2.0.1
-
-Summary: The Oracle Automatic Storage Management library driver.
-Name: oracleasm-%{kver}
-Version: @DIST_VERSION@
-Release: @@PKG_VERSION@@.SLE9
-License: GPL
-Group: System Environment/Kernel
-Source: oracleasm-@DIST_VERSION@.tar.gz
-URL: http://oss.oracle.com/projects/oracleasm/
-Distribution: Oracle
-Vendor: Oracle Corporation
-Packager: Joel Becker <joel.becker@oracle.com>
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-default = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-
-BuildRoot: %{_tmppath}/oracleasm-%{PACKAGE_VERSION}-%{PACKAGE_RELEASE}-root
-
-
-%description
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the default kernel.
-
-%if %{builddefault}
-%package default
-Summary: The Oracle Automatic Storage Management library driver for UP systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-default = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description default
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for the default kernel.
-%endif
-
-
-%if %{buildsmp}
-%package smp
-Summary: The Oracle Automatic Storage Management library driver for SMP systems.
-Group: System Environment/Kernel
-AutoReqProv: no
-Provides: oracleasm = %{version}
-Requires: kernel-smp = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description smp
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for symmetric multiprocessor kernels.
-%endif
-
-
-%if %{buildbigsmp}
-%package bigsmp
-Summary: The Oracle Automatic Storage Management library driver for NUMA systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-bigsmp = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description bigsmp
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for large memory SMP kernels.
-%endif
-
-
-%if %{build64kpagesize}
-%package 64k-pagesize
-Summary: The Oracle Automatic Storage Management library driver for Itanium kernels with a 64KB pagesize.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-64k-pagesize = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description 64k-pagesize
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for Itanium kernels with a 64KB pagesize.
-%endif
-
-
-%if %{buildsn2}
-%package sn2
-Summary: The Oracle Automatic Storage Management library driver for Altix systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-sn2 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description sn2
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for UP Itanium2 kernels.
-%endif
-
-
-%if %{buildiseries64}
-%package iseries64
-Summary: The Oracle Automatic Storage Management library driver for IBM iSeries systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-iseries64 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description iseries64
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM iSeries systems.
-%endif
-
-
-%if %{buildpmac64}
-%package pmac64
-Summary: The Oracle Automatic Storage Management library driver for 64-bit Power Macintosh kernels.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-pmac64 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description pmac64
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for 64-bit Power Macintosh kernels.
-%endif
-
-
-%if %{buildpseries64}
-%package pseries64
-Summary: The Oracle Automatic Storage Management library driver for IBM pSeries systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-pseries64 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description pseries64
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM pSeries systems.
-%endif
-
-
-%if %{builds390}
-%package s390
-Summary: The Oracle Automatic Storage Management library driver for IBM S/390 31-bit systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-s390 = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description s390
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM S/390 31-bit systems.
-%endif
-
-
-%if %{builds390x}
-%package s390x
-Summary: The Oracle Automatic Storage Management library driver for IBM zSeries systems.
-Group: System Environment/Kernel
-Provides: oracleasm = %{version}
-AutoReqProv: no
-Requires: kernel-s390x = %{kver}
-Requires: oracleasm-support >= %{support_ver}
-Conflicts: oracleasmlib < %{min_enodev}
-BuildRequires: kernel-source = %{kver}, kernel-syms = %{kver}
-
-%description s390x
-Kernel driver for the Oracle Automatic Storage Management library.
-This package is compiled for IBM zSeries systems.
-%endif
-
-
-
-%prep
-%setup -n oracleasm-%{version}
-
-
-%build
-
-local_configure()
-{
-	./configure					\
-		--prefix=%{_prefix}			\
-		--exec-prefix=%{_exec_prefix}		\
-		--bindir=%{_bindir}			\
-		--sbindir=%{_sbindir}			\
-		--sysconfdir=%{_sysconfdir}		\
-		--datadir=%{_datadir}			\
-		--includedir=%{_includedir}		\
-		--libdir=%{_libdir}			\
-		--libexecdir=%{_libexecdir}		\
-		--localstatedir=%{_localstatedir}	\
-		--sharedstatedir=%{_sharedstatedir}	\
-		--mandir=%{_mandir}			\
-		--infodir=%{_infodir}			\
-		--with-vendor=sles9			\
-		--with-vendorkernel="$1"
-}
-
-%if %{builddefault}
-local_configure "%{kver}-default"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildsmp}
-local_configure "%{kver}-smp"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildbigsmp}
-local_configure "%{kver}-bigsmp"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{build64kpagesize}
-local_configure "%{kver}-64k-pagesize"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildsn2}
-local_configure "%{kver}-sn2"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildiseries64}
-local_configure "%{kver}-iseries64"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildpmac64}
-local_configure "%{kver}-pmac64"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{buildpseries64}
-local_configure "%{kver}-pseries64"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{builds390}
-local_configure "%{kver}-s390"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-%if %{builds390x}
-local_configure "%{kver}-s390x"
-make QUIET=1
-make DESTDIR="$RPM_BUILD_ROOT" INSTALL_MOD_PATH='$(DESTDIR)' install 
-
-# 2.6 kbuild can't do this install nicely
-EXTRA_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390x/extra"
-INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kver}-s390x/kernel/drivers/addon/oracleasm"
-mkdir -p "${INST_MODLIB}"
-mv "${EXTRA_MODLIB}"/oracleasm.ko "${INST_MODLIB}/"
-
-make clean
-%endif
-
-
-
-%install
-
-
-
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
-
-
-%if %{builddefault}
-%post default
-depmod -ae %{kver}-default
-
-%files default
-%defattr(-,root,root)
-/lib/modules/%{kver}-default/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildsmp}
-%post smp
-depmod -ae %{kver}-smp
-
-%files smp
-%defattr(-,root,root)
-/lib/modules/%{kver}-smp/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildbigsmp}
-%post bigsmp
-depmod -ae %{kver}-bigsmp
-
-%files bigsmp
-%defattr(-,root,root)
-/lib/modules/%{kver}-bigsmp/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{build64kpagesize}
-%post 64k-pagesize
-depmod -ae %{kver}-64k-pagesize
-
-%files 64k-pagesize
-%defattr(-,root,root)
-/lib/modules/%{kver}-64k-pagesize/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildsn2}
-%post sn2
-depmod -ae %{kver}-sn2/
-
-%files sn2
-%defattr(-,root,root)
-/lib/modules/%{kver}-sn2/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildiseries64}
-%post iseries64
-depmod -ae %{kver}-iseries64
-
-%files iseries64
-%defattr(-,root,root)
-/lib/modules/%{kver}-iseries64/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildpmac64}
-%post pmac64
-depmod -ae %{kver}-pmac64
-
-%files pmac64
-%defattr(-,root,root)
-/lib/modules/%{kver}-pmac64/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{buildpseries64}
-%post pseries64
-depmod -ae %{kver}-pseries64
-
-%files pseries64
-%defattr(-,root,root)
-/lib/modules/%{kver}-pseries64/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{builds390}
-%post s390
-depmod -ae %{kver}-s390
-
-%files s390
-%defattr(-,root,root)
-/lib/modules/%{kver}-s390/kernel/drivers/addon/oracleasm
-%endif
-
-
-%if %{builds390x}
-%post s390x
-depmod -ae %{kver}-s390x
-
-%files s390x
-%defattr(-,root,root)
-/lib/modules/%{kver}-s390x/kernel/drivers/addon/oracleasm
-%endif
-
-
-
-%changelog
-* Tue Sep 21 2004 Joel Becker <joel.becker@oracle.com>
-- Make SLES9 specfile.
-
-* Tue Jan 13 2004 Joel Becker <joel.becker@oracle.com>
-- Make kernel-only.
-
-* Thu Nov 20 2003 Joel Becker <joel.becker@oracle.com>
-- Add x86 and ia64 targets.
-
-* Wed Nov 19 2003 Joel Becker <joel.becker@oracle.com>
-- Make the UL SP3 changes.
-
-* Wed Nov 12 2003 Joel Becker <joel.becker@oracle.com>
-- Start the ASM rename.
-
-* Thu Oct 30 2003 Joel Becker <joel.becker@oracle.com>
-- Created EL3 version
-
-* Mon Jun 23 2003 Joel Becker <joel.becker@oracle.com>
-- Added osm-lib bits
-
-* Fri Jun 20 2003 Joel Becker <joel.becker@oracle.com>
-- Initial RPM
-
