[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Tue Apr 13 18:27:46 UTC 2010


 NEWS                          |    3 +++
 include/parted/device.h       |    2 +-
 libparted/device.c            |    2 +-
 libparted/fs/ext2/ext2_fs.h   |    2 ++
 libparted/fs/ext2/interface.c |    6 +++++-
 tests/t1700-ext-probe.sh      |   14 ++++++++++++++
 6 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 476db29336c42867fcf200a2a9860a76fb6cf1c5
Author: Colin Watson <cjwatson at ubuntu.com>
Date:   Mon Apr 12 10:16:21 2010 +0100

    maint: constify ped_device_get_constraint interface
    
    * include/parted/device.h (ped_device_get_constraint): Constify "dev"
    parameter.
    * libparted/device.c (ped_device_get_constraint): Likewise.

diff --git a/include/parted/device.h b/include/parted/device.h
index 764c246..bfeafed 100644
--- a/include/parted/device.h
+++ b/include/parted/device.h
@@ -145,7 +145,7 @@ extern int ped_device_sync (PedDevice* dev);
 extern int ped_device_sync_fast (PedDevice* dev);
 extern PedSector ped_device_check (PedDevice* dev, void* buffer,
                                    PedSector start, PedSector count);
-extern PedConstraint* ped_device_get_constraint (PedDevice* dev);
+extern PedConstraint* ped_device_get_constraint (const PedDevice* dev);
 
 extern PedConstraint *ped_device_get_minimal_aligned_constraint(
                                                          const PedDevice *dev);
diff --git a/libparted/device.c b/libparted/device.c
index 64da978..f20121b 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -403,7 +403,7 @@ ped_device_sync_fast (PedDevice* dev)
  *         constraint.
  */
 PedConstraint*
-ped_device_get_constraint (PedDevice* dev)
+ped_device_get_constraint (const PedDevice* dev)
 {
         PedGeometry *s, *e;
         PedConstraint* c = ped_constraint_new (

commit cbf873fbe9210dff208e366c5b620cb1625937d4
Author: Colin Watson <cjwatson at ubuntu.com>
Date:   Tue Apr 13 00:11:13 2010 +0100

    libparted: uninit_bg and flex_bg features should indicate ext4
    
    According to tune2fs(8), the uninit_bg and flex_bg features are only
    supported by ext4, so libparted should treat their presence as
    indicating ext4.  Reported by C de-Avillez in
    https://bugs.launchpad.net/ubuntu/+source/parted/+bug/561599.
    
    * libparted/fs/ext2/ext2_fs.h: Define EXT4_FEATURE_RO_COMPAT_GDT_CSUM
    and EXT4_FEATURE_INCOMPAT_FLEX_BG.
    * libparted/fs/ext2/interface.c (_ext2_generic_probe): Test for
    EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG when
    probing for ext4.
    * tests/t1700-ext-probe.sh: Test for this.
    * NEWS (Bug fixes): Mention this.

diff --git a/NEWS b/NEWS
index 2471b8b..8e678db 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@ GNU parted NEWS                                    -*- outline -*-
   Similarly, msdos_partition_get_flag(p,PED_PARTITION_HIDDEN) always returns 0
   for an extended partition.
 
+  libparted uses a more accurate heuristic to distinguish between
+  ext4 and ext3 partitions.
+
 ** Changes in behavior
 
   libparted no longer issues an exception/warning about >512-byte
diff --git a/libparted/fs/ext2/ext2_fs.h b/libparted/fs/ext2/ext2_fs.h
index 11bb6d7..f9ecd85 100644
--- a/libparted/fs/ext2/ext2_fs.h
+++ b/libparted/fs/ext2/ext2_fs.h
@@ -57,12 +57,14 @@
 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER	0x0001
 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE	0x0002
 #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE	0x0008
+#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM		0x0010
 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK	0x0020
 
 #define EXT2_FEATURE_INCOMPAT_FILETYPE		0x0002
 #define EXT3_FEATURE_INCOMPAT_RECOVER		0x0004
 #define EXT4_FEATURE_INCOMPAT_EXTENTS		0x0040
 #define EXT4_FEATURE_INCOMPAT_64BIT		0x0080
+#define EXT4_FEATURE_INCOMPAT_FLEX_BG		0x0200
 
 /*
  * Special inodes numbers
diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c
index df771a9..95ef759 100644
--- a/libparted/fs/ext2/interface.c
+++ b/libparted/fs/ext2/interface.c
@@ -55,11 +55,15 @@ _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver)
 			is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
 				    & EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
 				   || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
+				       & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
+				   || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
 				       & EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
 				   || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
 				       & EXT4_FEATURE_INCOMPAT_EXTENTS)
 				   || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
-				       & EXT4_FEATURE_INCOMPAT_64BIT));
+				       & EXT4_FEATURE_INCOMPAT_64BIT)
+				   || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
+				       & EXT4_FEATURE_INCOMPAT_FLEX_BG));
 			if (is_ext4)
 				is_ext3 = 0;
 		}
diff --git a/tests/t1700-ext-probe.sh b/tests/t1700-ext-probe.sh
index 4b3a5a4..62ca8e5 100755
--- a/tests/t1700-ext-probe.sh
+++ b/tests/t1700-ext-probe.sh
@@ -45,4 +45,18 @@ for type in ext2 ext3 ext4; do
 
 done
 
+# Some features should indicate ext4 by themselves.
+for feature in uninit_bg flex_bg; do
+  # create an ext3 file system
+  dd if=/dev/zero of=$dev bs=1024 count=4096 >/dev/null || fail=1
+  mkfs.ext3 -F $dev >/dev/null || fail=1
+
+  # set the feature
+  tune2fs -O $feature $dev || fail=1
+
+  # probe the file system, which should now be ext4
+  parted -m -s $dev u s print >out 2>&1 || fail=1
+  grep '^1:.*:ext4::;$' out || fail=1
+done
+
 Exit $fail



More information about the Parted-commits mailing list