[PATCH] udisks: add nilfs2 filesystem

Jiro SEKIBA (none) jir at lucid-desktop.
Sat Jul 24 01:52:51 PDT 2010


Hi,

This is a patch against udisks to support creating and mounting
nilfs2 filesystem.  To detect the filesystem, the latest util-linux-ng
and a following typo patch are required.
http://www.spinics.net/lists/util-linux-ng/msg03304.html

Signed-off-by: Jiro SEKIBA <jir at unicus.jp>
---
 src/daemon.c           |   16 ++++++++++++++++
 src/helpers/job-mkfs.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/src/daemon.c b/src/daemon.c
index 87420e1..a5f34ee 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -373,6 +373,22 @@ static const Filesystem known_file_systems[] =
       FALSE, /* supports_online_resize_shrink */
     },
     {
+      "nilfs2", /* id */
+      "NILFS2", /* name */
+      TRUE, /* supports_unix_owners */
+      TRUE, /* can_mount */
+      TRUE, /* can_create */
+      80, /* max_label_len */
+      FALSE, /* supports_label_rename */
+      FALSE, /* supports_online_label_rename*/
+      FALSE, /* supports_fsck */
+      FALSE, /* supports_online_fsck */
+      FALSE, /* supports_resize_enlarge */
+      FALSE, /* supports_online_resize_enlarge */
+      FALSE, /* supports_resize_shrink */
+      FALSE, /* supports_online_resize_shrink */
+    },
+    {
       "swap", /* id */
       "Swap Space", /* name */
       FALSE, /* supports_unix_owners */
diff --git a/src/helpers/job-mkfs.c b/src/helpers/job-mkfs.c
index 8e4dce2..62cdfff 100644
--- a/src/helpers/job-mkfs.c
+++ b/src/helpers/job-mkfs.c
@@ -337,6 +337,51 @@ main (int argc,
       command_line = g_string_free (s, FALSE);
 
     }
+  else if (strcmp (fstype, "nilfs2") == 0)
+    {
+
+      s = g_string_new ("mkfs.nilfs2");
+      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, 80))
+                {
+                  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, "swap") == 0)
     {
 
-- 
1.7.0.4



More information about the devkit-devel mailing list