summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <zeuthen@gmail.com>2013-02-17 14:49:21 -0800
committerDavid Zeuthen <zeuthen@gmail.com>2013-02-17 14:49:21 -0800
commit6ae6c19ad981801d08f3f5b59c0301ed3fe8b7b4 (patch)
tree92f951f832c48ff711490b9198442ccd1a95a806
parent358b377fab62d01ee500aa494bde38d03821da00 (diff)
Introduce UDISKS_FILESYSTEM_SHARED=1 to use /media for mounting
A lot of haters been complaining about /run/media/$USER and there are a couple of setups where it's awkward to use /etc/fstab entries and just easier to write a short udev rule. Signed-off-by: David Zeuthen <zeuthen@gmail.com>
-rw-r--r--doc/man/udisks.xml8
-rw-r--r--src/udiskslinuxfilesystem.c20
2 files changed, 27 insertions, 1 deletions
diff --git a/doc/man/udisks.xml b/doc/man/udisks.xml
index bc4b503..3c371d7 100644
--- a/doc/man/udisks.xml
+++ b/doc/man/udisks.xml
@@ -252,6 +252,14 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>UDISKS_FILESYSTEM_SHARED</option></term>
+ <listitem>
+ <para>
+ If set to 1, the filesystem on the device will be mounted in a shared directory (e.g. <filename class='directory'>/media/VolumeName</filename>) instead of a private directory (e.g. <filename class='directory'>/run/media/$USER/VolumeName</filename>) when the <link linkend="gdbus-method-org-freedesktop-UDisks2-Filesystem.Mount">Filesystem.Mount()</link> method is handled.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>ID_SEAT</option></term>
<listitem>
<para>
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
index 1e8ac7e..e87e272 100644
--- a/src/udiskslinuxfilesystem.c
+++ b/src/udiskslinuxfilesystem.c
@@ -841,6 +841,8 @@ calculate_mount_point (UDisksDaemon *daemon,
const gchar *fs_type,
GError **error)
{
+ UDisksLinuxBlockObject *object = NULL;
+ gboolean fs_shared = FALSE;
const gchar *label = NULL;
const gchar *uuid = NULL;
gchar *escaped_user_name = NULL;
@@ -859,10 +861,25 @@ calculate_mount_point (UDisksDaemon *daemon,
uuid = udisks_block_get_id_uuid (block);
}
+ object = udisks_daemon_util_dup_object (block, NULL);
+ if (object != NULL)
+ {
+ UDisksLinuxDevice *device = udisks_linux_block_object_get_device (object);
+ if (device != NULL)
+ {
+ if (device->udev_device != NULL)
+ {
+ /* TODO: maybe introduce Block:HintFilesystemShared instead of pulling it directly from the udev device */
+ fs_shared = g_udev_device_get_property_as_boolean (device->udev_device, "UDISKS_FILESYSTEM_SHARED");
+ }
+ g_object_unref (device);
+ }
+ }
+
/* If we know the user-name and it doesn't have any '/' character in
* it, mount in /run/media/$USER
*/
- if (user_name != NULL && strstr (user_name, "/") == NULL)
+ if (!fs_shared && (user_name != NULL && strstr (user_name, "/") == NULL))
{
mount_dir = g_strdup_printf ("/run/media/%s", user_name);
if (!g_file_test (mount_dir, G_FILE_TEST_EXISTS))
@@ -963,6 +980,7 @@ calculate_mount_point (UDisksDaemon *daemon,
g_free (mount_dir);
out:
+ g_clear_object (&object);
g_free (escaped_user_name);
return mount_point;
}