All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: David Laight <David.Laight@ACULAB.COM>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 3/5] genetlink: statically initialize families
Date: Tue, 25 Oct 2016 13:38:28 +0200	[thread overview]
Message-ID: <1477395508.4390.23.camel@sipsolutions.net> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB0209D95@AcuExch.aculab.com>

On Tue, 2016-10-25 at 11:25 +0000, David Laight wrote:

> > Actually, with the new system where it's not const, I could even
> > split this up and submit per subsystem, i.e. the fourth patch
> > doesn't depend on it. I thought it would, since I wanted to make it
> > const, but since I failed it doesn't actually have that dependency.
> 
> Actually, why aren't the structures 'const' ?
> 
> You could use a #define to set the .ops and .n_ops fields.
> (and maybe .module = THIS_MODULE as well).

This stuff isn't the problem - after this patch these are of course
statically initialized and const.

The problem is that the struct members family->id, family->mcgrp_offset 
and family->attrbuf, are only determined at genl_register_family().

I considered simply moving them into a new struct, that contains just
those along with a pointer to the family, but then I have essentially
two choices:

1) look up the registration struct by the family every time I need the
   family ID, which is all the time; that would be rather inefficient

2) change *all* genetlink code to not pass the family but rather pass a
   pointer returned by genl_register_family(); that's a massive change

So on the whole, I decided that __ro_after_init was entirely reasonable
and then even this patch isn't really necessary, but since I had it
anyway it still seemed to make sense, even if I had to add all those
forward declarations.

johannes

  reply	other threads:[~2016-10-25 11:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 12:40 [PATCH 0/5] genetlink improvements Johannes Berg
2016-10-24 12:40 ` [PATCH 1/5] genetlink: introduce and use genl_family_attrbuf() Johannes Berg
2016-10-24 12:40 ` [PATCH 2/5] genetlink: no longer support using static family IDs Johannes Berg
2016-10-24 12:40 ` [PATCH 3/5] genetlink: statically initialize families Johannes Berg
2016-10-24 12:55   ` Johannes Berg
2016-10-25 11:25     ` David Laight
2016-10-25 11:38       ` Johannes Berg [this message]
2016-10-24 12:40 ` [PATCH 4/5] genetlink: use idr to track families Johannes Berg
2016-10-24 12:40 ` [PATCH 5/5] genetlink: mark families as __ro_after_init Johannes Berg
2016-10-27 20:16 ` [PATCH 0/5] genetlink improvements David Miller
2016-11-01 17:28 ` new kmemleak reports (was: Re: [PATCH 0/5] genetlink improvements) Jakub Kicinski
2016-11-01 18:32   ` Cong Wang
2016-11-01 18:56     ` Jakub Kicinski
2016-11-02 20:30       ` Cong Wang
2016-11-02 23:47         ` [RFC] make kmemleak scan __ro_after_init section " Jakub Kicinski
2016-11-02 23:47           ` Jakub Kicinski
2016-11-03  5:40           ` Cong Wang
2016-11-03  5:40             ` Cong Wang
2016-11-03 15:48           ` Johannes Berg
2016-11-03 15:48             ` Johannes Berg
2016-11-03 20:49           ` Catalin Marinas
2016-11-03 20:49             ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477395508.4390.23.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=David.Laight@ACULAB.COM \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.