From nobody Tue Feb 11 20:48:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YstpG0R9cz5mhZ7; Tue, 11 Feb 2025 20:48:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YstpF685Pz40nK; Tue, 11 Feb 2025 20:48:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739306933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YHualwq368PHu0EfxdSq6IU/nLz+mVFW9qh/sMuSRzU=; b=pi5ekmrPwy4cq/Q3rLD/U9wu2b5JX+AZBcy86bXZr88X3/565fGYeDUnY7WGYgM2wcbXE/ a1Vi1xDdevETvJ0UgjFFJ2r06VkuOW6qSwEFbqb1Ucq7AyewnrQ6VqXUgHDGfcvu5yQ6Uv xntKIg/E+FzL77z3sCnT5TvvkjDsS9giT6tKri+RWzw1/adB5NKl1cWc1KE/A+jOzHo+vw dSLIo9txnGPWpBpSCWbeIct0aZmjjLDiMm7ftZ73rfai4VgutQzgt8ZHzHibWFwRsHHqz8 OI4Kamv+0gU58UWc15rdTWDWSXP0eZIHubP9GbMsklvNFTbYO7rLWcZmHb8Xng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739306933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YHualwq368PHu0EfxdSq6IU/nLz+mVFW9qh/sMuSRzU=; b=FKi8XCZg2MSJOgjdDGGCemh2wBUxTR+XvphW5GRep4XtJeKobIPH/k/9Y+R3KpakbKI/qp bzPpF/NaLeTvRVrt00NRFuKEKyynn0NWkWV3o0B2RBY8bkkaBk973WL6Go20FSiFKfSz7N kMu2wWrI9e0tcECCpk8evGt2Kxwcugu0O1XSDa+IHb9+fRD9ZHfaD7ic076tl3dSXtXfjW Hv6TIHIA6wV1chOJxlea17JCNVRUIdFEs+GvtjgsCDW0H0cAk4L2TcWkPBlxjHL/na5AjB JSuC7JyaLAv5BVmTUBwuDvKVlWNL2EEtzaCEoczuVhxYuD1KzQ0EgS/BQ/iz4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739306933; a=rsa-sha256; cv=none; b=wsfpz7jL1iPR5N7wB5y6xaUsEUZvf9YWaXFYZu3TUkIe+NC3x0OqRJrvpotb/U345S8KrT SUezqqfNkaByvi1BqIGI+2m0C0X28gI2tFjbCxA3v785pdgKkj1VodlKR4uqRMhYMnCU7x hzlpPQ2rxDzY6nVuBAmMt3XN5t6OxPecJqL8sV80MtOIAKhIJcaYJbAnNZN3jX+4FzXHpw Ladj+4noub++d7/8YCQzf02ov64ldAC05y8N/1uYP/PJKhSBGZgwnn+G9Ohk+YrHK3tVtF 60NXlWJPZFZgVcK7KjrYdLbFODzzqXggDOBX9ZjsLrxn/BzG99sRIP+vmuYIwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YstpF4S0YzDBR; Tue, 11 Feb 2025 20:48:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51BKmri7092028; Tue, 11 Feb 2025 20:48:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51BKmrYW092025; Tue, 11 Feb 2025 20:48:53 GMT (envelope-from git) Date: Tue, 11 Feb 2025 20:48:53 GMT Message-Id: <202502112048.51BKmrYW092025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: c48ca725a83c - main - make_dev.9: Fix mda_cr typo + polish List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c48ca725a83c0c8b27210d50977835c0b916bf07 Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=c48ca725a83c0c8b27210d50977835c0b916bf07 commit c48ca725a83c0c8b27210d50977835c0b916bf07 Author: Alexander Ziaee AuthorDate: 2025-02-11 20:42:27 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-11 20:47:47 +0000 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 --- share/man/man9/make_dev.9 | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/share/man/man9/make_dev.9 b/share/man/man9/make_dev.9 index 5428b4c7a74e..de56f350faa5 100644 --- a/share/man/man9/make_dev.9 +++ b/share/man/man9/make_dev.9 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 1999 Chris Costello .\" All rights reserved. .\" @@ -22,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 2, 2016 +.Dd January 19, 2025 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -38,9 +41,7 @@ .Nm destroy_dev_sched_cb , .Nm destroy_dev_drain , .Nm dev_depends -.Nd manage -.Vt cdev Ns 's -and DEVFS registration for devices +.Nd create and destroy character devices including devfs registration .Sh SYNOPSIS .In sys/param.h .In sys/conf.h @@ -105,6 +106,7 @@ struct make_dev_args { void *mda_si_drv2; }; .Ed +.Pp Before use and filling with the desired values, the structure must be initialized by the .Fn make_dev_args_init @@ -166,10 +168,10 @@ member of the initialized The .Va args.mda_flags argument alters the operation of -.Fn make_dev_s. +.Fn make_dev_s . The following values are currently accepted: .Pp -.Bl -tag -width "It Dv MAKEDEV_CHECKNAME" -compact -offset indent +.Bl -tag -width "MAKEDEV_CHECKNAME" -compact -offset indent .It Dv MAKEDEV_REF reference the created device .It Dv MAKEDEV_NOWAIT @@ -200,12 +202,13 @@ is specified. .Pp The .Xr dev_clone 9 -event handler shall specify +event handler shall specify the .Dv MAKEDEV_REF -flag when creating a device in response to lookup, to avoid race where -the device created is destroyed immediately after -.Xr devfs_lookup 9 -drops his reference to cdev. +flag when creating a device in response to lookup, to avoid a race where +the created device is immediately destroyed after +.Fn devfs_lookup +drops its reference to +.Fa cdev . .Pp The .Dv MAKEDEV_ETERNAL @@ -226,13 +229,14 @@ and the device name is invalid or already exists. .Pp The .Fn make_dev_p -use of the form +use of the form: .Bd -literal -offset indent struct cdev *dev; int res; res = make_dev_p(flags, &dev, cdevsw, cred, uid, gid, perms, name); .Ed -is equivalent to the code +.Pp +is equivalent to the code: .Bd -literal -offset indent struct cdev *dev; struct make_dev_args args; @@ -241,7 +245,7 @@ int res; make_dev_args_init(&args); args.mda_flags = flags; args.mda_devsw = cdevsw; -args.mda_cred = cred; +args.mda_cr = cred; args.mda_uid = uid; args.mda_gid = gid; args.mda_mode = perms; @@ -250,10 +254,11 @@ res = make_dev_s(&args, &dev, name); .Pp Similarly, the .Fn make_dev_credf -function call is equivalent to +function call is equivalent to: .Bd -literal -offset indent - (void) make_dev_s(&args, &dev, name); +(void) make_dev_s(&args, &dev, name); .Ed +.Pp In other words, .Fn make_dev_credf 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. .Pp The .Fn make_dev_cred -function is equivalent to the call +function is equivalent to the call: .Bd -literal -offset indent make_dev_credf(0, cdevsw, unit, cr, uid, gid, perms, fmt, ...); .Ed .Pp The .Fn make_dev -function call is the same as +function call is the same as: .Bd -literal -offset indent make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...); .Ed @@ -377,7 +382,7 @@ is called, with argument .Fa arg . The .Fn destroy_dev_sched -function is the same as +function is the same as: .Bd -literal -offset indent destroy_dev_sched_cb(cdev, NULL, NULL); .Ed