Skip to content

Commit c48ca72

Browse files
committed
make_dev.9: Fix mda_cr typo + polish
The make_dev_args_init structure example said mda_cred, however the correct form is mda_cr according to the reporter and my git grep. A new document description has been contributed by jhb. While here, fix grammar and trivial typos (spacing, colons before examples, trailing delimiter) and spdx. MFC after: 3 days Reported by: jhb (much polish and document description) Reported by: Evgenii Ivanov on Community Discord Reviewed by: carlavilla, mhorne, jhb, kib Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D48516
1 parent 975c6f3 commit c48ca72

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

share/man/man9/make_dev.9

+24-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.\"
2+
.\" SPDX-License-Identifier: BSD-2-Clause
3+
.\"
14
.\" Copyright (c) 1999 Chris Costello
25
.\" All rights reserved.
36
.\"
@@ -22,7 +25,7 @@
2225
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2326
.\" SUCH DAMAGE.
2427
.\"
25-
.Dd March 2, 2016
28+
.Dd January 19, 2025
2629
.Dt MAKE_DEV 9
2730
.Os
2831
.Sh NAME
@@ -38,9 +41,7 @@
3841
.Nm destroy_dev_sched_cb ,
3942
.Nm destroy_dev_drain ,
4043
.Nm dev_depends
41-
.Nd manage
42-
.Vt cdev Ns 's
43-
and DEVFS registration for devices
44+
.Nd create and destroy character devices including devfs registration
4445
.Sh SYNOPSIS
4546
.In sys/param.h
4647
.In sys/conf.h
@@ -105,6 +106,7 @@ struct make_dev_args {
105106
void *mda_si_drv2;
106107
};
107108
.Ed
109+
.Pp
108110
Before use and filling with the desired values, the structure must be
109111
initialized by the
110112
.Fn make_dev_args_init
@@ -166,10 +168,10 @@ member of the initialized
166168
The
167169
.Va args.mda_flags
168170
argument alters the operation of
169-
.Fn make_dev_s.
171+
.Fn make_dev_s .
170172
The following values are currently accepted:
171173
.Pp
172-
.Bl -tag -width "It Dv MAKEDEV_CHECKNAME" -compact -offset indent
174+
.Bl -tag -width "MAKEDEV_CHECKNAME" -compact -offset indent
173175
.It Dv MAKEDEV_REF
174176
reference the created device
175177
.It Dv MAKEDEV_NOWAIT
@@ -200,12 +202,13 @@ is specified.
200202
.Pp
201203
The
202204
.Xr dev_clone 9
203-
event handler shall specify
205+
event handler shall specify the
204206
.Dv MAKEDEV_REF
205-
flag when creating a device in response to lookup, to avoid race where
206-
the device created is destroyed immediately after
207-
.Xr devfs_lookup 9
208-
drops his reference to cdev.
207+
flag when creating a device in response to lookup, to avoid a race where
208+
the created device is immediately destroyed after
209+
.Fn devfs_lookup
210+
drops its reference to
211+
.Fa cdev .
209212
.Pp
210213
The
211214
.Dv MAKEDEV_ETERNAL
@@ -226,13 +229,14 @@ and the device name is invalid or already exists.
226229
.Pp
227230
The
228231
.Fn make_dev_p
229-
use of the form
232+
use of the form:
230233
.Bd -literal -offset indent
231234
struct cdev *dev;
232235
int res;
233236
res = make_dev_p(flags, &dev, cdevsw, cred, uid, gid, perms, name);
234237
.Ed
235-
is equivalent to the code
238+
.Pp
239+
is equivalent to the code:
236240
.Bd -literal -offset indent
237241
struct cdev *dev;
238242
struct make_dev_args args;
@@ -241,7 +245,7 @@ int res;
241245
make_dev_args_init(&args);
242246
args.mda_flags = flags;
243247
args.mda_devsw = cdevsw;
244-
args.mda_cred = cred;
248+
args.mda_cr = cred;
245249
args.mda_uid = uid;
246250
args.mda_gid = gid;
247251
args.mda_mode = perms;
@@ -250,10 +254,11 @@ res = make_dev_s(&args, &dev, name);
250254
.Pp
251255
Similarly, the
252256
.Fn make_dev_credf
253-
function call is equivalent to
257+
function call is equivalent to:
254258
.Bd -literal -offset indent
255-
(void) make_dev_s(&args, &dev, name);
259+
(void) make_dev_s(&args, &dev, name);
256260
.Ed
261+
.Pp
257262
In other words,
258263
.Fn make_dev_credf
259264
does not allow the caller to obtain the return value, and in
@@ -263,14 +268,14 @@ options, the function asserts that the device creation succeeded.
263268
.Pp
264269
The
265270
.Fn make_dev_cred
266-
function is equivalent to the call
271+
function is equivalent to the call:
267272
.Bd -literal -offset indent
268273
make_dev_credf(0, cdevsw, unit, cr, uid, gid, perms, fmt, ...);
269274
.Ed
270275
.Pp
271276
The
272277
.Fn make_dev
273-
function call is the same as
278+
function call is the same as:
274279
.Bd -literal -offset indent
275280
make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...);
276281
.Ed
@@ -377,7 +382,7 @@ is called, with argument
377382
.Fa arg .
378383
The
379384
.Fn destroy_dev_sched
380-
function is the same as
385+
function is the same as:
381386
.Bd -literal -offset indent
382387
destroy_dev_sched_cb(cdev, NULL, NULL);
383388
.Ed

0 commit comments

Comments
 (0)