From 3344c5a17e9322ec55ad4e3026e2a1e547b89938 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 26 May 2001 08:27:58 +0000 Subject: Create a general facility for making dev_t's depend on another dev_t. The dev_depends(dev_t, dev_t) function is for tying them to each other. When destroy_dev() is called on a dev_t, all dev_t's depending on it will also be destroyed (depth first order). Rewrite the make_dev_alias() to use this dependency facility. kern/subr_disk.c: Make the disk mini-layer use dependencies to make sure all relevant dev_t's are removed when the disk disappears. Make the disk mini-layer precreate some magic sub devices which the disk/slice/label code expects to be there. kern/subr_disklabel.c: Remove some now unneeded variables. kern/subr_diskmbr.c: Remove some ancient, commented out code. kern/subr_diskslice.c: Minor cleanup. Use name from dev_t instead of dsname() --- sys/kern/subr_diskslice.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sys/kern/subr_diskslice.c') diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index 9d9c705f6f3a..0e20032de10d 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -648,7 +648,6 @@ dsopen(dev, mode, flags, sspp, lp) struct disklabel *lp1; char *msg; u_char mask; - bool_t need_init; int part; char partname[2]; int slice; @@ -671,10 +670,9 @@ dsopen(dev, mode, flags, sspp, lp) * on the unit. This should only be done if the media has changed. */ ssp = *sspp; - need_init = !dsisopen(ssp); - if (ssp != NULL && need_init) - dsgone(sspp); - if (need_init) { + if (!dsisopen(ssp)) { + if (ssp != NULL) + dsgone(sspp); /* * Allocate a minimal slices "struct". This will become * the final slices "struct" if we don't want real slices @@ -730,9 +728,12 @@ dsopen(dev, mode, flags, sspp, lp) ) continue; dev1 = dkmodslice(dkmodpart(dev, RAW_PART), slice); - if (dev1->si_devsw == NULL) - dev1->si_devsw = dev->si_devsw; +#if 0 sname = dsname(dev, unit, slice, RAW_PART, partname); +#else + *partname='\0'; + sname = dev1->si_name; +#endif /* * XXX this should probably only be done for the need_init * case, but there may be a problem with DIOCSYNCSLICEINFO. -- cgit v1.2.3