summaryrefslogtreecommitdiff
path: root/net/aoe/files/patch-aoecmd.c
diff options
context:
space:
mode:
authorMax Khon <fjoe@FreeBSD.org>2010-09-14 13:30:54 +0000
committerMax Khon <fjoe@FreeBSD.org>2010-09-14 13:30:54 +0000
commitd35ce612b151dc1c7689bd42b55904af2803cf27 (patch)
treeff7b77aa504769ef1897189e67a7de948acee809 /net/aoe/files/patch-aoecmd.c
parentDEPRECATE it and set EXPIRATION_DATE to 1 month, it depends of p5-P4-Client, (diff)
New port: FreeBSD driver for ATA over Ethernet (AoE)
Port author is Stacey D. Son. Two additional patches are added: - a patch to fix build on FreeBSD 7 and later [1] - a patch to fix device detection >2TB [2] Submitted by: pluknet [1], fjoe [2] Tested by: George Mamalakis
Diffstat (limited to 'net/aoe/files/patch-aoecmd.c')
-rw-r--r--net/aoe/files/patch-aoecmd.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/net/aoe/files/patch-aoecmd.c b/net/aoe/files/patch-aoecmd.c
new file mode 100644
index 000000000000..6868561e5ffb
--- /dev/null
+++ b/net/aoe/files/patch-aoecmd.c
@@ -0,0 +1,57 @@
+--- aoecmd.c.orig 2006-05-26 00:13:09.000000000 +0700
++++ aoecmd.c 2010-09-13 20:15:55.000000000 +0700
+@@ -44,6 +44,7 @@
+ #include <sys/mutex.h>
+ #include <sys/mbuf.h>
+ #include <sys/sysctl.h>
++#include <sys/endian.h>
+
+ #include <dev/aoe/aoe.h>
+
+@@ -427,29 +428,6 @@
+ goto loop;
+ }
+
+-static u_short
+-lhget16(u_char *p)
+-{
+- u_short n;
+-
+- n = p[1];
+- n <<= 8;
+- n |= p[0];
+- return (n);
+-}
+-
+-static u_long
+-lhget32(u_char *p)
+-{
+- u_long n;
+-
+- n = lhget16(p+2);
+- n <<= 16;
+- n |= lhget16(p);
+- return (n);
+-}
+-
+-
+ static void
+ ataid_complete(struct aoedev *d, char *id)
+ {
+@@ -457,13 +435,13 @@
+
+ memcpy(d->ad_ident, id, sizeof d->ad_ident);
+
+- n = lhget16(id + (83<<1)); /* Command set supported. */
++ n = le16toh(*(uint16_t *) (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 = le64toh(*(uint64_t *) (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. */
++ d->ad_nsectors = le32toh(*(uint32_t *) (id + (60<<1))); /* n lba28 sectors. */
+ }
+ if (aoeblk_register(d) != 0)
+ IPRINTK("could not register disk\n");