linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: Greg KH <greg@kroah.com>
Cc: linux-hotplug-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: kobject_uevent.c moved to kernel connector.
Date: Thu, 20 Jan 2005 08:48:26 +0000	[thread overview]
Message-ID: <1106210906.5264.46.camel@uganda> (raw)
In-Reply-To: <20050119230518.GA5569@kroah.com>


[-- Attachment #1.1: Type: text/plain, Size: 1266 bytes --]

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

[-- Attachment #1.2: kobject_connector.patch --]
[-- Type: text/x-patch, Size: 2353 bytes --]

--- 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);
 }
 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-01-20  8:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1101286481.18807.66.camel@uganda>
     [not found] ` <1101287606.18807.75.camel@uganda>
     [not found]   ` <20041124222857.GG3584@kroah.com>
     [not found]     ` <1102504677.3363.55.camel@uganda>
     [not found]       ` <20041221204101.GA9831@kroah.com>
     [not found]         ` <1103707272.3432.6.camel@uganda>
     [not found]           ` <20041225180241.38ffb9d8@zanzibar.2ka.mipt.ru>
     [not found]             ` <20050104060211.50c2bf47@zanzibar.2ka.mipt.ru>
     [not found]               ` <20050112190615.GC10885@kroah.com>
2005-01-12 21:54                 ` kobject_uevent.c moved to kernel connector Evgeniy Polyakov
2005-01-19 23:05                   ` Greg KH
2005-01-20  8:48                     ` Evgeniy Polyakov [this message]
2005-01-20 17:47                       ` Greg KH

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=1106210906.5264.46.camel@uganda \
    --to=johnpol@2ka.mipt.ru \
    --cc=greg@kroah.com \
    --cc=linux-hotplug-devel@lists.sourceforge.net \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).