Commit Graph

338 Commits

Author SHA1 Message Date
Seth Heeren 37dad68f45 ped_partition_get_path result not freed 2010-10-05 12:54:55 -06:00
Seth Heeren 58b0e23dd7 remove misuse of ustring in get_filesystem 2010-10-05 10:29:05 -06:00
Luca Bruno 5765eb870c Use Btrfs handlers, if enabled at configure time
GParted already has basic support only to recognize Btrfs volumes; if
configured, use our newer methods to handle them.
Also, put in place interface controls for all supported generic actions.
2010-10-03 17:00:53 +02:00
Curtis Gedak d040e4e584 Use direct assignment for string in class initialization
Change string initialization to use direct assignment instead of
a class method in the GParted_Core class initialization.

Thanks go to Jan Claeys for pointing out this potential problem
and providing the following link:
https://bugzilla.gnome.org/show_bug.cgi?id=627724#c7

This link contains a comment by Matthias Clasen that says:

    "In a class init function, don't do anything that causes
    other threads to initialize classed types."
2010-09-21 11:19:42 -06:00
Curtis Gedak 545a8583aa Minor cosmetic formatting change 2010-08-25 09:36:13 -06:00
Curtis Gedak 81986c0990 Ensure partition path name is compatible with dmraid (#622217)
This patch along with a few preceding patches address the
following bug reports:

Closes bug #622217 - gparted live 0.6.0-1 incompatibility with
AMD RAID (SB750 southbridge)

Closes Ubuntu launchpad bug 600729 - Gparted not usable on
fakeraid arrays
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/600729
2010-08-17 10:36:00 -06:00
Curtis Gedak cf264a05bb Replace function ped_partition_get_path with method get_partition_path 2010-08-17 10:36:00 -06:00
Curtis Gedak 9bd8b14871 Create new method get_partition_path
This method will be used as an entry point to the libparted
function ped_partition_get_path
2010-08-17 10:36:00 -06:00
Curtis Gedak 53c49349f7 Simplify logic in set_device_partitions method
Also clean up some white space
2010-08-17 10:36:00 -06:00
Curtis Gedak a3d70a1fbf Ensure original partition boundaries kept on rollback of failed move 2010-07-22 17:18:48 -06:00
Curtis Gedak c3a06ffd6c Fix problem with logical partition move overwriting EBR (#623630)
Prevent overwriting meta data (Extended Boot Rectors) for logical
partitions by temporarily increasing the size of the logical
partition to encompass all of the space involved in the move
operation.  The libparted library will move the EBR as needed to
permit this to happen.  After the move the logical partition is
set to the proper size.

This fixes bug #623630 - Move logical partition to right yields
invalid partition table on /dev/sda - wrong signature 0
2010-07-22 17:18:48 -06:00
Curtis Gedak e810b7f7f0 Fix crash moving partitions when size is a multiple of 16 MiB (#623697) 2010-07-06 13:12:19 -06:00
Curtis Gedak f173a51f0b Enable support for devices with sector sizes > 512 bytes (#607165)
GParted requires libparted version 2.2 or higher to support devices
with sector sizes > 512 bytes.

This commit marks the end of a series of enhancements required to
provide support for sector sizes > 512 bytes.
2010-05-27 11:08:40 -06:00
Curtis Gedak be53cf584b Fix off by 1 sector math when looking for unallocated space 2010-05-27 10:59:12 -06:00
Curtis Gedak 87e48efe88 Only show exactly 1 MiB unallocated space if not MBR or EBR
Do not show unallocated space of exactly 1 MiB in size if:

  a) The space is at the front of the drive.

     This space is reserved for the partition table and the
     Master Boot Record.

or

  b) The space immediately precedes a logical partition.

     This space is reserved for the Extended Boot Record.
2010-05-27 09:27:00 -06:00
Curtis Gedak f861501390 Improve cylinder alignment for partitions less than a disk cylinder 2010-05-26 16:57:59 -06:00
Curtis Gedak e62a23b5b5 Add partition alignment option to align to MiB (#617409)
Make align to MiB the default setting instead of align to cylinder.

Migrate logic for alignment to cylinder into its own method
snap_to_cylinder, and place common logic in snap_to_alignment.

Add alignment checks for situations where space is needed for Master
Boot Record or Extended Boot Record.

Adjust ranges on spin buttons according to required boot record space.

Copy fix for off by one sector (#596552) from
Dialog_Partition_New::Get_New_Partition to
Dialog_Base_Partition::Get_New_Partition

Enhance resize / move logic for checking locations of nearby logical
partitions to not depend on the partition ordering.

Note: This commit does not include limiting graphic movement according
to required boot record space.
2010-05-20 10:00:14 -06:00
Curtis Gedak 2cdfb4c55a Change partition alignment check box to a drop down menu
Also add signal handler to alignment menu to update file system
minimum size.
This enhancement is to prepare for adding a third alignment
option to align to MiB.
2010-05-09 14:45:26 -06:00
Curtis Gedak 6369e58bff Enhance detection for ext3, fat16, fat32, linux-swap, and hfsplus
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-28 14:11:24 -06:00
Curtis Gedak 66355153fb Enhance file system space unused math to use actual sector size 2010-04-28 13:25:57 -06:00
Curtis Gedak 9e5e9f5627 Enhance file system detection to use FS_Info method - blkid
This enhancement was added because the current libparted library,
version 2.2, does not appear to detect file systems for sector
sizes other than 512 bytes.
2010-04-28 12:58:28 -06:00
Curtis Gedak 7e2ca14756 Rename get_length method to get_sector_length
This rename is to try to reduce future confusion between
partition length in sectors versus partition length in bytes.
2010-04-28 09:11:44 -06:00
Curtis Gedak 70448f4fb0 Replace sector math with get_byte_length method where appropriate
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-27 12:54:14 -06:00
Curtis Gedak cb08e8c7dd Remove 512 byte based units and rename _FACTOR to BYTE
With the removal of the 512 byte constants, such as MEBIBYTE, it
was possible to rename the _FACTOR constants back to BYTE
constants.  The _FACTOR constants, such as MEBI_FACTOR, were a
temporary measure to help in the transition to support devices
with sector sizes > 512 bytes.
2010-04-26 13:40:38 -06:00
Curtis Gedak 81a903cda2 Replace constant MEBIBYTE with appropriate MEBI_FACTOR math
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-26 13:21:18 -06:00
Curtis Gedak 5d2bf2ec5d Replace default sector size with appropriate sector size
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-26 11:52:33 -06:00
Curtis Gedak 896dab7192 Enhance copy_filesystem method to work with sector sizes
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-26 11:43:59 -06:00
Curtis Gedak c3352fb24a Clean up progress bar current status after copy/move action
Also ensure that final progress bar current status is set to
completed value when the copy blocks method completes.
2010-04-25 11:09:18 -06:00
Curtis Gedak 74ecd2ed3f Set sector size and add to operation and dialog methods
This change is in preparation for supporting sectors sizes > 512 bytes.
2010-04-19 19:22:31 -06:00
Curtis Gedak 8fb40d843d Enhance copy methods for sector sizes > 512 bytes 2010-04-07 11:39:42 -06:00
Curtis Gedak 1a498b62bf Enable copy to work on computers with only 128 MiB RAM (#613430) 2010-03-24 14:47:46 -06:00
Curtis Gedak 44e5176ee5 Enhance format_size() for sector sizes > 512 bytes 2010-03-24 14:37:08 -06:00
Curtis Gedak 40d7dbac4b Convert file system minimum from sector to byte value 2010-03-24 14:37:08 -06:00
Curtis Gedak e786bfa598 Enhance erase_filesytem_signatures() for sector sizes > 512 bytes 2010-03-14 13:46:59 -06:00
Curtis Gedak 892e56f9b6 Enhance file system detection for sector sizes > 512 bytes 2010-03-14 13:46:59 -06:00
Curtis Gedak 4c0b514e22 Set device length to value from libparted
Previously this value was calculated to end on a cylinder
boundary.  On today's larger hard drives, which simply emulate
Cylinders/Heads/Sectors, some disk space might remain after the
last cylinder.  This space would always be less than a full
cylinder in size.  Now this space will be visible to the user.
2010-03-14 13:46:59 -06:00
Curtis Gedak 39208ba2af Add check if partition table re-read work around code is needed
A patch to alleviate the "failure to inform kernel of partition
changes problem" (bug #604298) has been included in parted-2.2.
Hence when parted-2.2 or higher is used, the work around code in
GParted is not required.
2010-03-01 11:05:03 -07:00
Curtis Gedak 4e2be4047c Remove comment about wrong identifier for HFS/HFS+ (#568867)
With parted-2.2 the partition identifier for HFS and HFS+ is set to 0xAF.
With previous versions of parted this was incorrectly set to 0x83.
2010-02-26 10:36:54 -07:00
Curtis Gedak 19d8f0dfc8 Add sector size to device display pane
Also add sector_size to Device class.  This is the start of an
enhancement to add support for devices with sector sizes other
than 512 bytes (#607165).
2010-02-20 15:12:26 -07:00
Curtis Gedak eba0c88da5 Indicate required software packages if unable to read file system (#576908) 2010-02-20 11:27:58 -07:00
Curtis Gedak 3dd34af909 Avoid crashes by ignoring devices with sector size > 512 bytes (#595309)
This is not an ideal solution because devices with sector sizes
greater than 512 bytes are silently ignored from a graphical interface
perspective.  Only if the user starts gparted from the command line
will the "ignoring device" message be seen.

In my opinion this short term solution of ignoring these devices is
still better than a gparted crash which might also result in data
loss.

A bug report requesting support for devices with sector sizes > 512
bytes has been created.
https://bugzilla.gnome.org/show_bug.cgi?id=607165

Thanks go to Jan Claeys for the initial small patch.
2010-01-16 11:45:29 -07:00
Curtis Gedak bf86fd3f9c Work around: retry ped_disk_commit_to_os() after sleep(1) (#604298)
Bug #604298 involves a problem that can occur when GParted uses
libparted to manipulate a partition table, but the
ped_disk_commit_to_os() function fails to inform the Linux kernel of
these changes to the partition table.  This problem is intermittent in
nature and is difficult to reliably reproduce.

This change is an attempt at a work around.  If the first call to
ped_disk_commit_to_os() fails, then we sleep for 1 second to allow the
system to settle before invoking the function call again.  My testing
has shown that this greatly improves the chances of successfully
informing the kernel of partition changes.

Thanks go to François Dupoux and Steven Shiau for their suggestions
and help to resolve this problem.
2010-01-15 15:39:06 -07:00
Curtis Gedak 51d1c4c552 Ensure commit_to_os() return code is passed up through commit() method
This problem was discovered while investigating bug #604298
2010-01-08 11:02:16 -07:00
Curtis Gedak 1ef489fcd8 Clear libparted kernel re-read messages when scanning devices
When calling commit_to_os() with newer Linux kernels,
parted-1.9.0, and at least one partition mounted on the device,
the following error message is displayed:

    The kernel was unable to re-read the partition table on
    /dev/sda (Device or resource busy).  This means Linux won't
    know anything about the modifications you made until you
    reboot.  You should reboot your computer before doing
    anything with /dev/sda.

If this message is not cleared then it will remain in the
libparted_message array and could potentially be displayed along
with an error message for a subsequent scanned disk device.
2009-12-09 13:16:18 -07:00
Curtis Gedak 0fba953cd9 Capture libparted messages when invalid partition table found #337244
When libparted reports a problem with the partition table, capture
this message and attach it to the "unallocated" partition that spans
the entire disk.

Examples of these types of problems encountered are:
     /dev/sda: unrecognised disk label
     Can't have overlapping partitions.
2009-12-03 15:59:49 -07:00
Curtis Gedak 8cfb27b718 Cleanup file copyright entries
Restore copyright entries by original author to those of his last
known repository commit titled "released gparted-0.3.4 on
LarryT's request." on Feb 25, 2007.

Add my own copyright entries for files in which I changed source
code.  Files in which I only made spelling changes do not have my
copyright entry added.
2009-11-05 11:08:49 -07:00
Curtis Gedak 1607d13a06 Added auto detection of Linux software RAID devices
Auto detection of Linux software RAID devices was lost in GParted
0.3.8.  This was because device scanning by the libparted device
call ped_device_probe_all() was replaced with custom code within
GParted to scan /proc/partitions for devices.

The reason the libparted call was replaced was due to a long
scanning problem with ped_device_probe_all(), a non-existent
physical floppy device, and a BIOS setting indicating a floppy
drive existed.  See bug #351753:
https://bugzilla.gnome.org/show_bug.cgi?id=351753
2009-11-03 13:30:44 -07:00
Curtis Gedak 33d7e31d3c Change em dashes to period with new sentence
With the em dashes in the translatable strings, a 'make distcheck'
would fail.  Hence these have been change to be a period followed by a
new sentence.
2009-10-26 15:19:04 -06:00
Curtis Gedak 5f6301d1b0 Rework logic to resolve real path for symbolic link devices (#582687) 2009-10-13 17:45:04 -06:00
Bruce Cowan b44516a9d4 Minor string fixes (#597686) 2009-10-13 12:24:02 -06:00
Curtis Gedak 0810792f02 Ensure dmraid devices created for devices passed on command line 2009-09-30 16:32:32 -06:00
Curtis Gedak 6d90d0fbcd Resolve real path for symbolic link devices in mount files (#582687)
In order to find a match between the device paths in mount files and
partitions as found by libparted, the mount device must be a real path
and not a symbolic link.

Closes GParted bug #582687
2009-08-09 14:26:07 -06:00
Curtis Gedak 5e07fb434d Place translator comment in proper location (#590415) 2009-07-31 18:56:31 -06:00
Curtis Gedak 8aa941204c Enhance to use new linux-swap "filesystem" types added in parted-1.9.0
Excerpt from parted-1.9.0 release notes follows:
  In libparted, the linux-swap "filesystem" types are now called
  "linux-swap(v0)" and "linux-swap(v1)" rather than "linux-swap(old)"
  and "linux-swap(new)" as in parted 1.8, or "linux-swap" as in older
  versions; "old" and "new" generally make poor names, and v1 is the
  only format supported by current Linux kernels. Aliases for all
  previous names are available.
2009-07-28 15:38:30 -06:00
Curtis Gedak 5f3c806561 Enhance file parsing to handle tabs properly (#582687)
Previously the read_mountpoints_from_file() method only expected
a space between arguments in files such as /etc/fstab.  Valid
delimiters are now space and tab.

Related to GParted bug #582687
2009-07-23 16:09:22 -06:00
Curtis Gedak ae912379cc Cleanup white space in read_mountpoints_from_file method 2009-07-23 16:09:22 -06:00
Curtis Gedak 746a2f2f09 Improve error messages and translator comments
Provide translator sample text, and add more detail to error messages
when updating the ntfs boot sector.
2009-05-16 12:45:43 -06:00
Curtis Gedak dd8a57a8fe Remove requirement for xxd and dd for NTFS move or paste action
Perform direct update of Number of Hidden Sectors in NTFS boot record.
This change removes the need for /usr/bin/xxd and /bin/dd.
Related to GParted bug #574389
2009-05-16 12:15:14 -06:00
Curtis Gedak 9238e47bc2 Remove absolute paths from /usr/bin/xxd and /bin/dd 2009-05-14 14:45:11 -06:00
Curtis Gedak e7352a5000 Ensure /dev file system device entries created before adding device 2009-05-02 10:59:49 -06:00
Curtis Gedak 301bd77312 Refactor some logic into separate settle_device method 2009-05-02 10:59:49 -06:00
Curtis Gedak a05751ea95 Enhance to try udevadm if udevsettle is not found
Newer systems might not have udevsettle.  It has been replaced by
"udevadm settle".
Thanks to Lorenzo Cogotti aka Micia for this knowledge, and for a
proposed solution.
2009-04-24 11:12:29 -06:00
Curtis Gedak 7c2c771266 Minor cosmetic fix to reorder Reiser4 detection code
Now the Reiser4 detection code better matches the detection code for
other file systems.
2009-04-22 16:55:47 -06:00
Curtis Gedak 7695593d21 Improve crypt-luks detection (#578300)
Move crypt-luks detection prior to libparted file system detection.
If libparted file system detection is performed first, then encrypted
file systems such as ext3 will be incorrectly detected by libparted as
plain 'ext3' when in fact these file systems are encrypted.
2009-04-22 16:47:13 -06:00
Curtis Gedak eda5bf16aa Improved swap and dmraid mountpoint detection
svn path=/trunk/; revision=1097
2009-03-16 22:55:24 +00:00
Curtis Gedak eb4ad0615d Added initial support for dmraid devices
svn path=/trunk/; revision=1093
2009-03-14 20:09:28 +00:00
Curtis Gedak f259327c82 Enabled type checking (const instead of #define)
svn path=/trunk/; revision=1080
2009-02-27 17:33:20 +00:00
Curtis Gedak 14363d96f4 Added recognition of /dev/mmcblk* SD/MMC devices
svn path=/trunk/; revision=1079
2009-02-25 20:42:44 +00:00
Curtis Gedak dc1ab54d8f Added detection of btrfs file system
svn path=/trunk/; revision=1075
2009-02-23 20:22:30 +00:00
Curtis Gedak 3ef0293876 Added detection of LUKS encrypted partitions
svn path=/trunk/; revision=1071
2009-02-18 16:19:49 +00:00
Curtis Gedak 42b63cc274 Enhanced move/resize functionality - Only move start sector if dialog space before value is changed.
svn path=/trunk/; revision=1070
2009-02-16 19:53:43 +00:00
Curtis Gedak 0375182e3c Fixed partition type for linux-swap(new).
svn path=/trunk/; revision=1045
2009-01-28 17:48:40 +00:00
Curtis Gedak a52b989903 Actually commit changes from src/GParted_Core.cc, and remove src/Partition.o that was accidentally committed in it's place.
svn path=/trunk/; revision=1026
2009-01-07 04:40:16 +00:00
Curtis Gedak 533eb1bc03 Added support for ext4 file systems
svn path=/trunk/; revision=1005
2008-12-18 22:13:43 +00:00
Curtis Gedak 7a3fa5a7dd Reduced FS_Info cache disk reads
svn path=/trunk/; revision=1001
2008-12-08 18:23:30 +00:00
Curtis Gedak 4ef71e5004 Added lvm2 physical volume detection
svn path=/trunk/; revision=1000
2008-12-07 18:43:35 +00:00
Curtis Gedak 504eb04ddc Roll back (remove) code to recognize /dev/mapper/* devices, because too many entries such as LVM partitions are wrongly added to the device list.
svn path=/trunk/; revision=989
2008-11-29 17:08:52 +00:00
Curtis Gedak c4bc4430c7 Fixed incorrect spelling of filesystem and mountpoint
svn path=/trunk/; revision=970
2008-11-18 23:58:17 +00:00
Curtis Gedak 5b8c16ba60 Improved read label performance with blkid cached results
svn path=/trunk/; revision=963
2008-11-13 20:06:18 +00:00
Curtis Gedak ed9b5afe36 Added read UUID read display
svn path=/trunk/; revision=961
2008-11-11 17:21:22 +00:00
Curtis Gedak 55952fe621 Renamed set_label and get_label methods to write_label and read_label respectively.
svn path=/trunk/; revision=957
2008-11-08 23:55:17 +00:00
Curtis Gedak a5839e5746 Fixed some spelling mistakes
svn path=/trunk/; revision=951
2008-11-04 22:16:06 +00:00
Curtis Gedak 5cb29070bf Changed thread status messages to be unique
svn path=/trunk/; revision=947
2008-10-31 17:15:01 +00:00
Curtis Gedak a8a035cbae Removed ellipses from status messages in set_devices()
svn path=/trunk/; revision=946
2008-10-30 19:41:51 +00:00
Curtis Gedak da9d41d459 Added translator comments
svn path=/trunk/; revision=945
2008-10-30 19:10:17 +00:00
Curtis Gedak 2331bd0763 Added set and get thread status message methods.
Added thread status message updates in set_devices().

svn path=/trunk/; revision=943
2008-10-30 18:50:38 +00:00
Curtis Gedak a622e6fefd Remove std:: prefix from llabs()
svn path=/trunk/; revision=942
2008-10-29 00:41:52 +00:00
Curtis Gedak 57bda0a93c Enhanced to recognize /dev/mapper/* devices.
The move away from libparted device recognition broke recognition of /dev/mapper/* devices.  Problem now fixed.
Thanks to Colin Watson for the patch.

svn path=/trunk/; revision=933
2008-10-15 15:51:24 +00:00
Curtis Gedak 3418589a45 Add translator comments and fix spelling mistake
svn path=/trunk/; revision=914
2008-09-25 15:23:52 +00:00
Curtis Gedak 29c343848a Added pattern recognition for HP RAID drives
svn path=/trunk/; revision=898
2008-09-12 20:57:12 +00:00
Curtis Gedak a2b96b0094 Enhanced optimal block size copy algorithm to reduce time required to move or copy partitions
svn path=/trunk/; revision=880
2008-08-07 02:06:00 +00:00
Curtis Gedak af8a021e89 Improved math for rounding starting sector to cylinder boundaries for logical partitions, and the first primary partition for MBR and GPT partition tables. This fixes a problem where a resize operation could turn into a move due to problems with the snap_to_cylinder function.
svn path=/trunk/; revision=857
2008-06-15 17:57:48 +00:00
Curtis Gedak 467e910e1d Fixed 3 grammatical errors by replacing periods with dashes
svn path=/trunk/; revision=854
2008-06-12 22:22:29 +00:00
Curtis Gedak 7bf6c422ff Added parse devices from /proc/partitions for "Scanning all devices..." code
svn path=/trunk/; revision=847
2008-05-08 16:25:43 +00:00
Curtis Gedak 605e1f4cdc Fixed bug #324220 with the following changes:
- Removed gparted-disable-automount.fdi handling.
- Renamed gparted binary to gpartedbin to permit a calling script to be named gparted.
- Added new calling script gparted.in to permit using hal-lock to acuiqre device locks to prevent automounting while executing gpartedbin.
- Renamed gparted.desktop.in to gparted.desktop.in.in to permit parsing installdir.

svn path=/trunk/; revision=826
2008-04-21 15:22:00 +00:00
Curtis Gedak 8d808c0b62 gparted-0.3.6 - code recreation from Source Forge
svn path=/trunk/; revision=810
2008-04-07 19:41:18 +00:00
Curtis Gedak 6c149ea1d9 gparted-0.3.5 - code recreation from Source Forge
svn path=/trunk/; revision=809
2008-04-07 15:26:19 +00:00
Bart Hakvoort 4e9d368102 added a check to see wether a device is 'real' or not. Thanks to
Francois Dupoux for the patch.

svn path=/trunk/; revision=764
2007-01-07 20:29:03 +00:00
Bart Hakvoort 8d2e7dd26d replaced 'long' with 'Sector' to prefent overflows with really large
* include/Device.h,
  include/Dialog_Base_Partition.h,
  src/Dialog_Base_Partition.cc: replaced 'long' with 'Sector' to
  prefent overflows with really large devices.
2006-12-08 13:14:05 +00:00
Bart Hakvoort 8336fcffea fixed 'Could not detect file system.' error with fat and hfs filesystem
* src/GParted_Core.cc: fixed 'Could not detect file system.' error
  with fat and hfs filesystem when performing a move to the left.
  (thanks to 'the Bogerds' for borrowing me an usbstick ;) )
2006-12-05 21:47:34 +00:00