2010-04-02 13:35:12 +02:00
|
|
|
---
|
|
|
|
parted/parted.c | 24 +++++++++++++++++++++---
|
|
|
|
1 file changed, 21 insertions(+), 3 deletions(-)
|
|
|
|
|
2009-08-06 22:06:27 +02:00
|
|
|
Index: parted/parted.c
|
|
|
|
===================================================================
|
2010-07-19 20:20:25 +02:00
|
|
|
--- parted/parted.c.orig 2010-05-28 17:09:04.000000000 +0200
|
|
|
|
+++ parted/parted.c 2010-07-08 13:26:06.000000000 +0200
|
|
|
|
@@ -1917,7 +1917,7 @@ do_resize (PedDevice** dev)
|
2010-04-02 13:35:12 +02:00
|
|
|
issue_fs_op_warning ("resize");
|
2007-01-15 15:29:14 +01:00
|
|
|
PedDisk *disk;
|
|
|
|
PedPartition *part = NULL;
|
|
|
|
- PedFileSystem *fs;
|
|
|
|
+ PedFileSystem *fs = NULL;
|
|
|
|
PedConstraint *constraint;
|
|
|
|
PedSector start, end;
|
|
|
|
PedGeometry *range_start = NULL, *range_end = NULL;
|
2010-07-19 20:20:25 +02:00
|
|
|
@@ -1959,22 +1959,39 @@ do_resize (PedDevice** dev)
|
2007-01-15 15:29:14 +01:00
|
|
|
goto error_destroy_constraint;
|
|
|
|
ped_partition_set_system (part, NULL);
|
|
|
|
} else {
|
2010-04-02 13:35:12 +02:00
|
|
|
+ int always_resize = getenv( "YAST_IS_RUNNING" ) != NULL;
|
|
|
|
+ const char* fsname = "";
|
|
|
|
+ if( always_resize )
|
|
|
|
+ {
|
|
|
|
+ PedFileSystemType* fst = ped_file_system_probe( &part->geom );
|
|
|
|
+ if( fst )
|
|
|
|
+ fsname = fst->name;
|
|
|
|
+ }
|
2007-01-15 15:29:14 +01:00
|
|
|
fs = ped_file_system_open (&part->geom);
|
|
|
|
- if (!fs)
|
2010-04-02 13:35:12 +02:00
|
|
|
+ if (!fs && (!always_resize || strncmp(fsname,"fat",3)==0) )
|
2007-01-15 15:29:14 +01:00
|
|
|
goto error_destroy_disk;
|
2010-04-02 13:35:12 +02:00
|
|
|
+ if (fs)
|
2009-08-06 22:06:27 +02:00
|
|
|
constraint = constraint_intersect_and_destroy (
|
|
|
|
ped_file_system_get_resize_constraint (fs),
|
|
|
|
constraint_from_start_end (
|
|
|
|
*dev, range_start, range_end));
|
2010-04-02 13:35:12 +02:00
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ new_geom.start = part->geom.start;
|
|
|
|
+ constraint = ped_constraint_exact(&new_geom);
|
|
|
|
+ }
|
2007-01-15 15:29:14 +01:00
|
|
|
if (!ped_disk_set_partition_geom (disk, part, constraint,
|
|
|
|
new_geom.start, new_geom.end))
|
|
|
|
goto error_close_fs;
|
2007-03-22 21:00:14 +01:00
|
|
|
- if (!ped_file_system_resize (fs, &part->geom, g_timer))
|
2010-09-17 16:01:23 +02:00
|
|
|
+ if(fs && (!always_resize || strncmp(fsname,"fat",3)==0))
|
2010-04-02 13:35:12 +02:00
|
|
|
+ {
|
|
|
|
+ if (!ped_file_system_resize (fs, &part->geom, g_timer) && !always_resize )
|
2009-08-06 22:06:27 +02:00
|
|
|
goto error_close_fs;
|
|
|
|
/* may have changed... eg fat16 -> fat32 */
|
|
|
|
ped_partition_set_system (part, fs->type);
|
|
|
|
ped_file_system_close (fs);
|
2007-01-15 15:29:14 +01:00
|
|
|
}
|
2009-08-06 22:06:27 +02:00
|
|
|
+ }
|
2007-01-15 15:29:14 +01:00
|
|
|
|
|
|
|
ped_disk_commit (disk);
|
2009-08-06 22:06:27 +02:00
|
|
|
ped_constraint_destroy (constraint);
|
2010-07-19 20:20:25 +02:00
|
|
|
@@ -1990,6 +2007,7 @@ do_resize (PedDevice** dev)
|
2007-01-15 15:29:14 +01:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
error_close_fs:
|
|
|
|
+ if (fs)
|
2009-08-06 22:06:27 +02:00
|
|
|
ped_file_system_close (fs);
|
2007-01-15 15:29:14 +01:00
|
|
|
error_destroy_constraint:
|
|
|
|
ped_constraint_destroy (constraint);
|