diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2005-08-17 02:32:24 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2005-08-17 02:32:24 +0000 |
commit | 11a99748bfe6aa793452a7b09c0b28e3ff49a04c (patch) | |
tree | 72cfef7a58f815787e142d462e258c379a8e9821 /sys | |
parent | b914c2b9ed1199887db0c177b74de3844be13254 (diff) |
add bio_unregister so drivers can remove their bio entry on error or
detach.
ok marco@ after i proved i had tested it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/bio.c | 18 | ||||
-rw-r--r-- | sys/dev/biovar.h | 3 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sys/dev/bio.c b/sys/dev/bio.c index 5e2af3e1527..4e38d1a1aa1 100644 --- a/sys/dev/bio.c +++ b/sys/dev/bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio.c,v 1.5 2005/08/08 04:02:30 deraadt Exp $ */ +/* $OpenBSD: bio.c,v 1.6 2005/08/17 02:32:23 dlg Exp $ */ /* * Copyright (c) 2002 Niklas Hallqvist. All rights reserved. @@ -131,6 +131,22 @@ bio_register(dev, ioctl) return (0); } +void +bio_unregister(dev) + struct device *dev; +{ + struct bio_mapping *bm, *next; + + for (bm = LIST_FIRST(&bios); bm != NULL; bm = next) { + next = LIST_NEXT(bm, bm_link); + + if (dev == bm->bm_dev) { + LIST_REMOVE(bm, bm_link); + free(bm, M_DEVBUF); + } + } +} + struct bio_mapping * bio_lookup(name) char *name; diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h index e580cbc7831..85187fe54b6 100644 --- a/sys/dev/biovar.h +++ b/sys/dev/biovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biovar.h,v 1.14 2005/08/16 01:12:46 marco Exp $ */ +/* $OpenBSD: biovar.h,v 1.15 2005/08/17 02:32:23 dlg Exp $ */ /* * Copyright (c) 2002 Niklas Hallqvist. All rights reserved. @@ -47,6 +47,7 @@ struct bio_locate { #ifdef _KERNEL int bio_register(struct device *, int (*)(struct device *, u_long, caddr_t)); +void bio_unregister(struct device *); #endif /* RAID section */ |