Allow creating partition tables with Block.Format()
authorDavid Zeuthen <davidz@redhat.com>
Mon, 14 Nov 2011 16:44:58 +0000 (11:44 -0500)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 14 Nov 2011 16:44:58 +0000 (11:44 -0500)
Signed-off-by: David Zeuthen <davidz@redhat.com>
data/org.freedesktop.UDisks2.xml
src/udiskslinuxblock.c
src/udiskslinuxfsinfo.c

index 7afa94c..687709e 100644 (file)
 
     <!--
         Format:
-        @type: The type of file system or other content to format the device with.
+        @type: The type of file system, partition table or other content to format the device with.
         @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>label</parameter> (of type 's'), <parameter>take-ownership</parameter> (of type 'b') and <parameter>encrypt.passphrase</parameter> (of type 's').
 
-        Formats the device with a file system or other well-known content.
+        Formats the device with a file system, partition table or
+        other well-known content.
 
         Known values for @type includes <constant>empty</constant> (to
         just zero out areas of the device known to host file system
         and most file systems supported by the <citerefentry><refentrytitle>mkfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
         program through its <option>-t</option> option.
 
+        Known partition table formats includes
+        <constant>dos</constant> and <constant>gpt</constant>.
+
         If @type supports it, you can specify a label with the
         <parameter>label</parameter> option in the @options parameter;
         however, note that this may not be supported on all file
index 8c3b948..69c114d 100644 (file)
@@ -1743,7 +1743,7 @@ handle_format (UDisksBlock           *block,
                                                     NULL,
                                                     action_id,
                                                     options,
-                                                    N_("Authentication is required to create a file system"),
+                                                    N_("Authentication is required to format $(udisks2.device)"),
                                                     invocation))
     goto out;
 
index c8c7240..a27ad22 100644 (file)
@@ -26,6 +26,7 @@
 
 const FSInfo _fs_info[] =
   {
+    /* filesystems */
     {
       "ext2",
       "e2label $DEVICE $LABEL",
@@ -96,6 +97,7 @@ const FSInfo _fs_info[] =
       FALSE,
       "mkfs.minix $DEVICE",
     },
+    /* swap space */
     {
       "swap",
       NULL,
@@ -103,6 +105,22 @@ const FSInfo _fs_info[] =
       FALSE,
       "mkswap -L $LABEL $DEVICE",
     },
+    /* partition tables */
+    {
+      "dos",
+      NULL,
+      NULL,
+      FALSE,
+      "parted --script $DEVICE mktable msdos",
+    },
+    {
+      "gpt",
+      NULL,
+      NULL,
+      FALSE,
+      "parted --script $DEVICE mktable gpt",
+    },
+    /* empty */
     {
       "empty",
       NULL,