[parted-devel] [PATCH 6/6] parted: Add stub resize command for backward compatibility

Phillip Susi psusi at ubuntu.com
Fri Jan 18 04:56:39 UTC 2013


To make sure that older scripts trying to use the resize command do not
accidentally run the new resizepart command by mistake, this undocumented
stub command will throw an error if called.
---
 parted/parted.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/parted/parted.c b/parted/parted.c
index b65c1cb..1e41cd9 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1503,6 +1503,16 @@ error:
 }
 
 static int
+do_resize (PedDevice **dev, PedDisk** diskp)
+{
+        ped_exception_throw (
+                PED_EXCEPTION_ERROR,
+                PED_EXCEPTION_CANCEL,
+                _("The resize command has been removed in parted 3.0"));
+        return 0;
+}
+
+static int
 do_resizepart (PedDevice** dev, PedDisk** diskp)
 {
         PedDisk                 *disk = *diskp;
@@ -1969,6 +1979,12 @@ _("rescue START END                         rescue a lost partition near "
 NULL),
         str_list_create (_(start_end_msg), NULL), 1));
 
+command_register (commands, command_create (
+        str_list_create_unique ("resize", _("resize"), NULL),
+        do_resize,
+	NULL,
+        str_list_create (_(N_("The resize command was removed in parted 3.0\n")), NULL), 1));
+
 //XXX: mention that this command does never move start of the partition
 command_register (commands, command_create (
         str_list_create_unique ("resizepart", _("resizepart"), NULL),
-- 
1.7.10.4




More information about the parted-devel mailing list