Add override for system internal property
authorMartin Pitt <martin.pitt@ubuntu.com>
Wed, 4 May 2011 08:38:01 +0000 (10:38 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Wed, 4 May 2011 08:38:01 +0000 (10:38 +0200)
Check UDISKS_SYSTEM_INTERNAL udev property to override the usual bus type based
"is drive system internal?" detection.

Based on patch by Patrick Stewart <patstew@gmail.com>, thank you!

doc/man/udisks7.xml
src/device.c

index c5d0a55..4e97b28 100644 (file)
         icon theme specification.
         </para></listitem>
       </varlistentry>
+
+      <varlistentry>
+        <term><option>UDISKS_SYSTEM_INTERNAL</option></term>
+        <listitem><para>If set, this will override the usual bus type based
+           detection of whether a device is considered "system internal". "0"
+           means "removable" (i. e. eligible for automounting, and normal
+           users can mount), any other value means "system internal" (i.
+           e. no automounting, and only administrators can mount).
+        </para></listitem>
+      </varlistentry>
     </variablelist>
     <para>
       The <option>ID_DRIVE_*</option> properties are used to describe what
index a928fb5..22779c7 100644 (file)
@@ -3849,9 +3849,12 @@ static gboolean
 update_info_is_system_internal (Device *device)
 {
   gboolean is_system_internal;
-
-  /* TODO: make it possible to override this property from a udev property.
-   */
+  
+  if (g_udev_device_has_property (device->priv->d, "UDISKS_SYSTEM_INTERNAL"))
+    {
+      is_system_internal = g_udev_device_get_property_as_boolean (device->priv->d, "UDISKS_SYSTEM_INTERNAL");
+      goto determined;
+    }
 
   /* start out by assuming the device is system internal, then adjust depending on what kind of
    * device we are dealing with