hal/fdi/90defaultpolicy storage-policy.fdi,1.1,1.2
David Zeuthen
david at freedesktop.org
Wed Oct 13 11:50:47 PDT 2004
Update of /cvs/hal/hal/fdi/90defaultpolicy
In directory gabe:/tmp/cvs-serv10994/fdi/90defaultpolicy
Modified Files:
storage-policy.fdi
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: storage-policy.fdi
===================================================================
RCS file: /cvs/hal/hal/fdi/90defaultpolicy/storage-policy.fdi,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- storage-policy.fdi 12 Oct 2004 20:17:08 -0000 1.1
+++ storage-policy.fdi 13 Oct 2004 18:50:45 -0000 1.2
@@ -77,59 +77,104 @@
<!-- Normal volumes; use volume label, uuid or drive_type -->
<match key="block.is_volume" bool="true">
<match key="volume.fsusage" string="filesystem">
+ <!-- skip for drives with the no partitions hint (they are handled above) -->
+ <match key="@block.storage_device:storage.no_partitions_hint" bool="false">
- <merge key="volume.policy.should_mount" type="bool">true</merge>
- <merge key="volume.policy.mount_filesystem" type="copy_property">volume.fstype</merge>
-
- <!-- Fallback is '<storage.drive_type>', e.g. disk, compact_flash etc. -->
- <merge key="volume.policy.desired_mount_point" type="copy_property">@block.storage_device:storage.drive_type</merge>
-
- <!-- Better: if available use UUID -->
- <match key="volume.uuid" empty="false">
- <merge key="volume.policy.desired_mount_point" type="copy_property">volume.uuid</merge>
- </match>
-
- <!-- Best: If available use filesystem label -->
- <match key="volume.label" empty="false">
- <!-- unless it's a path (e.g. /boot, /, /home etc) -->
- <match key="volume.label" is_absolute_path="false">
- <merge key="volume.policy.desired_mount_point" type="copy_property">volume.label</merge>
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ <merge key="volume.policy.mount_filesystem" type="copy_property">volume.fstype</merge>
+
+ <!-- Fallback is '<storage.drive_type>', e.g. disk, compact_flash etc. -->
+ <merge key="volume.policy.desired_mount_point" type="copy_property">@block.storage_device:storage.drive_type</merge>
+
+ <!-- Better: if available use UUID -->
+ <match key="volume.uuid" empty="false">
+ <merge key="volume.policy.desired_mount_point" type="copy_property">volume.uuid</merge>
</match>
- </match>
-
- <!-- Should never mount Apple Bootstrap partitions (it would be
- a security hole) - should use the bootable flag from the
- Mac partition table instead -->
- <match key="volume.fstype" string="hfs">
- <match key="volume.label" string="bootstrap">
- <merge key="volume.policy.should_mount" type="bool">false</merge>
- </match>
- </match>
-
- <!-- Use selinux mount options for hotpluggable and removable
- volumes -->
- <match key="/org/freedesktop/Hal/devices/computer:linux.is_selinux_enabled" bool="true">
- <match key="@block.storage_device:storage.hotpluggable" bool="true">
- <merge key="volume.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>
+
+ <!-- Best: If available use filesystem label -->
+ <match key="volume.label" empty="false">
+ <!-- unless it's a path (e.g. /boot, /, /home etc) -->
+ <match key="volume.label" is_absolute_path="false">
+ <!-- and only if the label is ascii -->
+ <match key="volume.label" is_ascii="true">
+ <merge key="volume.policy.desired_mount_point" type="copy_property">volume.label</merge>
+ </match>
+ </match>
+ </match>
+
+ <!-- Should never mount Apple Bootstrap partitions (it would be
+ a security hole) - should use the bootable flag from the
+ Mac partition table instead -->
+ <match key="volume.fstype" string="hfs">
+ <match key="volume.label" string="bootstrap">
+ <merge key="volume.policy.should_mount" type="bool">false</merge>
+ </match>
</match>
- <match key="@block.storage_device:storage.removable" bool="true">
- <merge key="volume.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>
+
+ <!-- Use selinux mount options for hotpluggable and removable
+ volumes -->
+ <match key="/org/freedesktop/Hal/devices/computer:linux.is_selinux_enabled" bool="true">
+ <match key="@block.storage_device:storage.hotpluggable" bool="true">
+ <merge key="volume.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>
+ </match>
+ <match key="@block.storage_device:storage.removable" bool="true">
+ <merge key="volume.policy.mount_option.fscontext=system_u:object_r:removable_t" type="bool">true</merge>
+ </match>
</match>
- </match>
- <!-- Use noatime and sync options for all hotpluggable or removable
- volumes smaller than 2GB -->
- <match key="volume.size" compare_lt="2147483648">
- <match key="@block.storage_device:storage.hotpluggable" bool="true">
- <merge key="volume.policy.mount_option.async" type="bool">true</merge>
- <merge key="volume.policy.mount_option.noatime" type="bool">true</merge>
+ <!-- Use noatime and sync options for all hotpluggable or removable
+ volumes smaller than 2GB -->
+ <match key="volume.size" compare_lt="2147483648">
+ <match key="@block.storage_device:storage.hotpluggable" bool="true">
+ <merge key="volume.policy.mount_option.async" type="bool">true</merge>
+ <merge key="volume.policy.mount_option.noatime" type="bool">true</merge>
+ </match>
+ <match key="@block.storage_device:storage.removable" bool="true">
+ <merge key="volume.policy.mount_option.async" type="bool">true</merge>
+ <merge key="volume.policy.mount_option.noatime" type="bool">true</merge>
+ </match>
</match>
- <match key="@block.storage_device:storage.removable" bool="true">
- <merge key="volume.policy.mount_option.async" type="bool">true</merge>
- <merge key="volume.policy.mount_option.noatime" type="bool">true</merge>
+
+ <!-- whitelist of partition table id, if from a msdos partition table -->
+ <match key="volume.partition.msdos_part_table_type" exists="true">
+ <!-- Default to no mount and punch holes -->
+ <merge key="volume.policy.should_mount" type="bool">false</merge>
+ <!-- Linux -->
+ <match key="volume.partition.msdos_part_table_type" int="0x83">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
+ <!-- FAT12 -->
+ <match key="volume.partition.msdos_part_table_type" int="0x01">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
+ <!-- FAT16 <32M -->
+ <match key="volume.partition.msdos_part_table_type" int="0x04">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
+ <!-- FAT16 -->
+ <match key="volume.partition.msdos_part_table_type" int="0x06">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
+ <!-- HPFS/NTFS -->
+ <match key="volume.partition.msdos_part_table_type" int="0x07">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
+ <!-- W95 FAT32 -->
+ <match key="volume.partition.msdos_part_table_type" int="0x0b">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
+ <!-- W95 FAT32 (LBA) -->
+ <match key="volume.partition.msdos_part_table_type" int="0x0c">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
+ <!-- W95 FAT16 (LBA) -->
+ <match key="volume.partition.msdos_part_table_type" int="0x0e">
+ <merge key="volume.policy.should_mount" type="bool">true</merge>
+ </match>
</match>
- </match>
+
+ </match>
</match>
</match>
</device>
More information about the hal-commit
mailing list