hal/hald device_info.c,1.14,1.15
David Zeuthen
david at freedesktop.org
Wed Oct 13 11:50:47 PDT 2004
Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv10994/hald
Modified Files:
device_info.c
Log Message:
2004-10-13 David Zeuthen <davidz at redhat.com>
* doc/spec/hal-spec.xml.in: Add docs for is_ascii attribute on the
match directive.
* fdi/90defaultpolicy/storage-policy.fdi: Don't add volume policy
if the drive has the no_partitions_hint set to TRUE. Require label
to be ASCII if using the label as a mount point. Use whitelist of
msdos partition types if volume stems from a drive with a msdos
partition table.
* hald/device_info.c (handle_match): Add the is_ascii match check.
* libhal-storage/libhal-storage.c:
(hal_drive_free): Free newly added fields
(hal_volume_free): Free newly added fields
(hal_drive_from_udi): Add should_mount, mount_filesystem,
desired_mount_point properties
(hal_volume_from_udi): Add should_mount, mount_filesystem,
desired_mount_point properties
(hal_drive_policy_default_get_mount_root): New function
(hal_drive_policy_default_use_managed_keyword): New function
(hal_drive_policy_default_get_managed_keyword_primary): New function
(hal_drive_policy_default_get_managed_keyword_secondary): New function
(hal_drive_policy_is_mountable): New function
(hal_drive_policy_get_desired_mount_point): New function
(hal_drive_policy_get_mount_options): New function
(hal_drive_policy_get_mount_fs): New function
(hal_volume_policy_is_mountable): New function
(hal_volume_policy_get_desired_mount_point): New function
(hal_volume_policy_get_mount_options): New function
(hal_volume_policy_get_mount_fs): New function
(hal_drive_no_partitions_hint): New function
* libhal-storage/libhal-storage.h: Add prototypes for new functions
Index: device_info.c
===================================================================
RCS file: /cvs/hal/hal/hald/device_info.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- device_info.c 13 Oct 2004 13:50:07 -0000 1.14
+++ device_info.c 13 Oct 2004 18:50:45 -0000 1.15
@@ -468,6 +468,37 @@
else
return TRUE;
}
+ } else if (strcmp (attr[2], "is_ascii") == 0) {
+ dbus_bool_t is_ascii = TRUE;
+ dbus_bool_t should_be_ascii = TRUE;
+ unsigned int i;
+ const char *str;
+
+ if (strcmp (attr[3], "false") == 0)
+ should_be_ascii = FALSE;
+
+ if (hal_device_property_get_type (d, prop_to_check) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ is_ascii = TRUE;
+
+ str = hal_device_property_get_string (d, prop_to_check);
+ for (i = 0; str[i] != '\0'; i++) {
+ if (((unsigned char) str[i]) > 0x7f)
+ is_ascii = FALSE;
+ }
+
+ if (should_be_ascii) {
+ if (is_ascii)
+ return TRUE;
+ else
+ return FALSE;
+ } else {
+ if (is_ascii)
+ return FALSE;
+ else
+ return TRUE;
+ }
} else if (strcmp (attr[2], "is_absolute_path") == 0) {
const char *path = NULL;
dbus_bool_t is_absolute_path = FALSE;
More information about the hal-commit
mailing list