Appending options for partitioned disks

Stephen Frank sf1183 at messiah.edu
Tue May 10 08:30:53 PDT 2005


>>> Andrey Borzenkov <arvidjaar at mail.ru> 05/10/05 7:07 AM >>>
On Tuesday 10 May 2005 08:27, Stephen Frank wrote:
[...]
> But what if I don't want to set it to true by default, but only for
> thumbdrives? Well, I tried using a set of match tags to narrow my
selection
> to only USB storage devices, then settings the key:
> storage.policy.mount_option.users to true
> but unfortunately, that key only applies when the device is
> non-partitioned. Thus, I cannot custom adjust the mounting options for
> partitioned disks.
>

do you mean that volume.policy.mount_option.* no more morks?

{pts/1}% lshal | grep mount_opt
lshal version 0.4.7
  storage.policy.mount_option.iocharset=utf8 = true  (bool)
  storage.policy.mount_option.codepage=866 = true  (bool)
  volume.policy.mount_option.utf8 = true  (bool)
  volume.policy.mount_option.iocharset=utf8 = true  (bool)
[...]
-andrey

Hmm. Yes, I had seen those, but I was under the impression that I could only
apply them to very specific disks. I tried setting
volume.policy.mount_option.*, but it didn't seem to carry through to subsets
of devices. In other works, using hal-device-manager I could see that it
successfully set those options for anything with the match characteristics I
specficied (eg. the thing labelled STORAGE DEVICE), but the volume mounted
under the STORAGE DEVICE did not retain those options becaue it did not
match storage.bus=usb or info.category=storage.

Here are the lines from my config.fdi file:
  <device>
    <!-- Match USB Storage Devices -->
    <match key="info.category" string="storage">     
      <match key="storage.bus" string="usb">
        <merge key="volume.policy.mount_option.users"
type="bool">true</merge>
      </match>
    </match>
  </device>

For those whos browsers tag-i-fied the XML up there, here is the same thing
with the < replaced by (:
  (device)
    (!-- Match USB Storage Devices --)
    (match key="info.category" string="storage">     
      (match key="storage.bus" string="usb")
        (merge key="volume.policy.mount_option.users"
type="bool")true(/merge)
      (/match)
    (/match)
  (/device)

Here are parts of the output from lshal:
udi = '/org/freedesktop/Hal/devices/block_50E0-D8B5'
  volume.mount_point = ''  (string)
  volume.policy.mount_option.noatime = true  (bool)
  volume.policy.mount_option.sync = true  (bool)
  volume.policy.desired_mount_point = 'WOZARK'  (string)
  volume.policy.mount_filesystem = 'vfat'  (string)
  volume.policy.should_mount = true  (bool)
  info.udi = '/org/freedesktop/Hal/devices/block_50E0-D8B5'  (string)
  volume.partition.msdos_part_table_type = 11  (0xb)  (int)
  volume.size = 262127616  (0xf9fc000)  (uint64)
  volume.block_size = 512  (0x200)  (int)
  volume.num_blocks = 511968  (0x7cfe0)  (int)
  volume.partition.number = 1  (0x1)  (int)
  volume.is_partition = true  (bool)
  volume.is_mounted = false  (bool)
  volume.is_disc = false  (bool)
  volume.uuid = '50E0-D8B5'  (string)
  volume.label = 'WOZARK'  (string)
  volume.fsversion = 'FAT32'  (string)
  volume.fsusage = 'filesystem'  (string)
  volume.fstype = 'vfat'  (string)
  info.product = 'WOZARK'  (string)
  block.storage_device = '/org/freedesktop/Hal/devices/block_8_0'  (string)
  block.minor = 1  (0x1)  (int)
  block.major = 8  (0x8)  (int)
  info.capabilities = 'block volume'  (string)
  info.category = 'volume'  (string)
  info.parent = '/org/freedesktop/Hal/devices/block_8_0'  (string)
  block.device = '/dev/sda1'  (string)
  block.is_volume = true  (bool)
  block.have_scanned = false  (bool)
  block.no_partitions = false  (bool)
  linux.sysfs_path_device = '/sys/block/sda/sda1'  (string)
  linux.sysfs_path = '/sys/block/sda/sda1'  (string)
  info.bus = 'block'  (string)

udi = '/org/freedesktop/Hal/devices/block_8_0'
  volume.policy.mount_option.users = true  (bool)
  storage.policy.should_mount = true  (bool)
  info.udi = '/org/freedesktop/Hal/devices/block_8_0'  (string)
  storage.requires_eject = false  (bool)
  storage.hotpluggable = true  (bool)
  storage.removable = true  (bool)
  info.product = 'STORAGE DEVICE'  (string)
  info.vendor = 'Generic'  (string)
  storage.drive_type = 'disk'  (string)
  block.storage_device = '/org/freedesktop/Hal/devices/block_8_0'  (string)
  storage.physical_device =
'/org/freedesktop/Hal/devices/usb_usb_device_781_8185_125_-1_000197113_0' 
(string)
  storage.vendor = 'Generic'  (string)
  storage.model = 'STORAGE DEVICE'  (string)
  storage.automount_enabled_hint = true  (bool)
  storage.no_partitions_hint = false  (bool)
  storage.media_check_enabled = true  (bool)
  storage.bus = 'usb'  (string)
  block.minor = 0  (0x0)  (int)
  block.major = 8  (0x8)  (int)
  info.capabilities = 'block storage'  (string)
  info.category = 'storage'  (string)
  block.device = '/dev/sda'  (string)
  info.parent = '/org/freedesktop/Hal/devices/scsi_30_0_0_0'  (string)
  block.is_volume = false  (bool)
  block.have_scanned = false  (bool)
  block.no_partitions = false  (bool)
  linux.sysfs_path_device = '/sys/block/sda'  (string)
  linux.sysfs_path = '/sys/block/sda'  (string)
  info.bus = 'block'  (string)

As you can see, I would like to assign the mount option users to any USB
storage device, not just to this one, so I use match to get USB storage
devices. However, the result of this is that 
volume.policy.mount_option.users gets set to true for the parent device (my
USB storage device), but this option never gets set on the child device (the
mounted drive). This makes sense to me, since volume.policy.mount_option.*
sounds like something that would apply only to a specific volume. I,
however, want to assign a mount option oolicy to all matching storage
devices, hence why I wanted to use storage.policy.mount_option.*. (Because
in the end it's not practical to write a match for every single volume ever
mounted. It seems like these volumes have no keys that that make them
uniquely USB volumes, so it's difficult to write a generic rule for them. It
would just get propagated to all volumes, USB or not, which isn't what I
want.)
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list