Document make_dev_p(9).
Reviewed by: brueffer, kib
This commit is contained in:
parent
126799a04f
commit
8c0783a03a
@ -775,7 +775,8 @@ MLINKS+=make_dev.9 destroy_dev.9 \
|
||||
make_dev.9 dev_depends.9 \
|
||||
make_dev.9 make_dev_alias.9 \
|
||||
make_dev.9 make_dev_cred.9 \
|
||||
make_dev.9 make_dev_credf.9
|
||||
make_dev.9 make_dev_credf.9 \
|
||||
make_dev.9 make_dev_p.9
|
||||
MLINKS+=malloc.9 free.9 \
|
||||
malloc.9 MALLOC_DECLARE.9 \
|
||||
malloc.9 MALLOC_DEFINE.9 \
|
||||
|
@ -24,13 +24,14 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 7, 2010
|
||||
.Dd October 24, 2010
|
||||
.Dt MAKE_DEV 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm make_dev ,
|
||||
.Nm make_dev_cred ,
|
||||
.Nm make_dev_credf ,
|
||||
.Nm make_dev_p ,
|
||||
.Nm make_dev_alias ,
|
||||
.Nm destroy_dev ,
|
||||
.Nm destroy_dev_sched ,
|
||||
@ -49,6 +50,8 @@ and DEVFS registration for devices
|
||||
.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
|
||||
.Ft struct cdev *
|
||||
.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
|
||||
.Ft int
|
||||
.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ...
|
||||
.Ft struct cdev *
|
||||
.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ...
|
||||
.Ft void
|
||||
@ -128,20 +131,22 @@ member of the initialized
|
||||
The
|
||||
.Va flags
|
||||
argument alters the operation of
|
||||
.Fn make_dev_credf .
|
||||
.Fn make_dev_credf
|
||||
or
|
||||
.Fn make_dev_p .
|
||||
The following values are currently accepted:
|
||||
.Pp
|
||||
.Bl -tag -width "MAKEDEV_CHECKNAME" -compact -offset indent
|
||||
.It MAKEDEV_REF
|
||||
reference the created device
|
||||
.It MAKEDEV_NOWAIT
|
||||
do not sleep, may return NULL
|
||||
do not sleep, the call may fail
|
||||
.It MAKEDEV_WAITOK
|
||||
allow the function to sleep to satisfy malloc
|
||||
.It MAKEDEV_ETERNAL
|
||||
created device will be never destroyed
|
||||
.It MAKEDEV_CHECKNAME
|
||||
return NULL if the device name is invalid or already exists
|
||||
return an error if the device name is invalid or already exists
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
@ -190,6 +195,14 @@ make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...);
|
||||
.Ed
|
||||
.Pp
|
||||
The
|
||||
.Fn make_dev_p
|
||||
function is similar to
|
||||
.Fn make_dev_credf
|
||||
but it may return an error number and takes a pointer to the resulting
|
||||
.Ft *cdev
|
||||
as an argument.
|
||||
.Pp
|
||||
The
|
||||
.Fn make_dev_alias
|
||||
function takes the returned
|
||||
.Ft cdev
|
||||
@ -293,6 +306,44 @@ is called for all instantiated devices, but need to postpone module
|
||||
unload until
|
||||
.Fn destroy_dev
|
||||
is actually finished for all of them.
|
||||
.Sh RETURN VALUES
|
||||
If successful,
|
||||
.Fn make_dev_p
|
||||
will return 0, otherwise it will return an error.
|
||||
If successful,
|
||||
.Fn make_dev_credf
|
||||
will return a valid
|
||||
.Fa cdev
|
||||
pointer, otherwise it will return
|
||||
.Dv NULL .
|
||||
.Sh ERRORS
|
||||
The
|
||||
.Fn make_dev_p
|
||||
call will fail and the device will be not registered if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er ENOMEM
|
||||
The
|
||||
.Dv MAKEDEV_NOWAIT
|
||||
flags was specified and a memory allocation request could not be satisfied.
|
||||
.It Bq Er ENAMETOOLONG
|
||||
The
|
||||
.Dv MAKEDEV_CHECKNAME
|
||||
flags was specified and the provided device name is longer than
|
||||
.Dv SPECNAMELEN .
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Dv MAKEDEV_CHECKNAME
|
||||
flags was specified and the provided device name is empty, contains a
|
||||
.Qq \&.
|
||||
or
|
||||
.Qq ..
|
||||
path component or ends with
|
||||
.Ql / .
|
||||
.It Bq Er EEXIST
|
||||
The
|
||||
.Dv MAKEDEV_CHECKNAME
|
||||
flags was specified and the provided device name already exists.
|
||||
.El
|
||||
.Pp
|
||||
.Sh SEE ALSO
|
||||
.Xr devctl 4 ,
|
||||
@ -320,3 +371,7 @@ The functions
|
||||
.Fn destroy_dev_sched_cb
|
||||
first appeared in
|
||||
.Fx 7.0 .
|
||||
The function
|
||||
.Fn make_dev_p
|
||||
first appeared in
|
||||
.Fx 8.2 .
|
||||
|
Loading…
x
Reference in New Issue
Block a user