~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to debian/patches/0001-parted-resizepart-command.patch

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-07-21 10:23:16 UTC
  • mfrom: (7.2.32 sid)
  • Revision ID: package-import@ubuntu.com-20140721102316-jsyv3yzmbo8vlde5
Tags: 3.1-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 72b981e7e5a0eeee9b05f66eb63af9e5e57358dd Mon Sep 17 00:00:00 2001
 
1
From 30630f6dfb5cb450b6ab633214855652275e7a1e Mon Sep 17 00:00:00 2001
2
2
From: Petr Uzel <petr.uzel@suse.cz>
3
3
Date: Mon, 26 Sep 2011 17:21:01 +0200
4
4
Subject: parted: resizepart command
5
5
 
6
6
TODO
7
7
 
 
8
Last-Update: 2014-07-07
 
9
 
8
10
Patch-Name: 0001-parted-resizepart-command.patch
9
11
---
10
 
 parted/parted.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
11
 
 1 file changed, 87 insertions(+), 2 deletions(-)
 
12
 parted/parted.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
13
 1 file changed, 88 insertions(+)
12
14
 
13
15
diff --git a/parted/parted.c b/parted/parted.c
14
 
index a5e2870..492796b 100644
 
16
index 789030a..1351476 100644
15
17
--- a/parted/parted.c
16
18
+++ b/parted/parted.c
17
 
@@ -150,6 +150,9 @@ static const char* fs_type_msg_start = N_("FS-TYPE is one of: ");
 
19
@@ -152,6 +152,9 @@ static const char* fs_type_msg_start = N_("FS-TYPE is one of: ");
18
20
 static const char* start_end_msg =    N_("START and END are disk locations, such as "
19
21
                 "4GB or 10%.  Negative values count from the end of the disk.  "
20
22
                 "For example, -1s specifies exactly the last sector.\n");
24
26
 static const char* state_msg =        N_("STATE is one of: on, off\n");
25
27
 static const char* device_msg =       N_("DEVICE is usually /dev/hda or /dev/sda\n");
26
28
 static const char* name_msg =         N_("NAME is any word you want\n");
27
 
@@ -466,6 +469,21 @@ constraint_intersect_and_destroy (PedConstraint* a, PedConstraint* b)
28
 
         return result;
 
29
@@ -435,6 +438,20 @@ constraint_from_start_end (PedDevice* dev, PedGeometry* range_start,
 
30
                 range_start, range_end, 1, dev->length);
29
31
 }
30
32
 
31
 
+
32
33
+static PedConstraint*
33
34
+constraint_from_start_end_fixed_start (PedDevice* dev, PedSector start_sector,
34
35
+                           PedGeometry* range_end)
46
47
 void
47
48
 help_on (char* topic)
48
49
 {
49
 
@@ -2004,11 +2022,69 @@ error:
 
50
@@ -1478,6 +1495,68 @@ error:
50
51
 }
51
52
 
52
53
 static int
74
75
+
75
76
+        start = part->geom.start;
76
77
+        end = oldend = part->geom.end;
77
 
+        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end))
 
78
+        char *end_input;
 
79
+        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
78
80
+                goto error;
 
81
+        _adjust_end_if_iec(&start, &end, range_end, end_input);
 
82
+        free(end_input);
79
83
+        /* Do not move start of the partition */
80
84
+        constraint = constraint_from_start_end_fixed_start (*dev, start, range_end);
81
85
+        if (!ped_disk_set_partition_geom (disk, part, constraint,
111
115
+static int
112
116
 do_rm (PedDevice** dev)
113
117
 {
114
 
-        PedDisk*                disk;
115
 
+        PedDisk*                disk;
116
 
         PedPartition*           part = NULL;
117
 
-
118
 
         disk = ped_disk_new (*dev);
119
 
         if (!disk)
120
 
                 goto error;
121
 
@@ -2423,6 +2499,15 @@ _("mkpartfs PART-TYPE FS-TYPE START END     make a partition with a "
122
 
 NULL),
123
 
         str_list_create (_(part_type_msg), _(start_end_msg), NULL), 1));
 
118
         PedDisk*                disk;
 
119
@@ -1846,6 +1925,15 @@ _("'mkpart' makes a partition without creating a new file system on the "
 
120
   "partition.  FS-TYPE may be specified to set an appropriate partition ID.\n"),
 
121
 NULL), 1));
124
122
 
125
123
+//XXX: mention that this command does never move start of the partition
126
124
+command_register (commands, command_create (
132
130
+        str_list_create (_(number_msg), _(end_msg), NULL), 1));
133
131
+
134
132
 command_register (commands, command_create (
135
 
         str_list_create_unique ("move", _("move"), NULL),
136
 
         do_move,
 
133
         str_list_create_unique ("name", _("name"), NULL),
 
134
         do_name,