chiark / gitweb /
[PATCH] update the FAQ due to the latest devfs mess on lkml and also due to symlinks...
[elogind.git] / udev-add.c
index 174331fadeae7318c24894e0fca79ace631d4e7b..17b69eadabc620abde5b12b817801f306b8668b1 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "udev.h"
 #include "udev_version.h"
+#include "udev_dbus.h"
 #include "namedev.h"
 #include "udevdb.h"
 #include "libsysfs/libsysfs.h"
 static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev)
 {
        int retval = -ENODEV;
-
        char *dev;
 
        dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev");
        if (dev == NULL)
                goto exit;
-
        dbg("dev='%s'", dev);
 
        if (sscanf(dev, "%u:%u", &udev->major, &udev->minor) != 2)
                goto exit;
-
        dbg("found major=%d, minor=%d", udev->major, udev->minor);
 
        retval = 0;
@@ -100,46 +98,6 @@ static int create_path(char *file)
        return 0;
 }
 
-#ifdef USE_DBUS
-/** Send out a signal that a device node is created
- *
- *  @param  dev                 udevice object
- *  @param  path                Sysfs path of device
- */
-static void sysbus_send_create(struct udevice *dev, const char *path)
-{
-        char filename[255];
-        DBusMessage* message;
-        DBusMessageIter iter;
-
-        if (sysbus_connection == NULL)
-                return;
-
-        strncpy(filename, udev_root, sizeof(filename));
-        strncat(filename, dev->name, sizeof(filename));
-
-        /* object, interface, member */
-        message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", 
-                                          "org.kernel.udev.NodeMonitor",
-                                          "NodeCreated");
-        
-        dbus_message_iter_init(message, &iter);
-        dbus_message_iter_append_string(&iter, filename);
-        dbus_message_iter_append_string(&iter, path);
-
-        if ( !dbus_connection_send(sysbus_connection, message, NULL) )
-                dbg("error sending d-bus signal");
-
-        dbus_message_unref(message);
-        
-        dbus_connection_flush(sysbus_connection);
-}
-#endif /* USE_DBUS */
-
-/*
- * we possibly want to add some symlinks here
- * only numeric owner/group id's are supported
- */
 static int create_node(struct udevice *dev)
 {
        char filename[255];
@@ -151,7 +109,6 @@ static int create_node(struct udevice *dev)
        int i;
        int tail;
 
-
        strncpy(filename, udev_root, sizeof(filename));
        strncat(filename, dev->name, sizeof(filename));
 
@@ -274,7 +231,6 @@ static struct sysfs_class_device *get_class_dev(char *device_name)
 
        strcpy(dev_path, sysfs_path);
        strcat(dev_path, device_name);
-
        dbg("looking at '%s'", dev_path);
 
        /* open up the sysfs class device for this thing... */
@@ -359,11 +315,8 @@ int udev_add_device(char *path, char *subsystem)
        dbg("name='%s'", dev.name);
        retval = create_node(&dev);
 
-#ifdef USE_DBUS
-        if (retval == 0) {
-                sysbus_send_create(&dev, path);
-        }
-#endif /* USE_DBUS */
+       if (retval == 0)
+               sysbus_send_create(&dev, path);
 
 exit:
        if (class_dev)