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

Jim Meyering meyering at alioth.debian.org
Sat Sep 29 10:38:30 UTC 2012


 NEWS                       |   19 ++++
 doc/parted.texi            |   16 +++
 include/parted/disk.in.h   |    5 -
 libparted/disk.c           |    2 
 libparted/labels/gpt.c     |   45 +++++++++
 tests/Makefile.am          |    2 
 tests/lvm-utils.sh         |  208 ---------------------------------------------
 tests/t-lib-helpers.sh     |    4 
 tests/t-local.sh           |    2 
 tests/t-lvm.sh             |   11 --
 tests/t0220-gpt-msftres.sh |    3 
 tests/t9030-align-check.sh |    3 
 12 files changed, 94 insertions(+), 226 deletions(-)

New commits:
commit c987c73cbe773dfa3b14b911ffc243137195bbb3
Author: Jim Meyering <meyering at redhat.com>
Date:   Sat Sep 29 12:10:35 2012 +0200

    tests: clean up tests
    
    Use warn_ and $ME_ in place of warn and $ME; remove definitions of
    the latter two.  Remove unused code.
    * tests/lvm-utils.sh: Remove file.  All functions were either unused
    or duplicated/better in t-lvm.sh.
    * tests/Makefile.am (EXTRA_DIST): Remove it.
    * tests/t-local.sh (scsi_debug_setup_): Use echo 1>&2, not warn_, to
    emit to log file only, not console.  The diagnostic it emitted (in
    verbose mode) was more "informational" than a warning.
    * tests/t9030-align-check.sh: Use warn_, not warn.
    * tests/t-lvm.sh: Likewise, and use fail_, not error (undefined!).
    * tests/t-lib-helpers.sh (device_mapper_required_): Use t-lvm.sh
    and an explicit lvm_init_root_dir_ in place of lvm-utils.sh.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 96abecb..80d5525 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -74,7 +74,7 @@ TESTS = \
   t9050-partition-table-types.sh
 
 EXTRA_DIST = \
-  $(TESTS) lvm-utils.sh t-local.sh t-lvm.sh \
+  $(TESTS) t-local.sh t-lvm.sh \
   init.cfg init.sh t-lib-helpers.sh gpt-header-munge
 
 check_PROGRAMS = print-align print-max dup-clobber duplicate fs-resize
diff --git a/tests/lvm-utils.sh b/tests/lvm-utils.sh
deleted file mode 100644
index 456d265..0000000
--- a/tests/lvm-utils.sh
+++ /dev/null
@@ -1,208 +0,0 @@
-# Put lvm-related utilities here.
-# This file is sourced from test infrastructure.
-
-# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions
-# of the GNU General Public License v.2.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-export LVM_SUPPRESS_FD_WARNINGS=1
-
-ME=$(basename "$0")
-warn() { echo >&2 "$ME: $@"; }
-
-unsafe_losetup_()
-{
-  f=$1
-
-  test -n "$G_dev_" \
-    || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_"
-
-  # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
-  for slash in '' /; do
-    for i in 0 1 2 3 4 5 6 7 8 9; do
-      dev=$G_dev_/loop$slash$i
-      losetup $dev > /dev/null 2>&1 && continue;
-      losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; }
-      break
-    done
-  done
-
-  return 1
-}
-
-loop_setup_()
-{
-  file=$1
-  dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
-    || { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
-
-  # NOTE: this requires a new enough version of losetup
-  dev=$(unsafe_losetup_ "$file") \
-    || { warn "loop_setup_ failed: Unable to create loopback device"; return 1; }
-
-  echo "$dev"
-  return 0;
-}
-
-compare_two_fields_()
-{
-    local cmd1=$1;
-    local obj1=$2;
-    local field1=$3;
-    local cmd2=$4;
-    local obj2=$5;
-    local field2=$6;
-    local val1;
-    local val2;
-
-    val1=$($cmd1 --noheadings -o $field1 $obj1)
-    val2=$($cmd2 --noheadings -o $field2 $obj2)
-if test "$verbose" = "t"
-then
-  echo "compare_two_fields_ $obj1($field1): $val1 $obj2($field2): $val2"
-fi
-  test $val1 = $val2
-}
-
-compare_vg_field_()
-{
-    local vg1=$1;
-    local vg2=$2;
-    local field=$3;
-    local val1;
-    local val2;
-
-    val1=$(vgs --noheadings -o $field $vg1)
-    val2=$(vgs --noheadings -o $field $vg2)
-if test "$verbose" = "t"
-then
-  echo "compare_vg_field_ VG1: $val1 VG2: $val2"
-fi
-  test $val1 = $val2
-}
-
-check_vg_field_()
-{
-    local vg=$1;
-    local field=$2;
-    local expected=$3;
-    local actual;
-
-    actual=$(vgs --noheadings -o $field $vg)
-if test "$verbose" = "t"
-then
-  echo "check_vg_field_ VG=$vg, field=$field, actual=$actual, expected=$expected"
-fi
-  test $actual = $expected
-}
-
-check_pv_field_()
-{
-    local pv=$1;
-    local field=$2;
-    local expected=$3;
-    local actual;
-
-    actual=$(pvs --noheadings -o $field $pv)
-if test "$verbose" = "t"
-then
-  echo "check_pv_field_ PV=$pv, field=$field, actual=$actual, expected=$expected"
-fi
-    test $actual = $expected
-}
-
-check_lv_field_()
-{
-    local lv=$1;
-    local field=$2;
-    local expected=$3;
-    local actual;
-
-    actual=$(lvs --noheadings -o $field $lv)
-if test "$verbose" = "t"
-then
-  echo "check_lv_field_ LV=$lv, field=$field, actual=$actual, expected=$expected"
-fi
-  test $actual = $expected
-}
-
-vg_validate_pvlv_counts_()
-{
-	local local_vg=$1
-	local num_pvs=$2
-	local num_lvs=$3
-	local num_snaps=$4
-
-	check_vg_field_ $local_vg pv_count $num_pvs &&
-	check_vg_field_ $local_vg lv_count $num_lvs &&
-	check_vg_field_ $local_vg snap_count $num_snaps
-}
-
-dmsetup_has_dm_devdir_support_()
-{
-  # Detect support for the envvar.  If it's supported, the
-  # following command will fail with the expected diagnostic.
-  out=$(DM_DEV_DIR=j dmsetup version 2>&1)
-  test "$?:$out" = "1:Invalid DM_DEV_DIR envvar value." ||
-  test "$?:$out" = "1:Invalid DM_DEV_DIR environment variable value."
-}
-
-# set up private /dev and /etc
-init_root_dir_()
-{
-  test -n "$test_dir_" \
-    || fail_ "Internal error: called init_root_dir_ before" \
-      "defining \$test_dir_"
-
-  # Define these two globals.
-  G_root_=$test_dir_/root
-  G_dev_=$G_root_/dev
-
-  export LVM_SYSTEM_DIR=$G_root_/etc
-  export DM_DEV_DIR=$G_dev_
-
-  # Only the first caller does anything.
-  mkdir -p $G_root_/etc $G_dev_ $G_dev_/mapper $G_root_/lib
-  for i in 0 1 2 3 4 5 6 7; do
-    mknod $G_root_/dev/loop$i b 7 $i
-  done
-  for i in $abs_top_builddir/dmeventd/mirror/*.so $abs_top_builddir/dmeventd/snapshot/*.so
-  do
-    # NOTE: This check is necessary because the loop above will give us the value
-    # "$abs_top_builddir/dmeventd/mirror/*.so" if no files ending in 'so' exist.
-    # This is the best way I could quickly determine to skip over this bogus value.
-    if [ -f $i ]; then
-      echo Setting up symlink from $i to $G_root_/lib
-      ln -s $i $G_root_/lib
-    fi
-  done
-  cat > $G_root_/etc/lvm.conf <<-EOF
-  devices {
-    dir = "$G_dev_"
-    scan = "$G_dev_"
-    filter = [ "a/loop/", "a/mirror/", "a/mapper/", "r/.*/" ]
-    cache_dir = "$G_root_/etc"
-    sysfs_scan = 0
-  }
-  log {
-    verbose = $verboselevel
-    syslog = 0
-    indent = 1
-  }
-  backup {
-    backup = 0
-    archive = 0
-  }
-  global {
-    library_dir = "$G_root_/lib"
-  }
-EOF
-}
-
-init_root_dir_
diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
index 4b3c122..6721003 100644
--- a/tests/t-lib-helpers.sh
+++ b/tests/t-lib-helpers.sh
@@ -395,6 +395,6 @@ wait_for_dev_to_disappear_()
 
 device_mapper_required_()
 {
-  . "$abs_top_srcdir/tests/lvm-utils.sh" \
-       || fail_ "device mapper setup failed"
+  . "$abs_top_srcdir/tests/t-lvm.sh"
+  lvm_init_root_dir_ || fail_ "device mapper setup failed"
 }
diff --git a/tests/t-local.sh b/tests/t-local.sh
index dde1b8d..b40a5a0 100644
--- a/tests/t-local.sh
+++ b/tests/t-local.sh
@@ -100,7 +100,7 @@ scsi_debug_setup_()
   modprobe scsi_debug "$@" || { rm -f stamp; return 1; }
   scsi_debug_modprobe_succeeded_=1
   test "$VERBOSE" = yes \
-    && warn_ $ME_ modprobe scsi_debug succeeded
+    && echo $ME_ modprobe scsi_debug succeeded 1>&2
 
   # Wait up to 2s (via .1s increments) for the list of devices to change.
   # Sleeping for a fraction of a second requires GNU sleep, so fall
diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh
index b08f934..9cee155 100644
--- a/tests/t-lvm.sh
+++ b/tests/t-lvm.sh
@@ -1,7 +1,7 @@
 # Put lvm-related utilities here.
 # This file is sourced from test infrastructure.
 
-# Copyright (C) 2007, 2008, 2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007-2012 Red Hat, Inc. All rights reserved.
 #
 # This copyrighted material is made available to anyone wishing to use,
 # modify, copy, or redistribute it subject to the terms and conditions
@@ -13,15 +13,12 @@
 
 export LVM_SUPPRESS_FD_WARNINGS=1
 
-ME=$(basename "$0")
-warn() { echo >&2 "$ME: $@"; }
-
 unsafe_losetup_()
 {
   f=$1
 
   test -n "$G_dev_" \
-    || error "Internal error: unsafe_losetup_ called before init_root_dir_"
+    || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_"
 
   # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9}
   for slash in '' /; do
@@ -40,11 +37,11 @@ loop_setup_()
 {
   file=$1
   dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \
-    || { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
+    || { warn_ "loop_setup_ failed: Unable to create tmp file $file"; return 1; }
 
   # NOTE: this requires a new enough version of losetup
   dev=$(unsafe_losetup_ "$file" 2>/dev/null) \
-    || { warn "loop_setup_ failed: Unable to create loopback device"; return 1; }
+    || { warn_ "loop_setup_ failed: Unable to create loopback device"; return 1; }
 
   echo "$dev"
   return 0;
diff --git a/tests/t9030-align-check.sh b/tests/t9030-align-check.sh
index b3618a7..f0830f0 100644
--- a/tests/t9030-align-check.sh
+++ b/tests/t9030-align-check.sh
@@ -49,7 +49,8 @@ while :; do
   test $i = 70 && break
 
   # Wait up to 10s for the partition file to disappear.
-  wait_for_dev_to_disappear_ $p1 10 || { fail=1; warn $p1 failed to disappear; }
+  wait_for_dev_to_disappear_ $p1 10 \
+    || { fail=1; warn_ $ME_ $p1 failed to disappear; }
 done
 
 Exit $fail

commit e6536360bd4496cee1f1bf2dfb0b11f6bdbbfd4b
Author: Roderick W. Smith <rodsmith at rodsbooks.com>
Date:   Sun Sep 23 21:29:10 2012 +0200

    add support for a new Linux-specific GPT partition type code
    
    * NEWS: Describe the new Linux-specific partition type code
    and the new msftres flag that can be used to override this type
    code, should it be necessary.
    * doc/parted.texi: Describe of the new msftres flag.
    * include/parted/disk.in.h [_PedPartitionFlag]: Add
    PED_PARTITION_MSFT_DATA.
    * libparted/disk.c: Add check for PED_PARTITION_MSFT_DATA, with
    return of "msftdata", to ped_partition_flag_get_name()
    * libparted/labels/gpt.c (PARTITION_LINUX_DATA_GUID): Define.
    [_GPTPartitionData]: New member, "int msftdata".
    (_parse_part_entry): Set the msftdata flag if and only if the
    PARTITION_BASIC_DATA_GUID type code is in use;
    (gpt_partition_new): Use the PARTITION_LINUX_DATA_GUID
    type as the default type code
    (gpt_partition_set_system): Set the PARTITION_BASIC_DATA_GUID type
    code on partitions on which the msftdata flag is set and set
    PARTITION_LINUX_DATA_GUID as the type by default.
    Clear the msftdata flag in most tests in gpt_partition_set_flag()
    (gpt_partition_set_flag): Add test for PED_PARTITION_MSFT_DATA, which
    sets msftdata and other flags appropriately
    (gpt_partition_get_flag): Add test for the PED_PARTITION_MSFT_DATA
    item that returns the status of the msftdata flag
    (gpt_partition_is_flag_available): Add test for
    PED_PARTITION_MSFT_DATA item to
    * tests/t0220-gpt-msftres.sh: Accommodate the fact that now,
    partition table listings include "msftdata" for file systems
    of type NTFS and FAT*.
    For more discussion and justification, see
    http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10456

diff --git a/NEWS b/NEWS
index bab3afb..4c4716d 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,25 @@ GNU parted NEWS                                    -*- outline -*-
   libparted: treat a disk with no pMBR as an msdos-labeled disk
   even when it has valid GPT headers.
 
+** Changes in behavior
+
+  Added new Linux-specific partition GUID type code
+  (0FC63DAF-8483-4772-8E79-3D69D8477DE4) for Linux filesystem data on GPT
+  disks.  This type code is now assigned as the default partition type code
+  for new partitions holding Linux filesystems.
+
+  Added new "msftdata" flag to identify partitions holding NTFS or FAT
+  filesystems on GPT disks.  This flag corresponds to a GPT type code of
+  EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 ("Microsoft Basic Data").  Since
+  Linux filesystem partitions formerly used this type code, this flag may
+  optionally be set on Linux partitions to make the partition table type
+  codes match former configurations in case the new Linux filesystem type
+  code causes problems with some utility.  Note that this flag cannot be
+  removed from NTFS or FAT partitions within parted except by setting a
+  competing flag, such as "boot" (which sets the type code used by EFI
+  System partitions) or "msftres" (which sets the "Microsoft Reserved" type
+  code).
+
 
 * Noteworthy changes in release 3.1 (2012-03-02) [stable]
 
diff --git a/doc/parted.texi b/doc/parted.texi
index 1601151..b8db19d 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -793,6 +793,20 @@ on a partition that partition must be bootable.
 For PC98 disk labels, all ext2 partitions must be bootable (this is
 enforced by Parted).
 
+ at item msftdata
+(GPT) - This flag identifies partitions that contain Microsoft filesystems
+(NTFS or FAT).  It may optionally be set on Linux filesystems to mimic the
+type of configuration created by parted 3.0 and earlier, in which a
+separate Linux filesystem type code was not available on GPT disks.  This
+flag can only be removed within parted by replacing it with a competing
+flag, such as boot or msftres.
+
+ at item msftres
+(GPT) - This flag identifies a "Microsoft Reserved" partition, which is
+used by Windows on GPT disks.  Note that this flag should not normally be
+set on Windows filesystem partitions (those that contain NTFS or FAT
+filesystems).
+
 @item lba
 (MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
 MS Windows ME based operating systems to use Linear (LBA) mode.
@@ -907,7 +921,7 @@ which case this unit apply instead of the default unit for this
 particular number, but CHS and cylinder units are not supported as
 a suffix.  If no suffix is given, then the default unit is assumed.
 Parted will compute sensible ranges for the locations you specify
-(e.g. a range of +/- 500 MB when you specify the location in ``G'',
+(e.g., a range of +/- 500 MB when you specify the location in ``G'',
 and a range of +/- 500 KB when you specify the location in ``M'')
 and will select the nearest location in this range from the one you
 wrote that satisfies constraints from both the operation, the
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index 9734edd..a34e11e 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -72,10 +72,11 @@ enum _PedPartitionFlag {
         PED_PARTITION_BIOS_GRUB=12,
         PED_PARTITION_APPLE_TV_RECOVERY=13,
         PED_PARTITION_DIAG=14,
-        PED_PARTITION_LEGACY_BOOT=15
+        PED_PARTITION_LEGACY_BOOT=15,
+        PED_PARTITION_MSFT_DATA=16
 };
 #define PED_PARTITION_FIRST_FLAG        PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG         PED_PARTITION_LEGACY_BOOT
+#define PED_PARTITION_LAST_FLAG         PED_PARTITION_MSFT_DATA
 
 enum _PedDiskTypeFeature {
         PED_DISK_TYPE_EXTENDED=1,       /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index f9b5fd2..c4b1a01 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2433,6 +2433,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
 		return N_("prep");
 	case PED_PARTITION_MSFT_RESERVED:
 		return N_("msftres");
+	case PED_PARTITION_MSFT_DATA:
+		return N_("msftdata");
         case PED_PARTITION_APPLE_TV_RECOVERY:
                 return N_("atvrecv");
         case PED_PARTITION_DIAG:
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 63b30b9..490de70 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -122,6 +122,10 @@ typedef struct
     ((efi_guid_t) { PED_CPU_TO_LE32 (0x0657fd6d), PED_CPU_TO_LE16 (0xa4ab), \
                     PED_CPU_TO_LE16 (0x43c4), 0x84, 0xe5, \
                     { 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f }})
+#define PARTITION_LINUX_DATA_GUID \
+    ((efi_guid_t) { PED_CPU_TO_LE32 (0x0FC63DAF), PED_CPU_TO_LE16 (0x8483), \
+                    PED_CPU_TO_LE16 (0x4772), 0x8E, 0x79, \
+                    { 0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4 }})
 #define PARTITION_LVM_GUID \
     ((efi_guid_t) { PED_CPU_TO_LE32 (0xe6d6d379), PED_CPU_TO_LE16 (0xf507), \
                     PED_CPU_TO_LE16 (0x44c2), 0xa2, 0x3c, \
@@ -280,6 +284,7 @@ typedef struct _GPTPartitionData
   int hp_service;
   int hidden;
   int msftres;
+  int msftdata;
   int atvrecv;
   int msftrecv;
   int legacy_boot;
@@ -788,6 +793,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
   gpt_part_data->lvm = gpt_part_data->raid
     = gpt_part_data->boot = gpt_part_data->hp_service
     = gpt_part_data->hidden = gpt_part_data->msftres
+    = gpt_part_data->msftdata
     = gpt_part_data->msftrecv
     = gpt_part_data->legacy_boot
     = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
@@ -809,6 +815,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
     gpt_part_data->hp_service = 1;
   else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
     gpt_part_data->msftres = 1;
+  else if (!guid_cmp (gpt_part_data->type, PARTITION_BASIC_DATA_GUID))
+    gpt_part_data->msftdata = 1;
   else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RECOVERY))
     gpt_part_data->msftrecv = 1;
   else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID))
@@ -1318,7 +1326,7 @@ gpt_partition_new (const PedDisk *disk,
   if (!gpt_part_data)
     goto error_free_part;
 
-  gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
+  gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
   gpt_part_data->lvm = 0;
   gpt_part_data->raid = 0;
   gpt_part_data->boot = 0;
@@ -1326,6 +1334,7 @@ gpt_partition_new (const PedDisk *disk,
   gpt_part_data->hp_service = 0;
   gpt_part_data->hidden = 0;
   gpt_part_data->msftres = 0;
+  gpt_part_data->msftdata = 0;
   gpt_part_data->msftrecv = 0;
   gpt_part_data->atvrecv = 0;
   gpt_part_data->legacy_boot = 0;
@@ -1422,6 +1431,11 @@ gpt_partition_set_system (PedPartition *part,
       gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
       return 1;
     }
+  if (gpt_part_data->msftdata)
+    {
+      gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
+      return 1;
+    }
   if (gpt_part_data->msftrecv)
     {
       gpt_part_data->type = PARTITION_MSFT_RECOVERY;
@@ -1453,7 +1467,7 @@ gpt_partition_set_system (PedPartition *part,
         }
     }
 
-  gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
+  gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
   return 1;
 }
 
@@ -1571,6 +1585,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->bios_grub
           = gpt_part_data->hp_service
           = gpt_part_data->msftres
+          = gpt_part_data->msftdata
           = gpt_part_data->msftrecv
           = gpt_part_data->atvrecv = 0;
       return gpt_partition_set_system (part, part->fs_type);
@@ -1582,6 +1597,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->boot
           = gpt_part_data->hp_service
           = gpt_part_data->msftres
+          = gpt_part_data->msftdata
           = gpt_part_data->msftrecv
           = gpt_part_data->atvrecv = 0;
       return gpt_partition_set_system (part, part->fs_type);
@@ -1593,6 +1609,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->bios_grub
           = gpt_part_data->hp_service
           = gpt_part_data->msftres
+          = gpt_part_data->msftdata
           = gpt_part_data->msftrecv
           = gpt_part_data->atvrecv = 0;
       return gpt_partition_set_system (part, part->fs_type);
@@ -1604,6 +1621,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->bios_grub
           = gpt_part_data->hp_service
           = gpt_part_data->msftres
+          = gpt_part_data->msftdata
           = gpt_part_data->msftrecv
           = gpt_part_data->atvrecv = 0;
       return gpt_partition_set_system (part, part->fs_type);
@@ -1615,6 +1633,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->lvm
           = gpt_part_data->bios_grub
           = gpt_part_data->msftres
+          = gpt_part_data->msftdata
           = gpt_part_data->msftrecv
           = gpt_part_data->atvrecv = 0;
       return gpt_partition_set_system (part, part->fs_type);
@@ -1626,8 +1645,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->lvm
           = gpt_part_data->bios_grub
           = gpt_part_data->hp_service
+          = gpt_part_data->msftdata
+          = gpt_part_data->msftrecv
+          = gpt_part_data->atvrecv = 0;
+      return gpt_partition_set_system (part, part->fs_type);
+    case PED_PARTITION_MSFT_DATA:
+      gpt_part_data->msftres = state;
+      if (state) {
+        gpt_part_data->boot
+          = gpt_part_data->raid
+          = gpt_part_data->lvm
+          = gpt_part_data->bios_grub
+          = gpt_part_data->hp_service
+          = gpt_part_data->msftres
           = gpt_part_data->msftrecv
           = gpt_part_data->atvrecv = 0;
+        gpt_part_data->msftdata = 1;
+      } else {
+        gpt_part_data->msftdata = 0;
+      }
       return gpt_partition_set_system (part, part->fs_type);
     case PED_PARTITION_DIAG:
       gpt_part_data->msftrecv = state;
@@ -1637,6 +1673,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->lvm
           = gpt_part_data->bios_grub
           = gpt_part_data->hp_service
+          = gpt_part_data->msftdata
           = gpt_part_data->msftres
           = gpt_part_data->atvrecv = 0;
       return gpt_partition_set_system (part, part->fs_type);
@@ -1649,6 +1686,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
           = gpt_part_data->bios_grub
           = gpt_part_data->hp_service
           = gpt_part_data->msftres
+          = gpt_part_data->msftdata
           = gpt_part_data->msftrecv = 0;
       return gpt_partition_set_system (part, part->fs_type);
     case PED_PARTITION_HIDDEN:
@@ -1687,6 +1725,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
       return gpt_part_data->hp_service;
     case PED_PARTITION_MSFT_RESERVED:
       return gpt_part_data->msftres;
+    case PED_PARTITION_MSFT_DATA:
+      return gpt_part_data->msftdata;
     case PED_PARTITION_DIAG:
       return gpt_part_data->msftrecv;
     case PED_PARTITION_APPLE_TV_RECOVERY:
@@ -1716,6 +1756,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
     case PED_PARTITION_BIOS_GRUB:
     case PED_PARTITION_HPSERVICE:
     case PED_PARTITION_MSFT_RESERVED:
+    case PED_PARTITION_MSFT_DATA:
     case PED_PARTITION_DIAG:
     case PED_PARTITION_APPLE_TV_RECOVERY:
     case PED_PARTITION_HIDDEN:
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
index d522aec..bd14c84 100755
--- a/tests/t0220-gpt-msftres.sh
+++ b/tests/t0220-gpt-msftres.sh
@@ -56,7 +56,8 @@ printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt::;\n" > exp
 i=1
 for type in $fs_types; do
   end=$(expr $start + $part_size - 1)
-  echo "$i:${start}s:${end}s:${part_size}s::$type:;" >> exp || fail=1
+  case $type in fat*|NTFS) flag=msftdata;; *) flag=;; esac
+  echo "$i:${start}s:${end}s:${part_size}s::$type:$flag;" >> exp || fail=1
   parted -s $dev mkpart p-name $type ${start}s ${end}s > err 2>&1 || fail=1
   compare /dev/null err || fail=1
   parted -s $dev name $i $type > err 2>&1 || fail=1



More information about the Parted-commits mailing list