summaryrefslogtreecommitdiffstats
path: root/sys/fs/devfs
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2009-05-11 15:33:26 +0000
committerattilio <attilio@FreeBSD.org>2009-05-11 15:33:26 +0000
commit1dcb84131b6679f5d53452314d4ca1dfe2d8c5f0 (patch)
tree6591f00318da636f44a6ceb26f517e7795eb1b44 /sys/fs/devfs
parentebcb20267286e4ffadb3f603af56bd7a1df1f422 (diff)
downloadFreeBSD-src-1dcb84131b6679f5d53452314d4ca1dfe2d8c5f0.zip
FreeBSD-src-1dcb84131b6679f5d53452314d4ca1dfe2d8c5f0.tar.gz
Remove the thread argument from the FSD (File-System Dependent) parts of
the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation.
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r--sys/fs/devfs/devfs.h3
-rw-r--r--sys/fs/devfs/devfs_vfsops.c14
-rw-r--r--sys/fs/devfs/devfs_vnops.c21
3 files changed, 16 insertions, 22 deletions
diff --git a/sys/fs/devfs/devfs.h b/sys/fs/devfs/devfs.h
index 1050ba5..524bec8 100644
--- a/sys/fs/devfs/devfs.h
+++ b/sys/fs/devfs/devfs.h
@@ -172,7 +172,8 @@ extern unsigned devfs_rule_depth;
void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de);
void devfs_rules_cleanup (struct devfs_mount *dm);
int devfs_rules_ioctl(struct devfs_mount *dm, u_long cmd, caddr_t data, struct thread *td);
-int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td);
+int devfs_allocv (struct devfs_dirent *de, struct mount *mp,
+ struct vnode **vpp);
void devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int vp_locked);
void devfs_dirent_free(struct devfs_dirent *de);
void devfs_populate (struct devfs_mount *dm);
diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c
index 9a9bc38..ff86e36 100644
--- a/sys/fs/devfs/devfs_vfsops.c
+++ b/sys/fs/devfs/devfs_vfsops.c
@@ -60,7 +60,7 @@ static vfs_statfs_t devfs_statfs;
* Mount the filesystem
*/
static int
-devfs_mount(struct mount *mp, struct thread *td)
+devfs_mount(struct mount *mp)
{
int error;
struct devfs_mount *fmp;
@@ -92,7 +92,7 @@ devfs_mount(struct mount *mp, struct thread *td)
fmp->dm_rootdir = devfs_vmkdir(fmp, NULL, 0, NULL, DEVFS_ROOTINO);
- error = devfs_root(mp, LK_EXCLUSIVE, &rvp, td);
+ error = devfs_root(mp, LK_EXCLUSIVE, &rvp);
if (error) {
sx_destroy(&fmp->dm_lock);
free_unr(devfs_unr, fmp->dm_idx);
@@ -115,7 +115,7 @@ devfs_unmount_final(struct devfs_mount *fmp)
}
static int
-devfs_unmount(struct mount *mp, int mntflags, struct thread *td)
+devfs_unmount(struct mount *mp, int mntflags)
{
int error;
int flags = 0;
@@ -127,7 +127,7 @@ devfs_unmount(struct mount *mp, int mntflags, struct thread *td)
KASSERT(fmp->dm_mount != NULL,
("devfs_unmount unmounted devfs_mount"));
/* There is 1 extra root vnode reference from devfs_mount(). */
- error = vflush(mp, 1, flags, td);
+ error = vflush(mp, 1, flags, curthread);
if (error)
return (error);
sx_xlock(&fmp->dm_lock);
@@ -147,7 +147,7 @@ devfs_unmount(struct mount *mp, int mntflags, struct thread *td)
/* Return locked reference to root. */
static int
-devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td)
+devfs_root(struct mount *mp, int flags, struct vnode **vpp)
{
int error;
struct vnode *vp;
@@ -155,7 +155,7 @@ devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td)
dmp = VFSTODEVFS(mp);
sx_xlock(&dmp->dm_lock);
- error = devfs_allocv(dmp->dm_rootdir, mp, &vp, td);
+ error = devfs_allocv(dmp->dm_rootdir, mp, &vp);
if (error)
return (error);
vp->v_vflag |= VV_ROOT;
@@ -164,7 +164,7 @@ devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td)
}
static int
-devfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
+devfs_statfs(struct mount *mp, struct statfs *sbp)
{
sbp->f_flags = 0;
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 215f943..ece9559 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -330,14 +330,13 @@ devfs_insmntque_dtr(struct vnode *vp, void *arg)
* it on return.
*/
int
-devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td)
+devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp)
{
int error;
struct vnode *vp;
struct cdev *dev;
struct devfs_mount *dmp;
- KASSERT(td == curthread, ("devfs_allocv: td != curthread"));
dmp = VFSTODEVFS(mp);
if (de->de_flags & DE_DOOMED) {
sx_xunlock(&dmp->dm_lock);
@@ -351,7 +350,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, stru
VI_LOCK(vp);
mtx_unlock(&devfs_de_interlock);
sx_xunlock(&dmp->dm_lock);
- error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td);
+ error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread);
sx_xlock(&dmp->dm_lock);
if (devfs_allocv_drop_refs(0, dmp, de)) {
if (error == 0)
@@ -761,7 +760,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock)
de = TAILQ_FIRST(&dd->de_dlist); /* "." */
de = TAILQ_NEXT(de, de_list); /* ".." */
de = de->de_dir;
- error = devfs_allocv(de, dvp->v_mount, vpp, td);
+ error = devfs_allocv(de, dvp->v_mount, vpp);
*dm_unlock = 0;
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
return (error);
@@ -844,7 +843,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock)
return (0);
}
}
- error = devfs_allocv(de, dvp->v_mount, vpp, td);
+ error = devfs_allocv(de, dvp->v_mount, vpp);
*dm_unlock = 0;
return (error);
}
@@ -870,7 +869,6 @@ devfs_mknod(struct vop_mknod_args *ap)
{
struct componentname *cnp;
struct vnode *dvp, **vpp;
- struct thread *td;
struct devfs_dirent *dd, *de;
struct devfs_mount *dmp;
int error;
@@ -886,7 +884,6 @@ devfs_mknod(struct vop_mknod_args *ap)
cnp = ap->a_cnp;
vpp = ap->a_vpp;
- td = cnp->cn_thread;
dd = dvp->v_data;
error = ENOENT;
@@ -904,7 +901,7 @@ devfs_mknod(struct vop_mknod_args *ap)
if (de == NULL)
goto notfound;
de->de_flags &= ~DE_WHITEOUT;
- error = devfs_allocv(de, dvp->v_mount, vpp, td);
+ error = devfs_allocv(de, dvp->v_mount, vpp);
return (error);
notfound:
sx_xunlock(&dmp->dm_lock);
@@ -1427,12 +1424,8 @@ devfs_symlink(struct vop_symlink_args *ap)
struct devfs_dirent *dd;
struct devfs_dirent *de;
struct devfs_mount *dmp;
- struct thread *td;
-
- td = ap->a_cnp->cn_thread;
- KASSERT(td == curthread, ("devfs_symlink: td != curthread"));
- error = priv_check(td, PRIV_DEVFS_SYMLINK);
+ error = priv_check(curthread, PRIV_DEVFS_SYMLINK);
if (error)
return(error);
dmp = VFSTODEVFS(ap->a_dvp->v_mount);
@@ -1451,7 +1444,7 @@ devfs_symlink(struct vop_symlink_args *ap)
mac_devfs_create_symlink(ap->a_cnp->cn_cred, dmp->dm_mount, dd, de);
#endif
TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list);
- return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp, td));
+ return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp));
}
static int
OpenPOWER on IntegriCloud