Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Oct 2010 15:56:21 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214277 - head/share/man/man9
Message-ID:  <201010241556.o9OFuLkE032990@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Sun Oct 24 15:56:21 2010
New Revision: 214277
URL: http://svn.freebsd.org/changeset/base/214277

Log:
  Document make_dev_p(9).
  
  Reviewed by:	brueffer, kib

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/make_dev.9

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Sun Oct 24 15:44:23 2010	(r214276)
+++ head/share/man/man9/Makefile	Sun Oct 24 15:56:21 2010	(r214277)
@@ -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 \

Modified: head/share/man/man9/make_dev.9
==============================================================================
--- head/share/man/man9/make_dev.9	Sun Oct 24 15:44:23 2010	(r214276)
+++ head/share/man/man9/make_dev.9	Sun Oct 24 15:56:21 2010	(r214277)
@@ -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, ui
 .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, 
 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 .



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010241556.o9OFuLkE032990>