summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-12-19 02:37:40 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-12-19 02:37:40 +0100
commit9df9a3625ced6ec4f8c2f159903e4d0309bedb12 (patch)
treea17e0581c2e9bbfc038dbc967df257a9af0a1e13
parent2d06aac2abbd22757b6aa33b4fdc0c9ead4b7d50 (diff)
sdaoe: allow aoedev= shorthand for id!lun -> id!#æ/aoe/lun
we cannot type æ character in the bootloader console, so allow the shorthand syntax id!lun which gets translated to id!#æ/aoe/lun.
-rw-r--r--sys/man/3/sdaoe2
-rw-r--r--sys/src/9/port/sdaoe.c34
2 files changed, 20 insertions, 16 deletions
diff --git a/sys/man/3/sdaoe b/sys/man/3/sdaoe
index 62677497b..d0470fb4e 100644
--- a/sys/man/3/sdaoe
+++ b/sys/man/3/sdaoe
@@ -68,7 +68,7 @@ over Ethernet interfaces 0 and 1,
.IP
.EX
aoeif=ether0 ether1
-aoedev=e!#æ/aoe/42.0
+aoedev=e!42.0
.EE
.SH SOURCE
.B /sys/src/9/port/sdaoe.c
diff --git a/sys/src/9/port/sdaoe.c b/sys/src/9/port/sdaoe.c
index 90259705d..7c3c7bf67 100644
--- a/sys/src/9/port/sdaoe.c
+++ b/sys/src/9/port/sdaoe.c
@@ -249,19 +249,6 @@ static char *probef[32];
static char *probebuf;
static int nprobe;
-static int
-pnpprobeid(char *s)
-{
- int id;
-
- if(strlen(s) < 2)
- return 0;
- id = 'e';
- if(s[1] == '!')
- id = s[0];
- return id;
-}
-
static SDev*
aoepnp(void)
{
@@ -275,9 +262,26 @@ aoepnp(void)
nprobe = tokenize(probebuf, probef, nelem(probef));
h = t = 0;
for(i = 0; i < nprobe; i++){
- id = pnpprobeid(probef[i]);
- if(id == 0)
+ p = probef[i];
+ if(strlen(p) < 2)
continue;
+ id = 'e';
+ if(p[1] == '!'){
+ id = p[0];
+ p += 2;
+ }
+ /*
+ * shorthand for: id!lun -> id!#æ/aoe/lun
+ * because we cannot type æ in the bootloader console.
+ */
+ if(strchr(p, '/') == nil){
+ char tmp[64];
+
+ snprint(tmp, sizeof(tmp), "%c!#æ/aoe/%s", (char)id, p);
+
+ probef[i] = nil;
+ kstrdup(&probef[i], tmp);
+ }
s = malloc(sizeof *s);
if(s == nil)
break;