aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/devfs
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-07-25 00:37:34 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-07-25 00:37:34 +0000
commit2295126d7e1104ad862b090c6cd21cf8a69d2d99 (patch)
tree0c39775a3a9600208f2e27a8b897181fe49923d3 /sys/fs/devfs
parentc4bb3188e95bc6a6daea7fe4b8a0172acca4d1c3 (diff)
Notes
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r--sys/fs/devfs/devfs_devs.c3
-rw-r--r--sys/fs/devfs/devfs_int.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index 984ff2748441..cb79635595e0 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -138,6 +138,8 @@ devfs_alloc(int flags)
if (cdp == NULL)
return (NULL);
+ mtx_init(&cdp->cdp_threadlock, "devthrd", NULL, MTX_DEF);
+
cdp->cdp_dirents = &cdp->cdp_dirent0;
cdev = &cdp->cdp_c;
@@ -180,6 +182,7 @@ devfs_free(struct cdev *cdev)
devfs_free_cdp_inode(cdp->cdp_inode);
if (cdp->cdp_maxdirent > 0)
free(cdp->cdp_dirents, M_DEVFS2);
+ mtx_destroy(&cdp->cdp_threadlock);
free(cdp, M_CDEVP);
}
diff --git a/sys/fs/devfs/devfs_int.h b/sys/fs/devfs/devfs_int.h
index c5ed46ebc905..4b23e4fce272 100644
--- a/sys/fs/devfs/devfs_int.h
+++ b/sys/fs/devfs/devfs_int.h
@@ -70,6 +70,8 @@ struct cdev_priv {
void *cdp_dtr_cb_arg;
LIST_HEAD(, cdev_privdata) cdp_fdpriv;
+
+ struct mtx cdp_threadlock;
};
#define cdev2priv(c) __containerof(c, struct cdev_priv, cdp_c)