Add revoke_and_destroy_dev(), to be used by devices which decide when

they choose to destroy themselves without regard to whether or not
they are open.
This commit is contained in:
Brian Feldman 2002-02-16 17:35:05 +00:00
parent 6112fceebd
commit 1fd9f8f438
3 changed files with 15 additions and 0 deletions

View File

@ -361,6 +361,19 @@ make_dev_alias(dev_t pdev, const char *fmt, ...)
return (dev);
}
void
revoke_and_destroy_dev(dev_t dev)
{
struct vnode *vp;
GIANT_REQUIRED;
vp = SLIST_FIRST(&dev->si_hlist);
if (vp != NULL)
VOP_REVOKE(vp, REVOKEALL);
destroy_dev(dev);
}
void
destroy_dev(dev_t dev)
{

View File

@ -317,6 +317,7 @@ int cdevsw_add __P((struct cdevsw *new));
int cdevsw_remove __P((struct cdevsw *old));
int count_dev __P((dev_t dev));
void destroy_dev __P((dev_t dev));
void revoke_and_destroy_dev __P((dev_t dev));
struct cdevsw *devsw __P((dev_t dev));
const char *devtoname __P((dev_t dev));
int dev_named __P((dev_t pdev, const char *name));

View File

@ -317,6 +317,7 @@ int cdevsw_add __P((struct cdevsw *new));
int cdevsw_remove __P((struct cdevsw *old));
int count_dev __P((dev_t dev));
void destroy_dev __P((dev_t dev));
void revoke_and_destroy_dev __P((dev_t dev));
struct cdevsw *devsw __P((dev_t dev));
const char *devtoname __P((dev_t dev));
int dev_named __P((dev_t pdev, const char *name));