The cdevpriv_dtr_t typedef was not able to be used in a function prototype

like the various d_*_t typedefs since it declared a function pointer rather
than a function.  Add a new d_priv_dtor_t typedef that declares the function
and can be used as a function prototype.  The previous typedef wasn't
useful outside of the cdevpriv implementation, so retire it.

The name d_priv_dtor_t was chosen to be more consistent with cdev methods
since it is commonly used in place of d_close_t even though it is not a
direct pointer in struct cdevsw.

Reviewed by:	kib, imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D4340
This commit is contained in:
John Baldwin 2015-12-02 18:27:30 +00:00
parent 60862d8e48
commit 8d7e0f5889
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291653
3 changed files with 6 additions and 6 deletions

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 20, 2015
.Dd December 2, 2015
.Dt DEVFS_CDEVPRIV 9
.Os
.Sh NAME
@ -36,12 +36,12 @@
.In sys/param.h
.In sys/conf.h
.Bd -literal
typedef void (*cdevpriv_dtr_t)(void *data);
typedef void d_priv_dtor_t(void *data);
.Ed
.Ft int
.Fn devfs_get_cdevpriv "void **datap"
.Ft int
.Fn devfs_set_cdevpriv "void *priv" "cdevpriv_dtr_t dtr"
.Fn devfs_set_cdevpriv "void *priv" "d_priv_dtor_t *dtr"
.Ft void
.Fn devfs_clear_cdevpriv "void"
.Sh DESCRIPTION

View File

@ -151,7 +151,7 @@ devfs_get_cdevpriv(void **datap)
}
int
devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t priv_dtr)
devfs_set_cdevpriv(void *priv, d_priv_dtor_t *priv_dtr)
{
struct file *fp;
struct cdev_priv *cdp;

View File

@ -277,9 +277,9 @@ void setconf(void);
#define dev2unit(d) ((d)->si_drv0)
typedef void (*cdevpriv_dtr_t)(void *data);
typedef void d_priv_dtor_t(void *data);
int devfs_get_cdevpriv(void **datap);
int devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr);
int devfs_set_cdevpriv(void *priv, d_priv_dtor_t *dtr);
void devfs_clear_cdevpriv(void);
void devfs_fpdrop(struct file *fp); /* XXX This is not public KPI */