udisks2/udisks-2.10.0-dosfstools_4.2.patch
DistroBaker 2fccc86ccc Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/udisks2.git#8eb05435f07a89544f717607667b28049f1313f5
2021-03-31 16:30:40 +00:00

76 lines
1.9 KiB
Diff

commit ef1979d8cbfb8ad976de0af21a70f8c0f98fbbe9
Author: Tomas Bzatek <tbzatek@redhat.com>
Date: Wed Mar 17 18:50:19 2021 +0100
udiskslinuxfsinfo: Add dosfstools >= 4.2 quirks
Reverting back the legacy behaviour with no protective (fake) MBR
created while making new FAT filesystem on an unpartitioned block device.
Added a label clear functionality as well.
diff --git a/src/udiskslinuxfsinfo.c b/src/udiskslinuxfsinfo.c
index 15af26c8..f18b9b80 100644
--- a/src/udiskslinuxfsinfo.c
+++ b/src/udiskslinuxfsinfo.c
@@ -21,6 +21,8 @@
#include <string.h>
#include <glib.h>
+#include <blockdev/exec.h>
+
#include "config.h"
#include "udiskslinuxfsinfo.h"
#include "udisksconfigmanager.h"
@@ -236,6 +238,19 @@ const FSInfo _fs_info[] =
},
};
+/* workaround for dosfstools >= 4.2 */
+static const FSInfo vfat_dosfstools_42 =
+ {
+ FS_VFAT,
+ "fatlabel $DEVICE $LABEL",
+ "fatlabel --reset $DEVICE",
+ FALSE, /* supports_online_label_rename */
+ FALSE, /* supports_owners */
+ "mkfs.vfat -I -n $LABEL --mbr=n $DEVICE",
+ NULL,
+ NULL, /* option_no_discard */
+ };
+
/**
* get_fs_info:
*
@@ -248,6 +263,7 @@ const FSInfo _fs_info[] =
const FSInfo *
get_fs_info (const gchar *fstype)
{
+ const FSInfo *info = NULL;
guint n;
g_return_val_if_fail (fstype != NULL, NULL);
@@ -255,10 +271,20 @@ get_fs_info (const gchar *fstype)
for (n = 0; n < sizeof(_fs_info)/sizeof(FSInfo); n++)
{
if (strcmp (_fs_info[n].fstype, fstype) == 0)
- return &_fs_info[n];
+ {
+ info = &_fs_info[n];
+ break;
+ }
+ }
+
+ /* dosfstools >= 4.2 workaround */
+ if (g_str_equal (fstype, FS_VFAT) &&
+ bd_utils_check_util_version ("mkfs.vfat", "4.2", "--help", "mkfs.fat\\s+([\\d\\.]+).+", NULL))
+ {
+ info = &vfat_dosfstools_42;
}
- return NULL;
+ return info;
}
/**