Remove filemon->lock wrappers.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2016-03-02 00:13:13 +00:00
parent 3b77ac5f9e
commit e0dae8f1c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296286
3 changed files with 18 additions and 45 deletions

View File

@ -127,7 +127,7 @@ filemon_dtr(void *data)
/* Follow same locking order as filemon_pid_check. */
filemon_lock_write();
filemon_filemon_lock(filemon);
sx_xlock(&filemon->lock);
/* Remove from the in-use list. */
TAILQ_REMOVE(&filemons_inuse, filemon, link);
@ -140,7 +140,7 @@ filemon_dtr(void *data)
TAILQ_INSERT_TAIL(&filemons_free, filemon, link);
/* Give up write access. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
filemon_unlock_write();
if (fp != NULL)
@ -160,7 +160,7 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
if ((error = devfs_get_cdevpriv((void **) &filemon)) != 0)
return (error);
filemon_filemon_lock(filemon);
sx_xlock(&filemon->lock);
switch (cmd) {
/* Set the output file descriptor. */
@ -191,7 +191,7 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
break;
}
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
return (error);
}

View File

@ -28,20 +28,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
static __inline void
filemon_filemon_lock(struct filemon *filemon)
{
sx_xlock(&filemon->lock);
}
static __inline void
filemon_filemon_unlock(struct filemon *filemon)
{
sx_xunlock(&filemon->lock);
}
static __inline void
filemon_lock_read(void)
{

View File

@ -79,7 +79,7 @@ filemon_pid_check(struct proc *p)
TAILQ_FOREACH(filemon, &filemons_inuse, link) {
if (p == filemon->p) {
sx_sunlock(&proctree_lock);
filemon_filemon_lock(filemon);
sx_xlock(&filemon->lock);
filemon_unlock_read();
return (filemon);
}
@ -110,8 +110,7 @@ filemon_wrapper_chdir(struct thread *td, struct chdir_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -139,8 +138,7 @@ filemon_event_process_exec(void *arg __unused, struct proc *p,
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
free(freepath, M_TEMP);
}
@ -178,8 +176,7 @@ filemon_wrapper_open(struct thread *td, struct open_args *uap)
curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -231,8 +228,7 @@ filemon_wrapper_openat(struct thread *td, struct openat_args *uap)
curproc->p_pid, filemon->fname2, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -260,8 +256,7 @@ filemon_wrapper_rename(struct thread *td, struct rename_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -289,8 +284,7 @@ filemon_wrapper_link(struct thread *td, struct link_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -318,8 +312,7 @@ filemon_wrapper_symlink(struct thread *td, struct symlink_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -347,8 +340,7 @@ filemon_wrapper_linkat(struct thread *td, struct linkat_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -374,8 +366,7 @@ filemon_wrapper_stat(struct thread *td, struct stat_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -403,8 +394,7 @@ filemon_wrapper_freebsd32_stat(struct thread *td,
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -439,8 +429,7 @@ filemon_event_process_exit(void *arg __unused, struct proc *p)
filemon->p = NULL;
}
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -463,8 +452,7 @@ filemon_wrapper_unlink(struct thread *td, struct unlink_args *uap)
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}
@ -485,8 +473,7 @@ filemon_event_process_fork(void *arg __unused, struct proc *p1,
filemon_output(filemon, filemon->msgbufr, len);
/* Unlock the found filemon structure. */
filemon_filemon_unlock(filemon);
sx_xunlock(&filemon->lock);
}
}