This will let userland specify where the disks we want to talk to are
located.

Index: softraidvar.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/softraidvar.h,v
retrieving revision 1.104
diff -u -p -r1.104 softraidvar.h
--- softraidvar.h       6 Jul 2011 17:32:47 -0000       1.104
+++ softraidvar.h       6 Jul 2011 22:48:07 -0000
@@ -240,6 +240,14 @@ struct sr_crypto_kdfpair {
        u_int32_t       kdfsize2;
 };
 
+struct sr_aoe_config {
+       char nic[16];
+       unsigned char dsteaddr[6];
+       unsigned char slot;
+       unsigned short shelf;
+};
+
+
 #ifdef _KERNEL
 #include <dev/biovar.h>
 
Index: softraid_aoe.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/softraid_aoe.c,v
retrieving revision 1.22
diff -u -p -r1.22 softraid_aoe.c
--- softraid_aoe.c      4 Jul 2011 04:49:05 -0000       1.22
+++ softraid_aoe.c      6 Jul 2011 22:57:27 -0000
@@ -153,11 +153,8 @@ sr_aoe_assemble(struct sr_discipline *sd
 {
        struct ifnet            *ifp;
        struct aoe_handler      *ah;
-       unsigned char           slot;
-       unsigned short          shelf;
-       const char              *nic;
-       const char              *dsteaddr;
-       int                     s;
+       struct sr_aoe_config    sri;
+       int                     rv, s;
 #if 0
        struct mbuf *m;
        struct ether_header *eh;
@@ -165,24 +162,24 @@ sr_aoe_assemble(struct sr_discipline *sd
        int rv;
 #endif
 
+       if (!(bc->bc_opaque_flags & BIOC_SOIN))
+               return (EINVAL);
+       if (bc->bc_opaque_size != sizeof(sri))
+               return (EINVAL);
+       if ((rv = copyin(bc->bc_opaque, &sri, sizeof(sri))))
+           return (rv);
+       sri.nic[sizeof(sri.nic) - 1] = 0;
 
        sd->sd_max_ccb_per_wu = sd->sd_meta->ssdi.ssd_chunk_no;
 
-       /* where do these come from */
-       slot = 3;
-       shelf = 4;
-       nic = "ne0";
-       dsteaddr = dsteaddr;
-
-       ifp = ifunit(nic);
+       ifp = ifunit(sri.nic);
        if (!ifp)
                return (EINVAL);
-       shelf = htons(shelf);
 
        ah = malloc(sizeof(*ah), M_DEVBUF, M_WAITOK | M_ZERO);
        ah->ifp = ifp;
-       ah->major = shelf;
-       ah->minor = slot;
+       ah->major = sri.shelf;
+       ah->minor = sri.slot;
        ah->fn = (workq_fn)sr_aoe_input;
        TAILQ_INIT(&ah->reqs);
 
@@ -191,7 +188,7 @@ sr_aoe_assemble(struct sr_discipline *sd
        splx(s);
 
        sd->mds.mdd_aoe.sra_ah = ah;
-       memcpy(sd->mds.mdd_aoe.sra_eaddr, dsteaddr, 6);
+       memcpy(sd->mds.mdd_aoe.sra_eaddr, sri.dsteaddr, 6);
 
 #if 0
        MGETHDR(m, M_WAIT, MT_HEADER);
@@ -203,8 +200,8 @@ sr_aoe_assemble(struct sr_discipline *sd
        ap->vers = 1;
        ap->flags = 0;
        ap->error = 0;
-       ap->major = shelf;
-       ap->minor = slot;
+       ap->major = sri.shelf;
+       ap->minor = sri.slot;
        ap->command = 1;
        ap->tag = 0;
        ap->buffercnt = 0;

Reply via email to