summaryrefslogtreecommitdiff
path: root/hald/linux2/osspec.c
diff options
context:
space:
mode:
authorDavid Zeuthen <david@fubar.dk>2005-04-27 18:53:39 +0000
committerDavid Zeuthen <david@fubar.dk>2005-04-27 18:53:39 +0000
commit74db51271c37f2ba4ce4069dad3593747c65edaa (patch)
tree23ce3373285a8916903c4d49cb920ab237a6057c /hald/linux2/osspec.c
parent0a381f48681c4b2772d7aee18eb91b4fa00e1c67 (diff)
Remove prototype for the function hal_util_get_device_file().
Remove (hal_util_get_device_file): Remove Move from osspec.c (hal_util_get_sysfs_to_dev_map): New function (coldplug_synthesize_events): Get the sysfs->dev map in one go using 'udevinfo -d' available in udev since at least version 057. Bump dbus requirement to 0.33 since the new dbus is out. Don't leak the DBusMessage objects Don't leak the error and actually return FALSE if sender is unprivileged. Also fix up spelling.
Diffstat (limited to 'hald/linux2/osspec.c')
-rw-r--r--hald/linux2/osspec.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/hald/linux2/osspec.c b/hald/linux2/osspec.c
index c229ecca..82c33ab3 100644
--- a/hald/linux2/osspec.c
+++ b/hald/linux2/osspec.c
@@ -522,110 +522,6 @@ osspec_device_reprobe (HalDevice *d)
return hotplug_reprobe_tree (d);
}
-/* Returns the path of the udevinfo program
- *
- * @return Path or NULL if udevinfo program is not found
- */
-static const gchar *
-hal_util_get_udevinfo_path (void)
-{
- guint i;
- struct stat s;
- static gchar *path = NULL;
- gchar *possible_paths[] = {
- "/sbin/udevinfo",
- "/usr/bin/udevinfo",
- "/usr/sbin/udevinfo",
- "/usr/local/sbin/udevinfo"
- };
-
- if (path != NULL)
- return path;
-
- for (i = 0; i < sizeof (possible_paths) / sizeof (char *); i++) {
- if (stat (possible_paths[i], &s) == 0 && S_ISREG (s.st_mode)) {
- path = possible_paths[i];
- break;
- }
- }
- return path;
-}
-
-/** Get the name of the special device file given the sysfs path.
- *
- * @param sysfs_path Path to class device in sysfs
- * @param dev_file Where the special device file name should be stored
- * @param dev_file_length Size of dev_file character array
- * @return TRUE only if the device file could be found
- */
-gboolean
-hal_util_get_device_file (const gchar *sysfs_path, gchar *dev_file, gsize dev_file_length)
-{
- int i;
- gsize sysfs_path_len;
- gsize sysfs_mount_path_len;
- gchar sysfs_path_trunc[HAL_PATH_MAX];
- gchar sysfs_path_dev_trunc[HAL_PATH_MAX + 4];
- char *udev_argv[7] = { NULL,
- "-r", "-q", "name", "-p",
- sysfs_path_trunc, NULL };
- char *udev_stdout;
- char *udev_stderr;
- int udev_exitcode;
- struct stat statbuf;
-
- /* check for dev file in sysfs path */
- sysfs_path_len = strlen (sysfs_path);
- strncpy (sysfs_path_dev_trunc, sysfs_path, HAL_PATH_MAX);
- strncat (sysfs_path_dev_trunc + sysfs_path_len, "/dev", 4);
- if (stat (sysfs_path_dev_trunc, &statbuf) != 0)
- return FALSE;
-
- /* get path to udevinfo */
- udev_argv[0] = (char *) hal_util_get_udevinfo_path ();
- if (udev_argv[0] == NULL)
- return FALSE;
-
- /* compute truncated sysfs path as udevinfo doesn't want the sysfs_mount_path (e.g. /sys) prefix */
- sysfs_mount_path_len = strlen (hal_sysfs_path);
- if (strlen (sysfs_path) > sysfs_mount_path_len) {
- strncpy (sysfs_path_trunc, sysfs_path + sysfs_mount_path_len, HAL_PATH_MAX - sysfs_mount_path_len);
- }
-
- /* Now invoke udevinfo */
- if (udev_argv[0] == NULL || g_spawn_sync ("/",
- udev_argv,
- NULL,
- 0,
- NULL,
- NULL,
- &udev_stdout,
- &udev_stderr,
- &udev_exitcode,
- NULL) != TRUE) {
- HAL_ERROR (("Couldn't invoke %s", udev_argv[0]));
- return FALSE;
- }
-
- if (udev_exitcode != 0) {
- HAL_ERROR (("%s returned %d for %s", udev_argv[0], udev_exitcode, sysfs_path_trunc));
- return FALSE;
- }
-
- /* sanitize string returned by udev */
- for (i = 0; udev_stdout[i] != 0; i++) {
- if (udev_stdout[i] == '\r' || udev_stdout[i] == '\n') {
- udev_stdout[i] = 0;
- break;
- }
- }
-
- /*HAL_INFO (("got device file %s for %s", udev_stdout, sysfs_path));*/
-
- strncpy (dev_file, udev_stdout, dev_file_length);
- return TRUE;
-}
-
gboolean
hal_util_set_driver (HalDevice *d, const char *property_name, const char *sysfs_path)
{