Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:wolfi323:branches:Base:System
udisks2
0002-Probe-media-that-hasn-t-been-probed-by-ude...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Probe-media-that-hasn-t-been-probed-by-udev-yet.patch of Package udisks2
From 96c17a856411a63a3160778e723e7d607a840191 Mon Sep 17 00:00:00 2001 From: David Riebenbauer <davrieb@liegesta.at> Date: Tue, 27 May 2014 12:28:23 +0200 Subject: [PATCH 2/2] Probe media that hasn't been probed by udev yet. Manually probe block devices for filesystem, that haven't been probed by udevd(8) yet. This typically only applies to legacy devices like floppy drives that don't generate events for media change. This is basically the same thing that mount(8) does, when it isn't given a filesystem type other than 'auto'. However udisks needs to know about the filesystem before issuing the mount command, to set appropriate options. <https://bugs.freedesktop.org/show_bug.cgi?id=63849> --- src/udiskslinuxfilesystem.c | 62 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c index 604265f..ec6641a 100644 --- a/src/udiskslinuxfilesystem.c +++ b/src/udiskslinuxfilesystem.c @@ -37,6 +37,8 @@ #include <glib/gstdio.h> +#include <blkid/blkid.h> + #include "udiskslogging.h" #include "udiskslinuxfilesystem.h" #include "udiskslinuxblockobject.h" @@ -625,6 +627,57 @@ subst_str_and_escape (const gchar *str, return ret; } +static gchar * +probe_fs_type_prior_to_mount (UDisksBlock *block, + GError **error) +{ + const gchar *device; + blkid_probe probe = NULL; + char *fs_type = NULL; + const char *data; + size_t data_len; + + device = udisks_block_get_device (block); + + probe = blkid_new_probe_from_filename (device); + if (probe == NULL) { + g_set_error (error, + UDISKS_ERROR, + UDISKS_ERROR_FAILED, + "Failed to open device %s for filesystem probing.", + device); + goto out; + }; + + blkid_probe_enable_superblocks (probe, TRUE); + blkid_probe_set_superblocks_flags (probe, BLKID_SUBLKS_TYPE); + + if (blkid_do_safeprobe (probe) != 0) { + g_set_error (error, + UDISKS_ERROR, + UDISKS_ERROR_FAILED, + "Failed to recognize filesystem for device %s.", + device); + goto out; + } + + blkid_probe_lookup_value (probe, "TYPE", &data, &data_len); + if (data == NULL || data_len == 0) { + g_set_error (error, + UDISKS_ERROR, + UDISKS_ERROR_FAILED, + "Failed to recognize filesystem for device %s.", + device); + goto out; + } + + fs_type = g_strndup (data, data_len); + +out: + blkid_free_probe (probe); + return fs_type; +} + /* ---------------------------------------------------------------------------------------------------- */ /* @@ -695,7 +748,14 @@ calculate_fs_type (UDisksBlock *block, if (probed_fs_type != NULL && strlen (probed_fs_type) > 0) fs_type_to_use = g_strdup (probed_fs_type); else - fs_type_to_use = g_strdup ("auto"); + /* As udev has failed to provide a fs type, let's see for ourselves. + * This is most likely due to a floppy or similar not detecting media + * changes. + */ + fs_type_to_use = probe_fs_type_prior_to_mount (block, error); + if (fs_type_to_use == NULL) { + goto out; + } } out: -- 2.0.0.rc4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor