diff options
author | 2005-08-21 23:37:24 +0000 | |
---|---|---|
committer | 2005-08-21 23:37:24 +0000 | |
commit | 0505205b1794a9af108cbcad3e40931915c08b6b (patch) | |
tree | 479b41b3c1cd592b76b4985774274d82bf127c7d | |
parent | device may be {ses,safte}# as well, for slot-operations (diff) | |
download | wireguard-openbsd-0505205b1794a9af108cbcad3e40931915c08b6b.tar.xz wireguard-openbsd-0505205b1794a9af108cbcad3e40931915c08b6b.zip |
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@
-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); |