[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201026081059.GB2628@hirez.programming.kicks-ass.net>
Date: Mon, 26 Oct 2020 09:10:59 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc: Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Ard Biesheuvel <ardb@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Jann Horn <jannh@...gle.com>,
Will Deacon <will@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 49/56] refcount.h: fix a kernel-doc markup
On Sat, Oct 24, 2020 at 08:28:27AM +0200, Mauro Carvalho Chehab wrote:
> If the intent is to document the struct and its internal fields,
> this kernel-doc should work:
>
> /**
> * struct refcount_struct - variant of atomic_t specialized for reference counts
> * @refs: atomic_t counter field
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> */
>
> Which produces this result:
Who cares... :-(
> If you want both, then you would either split struct and typedef, e. g.
> with something like:
>
> /**
> * struct refcount_struct - variant of atomic_t specialized for reference counts
> * @refs: atomic_t counter field
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> */
> struct refcount_struct {
> atomic_t refs;
> };
>
> /**
> * typedef refcount_t - variant of atomic_t specialized for reference counts
> * @refs: atomic_t counter field
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> */
> typedef struct refcount_struct refcount_t;
>
> Or, you could add the member at the description field. E. g. something
> like this:
>
> /**
> * typedef refcount_t - variant of atomic_t specialized for reference counts
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> *
> * Members:
> * ``refs``
> * atomic_t counter field
> */
> typedef struct refcount_struct {
> atomic_t refs;
> } refcount_t;
>
> If you want to test it, you can run kernel-doc directly, to see how
> it will parse it. For ReST output, that's the syntax:
>
> ./scripts/kernel-doc --sphinx-version 3 include/linux/refcount.h
I'll just go ahead and remove the superfluous * from the comment... It's
trivially clear what is meant. If the stupid tool can't deal with that,
I don't care.
All this wanking about docs and making perfectly fine comments bloody
unreadable shit has to stop.
Powered by blists - more mailing lists