use mlabel rather than dosfslabel
authorDavid Zeuthen <davidz@redhat.com>
Thu, 5 Jun 2008 21:38:18 +0000 (17:38 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Thu, 5 Jun 2008 21:38:18 +0000 (17:38 -0400)
Because compared to dosfslabel

 - mlabel actually works
 - mlabel supports long labels (254 characters)
 - mlabel is also available in e.g. SUSE; dosfslabel seem to be a RH hack

src/devkit-disks-daemon.c
src/job-change-filesystem-label.c

index 114423c..fcd777d 100644 (file)
@@ -314,7 +314,7 @@ static const DevkitDisksFilesystem known_file_systems[] = {
                 FALSE,          /* supports_unix_owners */
                 TRUE,           /* can_mount */
                 TRUE,           /* can_create */
-                11,             /* max_label_len */
+                254,            /* max_label_len */
                 TRUE,           /* supports_label_rename */
                 FALSE,          /* supports_online_label_rename*/
                 TRUE,           /* supports_fsck */
index e83775d..9edaad9 100644 (file)
@@ -77,9 +77,12 @@ main (int argc, char **argv)
                         command_line = g_strdup_printf ("xfs_admin -L \"%s\" %s", new_label, device);
 
         } else if (strcmp (fstype, "vfat") == 0) {
-                if (!validate_and_escape_label (&new_label, 11))
+                if (!validate_and_escape_label (&new_label, 254))
                         goto out;
-                command_line = g_strdup_printf ("dosfslabel %s \"%s\"", device, new_label);
+                if (strlen (new_label) == 0)
+                        command_line = g_strdup_printf ("mlabel -c -i %s ::", device);
+                else
+                        command_line = g_strdup_printf ("mlabel -i %s \"::%s\"", device, new_label);
 
         } else {
                 g_printerr ("fstype %s not supported\n", fstype);