~ubuntu-branches/ubuntu/saucy/gparted/saucy

« back to all changes in this revision

Viewing changes to src/GParted_Core.cc

  • Committer: Package Import Robot
  • Author(s): Phillip Susi
  • Date: 2012-02-21 10:11:00 UTC
  • Revision ID: package-import@ubuntu.com-20120221101100-f4zqpr9rlq23p4j9
Tags: 0.11.0-2
Add fix-swap.patch: fix regression where moving swap partitions
corrupted them by backporting upstream commit
93241cccbf4974a4a0ce4024cf94278f9ba3f386 LP: #935685

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (C) 2004 Bart 'plors' Hakvoort
2
 
 * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak
 
2
 * Copyright (C) 2008, 2009, 2010, 2011, 2012 Curtis Gedak
3
3
 *
4
4
 *  This program is free software; you can redistribute it and/or modify
5
5
 *  it under the terms of the GNU General Public License as published by
1831
1831
 
1832
1832
                succes = (    succes
1833
1833
                          && update_bootsector( partition_new, operationdetail )
1834
 
                          && (   //Do not maximize file system if new size <= old
1835
 
                                 ( partition_new .get_sector_length() <= partition_old .get_sector_length() )
 
1834
                          && (   //Do not maximize file system if FS not linux-swap and new size <= old
 
1835
                                 (   partition_new .filesystem != FS_LINUX_SWAP  //linux-swap is recreated, not moved
 
1836
                                  && partition_new .get_sector_length() <= partition_old .get_sector_length()
 
1837
                                 )
1836
1838
                              || (   check_repair_filesystem( partition_new, operationdetail )
1837
1839
                                  && maximize_filesystem( partition_new, operationdetail )
1838
1840
                                 )
1983
1985
                        succes = resize_move_partition( partition_old, partition_new, operationdetail ) ;
1984
1986
 
1985
1987
                //expand file system to fit exactly in partition
1986
 
                if ( ! (   //Do not maximize file system if new size <= old
1987
 
                           ( partition_new .get_sector_length() <= partition_old .get_sector_length() )
 
1988
                if ( ! (   //Do not maximize file system if FS not linux-swap and new size <= old
 
1989
                           (   partition_new .filesystem != FS_LINUX_SWAP  //linux-swap is recreated, not resized
 
1990
                            && partition_new .get_sector_length() <= partition_old .get_sector_length()
 
1991
                           )
1988
1992
                        || (   check_repair_filesystem( partition_new, operationdetail )
1989
1993
                            && maximize_filesystem( partition_new, operationdetail )
1990
1994
                           )
2310
2314
 
2311
2315
                        return (   succes
2312
2316
                                && update_bootsector( partition_dst, operationdetail )
2313
 
                                && (   //Do not maximize file system if destination size <= source
2314
 
                                       ( partition_dst .get_sector_length() <= partition_src .get_sector_length() )
 
2317
                                && (   //Do not maximize file system if FS not linux-swap and destination size <= source
 
2318
                                       (   partition_dst .filesystem != FS_LINUX_SWAP  //linux-swap is recreated, not copied
 
2319
                                        && partition_dst .get_sector_length() <= partition_src .get_sector_length()
 
2320
                                       )
2315
2321
                                    || (   check_repair_filesystem( partition_dst, operationdetail )
2316
2322
                                        && maximize_filesystem( partition_dst, operationdetail )
2317
2323
                                       )