hal: Branch 'origin'
David Zeuthen
david at kemper.freedesktop.org
Wed Sep 13 21:23:42 PDT 2006
hald/linux/probing/probe-storage.c | 1
libhal/libhal.c | 42 +++++++++++++++++++++++++------------
2 files changed, 30 insertions(+), 13 deletions(-)
New commits:
diff-tree 0ae1aed74548fec563399d00100d621ce99b383b (from 99aaca0516856eafbe2ad2402b401e65f42fa629)
Author: David Zeuthen <davidz at redhat.com>
Date: Thu Sep 14 00:21:13 2006 -0400
send changes in correct order for LibHalChangeSet
Before this bug was fixed, the changes were sent in the wrong
order. This screwed up probe-storage.c (and probably other helpers
too) as it first set a property to FALSE and subsequently to TRUE.
diff --git a/hald/linux/probing/probe-storage.c b/hald/linux/probing/probe-storage.c
index 544299c..41c43bd 100644
--- a/hald/linux/probing/probe-storage.c
+++ b/hald/linux/probing/probe-storage.c
@@ -178,6 +178,7 @@ main (int argc, char *argv[])
close (fd);
goto out;
}
+ HAL_DEBUG (("CDROM_GET_CAPABILITY returned: 0x%08x", capabilities));
libhal_changeset_set_property_bool (cs, "storage.cdrom.cdr", FALSE);
libhal_changeset_set_property_bool (cs, "storage.cdrom.cdrw", FALSE);
diff --git a/libhal/libhal.c b/libhal/libhal.c
index a577829..e0324af 100644
--- a/libhal/libhal.c
+++ b/libhal/libhal.c
@@ -3533,11 +3533,13 @@ struct LibHalChangeSetElement_s {
char **val_strlist;
} value;
LibHalChangeSetElement *next;
+ LibHalChangeSetElement *prev;
};
struct LibHalChangeSet_s {
char *udi;
LibHalChangeSetElement *head;
+ LibHalChangeSetElement *tail;
};
/**
@@ -3566,11 +3568,32 @@ libhal_device_new_changeset (const char
}
changeset->head = NULL;
+ changeset->tail = NULL;
out:
return changeset;
}
+static void
+libhal_changeset_append (LibHalChangeSet *changeset, LibHalChangeSetElement *elem)
+{
+ if (changeset->head == NULL) {
+ changeset->head = elem;
+ changeset->tail = elem;
+ elem->next = NULL;
+ elem->prev = NULL;
+ } else {
+ elem->prev = changeset->tail;
+ elem->next = NULL;
+ elem->prev->next = elem;
+ changeset->tail = elem;
+ }
+
+ //elem->next = changeset->head;
+ //changeset->head = elem;
+}
+
+
/**
* libhal_device_set_property_string:
* @changeset: the changeset
@@ -3605,8 +3628,7 @@ libhal_changeset_set_property_string (Li
goto out;
}
- elem->next = changeset->head;
- changeset->head = elem;
+ libhal_changeset_append (changeset, elem);
out:
return elem != NULL;
}
@@ -3639,8 +3661,7 @@ libhal_changeset_set_property_int (LibHa
elem->change_type = LIBHAL_PROPERTY_TYPE_INT32;
elem->value.val_int = value;
- elem->next = changeset->head;
- changeset->head = elem;
+ libhal_changeset_append (changeset, elem);
out:
return elem != NULL;
}
@@ -3673,8 +3694,7 @@ libhal_changeset_set_property_uint64 (Li
elem->change_type = LIBHAL_PROPERTY_TYPE_UINT64;
elem->value.val_uint64 = value;
- elem->next = changeset->head;
- changeset->head = elem;
+ libhal_changeset_append (changeset, elem);
out:
return elem != NULL;
}
@@ -3707,8 +3727,7 @@ libhal_changeset_set_property_double (Li
elem->change_type = LIBHAL_PROPERTY_TYPE_DOUBLE;
elem->value.val_double = value;
- elem->next = changeset->head;
- changeset->head = elem;
+ libhal_changeset_append (changeset, elem);
out:
return elem != NULL;
}
@@ -3741,8 +3760,7 @@ libhal_changeset_set_property_bool (LibH
elem->change_type = LIBHAL_PROPERTY_TYPE_BOOLEAN;
elem->value.val_bool = value;
- elem->next = changeset->head;
- changeset->head = elem;
+ libhal_changeset_append (changeset, elem);
out:
return elem != NULL;
}
@@ -3805,8 +3823,7 @@ libhal_changeset_set_property_strlist (L
elem->change_type = LIBHAL_PROPERTY_TYPE_STRLIST;
elem->value.val_strlist = value_copy;
- elem->next = changeset->head;
- changeset->head = elem;
+ libhal_changeset_append (changeset, elem);
out:
return elem != NULL;
}
@@ -3861,7 +3878,6 @@ libhal_device_commit_changeset (LibHalCo
&sub);
for (elem = changeset->head; elem != NULL; elem = elem->next) {
-
dbus_message_iter_open_container (&sub,
DBUS_TYPE_DICT_ENTRY,
NULL,
More information about the hal-commit
mailing list