From fcb513ab77e9ad89ad2884f9802407d00537227f Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 6 Nov 2009 02:23:20 +0100 Subject: [PATCH] Bug 24606 - Add support for ReiserFS --- src/daemon.c | 16 ++++++++++ src/helpers/job-change-filesystem-label.c | 6 ++++ src/helpers/job-mkfs.c | 46 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 0 deletions(-) diff --git a/src/daemon.c b/src/daemon.c index b4db426..6a8c7fa 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -323,6 +323,22 @@ static const Filesystem known_file_systems[] = FALSE, /* supports_online_resize_shrink */ }, { + "reiserfs", /* id */ + "ReiserFS", /* name */ + TRUE, /* supports_unix_owners */ + TRUE, /* can_mount */ + TRUE, /* can_create */ + 16, /* max_label_len */ + TRUE, /* supports_label_rename */ + FALSE, /* supports_online_label_rename*/ + TRUE, /* supports_fsck */ + FALSE, /* supports_online_fsck */ + TRUE, /* supports_resize_enlarge */ + TRUE, /* supports_online_resize_enlarge */ + TRUE, /* supports_resize_shrink */ + FALSE, /* supports_online_resize_shrink */ + }, + { "minix", /* id */ "Minix", /* name */ TRUE, /* supports_unix_owners */ diff --git a/src/helpers/job-change-filesystem-label.c b/src/helpers/job-change-filesystem-label.c index 0c2c0c7..5b3e746 100644 --- a/src/helpers/job-change-filesystem-label.c +++ b/src/helpers/job-change-filesystem-label.c @@ -82,6 +82,12 @@ main (int argc, command_line = g_strdup_printf ("xfs_admin -L \"%s\" %s", new_label, device); } + else if (strcmp (fstype, "reiserfs") == 0) + { + if (!validate_and_escape_label (&new_label, 16)) + goto out; + command_line = g_strdup_printf ("reiserfstune -l \"%s\" %s", new_label, device); + } else if (strcmp (fstype, "vfat") == 0) { if (!validate_and_escape_label (&new_label, 254)) diff --git a/src/helpers/job-mkfs.c b/src/helpers/job-mkfs.c index 490258c..8e4dce2 100644 --- a/src/helpers/job-mkfs.c +++ b/src/helpers/job-mkfs.c @@ -256,6 +256,52 @@ main (int argc, command_line = g_string_free (s, FALSE); } + else if (strcmp (fstype, "reiserfs") == 0) + { + + s = g_string_new ("mkfs.reiserfs -q"); + for (n = 0; options[n] != NULL; n++) + { + if (g_str_has_prefix (options[n], "label=")) + { + label = strdup (options[n] + sizeof("label=") - 1); + if (!validate_and_escape_label (&label, 16)) + { + g_string_free (s, TRUE); + goto out; + } + g_string_append_printf (s, " -l \"%s\"", label); + g_free (label); + label = NULL; + } + else if (g_str_has_prefix (options[n], "take_ownership_uid=")) + { + take_ownership_uid = strtol (options[n] + sizeof("take_ownership_uid=") - 1, &endp, 10); + if (endp == NULL || *endp != '\0') + { + g_printerr ("option %s is malformed\n", options[n]); + goto out; + } + } + else if (g_str_has_prefix (options[n], "take_ownership_gid=")) + { + take_ownership_gid = strtol (options[n] + sizeof("take_ownership_gid=") - 1, &endp, 10); + if (endp == NULL || *endp != '\0') + { + g_printerr ("option %s is malformed\n", options[n]); + goto out; + } + } + else + { + g_printerr ("option %s not supported\n", options[n]); + goto out; + } + } + g_string_append_printf (s, " %s", device); + command_line = g_string_free (s, FALSE); + + } else if (strcmp (fstype, "minix") == 0) { -- 1.6.5.3