[gparted] Add support for minix file system (!12)



commit 03e89b1289e67c5dd5c91b77f06661103d1b0da5
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Aug 19 13:08:55 2018 +0100

    Add support for minix file system (!12)
    
    Util-linux package, at least as far back as version 2.23.2 as found on
    CentOS 7, provides the mkfs.minix and fsck.minix commands.  Also blkid
    from the same package, recognises minix file systems.
    
    Create version 3 file systems because MINIX 3 [1] is the only supported
    version and that reportedly uses version 3 of the file system [2].
    
    [1] MINIX 3 / History
        https://en.wikipedia.org/wiki/MINIX_3#History
    
    [2] Regarding MINIX 3 file system
        https://groups.google.com/forum/#!topic/minix3/3-TeHR_23X8
    
        "MINIX 3 uses Minix File System (MFS).  More precisely MFS V3."
    
    Closes !12 - Add minix file system support

 README                 |  1 +
 gparted.appdata.xml.in |  4 ++--
 include/Makefile.am    |  1 +
 include/Utils.h        | 33 ++++++++++++++--------------
 include/minix.h        | 38 +++++++++++++++++++++++++++++++++
 po/POTFILES.in         |  1 +
 src/GParted_Core.cc    |  4 ++++
 src/Makefile.am        |  1 +
 src/Utils.cc           |  5 +++++
 src/minix.cc           | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 128 insertions(+), 18 deletions(-)
---
diff --git a/README b/README
index d3f2c91f..4a3abcd9 100644
--- a/README
+++ b/README
@@ -276,6 +276,7 @@ provide this support:
    reiser4progs
    reiserfsprogs / reiserfs-utils / reiserfs
    udftools
+   util-linux      - required to create and check MINIX file systems
    xfsprogs, xfsdump
 
 
diff --git a/gparted.appdata.xml.in b/gparted.appdata.xml.in
index 26fbfb51..aeab647e 100644
--- a/gparted.appdata.xml.in
+++ b/gparted.appdata.xml.in
@@ -16,8 +16,8 @@
     </_p>
     <_p>
     GParted works with many file systems including: btrfs, ext2, ext3,
-    ext4, fat16, fat32, hfs, hfs+, linux-swap, lvm2 pv, nilfs2, ntfs,
-    reiserfs, reiser4, udf, ufs, and xfs.
+    ext4, fat16, fat32, hfs, hfs+, linux-swap, lvm2 pv, minix, nilfs2,
+    ntfs, reiserfs, reiser4, udf, ufs, and xfs.
     </_p>
   </description>
   <url type="homepage">https://gparted.org</url>
diff --git a/include/Makefile.am b/include/Makefile.am
index c46cd665..5b21f084 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -62,6 +62,7 @@ EXTRA_DIST = \
        linux_swap.h                    \
        lvm2_pv.h                       \
        luks.h                          \
+       minix.h                         \
        nilfs2.h                        \
        ntfs.h                          \
        reiser4.h                       \
diff --git a/include/Utils.h b/include/Utils.h
index f1486598..e606ecae 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -81,26 +81,27 @@ enum FSType
        FS_LINUX_SWAP      = 16,
        FS_LUKS            = 17,
        FS_LVM2_PV         = 18,
-       FS_NILFS2          = 19,
-       FS_NTFS            = 20,
-       FS_REISER4         = 21,
-       FS_REISERFS        = 22,
-       FS_UDF             = 23,
-       FS_UFS             = 24,
-       FS_XFS             = 25,
+       FS_MINIX           = 19,
+       FS_NILFS2          = 20,
+       FS_NTFS            = 21,
+       FS_REISER4         = 22,
+       FS_REISERFS        = 23,
+       FS_UDF             = 24,
+       FS_UFS             = 25,
+       FS_XFS             = 26,
 
        // Recognised signatures but otherwise unsupported file system types
-       FS_BITLOCKER       = 26,
-       FS_GRUB2_CORE_IMG  = 27,
-       FS_ISO9660         = 28,
-       FS_LINUX_SWRAID    = 29,
-       FS_LINUX_SWSUSPEND = 30,
-       FS_REFS            = 31,
-       FS_ZFS             = 32,
+       FS_BITLOCKER       = 27,
+       FS_GRUB2_CORE_IMG  = 28,
+       FS_ISO9660         = 29,
+       FS_LINUX_SWRAID    = 30,
+       FS_LINUX_SWSUSPEND = 31,
+       FS_REFS            = 32,
+       FS_ZFS             = 33,
 
        // Partition space usage colours
-       FS_USED            = 33,
-       FS_UNUSED          = 34
+       FS_USED            = 34,
+       FS_UNUSED          = 35
 } ;
 
 enum SIZE_UNIT
diff --git a/include/minix.h b/include/minix.h
new file mode 100644
index 00000000..64aefd08
--- /dev/null
+++ b/include/minix.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 2018 Mike Fleetwood
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef GPARTED_MINIX_H
+#define GPARTED_MINIX_H
+
+#include "FileSystem.h"
+#include "OperationDetail.h"
+#include "Partition.h"
+
+namespace GParted
+{
+
+class minix : public FileSystem
+{
+public:
+       FS get_filesystem_support();
+       bool create( const Partition & new_partition, OperationDetail & operationdetail );
+       bool check_repair( const Partition & partition, OperationDetail & operationdetail );
+};
+
+} //GParted
+
+#endif /* GPARTED_MINIX_H */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f9e9e297..154edc2e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -57,6 +57,7 @@ src/linux_swap.cc
 src/lvm2_pv.cc
 src/luks.cc
 src/main.cc
+src/minix.cc
 src/ntfs.cc
 src/nilfs2.cc
 src/reiser4.cc
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index de69f0e8..903d59ae 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -43,6 +43,7 @@
 #include "lvm2_pv.h"
 #include "luks.h"
 #include "reiserfs.h"
+#include "minix.h"
 #include "nilfs2.h"
 #include "ntfs.h"
 #include "xfs.h"
@@ -1445,6 +1446,8 @@ FSType GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition * lp
                        return GParted::FS_FAT16 ;
                else if ( fsname == "fat32" )
                        return GParted::FS_FAT32 ;
+               else if ( fsname == "minix" )
+                       return FS_MINIX;
                else if ( fsname == "nilfs2" )
                        return GParted::FS_NILFS2 ;
                else if ( fsname == "ntfs" )
@@ -4152,6 +4155,7 @@ void GParted_Core::init_filesystems()
        FILESYSTEM_MAP[FS_LINUX_SWAP]      = new linux_swap();
        FILESYSTEM_MAP[FS_LVM2_PV]         = new lvm2_pv();
        FILESYSTEM_MAP[FS_LUKS]            = new luks();
+       FILESYSTEM_MAP[FS_MINIX]           = new minix();
        FILESYSTEM_MAP[FS_NILFS2]          = new nilfs2();
        FILESYSTEM_MAP[FS_NTFS]            = new ntfs();
        FILESYSTEM_MAP[FS_REISER4]         = new reiser4();
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b1fd2c0..a886bde8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,6 +72,7 @@ gpartedbin_SOURCES = \
        lvm2_pv.cc                      \
        luks.cc                         \
        main.cc                         \
+       minix.cc                        \
        nilfs2.cc                       \
        ntfs.cc                         \
        reiser4.cc                      \
diff --git a/src/Utils.cc b/src/Utils.cc
index 05fa9d13..c95255ae 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -114,6 +114,7 @@ Glib::ustring Utils::get_color( FSType filesystem )
                case FS_USED            : return "#F8F8BA" ;    // ~ light tan yellow
                case FS_UNUSED          : return "#FFFFFF" ;    //white
                case FS_LVM2_PV         : return "#B39169" ;    //face skin dark
+               case FS_MINIX           : return "#9DB8D2" ;    // Blue Highlight
                case FS_BITLOCKER       : return "#494066" ;    //purple shadow
                case FS_GRUB2_CORE_IMG  : return "#666666" ;    //~ dark gray
                case FS_ISO9660         : return "#D3D3D3" ;    // ~ light gray
@@ -227,6 +228,7 @@ int Utils::get_filesystem_label_maxlength( FSType filesystem )
                case FS_JFS             : return 11 ;
                case FS_LINUX_SWAP      : return 15 ;
                //case FS_LVM2_PV       : return  ;
+               case FS_MINIX           : return 0;  // MINIX doesn't support labelling.
                case FS_NILFS2          : return 80 ;
                case FS_NTFS            : return 128 ;
                case FS_REISER4         : return 16 ;
@@ -294,6 +296,7 @@ Glib::ustring Utils::get_filesystem_string( FSType filesystem )
                case FS_USED            : return _("used") ;
                case FS_UNUSED          : return _("unused") ;
                case FS_LVM2_PV         : return "lvm2 pv" ;
+               case FS_MINIX           : return "minix";
                case FS_BITLOCKER       : return "bitlocker" ;
                case FS_GRUB2_CORE_IMG  : return "grub2 core.img";
                case FS_ISO9660         : return "iso9660";
@@ -337,6 +340,7 @@ const Glib::ustring Utils::get_filesystem_kernel_name( FSType fstype )
                case FS_HFS      : return "hfs";
                case FS_HFSPLUS  : return "hfsplus";
                case FS_JFS      : return "jfs";
+               case FS_MINIX    : return "minix";
                case FS_NILFS2   : return "nilfs2";
                case FS_NTFS     : return "ntfs";
                case FS_REISER4  : return "reiser4";
@@ -365,6 +369,7 @@ Glib::ustring Utils::get_filesystem_software( FSType filesystem )
                case FS_LINUX_SWAP  : return "util-linux" ;
                case FS_LVM2_PV     : return "lvm2" ;
                case FS_LUKS        : return "cryptsetup, dmsetup";
+               case FS_MINIX       : return "util-linux";
                case FS_NILFS2      : return "nilfs-utils" ;
                case FS_NTFS        : return "ntfs-3g / ntfsprogs" ;
                case FS_REISER4     : return "reiser4progs" ;
diff --git a/src/minix.cc b/src/minix.cc
new file mode 100644
index 00000000..78df5af4
--- /dev/null
+++ b/src/minix.cc
@@ -0,0 +1,58 @@
+/* Copyright (C) 2018 Mike Fleetwood
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "FileSystem.h"
+#include "OperationDetail.h"
+#include "Partition.h"
+#include "Utils.h"
+#include "minix.h"
+
+#include <glibmm.h>
+
+namespace GParted
+{
+
+FS minix::get_filesystem_support()
+{
+       FS fs( FS_MINIX );
+
+       fs.busy = FS::GPARTED;
+       fs.move = FS::GPARTED;
+       fs.copy = FS::GPARTED;
+       fs.online_read = FS::GPARTED;
+
+       if ( ! Glib::find_program_in_path( "mkfs.minix").empty() )
+               fs.create = FS::EXTERNAL;
+
+       if ( ! Glib::find_program_in_path( "fsck.minix").empty() )
+               fs.check = FS::EXTERNAL;
+
+       return fs;
+}
+
+bool minix::create( const Partition & new_partition, OperationDetail & operationdetail )
+{
+       return ! execute_command( "mkfs.minix -3 " + Glib::shell_quote( new_partition.get_path() ),
+                                 operationdetail, EXEC_CHECK_STATUS );
+}
+
+bool minix::check_repair( const Partition & partition, OperationDetail & operationdetail )
+{
+       return ! execute_command( "fsck.minix " + Glib::shell_quote( partition.get_path() ),
+                                 operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
+}
+
+} //GParted


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]