From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] new usb implementation
Date: Mon, 8 Jun 2009 20:54:05 -0400 [thread overview]
Message-ID: <92b8bfc5dfedbeaec3bb6f6c0df2653c@quanstro.net> (raw)
In-Reply-To: <599f06db0906081203x32cd8641i1e79c469c4a6ee83@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
>
> Didn't say impossible, I said tricky.
here's the code. it's not hard at all. the meat of
the code just is one line. the rest is error checking.
a very similar script would turn all aoe devices into
sd devices via sdaoe, though i always end up doing
that by hand.
- erik
[-- Attachment #2: usbsd --]
[-- Type: text/plain, Size: 1017 bytes --]
#!/bin/rc
# turn usb disks into sd devices via sdloop(3)
rfork e
disk = ()
disks=()
name=()
fn picksd{
p=`{awk '{print $1}' < /dev/sdctl}
r=()
for(i in u v w x y z)
if(~ $#r 0 && ! ~ sd$i $p)
r = $i
echo $r
}
test -e /dev/usb || bind -a '#u' /dev || {
echo no '#u/usb' >[1=2]
exit nousb
}
test -e /dev/usbdctl || mount -a /srv/usb /dev || {
echo cannot mount /srv/usb >[1=2]
exit nousbd
}
switch($#*){
case 0
;
case 1
disks = $1
case 2
disks = $1
name = $2
case *
echo usage: usbsd ' [disk [sdname]]' >[1=2]
exit usage
}
if(~ $#disks 0){
if(! test -e /dev/sdU*/data){
echo no usb disks >[1=2]
exit nodisk
}
disks = `{echo /dev/sdU*/data}
}
for(d in $disks){
if(~ $d /dev/sdU*.[0-9]*/data && test -e $d){
if(~ $#name 0)
name=`{picksd u}
if(~ $#name 0){
echo no available devices >[2=1];
exit nodev
}
echo config switch on spec $name type loop/$d >/dev/sdctl
}
if not
echo $d does not exist >[2=1]
}
exit ''
next prev parent reply other threads:[~2009-06-09 0:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 20:37 geoff
2009-05-26 20:40 ` Devon H. O'Dell
2009-05-26 20:42 ` Rudolf Sykora
2009-05-26 20:41 ` Steve Simon
2009-05-26 20:56 ` Mathieu L.
2009-05-26 21:17 ` jt
2009-05-26 21:43 ` David Leimbach
2009-05-28 3:52 ` Shaowei Wang (wsw)
2009-05-28 6:37 ` Gorka Guardiola
2009-05-28 11:14 ` kokamoto
2009-05-28 9:15 ` Balwinder S Dheeman
2009-06-08 17:29 ` Matthias Bauer
2009-06-08 18:06 ` Francisco J Ballesteros
2009-06-08 18:17 ` geoff
2009-06-08 18:21 ` Gorka Guardiola
2009-06-08 18:36 ` erik quanstrom
2009-06-08 19:03 ` Gorka Guardiola
2009-06-09 0:54 ` erik quanstrom [this message]
2009-05-28 11:52 Francisco J Ballesteros
2009-06-08 15:35 ` Pavel Klinkovsky
2009-06-08 15:45 ` erik quanstrom
2009-06-08 15:50 ` Francisco J Ballesteros
2009-06-09 9:05 ` Pavel Klinkovsky
2009-06-10 10:48 ` Pavel Klinkovsky
2009-06-10 14:18 ` Francisco J Ballesteros
2009-06-10 15:24 ` Pavel Klinkovsky
2009-06-10 15:53 ` Francisco J Ballesteros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92b8bfc5dfedbeaec3bb6f6c0df2653c@quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).