summaryrefslogtreecommitdiffstats
path: root/sys/fs/devfs/devfs_devs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/devfs/devfs_devs.c')
-rw-r--r--sys/fs/devfs/devfs_devs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index 81b2752..4bd6728 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -115,17 +115,21 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev_priv, CTLFLAG_RD,
0, sizeof(struct cdev_priv), "sizeof(struct cdev_priv)");
struct cdev *
-devfs_alloc(void)
+devfs_alloc(int flags)
{
struct cdev_priv *cdp;
struct cdev *cdev;
struct timespec ts;
- cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO | M_WAITOK);
+ cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO |
+ ((flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK));
+ if (cdp == NULL)
+ return (NULL);
cdp->cdp_dirents = &cdp->cdp_dirent0;
cdp->cdp_dirent0 = NULL;
cdp->cdp_maxdirent = 0;
+ cdp->cdp_inode = 0;
cdev = &cdp->cdp_c;
@@ -133,6 +137,7 @@ devfs_alloc(void)
LIST_INIT(&cdev->si_children);
vfs_timestamp(&ts);
cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts;
+ cdev->si_cred = NULL;
return (cdev);
}
OpenPOWER on IntegriCloud