lkml.org 
[lkml]   [2005]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: kobject_uevent.c moved to kernel connector.
From
Date
On Wed, 2005-01-19 at 15:05 -0800, Greg KH wrote:
> On Thu, Jan 13, 2005 at 01:15:19AM +0300, Evgeniy Polyakov wrote:
> > --- include/linux/connector.h~ 2005-01-13 00:21:55.000000000 +0300
> > +++ include/linux/connector.h 2005-01-13 00:53:21.000000000 +0300
> > @@ -24,6 +24,9 @@
> >
> > #include <asm/types.h>
> >
> > +#define CONN_IDX_KOBJECT_UEVENT 0xabcd
> > +#define CONN_VAL_KOBJECT_UEVENT 0x0000
> > +
> > #define CONNECTOR_MAX_MSG_SIZE 1024
> >
> > struct cb_id
> > --- linux-2.6/drivers/connector/connector.c.orig 2005-01-13 00:21:23.000000000 +0300
> > +++ linux-2.6/drivers/connector/connector.c 2005-01-13 00:32:48.000000000 +0300
> > @@ -46,6 +46,8 @@
> >
> > static struct cn_dev cdev;
> >
> > +int cn_already_initialized = 0;
>
> <snip>
>
> Hm, this patch needs to be rediffed, now that I've accepted the
> connector code, right? The connector.c change seems to already be in
> your last connector patch, and the .h change is there with a different
> #define spelling, causing the uevent code to need to be changed.
>
> Care to redo it?

Sure. Patch attached.

Thank you.

> thanks,
>
> greg k-h

--
Evgeniy Polyakov

Crash is better than data corruption -- Arthur Grabowski
--- linux-2.6/lib/kobject_uevent.c.orig 2005-01-13 00:45:55.000000000 +0300
+++ linux-2.6/lib/kobject_uevent.c 2005-01-13 00:34:05.000000000 +0300
@@ -12,6 +12,7 @@
* Kay Sievers <kay.sievers@vrfy.org>
* Arjan van de Ven <arjanv@redhat.com>
* Greg Kroah-Hartman <greg@kroah.com>
+ * Evgeniy Polyakov <johnpol@2ka.mipt.ru>
*/

#include <linux/spinlock.h>
@@ -21,6 +22,7 @@
#include <linux/string.h>
#include <linux/kobject_uevent.h>
#include <linux/kobject.h>
+#include <linux/connector.h>
#include <net/sock.h>

#define BUFFER_SIZE 1024 /* buffer for the hotplug env */
@@ -53,6 +55,68 @@
#ifdef CONFIG_KOBJECT_UEVENT
static struct sock *uevent_sock;

+#ifdef CONFIG_CONNECTOR
+static struct cb_id uid = {CN_IDX_KOBJECT_UEVENT, CN_VAL_KOBJECT_UEVENT};
+static void kobject_uevent_connector_callback(void *data)
+{
+}
+
+static void kobject_uevent_send_connector(const char *signal, const char *obj, char **envp, int gfp_mask)
+{
+ if (cn_already_initialized) {
+ int size;
+ struct cn_msg *msg;
+ static int uevent_connector_initialized;
+
+ if (!uevent_connector_initialized) {
+ cn_add_callback(&uid, "kobject_uevent", kobject_uevent_connector_callback);
+ uevent_connector_initialized = 1;
+ }
+
+
+ size = strlen(signal) + strlen(obj) + 2 + BUFFER_SIZE + sizeof(*msg);
+ msg = kmalloc(size, gfp_mask);
+ if (msg) {
+ u8 *pos;
+ int len;
+
+ msg->len = size - sizeof(*msg);
+
+ memcpy(&msg->id, &uid, sizeof(msg->id));
+
+ size -= sizeof(*msg);
+
+ pos = (u8 *)(msg + 1);
+
+ len = snprintf(pos, size, "%s@%s", signal, obj);
+ len++;
+ size -= len;
+ pos += len;
+
+ if (envp) {
+ int i;
+
+ for (i = 2; envp[i]; i++) {
+ len = strlen(envp[i]) + 1;
+ snprintf(pos, size, "%s", envp[i]);
+ size -= len;
+ pos += len;
+ }
+ }
+
+ cn_netlink_send(msg, 0);
+
+ kfree(msg);
+ }
+ }
+}
+#else
+static void kobject_uevent_send_connector(const char *signal, const char *obj, char **envp, int gfp_mask)
+{
+}
+#endif
+
+
/**
* send_uevent - notify userspace by sending event trough netlink socket
*
@@ -93,6 +157,8 @@
}
}

+ kobject_uevent_send_connector(signal, obj, envp, gfp_mask);
+
return netlink_broadcast(uevent_sock, skb, 0, 1, gfp_mask);
}
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.055 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site