2006-03-14 16:09:29

by Junichi Nomura

[permalink] [raw]
Subject: [PATCH] kobject_uevent CONFIG_SYSFS=n build fix

Hello,

In 2.6.16-rc6 (probably in earlier rc as well),
following build error occurs with CONFIG_SYSFS=n.

kernel/built-in.o(.data+0x1d40): undefined reference to `uevent_helper'
lib/lib.a(kobject_uevent.o)(.text+0x5c1): In function `kobject_uevent':
/build/rc6/source/lib/kobject_uevent.c:152: undefined reference to `uevent_seqnum'
lib/lib.a(kobject_uevent.o)(.text+0x5d0):/build/rc6/source/lib/kobject_uevent.c:152: undefined reference to `uevent_seqnum'
lib/lib.a(kobject_uevent.o)(.text+0x901):/build/rc6/source/lib/kobject_uevent.c:182: undefined reference to `uevent_helper'
lib/lib.a(kobject_uevent.o)(.text+0x910):/build/rc6/source/lib/kobject_uevent.c:182: undefined reference to `uevent_helper'

This seems to be caused by mismatch of build condition.
uevent_seqnum and uevent_helper are conditional to CONFIG_SYSFS.
While they are referenced if CONFIG_HOTPLUG (and CONFIG_NET) is enabled.

Attached patch consolidates them to CONFIG_HOTPLUG && CONFIG_NET.

I tried with (!CONFIG_NET && CONFIG_SYSFS) and
(CONFIG_NET && !CONFIG_SYSFS).
Both built ok.
So I think it doesn't conflict with "[PATCH] kobject_uevent CONFIG_NET=n
fix" which is in 2.6.16-rc6.

Thanks,
--
Jun'ichi Nomura, NEC Solutions (America), Inc.


Attachments:
nosysfs-build.patch (3.20 kB)

2006-03-14 22:01:33

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] kobject_uevent CONFIG_SYSFS=n build fix

On Tue, Mar 14, 2006 at 11:11:00AM -0500, Jun'ichi Nomura wrote:
> Hello,
>
> In 2.6.16-rc6 (probably in earlier rc as well),
> following build error occurs with CONFIG_SYSFS=n.
>
> kernel/built-in.o(.data+0x1d40): undefined reference to `uevent_helper'
> lib/lib.a(kobject_uevent.o)(.text+0x5c1): In function `kobject_uevent':
> /build/rc6/source/lib/kobject_uevent.c:152: undefined reference to `uevent_seqnum'
> lib/lib.a(kobject_uevent.o)(.text+0x5d0):/build/rc6/source/lib/kobject_uevent.c:152: undefined reference to `uevent_seqnum'
> lib/lib.a(kobject_uevent.o)(.text+0x901):/build/rc6/source/lib/kobject_uevent.c:182: undefined reference to `uevent_helper'
> lib/lib.a(kobject_uevent.o)(.text+0x910):/build/rc6/source/lib/kobject_uevent.c:182: undefined reference to `uevent_helper'
>
> This seems to be caused by mismatch of build condition.
> uevent_seqnum and uevent_helper are conditional to CONFIG_SYSFS.
> While they are referenced if CONFIG_HOTPLUG (and CONFIG_NET) is enabled.
>
> Attached patch consolidates them to CONFIG_HOTPLUG && CONFIG_NET.
>
> I tried with (!CONFIG_NET && CONFIG_SYSFS) and
> (CONFIG_NET && !CONFIG_SYSFS).
> Both built ok.
> So I think it doesn't conflict with "[PATCH] kobject_uevent CONFIG_NET=n
> fix" which is in 2.6.16-rc6.
>
> Thanks,
> --
> Jun'ichi Nomura, NEC Solutions (America), Inc.

> CONFIG_SYSFS=n fails to build due to mismatch of conditions
> for uevent_seqnum and uevent_helper.
>
> kernel/built-in.o(.data+0x1d40): undefined reference to `uevent_helper'
> lib/lib.a(kobject_uevent.o)(.text+0x5c1): In function `kobject_uevent':
> /build/rc6/source/lib/kobject_uevent.c:152: undefined reference to `uevent_seqnum'
> lib/lib.a(kobject_uevent.o)(.text+0x5d0):/build/rc6/source/lib/kobject_uevent.c:152: undefined reference to `uevent_seqnum'
> lib/lib.a(kobject_uevent.o)(.text+0x901):/build/rc6/source/lib/kobject_uevent.c:182: undefined reference to `uevent_helper'
> lib/lib.a(kobject_uevent.o)(.text+0x910):/build/rc6/source/lib/kobject_uevent.c:182: undefined reference to `uevent_helper'
>
> Signed-off-by: Jun'ichi Nomura <[email protected]>
>
>
> --- linux-2.6.16-rc6.orig/lib/kobject_uevent.c 2006-03-14 08:57:23.000000000 -0500
> +++ linux-2.6.16-rc6/lib/kobject_uevent.c 2006-03-14 08:52:57.000000000 -0500
> @@ -26,6 +26,9 @@
> #define NUM_ENVP 32 /* number of env pointers */
>
> #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
> +u64 uevent_seqnum;
> +char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";

No, the seqnum and helper can be called even if we have not defined
CONFIG_NET. Please redo the patch based on this.

thanks,

greg k-h

2006-03-14 23:58:39

by Junichi Nomura

[permalink] [raw]
Subject: Re: [PATCH] kobject_uevent CONFIG_SYSFS=n build fix

Hi Greg,

Greg KH wrote:
>> #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
>>+u64 uevent_seqnum;
>>+char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
>
> No, the seqnum and helper can be called even if we have not defined
> CONFIG_NET. Please redo the patch based on this.

OK, thanks for the comment.
I thought it could be conditional on CONFIG_NET because
it's used only from kobject_uevent() except for
kernel/ksysfs.c which just exports them to sysfs.
Are there other users? Or do you mean we have to keep
sysfs files for user space?

Attached patch makes them conditional on CONFIG_HOTPLUG only.
Build tested with both (!CONFIG_NET && CONFIG_SYSFS) and
(CONFIG_NET && !CONFIG_SYSFS).
Does this look correct?

Thanks,
--
Jun'ichi Nomura, NEC Solutions (America), Inc.


Attachments:
kobject_uevent-config_sysfs_n-build-fix.patch (1.56 kB)

2006-03-15 00:09:57

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] kobject_uevent CONFIG_SYSFS=n build fix

On Tue, Mar 14, 2006 at 07:00:17PM -0500, Jun'ichi Nomura wrote:
> --- linux-2.6.16-rc6-mm1.orig/lib/kobject_uevent.c 2006-03-14 22:57:23.000000000 +0900
> +++ linux-2.6.16-rc6-mm1/lib/kobject_uevent.c 2006-03-15 08:39:33.000000000 +0900
> @@ -25,6 +25,11 @@
> #define BUFFER_SIZE 2048 /* buffer for the variables */
> #define NUM_ENVP 32 /* number of env pointers */
>
> +#ifdef CONFIG_HOTPLUG
> +u64 uevent_seqnum;
> +char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
> +#endif
> +
> #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
> static DEFINE_SPINLOCK(sequence_lock);
> static struct sock *uevent_sock;
> --- linux-2.6.16-rc6-mm1.orig/kernel/ksysfs.c 2006-03-14 22:57:31.000000000 +0900
> +++ linux-2.6.16-rc6-mm1/kernel/ksysfs.c 2006-03-15 08:41:11.000000000 +0900
> @@ -15,9 +15,6 @@
> #include <linux/module.h>
> #include <linux/init.h>
>
> -u64 uevent_seqnum;
> -char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
> -
> #define KERNEL_ATTR_RO(_name) \
> static struct subsys_attribute _name##_attr = __ATTR_RO(_name)
>

Those two changes look correct. But why did you modify kobject.h below?

> --- linux-2.6.16-rc6-mm1.orig/include/linux/kobject.h 2006-03-15 00:00:20.000000000 +0900
> +++ linux-2.6.16-rc6-mm1/include/linux/kobject.h 2006-03-15 08:38:45.000000000 +0900
> @@ -27,6 +27,8 @@
> #include <asm/atomic.h>
>
> #define KOBJ_NAME_LEN 20
> +
> +#ifdef CONFIG_HOTPLUG
> #define UEVENT_HELPER_PATH_LEN 256
>
> /* path to the userspace helper executed on an event */
> @@ -34,6 +36,7 @@ extern char uevent_helper[];
>
> /* counter to tag the uevent, read only except for the kobject core */
> extern u64 uevent_seqnum;
> +#endif
>
> /* the actions here must match the proper string in lib/kobject_uevent.c */
> typedef int __bitwise kobject_action_t;

That shouldn't be needed, right?

thanks,

greg k-h

2006-03-15 01:02:07

by Junichi Nomura

[permalink] [raw]
Subject: Re: [PATCH] kobject_uevent CONFIG_SYSFS=n build fix

Hi,

Greg KH wrote:
>>@@ -27,6 +27,8 @@
>> #include <asm/atomic.h>
>>
>> #define KOBJ_NAME_LEN 20
>>+
>>+#ifdef CONFIG_HOTPLUG
>> #define UEVENT_HELPER_PATH_LEN 256

> That shouldn't be needed, right?

You're right. They are not needed.
Please disregard that part.

Thanks,
--
Jun'ichi Nomura, NEC Solutions (America), Inc.


Attachments:
kobject_uevent-config_sysfs_n-build-fix.patch (952.00 B)

2006-03-15 05:49:32

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] kobject_uevent CONFIG_SYSFS=n build fix

On Tue, Mar 14, 2006 at 08:03:39PM -0500, Jun'ichi Nomura wrote:
> Hi,
>
> Greg KH wrote:
> >>@@ -27,6 +27,8 @@
> >>#include <asm/atomic.h>
> >>
> >>#define KOBJ_NAME_LEN 20
> >>+
> >>+#ifdef CONFIG_HOTPLUG
> >>#define UEVENT_HELPER_PATH_LEN 256
>
> >That shouldn't be needed, right?
>
> You're right. They are not needed.
> Please disregard that part.

Looks good. Care to resend it one more time, this time with a good
changelog description and a Signed-off-by: line?

thanks,

greg k-h

2006-03-15 13:27:22

by Junichi Nomura

[permalink] [raw]
Subject: Re: [PATCH] kobject_uevent CONFIG_SYSFS=n build fix

Greg KH wrote:
>>>>+#ifdef CONFIG_HOTPLUG
>>>>#define UEVENT_HELPER_PATH_LEN 256
>>
>>>That shouldn't be needed, right?
>>
>>You're right. They are not needed.
>>Please disregard that part.
>
>
> Looks good. Care to resend it one more time, this time with a good
> changelog description and a Signed-off-by: line?

OK, here you are.
The patch is applicable to either 2.6.16-rc6 or 2.6.16-rc6-mm1.

Thanks,
--
Jun'ichi Nomura, NEC Solutions (America), Inc.


Attachments:
kobject_uevent-config_sysfs_n-build-fix.patch (1.14 kB)