diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-05-04 19:30:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-05-04 19:30:56 +0000 |
commit | e3d438608f212120e42a6447bf89f354816ac4ff (patch) | |
tree | 0ef9e295d96f14d2180ea27daa273afdb5b093d1 /sys/kern | |
parent | a258f20b10975f2a073d3fbeb33358967ff5298c (diff) |
make findblkmajor() and findblkname() MI; ok miod
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_disk.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 9f0836e9ea3..3e7d7a001cd 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.35 2007/05/04 03:44:45 deraadt Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.36 2007/05/04 19:30:55 deraadt Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -813,3 +813,28 @@ gotswap: dumpdev = swdevt[0].sw_dev; } } + +extern struct nam2blk nam2blk[]; + +int +findblkmajor(struct device *dv) +{ + char *name = dv->dv_xname; + int i; + + for (i = 0; nam2blk[i].name; i++) + if (!strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name))) + return (nam2blk[i].maj); + return (-1); +} + +char * +findblkname(int maj) +{ + int i; + + for (i = 0; nam2blk[i].name; i++) + if (nam2blk[i].maj == maj) + return (nam2blk[i].name); + return (NULL); +} |