All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luciano Coelho <luciano.coelho@nokia.com>
To: ext Jan Engelhardt <jengelh@medozas.de>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>,
	"kaber@trash.net" <kaber@trash.net>,
	Timo Teras <timo.teras@iki.fi>
Subject: Re: [PATCH v2] netfilter: Xtables: idletimer target implementation
Date: Thu, 03 Jun 2010 00:01:25 +0300	[thread overview]
Message-ID: <1275512485.2797.46.camel@powerslave> (raw)
In-Reply-To: <1275509088.2797.29.camel@powerslave>

On Wed, 2010-06-02 at 22:04 +0200, Coelho Luciano (Nokia-D/Helsinki)
wrote:
> What causes printk to appear under /sys/module even when compiled in, is
> that it uses a module param.  This line:
> 
> module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
> 
> ...is what triggers the printk directory to be created in sysfs.  If I
> add a similar line in my module, it shows up there too.
> 
> I still don't know if there is an actual kobject associated with it,
> I'll check that next.

Okay, so here is how it goes: if the module is linked into the kernel
and it has module parameters, the kernel creates a kobj for it as a
module_ktype without parent, which will cause it to show up
in /sys/modules.

I could do the same in the module initialization when THIS_MODULE ==
NULL, but I don't see any other module doing this.  In fact, I only see
the kernel itself creating kobjects of module_ktype (in load_module()
and in the case I just described).  Smells like a terrible hack to do
that in the module itself... :(

Adding bogus parameters to the module just to trig the kernel to create
the kobject also seems to be too hacky...

-- 
Cheers,
Luca.


  reply	other threads:[~2010-06-02 21:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02 13:41 [PATCH v2] netfilter: Xtables: idletimer target implementation Luciano Coelho
2010-06-02 15:16 ` Jan Engelhardt
2010-06-02 18:37   ` Luciano Coelho
2010-06-02 19:05     ` Luciano Coelho
2010-06-02 19:29       ` Jan Engelhardt
2010-06-02 19:52         ` Luciano Coelho
2010-06-02 20:04           ` Luciano Coelho
2010-06-02 21:01             ` Luciano Coelho [this message]
2010-06-03  7:04               ` Luciano Coelho
2010-06-03  7:58                 ` Jan Engelhardt
2010-06-03 10:13                   ` Luciano Coelho
2010-06-03 13:17                     ` Luciano Coelho

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=1275512485.2797.46.camel@powerslave \
    --to=luciano.coelho@nokia.com \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=timo.teras@iki.fi \
    /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.