Date: Wed, 26 Nov 2025 07:45:51 -0700 From: Warner Losh <imp@bsdimp.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Warner Losh <imp@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 301b8a806f79 - main - nvme: Minor style(9) fixes Message-ID: <CANCZdfqt5GzVo2PtEHpAXyjbMDK1KyO3i0ib9WrLiz-XL_Sjiw@mail.gmail.com> In-Reply-To: <aSbtPT6JZZWO-rtv@kib.kiev.ua> References: <6925d6af.3b42c.336a0065@gitrepo.freebsd.org> <aSbtPT6JZZWO-rtv@kib.kiev.ua>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Wed, Nov 26, 2025 at 5:06 AM Konstantin Belousov <kostikbel@gmail.com> wrote: > On Tue, Nov 25, 2025 at 04:17:51PM +0000, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=301b8a806f79292ee3324ca938a4d938df1911e8 > > > > commit 301b8a806f79292ee3324ca938a4d938df1911e8 > > Author: Warner Losh <imp@FreeBSD.org> > > AuthorDate: 2025-11-25 16:10:23 +0000 > > Commit: Warner Losh <imp@FreeBSD.org> > > CommitDate: 2025-11-25 16:12:51 +0000 > > > > nvme: Minor style(9) fixes > > > > <sys/systm.h> needs to be first after <sys/param.h>. And we don't > need > > both sys/param.h and sys/types.h. > > We do not both sys/param.h and sys/systm.h as well, since sys/systm.h > includes sys/param.h. > Style(9): Kernel include files (sys/*.h) come first. If either <sys/types.h> or <sys/param.h> is needed, include it before other include files. (<sys/param.h> includes <sys/types.h>; do not include both.) Next, include <sys/systm.h>, if needed. The remaining kernel headers should be sorted alphabetically. Should I update it to say just include systm.h over param.h over types.h? Or is there some other rule to follow that we should document? A quick survey suggests this is often the case, but a large minority of the time both or even all three are included. However, in this case, I needed to keep it separate because nvme.h is included by userland and I thought systm.h was kernel only (without checking)... but systm.h does seem to have all the proper guards to make that ok... Warner [-- Attachment #2 --] <div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Nov 26, 2025 at 5:06 AM Konstantin Belousov <<a href="mailto:kostikbel@gmail.com">kostikbel@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Nov 25, 2025 at 04:17:51PM +0000, Warner Losh wrote:<br> > The branch main has been updated by imp:<br> > <br> > URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=301b8a806f79292ee3324ca938a4d938df1911e8" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=301b8a806f79292ee3324ca938a4d938df1911e8</a><br> > <br> > commit 301b8a806f79292ee3324ca938a4d938df1911e8<br> > Author: Warner Losh <imp@FreeBSD.org><br> > AuthorDate: 2025-11-25 16:10:23 +0000<br> > Commit: Warner Losh <imp@FreeBSD.org><br> > CommitDate: 2025-11-25 16:12:51 +0000<br> > <br> > nvme: Minor style(9) fixes<br> > <br> > <sys/systm.h> needs to be first after <sys/param.h>. And we don't need<br> > both sys/param.h and sys/types.h.<br> <br> We do not both sys/param.h and sys/systm.h as well, since sys/systm.h<br> includes sys/param.h.<br></blockquote><div><br></div><div class="gmail_quote gmail_quote_container">Style(9):</div> Kernel include files (sys/*.h) come first. If either <sys/types.h> or<br> <sys/param.h> is needed, include it before other include files.<br> (<sys/param.h> includes <sys/types.h>; do not include both.) Next,<br> include <sys/systm.h>, if needed. The remaining kernel headers should be<br> sorted alphabetically.<br><div><br></div><div>Should I update it to say just include systm.h over param.h over types.h? Or is there some other rule to follow that we should document? A quick survey suggests this is often the case, but a large minority of the time both or even all three are included.</div><div><br></div><div>However, in this case, I needed to keep it separate because nvme.h is included by userland and I thought systm.h was kernel only (without checking)... but systm.h does seem to have all the proper guards to make that ok...</div><div><br></div><div>Warner </div></div></div>help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqt5GzVo2PtEHpAXyjbMDK1KyO3i0ib9WrLiz-XL_Sjiw>
