From: Rusty Russell <rusty@rustcorp.com.au>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: zwane@linuxpower.ca, linux-kernel@vger.kernel.org,
hch@infradead.org, Kai Germaschewski <kai.germaschewski@gmx.de>,
sfr@canb.auug.org.au, "Nemosoft Unv." <nemosoft@smcc.demon.nl>,
davem@redhat.com
Subject: Re: SET_MODULE_OWNER?
Date: Tue, 08 Apr 2003 22:25:39 +1000 [thread overview]
Message-ID: <20030409001247.E02A12C482@lists.samba.org> (raw)
In-Reply-To: Your message of "Tue, 08 Apr 2003 00:34:35 -0400." <3E92515B.6030807@pobox.com>
In message <3E92515B.6030807@pobox.com> you write:
> Rusty Russell wrote:
> > Unlike that, substituting dev->owner = THIS_MODULE; has no backwards
> > compatibility loss, and it removes a confusing and pointless macro
> > which *never* had a point.
>
>
> Substituting dev->owner=THIS_MODULE has _obvious_ backwards compat loss,
> because 'owner' member did not exist in struct net_device.
Oh, so SET_MODULE_OWNER is a struct net_device only thing? Certain
authors (myself included) obviously don't know that.
> If you had bothered to even do a trivial grep, you would have seen the
> use to which SET_MODULE_OWNER is being put. Christoph's try* changes
> are annoying but work-around-able. Removal of SET_MODULE_OWNER is not.
If *you* had bothered to do a grep, you would have seen non-netdevice
uses to which it is really being put, as it's managed to thoroughly
confuse coders.
APM, isdn, USB, hell, you even fooled the USAGI guys!
Seriously, adding an owner arg to init_etherdev and friends, or
creating a set of SET_NET_DEVICE_OWNER etc macros would have been
defensible for backwards compatibility.
Rusty.
PS. I didn't fix up ISDN. Kai, want me to do that?
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Move SET_MODULE_OWNER to netdevice.h
Author: Rusty Russell
Status: Completely Untested
D: Jeff points out that SET_MODULE_OWNER is really only for struct
D: net_device, so move it from module.h to netdevice.h and fix up
D: areas which were confused about it (renaming would be nice, but
D: too invasive).
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/arch/i386/kernel/apm.c working-2.5.67-set_owner/arch/i386/kernel/apm.c
--- linux-2.5.67/arch/i386/kernel/apm.c 2003-04-08 11:13:40.000000000 +1000
+++ working-2.5.67-set_owner/arch/i386/kernel/apm.c 2003-04-08 22:03:56.000000000 +1000
@@ -2038,7 +2038,7 @@ static int __init apm_init(void)
apm_proc = create_proc_info_entry("apm", 0, NULL, apm_get_info);
if (apm_proc)
- SET_MODULE_OWNER(apm_proc);
+ apm_proc->owner = THIS_MODULE;
kernel_thread(apm, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/drivers/char/i8k.c working-2.5.67-set_owner/drivers/char/i8k.c
--- linux-2.5.67/drivers/char/i8k.c 2003-02-07 19:22:26.000000000 +1100
+++ working-2.5.67-set_owner/drivers/char/i8k.c 2003-04-08 22:04:33.000000000 +1000
@@ -757,7 +757,7 @@ int __init i8k_init(void)
return -ENOENT;
}
proc_i8k->proc_fops = &i8k_fops;
- SET_MODULE_OWNER(proc_i8k);
+ proc_i8k->owner = THIS_MODULE;
printk(KERN_INFO
"Dell laptop SMM driver v%s Massimo Dal Zotto (dz@debian.org)\n",
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/drivers/usb/media/pwc-if.c working-2.5.67-set_owner/drivers/usb/media/pwc-if.c
--- linux-2.5.67/drivers/usb/media/pwc-if.c 2003-03-18 12:21:38.000000000 +1100
+++ working-2.5.67-set_owner/drivers/usb/media/pwc-if.c 2003-04-08 22:21:30.000000000 +1000
@@ -1805,7 +1805,7 @@ static int usb_pwc_probe(struct usb_inte
}
memcpy(vdev, &pwc_template, sizeof(pwc_template));
strcpy(vdev->name, name);
- SET_MODULE_OWNER(vdev);
+ vdev->owner = THIS_MODULE;
pdev->vdev = vdev;
vdev->priv = pdev;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/include/linux/module.h working-2.5.67-set_owner/include/linux/module.h
--- linux-2.5.67/include/linux/module.h 2003-04-08 11:15:01.000000000 +1000
+++ working-2.5.67-set_owner/include/linux/module.h 2003-04-08 22:13:05.000000000 +1000
@@ -408,7 +408,6 @@ __attribute__((section(".gnu.linkonce.th
#endif /* MODULE */
#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
-#define SET_MODULE_OWNER(dev) ((dev)->owner = THIS_MODULE)
/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/include/linux/netdevice.h working-2.5.67-set_owner/include/linux/netdevice.h
--- linux-2.5.67/include/linux/netdevice.h 2003-04-08 11:15:01.000000000 +1000
+++ working-2.5.67-set_owner/include/linux/netdevice.h 2003-04-08 22:16:01.000000000 +1000
@@ -835,6 +835,11 @@ extern int netdev_fastroute_obstacles;
extern void dev_clear_fastroute(struct net_device *dev);
#endif
+/* For use with struct netdevice, which didn't have an owner field in
+ 2.2 and before: this provides backwards compatibility if you care.
+ Don't use on other structs (unless you know the owner field was
+ added at the same time as struct netdevice's was). */
+#define SET_MODULE_OWNER(dev) ((dev)->owner = THIS_MODULE)
#endif /* __KERNEL__ */
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/net/ipv4/ah.c working-2.5.67-set_owner/net/ipv4/ah.c
--- linux-2.5.67/net/ipv4/ah.c 2003-04-08 11:15:06.000000000 +1000
+++ working-2.5.67-set_owner/net/ipv4/ah.c 2003-04-08 22:20:05.000000000 +1000
@@ -320,6 +320,7 @@ static void ah_destroy(struct xfrm_state
static struct xfrm_type ah_type =
{
.description = "AH4",
+ .owner = THIS_MODULE,
.proto = IPPROTO_AH,
.init_state = ah_init_state,
.destructor = ah_destroy,
@@ -335,7 +336,6 @@ static struct inet_protocol ah4_protocol
static int __init ah4_init(void)
{
- SET_MODULE_OWNER(&ah_type);
if (xfrm_register_type(&ah_type, AF_INET) < 0) {
printk(KERN_INFO "ip ah init: can't add xfrm type\n");
return -EAGAIN;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/net/ipv4/esp.c working-2.5.67-set_owner/net/ipv4/esp.c
--- linux-2.5.67/net/ipv4/esp.c 2003-04-08 11:15:06.000000000 +1000
+++ working-2.5.67-set_owner/net/ipv4/esp.c 2003-04-08 22:20:18.000000000 +1000
@@ -552,6 +552,7 @@ error:
static struct xfrm_type esp_type =
{
.description = "ESP4",
+ .owner = THIS_MODULE,
.proto = IPPROTO_ESP,
.init_state = esp_init_state,
.destructor = esp_destroy,
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/net/ipv6/ah6.c working-2.5.67-set_owner/net/ipv6/ah6.c
--- linux-2.5.67/net/ipv6/ah6.c 2003-04-08 11:15:09.000000000 +1000
+++ working-2.5.67-set_owner/net/ipv6/ah6.c 2003-04-08 22:20:27.000000000 +1000
@@ -318,6 +318,7 @@ static void ah6_destroy(struct xfrm_stat
static struct xfrm_type ah6_type =
{
.description = "AH6",
+ .owner = THIS_MODULE,
.proto = IPPROTO_AH,
.init_state = ah6_init_state,
.destructor = ah6_destroy,
@@ -333,8 +334,6 @@ static struct inet6_protocol ah6_protoco
int __init ah6_init(void)
{
- SET_MODULE_OWNER(&ah6_type);
-
if (xfrm_register_type(&ah6_type, AF_INET6) < 0) {
printk(KERN_INFO "ipv6 ah init: can't add xfrm type\n");
return -EAGAIN;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.67/net/ipv6/esp6.c working-2.5.67-set_owner/net/ipv6/esp6.c
--- linux-2.5.67/net/ipv6/esp6.c 2003-04-08 11:15:09.000000000 +1000
+++ working-2.5.67-set_owner/net/ipv6/esp6.c 2003-04-08 22:20:42.000000000 +1000
@@ -488,6 +488,7 @@ error:
static struct xfrm_type esp6_type =
{
.description = "ESP6",
+ .owner = THIS_MODULE,
.proto = IPPROTO_ESP,
.init_state = esp6_init_state,
.destructor = esp6_destroy,
@@ -504,7 +505,6 @@ static struct inet6_protocol esp6_protoc
int __init esp6_init(void)
{
- SET_MODULE_OWNER(&esp6_type);
if (xfrm_register_type(&esp6_type, AF_INET6) < 0) {
printk(KERN_INFO "ipv6 esp init: can't add xfrm type\n");
return -EAGAIN;
next parent reply other threads:[~2003-04-09 0:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3E92515B.6030807@pobox.com>
2003-04-08 12:25 ` Rusty Russell [this message]
2003-04-09 0:13 ` SET_MODULE_OWNER? David S. Miller
2003-04-09 1:03 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-09 3:23 ` SET_MODULE_OWNER? Rusty Russell
2003-04-09 3:48 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-09 15:00 ` SET_MODULE_OWNER? Kai Germaschewski
[not found] <3E93AA3D.4050104@pobox.com>
2003-04-09 5:27 ` SET_MODULE_OWNER? Rusty Russell
2003-04-07 6:47 SET_MODULE_OWNER? Rusty Russell
2003-04-07 8:17 ` SET_MODULE_OWNER? Christoph Hellwig
2003-04-07 18:29 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 2:01 ` SET_MODULE_OWNER? Rusty Russell
2003-04-08 2:16 ` SET_MODULE_OWNER? Zwane Mwaikambo
2003-04-08 3:41 ` SET_MODULE_OWNER? Rusty Russell
2003-04-08 4:39 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-09 0:46 ` SET_MODULE_OWNER? Rusty Russell
2003-04-09 2:32 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 2:27 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 3:46 ` SET_MODULE_OWNER? Rusty Russell
2003-04-08 6:00 ` SET_MODULE_OWNER? Christoph Hellwig
2003-04-08 11:51 ` SET_MODULE_OWNER? Alan Cox
2003-04-08 14:46 ` SET_MODULE_OWNER? Jamie Lokier
2003-04-08 15:12 ` SET_MODULE_OWNER? Jeff Garzik
2003-04-08 16:45 ` SET_MODULE_OWNER? Jamie Lokier
2003-04-08 17:19 ` SET_MODULE_OWNER? Jeff Garzik
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=20030409001247.E02A12C482@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=davem@redhat.com \
--cc=hch@infradead.org \
--cc=jgarzik@pobox.com \
--cc=kai.germaschewski@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=nemosoft@smcc.demon.nl \
--cc=sfr@canb.auug.org.au \
--cc=zwane@linuxpower.ca \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox