From nobody Thu Feb 27 01:13:56 2025 X-Original-To: dev-commits-src-all@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 4Z3Cz91Ncyz5pMyY; Thu, 27 Feb 2025 01:13:57 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3Cz90lBCz3vnG; Thu, 27 Feb 2025 01:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740618837; 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=pSq+R4AmZ8UCHAxiYJRESisnLBUu7ewNb7AIXnzNBpE=; b=BlDiEUDqMXrvNoukObdrgAyHNFC+8+pYBZEfn6ltCoj+0Eyf8BfVhPIIMHSXNvW8zI+pKS V4m+lW1RnQLS7M7pUnVM97NaO9mON/dDI2MFBKs8QlQ6BFROytY3Mc0f/EgynwZfOg0lGT pveTMBm6qLCJD6dNGYdSrQ9dhqPbwFZOX9e3+jl6tpaSwCjCOggHqRLbY1zYXBhORMOILZ 23F0lwtA0k+dZelltG1a59Ki6dessR/60eeBF4kS+OrOq0CDtnmSMFP7pkT6+EMI+rpq5a NWP+py5Ey1r8BQnOA7zousLPPT176bUJBK5pnm0PhBO0am9j2EjddJhwPYw7yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740618837; a=rsa-sha256; cv=none; b=DV/0hNfngSwU5Ic/3b3niVoyoA40duU9GU9Wz6Wk1j2UQtV7wZjl7tIlKaJ1hhLXmWFXQA dcfjhwPOnINEAOu4XcqnC/dbQlpzRSFQ/1uz5oCktC0S1U8EF1N0nCGxeLUwu+WDuMNaEE tTyUv9YUihMOizEbZr+AseWVdVkZoBV7G3YwJhvxoJicp6VcyEKI3hK1+ORVUfuXYo5SPS PW89+4b5EdexjN74pPyxWgr85rlC9Xc3/SyfSC3LLSMmi/RFM+pSAo6u8tO5y7qMqV+n5d zL3LGZdYLFOwNuH338bvoLYkpR21FdatvDGiw6mh9RqQm6PYqDntgo1FMTbgKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740618837; 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=pSq+R4AmZ8UCHAxiYJRESisnLBUu7ewNb7AIXnzNBpE=; b=hjdk/0yIPwY3ZqdB88jCuvzunukqugTsEbP9oYcQMvUG8oIofamUAuGgY5qeLlB8JkJrKz CY504zOWurLzNp3za4MoGNar2/gJOciXIStuveRGIjLUh9Ei6S0zXy22Lgp20qa7Ky9PvR /mNCnsmn4eDkJuaiVprYuNDRf98varDt4/zJYT0yelJal6kUZ5IYNdP7oeanpc7bwwv/WI K5OOtXRy9IEG4xROJkg57VgqrKRX/KP+DVBE1c/tMtM64qkDsL4B7uQ8Y/u5r14VVW17kr Jljt5sFzlnQzhNBYf2iTNr7Vhw6dsGqZ/Z+eG2pdvD3xIa9QrfkyhnGV+yXdqQ== 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 4Z3Cz90KjBz5rY; Thu, 27 Feb 2025 01:13:57 +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 51R1DuuM054713; Thu, 27 Feb 2025 01:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51R1DuQn054710; Thu, 27 Feb 2025 01:13:56 GMT (envelope-from git) Date: Thu, 27 Feb 2025 01:13:56 GMT Message-Id: <202502270113.51R1DuQn054710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 4e2ab411ce62 - stable/14 - make_dev.9: Fix mda_cr typo + polish List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 4e2ab411ce6239d7918eacfd1c4725bfc9508fa5 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=4e2ab411ce6239d7918eacfd1c4725bfc9508fa5 commit 4e2ab411ce6239d7918eacfd1c4725bfc9508fa5 Author: Alexander Ziaee AuthorDate: 2025-02-11 20:42:27 +0000 Commit: Alexander Ziaee CommitDate: 2025-02-27 00:55:14 +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 (cherry picked from commit c48ca725a83c0c8b27210d50977835c0b916bf07) --- 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 2beb38586593..052f9a0cfd87 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