diff options
| author | Jaakko Heinonen <jh@FreeBSD.org> | 2010-09-27 18:20:56 +0000 |
|---|---|---|
| committer | Jaakko Heinonen <jh@FreeBSD.org> | 2010-09-27 18:20:56 +0000 |
| commit | 47bcfb64225e811c8a56707de45ca2cabe2be628 (patch) | |
| tree | eff74ceea454ebea211167dc46d11a36f767385d /sys | |
| parent | d318c565d74496343ec299b3ace0ae9eb744dba1 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/fs/devfs/devfs_devs.c | 21 | ||||
| -rw-r--r-- | sys/fs/devfs/devfs_int.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 99b33ec4bd27..52e6567069b4 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -142,6 +142,27 @@ devfs_alloc(int flags) return (cdev); } +int +devfs_dev_exists(const char *name) +{ + struct cdev_priv *cdp; + + mtx_assert(&devmtx, MA_OWNED); + + TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) { + if ((cdp->cdp_flags & CDP_ACTIVE) == 0) + continue; + if (devfs_pathpath(cdp->cdp_c.si_name, name) != 0) + return (1); + if (devfs_pathpath(name, cdp->cdp_c.si_name) != 0) + return (1); + } + if (devfs_dir_find(name) != 0) + return (1); + + return (0); +} + void devfs_free(struct cdev *cdev) { diff --git a/sys/fs/devfs/devfs_int.h b/sys/fs/devfs/devfs_int.h index cd58284bc505..df16f1843344 100644 --- a/sys/fs/devfs/devfs_int.h +++ b/sys/fs/devfs/devfs_int.h @@ -72,6 +72,7 @@ struct cdev_priv { #define cdev2priv(c) member2struct(cdev_priv, cdp_c, c) struct cdev *devfs_alloc(int); +int devfs_dev_exists(const char *); void devfs_free(struct cdev *); void devfs_create(struct cdev *dev); void devfs_destroy(struct cdev *dev); |
