hal: Branch 'master' - 6 commits
Danny Kukawka
dkukawka at kemper.freedesktop.org
Sun Feb 22 07:05:16 PST 2009
doc/spec/hal-spec-properties.xml | 24 +++++
fdi/policy/10osvendor/20-acl-management.fdi | 124 +++++++++++++++-------------
hald/device_info.c | 5 -
hald/linux/osspec.c | 11 ++
tools/hal_get_property.c | 2
5 files changed, 105 insertions(+), 61 deletions(-)
New commits:
commit e20eefbf772cfaeaafc232d390005daa316d22b9
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Sun Feb 22 12:03:58 2009 +0100
fix commit 92e7f2e8b2a1a36d3ec2b371424719e7078d91da
Fixed commit 92e7f2e8b2a1a36d3ec2b371424719e7078d91da: don't
free 'const char *'. Changed code to prevent usage of g_strdup()
which prevents need to use g_free().
diff --git a/hald/device_info.c b/hald/device_info.c
index 6444b54..b157351 100644
--- a/hald/device_info.c
+++ b/hald/device_info.c
@@ -829,11 +829,11 @@ handle_merge (struct rule *rule, HalDevice *d)
{
const char *value = (char *)RULES_PTR(rule->value_offset);
const char *key;
+ char key_to_merge[HAL_PATH_MAX];
if (rule->rtype == RULE_MERGE || rule->rtype == RULE_APPEND ||
rule->rtype == RULE_PREPEND || rule->rtype == RULE_ADDSET ) {
char udi_to_merge[HAL_PATH_MAX];
- char key_to_merge[HAL_PATH_MAX];
/* Resolve key paths like 'someudi/foo/bar/baz:prop.name' '@prop.here.is.an.udi:with.prop.name' */
if (!resolve_udiprop_path (rule->key, hal_device_get_udi (d),
@@ -842,7 +842,7 @@ handle_merge (struct rule *rule, HalDevice *d)
HAL_ERROR (("Could not resolve keypath '%s' on udi '%s'", rule->key, hal_device_get_udi (d)));
return FALSE;
} else {
- key = g_strdup(key_to_merge);
+ key = key_to_merge;
if (strcmp(hal_device_get_udi (d), udi_to_merge) != 0) {
@@ -852,7 +852,6 @@ handle_merge (struct rule *rule, HalDevice *d)
if (d == NULL) {
HAL_ERROR (("Could not find device with udi '%s'", udi_to_merge));
- g_free (key);
return FALSE;
}
}
commit 507a37f2159e1355de136f7a2c7807c31a8affba
Merge: b9beaa0... 1d1abc2...
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Sun Feb 22 12:02:45 2009 +0100
Merge branch 'master' of ssh://dkukawka@git.freedesktop.org/git/hal
commit b9beaa06340508be7dd7d519bcb8cf9b3139da29
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Fri Feb 13 15:56:29 2009 +0100
move all storage/block related policies to one block
Moved all storage/block related policies to one block to
prevent accidentally overwriting of already set policies.
diff --git a/fdi/policy/10osvendor/20-acl-management.fdi b/fdi/policy/10osvendor/20-acl-management.fdi
index a276e98..2884a12 100644
--- a/fdi/policy/10osvendor/20-acl-management.fdi
+++ b/fdi/policy/10osvendor/20-acl-management.fdi
@@ -35,36 +35,14 @@
</match>
- <!-- optical drives -->
- <match key="info.capabilities" contains="storage.cdrom">
- <match key="block.device" exists="true">
- <addset key="info.capabilities" type="strlist">access_control</addset>
- <merge key="access_control.file" type="copy_property">block.device</merge>
- <merge key="access_control.type" type="string">cdrom</merge>
- </match>
- </match>
-
- <!-- scsi generic device for optical drives -->
+ <!-- scsi generic devices -->
<match key="info.capabilities" contains="scsi_generic">
<match key="scsi_generic.device" exists="true">
- <match key="@info.parent:scsi.type" string="cdrom">
- <addset key="info.capabilities" type="strlist">access_control</addset>
- <merge key="access_control.file" type="copy_property">scsi_generic.device</merge>
- <merge key="access_control.type" type="string">cdrom</merge>
- </match>
<match key="info.capabilities" contains="scanner">
<addset key="info.capabilities" type="strlist">access_control</addset>
<merge key="access_control.file" type="copy_property">scsi_generic.device</merge>
<merge key="access_control.type" type="string">scanner</merge>
</match>
- <!-- usb floppy bnc#336327 -->
- <match key="@info.parent:@info.parent:@info.parent:usb.interface.class" int="8">
- <match key="@info.parent:@info.parent:@info.parent:usb.interface.subclass" int="4">
- <addset key="info.capabilities" type="strlist">access_control</addset>
- <merge key="access_control.file" type="copy_property">scsi_generic.device</merge>
- <merge key="access_control.type" type="string">floppy</merge>
- </match>
- </match>
</match>
</match>
@@ -129,7 +107,6 @@
</match>
</match>
-
<!-- Firewire devices are mostly driven by userspace libraries -->
<match key="info.capabilities" contains="ieee1394_unit.iidc">
<match key="@ieee1394_unit.originating_device:ieee1394.device" exists="true">
@@ -178,19 +155,6 @@
</match>
</match>
- <!-- plain old floppy -->
- <match key="storage.drive_type" string="floppy">
- <match key="block.device" exists="true">
- <match key="storage.no_partitions_hint" bool="true">
- <match key="access_control.type" exists="false">
- <addset key="info.capabilities" type="strlist">access_control</addset>
- <merge key="access_control.file" type="copy_property">block.device</merge>
- <merge key="access_control.type" type="string">floppy</merge>
- </match>
- </match>
- </match>
- </match>
-
<!-- linux input devices (needed e.g. for games) -->
<match key="linux.subsystem" string="input">
<match key="input.device" exists="true">
@@ -227,6 +191,47 @@
</match>
</match>
+
+ <!-- keep all storage/block devices in this section together to prevent trouble -->
+ <!-- optical drives -->
+ <match key="info.capabilities" contains="storage.cdrom">
+ <match key="block.device" exists="true">
+ <addset key="info.capabilities" type="strlist">access_control</addset>
+ <merge key="access_control.file" type="copy_property">block.device</merge>
+ <merge key="access_control.type" type="string">cdrom</merge>
+ </match>
+ </match>
+ <!-- plain old floppy -->
+ <match key="storage.drive_type" string="floppy">
+ <match key="block.device" exists="true">
+ <match key="storage.no_partitions_hint" bool="true">
+ <match key="access_control.type" exists="false">
+ <addset key="info.capabilities" type="strlist">access_control</addset>
+ <merge key="access_control.file" type="copy_property">block.device</merge>
+ <merge key="access_control.type" type="string">floppy</merge>
+ </match>
+ </match>
+ </match>
+ </match>
+ <!-- scsi generic block device -->
+ <match key="info.capabilities" contains="scsi_generic">
+ <match key="scsi_generic.device" exists="true">
+ <match key="@info.parent:scsi.type" string="cdrom">
+ <addset key="info.capabilities" type="strlist">access_control</addset>
+ <merge key="access_control.file" type="copy_property">scsi_generic.device</merge>
+ <merge key="access_control.type" type="string">cdrom</merge>
+ </match>
+ <!-- usb floppy bnc#336327 -->
+ <match key="@info.parent:@info.parent:@info.parent:usb.interface.class" int="8">
+ <match key="@info.parent:@info.parent:@info.parent:usb.interface.subclass" int="4">
+ <addset key="info.capabilities" type="strlist">access_control</addset>
+ <merge key="access_control.file" type="copy_property">scsi_generic.device</merge>
+ <merge key="access_control.type" type="string">floppy</merge>
+ </match>
+ </match>
+ </match>
+ </match>
+
<!-- Removable block devices -->
<match key="info.capabilities" contains="block">
<!-- Don't set removable-block policy to devices which have already another policy
commit 7d368270dc1737f398cb4226aa5385641601af7f
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Fri Feb 13 15:48:21 2009 +0100
fix problems with removable-block policy and floppy devs
Fixed problems with removable-block policy and floppy devices.
Moved removable-block part to the end of the file and added a
check if a device as already a rule to prevent overwriting
already set floppy or other policy. (bnc#471514)
diff --git a/fdi/policy/10osvendor/20-acl-management.fdi b/fdi/policy/10osvendor/20-acl-management.fdi
index 98f8c88..a276e98 100644
--- a/fdi/policy/10osvendor/20-acl-management.fdi
+++ b/fdi/policy/10osvendor/20-acl-management.fdi
@@ -34,26 +34,6 @@
</match>
</match>
- <!-- Removable block devices -->
- <match key="info.capabilities" contains="block">
- <match key="block.device" exists="true">
- <match key="@block.storage_device:storage.removable" bool="true">
- <!-- do not set acls on unpartitioned volumes, parent gets them -->
- <match key="block.is_volume" bool="true">
- <match key="volume.is_partition" bool="true">
- <addset key="info.capabilities" type="strlist">access_control</addset>
- <merge key="access_control.file" type="copy_property">block.device</merge>
- <merge key="access_control.type" type="string">removable-block</merge>
- </match>
- </match>
- <match key="block.is_volume" bool="false">
- <addset key="info.capabilities" type="strlist">access_control</addset>
- <merge key="access_control.file" type="copy_property">block.device</merge>
- <merge key="access_control.type" type="string">removable-block</merge>
- </match>
- </match>
- </match>
- </match>
<!-- optical drives -->
<match key="info.capabilities" contains="storage.cdrom">
@@ -247,6 +227,31 @@
</match>
</match>
+ <!-- Removable block devices -->
+ <match key="info.capabilities" contains="block">
+ <!-- Don't set removable-block policy to devices which have already another policy
+ as e.g. floppy devices !!! -->
+ <match key="access_control.type" exists="false">
+ <match key="block.device" exists="true">
+ <match key="@block.storage_device:storage.removable" bool="true">
+ <!-- do not set acls on unpartitioned volumes, parent gets them -->
+ <match key="block.is_volume" bool="true">
+ <match key="volume.is_partition" bool="true">
+ <addset key="info.capabilities" type="strlist">access_control</addset>
+ <merge key="access_control.file" type="copy_property">block.device</merge>
+ <merge key="access_control.type" type="string">removable-block</merge>
+ </match>
+ </match>
+ <match key="block.is_volume" bool="false">
+ <addset key="info.capabilities" type="strlist">access_control</addset>
+ <merge key="access_control.file" type="copy_property">block.device</merge>
+ <merge key="access_control.type" type="string">removable-block</merge>
+ </match>
+ </match>
+ </match>
+ </match>
+ </match>
+
<!-- enforcement of policy goes here -->
<!-- add / remove ACL's when devices are added and removed -->
commit 9ff3ffe362c2d72a393aa4cde5c94950e26aeac7
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Mon Feb 2 18:16:39 2009 +0100
provide comparable linux kernel version information
Provide comparable linux kernel version information via these
new properties:
system.kernel.version.major (int)
system.kernel.version.minor (int)
system.kernel.version.micro (int)
This allow us to track changes in the kernel within the fdi
files and rules.
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 3c400ef..d06e970 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -7027,6 +7027,30 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
</row>
<row>
<entry>
+ <literal>system.kernel.version.major</literal> (int)
+ </entry>
+ <entry>example: 2</entry>
+ <entry>No</entry>
+ <entry>The major version number of the running kernel.</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>system.kernel.version.minor</literal> (int)
+ </entry>
+ <entry>example: 6</entry>
+ <entry>No</entry>
+ <entry>The minor version number of the running kernel.</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>system.kernel.version.micro</literal> (int)
+ </entry>
+ <entry>example: 28</entry>
+ <entry>No</entry>
+ <entry>The micro version number of the running kernel.</entry>
+ </row>
+ <row>
+ <entry>
<literal>system.kernel.machine</literal> (string)
</entry>
<entry>example: i686</entry>
diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
index f75d88a..16ee252 100644
--- a/hald/linux/osspec.c
+++ b/hald/linux/osspec.c
@@ -840,6 +840,17 @@ osspec_probe (void)
if (uname (&un) >= 0) {
hal_device_property_set_string (root, "system.kernel.name", un.sysname);
hal_device_property_set_string (root, "system.kernel.version", un.release);
+ if (un.release != NULL && un.release[0] != '\0') {
+ int major, minor, micro ;
+
+ /* check if we can parse the major.minor.micro info and ignore the rest */
+ if ( sscanf( un.release, "%d.%d.%d", &major, &minor, µ ) >= 3 ) {
+ hal_device_property_set_int (root, "system.kernel.version.major", major);
+ hal_device_property_set_int (root, "system.kernel.version.minor", minor);
+ hal_device_property_set_int (root, "system.kernel.version.micro", micro);
+ }
+ }
+
hal_device_property_set_string (root, "system.kernel.machine", un.machine);
}
commit e04a7138ac2de0917e0032dae7bdfc1c2dabc179
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Thu Jan 29 11:31:26 2009 +0100
fix commit 33b54318f73012e24220456216794dd3ff39fc93
Fixed commit 33b54318f73012e24220456216794dd3ff39fc93. Don't use
LIBHAL_FREE_DBUS_ERROR() if there was already a dbus_error_is_set()
check.
diff --git a/tools/hal_get_property.c b/tools/hal_get_property.c
index d31261a..29ab4c5 100644
--- a/tools/hal_get_property.c
+++ b/tools/hal_get_property.c
@@ -177,7 +177,7 @@ main (int argc, char *argv[])
}
if (dbus_error_is_set(&error)) {
fprintf (stderr, "error: libhal_device_exists: %s: %s\n", error.name, error.message);
- LIBHAL_FREE_DBUS_ERROR (&error);
+ dbus_error_free (&error);
return 1;
}
More information about the hal-commit
mailing list