summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/bioctl/bioctl.c30
-rw-r--r--sys/dev/bio.c14
-rw-r--r--sys/dev/biovar.h31
-rw-r--r--usr.sbin/sdio/sdio.c4
4 files changed, 39 insertions, 40 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c
index bd1a4287e34..3a2284b3f10 100644
--- a/sbin/bioctl/bioctl.c
+++ b/sbin/bioctl/bioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bioctl.c,v 1.106 2012/01/17 14:01:02 jsing Exp $ */
+/* $OpenBSD: bioctl.c,v 1.107 2012/01/17 15:15:57 jsing Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
@@ -319,7 +319,7 @@ bio_inq(char *name)
memset(&bi, 0, sizeof(bi));
- bi.bi_cookie = bl.bl_cookie;
+ bi.bi_bio.bio_cookie = bl.bl_bio.bio_cookie;
rv = ioctl(devh, BIOCINQ, &bi);
if (rv == -1) {
@@ -333,7 +333,7 @@ bio_inq(char *name)
volheader = 0;
for (i = 0; i < bi.bi_novol; i++) {
memset(&bv, 0, sizeof(bv));
- bv.bv_cookie = bl.bl_cookie;
+ bv.bv_bio.bio_cookie = bl.bl_bio.bio_cookie;
bv.bv_volid = i;
bv.bv_percent = -1;
bv.bv_seconds = 0;
@@ -420,7 +420,7 @@ bio_inq(char *name)
for (d = 0; d < bv.bv_nodisk; d++) {
memset(&bd, 0, sizeof(bd));
- bd.bd_cookie = bl.bl_cookie;
+ bd.bd_bio.bio_cookie = bl.bl_bio.bio_cookie;
bd.bd_diskid = d;
bd.bd_volid = i;
@@ -496,7 +496,7 @@ bio_alarm(char *arg)
int rv;
struct bioc_alarm ba;
- ba.ba_cookie = bl.bl_cookie;
+ ba.ba_bio.bio_cookie = bl.bl_bio.bio_cookie;
switch (arg[0]) {
case 'q': /* silence alarm */
@@ -544,14 +544,14 @@ bio_getvolbyname(char *name)
struct bioc_vol bv;
memset(&bi, 0, sizeof(bi));
- bi.bi_cookie = bl.bl_cookie;
+ bi.bi_bio.bio_cookie = bl.bl_bio.bio_cookie;
rv = ioctl(devh, BIOCINQ, &bi);
if (rv == -1)
err(1, "BIOCINQ");
for (i = 0; i < bi.bi_novol; i++) {
memset(&bv, 0, sizeof(bv));
- bv.bv_cookie = bl.bl_cookie;
+ bv.bv_bio.bio_cookie = bl.bl_bio.bio_cookie;
bv.bv_volid = i;
rv = ioctl(devh, BIOCVOL, &bv);
if (rv == -1)
@@ -590,7 +590,7 @@ bio_setstate(char *arg, int status, char *devicename)
bs.bs_other_id_type = BIOC_SSOTHER_DEVT;
}
- bs.bs_cookie = bl.bl_cookie;
+ bs.bs_bio.bio_cookie = bl.bl_bio.bio_cookie;
bs.bs_status = status;
if (status != BIOC_SSHOTSPARE) {
@@ -622,7 +622,7 @@ bio_setblink(char *name, char *arg, int blink)
/* try setting blink on the device directly */
memset(&bb, 0, sizeof(bb));
- bb.bb_cookie = bl.bl_cookie;
+ bb.bb_bio.bio_cookie = bl.bl_bio.bio_cookie;
bb.bb_status = blink;
bb.bb_target = location.target;
bb.bb_channel = location.channel;
@@ -633,14 +633,14 @@ bio_setblink(char *name, char *arg, int blink)
/* if the blink didn't work, try to find something that will */
memset(&bi, 0, sizeof(bi));
- bi.bi_cookie = bl.bl_cookie;
+ bi.bi_bio.bio_cookie = bl.bl_bio.bio_cookie;
rv = ioctl(devh, BIOCINQ, &bi);
if (rv == -1)
err(1, "BIOCINQ");
for (v = 0; v < bi.bi_novol; v++) {
memset(&bv, 0, sizeof(bv));
- bv.bv_cookie = bl.bl_cookie;
+ bv.bv_bio.bio_cookie = bl.bl_bio.bio_cookie;
bv.bv_volid = v;
rv = ioctl(devh, BIOCVOL, &bv);
if (rv == -1)
@@ -651,7 +651,7 @@ bio_setblink(char *name, char *arg, int blink)
for (d = 0; d < bv.bv_nodisk; d++) {
memset(&bd, 0, sizeof(bd));
- bd.bd_cookie = bl.bl_cookie;
+ bd.bd_bio.bio_cookie = bl.bl_bio.bio_cookie;
bd.bd_volid = v;
bd.bd_diskid = d;
@@ -694,7 +694,7 @@ bio_blink(char *enclosure, int target, int blinktype)
errx(1, "Can't locate %s device via %s", enclosure, "/dev/bio");
memset(&blink, 0, sizeof(blink));
- blink.bb_cookie = bio.bl_cookie;
+ blink.bb_bio.bio_cookie = bio.bl_bio.bio_cookie;
blink.bb_status = blinktype;
blink.bb_target = target;
@@ -808,7 +808,7 @@ bio_createraid(u_int16_t level, char *dev_list, char *key_disk)
errx(1, "not exactly one partition");
memset(&create, 0, sizeof(create));
- create.bc_cookie = bl.bl_cookie;
+ create.bc_bio.bio_cookie = bl.bl_bio.bio_cookie;
create.bc_level = level;
create.bc_dev_list_len = no_dev * sizeof(dev_t);
create.bc_dev_list = dt;
@@ -1016,7 +1016,7 @@ bio_deleteraid(char *dev)
struct bioc_deleteraid bd;
memset(&bd, 0, sizeof(bd));
- bd.bd_cookie = bd.bd_cookie;
+ bd.bd_bio.bio_cookie = bd.bd_bio.bio_cookie;
/* XXX make this a dev_t instead of a string */
strlcpy(bd.bd_dev, dev, sizeof bd.bd_dev);
if (ioctl(devh, BIOCDELETERAID, &bd))
diff --git a/sys/dev/bio.c b/sys/dev/bio.c
index a3bfdca67cb..9ce7a291470 100644
--- a/sys/dev/bio.c
+++ b/sys/dev/bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio.c,v 1.12 2010/01/22 21:56:04 miod Exp $ */
+/* $OpenBSD: bio.c,v 1.13 2012/01/17 15:15:57 jsing Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -73,7 +73,7 @@ int
bioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
{
struct bio_locate *locate;
- struct bio_common *common;
+ struct bio *bio;
char name[16];
int error;
@@ -83,8 +83,8 @@ bioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
error = copyinstr(locate->bl_name, name, sizeof name, NULL);
if (error != 0)
return (error);
- locate->bl_cookie = bio_lookup(name);
- if (locate->bl_cookie == NULL)
+ locate->bl_bio.bio_cookie = bio_lookup(name);
+ if (locate->bl_bio.bio_cookie == NULL)
return (ENOENT);
break;
@@ -97,11 +97,11 @@ bioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
case BIOCCREATERAID:
case BIOCDELETERAID:
case BIOCDISCIPLINE:
- common = (struct bio_common *)addr;
- if (!bio_validate(common->bc_cookie))
+ bio = (struct bio *)addr;
+ if (!bio_validate(bio->bio_cookie))
return (ENOENT);
return (bio_delegate_ioctl(
- (struct bio_mapping *)common->bc_cookie, cmd, addr));
+ (struct bio_mapping *)bio->bio_cookie, cmd, addr));
default:
return (ENXIO);
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h
index 62f52a23650..5d2b2c4c81e 100644
--- a/sys/dev/biovar.h
+++ b/sys/dev/biovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biovar.h,v 1.40 2011/05/20 14:46:44 marco Exp $ */
+/* $OpenBSD: biovar.h,v 1.41 2012/01/17 15:15:57 jsing Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -28,20 +28,19 @@
/*
* Devices getting ioctls through this interface should use ioctl class 'B'
* and command numbers starting from 32, lower ones are reserved for generic
- * ioctls. All ioctl data must be structures which start with a void *
- * cookie.
+ * ioctls. All ioctl data must be structures which start with a struct bio.
*/
#include <sys/types.h>
-struct bio_common {
- void *bc_cookie;
+struct bio {
+ void *bio_cookie;
};
/* convert name to a cookie */
#define BIOCLOCATE _IOWR('B', 0, struct bio_locate)
struct bio_locate {
- void *bl_cookie;
+ struct bio bl_bio;
char *bl_name;
};
@@ -53,7 +52,7 @@ void bio_unregister(struct device *);
#define BIOCINQ _IOWR('B', 32, struct bioc_inq)
struct bioc_inq {
- void *bi_cookie;
+ struct bio bi_bio;
char bi_dev[16]; /* controller device */
int bi_novol; /* nr of volumes */
@@ -63,7 +62,7 @@ struct bioc_inq {
#define BIOCDISK _IOWR('B', 33, struct bioc_disk)
/* structure that represents a disk in a RAID volume */
struct bioc_disk {
- void *bd_cookie;
+ struct bio bd_bio;
u_int16_t bd_channel;
u_int16_t bd_target;
@@ -99,7 +98,7 @@ struct bioc_disk {
#define BIOCVOL _IOWR('B', 34, struct bioc_vol)
/* structure that represents a RAID volume */
struct bioc_vol {
- void *bv_cookie;
+ struct bio bv_bio;
int bv_volid; /* volume id */
int16_t bv_percent; /* percent done operation */
@@ -130,7 +129,7 @@ struct bioc_vol {
#define BIOCALARM _IOWR('B', 35, struct bioc_alarm)
struct bioc_alarm {
- void *ba_cookie;
+ struct bio ba_bio;
int ba_opcode;
int ba_status; /* only used with get state */
@@ -143,7 +142,7 @@ struct bioc_alarm {
#define BIOCBLINK _IOWR('B', 36, struct bioc_blink)
struct bioc_blink {
- void *bb_cookie;
+ struct bio bb_bio;
u_int16_t bb_channel;
u_int16_t bb_target;
@@ -155,7 +154,7 @@ struct bioc_blink {
#define BIOCSETSTATE _IOWR('B', 37, struct bioc_setstate)
struct bioc_setstate {
- void *bs_cookie;
+ struct bio bs_bio;
u_int16_t bs_channel;
u_int16_t bs_target;
u_int16_t bs_lun;
@@ -174,7 +173,7 @@ struct bioc_setstate {
#define BIOCCREATERAID _IOWR('B', 38, struct bioc_createraid)
struct bioc_createraid {
- void *bc_cookie;
+ struct bio bc_bio;
void *bc_dev_list;
u_int16_t bc_dev_list_len;
int32_t bc_key_disk;
@@ -198,7 +197,7 @@ struct bioc_createraid {
#define BIOCDELETERAID _IOWR('B', 39, struct bioc_deleteraid)
struct bioc_deleteraid {
- void *bd_cookie;
+ struct bio bd_bio;
u_int32_t bd_flags;
#define BIOC_SDCLEARMETA 0x01 /* clear metadata region */
char bd_dev[16]; /* device */
@@ -206,7 +205,7 @@ struct bioc_deleteraid {
#define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
struct bioc_discipline {
- void *bd_cookie;
+ struct bio bd_bio;
char bd_dev[16];
u_int32_t bd_cmd;
u_int32_t bd_size;
@@ -215,7 +214,7 @@ struct bioc_discipline {
#define BIOCINSTALLBOOT _IOWR('B', 41, struct bioc_installboot)
struct bioc_installboot {
- void *bb_cookie;
+ struct bio bb_bio;
char bb_dev[16];
void *bb_bootblk;
void *bb_bootldr;
diff --git a/usr.sbin/sdio/sdio.c b/usr.sbin/sdio/sdio.c
index 61719d662fc..0c5a3f5d8ea 100644
--- a/usr.sbin/sdio/sdio.c
+++ b/usr.sbin/sdio/sdio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdio.c,v 1.4 2007/05/27 04:11:28 jmc Exp $ */
+/* $OpenBSD: sdio.c,v 1.5 2012/01/17 15:15:57 jsing Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -77,7 +77,7 @@ sdio_open(const char *name, struct sdio_hdl **hdl)
return -1;
}
- (*hdl)->cookie = bl.bl_cookie;
+ (*hdl)->cookie = bl.bl_bio.bio_cookie;
return 0;
}