Commit Graph

111 Commits

Author SHA1 Message Date
Mike Fleetwood 686ec8f713 Make GParted recognise reading blank file system labels (#685656)
GParted doesn't notice when a file system label is changed to blank.
GParted first calls the file system specific read_label() method.  When
the label is blank read_label() correctly sets partition.label to the
zero length string.  Second GParted_Core::set_device_partitions() treats
the zero length string to mean that the label is unset and calls
FS_Info::get_label() to retrieve it from the cache of blkid output.
Blkid also doesn't notice when the file system label has been changed to
blank so reports the previous label.  Hence GParted displays the
previous file system label.

Fix by making label a private member variable of the class Partition and
providing access methods set_label(), get_label() and label_known()
which track whether the label has been set or not.  This only fixes the
fault for file systems which use file system specific commands to read
the label and when these tools are installed.  Otherwise GParted uses,
or has to fall back on using, the buggy blkid command to read the file
system label.

NOTE:
Many of the file system specific read_label() methods use a tool which
outputs more than just the label and use Utils::regexp_label() to match
leading text and the label itself.  If the surrounding text changes or
disappears altogether to indicated a blank label, regexp_label() doesn't
match anything and returns the zero length string.  This  is exactly
what is required and is passed to set_label() to set the label to blank.

Bug 685656 - GParted doesn't notice when file system label is changed to
             blank
2012-11-04 12:26:09 +00:00
Mike Fleetwood 01150758c3 Make mounted partition usage method selectable per file system (#683255)
Each file system class can now choose how the size and free space of the
file system is determined when it is mounted.

    .fs.online_read = FS::NONE  (default)
        Do nothing.  Don't get the file system size and free space.

    .fs.online_read = FS::GPARTED
        Use internal GParted method which calls statvfs() system call on
        the mounted file system.

    .fs.online_read = FS::EXTERNAL
        Call the file system's member function set_used_sectors().  This
        is the same function as called when the file system is not
        mounted.   It can determine if the file system is mounted or not
        by testing partition.busy and acting accordingly.

This means that determining the size and free space of active LVM2
Physical Volumes is no longer a special case.  Instead the lvm2_pv class
just elects to have its set_used_sectors() method called for both the
active and deactive cases.

Bug #683255 - ext2: statvfs differs from dumpe2fs (x MB unallocated
              space within the partition)
2012-10-02 13:19:29 -06:00
Mike Fleetwood fbc4e9e941 Remove full stops from the end of primary text in dialogs
The GNOME HIG, 3.4.1 "Alert Text" states:

    ...  The primary text is punctuated in 'newspaper headline' style,
    that is, it has no terminating period, but it may have a terminating
    question mark.

http://developer.gnome.org/hig-book/3.0/windows-alert.html.en#alert-text
2012-08-30 13:47:46 -06:00
Mike Fleetwood 795a92f5b2 Add file system specific remove() methods (#670171)
This commit only adds a remove() method to every file system and an
optional call to it in the relevant operations.  All remove() methods
are no operations and not enabled.

The remove() method provides explicit controlled removal of a file
system before the partition is deleted or overwritten by being formatted
or pasted into.  When implemented, it appears as an extra step in the
relevant operation.  The file system specific remove() method is
explicitly allowed to fail and stop the operations currently being
applied.

This is different to the existing erase_filesystem_signatures() which
wipes any previous file system signatures immediately before a new file
system is written to ensure there is no possibility of the partition
containing two or more different file system signatures.  It never fails
or reports anything to the user.

NOTE:
Most file systems should NOT implement a remove() method as it will
prevent recovery from accidental partition deletion.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 719e73e335 Query unallocated space for unmounted file systems (#499202)
Update file system specific implementations to set the size and free
space, thus allowing the unallocated space in the partition to be
calculated, for the following unmounted file systems:
    btrfs, ext2, ext3, ext4, fat16, fat32, jfs, nilfs2, ntfs, reiserfs,
    reiser4, xfs

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 10:24:28 -06:00
Curtis Gedak 0fda1d011d Enable new fs resize library available with parted-3.1 (#668281)
The parted-3.1 release brings back FAT16/FAT32 and HFS/HFS+ file
system resize capabilities in a new libparted fs resize library.

The following operations are again available when GParted is linked
with parted-3.1:

   FAT16 - grow and shrink
   FAT32 - grow and shrink
   HFS   - shrink
   HFS+  - shrink

Note that there is a difference in how move actions are handled for
FAT16/FAT32 file systems based on parted version.

When GParted is linked with parted >= 3.0:

   FAT16 - move performed internally by GParted
   FAT32 - move performed internally by GParted

When GParted is linked with parted < 3.0:

   FAT16 - move performed by libparted
   FAT32 - move performed by libparted

Thanks goes to Jim Meyering for restoring these file system resizing
capabilities in Parted 3.1 with a new libparted fs resize library.

Closes Bug #668281 - minimal file-system resize API? (FAT and HFS*
                     only)
2012-03-03 11:55:20 -07:00
Rogier Goossens 88cfe40a8b Remove temporary file after reading UUID of fat16 and fat32 filesystems 2012-02-10 10:33:13 -07:00
Rogier Goossens a5eb91e549 Further improve help manual wording
See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -07:00
Curtis Gedak 2f191307cf Restructure and word-smith UUID translatable text
Restructure and word-smith translatable text associated with the
enhancement to add ability for setting UUID in an effort to better
align with the Gnome Documentation Style Guide.

See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -07:00
Rogier Goossens 4108daf15f Implement changing UUID for NTFS (#667278)
Part 4 of 4 to provide new UUID support for NTFS.

Closes Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -07:00
Rogier Goossens 9e96159bb2 Add support for setting UUID (#667278)
Add the ability to set a new random UUID on file systems that provide
the appropriate tools to perform this action.

Update the help manual to include this new functionality.  Also add
reference links to "setting a partition label" and "changing a
partition UUID" in the "copying and pasting a partition" section.

This patch does not include setting the UUID on an NTFS file system.

Bug #667278 - Add support for setting UUID

Bug #608308 - fix documentation - Copying and Pasting a Partition
2012-01-23 12:32:27 -07:00
Curtis Gedak 8a58b5b53e Enable compile and link with libparted 3.0 (#651559)
The release of (lib)parted 3.0 includes a change to the Application
Programing Interface - API.  Most importantly, libparted 3.0 removes
many file system specific function calls, and hence the capabilities
provided by these functions.  In order for GParted to compile and link
with libparted 3.0, this libparted functionality is lost.

Specifically, the functionality that is lost when GParted is compiled
and linked with libparted 3.0 is as follows:

  - Loss of ability to grow and shrink FAT16 and FAT32 file systems
  - Loss of ability to shrink HFS and HFS+ file systems
  - Loss of ability to determine used and unused sectors in HFS and
      HFS+ file systems
  - Loss of ability to erase file system signatures on partition
      create and format

It is hoped that other free software projects will include some or all
of the above lost functionality, which can then be added back to
GParted.

This commit includes a change in how FAT16 and FAT32 file systems are
moved.  Specifically the move is now performed internally by GParted
when linked with libparted 3.0.  The move functionality is provided by
libparted for prior libparted versions (e.g. less than 3.0).

This is the final enhancement in a series of commits that enable
GParted to compile with libparted version 3.0.

Closes Bug #651559 - Doesn't compile against parted 3.0
2011-06-09 09:59:41 -06:00
Curtis Gedak ca30f986f7 Add virtual move method to FileSystem class
This is preparation work for the following bug report:
Bug #589555 - Moving a swap partition needlessly copies
              all "data" on it
2010-10-19 13:35:53 -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 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 f9f603256e Convert file system maximum from sector to byte value 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 cf22c99424 Update copyright years in fat16.cc and fat32.cc 2010-01-14 10:59:30 -07:00
Curtis Gedak 1155fa6dab Fix problem reading some FAT32 partitions (#605175)
This problem was introduced with GParted 0.4.7 when the "-a"
option was removed from the dosfsck command.  The dosfsck command
is used to read the number of used sectors.  Instead we will now
use the "-n" option which does not write any changes to the file
system, and allows non-interactive operation.
2010-01-14 10:50: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 6fa8ad4818 Made set_used_sectors method less meddlesome for FAT16/32
Removed the "-a" flag from the dosfsck command that is used to
determine the number of used sectors in FAT16 and FAT32 file systems.

Related to GParted bug #569921
2009-08-11 15:33:59 -06: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 352641208a Added fat_compliant_label() method to limit volume labels to 11 characters.
Enforced fat compliant label for FAT16 and FAT32 file systems.

svn path=/trunk/; revision=959
2008-11-11 00:14:57 +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 8d808c0b62 gparted-0.3.6 - code recreation from Source Forge
svn path=/trunk/; revision=810
2008-04-07 19:41:18 +00:00
Bart Hakvoort e3b4a7316b added support for reading volumelabels. Atm we only read ext2/3, but the
* added support for reading volumelabels. Atm we only read ext2/3, but
  the infrastructure for adding the other filesystems is in place.
  It's simply a matter of finding the right commands and parsing the
  output. (see #338528 for more info)
2006-09-12 20:34:33 +00:00
Bart Hakvoort 9010255c1c return true if filesystem was succesfully modified by dosfsck.
* src/fat16.cc,
  src/fat32.cc: return true if filesystem was succesfully modified by
  dosfsck.
2006-09-09 11:11:32 +00:00
Bart Hakvoort 4d895659d3 be a bit more verbose on errior in set_used_sectors()
* src/ext2.cc
  src/ext3.cc
  src/fat16.cc
  src/fat32.cc
  src/jfs.cc
  src/ntfs.cc
  src/reiser4.cc
  src/reiserfs.cc
  src/xfs.cc: be a bit more verbose on errior in set_used_sectors()
2006-09-08 20:51:31 +00:00
Bart Hakvoort 889ab1232f changed progressfeedbackhandling a bit. Because this affected
* changed progressfeedbackhandling a bit. Because this affected
  OperationDetail i had to make changes in almost every file.
2006-08-20 09:33:54 +00:00
Bart Hakvoort 677a21f50a improved errorhandling a bit. At the initialscan we store errors/warnings
* improved errorhandling a bit. At the initialscan we store
  errors/warnings now in a list per partition and show the in the
  partitioninfo dialog.
  While executing an operation we collect all libparted exceptions in
  a list and attach this list to the operationdetails when everything
  is done.
2006-07-30 15:13:41 +00:00
Bart Hakvoort d52b0286c9 fixed Pango markup problems in operationdetails restructured
* fixed Pango markup problems in operationdetails
* restructured OperationDetail
* renamed some enums for improved readability of the source
2006-07-29 08:27:28 +00:00
Bart Hakvoort 2d7fb5700b more cleanups in the core and the fs'es (these changelogs are getting
* more cleanups in the core and the fs'es (these changelogs are
  getting boring ;^) )
2006-06-17 16:38:15 +00:00
Bart Hakvoort 20d5650188 cleanups in the core and the fs'es (check/repair)
* cleanups in the core and the fs'es (check/repair)
2006-06-17 09:55:32 +00:00
Bart Hakvoort 682283ce89 cleanups in the core and the fs'es (create)
* cleanups in the core and the fs'es (create)
2006-06-17 08:56:24 +00:00
Bart Hakvoort 7bb7e8a84f Use ped_device_read and ped_device_write instead of 'dd' to copy
* Use ped_device_read and ped_device_write instead of 'dd' to copy
  filesystems.
  Modified progressdetails to provide more detailed feedback about a
  process.
  Basicly these were all changes to the infrastructure to make the
  incorporation of the 'move-code' a bit easier.

  ( sorry, not in the mood to list all affected files ;)
2006-05-23 21:17:34 +00:00
Bart Hakvoort f96c8dea05 trivial cleanups
* trivial cleanups
2006-03-28 12:40:29 +00:00
Bart Hakvoort ad9f2126e7 fixed issues with copying (see also #335004) cleanups + added FIXME added
* include/GParted_Core.h,
  src/GParted_Core.cc,
  src/Win_GParted.cc,
  src/ext2.cc,
  src/ext3.cc,
  src/fat16.cc,
  src/fat32.cc,
  src/jfs.cc,
  src/ntfs.cc,
  src/reiserfs.cc: fixed issues with copying (see also #335004)
* include/Operation.h,
  src/Operation.cc: cleanups + added FIXME
* include/Partition.h,
  src/Partition.cc: added clear_mountpoints()
* src/DrawingAreaVisualDisk.cc: added FIXME
2006-03-19 15:30:20 +00:00
Bart Hakvoort cb8ff87462 changed statusmessage, fixed issue with exit_status and tested/confirmed
* src/ext2.cc,
  src/ext3.cc,
  src/fat16.cc,
  src/fat32.cc,
  src/jfs.cc,
  src/ntfs.cc,
  src/reiser4.cc,
  src/reiserfs.cc,
  src/xfs.cc: changed statusmessage, fixed issue with exit_status and
  tested/confirmed succesfull usage of Partition::get_path() in
  Set_Used_Sectors() of all filesystems.
2006-03-16 13:12:01 +00:00
Bart Hakvoort 6d8b169e73 changed the way devices and partitions store their devicepaths. Instead of
* changed the way devices and partitions store their devicepaths.
  Instead of holding a 'realpath' and a symbolic path we store paths
  in a list. This allows for improved detection of mountpoins, free
  space, etc..

  Also fixed a nasty bug which showed up when you copy a partition
  from one device to another. (thanks to mario for the report)
2006-03-14 21:37:47 +00:00
Bart Hakvoort 29a7744fe2 improved errorhandling in Set_Used_Sectors() in the filesystemclasses
* improved errorhandling in Set_Used_Sectors() in the filesystemclasses
2006-02-25 12:25:18 +00:00
Bart Hakvoort 391ca32a2b in some places i still used MiB's instead of sectors to store sizes. this
* in some places i still used MiB's instead of sectors to store sizes.
  this has been fixed everywhere. Only the spinbuttons still use
  MiB's. I have a few ideas on how to solve this, but i'll take it up
  with #usability first.
2006-02-25 10:09:30 +00:00
Bart Hakvoort 828d7a9e5b wrap mount/umount/swapon/swapoff instead of implementing it ourselves
* wrap mount/umount/swapon/swapoff instead of implementing it
  ourselves (#330641)
* moved execute_command() to Utils and made the filesystems use it. All
  in all this decreased the size of the binary with 10% and made stuff
  more readable.
2006-02-15 16:05:26 +00:00
Bart Hakvoort 591a8f3db0 :get_tmp_dir() instead of hardcoding it as '/tmp' :find_program_in_path()
* use Glib::get_tmp_dir() instead of hardcoding it as '/tmp'
* use Glib::find_program_in_path() instead af a system/which combi
* display current device in windowtitle
2006-01-24 12:31:58 +00:00
Bart Hakvoort 52dfb1c364 correct partitiontype of destination is now set while copying resizing now
* correct partitiontype of destination is now set while copying
* resizing now return correct status (sometimes it would report
  succes even when some of the suboperationes failed)
* fixed some issues with resizing and cylindersizes.
2006-01-22 21:16:36 +00:00
Bart Hakvoort 045edbbe95 :spawn_sync instead of popen(). also made the filesystems call
* removed Execute_Command() and replaced it by execute_command().
  The latter uses Glib::spawn_sync instead of popen().
  also made the filesystems call execute_command rather than calling
  Glib::spawn_sync themselves.
2006-01-22 13:23:58 +00:00
Bart Hakvoort 97a9a5fa87 p
* added detailed progressfeedback. It still needs some polishing, but
  is already far better then the old situation. And what's more, it's
  finally threadsafe :p
2006-01-19 19:15:15 +00:00
Bart Hakvoort 23aa549c7c :spawn_command_line_sync() + general cleanups in the set_used_sectors()
* replaced popen() with Glib::spawn_command_line_sync() + general
  cleanups in the set_used_sectors() functions.
2005-12-28 16:43:06 +00:00
Bart Hakvoort 7e4efd3c2e rewrote quite some stuff to use an enum to indentify filesystems instead
* rewrote quite some stuff to use an enum to indentify filesystems
  instead of stringcomparisons.
2005-12-07 11:21:27 +00:00
Bart Hakvoort 73c5fa6f4e fixed 'broken pipe' warning removed unnecessary 'echo 2 |' from freespace
* src/jfs.cc: fixed 'broken pipe' warning
* src/fat16.cc,
  src/fat32.cc: removed unnecessary 'echo 2 |' from freespace scan.
2005-11-29 17:14:38 +00:00
Bart Hakvoort cc18d11ad5 hmmz, lots of shimmery internals.. Instead of using a boolean to indicate
* hmmz, lots of shimmery internals..
  Instead of using a boolean to indicate support for certain
  features i now use and enum (NONE, LIBPARTED, EXTENDED).
  This allowed me to clean up some stuff that annoyed me ;)
  Still.. the core could use a bit more love...
2005-11-27 00:57:11 +00:00
Bart Hakvoort 61cd0ce778 lots of stuff and cleanups, including fixing getting used/unused space of
* lots of stuff and cleanups, including fixing getting used/unused space of hfs/hfs+/fat16/fat32
* also fixes bug #161362
2005-09-13 14:56:00 +00:00
Bart Hakvoort c87cba6ee5 Changed 'bool Create( const Glib::ustring & device_path, const Partition &
* The Filesystemclasses: Changed 'bool Create( const Glib::ustring & device_path, const Partition & new_partition )'
to 'bool Create( const Partition & new_partition )'. Since i now use external tools for all filesystems, the partitionpath will suffice.
2004-12-28 13:29:01 +00:00
Bart Hakvoort 7d1a46f1c1 fixed bug with thousand separator (#161362). fixed bug with incorrect
* (all filesystem classes): fixed bug with thousand separator (#161362).
* ext2.cc,
  ext3.cc: fixed bug with incorrect used/unused space after copying.
2004-12-15 19:39:18 +00:00
Bart Hakvoort 4815b17153 Replaced boolean 'resize' with 'shrink' and 'grow'. It seems some
* Replaced boolean 'resize' with 'shrink' and 'grow'. It seems some filesystems only support growing (e.g. xfs) so i need
  two flags to control the behaviour of the filesystemclasses.
2004-12-13 13:58:51 +00:00
Bart Hakvoort 0e03819afc use mkdosfs -F16 instead of libparted to create fat16 filesystems
* src/fat16: use mkdosfs -F16 instead of libparted to create fat16 filesystems
2004-12-10 11:49:27 +00:00
Bart Hakvoort 951797caa7 added MIN and MAX to filesystemstruct to set min. and max sizes of a
* added MIN and MAX to filesystemstruct to set min. and max sizes of a filesystem. So instead of checking per filesystem
  i now simply check the fs.MIN or fs.MAX. this results in less and cleaner code. Also this will come in handy when adding
  support for new filesystems. (This also fixed several minor bugs with filesystemsizes and gained some improvement in resizer
  performance)
2004-12-09 22:56:33 +00:00
Bart Hakvoort 3401c0be0d added correct check for availability of 'dosfsck' bumped to 0.0.7 YAY! ;)
* src/fat16.cc,
  src/fat32.cc: added correct check for availability of 'dosfsck'
* configure.in: bumped to 0.0.7  YAY! ;)
2004-12-04 16:56:08 +00:00
Bart Hakvoort a54a5954f5 implemented correct filesystemcheck using dosfsck.
* src/fat16.cc,
  src/fat32.cc: implemented correct filesystemcheck using dosfsck.
2004-11-30 21:21:10 +00:00
Bart Hakvoort f0eb17b8db Execute_Command() now returns exit status of executed command returnvalue
* include/FileSystem.h,
  src/FileSystem.cc: Execute_Command() now returns exit status of executed command
* the filesystemclasses: returnvalue (bool) is now set according to the return status of the command
2004-11-30 21:05:48 +00:00
Bart Hakvoort bd02bca613 P ). Resizing of ext2/3 works perfect now. I've even tested it on the
* Again way too many chances to create a detailed entry (i'm glad i'm the only dev atm :P ).
  Resizing of ext2/3 works perfect now. I've even tested it on the partition holding my SG seasons =)
  Implemented checking of filesystems (only internally used atm).
  Done some overall tweaking, finetuning etc.. release 0.0.7 is getting shape.
2004-11-21 21:49:38 +00:00
Bart Hakvoort 4ccf831ec7 P) It still needs a lot of love, but the foundations are laid =)
* Rewrote a large part of gparteds internal code. Filesystemssupport is now much more separated from the rest of gparted and
  adding support for other filesystems should be a piece of cake now (hope that's true :P)
  It still needs a lot of love, but the foundations are laid =)
2004-11-17 13:00:25 +00:00