hal: Branch 'hal-0_5_11-branch' - 6 commits
Danny Kukawka
dkukawka at kemper.freedesktop.org
Fri Apr 18 12:12:42 PDT 2008
doc/spec/hal-spec-properties.xml | 99 +++++++++++++++++--
hald-runner/runner.c | 2
hald-runner/runner.h | 4
hald/create_cache.c | 2
hald/device_info.c | 2
hald/device_store.c | 2
hald/hald.h | 4
hald/hald_dbus.c | 14 +-
hald/hald_runner.c | 2
hald/hald_runner.h | 2
hald/linux/addons/addon-acpi.c | 2
hald/linux/addons/addon-cpufreq-userspace.c | 5 -
hald/linux/addons/addon-cpufreq.c | 6 -
hald/linux/addons/addon-storage.c | 2
hald/linux/addons/addon-usb-csr.c | 10 +-
hald/linux/blockdev.c | 10 +-
hald/linux/coldplug.c | 4
hald/linux/device.c | 139 ++++++++++++++++++++++++++--
hald/linux/hal-file-monitor.c | 2
hald/linux/hotplug.c | 2
hald/linux/pmu.c | 4
hald/linux/probing/probe-pc-floppy.c | 3
hald/linux/probing/probe-serial.c | 3
hald/linux/probing/probe-smbios.c | 25 +++--
hald/linux/probing/probe-volume.c | 14 +-
hald/mmap_cache.c | 5 -
hald/util.c | 92 ------------------
hald/util.h | 4
libhal-storage/libhal-storage.c | 23 ----
libhal/libhal.c | 27 ++---
partutil/partutil.c | 2
tools/hal-storage-closetray.c | 2
tools/hal-storage-eject.c | 2
tools/hal-storage-mount.c | 17 ---
tools/hal-storage-shared.c | 7 -
tools/linux/hal-ipw-killswitch-linux.c | 3
36 files changed, 297 insertions(+), 251 deletions(-)
New commits:
commit 8c1d81c611fb21f73c72945f737b0168cea291d4
Author: David Woodhouse <dwmw2 at infradead.org>
Date: Fri Apr 18 20:51:52 2008 +0200
add support for of_platform subsystem
Added support for of_platform subsystem. The of_platform bus is present
on some PPC boards, it is the bus exposed by the kernel for a bunch of
the SoC devices. Without the patch, half the devices aren't found by HAL.
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 050f54a..537fa7e 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -7466,6 +7466,40 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
No namespace specific properties.
</para>
</sect2>
+
+ <sect2 id="device-properties-of_platform">
+ <title>
+ of_platform namespace
+ </title>
+ <para>
+ Devices on the virtual 'of_platform' bus are represented
+ by device objects where <literal>info.subsystem</literal>
+ equals <literal>of_platform</literal>. The following
+ properties are available for such device objects.
+ </para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Key (type)</entry>
+ <entry>Values</entry>
+ <entry>Mandatory</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <literal>of_platform.id</literal> (string)
+ </entry>
+ <entry>example: f0003000.ethernet</entry>
+ <entry>Yes</entry>
+ <entry>Device identification</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect2>
</sect1>
<sect1 id="properties-misc">
diff --git a/hald/linux/device.c b/hald/linux/device.c
index a846e9e..94fb221 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3776,6 +3776,51 @@ vmbus_compute_udi (HalDevice *d)
/*--------------------------------------------------------------------------------------------------------------*/
static HalDevice *
+of_platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
+ const gchar *sysfs_path_in_devices)
+{
+ HalDevice *d;
+ const gchar *dev_id;
+ gchar buf[64];
+
+ d = hal_device_new ();
+ hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+ hal_device_property_set_string (d, "info.subsystem", "of_platform");
+ if (parent_dev != NULL) {
+ hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+ } else {
+ hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+ }
+
+ hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+ dev_id = hal_util_get_last_element (sysfs_path);
+
+ hal_device_property_set_string (d, "of_platform.id", dev_id);
+
+ g_snprintf (buf, sizeof (buf), "OpenFirmware Platform Device (%s)", hal_device_property_get_string (d, "of_platform.id"));
+ hal_device_property_set_string (d, "info.product", buf);
+
+ return d;
+}
+
+static gboolean
+of_platform_compute_udi (HalDevice *d)
+{
+ gchar udi[256];
+
+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+ "/org/freedesktop/Hal/devices/of_platform_%s",
+ hal_device_property_get_string (d, "of_platform.id"));
+ hal_device_set_udi (d, udi);
+ hal_device_property_set_string (d, "info.udi", udi);
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
{
HalDevice *d;
@@ -4159,6 +4204,14 @@ static DevHandler dev_handler_vmbus =
};
+static DevHandler dev_handler_of_platform =
+{
+ .subsystem = "of_platform",
+ .add = of_platform_add,
+ .compute_udi = of_platform_compute_udi,
+ .remove = dev_remove
+};
+
/* SCSI debug, to test thousends of fake devices */
static DevHandler dev_handler_pseudo = {
.subsystem = "pseudo",
@@ -4208,6 +4261,7 @@ static DevHandler *dev_handlers[] = {
&dev_handler_virtio,
&dev_handler_vio,
&dev_handler_vmbus,
+ &dev_handler_of_platform,
NULL
};
commit af5cd2aeffc37e081794dd533776885c0cbd3a9c
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Fri Apr 18 20:41:51 2008 +0200
fixed a bunch of compiler warnings from the Intel compiler
Fixed a bunch of compiler warnings from the Intel compiler
(cce/icc 10.1.015). Closed a small memory leak in
linux/hal-file-monitor.c
diff --git a/hald-runner/runner.c b/hald-runner/runner.c
index 1184ce2..0ca2aac 100644
--- a/hald-runner/runner.c
+++ b/hald-runner/runner.c
@@ -252,7 +252,7 @@ run_request_run (run_request *r, DBusConnection *con, DBusMessage *msg, GPid *ou
char *program_dir = NULL;
GList *list;
- printf("Run started %s (%d) (%d) \n!", r->argv[0], r->timeout,
+ printf("Run started %s (%u) (%d) \n!", r->argv[0], r->timeout,
r->error_on_stderr);
if (r->input != NULL) {
stdin_p = &stdin_v;
diff --git a/hald-runner/runner.h b/hald-runner/runner.h
index c053381..d063784 100644
--- a/hald-runner/runner.h
+++ b/hald-runner/runner.h
@@ -50,9 +50,9 @@ gboolean run_request_run(run_request *r, DBusConnection *con, DBusMessage *msg,
void run_kill_udi(gchar *udi);
/* Kill all running request*/
-void run_kill_all();
+void run_kill_all(void);
/* initialise the actual runner data */
-void run_init();
+void run_init(void);
#endif /* RUNNER_H */
diff --git a/hald/create_cache.c b/hald/create_cache.c
index bc1cfba..cdc8c9a 100644
--- a/hald/create_cache.c
+++ b/hald/create_cache.c
@@ -300,7 +300,7 @@ static void remember_jump_position(struct fdi_context *fdi_ctx)
if (fdi_ctx->depth >= HAL_MAX_INDENT_DEPTH)
DIE(("Rule depth overflow"));
fdi_ctx->match_at_depth[fdi_ctx->depth++] = fdi_ctx->position;
-};
+}
static void set_jump_position(struct fdi_context *fdi_ctx)
{
diff --git a/hald/device_info.c b/hald/device_info.c
index 22f1836..2381612 100644
--- a/hald/device_info.c
+++ b/hald/device_info.c
@@ -804,7 +804,7 @@ handle_match (struct rule *rule, HalDevice *d)
return FALSE;
}
- return FALSE;
+ // return FALSE;
}
/* we have finished the callouts for a device, now add it to the gdl */
diff --git a/hald/device_store.c b/hald/device_store.c
index ff27dbd..191e251 100644
--- a/hald/device_store.c
+++ b/hald/device_store.c
@@ -364,7 +364,7 @@ void
hal_device_store_print (HalDeviceStore *store)
{
fprintf (stderr, "===============================================\n");
- fprintf (stderr, "Dumping %d devices\n",
+ fprintf (stderr, "Dumping %u devices\n",
g_slist_length (store->devices));
fprintf (stderr, "===============================================\n");
hal_device_store_foreach (store,
diff --git a/hald/hald.h b/hald/hald.h
index 7c55e62..1960595 100644
--- a/hald/hald.h
+++ b/hald/hald.h
@@ -49,8 +49,8 @@ HalDeviceStore *hald_get_tdl (void);
void hald_compute_udi (gchar *dst, gsize dstsize, const gchar *format, ...);
-void property_atomic_update_begin ();
-void property_atomic_update_end ();
+void property_atomic_update_begin (void);
+void property_atomic_update_end (void);
extern dbus_bool_t hald_is_verbose;
extern dbus_bool_t hald_use_syslog;
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index b324804..819ab9c 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -1109,7 +1109,7 @@ foreach_property_append (HalDevice *device,
case HAL_PROPERTY_TYPE_STRLIST:
{
DBusMessageIter iter_var, iter_array;
- HalDeviceStrListIter iter;
+ HalDeviceStrListIter hd_iter;
dbus_message_iter_open_container (&iter_dict_entry,
DBUS_TYPE_VARIANT,
@@ -1122,11 +1122,11 @@ foreach_property_append (HalDevice *device,
DBUS_TYPE_STRING_AS_STRING,
&iter_array);
- for (hal_device_property_strlist_iter_init (device, key, &iter);
- hal_device_property_strlist_iter_is_valid (&iter);
- hal_device_property_strlist_iter_next (&iter)) {
+ for (hal_device_property_strlist_iter_init (device, key, &hd_iter);
+ hal_device_property_strlist_iter_is_valid (&hd_iter);
+ hal_device_property_strlist_iter_next (&hd_iter)) {
const char *v;
- v = hal_device_property_strlist_iter_get_value (&iter);
+ v = hal_device_property_strlist_iter_get_value (&hd_iter);
dbus_message_iter_append_basic (&iter_array,
DBUS_TYPE_STRING,
@@ -5618,7 +5618,7 @@ hald_dbus_session_active_changed (CKTracker *tracker, CKSession *session, void *
}
extra_env[1] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_ID=%s", ck_session_get_id (session));
- extra_env[2] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_UID=%d", ck_session_get_user (session));
+ extra_env[2] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_UID=%u", ck_session_get_user (session));
extra_env[3] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_IS_ACTIVE=%s",
ck_session_is_active (session) ? "true" : "false");
@@ -5660,7 +5660,7 @@ hald_dbus_session_added (CKTracker *tracker, CKSession *session, void *user_data
}
extra_env[1] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_ID=%s", ck_session_get_id (session));
- extra_env[2] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_UID=%d", ck_session_get_user (session));
+ extra_env[2] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_UID=%u", ck_session_get_user (session));
extra_env[3] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_IS_ACTIVE=%s",
ck_session_is_active (session) ? "true" : "false");
diff --git a/hald/hald_runner.c b/hald/hald_runner.c
index 400c90b..c8bec82 100644
--- a/hald/hald_runner.c
+++ b/hald/hald_runner.c
@@ -451,7 +451,7 @@ add_basic_env (DBusMessageIter * iter, const gchar * udi)
add_env (iter, s, ck_session_is_active (session) ? "true" : "false");
g_free (s);
s = g_strdup_printf ("CK_SESSION_UID_%s", session_id);
- p = g_strdup_printf ("%d", ck_session_get_user (session));
+ p = g_strdup_printf ("%u", ck_session_get_user (session));
add_env (iter, s, p);
g_free (s);
g_free (p);
diff --git a/hald/hald_runner.h b/hald/hald_runner.h
index 0356132..6580993 100644
--- a/hald/hald_runner.h
+++ b/hald/hald_runner.h
@@ -92,7 +92,7 @@ hald_runner_run_method(HalDevice *device,
gpointer data1, gpointer data2);
void hald_runner_kill_device(HalDevice *device);
-void hald_runner_kill_all();
+void hald_runner_kill_all(void);
/* called by the core to tell the runner a device was finalized */
void runner_device_finalized (HalDevice *device);
diff --git a/hald/linux/addons/addon-acpi.c b/hald/linux/addons/addon-acpi.c
index de49c80..ea4ad30 100644
--- a/hald/linux/addons/addon-acpi.c
+++ b/hald/linux/addons/addon-acpi.c
@@ -303,8 +303,6 @@ main (int argc, char **argv)
* sleep for 5s and try to reconnect (again). */
sleep (5);
}
-
- return 1;
}
/* vim:set sw=8 noet: */
diff --git a/hald/linux/addons/addon-cpufreq-userspace.c b/hald/linux/addons/addon-cpufreq-userspace.c
index ab1680f..be7bab1 100644
--- a/hald/linux/addons/addon-cpufreq-userspace.c
+++ b/hald/linux/addons/addon-cpufreq-userspace.c
@@ -353,7 +353,6 @@ static gboolean adjust_speed(struct userspace_interface *iface)
{
GSList *cpus = (GSList*)iface->cpus;
GSList *it = NULL;
- int ret = 0;
int cpu_load = 0;
for (it = cpus; it != NULL; it = g_slist_next(it)) {
@@ -380,19 +379,15 @@ static gboolean adjust_speed(struct userspace_interface *iface)
iface->current_speed = 0;
HAL_DEBUG(("jumped to max (%d kHz)",
g_a_i(iface->speeds_kHz, iface->current_speed)));
- ret = 1;
}
} else if (cpu_load > config.up_threshold && iface->current_speed > 0) {
iface->current_speed = increase_speed(iface);
HAL_DEBUG(("increased to %d kHz", g_a_i(iface->speeds_kHz, iface->current_speed)));
- ret = 1;
} else if (cpu_load < (int)g_a_i(iface->demotion, iface->current_speed) &&
iface->current_speed < iface->last_step) {
iface->current_speed = decrease_speed(iface);
HAL_DEBUG(("decreased to %d kHz", g_a_i(iface->speeds_kHz, iface->current_speed)));
- ret = -1;
} else {
- ret = 0;
HAL_DEBUG(("Speed not changed"));
}
diff --git a/hald/linux/addons/addon-cpufreq.c b/hald/linux/addons/addon-cpufreq.c
index 040ebd9..86d8ebc 100644
--- a/hald/linux/addons/addon-cpufreq.c
+++ b/hald/linux/addons/addon-cpufreq.c
@@ -689,9 +689,9 @@ static gboolean set_governors(DBusConnection *connection, DBusMessage *message,
/** clear all previous cpufreq_objs */
if (g_slist_length(cpufreq_objs) > 0) {
- GSList *it = NULL;
- for (it = cpufreq_objs; it != NULL; it = g_slist_next(it)) {
- struct cpufreq_obj *obj = it->data;
+ GSList *iter = NULL;
+ for (iter = cpufreq_objs; iter != NULL; iter = g_slist_next(iter)) {
+ struct cpufreq_obj *obj = iter->data;
obj->free(obj->iface);
free(obj->iface);
free(obj);
diff --git a/hald/linux/addons/addon-storage.c b/hald/linux/addons/addon-storage.c
index 8d6d4b8..fff22d6 100644
--- a/hald/linux/addons/addon-storage.c
+++ b/hald/linux/addons/addon-storage.c
@@ -279,7 +279,7 @@ enum {
};
static gboolean poll_for_media (gpointer user_data);
-static gboolean poll_for_media_force ();
+static gboolean poll_for_media_force (void);
static int interval_in_seconds = 2;
diff --git a/hald/linux/addons/addon-usb-csr.c b/hald/linux/addons/addon-usb-csr.c
index 4dfecdc..fbb2254 100644
--- a/hald/linux/addons/addon-usb-csr.c
+++ b/hald/linux/addons/addon-usb-csr.c
@@ -68,7 +68,7 @@ static GMainLoop *main_loop;
static const char *device_udi;
/* prototypes */
-static struct usb_device *find_device (const char *hal_device_udi, PropertyCacheItem *pci);
+static struct usb_device *find_device (PropertyCacheItem *pci);
static PropertyCacheItem*
property_cache_item_get (const char *hal_device_udi)
@@ -129,7 +129,7 @@ check_battery (const char *hal_device_udi, PropertyCacheItem *pci)
HAL_DEBUG (("Is dual: %d", is_dual));
addr = is_dual? 1<<8 : 0;
- curr_device = find_device (hal_device_udi, pci);
+ curr_device = find_device (pci);
if (curr_device == NULL) {
HAL_ERROR (("Device %s not found", hal_device_udi));
return;
@@ -170,7 +170,7 @@ check_battery (const char *hal_device_udi, PropertyCacheItem *pci)
/* TODO: Is it linux-specific way to find the device? */
static struct usb_device*
-find_device (const char *hal_device_udi, PropertyCacheItem *pci)
+find_device (PropertyCacheItem *pci)
{
struct usb_bus* curr_bus;
char LUdirname[5];
@@ -224,7 +224,7 @@ is_the_device (const char *hal_device_udi)
}
static void
-device_removed (LibHalContext *ctx, const char *hal_device_udi)
+device_removed (const char *hal_device_udi)
{
/* this device is removed */
if (is_the_device (hal_device_udi)) {
@@ -245,7 +245,7 @@ property_modified (LibHalContext *ctx,
if (is_removed) {
HAL_DEBUG (("** Main Property %s removed: %s", key, hal_device_udi));
/* probably we'll have to exit if this is our device */
- device_removed (ctx, hal_device_udi);
+ device_removed (hal_device_udi);
}
} else
/* "Secondary" property modified */
diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index ceba51f..6042558 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -1760,12 +1760,12 @@ udev_get_device_file_for_sysfs_path (const char *sysfs_path)
if (!g_spawn_sync("/",
(char **) argv,
- NULL, /* envp */
- 0, /* flags */
- NULL, /* child_setup */
- NULL, /* user_data */
+ NULL, /* envp */
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN, /* flags */
+ NULL, /* child_setup */
+ NULL, /* user_data */
&u_stdout,
- NULL, /* stderr */
+ NULL, /* stderr */
&u_exit_status,
&g_error)) {
HAL_ERROR (("Error spawning udevinfo: %s", g_error->message));
diff --git a/hald/linux/coldplug.c b/hald/linux/coldplug.c
index dbc1830..18eae78 100644
--- a/hald/linux/coldplug.c
+++ b/hald/linux/coldplug.c
@@ -158,7 +158,7 @@ hal_util_init_sysfs_to_udev_map (void)
sysfs_to_udev_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, udev_info_free);
/* get udevroot */
- if (g_spawn_sync ("/", udevroot_argv, NULL, 0, NULL, NULL,
+ if (g_spawn_sync ("/", udevroot_argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, NULL, NULL,
&udevinfo_stdout,
NULL,
&udevinfo_exitcode,
@@ -179,7 +179,7 @@ hal_util_init_sysfs_to_udev_map (void)
HAL_INFO (("dev_root is %s", dev_root));
/* get udevdb export */
- if (g_spawn_sync ("/", udevdb_export_argv, NULL, 0, NULL, NULL,
+ if (g_spawn_sync ("/", udevdb_export_argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, NULL, NULL,
&udevinfo_stdout,
NULL,
&udevinfo_exitcode,
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 368b1cc..a846e9e 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3104,12 +3104,7 @@ static gboolean
backlight_compute_udi (HalDevice *d)
{
gchar udi[256];
- const char *dir;
- const char *name;
- dir = hal_device_property_get_string (d, "linux.sysfs_path");
-
- name = hal_util_get_last_element(dir);
hald_compute_udi (udi, sizeof (udi),
"%s_backlight",
hal_device_property_get_string (d, "info.parent"));
diff --git a/hald/linux/hal-file-monitor.c b/hald/linux/hal-file-monitor.c
index 29a2578..c671ce4 100644
--- a/hald/linux/hal-file-monitor.c
+++ b/hald/linux/hal-file-monitor.c
@@ -410,6 +410,8 @@ handle_inotify_event (HalFileMonitor *monitor,
if (ievent->mask & IN_IGNORED) {
file_monitor_remove_watch (monitor, watch);
}
+
+ g_free(freeme);
}
static gboolean
diff --git a/hald/linux/hotplug.c b/hald/linux/hotplug.c
index 2ca62ef..bb86898 100644
--- a/hald/linux/hotplug.c
+++ b/hald/linux/hotplug.c
@@ -109,7 +109,7 @@ hotplug_event_begin_sysfs (HotplugEvent *hotplug_event)
if (hotplug_event->type == HOTPLUG_EVENT_SYSFS && d != NULL) {
HotplugEventType type;
- type = hal_device_property_get_int (d, "linux.hotplug_type");
+ type = (HotplugEventType) hal_device_property_get_int (d, "linux.hotplug_type");
if (type == HOTPLUG_EVENT_SYSFS_DEVICE) {
HAL_INFO (("%s is a device (store)", hotplug_event->sysfs.sysfs_path));
hotplug_event->type = HOTPLUG_EVENT_SYSFS_DEVICE;
diff --git a/hald/linux/pmu.c b/hald/linux/pmu.c
index 0222cb3..71f94cf 100644
--- a/hald/linux/pmu.c
+++ b/hald/linux/pmu.c
@@ -78,7 +78,6 @@ battery_refresh (HalDevice *d, PMUDevHandler *handler)
{
const char *path;
int flags;
- int last_full;
path = hal_device_property_get_string (d, "linux.pmu_path");
if (path == NULL)
@@ -123,9 +122,6 @@ battery_refresh (HalDevice *d, PMUDevHandler *handler)
else
hal_device_property_set_int (d, "battery.charge_level.rate", -current);
- current = hal_device_property_get_int (d, "battery.charge_level.current");
- last_full = hal_device_property_get_int (d, "battery.charge_level.last_full");
-
/* TODO: could read some pmu file? */
device_pm_calculate_time (d);
device_pm_calculate_percentage (d);
diff --git a/hald/linux/probing/probe-pc-floppy.c b/hald/linux/probing/probe-pc-floppy.c
index 7a66987..b8e3c71 100644
--- a/hald/linux/probing/probe-pc-floppy.c
+++ b/hald/linux/probing/probe-pc-floppy.c
@@ -46,7 +46,6 @@ main (int argc, char *argv[])
{
int fd;
int ret;
- char *udi;
char *device_file;
char name[256];
struct floppy_drive_struct ds;
@@ -56,7 +55,7 @@ main (int argc, char *argv[])
/* assume failure */
ret = 1;
- if ((udi = getenv ("UDI")) == NULL)
+ if (getenv ("UDI") == NULL)
goto out;
if ((device_file = getenv ("HAL_PROP_BLOCK_DEVICE")) == NULL)
goto out;
diff --git a/hald/linux/probing/probe-serial.c b/hald/linux/probing/probe-serial.c
index b70f82b..df5a749 100644
--- a/hald/linux/probing/probe-serial.c
+++ b/hald/linux/probing/probe-serial.c
@@ -46,7 +46,6 @@ main (int argc, char *argv[])
{
int fd;
int ret;
- char *udi;
char *device_file;
struct serial_struct ss;
@@ -57,7 +56,7 @@ main (int argc, char *argv[])
setup_logger ();
- if ((udi = getenv ("UDI")) == NULL) {
+ if (getenv ("UDI") == NULL) {
HAL_ERROR (("UDI not set"));
goto out;
}
diff --git a/hald/linux/probing/probe-smbios.c b/hald/linux/probing/probe-smbios.c
index 4d5551c..6085599 100644
--- a/hald/linux/probing/probe-smbios.c
+++ b/hald/linux/probing/probe-smbios.c
@@ -29,6 +29,7 @@
#endif
#include <ctype.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
@@ -101,7 +102,6 @@ main (int argc, char *argv[])
char *nbuf;
int dmipipe[2];
int nullfd;
- int tmp_ret;
FILE *f;
int dmiparser_state = DMIPARSER_STATE_IGNORE;
@@ -153,9 +153,20 @@ main (int argc, char *argv[])
exit(1);
}
- tmp_ret = pipe (dmipipe);
- f = fdopen (dmipipe[0], "r");
- nullfd = open ("/dev/null", O_RDONLY);
+ if(pipe (dmipipe) == -1) {
+ HAL_ERROR(("Could not create pipe (error: '%s'), exit!", strerror(errno)));
+ exit(1);
+ }
+
+ if ((f = fdopen (dmipipe[0], "r")) == NULL) {
+ HAL_ERROR(("Could not open file (error: '%s'), exit!", strerror(errno)));
+ exit(1);
+ }
+
+ if ((nullfd = open ("/dev/null", O_RDONLY)) == -1){
+ HAL_ERROR(("Could not open /dev/null (error: '%s'), exit!", strerror(errno)));
+ exit(1);
+ }
/* fork the child process */
switch (fork ()) {
@@ -187,7 +198,7 @@ main (int argc, char *argv[])
/* read the output of the child */
while(fgets (buf, sizeof(buf), f) != NULL)
{
- int i;
+ int j;
unsigned int len;
unsigned int tabs = 0;
@@ -243,8 +254,8 @@ main (int argc, char *argv[])
nbuf = &buf[1];
/* removes the trailing spaces */
- for (i = len - 2; isspace (nbuf[i]) && i >= 0; --i)
- nbuf[i] = '\0';
+ for (j = len - 2; isspace (nbuf[j]) && j >= 0; --j)
+ nbuf[j] = '\0';
if (dmiparser_state == DMIPARSER_STATE_BIOS) {
setstr (nbuf, "Vendor:", "system.firmware.vendor");
diff --git a/hald/linux/probing/probe-volume.c b/hald/linux/probing/probe-volume.c
index 61eb96a..4293e90 100644
--- a/hald/linux/probing/probe-volume.c
+++ b/hald/linux/probing/probe-volume.c
@@ -89,7 +89,7 @@ strdup_valid_utf8 (const char *str)
static void
-set_volume_id_values (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs, struct volume_id *vid)
+set_volume_id_values (LibHalChangeSet *cs, struct volume_id *vid)
{
char buf[256];
const char *usage;
@@ -153,8 +153,7 @@ set_volume_id_values (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs,
}
static void
-advanced_disc_detect (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs,
- int fd, const char *device_file)
+advanced_disc_detect (LibHalChangeSet *cs, int fd, const char *device_file)
{
/* the discs block size */
unsigned short bs;
@@ -312,7 +311,6 @@ main (int argc, char *argv[])
LibHalContext *ctx = NULL;
DBusError error;
char *parent_udi;
- char *sysfs_path;
struct volume_id *vid;
char *stordev_dev_file;
char *partition_number_str;
@@ -346,7 +344,7 @@ main (int argc, char *argv[])
goto out;
if ((parent_udi = getenv ("HAL_PROP_INFO_PARENT")) == NULL)
goto out;
- if ((sysfs_path = getenv ("HAL_PROP_LINUX_SYSFS_PATH")) == NULL)
+ if (getenv ("HAL_PROP_LINUX_SYSFS_PATH") == NULL)
goto out;
partition_number_str = getenv ("HAL_PROP_VOLUME_PARTITION_NUMBER");
if (partition_number_str != NULL)
@@ -436,7 +434,7 @@ main (int argc, char *argv[])
case CDS_XA_2_2:
libhal_changeset_set_property_bool (cs, "volume.disc.has_data", TRUE);
HAL_DEBUG(("Disc in %s has data", device_file));
- advanced_disc_detect (ctx, udi, cs, fd, device_file);
+ advanced_disc_detect (cs, fd, device_file);
break;
case CDS_NO_INFO: /* blank or invalid CD */
libhal_changeset_set_property_bool (cs, "volume.disc.is_blank", TRUE);
@@ -633,7 +631,7 @@ main (int argc, char *argv[])
}
if (vid_ret == 0) {
- set_volume_id_values(ctx, udi, cs, vid);
+ set_volume_id_values(cs, vid);
if (disc_may_have_data) {
libhal_changeset_set_property_bool (cs, "volume.disc.is_blank", FALSE);
libhal_changeset_set_property_bool (cs, "volume.disc.has_data", TRUE);
@@ -670,7 +668,7 @@ main (int argc, char *argv[])
if (volume_id_probe_all (
vid, vol_probe_offset + part_offset, 0) == 0) {
- set_volume_id_values(ctx, udi, cs, vid);
+ set_volume_id_values(cs, vid);
}
/* and we're done */
diff --git a/hald/mmap_cache.c b/hald/mmap_cache.c
index ac35685..6125cf0 100644
--- a/hald/mmap_cache.c
+++ b/hald/mmap_cache.c
@@ -91,7 +91,6 @@ int di_rules_init (void)
return 0;
}
-static gboolean regen_cache_done;
static gint regen_cache_success;
static void
@@ -110,8 +109,6 @@ regen_cache_cb (HalDevice *d,
} else {
regen_cache_success = FALSE;
}
-
- regen_cache_done = TRUE;
}
@@ -140,8 +137,6 @@ regen_cache (void)
}
}
- regen_cache_done = FALSE;
-
hald_runner_run_sync (NULL,
"hald-generate-fdi-cache",
extra_env,
diff --git a/hald/util.c b/hald/util.c
index 29da72e..51f5d8a 100644
--- a/hald/util.c
+++ b/hald/util.c
@@ -1056,7 +1056,7 @@ hal_util_hexdump (const void *mem, unsigned int size)
const char *buf = (const char *) mem;
n = 0;
- printf ("Dumping %d=0x%x bytes\n", size, size);
+ printf ("Dumping %u=0x%x bytes\n", size, size);
while (n < size) {
printf ("0x%04x: ", n);
diff --git a/libhal-storage/libhal-storage.c b/libhal-storage/libhal-storage.c
index 4868ff9..bd15014 100644
--- a/libhal-storage/libhal-storage.c
+++ b/libhal-storage/libhal-storage.c
@@ -191,15 +191,6 @@ out:
return result;
}
-static void
-fixup_string (char *s)
-{
- /* TODO: first strip leading and trailing whitespace */
- /*g_strstrip (s);*/
-
- /* TODO: could do nice things on all-upper case strings */
-}
-
/* volume may be NULL (e.g. if drive supports removable media) */
char *
libhal_drive_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *volume, LibHalStoragePolicy *policy)
@@ -241,8 +232,6 @@ libhal_drive_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *volu
}
}
- fixup_string (vendormodel_str);
-
if (drive_type==LIBHAL_DRIVE_TYPE_CDROM) {
/* Optical drive handling */
@@ -363,21 +352,13 @@ libhal_volume_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *vol
char *name;
char *size_str;
const char *volume_label;
- const char *model;
- const char *vendor;
LibHalDriveType drive_type;
- dbus_bool_t drive_is_hotpluggable;
dbus_bool_t drive_is_removable;
- LibHalDriveCdromCaps drive_cdrom_caps;
char buf[MAX_STRING_SZ];
volume_label = libhal_volume_get_label (volume);
- model = libhal_drive_get_model (drive);
- vendor = libhal_drive_get_vendor (drive);
drive_type = libhal_drive_get_type (drive);
- drive_is_hotpluggable = libhal_drive_is_hotpluggable (drive);
drive_is_removable = libhal_drive_uses_removable_media (drive);
- drive_cdrom_caps = libhal_drive_get_cdrom_caps (drive);
size_str = libhal_volume_policy_compute_size_as_string (volume);
@@ -1966,7 +1947,7 @@ libhal_drive_policy_default_get_managed_keyword_secondary (LibHalContext *hal_ct
dbus_bool_t
libhal_drive_policy_is_mountable (LibHalDrive *drive, LibHalStoragePolicy *policy)
{
- printf ("should_mount=%d, no_partitions_hint=%d\n", drive->should_mount, drive->no_partitions_hint);
+ printf ("should_mount=%u, no_partitions_hint=%u\n", drive->should_mount, drive->no_partitions_hint);
return drive->should_mount && drive->no_partitions_hint;
}
@@ -2007,10 +1988,8 @@ mopts_collect (LibHalContext *hal_ctx, const char *namespace, int namespace_len,
}
for (libhal_psi_init (&it, properties); libhal_psi_has_more (&it); libhal_psi_next (&it)) {
- int type;
char *key;
- type = libhal_psi_get_type (&it);
key = libhal_psi_get_key (&it);
if (libhal_psi_get_type (&it) == LIBHAL_PROPERTY_TYPE_BOOLEAN &&
strncmp (key, namespace, namespace_len - 1) == 0) {
diff --git a/libhal/libhal.c b/libhal/libhal.c
index be98d43..08c5481 100644
--- a/libhal/libhal.c
+++ b/libhal/libhal.c
@@ -225,21 +225,17 @@ struct LibHalPropertySet_s {
* Represents a property. Opaque.
*/
struct LibHalProperty_s {
- int type; /**< Type of property */
- char *key; /**< ASCII string */
+ LibHalPropertyType type; /**< Type of property */
+ char *key; /**< ASCII string */
/** Possible values of the property */
union {
- char *str_value; /**< UTF-8 zero-terminated string */
- dbus_int32_t int_value;
- /**< 32-bit signed integer */
- dbus_uint64_t uint64_value;
- /**< 64-bit unsigned integer */
- double double_value; /**< IEEE754 double precision float */
- dbus_bool_t bool_value;
- /**< Truth value */
-
- char **strlist_value; /**< List of UTF-8 zero-terminated strings */
+ char *str_value; /**< UTF-8 zero-terminated string */
+ dbus_int32_t int_value; /**< 32-bit signed integer */
+ dbus_uint64_t uint64_value; /**< 64-bit unsigned integer */
+ double double_value; /**< IEEE754 double precision float */
+ dbus_bool_t bool_value; /**< Truth value */
+ char **strlist_value; /**< List of UTF-8 zero-terminated strings */
} v;
UT_hash_handle hh; /*makes this hashable*/
@@ -427,7 +423,6 @@ static LibHalPropertySet *
get_property_set (DBusMessageIter *iter)
{
LibHalPropertySet *result;
- LibHalProperty *p_last;
DBusMessageIter dict_iter;
result = malloc (sizeof (LibHalPropertySet));
@@ -455,8 +450,6 @@ get_property_set (DBusMessageIter *iter)
dbus_message_iter_recurse (iter, &dict_iter);
- p_last = NULL;
-
while (dbus_message_iter_get_arg_type (&dict_iter) == DBUS_TYPE_DICT_ENTRY)
{
DBusMessageIter dict_entry_iter, var_iter;
@@ -481,7 +474,7 @@ get_property_set (DBusMessageIter *iter)
dbus_message_iter_recurse (&dict_entry_iter, &var_iter);
- p->type = dbus_message_iter_get_arg_type (&var_iter);
+ p->type = (LibHalPropertyType) dbus_message_iter_get_arg_type (&var_iter);
if(!libhal_property_fill_value_from_variant (p, &var_iter))
goto oom;
@@ -1303,7 +1296,7 @@ libhal_device_get_property_type (LibHalContext *ctx, const char *udi, const char
DBusMessage *message;
DBusMessage *reply;
DBusMessageIter iter, reply_iter;
- int type;
+ LibHalPropertyType type;
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, LIBHAL_PROPERTY_TYPE_INVALID); /* or return NULL? */
diff --git a/partutil/partutil.c b/partutil/partutil.c
index c623ca2..9c2930f 100644
--- a/partutil/partutil.c
+++ b/partutil/partutil.c
@@ -776,7 +776,6 @@ part_table_parse_apple (int fd, guint64 offset, guint64 size)
/* more stuff */
} __attribute__ ((packed)) mac_part;
int block_size;
- int block_count;
int map_count;
HAL_INFO (("Entering Apple parser"));
@@ -798,7 +797,6 @@ part_table_parse_apple (int fd, guint64 offset, guint64 size)
}
block_size = GUINT16_FROM_BE (mac_header.block_size);
- block_count = GUINT32_FROM_BE (mac_header.block_count); /* num blocks on whole disk */
HAL_INFO (("Mac MAGIC found, block_size=%d", block_size));
diff --git a/tools/hal-storage-closetray.c b/tools/hal-storage-closetray.c
index ef7405d..43cc733 100644
--- a/tools/hal-storage-closetray.c
+++ b/tools/hal-storage-closetray.c
@@ -48,7 +48,7 @@ usage (void)
}
-void static
+static void
unknown_closetray_error (const char *detail)
{
fprintf (stderr, "org.freedesktop.Hal.Device.Storage.UnknownFailure\n");
diff --git a/tools/hal-storage-eject.c b/tools/hal-storage-eject.c
index 81d1c8f..3fb9dfb 100644
--- a/tools/hal-storage-eject.c
+++ b/tools/hal-storage-eject.c
@@ -50,7 +50,7 @@ usage (void)
}
-void static
+static void
unknown_eject_error (const char *detail)
{
fprintf (stderr, "org.freedesktop.Hal.Device.%s.UnknownFailure\n", devtype);
diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c
index 3220734..3fa59f6 100644
--- a/tools/hal-storage-mount.c
+++ b/tools/hal-storage-mount.c
@@ -585,12 +585,6 @@ handle_mount (LibHalContext *hal_ctx,
explicit_mount_point_given = FALSE;
if (strlen (mount_point) == 0) {
char *p;
- const char *label;
-
- if (volume != NULL)
- label = libhal_volume_get_label (volume);
- else
- label = NULL;
if (label != NULL) {
/* best - use label */
@@ -693,7 +687,7 @@ handle_mount (LibHalContext *hal_ctx,
unknown_error ("option uid is malformed");
}
#ifdef DEBUG
- printf ("%s with uid %d\n", allow, uid);
+ printf ("%s with uid %u\n", allow, uid);
#endif
wants_to_change_uid = TRUE;
@@ -792,15 +786,6 @@ handle_mount (LibHalContext *hal_ctx,
#ifdef HAVE_POLKIT
if (invoked_by_syscon_name != NULL) {
char *polkit_result;
- char *action_params[] = {
- "fstype", "",
- "mount-point", "",
- "mount-options", "",
- NULL};
-
- action_params[1] = mount_do_fstype;
- action_params[3] = mount_dir;
- action_params[5] = mount_option_commasep;
dbus_error_init (&error);
polkit_result = libhal_device_is_caller_privileged (hal_ctx,
diff --git a/tools/hal-storage-shared.c b/tools/hal-storage-shared.c
index eba5440..b10be10 100644
--- a/tools/hal-storage-shared.c
+++ b/tools/hal-storage-shared.c
@@ -485,7 +485,7 @@ line_found:
if (!g_spawn_sync ("/",
args,
NULL,
- 0,
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
NULL,
NULL,
&sout,
@@ -550,9 +550,7 @@ handle_eject (DBusConnection *system_bus,
int na;
int fd;
int num_excl_tries;
-#ifdef HAVE_POLKIT
DBusError error;
-#endif
/* When called here all the file systems from this device are
* already unmounted. That's actually guaranteed; see
@@ -650,7 +648,7 @@ try_open_excl_again:
if (!g_spawn_sync ("/",
args,
NULL,
- 0,
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
NULL,
NULL,
&sout,
@@ -675,7 +673,6 @@ try_open_excl_again:
if (!libhal_drive_is_media_detection_automatic (drive)) {
DBusMessage *message;
DBusMessage *reply;
- DBusError error;
message = dbus_message_new_method_call ("org.freedesktop.Hal",
udi,
diff --git a/tools/linux/hal-ipw-killswitch-linux.c b/tools/linux/hal-ipw-killswitch-linux.c
index 5376810..1f1a648 100644
--- a/tools/linux/hal-ipw-killswitch-linux.c
+++ b/tools/linux/hal-ipw-killswitch-linux.c
@@ -37,8 +37,7 @@ int main(int argc,char** argv) {
char *udi;
char *parent;
char *iface;
- int i;
- char kill_status;
+ int i, kill_status;
char **udis;
int num_udis;
FILE *fd;
commit 7872270489fedefbabe3420e5e9d599b09898e84
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Thu Apr 17 19:42:45 2008 +0200
fixed UDI generation for VMBus devices
Fixed UDI generation for VMBus devices. Use only vmbus.bus_id
since it has already this format 'vmbus_<bus_number>_<device_num>'
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 80dd39e..368b1cc 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3769,9 +3769,8 @@ vmbus_compute_udi (HalDevice *d)
gchar udi[256];
hal_util_compute_udi (hald_get_gdl(), udi, sizeof (udi),
- "/org/freedesktop/Hal/devices/vmbus_%s_%s",
- hal_device_property_get_string (d, "vmbus.bus_id"),
- hal_device_property_get_string (d, "vmbus.device_id"));
+ "/org/freedesktop/Hal/devices/_%s",
+ hal_device_property_get_string (d, "vmbus.bus_id"));
hal_device_set_udi (d, udi);
commit 3b1757a0829a265b5c9d0c3ba8239c86368bb67d
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Thu Apr 17 16:51:23 2008 +0200
removed deprecated keys usb_device.*_bcd
Removed deprecated keys which reached end of lifetime (2008-03-21):
* usb_device.speed_bcd (replaced by usb_device.speed)
* usb_device.version_bcd (replaced by usb_device.version)
Removed also hal_util_{g,s}et_bcd2_from_file() from hald/util.*
since they are not needed any longer.
NOTE: Someone need to adapt FreeBSD code!
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 264a06a..050f54a 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -7591,18 +7591,6 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
<entry>2007-05-01</entry>
<entry></entry>
</row>
- <row>
- <entry><literal>usb_device.speed_bcd</literal> (int)</entry>
- <entry><literal>usb_device.speed</literal> (double)</entry>
- <entry>2008-03-21</entry>
- <entry>changed from 'BCD with two decimals' to double</entry>
- </row>
- <row>
- <entry><literal>usb_device.version_bcd</literal> (int)</entry>
- <entry><literal>usb_device.version</literal> (double)</entry>
- <entry>2008-03-21</entry>
- <entry>changed from 'BCD with two decimals' to double</entry>
- </row>
</tbody>
</tgroup>
</informaltable>
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 28894a8..80dd39e 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -1773,11 +1773,7 @@ usb_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
hal_util_set_int_from_file (d, "usb_device.linux.device_number", sysfs_path, "devnum", 10);
hal_util_set_string_from_file (d, "usb_device.serial", sysfs_path, "serial");
-
- hal_util_set_string_from_file (d, "usb_device.serial", sysfs_path, "serial");
- hal_util_set_bcd2_from_file (d, "usb_device.speed_bcd", sysfs_path, "speed");
hal_util_set_double_from_file (d, "usb_device.speed", sysfs_path, "speed");
- hal_util_set_bcd2_from_file (d, "usb_device.version_bcd", sysfs_path, "version");
hal_util_set_double_from_file (d, "usb_device.version", sysfs_path, "version");
hal_util_get_int_from_file (sysfs_path, "bmAttributes", &bmAttributes, 16);
diff --git a/hald/util.c b/hald/util.c
index ee3cb37..29da72e 100644
--- a/hald/util.c
+++ b/hald/util.c
@@ -279,96 +279,6 @@ hal_util_set_uint64_from_file (HalDevice *d, const gchar *key, const gchar *dire
return ret;
}
-gboolean
-hal_util_get_bcd2_from_file (const gchar *directory, const gchar *file, gint *result)
-{
- FILE *f;
- char buf[64];
- gchar path[HAL_PATH_MAX];
- gboolean ret;
- gint digit;
- gint left, right;
- gboolean passed_white_space;
- gint num_prec;
- gsize len;
- gchar c;
- guint i;
-
- f = NULL;
- ret = FALSE;
-
- g_snprintf (path, sizeof (path), "%s/%s", directory, file);
-
- f = fopen (path, "rb");
- if (f == NULL) {
- //HAL_ERROR (("Cannot open '%s'", path));
- goto out;
- }
-
- if (fgets (buf, sizeof (buf), f) == NULL) {
- //HAL_ERROR (("Cannot read from '%s'", path));
- goto out;
- }
-
- left = 0;
- len = strlen (buf);
- passed_white_space = FALSE;
- for (i = 0; i < len && buf[i] != '.'; i++) {
- if (g_ascii_isspace (buf[i])) {
- if (passed_white_space)
- break;
- else
- continue;
- }
- passed_white_space = TRUE;
- left *= 16;
- c = buf[i];
- digit = (int) (c - '0');
- left += digit;
- }
- i++;
- right = 0;
- num_prec = 0;
- for (; i < len; i++) {
- if (g_ascii_isspace (buf[i]))
- break;
- if (num_prec == 2) /* Only care about two digits
- * of precision */
- break;
- right *= 16;
- c = buf[i];
- digit = (int) (c - '0');
- right += digit;
- num_prec++;
- }
-
- for (; num_prec < 2; num_prec++)
- right *= 16;
-
- *result = left * 256 + (right & 255);
- ret = TRUE;
-
-out:
- if (f != NULL)
- fclose (f);
-
- return ret;
-}
-
-gboolean
-hal_util_set_bcd2_from_file (HalDevice *d, const gchar *key, const gchar *directory, const gchar *file)
-{
- gint value;
- gboolean ret;
-
- ret = FALSE;
-
- if (hal_util_get_bcd2_from_file (directory, file, &value))
- ret = hal_device_property_set_int (d, key, value);
-
- return ret;
-}
-
gchar *
hal_util_get_string_from_file (const gchar *directory, const gchar *file)
{
diff --git a/hald/util.h b/hald/util.h
index 4cf9524..e1783e2 100644
--- a/hald/util.h
+++ b/hald/util.h
@@ -62,10 +62,6 @@ gboolean hal_util_get_bool_from_file (const gchar *directory, const gchar *file,
gboolean hal_util_set_string_from_file (HalDevice *d, const gchar *key, const gchar *directory, const gchar *file);
-gboolean hal_util_get_bcd2_from_file (const gchar *directory, const gchar *file, gint *result);
-
-gboolean hal_util_set_bcd2_from_file (HalDevice *d, const gchar *key, const gchar *directory, const gchar *file);
-
gboolean hal_util_set_double_from_file (HalDevice *d, const gchar *key, const gchar *directory, const gchar *file);
void hal_util_make_udi_unique (HalDeviceStore *store, gchar *udi, gsize udisize, const char *original_udi);
commit 0e4f022d5374d50e280f8fc2cd0eb2032c573f5c
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Thu Apr 17 11:30:29 2008 +0200
updated SPEC for VMBus
Updated SPEC for VMBus.
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index f0718b0..264a06a 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -3110,6 +3110,59 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
</tgroup>
</informaltable>
</sect2>
+
+ <sect2 id="device-properties-vmbus">
+ <title>
+ vmbus namespace
+ </title>
+ <para>
+ Virtual devices of the VMBus, which is part of the Hyper-V technologies
+ (which is a hypervisor based virtualization solution) included in the
+ Windows Server 2008, are represented by device objects where
+ <literal>info.subsystem</literal> equals <literal>vmbus</literal>.
+ The following properties are available for such device objects.
+ </para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Key (type)</entry>
+ <entry>Values</entry>
+ <entry>Mandatory</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <literal>vmbus.bus_id</literal> (string)
+ </entry>
+ <entry></entry>
+ <entry>Yes</entry>
+ <entry>ID of the bus.</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>vmbus.device_id</literal> (string)
+ </entry>
+ <entry></entry>
+ <entry>Yes</entry>
+ <entry>ID of the device.</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>vmbus.class_id</literal> (string)
+ </entry>
+ <entry>example: {f8615163-df3e-46c5-913ff2d2f965ed0e}</entry>
+ <entry>Yes</entry>
+ <entry>Class identifier of the device.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect2>
+
+
</sect1>
<sect1 id="properties-functional">
commit ce1b663768cd5f982e2cb082564e6277eae27196
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Thu Apr 17 11:13:13 2008 +0200
add support for VMBus
Adopted and rewritten version of a patch contributed by Mike Sterling
<mike.sterling at microsoft.com> (for 0.5.8.1) to add support for the VMBus.
Contributed via https://bugs.freedesktop.org/show_bug.cgi?id=15227:
> Windows Server 2008 includes the Hyper-V technologies, a hypervisor based
> virtualization solution. Hyper-V includes a new virtual bus type (called
> VMBus) where synthetic devices in the VM connect. As Hyper-V will include
> support for some Linux distributions, we'd like to see native support
> for VMBus in hald.
diff --git a/hald/linux/device.c b/hald/linux/device.c
index d0e6d81..28894a8 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3719,6 +3719,73 @@ vio_compute_udi (HalDevice *d)
/*--------------------------------------------------------------------------------------------------------------*/
static HalDevice *
+vmbus_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+ HalDevice *d;
+ const gchar *bus_id;
+ const gchar *class_id;
+ const gchar *device_id;
+
+ HAL_INFO (("vmbus_add: sysfs_path=%s device_file=%s parent_dev=0x%08x parent_path=%s", sysfs_path, device_file, parent_dev, parent_path));
+
+ d = hal_device_new ();
+ hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+ hal_device_property_set_string (d, "info.subsystem", "vmbus");
+ hal_device_property_set_string (d, "info.vendor", "Microsoft/Citrix");
+ hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+ if (parent_dev != NULL) {
+ hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+ } else {
+ hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+ }
+
+ bus_id = hal_util_get_last_element (sysfs_path);
+ hal_device_property_set_string (d, "vmbus.bus_id", bus_id);
+ device_id = hal_util_get_string_from_file (sysfs_path, "device_id");
+ hal_device_property_set_string (d, "vmbus.device_id", device_id);
+ class_id = hal_util_get_string_from_file (sysfs_path, "class_id");
+ hal_device_property_set_string (d, "vmbus.class_id", class_id);
+
+ if (class_id != NULL) {
+ if (strcmp (class_id, "{f8615163-df3e-46c5-913ff2d2f965ed0e}") == 0) {
+ hal_device_property_set_string (d, "info.product", "Network Virtualization Service Client Device");
+ } else if (strcmp (class_id, "{ba6163d9-04a1-4d29-b60572e2ffb1dc7f}") == 0) {
+ hal_device_property_set_string (d, "info.product", "Storage Virtualization Service Client Device");
+ } else if (strcmp (class_id, "{c5295816-f63a-4d5f-8d1a4daf999ca185}") == 0) {
+ // root device of the bus
+ hal_device_property_set_string (d, "info.product", "Vmbus Device");
+ }
+ }
+
+ if (!hal_device_has_property(d, "info.product")) {
+ char buf[64];
+ g_snprintf (buf, sizeof (buf), "Virtualization Service Client Device (%s)", bus_id);
+ hal_device_property_set_string (d, "info.product", buf);
+ }
+
+ return d;
+}
+
+static gboolean
+vmbus_compute_udi (HalDevice *d)
+{
+ gchar udi[256];
+
+ hal_util_compute_udi (hald_get_gdl(), udi, sizeof (udi),
+ "/org/freedesktop/Hal/devices/vmbus_%s_%s",
+ hal_device_property_get_string (d, "vmbus.bus_id"),
+ hal_device_property_get_string (d, "vmbus.device_id"));
+
+ hal_device_set_udi (d, udi);
+
+ return TRUE;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
{
HalDevice *d;
@@ -4093,6 +4160,15 @@ static DevHandler dev_handler_vio =
.remove = dev_remove
};
+static DevHandler dev_handler_vmbus =
+{
+ .subsystem = "vmbus",
+ .add = vmbus_add,
+ .compute_udi = vmbus_compute_udi,
+ .remove = dev_remove
+};
+
+
/* SCSI debug, to test thousends of fake devices */
static DevHandler dev_handler_pseudo = {
.subsystem = "pseudo",
@@ -4141,6 +4217,7 @@ static DevHandler *dev_handlers[] = {
&dev_handler_ps3_system_bus,
&dev_handler_virtio,
&dev_handler_vio,
+ &dev_handler_vmbus,
NULL
};
More information about the hal-commit
mailing list