From a1dfd7d1f4d0c913955c810376d683b1632334b0 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 30 Mar 2011 13:46:06 -0400 Subject: [PATCH] Add org.freedesktop.UDisks2.Swapspace interface Whether an swap device is in use or not, can be tracked via the :Active property. A swap device can be activated or deactivated with the Start() and Stop() methods. For now, Start() and Stop() are not actually hooked up. Implementation-wise, monitoring /proc/swaps requires this patch http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=66d7dd518ae413a383ab2c6c263cc30617329842 which is in Linux 2.6.38 or later. Example: $ udisksctl monitor Monitoring the udisks daemon. Press Ctrl+C to exit. 13:49:08.441: The udisks-daemon is running (name-owner :1.315). 13:49:11.720: /org/freedesktop/UDisks2/block_devices/sda3: org.freedesktop.UDisks2.Swapspace: Properties Changed Active: false 13:49:11.746: /org/freedesktop/UDisks2/block_devices/sda3: org.freedesktop.UDisks2.LinuxSysfsDevice::UEvent (b'change',) 13:49:15.310: /org/freedesktop/UDisks2/block_devices/sda3: org.freedesktop.UDisks2.Swapspace: Properties Changed Active: true Signed-off-by: David Zeuthen --- data/org.freedesktop.UDisks2.xml | 15 +++ doc/udisks2-sections.txt | 4 +- src/types.h | 13 +++ src/udisksfstabprovider.c | 3 +- src/udiskslinuxblock.c | 54 +++++++++- src/udisksmount.c | 34 +++++- src/udisksmount.h | 11 +- src/udisksmountmonitor.c | 226 +++++++++++++++++++++++++++++++-------- src/udisksmountmonitor.h | 5 +- src/udiskspersistentstore.c | 3 +- src/udisksprivate.h | 3 +- 11 files changed, 310 insertions(+), 61 deletions(-) diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml index 0677f10..9637396 100644 --- a/data/org.freedesktop.UDisks2.xml +++ b/data/org.freedesktop.UDisks2.xml @@ -223,6 +223,21 @@ + + + + + + + + + + + + + + + diff --git a/doc/udisks2-sections.txt b/doc/udisks2-sections.txt index 1f9f374..74cb589 100644 --- a/doc/udisks2-sections.txt +++ b/doc/udisks2-sections.txt @@ -208,7 +208,9 @@ udisks_fstab_provider_get_type udisksmount UDisksMount UDisksMount +UDisksMountType udisks_mount_get_dev +udisks_mount_get_mount_type udisks_mount_get_mount_path udisks_mount_compare @@ -225,7 +227,7 @@ udisks_mount_get_type UDisksMountMonitor udisks_mount_monitor_new udisks_mount_monitor_get_mounts_for_dev -udisks_mount_monitor_is_dev_mounted +udisks_mount_monitor_is_dev_in_use UDISKS_TYPE_MOUNT_MONITOR UDISKS_MOUNT_MONITOR diff --git a/src/types.h b/src/types.h index 8eda683..c27cb97 100644 --- a/src/types.h +++ b/src/types.h @@ -96,4 +96,17 @@ typedef gboolean (*UDisksThreadedJobFunc) (UDisksThreadedJob *job, struct _UDisksPersistentStore; typedef struct _UDisksPersistentStore UDisksPersistentStore; +/** + * UDisksMountType: + * @UDISKS_MOUNT_TYPE_FILESYSTEM: Object correspond to a mounted filesystem. + * @UDISKS_MOUNT_TYPE_SWAP: Object correspond to an in-use swap device. + * + * Types of a mount. + */ +typedef enum +{ + UDISKS_MOUNT_TYPE_FILESYSTEM, + UDISKS_MOUNT_TYPE_SWAP +} UDisksMountType; + #endif diff --git a/src/udisksfstabprovider.c b/src/udisksfstabprovider.c index 5aae8c4..f6f7727 100644 --- a/src/udisksfstabprovider.c +++ b/src/udisksfstabprovider.c @@ -565,7 +565,8 @@ update_entry (UDisksFstabProvider *provider, { UDisksMount *mount = UDISKS_MOUNT (l->data); - if (g_strcmp0 (udisks_mount_get_mount_path (mount), entry->path) == 0) + if (udisks_mount_get_mount_type (mount) == UDISKS_MOUNT_TYPE_FILESYSTEM && + g_strcmp0 (udisks_mount_get_mount_path (mount), entry->path) == 0) { is_applied = TRUE; break; diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c index 8812e94..3a7ae90 100644 --- a/src/udiskslinuxblock.c +++ b/src/udiskslinuxblock.c @@ -68,6 +68,7 @@ struct _UDisksLinuxBlock UDisksLinuxSysfsDevice *iface_linux_sysfs_device; UDisksBlockDevice *iface_block_device; UDisksFilesystem *iface_filesystem; + UDisksSwapspace *iface_swapspace; }; struct _UDisksLinuxBlockClass @@ -778,10 +779,14 @@ static gboolean filesystem_check (UDisksLinuxBlock *block) { gboolean ret; + UDisksMountType mount_type; ret = FALSE; - if (udisks_block_device_get_id_usage (block->iface_block_device) || - udisks_mount_monitor_is_dev_mounted (block->mount_monitor, g_udev_device_get_device_number (block->device))) + if (g_strcmp0 (udisks_block_device_get_id_usage (block->iface_block_device), "filesystem") == 0 || + (udisks_mount_monitor_is_dev_in_use (block->mount_monitor, + g_udev_device_get_device_number (block->device), + &mount_type) && + mount_type == UDISKS_MOUNT_TYPE_FILESYSTEM)) ret = TRUE; return ret; @@ -806,7 +811,8 @@ filesystem_update (UDisksLinuxBlock *block, for (l = mounts; l != NULL; l = l->next) { UDisksMount *mount = UDISKS_MOUNT (l->data); - g_ptr_array_add (p, (gpointer) udisks_mount_get_mount_path (mount)); + if (udisks_mount_get_mount_type (mount) == UDISKS_MOUNT_TYPE_FILESYSTEM) + g_ptr_array_add (p, (gpointer) udisks_mount_get_mount_path (mount)); } g_ptr_array_add (p, NULL); udisks_filesystem_set_mount_points (iface, (const gchar *const *) p->pdata); @@ -816,6 +822,45 @@ filesystem_update (UDisksLinuxBlock *block, } /* ---------------------------------------------------------------------------------------------------- */ +/* org.freedesktop.UDisks.Swapspace */ + +static gboolean +swapspace_check (UDisksLinuxBlock *block) +{ + gboolean ret; + UDisksMountType mount_type; + + ret = FALSE; + if ((g_strcmp0 (udisks_block_device_get_id_usage (block->iface_block_device), "other") == 0 && + g_strcmp0 (udisks_block_device_get_id_type (block->iface_block_device), "swap") == 0) + || (udisks_mount_monitor_is_dev_in_use (block->mount_monitor, + g_udev_device_get_device_number (block->device), + &mount_type) + && mount_type == UDISKS_MOUNT_TYPE_SWAP)) + ret = TRUE; + + return ret; +} + +static void +swapspace_update (UDisksLinuxBlock *block, + const gchar *uevent_action, + GDBusInterface *_iface) +{ + UDisksSwapspace *iface = UDISKS_SWAPSPACE (_iface); + UDisksMountType mount_type; + gboolean active; + + active = FALSE; + if (udisks_mount_monitor_is_dev_in_use (block->mount_monitor, + g_udev_device_get_device_number (block->device), + &mount_type) + && mount_type == UDISKS_MOUNT_TYPE_SWAP) + active = TRUE; + udisks_swapspace_set_active (iface, active); +} + +/* ---------------------------------------------------------------------------------------------------- */ /** * udisks_linux_block_uevent: @@ -846,6 +891,9 @@ udisks_linux_block_uevent (UDisksLinuxBlock *block, UDISKS_TYPE_BLOCK_DEVICE_STUB, &block->iface_block_device); update_iface (block, action, filesystem_check, NULL, filesystem_update, UDISKS_TYPE_LINUX_FILESYSTEM, &block->iface_filesystem); + /* TODO: need to hook up Start() and Stop() methods */ + update_iface (block, action, swapspace_check, NULL, swapspace_update, + UDISKS_TYPE_SWAPSPACE_STUB, &block->iface_swapspace); } /* ---------------------------------------------------------------------------------------------------- */ diff --git a/src/udisksmount.c b/src/udisksmount.c index d4dea09..99dcba3 100644 --- a/src/udisksmount.c +++ b/src/udisksmount.c @@ -39,10 +39,10 @@ /** * SECTION:udisksmount * @title: UDisksMount - * @short_description: Object corresponding to a mount + * @short_description: Object corresponding to a filesystem mount or in-use swap device * - * Object corresponding to mount. You cannot instantiate this type - * yourself – use #UDisksMountMonitor. + * Object corresponding to mount or in-use swap device. You cannot + * instantiate this type yourself – use #UDisksMountMonitor. */ /** @@ -57,6 +57,7 @@ struct _UDisksMount gchar *mount_path; dev_t dev; + UDisksMountType type; }; typedef struct _UDisksMountClass UDisksMountClass; @@ -95,13 +96,15 @@ udisks_mount_class_init (UDisksMountClass *klass) UDisksMount * _udisks_mount_new (dev_t dev, - const gchar *mount_path) + const gchar *mount_path, + UDisksMountType type) { UDisksMount *mount; mount = UDISKS_MOUNT (g_object_new (UDISKS_TYPE_MOUNT, NULL)); mount->dev = dev; mount->mount_path = g_strdup (mount_path); + mount->type = type; return mount; } @@ -110,7 +113,9 @@ _udisks_mount_new (dev_t dev, * udisks_mount_get_mount_path: * @mount: A #UDisksMount * - * Gets the mount path for @mount. + * Gets the mount path for a #UDISKS_MOUNT_TYPE_FILESYSTEM-type mount. + * + * It is a programming error to call this on any other type of #UDisksMount. * * Returns: A string owned by @mount. Do not free. */ @@ -118,6 +123,7 @@ const gchar * udisks_mount_get_mount_path (UDisksMount *mount) { g_return_val_if_fail (UDISKS_IS_MOUNT (mount), NULL); + g_return_val_if_fail (mount->type == UDISKS_MOUNT_TYPE_FILESYSTEM, NULL); return mount->mount_path; } @@ -159,7 +165,25 @@ udisks_mount_compare (UDisksMount *mount, goto out; ret = (mount->dev - other_mount->dev); + if (ret != 0) + goto out; + + ret = mount->type - other_mount->type; out: return ret; } + +/** + * udisks_mount_get_mount_type: + * @mount: A #UDisksMount. + * + * Gets the #UDisksMountType for @mount. + * + * Returns: A value from the #UDisksMountType enumeration. + */ +UDisksMountType +udisks_mount_get_mount_type (UDisksMount *mount) +{ + return mount->type; +} diff --git a/src/udisksmount.h b/src/udisksmount.h index 3492098..afa0bd5 100644 --- a/src/udisksmount.h +++ b/src/udisksmount.h @@ -29,11 +29,12 @@ G_BEGIN_DECLS #define UDISKS_MOUNT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UDISKS_TYPE_MOUNT, UDisksMount)) #define UDISKS_IS_MOUNT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), UDISKS_TYPE_MOUNT)) -GType udisks_mount_get_type (void) G_GNUC_CONST; -const gchar *udisks_mount_get_mount_path (UDisksMount *mount); -dev_t udisks_mount_get_dev (UDisksMount *mount); -gint udisks_mount_compare (UDisksMount *mount, - UDisksMount *other_mount); +GType udisks_mount_get_type (void) G_GNUC_CONST; +UDisksMountType udisks_mount_get_mount_type (UDisksMount *mount); +const gchar *udisks_mount_get_mount_path (UDisksMount *mount); +dev_t udisks_mount_get_dev (UDisksMount *mount); +gint udisks_mount_compare (UDisksMount *mount, + UDisksMount *other_mount); G_END_DECLS diff --git a/src/udisksmountmonitor.c b/src/udisksmountmonitor.c index c49083e..74b8079 100644 --- a/src/udisksmountmonitor.c +++ b/src/udisksmountmonitor.c @@ -40,11 +40,12 @@ /** * SECTION:udisksmountmonitor * @title: UDisksMountMonitor - * @short_description: Monitors mounted devices + * @short_description: Monitors mounted filesystems or in-use swap devices * - * This type is used for monitoring mounted devices. On Linux, this is - * done by inspecting and monitoring the - * /proc/self/mountinfo file. + * This type is used for monitoring mounted devices and swap devices + * in use. On Linux, this is done by inspecting and monitoring the + * /proc/self/mountinfo and + * /proc/swaps files. */ /** @@ -58,7 +59,11 @@ struct _UDisksMountMonitor GObject parent_instance; GIOChannel *mounts_channel; - GSource *watch_source; + GSource *mounts_watch_source; + + GIOChannel *swaps_channel; + GSource *swaps_watch_source; + gboolean have_data; GList *mounts; }; @@ -99,9 +104,13 @@ udisks_mount_monitor_finalize (GObject *object) if (monitor->mounts_channel != NULL) g_io_channel_unref (monitor->mounts_channel); + if (monitor->mounts_watch_source != NULL) + g_source_destroy (monitor->mounts_watch_source); - if (monitor->watch_source != NULL) - g_source_destroy (monitor->watch_source); + if (monitor->swaps_channel != NULL) + g_io_channel_unref (monitor->swaps_channel); + if (monitor->swaps_watch_source != NULL) + g_source_destroy (monitor->swaps_watch_source); g_list_foreach (monitor->mounts, (GFunc) g_object_unref, NULL); g_list_free (monitor->mounts); @@ -212,21 +221,15 @@ diff_sorted_lists (GList *list1, } } -static gboolean -mounts_changed_event (GIOChannel *channel, - GIOCondition cond, - gpointer user_data) +static void +reload_mounts (UDisksMountMonitor *monitor) { - UDisksMountMonitor *monitor = UDISKS_MOUNT_MONITOR (user_data); GList *old_mounts; GList *cur_mounts; GList *added; GList *removed; GList *l; - if (cond & ~G_IO_ERR) - goto out; - udisks_mount_monitor_ensure (monitor); old_mounts = g_list_copy (monitor->mounts); @@ -258,7 +261,30 @@ mounts_changed_event (GIOChannel *channel, g_list_free (cur_mounts); g_list_free (removed); g_list_free (added); +} + +static gboolean +mounts_changed_event (GIOChannel *channel, + GIOCondition cond, + gpointer user_data) +{ + UDisksMountMonitor *monitor = UDISKS_MOUNT_MONITOR (user_data); + if (cond & ~G_IO_ERR) + goto out; + reload_mounts (monitor); + out: + return TRUE; +} +static gboolean +swaps_changed_event (GIOChannel *channel, + GIOCondition cond, + gpointer user_data) +{ + UDisksMountMonitor *monitor = UDISKS_MOUNT_MONITOR (user_data); + if (cond & ~G_IO_ERR) + goto out; + reload_mounts (monitor); out: return TRUE; } @@ -273,10 +299,10 @@ udisks_mount_monitor_constructed (GObject *object) monitor->mounts_channel = g_io_channel_new_file ("/proc/self/mountinfo", "r", &error); if (monitor->mounts_channel != NULL) { - monitor->watch_source = g_io_create_watch (monitor->mounts_channel, G_IO_ERR); - g_source_set_callback (monitor->watch_source, (GSourceFunc) mounts_changed_event, monitor, NULL); - g_source_attach (monitor->watch_source, g_main_context_get_thread_default ()); - g_source_unref (monitor->watch_source); + monitor->mounts_watch_source = g_io_create_watch (monitor->mounts_channel, G_IO_ERR); + g_source_set_callback (monitor->mounts_watch_source, (GSourceFunc) mounts_changed_event, monitor, NULL); + g_source_attach (monitor->mounts_watch_source, g_main_context_get_thread_default ()); + g_source_unref (monitor->mounts_watch_source); } else { @@ -284,6 +310,21 @@ udisks_mount_monitor_constructed (GObject *object) g_error_free (error); } + error = NULL; + monitor->swaps_channel = g_io_channel_new_file ("/proc/swaps", "r", &error); + if (monitor->swaps_channel != NULL) + { + monitor->swaps_watch_source = g_io_create_watch (monitor->swaps_channel, G_IO_ERR); + g_source_set_callback (monitor->swaps_watch_source, (GSourceFunc) swaps_changed_event, monitor, NULL); + g_source_attach (monitor->swaps_watch_source, g_main_context_get_thread_default ()); + g_source_unref (monitor->swaps_watch_source); + } + else + { + g_error ("No /proc/swaps file: %s", error->message); + g_error_free (error); + } + if (G_OBJECT_CLASS (udisks_mount_monitor_parent_class)->constructed != NULL) (*G_OBJECT_CLASS (udisks_mount_monitor_parent_class)->constructed) (object); } @@ -339,25 +380,24 @@ have_mount (UDisksMountMonitor *monitor, return ret; } -static void -udisks_mount_monitor_ensure (UDisksMountMonitor *monitor) +/* ---------------------------------------------------------------------------------------------------- */ + +static gboolean +udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, + GError **error) { + gboolean ret; gchar *contents; gchar **lines; - GError *error; guint n; + ret = FALSE; contents = NULL; lines = NULL; - if (monitor->have_data) - goto out; - - error = NULL; - if (!g_file_get_contents ("/proc/self/mountinfo", &contents, NULL, &error)) + if (!g_file_get_contents ("/proc/self/mountinfo", &contents, NULL, error)) { - g_warning ("Error reading /proc/self/mountinfo: %s", error->message); - g_error_free (error); + g_prefix_error (error, "Error reading /proc/self/mountinfo: "); goto out; } @@ -365,7 +405,6 @@ udisks_mount_monitor_ensure (UDisksMountMonitor *monitor) * * Note that things like space are encoded as \020. */ - lines = g_strsplit (contents, "\n", 0); for (n = 0; lines[n] != NULL; n++) { @@ -389,7 +428,7 @@ udisks_mount_monitor_ensure (UDisksMountMonitor *monitor) encoded_root, encoded_mount_point) != 6) { - g_warning ("Error parsing line '%s'", lines[n]); + g_warning ("%s: Error parsing line '%s'", G_STRFUNC, lines[n]); continue; } @@ -416,7 +455,7 @@ udisks_mount_monitor_ensure (UDisksMountMonitor *monitor) if (sscanf (sep + 3, "%s %s", fstype, mount_source) != 2) { - g_warning ("Error parsing things past - for '%s'", lines[n]); + g_warning ("%s: Error parsing things past - for '%s'", G_STRFUNC, lines[n]); continue; } @@ -428,13 +467,13 @@ udisks_mount_monitor_ensure (UDisksMountMonitor *monitor) if (stat (mount_source, &statbuf) != 0) { - g_warning ("Error statting %s: %m", mount_source); + g_warning ("%s: Error statting %s: %m", G_STRFUNC, mount_source); continue; } if (!S_ISBLK (statbuf.st_mode)) { - g_warning ("%s is not a block device", mount_source); + g_warning ("%s: %s is not a block device", G_STRFUNC, mount_source); continue; } @@ -456,19 +495,118 @@ udisks_mount_monitor_ensure (UDisksMountMonitor *monitor) if (!have_mount (monitor, dev, mount_point)) { UDisksMount *mount; - mount = _udisks_mount_new (dev, mount_point); + mount = _udisks_mount_new (dev, mount_point, UDISKS_MOUNT_TYPE_FILESYSTEM); monitor->mounts = g_list_prepend (monitor->mounts, mount); - //g_debug ("SUP ADDING %d:%d on %s", major, minor, mount_point); } g_free (mount_point); } - monitor->have_data = TRUE; + ret = TRUE; + + out: + g_free (contents); + g_strfreev (lines); + + return ret; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +static gboolean +udisks_mount_monitor_get_swaps (UDisksMountMonitor *monitor, + GError **error) +{ + gboolean ret; + gchar *contents; + gchar **lines; + guint n; + + ret = FALSE; + contents = NULL; + lines = NULL; + + if (!g_file_get_contents ("/proc/swaps", &contents, NULL, error)) + { + g_prefix_error (error, "Error reading /proc/self/mountinfo: "); + goto out; + } + + lines = g_strsplit (contents, "\n", 0); + for (n = 0; lines[n] != NULL; n++) + { + gchar filename[PATH_MAX]; + struct stat statbuf; + dev_t dev; + + /* skip first line of explanatory text */ + if (n == 0) + continue; + + if (strlen (lines[n]) == 0) + continue; + + if (sscanf (lines[n], "%s", filename) != 1) + { + g_warning ("%s: Error parsing line '%s'", G_STRFUNC, lines[n]); + continue; + } + + if (stat (filename, &statbuf) != 0) + { + g_warning ("%s: Error statting %s: %m", G_STRFUNC, filename); + continue; + } + + dev = statbuf.st_rdev; + + if (!have_mount (monitor, dev, NULL)) + { + UDisksMount *mount; + mount = _udisks_mount_new (dev, NULL, UDISKS_MOUNT_TYPE_SWAP); + monitor->mounts = g_list_prepend (monitor->mounts, mount); + } + } + + ret = TRUE; out: g_free (contents); g_strfreev (lines); + + return ret; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +static void +udisks_mount_monitor_ensure (UDisksMountMonitor *monitor) +{ + GError *error; + + if (monitor->have_data) + goto out; + + error = NULL; + if (!udisks_mount_monitor_get_mountinfo (monitor, &error)) + { + g_warning ("Error getting mounts: %s (%s, %d)", + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + + error = NULL; + if (!udisks_mount_monitor_get_swaps (monitor, &error)) + { + g_warning ("Error getting swaps: %s (%s, %d)", + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + + monitor->have_data = TRUE; + + out: + ; } /** @@ -510,17 +648,19 @@ udisks_mount_monitor_get_mounts_for_dev (UDisksMountMonitor *monitor, } /** - * udisks_mount_monitor_is_dev_mounted: + * udisks_mount_monitor_is_dev_in_use: * @monitor: A #UDisksMountMonitor. * @dev: A #dev_t device number. + * @out_type: (out allow-none): Return location for mount type, if in use or %NULL. * - * Checks if @dev is mounted. + * Checks if @dev is in use (e.g. mounted or swap-area in-use). * - * Returns: %TRUE if mounted, %FALSE otherwise. + * Returns: %TRUE if in use, %FALSE otherwise. */ gboolean -udisks_mount_monitor_is_dev_mounted (UDisksMountMonitor *monitor, - dev_t dev) +udisks_mount_monitor_is_dev_in_use (UDisksMountMonitor *monitor, + dev_t dev, + UDisksMountType *out_type) { gboolean ret; GList *l; @@ -533,6 +673,8 @@ udisks_mount_monitor_is_dev_mounted (UDisksMountMonitor *monitor, if (udisks_mount_get_dev (mount) == dev) { + if (out_type != NULL) + *out_type = udisks_mount_get_mount_type (mount); ret = TRUE; goto out; } diff --git a/src/udisksmountmonitor.h b/src/udisksmountmonitor.h index 36337c2..2e4a2cc 100644 --- a/src/udisksmountmonitor.h +++ b/src/udisksmountmonitor.h @@ -33,8 +33,9 @@ GType udisks_mount_monitor_get_type (void) G_GNUC_CONST UDisksMountMonitor *udisks_mount_monitor_new (void); GList *udisks_mount_monitor_get_mounts_for_dev (UDisksMountMonitor *monitor, dev_t dev); -gboolean udisks_mount_monitor_is_dev_mounted (UDisksMountMonitor *monitor, - dev_t dev); +gboolean udisks_mount_monitor_is_dev_in_use (UDisksMountMonitor *monitor, + dev_t dev, + UDisksMountType *out_type); G_END_DECLS diff --git a/src/udiskspersistentstore.c b/src/udiskspersistentstore.c index e18e26a..1e189c5 100644 --- a/src/udiskspersistentstore.c +++ b/src/udiskspersistentstore.c @@ -622,7 +622,8 @@ mounted_fs_entry_is_valid (UDisksPersistentStore *store, for (l = mounts; l != NULL; l = l->next) { UDisksMount *mount = UDISKS_MOUNT (l->data); - if (g_strcmp0 (udisks_mount_get_mount_path (mount), mount_point) == 0) + if (udisks_mount_get_mount_type (mount) == UDISKS_MOUNT_TYPE_FILESYSTEM && + g_strcmp0 (udisks_mount_get_mount_path (mount), mount_point) == 0) { found_mount = TRUE; break; diff --git a/src/udisksprivate.h b/src/udisksprivate.h index 3731003..30bf3b9 100644 --- a/src/udisksprivate.h +++ b/src/udisksprivate.h @@ -26,7 +26,8 @@ G_BEGIN_DECLS UDisksMount *_udisks_mount_new (dev_t dev, - const gchar *mount_path); + const gchar *mount_path, + UDisksMountType type); G_END_DECLS -- 2.7.4