Logo Search packages:      
Sourcecode: hal version File versions

dbus_bool_t hal_volume_policy_should_be_visible ( HalDrive *  drive,
HalVolume *  volume,
HalStoragePolicy *  policy,
const char *  target_mount_point 

Policy function to determine if a volume should be visible in a desktop environment. This is useful to hide certain system volumes as bootstrap partitions, the /usr partition, swap partitions and other volumes that a unprivileged desktop user shouldn't know even exists.

drive Drive that the volume is stemming from
volume Volume
policy Policy object
target_mount_point The mount point that the volume is expected to be mounted at if not already mounted. This may e.g. stem from /etc/fstab. If this is NULL the then mount point isn't taking into account when evaluating whether the volume should be visible
Whether the volume should be shown in a desktop environment.

Definition at line 550 of file libhal-storage.c.

      unsigned int i;
      dbus_bool_t is_visible;
      const char *label;
      const char *mount_point;
      const char *fstype;
      const char *fhs23_toplevel_mount_points[] = {

      is_visible = FALSE;

      /* skip if hal says it's not used as a filesystem */
      if (hal_volume_get_fsusage (volume) != HAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM)
            goto out;

      label = hal_volume_get_label (volume);
      mount_point = hal_volume_get_mount_point (volume);
      fstype = hal_volume_get_fstype (volume);

      /* use target mount point if we're not mounted yet */
      if (mount_point == NULL)
            mount_point = target_mount_point;

      /* bail out if we don't know the filesystem */
      if (fstype == NULL)
            goto out;

      /* blacklist fhs2.3 top level mount points */
      if (mount_point != NULL) {
            for (i = 0; fhs23_toplevel_mount_points[i] != NULL; i++) {
                  if (strcmp (mount_point, fhs23_toplevel_mount_points[i]) == 0)
                        goto out;

      /* blacklist partitions with name 'bootstrap' of type HFS (Apple uses that) */
      if (label != NULL && strcmp (label, "bootstrap") == 0 && strcmp (fstype, "hfs") == 0)
            goto out;

      /* only the real lucky mount points will make it this far :-) */
      is_visible = TRUE;

      return is_visible;

Generated by  Doxygen 1.6.0   Back to index