Date: Thu, 1 Dec 2022 14:44:15 +0000 From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: Baptiste Daroussin <bapt@FreeBSD.org> Cc: hackers@freebsd.org Subject: Re: devctl_notify system is inconsistent Message-ID: <93B61739-04EF-4C68-9C91-516AA8FA4418@ipfw.ru> In-Reply-To: <20221201083559.xx3v5jn7sf44rfmv@aniel.nours.eu> References: <20221201083559.xx3v5jn7sf44rfmv@aniel.nours.eu>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 1 Dec 2022, at 08:35, Baptiste Daroussin <bapt@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?93B61739-04EF-4C68-9C91-516AA8FA4418>