summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ufs
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2000-04-16 18:55:20 +0000
committerjlemon <jlemon@FreeBSD.org>2000-04-16 18:55:20 +0000
commit42f19b906955a4b3ed85af73d1008731a67d8ffc (patch)
tree2cca1cfca6c0ceaa62dff991de00f75c29b08cc4 /sys/ufs/ufs
parentc41c876463ee8c302f06554537e0fb22a3fcdca4 (diff)
downloadFreeBSD-src-42f19b906955a4b3ed85af73d1008731a67d8ffc.zip
FreeBSD-src-42f19b906955a4b3ed85af73d1008731a67d8ffc.tar.gz
Replace the POLLEXTEND extensions with the kqueue() mechanism.
Diffstat (limited to 'sys/ufs/ufs')
-rw-r--r--sys/ufs/ufs/ufs_readwrite.c9
-rw-r--r--sys/ufs/ufs/ufs_vnops.c45
2 files changed, 29 insertions, 25 deletions
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c
index 48088e9..1f1b929 100644
--- a/sys/ufs/ufs/ufs_readwrite.c
+++ b/sys/ufs/ufs/ufs_readwrite.c
@@ -47,7 +47,10 @@
#include <vm/vm_pager.h>
#include <vm/vm_map.h>
#include <vm/vnode_pager.h>
-#include <sys/poll.h>
+#include <sys/event.h>
+
+#define VN_KNOTE(vp, b) \
+ KNOTE((struct klist *)&vp->v_pollinfo.vpi_selinfo.si_note, (caddr_t)(b))
/*
* Vnode op for reading.
@@ -513,6 +516,8 @@ WRITE(ap)
*/
if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0)
ip->i_mode &= ~(ISUID | ISGID);
+ if (resid > uio->uio_resid)
+ VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));
if (error) {
if (ioflag & IO_UNIT) {
(void)UFS_TRUNCATE(vp, osize,
@@ -522,8 +527,6 @@ WRITE(ap)
}
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC))
error = UFS_UPDATE(vp, 1);
- if (!error)
- VN_POLLEVENT(vp, POLLWRITE | (extended ? POLLEXTEND : 0));
if (object)
vm_object_vndeallocate(object);
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index f399511..889f446 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -56,7 +56,7 @@
#include <sys/malloc.h>
#include <sys/dirent.h>
#include <sys/lockf.h>
-#include <sys/poll.h>
+#include <sys/event.h>
#include <sys/conf.h>
#include <vm/vm_zone.h>
@@ -120,6 +120,8 @@ union _qcvt {
tmp.val[_QUAD_LOWWORD] = (l); \
(q) = tmp.qcvt; \
}
+#define VN_KNOTE(vp, b) \
+ KNOTE(&vp->v_pollinfo.vpi_selinfo.si_note, (b))
/*
* A virgin directory (no blushing please).
@@ -186,7 +188,7 @@ ufs_create(ap)
ap->a_dvp, ap->a_vpp, ap->a_cnp);
if (error)
return (error);
- VN_POLLEVENT(ap->a_dvp, POLLWRITE);
+ VN_KNOTE(ap->a_dvp, NOTE_WRITE);
return (0);
}
@@ -212,7 +214,7 @@ ufs_mknod(ap)
ap->a_dvp, vpp, ap->a_cnp);
if (error)
return (error);
- VN_POLLEVENT(ap->a_dvp, POLLWRITE);
+ VN_KNOTE(ap->a_dvp, NOTE_WRITE);
ip = VTOI(*vpp);
ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
if (vap->va_rdev != VNOVAL) {
@@ -528,7 +530,7 @@ ufs_setattr(ap)
return (EROFS);
error = ufs_chmod(vp, (int)vap->va_mode, cred, p);
}
- VN_POLLEVENT(vp, POLLATTRIB);
+ VN_KNOTE(vp, NOTE_ATTRIB);
return (error);
}
@@ -706,8 +708,8 @@ ufs_remove(ap)
goto out;
}
error = ufs_dirremove(dvp, ip, ap->a_cnp->cn_flags, 0);
- VN_POLLEVENT(vp, POLLNLINK);
- VN_POLLEVENT(dvp, POLLWRITE);
+ VN_KNOTE(vp, NOTE_DELETE);
+ VN_KNOTE(dvp, NOTE_WRITE);
out:
return (error);
}
@@ -773,8 +775,8 @@ out1:
if (tdvp != vp)
VOP_UNLOCK(vp, 0, p);
out2:
- VN_POLLEVENT(vp, POLLNLINK);
- VN_POLLEVENT(tdvp, POLLWRITE);
+ VN_KNOTE(vp, NOTE_LINK);
+ VN_KNOTE(tdvp, NOTE_WRITE);
return (error);
}
@@ -995,7 +997,7 @@ abortit:
oldparent = dp->i_number;
doingdirectory = 1;
}
- VN_POLLEVENT(fdvp, POLLWRITE);
+ VN_KNOTE(fdvp, NOTE_WRITE); /* XXX right place? */
vrele(fdvp);
/*
@@ -1101,7 +1103,7 @@ abortit:
}
goto bad;
}
- VN_POLLEVENT(tdvp, POLLWRITE);
+ VN_KNOTE(tdvp, NOTE_WRITE);
vput(tdvp);
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
@@ -1158,7 +1160,6 @@ abortit:
if (DOINGSOFTDEP(tvp))
softdep_change_linkcnt(xp);
}
- VN_POLLEVENT(tdvp, POLLWRITE);
if (doingdirectory && !DOINGSOFTDEP(tvp)) {
/*
* Truncate inode. The only stuff left in the directory
@@ -1182,8 +1183,9 @@ abortit:
tcnp->cn_cred, tcnp->cn_proc)) != 0)
goto bad;
}
+ VN_KNOTE(tdvp, NOTE_WRITE);
vput(tdvp);
- VN_POLLEVENT(tvp, POLLNLINK); /* XXX this right? */
+ VN_KNOTE(tvp, NOTE_DELETE);
vput(tvp);
xp = NULL;
}
@@ -1238,6 +1240,7 @@ abortit:
error = ufs_dirremove(fdvp, xp, fcnp->cn_flags, 0);
xp->i_flag &= ~IN_RENAME;
}
+ VN_KNOTE(fvp, NOTE_RENAME);
if (dp)
vput(fdvp);
if (xp)
@@ -1314,10 +1317,10 @@ ufs_mkdir(ap)
#ifdef QUOTA
struct ucred ucred, *ucp;
ucp = cnp->cn_cred;
-#endif I
+#endif
/*
* If we are hacking owners here, (only do this where told to)
- * and we are not giving it TOO root, (would subvert quotas)
+ * and we are not giving it TO root, (would subvert quotas)
* then go ahead and give it to the other user.
* The new directory also inherits the SUID bit.
* If user's UID and dir UID are the same,
@@ -1426,7 +1429,6 @@ ufs_mkdir(ap)
(void)BUF_WRITE(bp);
goto bad;
}
- VN_POLLEVENT(dvp, POLLWRITE); /* XXX right place? */
/*
* Directory set up, now install its entry in the parent directory.
*
@@ -1447,6 +1449,7 @@ ufs_mkdir(ap)
bad:
if (error == 0) {
+ VN_KNOTE(dvp, NOTE_WRITE);
*ap->a_vpp = tvp;
} else {
dp->i_effnlink--;
@@ -1537,7 +1540,7 @@ ufs_rmdir(ap)
}
goto out;
}
- VN_POLLEVENT(dvp, POLLWRITE|POLLNLINK);
+ VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK);
cache_purge(dvp);
/*
* Truncate inode. The only stuff left in the directory is "." and
@@ -1557,7 +1560,7 @@ ufs_rmdir(ap)
}
cache_purge(vp);
out:
- VN_POLLEVENT(vp, POLLNLINK);
+ VN_KNOTE(vp, NOTE_DELETE);
return (error);
}
@@ -1582,7 +1585,7 @@ ufs_symlink(ap)
vpp, ap->a_cnp);
if (error)
return (error);
- VN_POLLEVENT(ap->a_dvp, POLLWRITE);
+ VN_KNOTE(ap->a_dvp, NOTE_WRITE);
vp = *vpp;
len = strlen(ap->a_target);
if (len < vp->v_mount->mnt_maxsymlinklen) {
@@ -2086,11 +2089,11 @@ ufs_makeinode(mode, dvp, vpp, cnp)
#ifdef QUOTA
struct ucred ucred, *ucp;
ucp = cnp->cn_cred;
-#endif I
+#endif
/*
* If we are not the owner of the directory,
* and we are hacking owners here, (only do this where told to)
- * and we are not giving it TOO root, (would subvert quotas)
+ * and we are not giving it TO root, (would subvert quotas)
* then go ahead and give it to the other user.
* Note that this drops off the execute bits for security.
*/
@@ -2301,5 +2304,3 @@ ufs_vnoperatespec(ap)
{
return (VOCALL(ufs_specop_p, ap->a_desc->vdesc_offset, ap));
}
-
-
OpenPOWER on IntegriCloud