summaryrefslogtreecommitdiffstats
path: root/sys/dev/vn
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-01-27 04:18:15 +0000
committerbde <bde@FreeBSD.org>1996-01-27 04:18:15 +0000
commit4cf50d85eec3dff9f5df3411d87b0a2aea9c083d (patch)
treef93e309637079217e5820d51bef98f295ccb958a /sys/dev/vn
parentb367666afd7d12a7802e173170448bcd9f13d89b (diff)
downloadFreeBSD-src-4cf50d85eec3dff9f5df3411d87b0a2aea9c083d.zip
FreeBSD-src-4cf50d85eec3dff9f5df3411d87b0a2aea9c083d.tar.gz
First attempt at creating devfs entries for sliced devices. Doesn't
quite work yet, so the heart of it is disabled. Added bdev and cdev args to dsopen(). drivers: Fixed device names, links, minor numbers and modes. wd.c: Started actually supporting devfs. diskslice.h: Added devfs tokens to structs (currently 576 of them per disk! :-(). subr_diskslice.c: Create devfs entries in dsopen() and (unsuccessfully) attempt to make them go away at the right times. DEVFS is #undefed at the start so that this shouldn't cause problems.
Diffstat (limited to 'sys/dev/vn')
-rw-r--r--sys/dev/vn/vn.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 0212e51..5c3d195 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -133,6 +133,10 @@ int vndebug = 0x00;
struct vn_softc {
int sc_flags; /* flags */
size_t sc_size; /* size of vn */
+#if defined(DEVFS) && defined(notyet)
+ void *sc_bdev; /* devfs token for whole disk */
+ void *sc_cdev; /* devfs token for raw whole disk */
+#endif
struct vnode *sc_vp; /* vnode */
struct ucred *sc_cred; /* credentials */
int sc_maxactive; /* max # of active requests */
@@ -206,7 +210,8 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p)
vn->sc_size;
return (dsopen("vn", dev, mode, &vn->sc_slices, &label,
- vnstrategy, (ds_setgeom_t *)NULL));
+ vnstrategy, (ds_setgeom_t *)NULL,
+ &vn_bdevsw, &vn_cdevsw));
}
if (dkslice(dev) != WHOLE_DISK_SLICE ||
dkpart(dev) != RAW_PART ||
@@ -618,6 +623,12 @@ static void
vn_drvinit(void *unused)
{
dev_t dev;
+#ifdef DEVFS
+ int mynor;
+ char name[32];
+ int unit;
+ struct vn_softc *vn;
+#endif
if( ! vn_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
@@ -626,17 +637,21 @@ vn_drvinit(void *unused)
bdevsw_add(&dev,&vn_bdevsw,NULL);
vn_devsw_installed = 1;
#ifdef DEVFS
- {
- void *x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name major minor type uid gid perm*/
- "/", "rvn", &vn_cdevsw, 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "vn", &vn_bdevsw, 0, DV_BLK, 0, 0, 0600);
+ for (unit = 0; unit < NVN; unit++) {
+ vn = vn_softc[unit];
+ mynor = dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART);
+ sprintf(name, "rvn%d", unit);
+ /*
+ * XXX not saving tokens yet. The vn devices don't
+ * exist until after they have been opened :-).
+ */
+ devfs_add_devsw("/", name + 1, &vn_bdevsw, mynor,
+ DV_BLK, 0, 0, 0640);
+ devfs_add_devsw("/", name, &vn_cdevsw, mynor,
+ DV_CHR, 0, 0, 0640);
}
#endif
- }
+ }
}
SYSINIT(vndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,vn_drvinit,NULL)
OpenPOWER on IntegriCloud