diff options
| author | Martin Pitt <martin.pitt@ubuntu.com> | 2011-05-04 10:38:01 +0200 |
|---|---|---|
| committer | Martin Pitt <martin.pitt@ubuntu.com> | 2011-05-04 10:38:01 +0200 |
| commit | 156ebd5ca8f88b7a4772c03ed269ae30718f866d (patch) | |
| tree | f0c66555408acaddbcae3eb44bafe6e5b542a0b5 | |
| parent | 361a2ce3f2fc0b6ef02ac11d31bf77a0a9354e70 (diff) | |
Add override for system internal property
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!
| -rw-r--r-- | doc/man/udisks7.xml | 10 | ||||
| -rw-r--r-- | src/device.c | 9 |
2 files changed, 16 insertions, 3 deletions
diff --git a/doc/man/udisks7.xml b/doc/man/udisks7.xml index c5d0a55..4e97b28 100644 --- a/doc/man/udisks7.xml +++ b/doc/man/udisks7.xml @@ -74,6 +74,16 @@ 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 diff --git a/src/device.c b/src/device.c index a928fb5..22779c7 100644 --- a/src/device.c +++ b/src/device.c @@ -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 |
