summaryrefslogtreecommitdiffstats
path: root/sys/fs/specfs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-08-24 15:36:55 +0000
committerphk <phk@FreeBSD.org>2000-08-24 15:36:55 +0000
commitec761116e25ef0a9e43ec5670c7c6565a4848a0b (patch)
tree526f85e393c165d9f02f974b9d8214c9b1605bc4 /sys/fs/specfs
parentf234fce050713400cc0e6419a59b0f6df01a2501 (diff)
downloadFreeBSD-src-ec761116e25ef0a9e43ec5670c7c6565a4848a0b.zip
FreeBSD-src-ec761116e25ef0a9e43ec5670c7c6565a4848a0b.tar.gz
Fix panic when removing open device (found by bp@)
Implement subdirs. Build the full "devicename" for cloning functions. Fix panic when deleted device goes away. Collaps devfs_dir and devfs_dirent structures. Add proper cloning to the /dev/fd* "device-"driver. Fix a bug in make_dev_alias() handling which made aliases appear multiple times. Use devfs_clone to implement getdiskbyname() Make specfs maintain the stat(2) timestamps per dev_t
Diffstat (limited to 'sys/fs/specfs')
-rw-r--r--sys/fs/specfs/spec_vnops.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index f6bd853..f681cc8 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -246,19 +246,22 @@ spec_read(ap)
struct proc *p;
struct uio *uio;
dev_t dev;
- int error;
+ int error, resid;
vp = ap->a_vp;
dev = vp->v_rdev;
uio = ap->a_uio;
p = uio->uio_procp;
+ resid = uio->uio_resid;
- if (uio->uio_resid == 0)
+ if (resid == 0)
return (0);
VOP_UNLOCK(vp, 0, p);
error = (*devsw(dev)->d_read) (dev, uio, ap->a_ioflag);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ if (uio->uio_resid != resid || (error == 0 && resid != 0))
+ getnanotime(&dev->si_atime);
return (error);
}
@@ -279,16 +282,21 @@ spec_write(ap)
struct proc *p;
struct uio *uio;
dev_t dev;
- int error;
+ int error, resid;
vp = ap->a_vp;
dev = vp->v_rdev;
uio = ap->a_uio;
p = uio->uio_procp;
+ resid = uio->uio_resid;
VOP_UNLOCK(vp, 0, p);
error = (*devsw(dev)->d_write) (dev, uio, ap->a_ioflag);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ if (uio->uio_resid != resid || (error == 0 && resid != 0)) {
+ getnanotime(&dev->si_ctime);
+ dev->si_mtime = dev->si_ctime;
+ }
return (error);
}
OpenPOWER on IntegriCloud