diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2005-08-21 23:37:25 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2005-08-21 23:37:25 +0000 |
commit | 61f950d88a31ca36fb11e2838e6df25e3089c2a5 (patch) | |
tree | 129f7937340a38788594a6715f1a0b5913c0ffc5 /sbin/bioctl/bioctl.c | |
parent | 3b564fc5d74ecdb2b8c7db160af1da31cd0dff89 (diff) |
try to blink the device given on the command line before walking inquiries
on the device looking for an enclosure. this allows bioctl -b 0:0 ses0 to
work as well as bioctl -b 0:0 sd0/ami0.
ok deraadt@
Diffstat (limited to 'sbin/bioctl/bioctl.c')
-rw-r--r-- | sbin/bioctl/bioctl.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index c73f509dda8..37414ee6173 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioctl.c,v 1.36 2005/08/18 22:14:27 deraadt Exp $ */ +/* $OpenBSD: bioctl.c,v 1.37 2005/08/21 23:37:24 dlg Exp $ */ /* * Copyright (c) 2004, 2005 Marco Peereboom @@ -442,6 +442,7 @@ bio_setblink(char *name, char *arg, int blink) struct bioc_inq bi; struct bioc_vol bv; struct bioc_disk bd; + struct bioc_blink bb; const char *errstr; int v, d, rv; @@ -449,6 +450,17 @@ bio_setblink(char *name, char *arg, int blink) if (errstr) errx(1, "Target %s: %s", arg, errstr); + /* try setting blink on the device directly */ + memset(&bb, 0, sizeof(bb)); + bb.bb_cookie = bl.bl_cookie; + bb.bb_status = blink; + bb.bb_target = location.target; + rv = ioctl(devh, BIOCBLINK, &bb); + if (rv == 0) + return; + + /* if the blink didnt work, try to find something that will */ + memset(&bi, 0, sizeof(bi)); bi.bi_cookie = bl.bl_cookie; rv = ioctl(devh, BIOCINQ, &bi); |