[click] Now all dev_t's in the kernel have their char device major.
Only know casualy of this is swapinfo/pstat which should be fixes the right way: Store the actual pathname in the kernel like mount does. [Volounteers sought for this task] The road map from here is roughly: expand struct specinfo into struct based dev_t. Add dev_t registration facilities for device drivers and start to use them.
This commit is contained in:
parent
27ccb91085
commit
f3c07181e3
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_conf.c,v 1.48 1999/07/17 18:43:45 phk Exp $
|
||||
* $Id: kern_conf.c,v 1.49 1999/07/17 19:57:25 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -71,22 +71,7 @@ devsw(dev_t dev)
|
||||
struct cdevsw *
|
||||
bdevsw(dev_t dev)
|
||||
{
|
||||
struct cdevsw *c;
|
||||
int i = major(dev);
|
||||
|
||||
if (bmaj2cmaj[i] == 256)
|
||||
return 0;
|
||||
|
||||
c = cdevsw[bmaj2cmaj[major(dev)]];
|
||||
if (!c) {
|
||||
printf("bogus bdev dev_t %p, no cdev\n", (void *)dev);
|
||||
Debugger("Bummer");
|
||||
return 0;
|
||||
}
|
||||
/* CMAJ zero is the console, which has no strategy so this works */
|
||||
if (c->d_strategy)
|
||||
return (c);
|
||||
return (0);
|
||||
return(cdevsw[major(dev)]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -209,7 +194,10 @@ minor(dev_t x)
|
||||
dev_t
|
||||
makebdev(int x, int y)
|
||||
{
|
||||
return (makedev(x, y));
|
||||
if (bmaj2cmaj[x] == 256) {
|
||||
return NODEV;
|
||||
}
|
||||
return (makedev(bmaj2cmaj[x], y));
|
||||
}
|
||||
|
||||
dev_t
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.210 1999/07/17 19:38:00 phk Exp $
|
||||
* $Id: vfs_subr.c,v 1.211 1999/07/18 14:30:37 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1244,11 +1244,13 @@ bdevvp(dev, vpp)
|
||||
return (error);
|
||||
}
|
||||
vp = nvp;
|
||||
vp->v_type = VBLK;
|
||||
/* dev2udev() results in a CDEV, so we need to cheat here. */
|
||||
vp->v_type = VCHR;
|
||||
if ((nvp = checkalias(vp, dev2udev(dev), (struct mount *)0)) != NULL) {
|
||||
vput(vp);
|
||||
vp = nvp;
|
||||
}
|
||||
vp->v_type = VBLK;
|
||||
*vpp = vp;
|
||||
return (0);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.210 1999/07/17 19:38:00 phk Exp $
|
||||
* $Id: vfs_subr.c,v 1.211 1999/07/18 14:30:37 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1244,11 +1244,13 @@ bdevvp(dev, vpp)
|
||||
return (error);
|
||||
}
|
||||
vp = nvp;
|
||||
vp->v_type = VBLK;
|
||||
/* dev2udev() results in a CDEV, so we need to cheat here. */
|
||||
vp->v_type = VCHR;
|
||||
if ((nvp = checkalias(vp, dev2udev(dev), (struct mount *)0)) != NULL) {
|
||||
vput(vp);
|
||||
vp = nvp;
|
||||
}
|
||||
vp->v_type = VBLK;
|
||||
*vpp = vp;
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user