Commit Graph

12 Commits

Author SHA1 Message Date
Mike Fleetwood d948cbcb91 Make get_custom_text() and get_generic_text() return by reference
Replace return by value of const strings from
FileSystem::get_custom_text() and get_generic_text() because that
implies duplication of those strings.  Return a reference to constant
strings instead.
2018-06-18 10:15:33 -06:00
Mike Fleetwood 029a8eb19d Stop providing a default for FileSystem::resize() fill_partition argument
FileSystem::resize() (and derived) is only ever called from a single
location and always with the fill_partition argument supplied [1].
Therefore providing a default for the argument is unnecessary.  So
remove it.

[1] Since these two commits from 2006-06-17, before GParted 0.3.0, which
    added resize_filesystem() and maximize_filesystem() methods to wrap
    calls to p_filesystem->resize() into a single location:

    08245cd08c
    cleanups in the core and the fs'es (resize)

    2d7fb5700b
    more cleanups in the core and the fs'es (these changelogs are getting
2016-12-12 13:15:34 -07:00
Mike Fleetwood 8979913a3f Remove "../include/" from GParted header #includes
It made the code look a little messy, is easily resolved in the build
system and made the dependencies more complicated than needed.  Each
GParted header was tracked via multiple different names (different
numbers of "../include/" prefixes).  For example just looking at how
DialogFeatures.o depends on Utils.h:

    $ cd src
    $ make DialogFeatures.o
    $ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
     ../include/DialogFeatures.h ../include/../include/Utils.h \
     ../include/../include/../include/../include/../include/../include/Utils.h \
     ../include/../include/../include/Utils.h \

After removing "../include/" from the GParted header #includes, just
need to add "-I../include" to the compile command via the AM_CPPFLAGS in
src/Makefile.am.  Now the dependencies on GParted header files are
tracked under a single name (with a single "../include/" prefix).  Now
DialogFeatures.o only depends on a single name to Utils.h:

    $ make DialogFeatures.o
    $ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
     ../include/DialogFeatures.h ../include/Utils.h ../include/i18n.h \
2016-12-12 13:15:34 -07:00
Mike Fleetwood 48d898ebfd Include Partition.h header everywhere it's used
Lots of files which use the Partition class relied on the declaration
being included via other header files.  This is bad practice.

Add #include "Partition.h" into every file which uses the Partition
class which doesn't already include it.  Header file #include guards are
specifically to allow this.
2016-01-26 10:11:35 -07:00
Mike Fleetwood f6e4390aaf Add const qualifier to get_custom_text() member functions
The function never modifies any member variables so make it a const
member function.

(FileSystem::get_custom_text() is a virtual function so can't be made
static).
2015-05-19 10:34:59 -06:00
Mike Fleetwood b1dc9e69e3 Make partition busy detection method selectable per file system (#723842)
GParted's primary inbuilt busy detection method is "is the partition
mounted?".  A custom method is used for LVM2 PV because its not a
mounted file system.

Make busy detection selectable per file system type.

    .fs.busy = FS::NONE  (default)
        No busy detection.

    .fs.busy = FS::GPARTED
        Use internal GParted method which checks if the partition is
        mounted.

    .fs.busy = FS:EXTERNAL
        Call the file system type's member function is_busy().

LVM2 PV busy detection changes from a special case to just electing to
call the lvm2_pv::is_busy() method.  Linux Software RAID remains a
special case because it's only recognised, but not otherwise supported.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Daniel Mustieles 3861b9257b Replace obsolete FSF postal address in copyright notices (#721565)
This is part of parent bug:
    Bug #721455 - Obsolete info in license text on multiple modules

and GNOME Goal:
    https://wiki.gnome.org/Initiatives/GnomeGoals/Proposals

    * verify all source files to make sure they have a license and a
      copyright, and that both are up-to-date

Bug #721565 -  License text contains obsolete FSF postal address
2014-01-26 10:53:23 +00:00
Mike Fleetwood 2b51d87147 Make include guards unique (#539297)
Include guards need to be unique within GParted code and all included
library header files.
    http://en.wikipedia.org/wiki/Include_guard#Difficulties

Use this model for all include guards:
    #ifndef GPARTED_FILE_NAME_H
    #define GPARTED_FILE_NAME_H
    ...
    #endif /* GPARTED_FILE_NAME_H */

Closes Bug #539297 - Make include guards unique
2013-06-05 10:57:39 -06:00
Phillip Susi e4210ba08d Cleanup duplicate fs code
Many filesystems do not implement some of their methods, but had to provide
dummy implementations.  Remove all of the dummy implementations and instead
just provide one in the base FileSystem class.
2013-03-11 18:40:31 -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 619bda5d8b Enable LVM2 VG activation / deactivation (#670171)
In the Partition menu enable activation / deactivation of the LVM2
Volume Group of which the Physical Volume is a member.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood abd0dd0426 Report space usage of LVM2 PVs (#160787)
Add minimal support for just reporting the space usage of LVM2 PVs.
Accept libparted / blkid detection of LVM2 PVs first, falling back on
GParted's specific detection code otherwise.  Maintain LVM not supported
warning message.

Bug #160787 - lvm support
2012-02-02 10:17:29 -07:00