summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-08-08 04:02:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-08-08 04:02:32 +0000
commitded2c8638fbc48f402965acb8918e82dcd91c1b4 (patch)
treeee4aa40a9139faa55dc3b83aa6d75298ddb64f96 /sys
parent26316bc44a9c19d65f77a16e80410601a7dfab90 (diff)
rename a bunch of bio/raid APIs to stop the bleeding in dlg and
my eyes; marco ok
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/bio.c12
-rw-r--r--sys/dev/biovar.h119
-rw-r--r--sys/dev/ic/ami.c104
3 files changed, 113 insertions, 122 deletions
diff --git a/sys/dev/bio.c b/sys/dev/bio.c
index 88dd92634de..5e2af3e1527 100644
--- a/sys/dev/bio.c
+++ b/sys/dev/bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio.c,v 1.4 2005/04/01 20:02:27 marco Exp $ */
+/* $OpenBSD: bio.c,v 1.5 2005/08/08 04:02:30 deraadt Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -97,20 +97,20 @@ bioioctl(dev, cmd, addr, flag, p)
switch (cmd) {
case BIOCLOCATE:
locate = (struct bio_locate *)addr;
- error = copyinstr(locate->name, name, 16, &len);
+ error = copyinstr(locate->bl_name, name, 16, &len);
if (error != 0)
return (error);
- locate->cookie = bio_lookup(name);
- if (locate->cookie == NULL)
+ locate->bl_cookie = bio_lookup(name);
+ if (locate->bl_cookie == NULL)
return (ENOENT);
break;
default:
common = (struct bio_common *)addr;
- if (!bio_validate(common->cookie))
+ if (!bio_validate(common->bc_cookie))
return (ENOENT);
return (bio_delegate_ioctl(
- (struct bio_mapping *)common->cookie, cmd, addr));
+ (struct bio_mapping *)common->bc_cookie, cmd, addr));
}
return (0);
}
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h
index ce2b7c06303..44d71ef5b55 100644
--- a/sys/dev/biovar.h
+++ b/sys/dev/biovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biovar.h,v 1.10 2005/08/08 03:11:36 marco Exp $ */
+/* $OpenBSD: biovar.h,v 1.11 2005/08/08 04:02:30 deraadt Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -35,13 +35,13 @@
#include <sys/types.h>
struct bio_common {
- void *cookie;
+ void *bc_cookie;
};
#define BIOCLOCATE _IOWR('B', 0, struct bio_locate)
struct bio_locate {
- void *cookie;
- char *name;
+ void *bl_cookie;
+ char *bl_name;
};
#ifdef _KERNEL
@@ -51,24 +51,23 @@ int bio_register(struct device *, int (*)(struct device *, u_long,
/* RAID section */
-#define BIOCINQ _IOWR('B', 32, bioc_inq)
-typedef struct _bioc_inq {
- void *cookie;
+#define BIOCINQ _IOWR('B', 32, struct bioc_inq)
+struct bioc_inq {
+ void *bi_cookie;
- int novol; /* nr of volumes */
- int nodisk; /* nr of total disks */
-
- char dev[16]; /* controller device */
-} bioc_inq;
+ char bi_dev[16]; /* controller device */
+ int bi_novol; /* nr of volumes */
+ int bi_nodisk; /* nr of total disks */
+};
-#define BIOCDISK _IOWR('B', 33, bioc_disk)
+#define BIOCDISK _IOWR('B', 33, struct bioc_disk)
/* structure that represents a disk in a RAID volume */
-typedef struct _bioc_disk {
- void *cookie;
+struct bioc_disk {
+ void *bd_cookie;
- int volid; /* associate with volume, if -1 unused */
- int diskid; /* virtual disk id */
- int status; /* current status */
+ int bd_volid; /* associate with volume, if -1 unused */
+ int bd_diskid; /* virtual disk id */
+ int bd_status; /* current status */
#define BIOC_SDONLINE 0x00
#define BIOC_SDONLINE_S "Online"
#define BIOC_SDOFFLINE 0x01
@@ -83,34 +82,29 @@ typedef struct _bioc_disk {
#define BIOC_SDUNUSED_S "Unused"
#define BIOC_SDINVALID 0xff
#define BIOC_SDINVALID_S "Invalid"
- int resv; /* align */
-
- u_quad_t size; /* size of the disk */
-
- /* this is provided by the physical disks if suported */
- char vendor[8]; /* vendor string */
- char product[16]; /* product string */
- char revision[4]; /* revision string */
- char pad[4]; /* zero terminate in here */
+ int bd_resv; /* align */
+ u_quad_t bd_size; /* size of the disk */
/* physical data */
- u_int16_t channel;
- u_int16_t target;
- u_int16_t lun;
- u_int16_t other_id; /* unused for now but needed for sas/fc */
-
- /* XXX get this too? */
- /* serial number */
-} bioc_disk;
+ u_int16_t bd_channel;
+ u_int16_t bd_target;
+ u_int16_t bd_lun;
+ u_int16_t bd_other_id; /* unused for now but needed for sas/fc */
+ char bd_vendor[8]; /* vendor string */
+ char bd_product[16]; /* product string */
+ char bd_revision[4]; /* revision string */
+ char bd_pad[4]; /* zero terminate in here */
+ char bd_serial[16];
+};
-#define BIOCVOL _IOWR('B', 34, bioc_vol)
+#define BIOCVOL _IOWR('B', 34, struct bioc_vol)
/* structure that represents a RAID volume */
-typedef struct _bioc_vol {
- void *cookie;
+struct bioc_vol {
+ void *bv_cookie;
- int volid; /* volume id */
- int resv1; /* for binary compatibility */
- int status; /* current status */
+ int bv_volid; /* volume id */
+ int bv_resv1; /* for binary compatibility */
+ int bv_status; /* current status */
#define BIOC_SVONLINE 0x00
#define BIOC_SVONLINE_S "Online"
#define BIOC_SVOFFLINE 0x01
@@ -119,37 +113,34 @@ typedef struct _bioc_vol {
#define BIOC_SVDEGRADED_S "Degraded"
#define BIOC_SVINVALID 0xff
#define BIOC_SVINVALID_S "Invalid"
- int resv2; /* align */
- u_quad_t size; /* size of the disk */
- int level; /* raid level */
- int nodisk; /* nr of drives */
-
- /* this is provided by the RAID card */
- char vendor[8]; /* vendor string */
- char product[16]; /* product string */
- char revision[4]; /* revision string */
- char pad[4]; /* zero terminate in here */
-
- /* physical data */
- char dev[16]; /* device */
-} bioc_vol;
+ int bv_resv2; /* align */
+ u_quad_t bv_size; /* size of the disk */
+ int bv_level; /* raid level */
+ int bv_nodisk; /* nr of drives */
+
+ char bv_dev[16]; /* device */
+ char bv_vendor[8]; /* vendor string */
+ char bv_product[16]; /* product string */
+ char bv_revision[4]; /* revision string */
+ char bv_pad[4]; /* zero terminate in here */
+};
-#define BIOCALARM _IOWR('B', 35, bioc_alarm)
-typedef struct _bioc_alarm {
- void *cookie;
+#define BIOCALARM _IOWR('B', 35, struct bioc_alarm)
+struct bioc_alarm {
+ void *ba_cookie;
- int resv1; /* for binary compatibility */
- int resv2; /* for binary compatibility */
- int status; /* only used with get state */
- int resv3; /* for binary compatibility */
+ int ba_resv1; /* for binary compatibility */
+ int ba_resv2; /* for binary compatibility */
+ int ba_status; /* only used with get state */
+ int ba_resv3; /* for binary compatibility */
- int opcode;
+ int ba_opcode;
#define BIOC_SADISABLE 0x00 /* disable alarm */
#define BIOC_SAENABLE 0x01 /* enable alarm */
#define BIOC_SASILENCE 0x02 /* silence alarm */
#define BIOC_GASTATUS 0x03 /* get status */
#define BIOC_SATEST 0x04 /* test alarm */
-} bioc_alarm;
+};
#define BIOC_INQ 0x01
#define BIOC_DISK 0x02
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index 0d1138d4709..6f9a2c9d78a 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.54 2005/08/08 03:11:36 marco Exp $ */
+/* $OpenBSD: ami.c,v 1.55 2005/08/08 04:02:31 deraadt Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -140,10 +140,10 @@ int ami_mgmt(struct ami_softc *, u_int8_t, u_int8_t, u_int8_t,
size_t, void *);
int ami_drv_inq(struct ami_softc *, u_int8_t, u_int8_t, void *);
int ami_ioctl(struct device *, u_long, caddr_t);
-int ami_ioctl_inq(struct ami_softc *, bioc_inq *);
-int ami_ioctl_vol(struct ami_softc *, bioc_vol *);
-int ami_ioctl_disk(struct ami_softc *, bioc_disk *);
-int ami_ioctl_alarm(struct ami_softc *, bioc_alarm *);
+int ami_ioctl_inq(struct ami_softc *, struct bioc_inq *);
+int ami_ioctl_vol(struct ami_softc *, struct bioc_vol *);
+int ami_ioctl_disk(struct ami_softc *, struct bioc_disk *);
+int ami_ioctl_alarm(struct ami_softc *, struct bioc_alarm *);
#endif /* NBIO > 0 */
struct ami_ccb *
@@ -1818,22 +1818,22 @@ ami_ioctl(dev, cmd, addr)
switch (cmd) {
case BIOCINQ:
AMI_DPRINTF(AMI_D_IOCTL, ("inq "));
- error = ami_ioctl_inq(sc, (bioc_inq *)addr);
+ error = ami_ioctl_inq(sc, (struct bioc_inq *)addr);
break;
case BIOCVOL:
AMI_DPRINTF(AMI_D_IOCTL, ("vol "));
- error = ami_ioctl_vol(sc, (bioc_vol *)addr);
+ error = ami_ioctl_vol(sc, (struct bioc_vol *)addr);
break;
case BIOCDISK:
AMI_DPRINTF(AMI_D_IOCTL, ("disk "));
- error = ami_ioctl_disk(sc, (bioc_disk *)addr);
+ error = ami_ioctl_disk(sc, (struct bioc_disk *)addr);
break;
case BIOCALARM:
AMI_DPRINTF(AMI_D_IOCTL, ("alarm "));
- error = ami_ioctl_alarm(sc, (bioc_alarm *)addr);
+ error = ami_ioctl_alarm(sc, (struct bioc_alarm *)addr);
break;
default:
@@ -1973,7 +1973,7 @@ bail:;
int
ami_ioctl_inq(sc, bi)
struct ami_softc *sc;
- bioc_inq *bi;
+ struct bioc_inq *bi;
{
struct ami_big_diskarray *p; /* struct too large for stack */
char *plist;
@@ -2001,10 +2001,10 @@ ami_ioctl_inq(sc, bi)
memset(plist, 0, AMI_BIG_MAX_PDRIVES);
- bi->novol = p->ada_nld;
- bi->nodisk = 0;
+ bi->bi_novol = p->ada_nld;
+ bi->bi_nodisk = 0;
- strlcpy(bi->dev, sc->sc_dev.dv_xname, sizeof(bi->dev));
+ strlcpy(bi->bi_dev, sc->sc_dev.dv_xname, sizeof(bi->bi_dev));
/* do we actually care how many disks we have at this point? */
for (i = 0; i < p->ada_nld; i++)
@@ -2016,7 +2016,7 @@ ami_ioctl_inq(sc, bi)
if (!plist[off]) {
plist[off] = 1;
- bi->nodisk++;
+ bi->bi_nodisk++;
}
}
@@ -2032,7 +2032,7 @@ bail:
int
ami_ioctl_vol(sc, bv)
struct ami_softc *sc;
- bioc_vol *bv;
+ struct bioc_vol *bv;
{
struct ami_big_diskarray *p; /* struct too large for stack */
int i, s, t;
@@ -2049,61 +2049,61 @@ ami_ioctl_vol(sc, bv)
goto bail;
}
- if (bv->volid > p->ada_nld) {
+ if (bv->bv_volid > p->ada_nld) {
error = EINVAL;
goto bail;
}
- i = bv->volid;
+ i = bv->bv_volid;
switch (p->ald[i].adl_status) {
case AMI_RDRV_OFFLINE:
- bv->status = BIOC_SVOFFLINE;
+ bv->bv_status = BIOC_SVOFFLINE;
break;
case AMI_RDRV_DEGRADED:
- bv->status = BIOC_SVDEGRADED;
+ bv->bv_status = BIOC_SVDEGRADED;
break;
case AMI_RDRV_OPTIMAL:
- bv->status = BIOC_SVONLINE;
+ bv->bv_status = BIOC_SVONLINE;
break;
default:
- bv->status = BIOC_SVINVALID;
+ bv->bv_status = BIOC_SVINVALID;
}
- bv->size = 0;
- bv->level = p->ald[i].adl_raidlvl;
- bv->nodisk = 0;
+ bv->bv_size = 0;
+ bv->bv_level = p->ald[i].adl_raidlvl;
+ bv->bv_nodisk = 0;
for (s = 0; s < p->ald[i].adl_spandepth; s++) {
for (t = 0; t < p->ald[i].adl_nstripes; t++)
- bv->nodisk++;
+ bv->bv_nodisk++;
- switch (bv->level) {
+ switch (bv->bv_level) {
case 0:
- bv->size += p->ald[i].asp[s].ads_length *
+ bv->bv_size += p->ald[i].asp[s].ads_length *
p->ald[i].adl_nstripes;
break;
case 1:
- bv->size += p->ald[i].asp[s].ads_length;
+ bv->bv_size += p->ald[i].asp[s].ads_length;
break;
case 5:
- bv->size += p->ald[i].asp[s].ads_length *
+ bv->bv_size += p->ald[i].asp[s].ads_length *
(p->ald[i].adl_nstripes - 1);
break;
}
}
if (p->ald[i].adl_spandepth > 1)
- bv->level *= 10;
+ bv->bv_level *= 10;
- bv->size *= (u_quad_t)512;
+ bv->bv_size *= (u_quad_t)512;
- strlcpy(bv->dev, sc->sc_hdr[i].dev, sizeof(bv->dev));
+ strlcpy(bv->bv_dev, sc->sc_hdr[i].dev, sizeof(bv->bv_dev));
bail:
free(p, M_DEVBUF);
@@ -2114,7 +2114,7 @@ bail:
int
ami_ioctl_disk(sc, bd)
struct ami_softc *sc;
- bioc_disk *bd;
+ struct bioc_disk *bd;
{
struct scsi_inquiry_data inqbuf;
struct ami_big_diskarray *p; /* struct too large for stack */
@@ -2134,17 +2134,17 @@ ami_ioctl_disk(sc, bd)
goto bail;
}
- if (bd->volid > p->ada_nld) {
+ if (bd->bd_volid > p->ada_nld) {
error = EINVAL;
goto bail;
}
- i = bd->volid;
+ i = bd->bd_volid;
error = EINVAL;
for (s = 0, d = 0; s < p->ald[i].adl_spandepth; s++) {
for (t = 0; t < p->ald[i].adl_nstripes; t++) {
- if (d != bd->diskid) {
+ if (d != bd->bd_diskid) {
d++;
continue;
}
@@ -2155,41 +2155,41 @@ ami_ioctl_disk(sc, bd)
switch (p->apd[off].adp_ostatus) {
case AMI_PD_UNCNF:
- bd->status = BIOC_SDUNUSED;
+ bd->bd_status = BIOC_SDUNUSED;
break;
case AMI_PD_ONLINE:
- bd->status = BIOC_SDONLINE;
+ bd->bd_status = BIOC_SDONLINE;
break;
case AMI_PD_FAILED:
- bd->status = BIOC_SDFAILED;
+ bd->bd_status = BIOC_SDFAILED;
break;
case AMI_PD_RBLD:
- bd->status = BIOC_SDREBUILD;
+ bd->bd_status = BIOC_SDREBUILD;
break;
case AMI_PD_HOTSPARE:
- bd->status = BIOC_SDHOTSPARE;
+ bd->bd_status = BIOC_SDHOTSPARE;
break;
default:
- bd->status = BIOC_SDINVALID;
+ bd->bd_status = BIOC_SDINVALID;
}
- bd->size = (u_quad_t)p->apd[off].adp_size *
+ bd->bd_size = (u_quad_t)p->apd[off].adp_size *
(u_quad_t)512;
ch = p->ald[i].asp[s].adv[t].add_target >> 4;
tg = p->ald[i].asp[s].adv[t].add_target & 0x0f;
if (!ami_drv_inq(sc, ch, tg, &inqbuf))
- strlcpy(bd->vendor, inqbuf.vendor,
+ strlcpy(bd->bd_vendor, inqbuf.vendor,
8 + 16 + 4 + 1); /* vendor prod rev zero */
- bd->channel = ch;
- bd->target = tg;
+ bd->bd_channel = ch;
+ bd->bd_target = tg;
error = 0;
goto bail;
@@ -2204,12 +2204,12 @@ bail:
int ami_ioctl_alarm(sc, ba)
struct ami_softc *sc;
- bioc_alarm *ba;
+ struct bioc_alarm *ba;
{
int error = 0;
u_int8_t func, ret;
- switch(ba->opcode) {
+ switch(ba->ba_opcode) {
case BIOC_SADISABLE:
func = AMI_SPKR_OFF;
break;
@@ -2232,17 +2232,17 @@ int ami_ioctl_alarm(sc, ba)
default:
AMI_DPRINTF(AMI_D_IOCTL, ("%s: biocalarm invalid opcode %x\n",
- sc->sc_dev.dv_xname, ba->opcode));
+ sc->sc_dev.dv_xname, ba->ba_opcode));
error = EINVAL;
}
if (ami_mgmt(sc, AMI_SPEAKER, func, 0, sizeof ret, &ret))
error = EINVAL;
else
- if (ba->opcode == BIOC_GASTATUS)
- ba->status = ret;
+ if (ba->ba_opcode == BIOC_GASTATUS)
+ ba->ba_status = ret;
else
- ba->status = 0;
+ ba->ba_status = 0;
return (error);
}