From 713ed67f13e98a5443e00e3d8b08b336ff1c6720 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 6 Mar 2013 17:58:04 +0900 Subject: [PATCH] mount everything under /run/media/{private,shared}/ This avoids the need for the top-level /media folder (which is commonly misused) and should unify the handling of private and shared mounts a bit. In addition to introducing the new /run/media/shared folder, we move the private mounts from /run/media/ to /run/media/private to avoid any namespace clashes. It was suggestend by to use the terms public/private rather than shared/private, as it would be more symmetric. If we do that, the udev variable should be changed too I guess. Reference: . Signed-off-by: Tom Gundersen --- data/org.freedesktop.UDisks2.xml | 4 ++-- doc/man/udisksctl.xml | 2 +- src/udiskslinuxfilesystem.c | 18 +++++++++--------- src/udisksstate.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml index 6e40c9b..546aea0 100644 --- a/data/org.freedesktop.UDisks2.xml +++ b/data/org.freedesktop.UDisks2.xml @@ -1525,8 +1525,8 @@ below. In either case, the directory the filesystem is mounted in, is returned in @mount_path on success - it is usually a sub-directory of /run/media/$USER but note that - any directory may be returned. + class='directory'>/run/media/private/$USER but note + that any directory may be returned. The filesystem type to use can be overridden with the @fstype option and mount options (a comma-separated string) can be diff --git a/doc/man/udisksctl.xml b/doc/man/udisksctl.xml index 8f38479..6d796b1 100644 --- a/doc/man/udisksctl.xml +++ b/doc/man/udisksctl.xml @@ -168,7 +168,7 @@ Mounts a device. The device will be mounted in a - subdirectory in the /media hierarchy + subdirectory in the /run/media hierarchy - upon successful completion, the mount point will be printed to standard output. diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c index e87e272..f0e9f30 100644 --- a/src/udiskslinuxfilesystem.c +++ b/src/udiskslinuxfilesystem.c @@ -877,26 +877,26 @@ calculate_mount_point (UDisksDaemon *daemon, } /* If we know the user-name and it doesn't have any '/' character in - * it, mount in /run/media/$USER + * it, mount in /run/media/private/$USER */ if (!fs_shared && (user_name != NULL && strstr (user_name, "/") == NULL)) { - mount_dir = g_strdup_printf ("/run/media/%s", user_name); + mount_dir = g_strdup_printf ("/run/media/private/%s", user_name); if (!g_file_test (mount_dir, G_FILE_TEST_EXISTS)) { - /* First ensure that /run/media exists */ - if (!g_file_test ("/run/media", G_FILE_TEST_EXISTS)) + /* First ensure that /run/media/private exists */ + if (!g_file_test ("/run/media/private", G_FILE_TEST_EXISTS)) { - if (g_mkdir ("/run/media", 0755) != 0) + if (g_mkdir ("/run/media/private", 0755) != 0) { g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED, - "Error creating directory /run/media: %m"); + "Error creating directory /run/media/private: %m"); goto out; } } - /* Then create the per-user /run/media/$USER */ + /* Then create the per-user /run/media/private/$USER */ if (g_mkdir (mount_dir, 0700) != 0) { g_set_error (error, @@ -915,9 +915,9 @@ calculate_mount_point (UDisksDaemon *daemon, } } } - /* otherwise fall back to mounting in /media */ + /* otherwise fall back to mounting in /run/media/shared */ if (mount_dir == NULL) - mount_dir = g_strdup ("/media"); + mount_dir = g_strdup ("/run/media/shared"); /* NOTE: UTF-8 has the nice property that valid UTF-8 strings only contains * the byte 0x2F if it's for the '/' character (U+002F SOLIDUS). diff --git a/src/udisksstate.c b/src/udisksstate.c index e7b549a..71f2c97 100644 --- a/src/udisksstate.c +++ b/src/udisksstate.c @@ -61,7 +61,7 @@ * /run/udisks2/mounted-fs * * A serialized 'a{sa{sv}}' #GVariant mapping from the - * mount point (e.g. /media/EOS_DIGITAL) into a set of details. + * mount point (e.g. /run/media/shared/EOS_DIGITAL) into a set of details. * Known details include * block-device * (of type 't') that is the #dev_t -- 1.8.2