svn commit: r208906 - in projects/ofed/head/sys/ofed/include: asm linux net

Jeff Roberson jeff at FreeBSD.org
Tue Jun 8 07:49:03 UTC 2010


Author: jeff
Date: Tue Jun  8 07:49:02 2010
New Revision: 208906
URL: http://svn.freebsd.org/changeset/base/208906

Log:
  Import initial linux KPI compat code inspired by Luigi's kmod compat port.
  
   - Define linux bits using the same headers as linux uses for maximum
     include compatibility.  The same include nesting is used where possible.
   - Some files are empty as nothing from them was required to build ofed.
   - Some implementations are still stubs (file, device, idr, dma-mapping).
  
  Sponsored by:   Isilon Systems, iX Systems, and Panasas.

Added:
  projects/ofed/head/sys/ofed/include/asm/
  projects/ofed/head/sys/ofed/include/asm/atomic-long.h
  projects/ofed/head/sys/ofed/include/asm/atomic.h
  projects/ofed/head/sys/ofed/include/asm/byteorder.h
  projects/ofed/head/sys/ofed/include/asm/current.h
  projects/ofed/head/sys/ofed/include/asm/fcntl.h
  projects/ofed/head/sys/ofed/include/asm/semaphore.h
  projects/ofed/head/sys/ofed/include/asm/system.h
  projects/ofed/head/sys/ofed/include/asm/types.h
  projects/ofed/head/sys/ofed/include/asm/uaccess.h
  projects/ofed/head/sys/ofed/include/linux/bitmap.h
  projects/ofed/head/sys/ofed/include/linux/bitops.h
  projects/ofed/head/sys/ofed/include/linux/cdev.h
  projects/ofed/head/sys/ofed/include/linux/compat.h
  projects/ofed/head/sys/ofed/include/linux/compiler.h
  projects/ofed/head/sys/ofed/include/linux/completion.h
  projects/ofed/head/sys/ofed/include/linux/ctype.h
  projects/ofed/head/sys/ofed/include/linux/device.h
  projects/ofed/head/sys/ofed/include/linux/dma-attrs.h
  projects/ofed/head/sys/ofed/include/linux/dma-mapping.h
  projects/ofed/head/sys/ofed/include/linux/err.h
  projects/ofed/head/sys/ofed/include/linux/errno.h
  projects/ofed/head/sys/ofed/include/linux/ethtool.h
  projects/ofed/head/sys/ofed/include/linux/file.h
  projects/ofed/head/sys/ofed/include/linux/fs.h
  projects/ofed/head/sys/ofed/include/linux/gfp.h
  projects/ofed/head/sys/ofed/include/linux/idr.h
  projects/ofed/head/sys/ofed/include/linux/if_arp.h
  projects/ofed/head/sys/ofed/include/linux/if_ether.h
  projects/ofed/head/sys/ofed/include/linux/if_vlan.h
  projects/ofed/head/sys/ofed/include/linux/in.h
  projects/ofed/head/sys/ofed/include/linux/in6.h
  projects/ofed/head/sys/ofed/include/linux/inetdevice.h
  projects/ofed/head/sys/ofed/include/linux/init.h
  projects/ofed/head/sys/ofed/include/linux/interrupt.h
  projects/ofed/head/sys/ofed/include/linux/ioctl.h
  projects/ofed/head/sys/ofed/include/linux/jhash.h
  projects/ofed/head/sys/ofed/include/linux/jiffies.h
  projects/ofed/head/sys/ofed/include/linux/kdev_t.h
  projects/ofed/head/sys/ofed/include/linux/kernel.h
  projects/ofed/head/sys/ofed/include/linux/kobject.h
  projects/ofed/head/sys/ofed/include/linux/kref.h
  projects/ofed/head/sys/ofed/include/linux/kthread.h
  projects/ofed/head/sys/ofed/include/linux/list.h
  projects/ofed/head/sys/ofed/include/linux/lockdep.h
  projects/ofed/head/sys/ofed/include/linux/miscdevice.h
  projects/ofed/head/sys/ofed/include/linux/mm.h
  projects/ofed/head/sys/ofed/include/linux/module.h
  projects/ofed/head/sys/ofed/include/linux/moduleparam.h
  projects/ofed/head/sys/ofed/include/linux/mount.h
  projects/ofed/head/sys/ofed/include/linux/mutex.h
  projects/ofed/head/sys/ofed/include/linux/netdevice.h
  projects/ofed/head/sys/ofed/include/linux/page.h
  projects/ofed/head/sys/ofed/include/linux/pci.h
  projects/ofed/head/sys/ofed/include/linux/poll.h
  projects/ofed/head/sys/ofed/include/linux/random.h
  projects/ofed/head/sys/ofed/include/linux/rbtree.h
  projects/ofed/head/sys/ofed/include/linux/rwlock.h
  projects/ofed/head/sys/ofed/include/linux/rwsem.h
  projects/ofed/head/sys/ofed/include/linux/scatterlist.h
  projects/ofed/head/sys/ofed/include/linux/sched.h
  projects/ofed/head/sys/ofed/include/linux/semaphore.h
  projects/ofed/head/sys/ofed/include/linux/slab.h
  projects/ofed/head/sys/ofed/include/linux/socket.h
  projects/ofed/head/sys/ofed/include/linux/spinlock.h
  projects/ofed/head/sys/ofed/include/linux/stddef.h
  projects/ofed/head/sys/ofed/include/linux/string.h
  projects/ofed/head/sys/ofed/include/linux/sysfs.h
  projects/ofed/head/sys/ofed/include/linux/timer.h
  projects/ofed/head/sys/ofed/include/linux/types.h
  projects/ofed/head/sys/ofed/include/linux/uaccess.h
  projects/ofed/head/sys/ofed/include/linux/wait.h
  projects/ofed/head/sys/ofed/include/linux/workqueue.h
  projects/ofed/head/sys/ofed/include/net/
  projects/ofed/head/sys/ofed/include/net/addrconf.h
  projects/ofed/head/sys/ofed/include/net/arp.h
  projects/ofed/head/sys/ofed/include/net/ip6_route.h
  projects/ofed/head/sys/ofed/include/net/ipv6.h
  projects/ofed/head/sys/ofed/include/net/neighbour.h
  projects/ofed/head/sys/ofed/include/net/netevent.h
  projects/ofed/head/sys/ofed/include/net/route.h
  projects/ofed/head/sys/ofed/include/net/tcp.h

Added: projects/ofed/head/sys/ofed/include/asm/atomic-long.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/atomic-long.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,79 @@
+*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef	_ATOMIC_LONG_H_
+#define	_ATOMIC_LONG_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/atomic.h>
+
+typedef struct {
+	volatile u_long counter;
+} atomic_long_t;
+
+#define	atomic_long_add(i, v)		atomic_long_add_return((i), (v))
+#define	atomic_long_inc_return(v)	atomic_long_add_return(1, (v))
+
+static inline u_long
+atomic_long_add_return(long i, atomic_long_t *v)
+{
+	return i + atomic_fetchadd_long(&v->counter, i);
+}
+
+static inline void
+atomic_long_set(atomic_long_t *v, long i)
+{
+	atomic_set_long(&v->counter, i);
+}
+
+static inline long
+atomic_long_read(atomic_long_t *v)
+{
+	return atomic_load_acq_long(&v->counter);
+}
+
+static inline long
+atomic_long_inc(atomic_long_t *v)
+{
+	return atomic_fetchadd_long(&v->counter, 1) + 1;
+}
+
+static inline long
+atomic_long_dec(atomic_long_t *v)
+{
+	return atomic_fetchadd_long(&v->counter, -1) - 1;
+}
+
+static inline__ long
+atomic_long_dec_and_test(atomic_long_t *v)
+{
+	long i = atomic_long_add(-1, v);
+	return i == 0 ;
+}
+
+#endif	/* _ATOMIC_LONG_H_ */

Added: projects/ofed/head/sys/ofed/include/asm/atomic.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/atomic.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,85 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef	_ASM_ATOMIC_H_
+#define	_ASM_ATOMIC_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/atomic.h>
+#include <asm/atomic-long.h>
+
+typedef struct {
+	volatile u_int counter;
+} atomic_t;
+
+#define	atomic_add(i, v)		atomic_add_return((i), (v))
+#define	atomic_sub(i, v)		atomic_sub_return((i), (v))
+#define	atomic_inc_return(v)		atomic_add_return(1, (v))
+#define	atomic_add_negative(i, v)	(atomic_add_return((i), (v)) < 0)
+#define	atomic_sub_and_test(i, v)	(atomic_sub_return((i), (v)) == 0)
+#define	atomic_dec_and_test(v)		(atomic_sub_return(1, (v)) == 0)
+#define	atomic_inc_and_test(v)		(atomic_add_return(1, (v)) == 0)
+
+static inline u_int
+atomic_add_return(int i, atomic_t *v)
+{
+	return i + atomic_fetchadd_int(&v->counter, i);
+}
+
+static inline u_int
+atomic_sub_return(int i, atomic_t *v)
+{
+	return atomic_fetchadd_int(&v->counter, -i) - i;
+}
+
+static inline void
+atomic_set(atomic_t *v, int i)
+{
+	atomic_set_int(&v->counter, i);
+}
+
+static inline int
+atomic_read(atomic_t *v)
+{
+	return atomic_load_acq_int(&v->counter);
+}
+
+static inline int
+atomic_inc(atomic_t *v)
+{
+	return atomic_fetchadd_int(&v->counter, 1) + 1;
+}
+
+static inline int
+atomic_dec(atomic_t *v)
+{
+	return atomic_fetchadd_int(&v->counter, -1) - 1;
+}
+
+#endif	/* _ASM_ATOMIC_H_ */

Added: projects/ofed/head/sys/ofed/include/asm/byteorder.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/byteorder.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef	_ASM_BYTEORDER_H_
+#define	_ASM_BYTEORDER_H_
+
+#include <sys/types.h>
+#include <sys/endian.h>
+
+#define	cpu_to_le64	htole64
+#define	le64_to_cpu	le64toh
+#define	cpu_to_le32	htole32
+#define	le32_to_cpu	le32toh
+#define	cpu_to_le16	htole16
+#define	le16_to_cpu	le16toh
+#define	cpu_to_be64	htobe64
+#define	be64_to_cpu	be64toh
+#define	cpu_to_be32	htobe32
+#define	be32_to_cpu	be32toh
+#define	cpu_to_be16	htobe16
+#define	be16_to_cpu	be16toh
+#define	__be16_to_cpu	be16toh
+
+#define	cpu_to_le64p(x)	htole64(*(x))
+#define	le64_to_cpup(x)	le64toh(*(x))
+#define	cpu_to_le32p(x)	htole32(*(x))
+#define	le32_to_cpup(x)	le32toh(*(x))
+#define	cpu_to_le16p(x)	htole16(*(x))
+#define	le16_to_cpup(x)	le16toh(*(x))
+#define	cpu_to_be64p(x)	htobe64(*(x))
+#define	be64_to_cpup(x)	be64toh(*(x))
+#define	cpu_to_be32p(x)	htobe32(*(x))
+#define	be32_to_cpup(x)	be32toh(*(x))
+#define	cpu_to_be16p(x)	htobe16(*(x))
+#define	be16_to_cpup(x)	be16toh(*(x))
+
+#define	cpu_to_le64s(x)	do { *(x) = cpu_to_le64p((x)) } while (0)
+#define	le64_to_cpus(x)	do { *(x) = le64_to_cpup((x)) } while (0)
+#define	cpu_to_le32s(x)	do { *(x) = cpu_to_le32p((x)) } while (0)
+#define	le32_to_cpus(x)	do { *(x) = le32_to_cpup((x)) } while (0)
+#define	cpu_to_le16s(x)	do { *(x) = cpu_to_le16p((x)) } while (0)
+#define	le16_to_cpus(x)	do { *(x) = le16_to_cpup((x)) } while (0)
+#define	cpu_to_be64s(x)	do { *(x) = cpu_to_be64p((x)) } while (0)
+#define	be64_to_cpus(x)	do { *(x) = be64_to_cpup((x)) } while (0)
+#define	cpu_to_be32s(x)	do { *(x) = cpu_to_be32p((x)) } while (0)
+#define	be32_to_cpus(x)	do { *(x) = be32_to_cpup((x)) } while (0)
+#define	cpu_to_be16s(x)	do { *(x) = cpu_to_be16p((x)) } while (0)
+#define	be16_to_cpus(x)	do { *(x) = be16_to_cpup((x)) } while (0)
+
+#endif	/* _ASM_BYTEORDER_H_ */

Added: projects/ofed/head/sys/ofed/include/asm/current.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/current.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef	_ASM_CURRENT_H_
+#define	_ASM_CURRENT_H_
+
+#endif	/* _ASM_CURRENT_H_ */

Added: projects/ofed/head/sys/ofed/include/asm/fcntl.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/fcntl.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef _ASM_FCNTL_H_
+#define	_ASM_FCNTL_H_
+
+#include <sys/fcntl.h>
+
+#endif	/* _ASM_FCNTL_H_ */

Added: projects/ofed/head/sys/ofed/include/asm/semaphore.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/semaphore.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef	_ASM_SEMAPHORE_H_
+#define	_ASM_SEMAPHORE_H_
+
+#include <linux/semaphore.h>
+
+#endif	/* _ASM_SEMAPHORE_H_ */

Added: projects/ofed/head/sys/ofed/include/asm/system.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/system.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,27 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */

Added: projects/ofed/head/sys/ofed/include/asm/types.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/types.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef	_ASM_TYPES_H_
+#define	_ASM_TYPES_H_
+
+typedef unsigned short umode_t;
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) // && !defined(__STRICT_ANSI__)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+#ifdef _KERNEL
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+
+/* DMA addresses come in generic and 64-bit flavours.  */
+typedef vm_paddr_t dma_addr_t;
+typedef vm_paddr_t dma64_addr_t;
+
+#endif	/* _KERNEL */
+
+#endif	/* _ASM_TYPES_H_ */

Added: projects/ofed/head/sys/ofed/include/asm/uaccess.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/asm/uaccess.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef _LINUX_UACCESS_H_
+#define _LINUX_UACCESS_H_
+
+#include <linux/uaccess.h>
+
+long copy_from_user(void *to, const void __user * from, unsigned long n);
+long copy_to_user(void __user *to, const void *from, unsigned long n);
+
+#endif	/* _LINUX_UACCESS_H_ */

Added: projects/ofed/head/sys/ofed/include/linux/bitmap.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/bitmap.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef	_LINUX_BITMAP_H_
+#define	_LINUX_BITMAP_H_
+
+#include <linux/bitops.h>
+#include <linux/string.h>
+
+#endif	/* _LINUX_BITMAP_H_ */

Added: projects/ofed/head/sys/ofed/include/linux/bitops.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/bitops.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,151 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef	_LINUX_BITOPS_H_
+#define	_LINUX_BITOPS_H_
+
+#define	BITS_PER_LONG		(sizeof(long) * 8)
+#define	BIT_MASK(n)		(~0UL >> (BITS_PER_LONG - (n)))
+#define	BITS_TO_LONGS(n)	roundup2((n), BITS_PER_LONG)
+
+static inline unsigned long
+find_first_bit(unsigned long *addr, unsigned long size)
+{
+	int mask;
+	int bit;
+
+	for (bit = 0; size >= BITS_PER_LONG;
+	    size -= BITS_PER_LONG, bit += BITS_PER_LONG, addr++) {
+		if (*addr == 0)
+			continue;
+		return (bit + ffs(*addr));
+	}
+	if (size) {
+		mask = (*addr) & BIT_MASK(size);
+		if (mask)
+			bit += ffsl(mask);
+		else
+			bit += size;
+	}
+	return (bit);
+}
+
+static inline unsigned long
+find_first_zero_bit(unsigned long *addr, unsigned long size)
+{
+	int mask;
+	int bit;
+
+	for (bit = 0; size >= BITS_PER_LONG;
+	    size -= BITS_PER_LONG, bit += BITS_PER_LONG, addr++) {
+		if (~(*addr) == 0)
+			continue;
+		return (bit + ffs(~(*addr)));
+	}
+	if (size) {
+		mask = ~(*addr) & BIT_MASK(size);
+		if (mask)
+			bit += ffsl(mask);
+		else
+			bit += size;
+	}
+	return (bit);
+}
+
+static inline unsigned long
+find_last_bit(unsigned long *addr, unsigned long size)
+{
+	int mask;
+	int offs;
+	int bit;
+	int pos;
+
+	pos = size / BITS_PER_LONG;
+	offs = size % BITS_PER_LONG;
+	bit = BITS_PER_LONG * pos;
+	addr += pos;
+	if (offs) {
+		mask = (*addr) & BIT_MASK(offs);
+		if (mask)
+			return (bit + flsl(mask));
+	}
+	while (--pos) {
+		addr--;
+		bit -= BITS_PER_LONG;
+		if (*addr)
+			return (bit + flsl(mask));
+	}
+	return (size);
+}
+
+static inline unsigned long
+find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
+{
+	int mask;
+	int offs;
+	int bit;
+	int pos;
+
+	pos = offset / BITS_PER_LONG;
+	offs = size % BITS_PER_LONG;
+	bit = BITS_PER_LONG * pos;
+	addr += pos;
+	if (offs) {
+		mask = (*addr) & ~BIT_MASK(offs);
+		if (mask)
+			return (bit + ffsl(mask));
+		bit += BITS_PER_LONG;
+		addr++;
+	}
+	for (size -= bit; size >= BITS_PER_LONG;
+	    size -= BITS_PER_LONG, bit += BITS_PER_LONG, addr++) {
+		if (*addr == 0)
+			continue;
+		return (bit + ffs(*addr));
+	}
+	if (size) {
+		mask = (*addr) & BIT_MASK(size);
+		if (mask)
+			bit += ffsl(mask);
+		else
+			bit += size;
+	}
+	return (bit);
+}
+
+#define	NBINT	(NBBY * sizeof(int))
+
+#define	set_bit(i, a)							\
+    atomic_set_int((volatile int *)(a)[(i)/NBINT], (i) % NBINT)
+
+#define	clear_bit(i, a)							\
+    atomic_clear_int((volatile int *)(a)[(i)/NBINT], (i) % NBINT)
+
+#define	test_bit(i, a)							\
+    !!(atomic_load_acq_int((volatile int *)(a)[(i)/NBINT]) & 1 << ((i) % NBINT))
+
+#endif	/* _LINUX_BITOPS_H_ */

Added: projects/ofed/head/sys/ofed/include/linux/cdev.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/cdev.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef	_LINUX_CDEV_H_
+#define	_LINUX_CDEV_H_
+
+#include <linux/kobject.h>
+#include <linux/kdev_t.h>
+#include <linux/list.h>
+
+#define	cdev	linux_cdev
+
+struct file_operations;
+struct inode;
+struct module;
+
+struct cdev {
+	struct kobject	kobj;
+	struct module	*owner;
+	dev_t		dev;
+	const struct file_operations *ops;
+};
+
+void	cdev_init(struct cdev *, const struct file_operations *);
+struct	cdev *cdev_alloc(void);
+void	cdev_put(struct cdev *p);
+int	cdev_add(struct cdev *, dev_t, unsigned);
+void	cdev_del(struct cdev *);
+
+#endif	/* _LINUX_CDEV_H_ */

Added: projects/ofed/head/sys/ofed/include/linux/compat.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/compat.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef	_LINUX_COMPAT_H_
+#define	_LINUX_COMPAT_H_
+
+
+#endif	/* _LINUX_COMPAT_H_ */

Added: projects/ofed/head/sys/ofed/include/linux/compiler.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/compiler.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef	_LINUX_COMPILER_H_
+#define	_LINUX_COMPILER_H_
+
+#define __user
+#define __kernel
+#define __safe
+#define __force
+#define __nocast
+#define __iomem
+#define __chk_user_ptr(x)		0
+#define __chk_io_ptr(x)			0
+#define __builtin_warning(x, y...)	(1)
+#define __acquires(x)
+#define __releases(x)
+#define __acquire(x)			0
+#define __release(x)			0
+#define __cond_lock(x,c)		(c)
+#define	__bitwise
+#define __devinitdata
+#define __init
+#define __exit
+#define	__stringify(x)			#x
+#define	__attribute_const__		__attribute__((__const__))
+
+#define	likely(x)			__builtin_expect(!!(x), 1)
+#define	unlikely(x)			__builtin_expect(!!(x), 0)
+#define typeof(x)			__typeof(x)
+
+#endif	/* _LINUX_COMPILER_H_ */

Added: projects/ofed/head/sys/ofed/include/linux/completion.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/include/linux/completion.h	Tue Jun  8 07:49:02 2010	(r208906)
@@ -0,0 +1,158 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+#ifndef	_LINUX_COMPLETION_H_
+#define	_LINUX_COMPLETION_H_
+
+#include <linux/errno.h>
+#include <linux/sched.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/sleepqueue.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+
+struct completion {
+	unsigned int done;
+};
+
+#define	INIT_COMPLETION(c)	((c).done = 0)
+#define	init_completion(c)	((c)->done = 0)
+
+static inline void
+_complete_common(struct completion *c, int all)
+{
+	int wakeup_swapper;
+
+	sleepq_lock(c);
+	c->done++;
+	if (all)
+		wakeup_swapper = sleepq_broadcast(c, SLEEPQ_SLEEP, 0, 0);
+	else
+		wakeup_swapper = sleepq_signal(c, SLEEPQ_SLEEP, 0, 0);
+	sleepq_release(c);
+	if (wakeup_swapper)
+		kick_proc0();
+}
+
+#define	complete(c)	_complete_common(c, 0)
+#define	complete_all(c)	_complete_common(c, 1)
+
+/*
+ * Indefinite wait for done != 0 with or without signals.
+ */
+static inline long
+_wait_for_common(struct completion *c, int flags)
+{
+
+	flags |= SLEEPQ_SLEEP;
+	for (;;) {
+		sleepq_lock(c);
+		if (c->done) {
+			sleepq_release(c);
+			break;
+		}
+		sleepq_add(c, NULL, "completion", flags, 0);
+		if (flags & SLEEPQ_INTERRUPTIBLE) {
+			if (sleepq_wait_sig(c, 0) != 0)
+				return (-ERESTARTSYS);
+		} else
+			sleepq_wait(c, 0);
+	}
+	c->done--;
+	sleepq_release(c);
+
+	return (0);
+}
+
+#define	wait_for_completion(c)	_wait_for_common(c, 0)
+#define	wait_for_completion_interuptible(c)				\
+	_wait_for_common(c, SLEEPQ_INTERRUPTIBLE)
+
+static inline long
+_wait_for_timeout_common(struct completion *c, long timeout, int flags)
+{
+	long end;
+
+	end = ticks + timeout;
+	flags |= SLEEPQ_SLEEP;
+	for (;;) {
+		sleepq_lock(c);
+		if (c->done) {
+			sleepq_release(c);
+			break;
+		}
+		sleepq_add(c, NULL, "completion", flags, 0);
+		sleepq_set_timeout(c, end - ticks);
+		if (flags & SLEEPQ_INTERRUPTIBLE) {
+			if (sleepq_timedwait_sig(c, 0) != 0)
+				return (-ERESTARTSYS);
+		} else
+			sleepq_timedwait(c, 0);
+	}
+	c->done--;
+	sleepq_release(c);
+	timeout = end - ticks;
+
+	return (timeout > 0 ? timeout : 1);
+}
+
+#define	wait_for_completion_timeout(c, timeout)				\
+	_wait_for_timeout_common(c, timeout, 0)
+#define	wait_for_completion_interruptible_timeout(c, timeout)		\
+	_wait_for_timeout_common(c, timeout, SLEEPQ_INTERRUPTIBLE)
+
+static inline int
+try_wait_for_completion(struct completion *c)
+{
+	int isdone;
+
+	isdone = 1;
+	sleepq_lock(c);
+	if (c->done)
+		c->done--;
+	else
+		isdone = 0;
+	sleepq_release(c);
+	return (isdone);
+}
+
+static inline int
+completion_done(struct completion *c)
+{
+	int isdone;
+
+	isdone = 1;
+	sleepq_lock(c);
+	if (c->done == 0)
+		isdone = 0;
+	sleepq_release(c);
+	return (isdone);
+}
+
+#endif	/* _LINUX_COMPLETION_H_ */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list