What's tha KOBJ_MAX action used for?

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Mon Jul 13 22:15:23 EDT 2020


On Mon, 13 Jul 2020 14:35:23 +0200, Greg KH said:
> On Mon, Jul 13, 2020 at 01:17:25PM +0200, Garrit Franke wrote:
> > Hi all,
> >
> > I was wondering, what the KOBJ_MAX action in the kobject.h file does.
> > It is self explainatory what KOBJ_ADD, KOBJ_REMOVE etc. are used for, but KOBJ_MAX puzzles me.

> > Can it maybe even be removed?
>
> Maybe it can, try it and see!

I suspect that this line:
        for (action = 0; action < ARRAY_SIZE(kobject_actions); action++) {
in lib/kobject_uenvent.c:kobject_action_type()  combined with the fact that
kobject_actions[] does *not* actually match the enum regardless of the comment
above it, result in it being superfluous.

Figuring out why is left as an exercise for the student.

Oh, and if I had a dollar for every time I've been surprised by creative abuse of
the cpp ## operator... :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200713/e208d916/attachment.sig>


More information about the Kernelnewbies mailing list