From nobody Thu Dec 01 14:44:15 2022 X-Original-To: hackers@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 4NNJkG1Wpgz4jNj9 for ; Thu, 1 Dec 2022 14:44:22 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward500o.mail.yandex.net (forward500o.mail.yandex.net [37.140.190.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4NNJkF5xPXz40dF; Thu, 1 Dec 2022 14:44:21 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Authentication-Results: mx1.freebsd.org; none Received: from myt6-870ea81e6a0f.qloud-c.yandex.net (myt6-870ea81e6a0f.qloud-c.yandex.net [IPv6:2a02:6b8:c12:2229:0:640:870e:a81e]) by forward500o.mail.yandex.net (Yandex) with ESMTP id A1FBF94105A; Thu, 1 Dec 2022 17:44:17 +0300 (MSK) Received: by myt6-870ea81e6a0f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id FiT2qwCYhGk1-Mpq82FMb; Thu, 01 Dec 2022 17:44:17 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1669905857; bh=95HCStpixel8e4ewFx6d+rfK3F7y68XdKyCmDLbmeDs=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=Bq6bUWmvVOwsbZs4qC5xT0THNwYJSBx4Xhxjzir7Iy1KqmWflTeKWLpyiT49vF1iH TNaJsl+7S7T1NeewTXPTjrzojuZWQ9laChdi1Mhs8FQ0Js4/6pl2Rr1hcPQdQE6Sbf rPuSqizNcqd3aUdMLZp0tvCIxVJSyHJHSx48jQUs= Content-Type: text/plain; charset=utf-8 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: devctl_notify system is inconsistent From: "Alexander V. Chernikov" In-Reply-To: <20221201083559.xx3v5jn7sf44rfmv@aniel.nours.eu> Date: Thu, 1 Dec 2022 14:44:15 +0000 Cc: hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <93B61739-04EF-4C68-9C91-516AA8FA4418@ipfw.ru> References: <20221201083559.xx3v5jn7sf44rfmv@aniel.nours.eu> To: Baptiste Daroussin X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Rspamd-Queue-Id: 4NNJkF5xPXz40dF X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13238, ipnet:37.140.128.0/18, country:RU] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N > On 1 Dec 2022, at 08:35, Baptiste Daroussin wrote: >=20 > Hello, >=20 > After the addition of netlink(4) by melifaro@, I started working on a = new > genetlink(4) module, to send kernel notification to the userland via = netlink. >=20 > The goal is to be able to have multiple consumers without the need of = devd to be > running. >=20 > The goal is also to be able subscribe to the events the consumer is = willing to > receive. >=20 > https://reviews.freebsd.org/D37574 >=20 > I also added a hook to devctl_notify to make sure all its event got = sent via > nlsysevent. (https://reviews.freebsd.org/D37573) >=20 > It works great and so far I am happy with it. on thing I figured out = it is: > the "system" argment of devctl_notify is inconsistent: > Upper case vs lower case > "kern" vs "kernel" >=20 > I intent to fix the following way: > Create a new function similar to devctl_notify but with the first = argument being > an enum. I don=E2=80=99t have enough domain knowledge here, but generally, one of = the important changes in generic netlink was to move away from the = enum-like identifiers shared across the modules to strings. Having a single enum for the subsystem names would be hard for the = third-part module authors as they have to guess/compete for the numbers. I=E2=80=99d advocate for leaving them as strings (maybe with enforcing = some naming rules). =20 > Make the current devctl_notify convert its first argument into that = enum and > yell if an unkwown "system" is passed. (and probably declare = devctl_notify > deprecated) >=20 > Then fix the inconsistencies: all upper case as it seems the most = wildly use > case > s/kern/kernel/g >=20 > WDYT? >=20 > Best regards, > Bapt >=20