chiark / gitweb /
[PATCH] move all of the DBUS logic into one file and remove all of the #ifdef crud...
[elogind.git] / udev-remove.c
index 307b907..02c8437 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "udev.h"
 #include "udev_version.h"
+#include "udev_dbus.h"
 #include "namedev.h"
 #include "udevdb.h"
 #include "libsysfs/libsysfs.h"
@@ -100,42 +101,6 @@ static int delete_node(struct udevice *dev)
        return retval;
 }
 
-#ifdef USE_DBUS
-/** Send out a signal that a device node is deleted
- *
- *  @param  name                Name of the device node, e.g. /udev/sda1
- *  @param  path                Sysfs path of device
- */
-static void sysbus_send_remove(const char* name, const char *path)
-{
-        char filename[255];
-        DBusMessage* message;
-        DBusMessageIter iter;
-
-        if (sysbus_connection == NULL)
-                return;
-
-        strncpy(filename, udev_root, sizeof(filename));
-        strncat(filename, name, sizeof(filename));
-
-        /* object, interface, member */
-        message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", 
-                                          "org.kernel.udev.NodeMonitor",
-                                          "NodeDeleted");
-        
-        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 */
-
 /*
  * Look up the sysfs path in the database to see if we have named this device
  * something different from the kernel name.  If we have, us it.  If not, use
@@ -159,9 +124,7 @@ int udev_remove_device(char *path, char *subsystem)
        dbg("name is '%s'", dev->name);
        udevdb_delete_dev(path);
 
-#ifdef USE_DBUS
-       sysbus_send_remove(name, device);
-#endif /* USE_DBUS */
-  
+       sysbus_send_remove(name, path);
+
        return delete_node(dev);
 }