Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Feb 2009 16:52:08 +0100 (CET)
From:      cyril.elkaim@free.fr
To:        freebsd drivers <freebsd-drivers@freebsd.org>
Subject:   patch aoe for freebsd 7
Message-ID:  <124214240.637761234194728394.JavaMail.root@zimbra10-e2.priv.proxad.net>
In-Reply-To: <1306049302.637521234194665378.JavaMail.root@zimbra10-e2.priv.proxad.net>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Hello there,

Here you'll find an attached patch to compile the coraid aoe driver with freebsd 7. I'm not able to validate this driver myself, so if somebody can test it I will be very grateful.

thanks,
Cyril Elkaim
[-- Attachment #2 --]
diff -u dev/aoe/Makefile aoe7/Makefile
--- dev/aoe/Makefile	2006-05-24 21:48:07.000000000 +0200
+++ aoe7/Makefile	2009-02-09 15:43:18.000000000 +0100
@@ -3,5 +3,6 @@
 KMOD=	aoe
 SRCS=	aoecmd.c aoedev.c aoenet.c aoeblk.c aoemain.c
 CFLAGS+= -DFORCE_NETWORK_HOOK -I../..
+EXPORT_SYMS= YES
 
 .include <bsd.kmod.mk>
diff -u dev/aoe/aoeblk.c aoe7/aoeblk.c
--- dev/aoe/aoeblk.c	2006-05-25 19:19:23.000000000 +0200
+++ aoe7/aoeblk.c	2009-02-09 14:46:41.000000000 +0100
@@ -27,6 +27,8 @@
  *
  * $FreeBSD: src/sys/dev/aoe/aoeblk.c,v 1.23.2.5 2004/09/22 16:50:41 ?? Exp $
  */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/dev/aoe/aoeblk.c,v 1.23.2.5 2004/09/22 16:50:41 ?? Exp $");
 
 /*
  * aoeblk.c
diff -u dev/aoe/aoecmd.c aoe7/aoecmd.c
--- dev/aoe/aoecmd.c	2006-05-25 19:13:09.000000000 +0200
+++ aoe7/aoecmd.c	2009-02-09 13:00:16.000000000 +0100
@@ -449,6 +449,17 @@
         return (n);
 }
 
+static u_long
+lhget48(u_char *p)
+{
+        u_long n;
+
+        n = lhget32(p+2);
+        n <<= 16;
+        n |= lhget16(p);
+        return (n);
+}
+
 
 static void
 ataid_complete(struct aoedev *d, char *id)
@@ -460,7 +471,7 @@
 	n = lhget16(id + (83<<1));		/* Command set supported. */
 	if (n & (1<<10)) {			/* Lba48 */
 		atomic_set_32(&d->ad_flags, DEVFL_EXT);
-		d->ad_nsectors = lhget32(id + (100<<1));	/* n lba48 sectors. */
+		d->ad_nsectors = lhget48(id + (100<<1));	/* n lba48 sectors. */
 	} else {
 		atomic_clear_32(&d->ad_flags, DEVFL_EXT);
 		d->ad_nsectors = lhget32(id + (60<<1));	/* n lba28 sectors. */
diff -u dev/aoe/aoenet.c aoe7/aoenet.c
--- dev/aoe/aoenet.c	2006-05-25 18:10:11.000000000 +0200
+++ aoe7/aoenet.c	2009-02-09 15:38:05.000000000 +0100
@@ -48,6 +48,8 @@
 #include <net/if_var.h>
 #include <net/if_types.h>
 #include <net/if_arp.h>
+#include <net/if_dl.h>
+#include <net/if_var.h>
 #include <net/netisr.h>
 
 #include <dev/aoe/aoe.h>
@@ -77,8 +79,10 @@
 #define NECODES (sizeof(aoe_errlist) /  sizeof(char *) - 1)
 #if (__FreeBSD_version < 600000)
 #define IFPADDR(ifp) (((struct arpcom *) (ifp))->ac_enaddr)
+#elif (__FreeBSD_version < 700000)
+#define IFPADDR(ifp) IFP2ENADDR(ifp)
 #else
-#define IFPADDR(ifp) IFP2ENADDR(ifp) 
+#define IFPADDR(ifp) IF_LLADDR(ifp)
 #endif
 #define IFLISTSZ 1024
 
@@ -96,7 +100,7 @@
 #include <sys/limits.h>
 #define IDX(c)  ((u_char)(c) / LONG_BIT)
 #define BIT(c)  ((u_long)1 << ((u_char)(c) % LONG_BIT))
- 
+  
 static size_t
 strspn(const char *s, const char *charset)
 {
@@ -275,7 +279,7 @@
 	TAILQ_FOREACH(ifp, &ifnet, if_link) {
 		if (!is_aoe_netif(ifp))
 			continue;
-		memcpy(h->ah_src, IFPADDR(ifp), sizeof(h->ah_src));
+		memcpy(h->ah_src, (u_char *)IFPADDR(ifp), sizeof(h->ah_src));
 		m = m_copypacket(m0, M_DONTWAIT);
 		if (m == NULL) {
 			IPRINTK("m_copypacket failure\n");
@@ -291,7 +295,7 @@
 u_char *
 aoenet_enaddr(struct ifnet *ifp)
 {
-	return (IFPADDR(ifp));
+  return (u_char *)(IFPADDR(ifp));
 }
 
 u_int
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?124214240.637761234194728394.JavaMail.root>