Compare commits
No commits in common. "c8s" and "c9s" have entirely different histories.
24
.gitignore
vendored
24
.gitignore
vendored
@ -1,5 +1,23 @@
|
|||||||
SOURCES/parted-3.2.tar.xz
|
parted-2.3.tar.xz
|
||||||
SOURCES/pubkey.jim.meyering
|
parted-2.3.tar.xz.sig
|
||||||
SOURCES/pubkey.phillip.susi
|
clog
|
||||||
|
/parted-2.4.tar.xz
|
||||||
|
/parted-2.4.tar.xz.sig
|
||||||
|
/parted-3.0.tar.xz
|
||||||
|
/parted-3.0.tar.xz.sig
|
||||||
|
/parted-3.1.tar.xz
|
||||||
|
/parted-3.1.tar.xz.sig
|
||||||
|
/parted-3.1.90.tar.xz
|
||||||
|
/parted-3.1.90.tar.xz.sig
|
||||||
/parted-3.2.tar.xz
|
/parted-3.2.tar.xz
|
||||||
/parted-3.2.tar.xz.sig
|
/parted-3.2.tar.xz.sig
|
||||||
|
/parted-3.2.153.tar.xz
|
||||||
|
/parted-3.2.153.tar.xz.sig
|
||||||
|
/parted-3.3.tar.xz
|
||||||
|
/parted-3.3.tar.xz.sig
|
||||||
|
/parted-3.3.52.tar.xz
|
||||||
|
/parted-3.3.52.tar.xz.sig
|
||||||
|
/parted-3.4.tar.xz
|
||||||
|
/parted-3.4.tar.xz.sig
|
||||||
|
/parted-3.5.tar.xz
|
||||||
|
/parted-3.5.tar.xz.sig
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From f1cdf08806caf7d71779a5fe67af797c8e3ab09e Mon Sep 17 00:00:00 2001
|
From cec533a00a2cd0b64a7a0f5debc26554f6025831 Mon Sep 17 00:00:00 2001
|
||||||
From: Phillip Susi <psusi@ubuntu.com>
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
Date: Mon, 28 Jul 2014 23:19:51 -0400
|
Date: Mon, 18 Apr 2022 15:10:06 -0400
|
||||||
Subject: [PATCH 2/6] maint: post-release administrivia
|
Subject: [PATCH 1/5] maint: post-release administrivia
|
||||||
|
|
||||||
* NEWS: Add header line for next release.
|
* NEWS: Add header line for next release.
|
||||||
* .prev-version: Record previous version.
|
* .prev-version: Record previous version.
|
||||||
@ -13,14 +13,14 @@ Subject: [PATCH 2/6] maint: post-release administrivia
|
|||||||
3 files changed, 5 insertions(+), 2 deletions(-)
|
3 files changed, 5 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/.prev-version b/.prev-version
|
diff --git a/.prev-version b/.prev-version
|
||||||
index 8c50098..a3ec5a4 100644
|
index e917998..5a95802 100644
|
||||||
--- a/.prev-version
|
--- a/.prev-version
|
||||||
+++ b/.prev-version
|
+++ b/.prev-version
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
-3.1
|
-3.4.64.2
|
||||||
+3.2
|
+3.5
|
||||||
diff --git a/NEWS b/NEWS
|
diff --git a/NEWS b/NEWS
|
||||||
index 49c8129..297b0a5 100644
|
index 68a164a..2bd161f 100644
|
||||||
--- a/NEWS
|
--- a/NEWS
|
||||||
+++ b/NEWS
|
+++ b/NEWS
|
||||||
@@ -1,5 +1,8 @@
|
@@ -1,5 +1,8 @@
|
||||||
@ -29,22 +29,22 @@ index 49c8129..297b0a5 100644
|
|||||||
+* Noteworthy changes in release ?.? (????-??-??) [?]
|
+* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
* Noteworthy changes in release 3.2 (2014-07-28) [stable]
|
* Noteworthy changes in release 3.5 (2022-04-18) [stable]
|
||||||
|
|
||||||
** New Features
|
** New Features
|
||||||
diff --git a/cfg.mk b/cfg.mk
|
diff --git a/cfg.mk b/cfg.mk
|
||||||
index ade72d7..62a02b6 100644
|
index d5fdd80..11fa51b 100644
|
||||||
--- a/cfg.mk
|
--- a/cfg.mk
|
||||||
+++ b/cfg.mk
|
+++ b/cfg.mk
|
||||||
@@ -43,7 +43,7 @@ local-checks-to-skip = \
|
@@ -45,7 +45,7 @@ local-checks-to-skip = \
|
||||||
# Now that we have better (check.mk) tests, make this the default.
|
|
||||||
export VERBOSE = yes
|
export VERBOSE = yes
|
||||||
|
|
||||||
-old_NEWS_hash = bd453bcf049e292a9677c094d24a29dd
|
# Hash of lines 42-208 for release 3.2
|
||||||
+old_NEWS_hash = 85f2e93c40425e202491675d97e40166
|
-old_NEWS_hash = 64a8f4d9ec1a5c256f3cc792450dc257
|
||||||
|
+old_NEWS_hash = 81f624d1d62a34f24e1286bd3cf5c736
|
||||||
|
|
||||||
include $(srcdir)/dist-check.mk
|
include $(srcdir)/dist-check.mk
|
||||||
|
|
||||||
--
|
--
|
||||||
1.9.3
|
2.35.3
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
From e73c27f435017e22a68383255f15ebaa562dd414 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 13 Aug 2014 13:40:28 -0700
|
|
||||||
Subject: [PATCH] tests: Try several UTF8 locales
|
|
||||||
|
|
||||||
Not all distributions (Fedora) have C.UTF-8 so try several (en_US, de_DE,
|
|
||||||
fr_FR, es_ES). This may still fail if none exist.
|
|
||||||
|
|
||||||
* tests/t0251-gpt-unicode.sh: Test for en_US de_DE fr_FR es_ES
|
|
||||||
---
|
|
||||||
tests/t0251-gpt-unicode.sh | 18 +++++++++++++++++-
|
|
||||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh
|
|
||||||
index c845950..537aaa1 100755
|
|
||||||
--- a/tests/t0251-gpt-unicode.sh
|
|
||||||
+++ b/tests/t0251-gpt-unicode.sh
|
|
||||||
@@ -22,7 +22,23 @@ dev=loop-file
|
|
||||||
# create zeroed device
|
|
||||||
truncate -s 10m $dev || fail=1
|
|
||||||
|
|
||||||
-export LC_ALL=C.UTF-8
|
|
||||||
+found_locale=no
|
|
||||||
+for locale in en_US de_DE fr_FR es_ES
|
|
||||||
+do
|
|
||||||
+ LC_ALL="$locale.utf8"
|
|
||||||
+
|
|
||||||
+ # In a UTF-8 locale, the string below prints as 4 characters.
|
|
||||||
+ if [ `printf 'foo\341\264\244' | wc -m` -eq 4 ]; then
|
|
||||||
+ found_locale=yes
|
|
||||||
+ break
|
|
||||||
+ fi
|
|
||||||
+done
|
|
||||||
+
|
|
||||||
+if [ "$found_locale" != "yes" ]; then
|
|
||||||
+ echo "no valid UTF-8 locale found; skipping" >&2
|
|
||||||
+ exit 77
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
# create gpt label with named partition
|
|
||||||
part_name=$(printf 'foo\341\264\244')
|
|
||||||
parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
|
|
||||||
--
|
|
||||||
1.9.3
|
|
||||||
|
|
1636
0002-parted-add-type-command.patch
Normal file
1636
0002-parted-add-type-command.patch
Normal file
File diff suppressed because it is too large
Load Diff
228
0003-libparted-add-swap-flag-for-DASD-label.patch
Normal file
228
0003-libparted-add-swap-flag-for-DASD-label.patch
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
From 29ffc6a1f285f48ac0b9efa7299373e486c486e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Arvin Schnell <aschnell@suse.com>
|
||||||
|
Date: Fri, 8 Oct 2021 10:06:24 +0000
|
||||||
|
Subject: [PATCH 3/5] libparted: add swap flag for DASD label
|
||||||
|
|
||||||
|
Support the swap flag and fix reading flags from disk. Also
|
||||||
|
cleanup code by dropping the 2 flags "raid" and "lvm" from
|
||||||
|
DasdPartitionData and instead use "system" directly.
|
||||||
|
|
||||||
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||||
|
---
|
||||||
|
include/parted/fdasd.in.h | 2 -
|
||||||
|
libparted/labels/dasd.c | 118 ++++++++++++++++----------------------
|
||||||
|
2 files changed, 50 insertions(+), 70 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
|
||||||
|
index 9e5d7d1..e3ba183 100644
|
||||||
|
--- a/include/parted/fdasd.in.h
|
||||||
|
+++ b/include/parted/fdasd.in.h
|
||||||
|
@@ -28,10 +28,8 @@
|
||||||
|
|
||||||
|
#define PARTITION_LINUX_SWAP 0x82
|
||||||
|
#define PARTITION_LINUX 0x83
|
||||||
|
-#define PARTITION_LINUX_EXT 0x85
|
||||||
|
#define PARTITION_LINUX_LVM 0x8e
|
||||||
|
#define PARTITION_LINUX_RAID 0xfd
|
||||||
|
-#define PARTITION_LINUX_LVM_OLD 0xfe
|
||||||
|
|
||||||
|
#define PART_TYPE_NATIVE "NATIVE"
|
||||||
|
#define PART_TYPE_SWAP "SWAP "
|
||||||
|
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
||||||
|
index 0c00c4f..27baad0 100644
|
||||||
|
--- a/libparted/labels/dasd.c
|
||||||
|
+++ b/libparted/labels/dasd.c
|
||||||
|
@@ -53,10 +53,8 @@
|
||||||
|
|
||||||
|
#define PARTITION_LINUX_SWAP 0x82
|
||||||
|
#define PARTITION_LINUX 0x83
|
||||||
|
-#define PARTITION_LINUX_EXT 0x85
|
||||||
|
#define PARTITION_LINUX_LVM 0x8e
|
||||||
|
#define PARTITION_LINUX_RAID 0xfd
|
||||||
|
-#define PARTITION_LINUX_LVM_OLD 0xfe
|
||||||
|
|
||||||
|
extern void ped_disk_dasd_init ();
|
||||||
|
extern void ped_disk_dasd_done ();
|
||||||
|
@@ -66,8 +64,6 @@ extern void ped_disk_dasd_done ();
|
||||||
|
typedef struct {
|
||||||
|
int type;
|
||||||
|
int system;
|
||||||
|
- int raid;
|
||||||
|
- int lvm;
|
||||||
|
} DasdPartitionData;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -134,6 +130,31 @@ static PedDiskType dasd_disk_type = {
|
||||||
|
features: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct flag_id_mapping_t
|
||||||
|
+{
|
||||||
|
+ enum _PedPartitionFlag flag;
|
||||||
|
+ int type_id;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct flag_id_mapping_t flag_id_mapping[] =
|
||||||
|
+{
|
||||||
|
+ { PED_PARTITION_LVM, PARTITION_LINUX_LVM },
|
||||||
|
+ { PED_PARTITION_RAID, PARTITION_LINUX_RAID },
|
||||||
|
+ { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST
|
||||||
|
+dasd_find_flag_id_mapping (PedPartitionFlag flag)
|
||||||
|
+{
|
||||||
|
+ int n = sizeof(flag_id_mapping) / sizeof(flag_id_mapping[0]);
|
||||||
|
+
|
||||||
|
+ for (int i = 0; i < n; ++i)
|
||||||
|
+ if (flag_id_mapping[i].flag == flag)
|
||||||
|
+ return &flag_id_mapping[i];
|
||||||
|
+
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static PedDisk*
|
||||||
|
dasd_alloc (const PedDevice* dev)
|
||||||
|
{
|
||||||
|
@@ -310,8 +331,6 @@ dasd_read (PedDisk* disk)
|
||||||
|
part->num = 1;
|
||||||
|
part->fs_type = ped_file_system_probe (&part->geom);
|
||||||
|
dasd_data = part->disk_specific;
|
||||||
|
- dasd_data->raid = 0;
|
||||||
|
- dasd_data->lvm = 0;
|
||||||
|
dasd_data->type = 0;
|
||||||
|
|
||||||
|
if (!ped_disk_add_partition (disk, part, NULL))
|
||||||
|
@@ -394,8 +413,6 @@ dasd_read (PedDisk* disk)
|
||||||
|
part->num = 1;
|
||||||
|
part->fs_type = ped_file_system_probe (&part->geom);
|
||||||
|
dasd_data = part->disk_specific;
|
||||||
|
- dasd_data->raid = 0;
|
||||||
|
- dasd_data->lvm = 0;
|
||||||
|
dasd_data->type = 0;
|
||||||
|
|
||||||
|
if (!ped_disk_add_partition (disk, part, NULL))
|
||||||
|
@@ -452,25 +469,12 @@ dasd_read (PedDisk* disk)
|
||||||
|
|
||||||
|
dasd_data = part->disk_specific;
|
||||||
|
|
||||||
|
- if ((strncmp(PART_TYPE_RAID, str, 6) == 0) &&
|
||||||
|
- (ped_file_system_probe(&part->geom) == NULL))
|
||||||
|
- ped_partition_set_flag(part, PED_PARTITION_RAID, 1);
|
||||||
|
- else
|
||||||
|
- ped_partition_set_flag(part, PED_PARTITION_RAID, 0);
|
||||||
|
-
|
||||||
|
- if ((strncmp(PART_TYPE_LVM, str, 6) == 0) &&
|
||||||
|
- (ped_file_system_probe(&part->geom) == NULL))
|
||||||
|
- ped_partition_set_flag(part, PED_PARTITION_LVM, 1);
|
||||||
|
- else
|
||||||
|
- ped_partition_set_flag(part, PED_PARTITION_LVM, 0);
|
||||||
|
-
|
||||||
|
- if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
|
||||||
|
- fs = ped_file_system_probe(&part->geom);
|
||||||
|
- if (fs && is_linux_swap(fs->name)) {
|
||||||
|
- dasd_data->system = PARTITION_LINUX_SWAP;
|
||||||
|
- PDEBUG;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ if (strncmp(PART_TYPE_RAID, str, 6) == 0)
|
||||||
|
+ dasd_data->system = PARTITION_LINUX_RAID;
|
||||||
|
+ else if (strncmp(PART_TYPE_LVM, str, 6) == 0)
|
||||||
|
+ dasd_data->system = PARTITION_LINUX_LVM;
|
||||||
|
+ else if (strncmp(PART_TYPE_SWAP, str, 6) == 0)
|
||||||
|
+ dasd_data->system = PARTITION_LINUX_SWAP;
|
||||||
|
|
||||||
|
vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);
|
||||||
|
|
||||||
|
@@ -747,20 +751,17 @@ dasd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
|
||||||
|
PED_ASSERT(part->disk_specific != NULL);
|
||||||
|
dasd_data = part->disk_specific;
|
||||||
|
|
||||||
|
- switch (flag) {
|
||||||
|
- case PED_PARTITION_RAID:
|
||||||
|
- if (state)
|
||||||
|
- dasd_data->lvm = 0;
|
||||||
|
- dasd_data->raid = state;
|
||||||
|
- return ped_partition_set_system(part, part->fs_type);
|
||||||
|
- case PED_PARTITION_LVM:
|
||||||
|
- if (state)
|
||||||
|
- dasd_data->raid = 0;
|
||||||
|
- dasd_data->lvm = state;
|
||||||
|
- return ped_partition_set_system(part, part->fs_type);
|
||||||
|
- default:
|
||||||
|
- return 0;
|
||||||
|
+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag);
|
||||||
|
+ if (p)
|
||||||
|
+ {
|
||||||
|
+ if (state)
|
||||||
|
+ dasd_data->system = p->type_id;
|
||||||
|
+ else if (dasd_data->system == p->type_id)
|
||||||
|
+ return dasd_partition_set_system (part, part->fs_type);
|
||||||
|
+ return 1;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
@@ -772,14 +773,11 @@ dasd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
|
||||||
|
PED_ASSERT (part->disk_specific != NULL);
|
||||||
|
dasd_data = part->disk_specific;
|
||||||
|
|
||||||
|
- switch (flag) {
|
||||||
|
- case PED_PARTITION_RAID:
|
||||||
|
- return dasd_data->raid;
|
||||||
|
- case PED_PARTITION_LVM:
|
||||||
|
- return dasd_data->lvm;
|
||||||
|
- default:
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag);
|
||||||
|
+ if (p)
|
||||||
|
+ return dasd_data->system == p->type_id;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -800,14 +798,10 @@ dasd_partition_is_flag_available (const PedPartition* part,
|
||||||
|
if (disk_specific->format_type == 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- switch (flag) {
|
||||||
|
- case PED_PARTITION_RAID:
|
||||||
|
- return 1;
|
||||||
|
- case PED_PARTITION_LVM:
|
||||||
|
- return 1;
|
||||||
|
- default:
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
+ if (dasd_find_flag_id_mapping (flag))
|
||||||
|
+ return 1;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -938,18 +932,6 @@ dasd_partition_set_system (PedPartition* part,
|
||||||
|
|
||||||
|
part->fs_type = fs_type;
|
||||||
|
|
||||||
|
- if (dasd_data->lvm) {
|
||||||
|
- dasd_data->system = PARTITION_LINUX_LVM;
|
||||||
|
- PDEBUG;
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (dasd_data->raid) {
|
||||||
|
- dasd_data->system = PARTITION_LINUX_RAID;
|
||||||
|
- PDEBUG;
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
if (!fs_type) {
|
||||||
|
dasd_data->system = PARTITION_LINUX;
|
||||||
|
PDEBUG;
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From 507d8e8d4c60fa6175d327c4f2dac307dc11ccd6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Heiko Becker <heirecka@exherbo.org>
|
|
||||||
Date: Fri, 19 Sep 2014 16:51:34 +0200
|
|
||||||
Subject: [PATCH 3/6] libparted: also link to UUID_LIBS
|
|
||||||
|
|
||||||
* libparted/Makefile.am (libparted_la_LIBADD): Add UUID_LIBS.
|
|
||||||
This fixes building parted with the gold linker.
|
|
||||||
---
|
|
||||||
libparted/Makefile.am | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/libparted/Makefile.am b/libparted/Makefile.am
|
|
||||||
index edc5f2e..cb58648 100644
|
|
||||||
--- a/libparted/Makefile.am
|
|
||||||
+++ b/libparted/Makefile.am
|
|
||||||
@@ -58,6 +58,7 @@ libparted_la_LIBADD = \
|
|
||||||
$(DM_LIBS) \
|
|
||||||
$(SELINUX_LIBS) \
|
|
||||||
$(LIB_BLKID) \
|
|
||||||
+ $(UUID_LIBS) \
|
|
||||||
$(INTLLIBS)
|
|
||||||
|
|
||||||
EXTRA_DIST = mbr.s
|
|
||||||
--
|
|
||||||
1.9.3
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
From 1e9e770f4bc7f3d80e09ecd1df58575fad064163 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sun, 28 Sep 2014 16:15:48 +0100
|
|
||||||
Subject: [PATCH 4/6] lib-fs-resize: Prevent crash resizing FAT16 file systems
|
|
||||||
|
|
||||||
Resizing FAT16 file system crashes in libparted/fs/r/fat/resize.c
|
|
||||||
create_resize_context() because it was dereferencing NULL pointer
|
|
||||||
fs_info->info_sector to copy the info_sector.
|
|
||||||
|
|
||||||
Only FAT32 file systems have info_sector populated by fat_open() ->
|
|
||||||
fat_info_sector_read(). FAT12 and FAT16 file systems don't have an
|
|
||||||
info_sector so pointer fs_info->info_sector remains assigned NULL from
|
|
||||||
fat_alloc(). When resizing a FAT file system create_resize_context()
|
|
||||||
was always dereferencing fs_info->info_sector to memory copy the
|
|
||||||
info_sector, hence it crashed for FAT12 and FAT16.
|
|
||||||
|
|
||||||
Make create_resize_context() only copy the info_sector for FAT32 file
|
|
||||||
systems.
|
|
||||||
|
|
||||||
Reported by Christian Hesse in
|
|
||||||
https://bugzilla.gnome.org/show_bug.cgi?id=735669
|
|
||||||
---
|
|
||||||
NEWS | 4 ++++
|
|
||||||
libparted/fs/r/fat/resize.c | 12 +++++++++---
|
|
||||||
2 files changed, 13 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/NEWS b/NEWS
|
|
||||||
index 297b0a5..da7db50 100644
|
|
||||||
--- a/NEWS
|
|
||||||
+++ b/NEWS
|
|
||||||
@@ -2,6 +2,10 @@ GNU parted NEWS -*- outline -*-
|
|
||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
|
||||||
|
|
||||||
+** Bug Fixes
|
|
||||||
+
|
|
||||||
+ libparted-fs-resize: Prevent crash resizing FAT16 file systems.
|
|
||||||
+
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2 (2014-07-28) [stable]
|
|
||||||
|
|
||||||
diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c
|
|
||||||
index 919acf0..bfe60a0 100644
|
|
||||||
--- a/libparted/fs/r/fat/resize.c
|
|
||||||
+++ b/libparted/fs/r/fat/resize.c
|
|
||||||
@@ -668,11 +668,17 @@ create_resize_context (PedFileSystem* fs, const PedGeometry* new_geom)
|
|
||||||
|
|
||||||
/* preserve boot code, etc. */
|
|
||||||
new_fs_info->boot_sector = ped_malloc (new_geom->dev->sector_size);
|
|
||||||
- new_fs_info->info_sector = ped_malloc (new_geom->dev->sector_size);
|
|
||||||
memcpy (new_fs_info->boot_sector, fs_info->boot_sector,
|
|
||||||
new_geom->dev->sector_size);
|
|
||||||
- memcpy (new_fs_info->info_sector, fs_info->info_sector,
|
|
||||||
- new_geom->dev->sector_size);
|
|
||||||
+ new_fs_info->info_sector = NULL;
|
|
||||||
+ if (fs_info->fat_type == FAT_TYPE_FAT32)
|
|
||||||
+ {
|
|
||||||
+ PED_ASSERT (fs_info->info_sector != NULL);
|
|
||||||
+ new_fs_info->info_sector =
|
|
||||||
+ ped_malloc (new_geom->dev->sector_size);
|
|
||||||
+ memcpy (new_fs_info->info_sector, fs_info->info_sector,
|
|
||||||
+ new_geom->dev->sector_size);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
new_fs_info->logical_sector_size = fs_info->logical_sector_size;
|
|
||||||
new_fs_info->sector_count = new_geom->length;
|
|
||||||
--
|
|
||||||
1.9.3
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
From 9b0a83a747b28bd1b778bdd32616e6f7ea88c84d Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Fri, 13 May 2022 10:02:06 -0700
|
||||||
|
Subject: [PATCH 4/5] parted: Reset the filesystem type when changing the
|
||||||
|
id/uuid
|
||||||
|
|
||||||
|
Without this the print command keeps showing the type selected with
|
||||||
|
mkpart, which doesn't match the id/uuid set by the user. So rescan the
|
||||||
|
partition for a filesystem.
|
||||||
|
---
|
||||||
|
parted/parted.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/parted/parted.c b/parted/parted.c
|
||||||
|
index b8a4acf..96da30d 100644
|
||||||
|
--- a/parted/parted.c
|
||||||
|
+++ b/parted/parted.c
|
||||||
|
@@ -991,6 +991,9 @@ do_type (PedDevice** dev, PedDisk** diskp)
|
||||||
|
|
||||||
|
free (input);
|
||||||
|
|
||||||
|
+ // Reset the fs_type based on the filesystem, if it exists
|
||||||
|
+ part->fs_type = ped_file_system_probe (&part->geom);
|
||||||
|
+
|
||||||
|
if (!ped_disk_commit (*diskp))
|
||||||
|
goto error;
|
||||||
|
return 1;
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
From d704c4919e7e95c3a2e28f48bb8eeacaf17a7cc8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sun, 28 Sep 2014 16:15:49 +0100
|
|
||||||
Subject: [PATCH 5/6] tests: t3000-resize-fs.sh: Add FAT16 resizing test
|
|
||||||
|
|
||||||
Add FAT16 resizing test so that we don't regress again.
|
|
||||||
---
|
|
||||||
tests/t3000-resize-fs.sh | 16 +++++++++++++---
|
|
||||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
|
|
||||||
index 8cab476..9084eb4 100755
|
|
||||||
--- a/tests/t3000-resize-fs.sh
|
|
||||||
+++ b/tests/t3000-resize-fs.sh
|
|
||||||
@@ -46,7 +46,7 @@ device_sectors_required=$(echo $default_end | sed 's/s$//')
|
|
||||||
# Ensure that $dev is large enough for this test
|
|
||||||
test $device_sectors_required -le $dev_n_sectors || fail=1
|
|
||||||
|
|
||||||
-for fs_type in hfs+ fat32; do
|
|
||||||
+for fs_type in hfs+ fat32 fat16; do
|
|
||||||
|
|
||||||
# create an empty $fs_type partition, cylinder aligned, size > 256 MB
|
|
||||||
parted -a min -s $dev mkpart p1 $start $default_end > out 2>&1 || fail=1
|
|
||||||
@@ -59,6 +59,7 @@ for fs_type in hfs+ fat32; do
|
|
||||||
wait_for_dev_to_appear_ ${dev}1
|
|
||||||
|
|
||||||
case $fs_type in
|
|
||||||
+ fat16) mkfs_cmd='mkfs.vfat -F 16'; fsck='fsck.vfat -v';;
|
|
||||||
fat32) mkfs_cmd='mkfs.vfat -F 32'; fsck='fsck.vfat -v';;
|
|
||||||
hfs*) mkfs_cmd='mkfs.hfs'; fsck=fsck.hfs;;
|
|
||||||
*) error "internal error: unhandled fs type: $fs_type";;
|
|
||||||
@@ -70,8 +71,17 @@ for fs_type in hfs+ fat32; do
|
|
||||||
# NOTE: shrinking is the only type of resizing that works.
|
|
||||||
# resize that file system to be one cylinder (8MiB) smaller
|
|
||||||
fs-resize ${dev}1 0 $new_end > out 2>&1 || fail=1
|
|
||||||
- # expect no output
|
|
||||||
- compare /dev/null out || fail=1
|
|
||||||
+
|
|
||||||
+ # check for expected output
|
|
||||||
+ case $fs_type in
|
|
||||||
+ fat16) cat << EOF > exp || framework_failure
|
|
||||||
+Information: Would you like to use FAT32? If you leave your file system as FAT16, then you will have no problems. If you convert to FAT32, and MS Windows is installed on this partition, then you must re-install the MS Windows boot loader. If you want to do this, you should consult the Parted manual (or your distribution's manual). Also, converting to FAT32 will make the file system unreadable by MS DOS, MS Windows 95a, and MS Windows NT.
|
|
||||||
+EOF
|
|
||||||
+ ;;
|
|
||||||
+ fat32) cat /dev/null > exp || framework_failure;; # expect no output
|
|
||||||
+ hfs*) cat /dev/null > exp || framework_failure;; # expect no output
|
|
||||||
+ esac
|
|
||||||
+ compare exp out || fail=1
|
|
||||||
|
|
||||||
# This is known to segfault with fsck.hfs from
|
|
||||||
# Fedora 16's hfsplus-tools-332.14-12.fc15.x86_64.
|
|
||||||
--
|
|
||||||
1.9.3
|
|
||||||
|
|
23
0005-tests-t3200-type-change-now-passes.patch
Normal file
23
0005-tests-t3200-type-change-now-passes.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
From ac2a35c2214ef42352d0ddb4f7f4cb77d116e92e Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Fri, 13 May 2022 10:15:41 -0700
|
||||||
|
Subject: [PATCH 5/5] tests: t3200-type-change now passes
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/Makefile.am | 3 ---
|
||||||
|
1 file changed, 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||||
|
index 2da653b..1d109d7 100644
|
||||||
|
--- a/tests/Makefile.am
|
||||||
|
+++ b/tests/Makefile.am
|
||||||
|
@@ -1,6 +1,3 @@
|
||||||
|
-XFAIL_TESTS = \
|
||||||
|
- t3200-type-change.sh
|
||||||
|
-
|
||||||
|
TEST_EXTENSIONS = .sh
|
||||||
|
SH_LOG_COMPILER = $(SHELL)
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
101
0006-libparted-Fix-handling-of-gpt-partition-types.patch
Normal file
101
0006-libparted-Fix-handling-of-gpt-partition-types.patch
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
From 22ec6553b00b8cc21bf8e78529e1cd0f775ff36f Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Mon, 8 Aug 2022 12:04:32 -0700
|
||||||
|
Subject: [PATCH 6/9] libparted: Fix handling of gpt partition types
|
||||||
|
|
||||||
|
This restores the previous behavior by testing the GUID against the list
|
||||||
|
of known types and skipping the filesystem GUID reset. Now the sequence
|
||||||
|
of:
|
||||||
|
|
||||||
|
ped_partition_new(...)
|
||||||
|
ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1);
|
||||||
|
ped_partition_set_system(part, ped_file_system_type_get("ext4"));
|
||||||
|
|
||||||
|
Will keep the GUID set to PED_PARTITION_BIOS_GRUB, which is how it used
|
||||||
|
to behave.
|
||||||
|
---
|
||||||
|
libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++--
|
||||||
|
1 file changed, 43 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
||||||
|
index 0e9e060..8e6a37d 100644
|
||||||
|
--- a/libparted/labels/gpt.c
|
||||||
|
+++ b/libparted/labels/gpt.c
|
||||||
|
@@ -196,6 +196,24 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] =
|
||||||
|
{ PED_PARTITION_SWAP, PARTITION_SWAP_GUID },
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const efi_guid_t skip_set_system_guids[] =
|
||||||
|
+{
|
||||||
|
+ PARTITION_LVM_GUID,
|
||||||
|
+ PARTITION_SWAP_GUID,
|
||||||
|
+ PARTITION_RAID_GUID,
|
||||||
|
+ PARTITION_PREP_GUID,
|
||||||
|
+ PARTITION_SYSTEM_GUID,
|
||||||
|
+ PARTITION_BIOS_GRUB_GUID,
|
||||||
|
+ PARTITION_HPSERVICE_GUID,
|
||||||
|
+ PARTITION_MSFT_RESERVED_GUID,
|
||||||
|
+ PARTITION_BASIC_DATA_GUID,
|
||||||
|
+ PARTITION_MSFT_RECOVERY,
|
||||||
|
+ PARTITION_APPLE_TV_RECOVERY_GUID,
|
||||||
|
+ PARTITION_IRST_GUID,
|
||||||
|
+ PARTITION_CHROMEOS_KERNEL_GUID,
|
||||||
|
+ PARTITION_BLS_BOOT_GUID,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST
|
||||||
|
gpt_find_flag_uuid_mapping (PedPartitionFlag flag)
|
||||||
|
{
|
||||||
|
@@ -1421,6 +1439,21 @@ gpt_partition_destroy (PedPartition *part)
|
||||||
|
_ped_partition_free (part);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* is_skip_guid checks the guid against the list of guids that should not be
|
||||||
|
+ * overridden by set_system. It returns a 1 if it is in the list.
|
||||||
|
+*/
|
||||||
|
+static bool
|
||||||
|
+is_skip_guid(efi_guid_t guid) {
|
||||||
|
+ int n = sizeof(skip_set_system_guids) / sizeof(skip_set_system_guids[0]);
|
||||||
|
+ for (int i = 0; i < n; ++i) {
|
||||||
|
+ if (guid_cmp(guid, skip_set_system_guids[i]) == 0) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int
|
||||||
|
gpt_partition_set_system (PedPartition *part,
|
||||||
|
const PedFileSystemType *fs_type)
|
||||||
|
@@ -1431,6 +1464,11 @@ gpt_partition_set_system (PedPartition *part,
|
||||||
|
|
||||||
|
part->fs_type = fs_type;
|
||||||
|
|
||||||
|
+ // Is this a GUID that should skip fs_type checking?
|
||||||
|
+ if (is_skip_guid(gpt_part_data->type)) {
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (fs_type)
|
||||||
|
{
|
||||||
|
if (strncmp (fs_type->name, "fat", 3) == 0
|
||||||
|
@@ -1563,10 +1601,13 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
||||||
|
const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag);
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
- if (state)
|
||||||
|
+ if (state) {
|
||||||
|
gpt_part_data->type = p->type_uuid;
|
||||||
|
- else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0)
|
||||||
|
+ } else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) {
|
||||||
|
+ // Clear the GUID so that fs_type will be used to return it to the default
|
||||||
|
+ gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
|
||||||
|
return gpt_partition_set_system (part, part->fs_type);
|
||||||
|
+ }
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -1,68 +0,0 @@
|
|||||||
From ac74b830ce518c2228b8ae3fba3f1ece82b49f81 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sun, 28 Sep 2014 16:15:50 +0100
|
|
||||||
Subject: [PATCH 6/6] tests: t3000-resize-fs.sh: Add requirement on mkfs.vfat
|
|
||||||
|
|
||||||
Add test skipping requirement on mkfs.vfat for the FAT32 and FAT16 file
|
|
||||||
system resizing tests. This matches existing test skipping requirement
|
|
||||||
on mkfs.hfs for the hfs+ file system.
|
|
||||||
|
|
||||||
* tests/t3000-resize-fs.sh: Also correct skip_test_ to skip_.
|
|
||||||
* tests/t-lib-helpers.sh: Also update message for requirement of hfs.
|
|
||||||
---
|
|
||||||
tests/t-lib-helpers.sh | 8 +++++++-
|
|
||||||
tests/t3000-resize-fs.sh | 5 +++--
|
|
||||||
2 files changed, 10 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
|
|
||||||
index 4e83a05..c8684bb 100644
|
|
||||||
--- a/tests/t-lib-helpers.sh
|
|
||||||
+++ b/tests/t-lib-helpers.sh
|
|
||||||
@@ -20,7 +20,13 @@ require_acl_()
|
|
||||||
require_hfs_()
|
|
||||||
{
|
|
||||||
mkfs.hfs 2>&1 | grep '^usage:' \
|
|
||||||
- || skip_ "This test requires HFS support."
|
|
||||||
+ || skip_ "mkfs.hfs: command not found"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+require_fat_()
|
|
||||||
+{
|
|
||||||
+ mkfs.vfat 2>&1 | grep '^Usage:' \
|
|
||||||
+ || skip_ "mkfs.vfat: command not found"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Skip this test if we're not in SELinux "enforcing" mode.
|
|
||||||
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
|
|
||||||
index 9084eb4..a79a307 100755
|
|
||||||
--- a/tests/t3000-resize-fs.sh
|
|
||||||
+++ b/tests/t3000-resize-fs.sh
|
|
||||||
@@ -18,7 +18,7 @@
|
|
||||||
|
|
||||||
. "${srcdir=.}/init.sh"; path_prepend_ ../parted .
|
|
||||||
require_hfs_
|
|
||||||
-
|
|
||||||
+require_fat_
|
|
||||||
require_root_
|
|
||||||
require_scsi_debug_module_
|
|
||||||
require_512_byte_sector_size_
|
|
||||||
@@ -31,7 +31,7 @@ default_end=546147s
|
|
||||||
|
|
||||||
# create memory-backed device
|
|
||||||
scsi_debug_setup_ dev_size_mb=550 > dev-name ||
|
|
||||||
- skip_test_ 'failed to create scsi_debug device'
|
|
||||||
+ skip_ 'failed to create scsi_debug device'
|
|
||||||
dev=$(cat dev-name)
|
|
||||||
|
|
||||||
fail=0
|
|
||||||
@@ -47,6 +47,7 @@ device_sectors_required=$(echo $default_end | sed 's/s$//')
|
|
||||||
test $device_sectors_required -le $dev_n_sectors || fail=1
|
|
||||||
|
|
||||||
for fs_type in hfs+ fat32 fat16; do
|
|
||||||
+ echo "fs_type=$fs_type"
|
|
||||||
|
|
||||||
# create an empty $fs_type partition, cylinder aligned, size > 256 MB
|
|
||||||
parted -a min -s $dev mkpart p1 $start $default_end > out 2>&1 || fail=1
|
|
||||||
--
|
|
||||||
1.9.3
|
|
||||||
|
|
160
0007-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch
Normal file
160
0007-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
From 8b4a30cc60ecbe9b7bc966e70560e5ce0fc0c1ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Mon, 8 Aug 2022 13:49:09 -0700
|
||||||
|
Subject: [PATCH 7/9] tests: Add a libparted test for ped_partition_set_system
|
||||||
|
on gpt
|
||||||
|
|
||||||
|
Test the libparted API to make sure the flag is not cleared by calling
|
||||||
|
ped_partition_set_system.
|
||||||
|
---
|
||||||
|
libparted/tests/Makefile.am | 6 ++-
|
||||||
|
libparted/tests/flags.c | 81 ++++++++++++++++++++++++++++++++++
|
||||||
|
libparted/tests/t1001-flags.sh | 23 ++++++++++
|
||||||
|
3 files changed, 108 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 libparted/tests/flags.c
|
||||||
|
create mode 100755 libparted/tests/t1001-flags.sh
|
||||||
|
|
||||||
|
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
|
||||||
|
index fd5cba5..260b692 100644
|
||||||
|
--- a/libparted/tests/Makefile.am
|
||||||
|
+++ b/libparted/tests/Makefile.am
|
||||||
|
@@ -3,9 +3,10 @@
|
||||||
|
#
|
||||||
|
# This file may be modified and/or distributed without restriction.
|
||||||
|
|
||||||
|
-TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh
|
||||||
|
+TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \
|
||||||
|
+ t3000-symlink.sh t4000-volser.sh
|
||||||
|
EXTRA_DIST = $(TESTS)
|
||||||
|
-check_PROGRAMS = label disk zerolen symlink volser
|
||||||
|
+check_PROGRAMS = label disk zerolen symlink volser flags
|
||||||
|
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||||
|
|
||||||
|
LDADD = \
|
||||||
|
@@ -24,6 +25,7 @@ disk_SOURCES = common.h common.c disk.c
|
||||||
|
zerolen_SOURCES = common.h common.c zerolen.c
|
||||||
|
symlink_SOURCES = common.h common.c symlink.c
|
||||||
|
volser_SOURCES = common.h common.c volser.c
|
||||||
|
+flags_SOURCES = common.h common.c flags.c
|
||||||
|
|
||||||
|
# Arrange to symlink to tests/init.sh.
|
||||||
|
CLEANFILES = init.sh
|
||||||
|
diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..c83a361
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/libparted/tests/flags.c
|
||||||
|
@@ -0,0 +1,81 @@
|
||||||
|
+#include <config.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
+#include <check.h>
|
||||||
|
+
|
||||||
|
+#include <parted/parted.h>
|
||||||
|
+
|
||||||
|
+#include "common.h"
|
||||||
|
+#include "progname.h"
|
||||||
|
+
|
||||||
|
+#define STREQ(a, b) (strcmp (a, b) == 0)
|
||||||
|
+
|
||||||
|
+static char* temporary_disk;
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+create_disk (void)
|
||||||
|
+{
|
||||||
|
+ temporary_disk = _create_disk (80 * 1024 * 1024);
|
||||||
|
+ fail_if (temporary_disk == NULL, "Failed to create temporary disk");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+destroy_disk (void)
|
||||||
|
+{
|
||||||
|
+ unlink (temporary_disk);
|
||||||
|
+ free (temporary_disk);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* TEST: Test partition type flag on gpt disklabel */
|
||||||
|
+START_TEST (test_gpt_flag)
|
||||||
|
+{
|
||||||
|
+ PedDevice* dev = ped_device_get (temporary_disk);
|
||||||
|
+ if (dev == NULL)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("gpt"));
|
||||||
|
+ PedConstraint *constraint = ped_constraint_any (dev);
|
||||||
|
+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL,
|
||||||
|
+ ped_file_system_type_get("ext4"), 2048, 4096);
|
||||||
|
+ ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1);
|
||||||
|
+ // Type should remain set to BIOS_GRUB
|
||||||
|
+ ped_partition_set_system(part, ped_file_system_type_get("ext4"));
|
||||||
|
+
|
||||||
|
+ ped_disk_add_partition (disk, part, constraint);
|
||||||
|
+ ped_disk_commit (disk);
|
||||||
|
+ ped_constraint_destroy (constraint);
|
||||||
|
+
|
||||||
|
+ // Check flag to confirm it is still set
|
||||||
|
+ part = ped_disk_get_partition (disk, 1);
|
||||||
|
+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set");
|
||||||
|
+
|
||||||
|
+ ped_disk_destroy (disk);
|
||||||
|
+ ped_device_destroy (dev);
|
||||||
|
+}
|
||||||
|
+END_TEST
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main (int argc, char **argv)
|
||||||
|
+{
|
||||||
|
+ set_program_name (argv[0]);
|
||||||
|
+ int number_failed;
|
||||||
|
+ Suite* suite = suite_create ("Partition Flags");
|
||||||
|
+ TCase* tcase_gpt = tcase_create ("GPT");
|
||||||
|
+
|
||||||
|
+ /* Fail when an exception is raised */
|
||||||
|
+ ped_exception_set_handler (_test_exception_handler);
|
||||||
|
+
|
||||||
|
+ tcase_add_checked_fixture (tcase_gpt, create_disk, destroy_disk);
|
||||||
|
+ tcase_add_test (tcase_gpt, test_gpt_flag);
|
||||||
|
+ /* Disable timeout for this test */
|
||||||
|
+ tcase_set_timeout (tcase_gpt, 0);
|
||||||
|
+ suite_add_tcase (suite, tcase_gpt);
|
||||||
|
+
|
||||||
|
+ SRunner* srunner = srunner_create (suite);
|
||||||
|
+ srunner_run_all (srunner, CK_VERBOSE);
|
||||||
|
+
|
||||||
|
+ number_failed = srunner_ntests_failed (srunner);
|
||||||
|
+ srunner_free (srunner);
|
||||||
|
+
|
||||||
|
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
+}
|
||||||
|
diff --git a/libparted/tests/t1001-flags.sh b/libparted/tests/t1001-flags.sh
|
||||||
|
new file mode 100755
|
||||||
|
index 0000000..60a6248
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/libparted/tests/t1001-flags.sh
|
||||||
|
@@ -0,0 +1,23 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+# run the flags unittest
|
||||||
|
+
|
||||||
|
+# Copyright (C) 2007-2014, 2019-2022 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+# 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 3 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/>.
|
||||||
|
+
|
||||||
|
+. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ .
|
||||||
|
+
|
||||||
|
+flags || fail=1
|
||||||
|
+
|
||||||
|
+Exit $fail
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
From 17630fc4d523d9c03af87a6e735599e88a032e2a Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 7 Nov 2014 11:15:55 -0800
|
|
||||||
Subject: [PATCH] tests: Change minimum size to 256MiB
|
|
||||||
|
|
||||||
btrfs on ppc64 wants 136MiB so expand the minimum temp filesystem size
|
|
||||||
for the t1700-probe-fs test.
|
|
||||||
---
|
|
||||||
tests/t1700-probe-fs.sh | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
|
|
||||||
index 574d6fe..94ed9ae 100755
|
|
||||||
--- a/tests/t1700-probe-fs.sh
|
|
||||||
+++ b/tests/t1700-probe-fs.sh
|
|
||||||
@@ -21,7 +21,7 @@ require_512_byte_sector_size_
|
|
||||||
|
|
||||||
dev=loop-file
|
|
||||||
ss=$sector_size_
|
|
||||||
-n_sectors=$((257*1024))
|
|
||||||
+n_sectors=$((512*1024))
|
|
||||||
|
|
||||||
for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus; do
|
|
||||||
|
|
||||||
--
|
|
||||||
1.9.3
|
|
||||||
|
|
109
0008-libparted-Fix-handling-of-msdos-partition-types.patch
Normal file
109
0008-libparted-Fix-handling-of-msdos-partition-types.patch
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
From d37d5e7a9470bb5bf8446f79f8e9c508366e06b6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Mon, 8 Aug 2022 15:02:30 -0700
|
||||||
|
Subject: [PATCH 8/9] libparted: Fix handling of msdos partition types
|
||||||
|
|
||||||
|
This restores the previous behavior by testing the partition type
|
||||||
|
against the list of known types and skipping the filesystem type reset.
|
||||||
|
Now the sequence of:
|
||||||
|
|
||||||
|
ped_partition_new(...)
|
||||||
|
ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1);
|
||||||
|
ped_partition_set_system(part, ped_file_system_type_get("ext4"));
|
||||||
|
|
||||||
|
Will keep the type set to PED_PARTITION_BLS_BOOT, which is how it used
|
||||||
|
to behave.
|
||||||
|
---
|
||||||
|
libparted/labels/dos.c | 54 +++++++++++++++++++++++++++++++++++-------
|
||||||
|
1 file changed, 46 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
|
||||||
|
index bd7465d..4359276 100644
|
||||||
|
--- a/libparted/labels/dos.c
|
||||||
|
+++ b/libparted/labels/dos.c
|
||||||
|
@@ -121,6 +121,22 @@ static const struct flag_id_mapping_t flag_id_mapping[] =
|
||||||
|
{ PED_PARTITION_SWAP, PARTITION_LINUX_SWAP },
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const unsigned char skip_set_system_types[] =
|
||||||
|
+{
|
||||||
|
+ PARTITION_EXT_LBA,
|
||||||
|
+ PARTITION_DOS_EXT,
|
||||||
|
+ PARTITION_COMPAQ_DIAG,
|
||||||
|
+ PARTITION_MSFT_RECOVERY,
|
||||||
|
+ PARTITION_LINUX_LVM,
|
||||||
|
+ PARTITION_LINUX_SWAP,
|
||||||
|
+ PARTITION_LINUX_RAID,
|
||||||
|
+ PARTITION_PALO,
|
||||||
|
+ PARTITION_PREP,
|
||||||
|
+ PARTITION_IRST,
|
||||||
|
+ PARTITION_ESP,
|
||||||
|
+ PARTITION_BLS_BOOT
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST
|
||||||
|
dos_find_flag_id_mapping (PedPartitionFlag flag)
|
||||||
|
{
|
||||||
|
@@ -1540,6 +1556,21 @@ msdos_partition_destroy (PedPartition* part)
|
||||||
|
free (part);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* is_skip_type checks the type against the list of types that should not be
|
||||||
|
+ * overridden by set_system. It returns a 1 if it is in the list.
|
||||||
|
+*/
|
||||||
|
+static bool
|
||||||
|
+is_skip_type(unsigned char type_id) {
|
||||||
|
+ int n = sizeof(skip_set_system_types) / sizeof(skip_set_system_types[0]);
|
||||||
|
+ for (int i = 0; i < n; ++i) {
|
||||||
|
+ if (type_id == skip_set_system_types[i]) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int
|
||||||
|
msdos_partition_set_system (PedPartition* part,
|
||||||
|
const PedFileSystemType* fs_type)
|
||||||
|
@@ -1548,6 +1579,11 @@ msdos_partition_set_system (PedPartition* part,
|
||||||
|
|
||||||
|
part->fs_type = fs_type;
|
||||||
|
|
||||||
|
+ // Is this a type that should skip fs_type checking?
|
||||||
|
+ if (is_skip_type(dos_data->system)) {
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (part->type & PED_PARTITION_EXTENDED) {
|
||||||
|
dos_data->system = PARTITION_EXT_LBA;
|
||||||
|
return 1;
|
||||||
|
@@ -1590,15 +1626,17 @@ msdos_partition_set_flag (PedPartition* part,
|
||||||
|
const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag);
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
- if (part->type & PED_PARTITION_EXTENDED)
|
||||||
|
- return 0;
|
||||||
|
-
|
||||||
|
- if (state)
|
||||||
|
- dos_data->system = p->type_id;
|
||||||
|
- else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id)
|
||||||
|
- return ped_partition_set_system (part, part->fs_type);
|
||||||
|
+ if (part->type & PED_PARTITION_EXTENDED)
|
||||||
|
+ return 0;
|
||||||
|
|
||||||
|
- return 1;
|
||||||
|
+ if (state) {
|
||||||
|
+ dos_data->system = p->type_id;
|
||||||
|
+ } else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) {
|
||||||
|
+ // Clear the type so that fs_type will be used to return it to the default
|
||||||
|
+ dos_data->system = PARTITION_LINUX;
|
||||||
|
+ return ped_partition_set_system (part, part->fs_type);
|
||||||
|
+ }
|
||||||
|
+ return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (flag) {
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 624a8b14af7d358782ecc12627c84da72c28aeff Mon Sep 17 00:00:00 2001
|
|
||||||
From: Phillip Susi <psusi@ubuntu.com>
|
|
||||||
Date: Tue, 13 Jan 2015 11:05:48 -0500
|
|
||||||
Subject: [PATCH 08/11] parted: don't crash in disk_set when disk label not
|
|
||||||
found
|
|
||||||
|
|
||||||
Due to a typeo in commit 7eac058 "parted: don't reload partition
|
|
||||||
table on every command", the disk_set command would crash if
|
|
||||||
a disk label was not found.
|
|
||||||
---
|
|
||||||
NEWS | 2 ++
|
|
||||||
parted/parted.c | 2 +-
|
|
||||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/NEWS b/NEWS
|
|
||||||
index da7db50..10c9a6e 100644
|
|
||||||
--- a/NEWS
|
|
||||||
+++ b/NEWS
|
|
||||||
@@ -4,6 +4,8 @@ GNU parted NEWS -*- outline -*-
|
|
||||||
|
|
||||||
** Bug Fixes
|
|
||||||
|
|
||||||
+ Don't crash in the disk_set command when a disk label is not found
|
|
||||||
+
|
|
||||||
libparted-fs-resize: Prevent crash resizing FAT16 file systems.
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index f27a035..2678554 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -1684,7 +1684,7 @@ do_disk_set (PedDevice** dev, PedDisk** diskp)
|
|
||||||
|
|
||||||
if (!*diskp)
|
|
||||||
*diskp = ped_disk_new (*dev);
|
|
||||||
- if (!diskp)
|
|
||||||
+ if (!*diskp)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!command_line_get_disk_flag (_("Flag to Invert?"), *diskp, &flag))
|
|
||||||
--
|
|
||||||
2.1.0
|
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
From 3deaae7a19ebfbc2dad6ad67ba65409e7238efc8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Mon, 8 Aug 2022 15:06:03 -0700
|
||||||
|
Subject: [PATCH 9/9] tests: Add a libparted test for ped_partition_set_system
|
||||||
|
on msdos
|
||||||
|
|
||||||
|
Test the libparted API to make sure the flag is not cleared by calling
|
||||||
|
ped_partition_set_system.
|
||||||
|
---
|
||||||
|
libparted/tests/flags.c | 35 +++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 35 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c
|
||||||
|
index c83a361..c4b290b 100644
|
||||||
|
--- a/libparted/tests/flags.c
|
||||||
|
+++ b/libparted/tests/flags.c
|
||||||
|
@@ -54,6 +54,34 @@ START_TEST (test_gpt_flag)
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
+/* TEST: Test partition type flag on msdos disklabel */
|
||||||
|
+START_TEST (test_msdos_flag)
|
||||||
|
+{
|
||||||
|
+ PedDevice* dev = ped_device_get (temporary_disk);
|
||||||
|
+ if (dev == NULL)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos"));
|
||||||
|
+ PedConstraint *constraint = ped_constraint_any (dev);
|
||||||
|
+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL,
|
||||||
|
+ ped_file_system_type_get("ext4"), 2048, 4096);
|
||||||
|
+ ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1);
|
||||||
|
+ // Type should remain set to BIOS_GRUB
|
||||||
|
+ ped_partition_set_system(part, ped_file_system_type_get("ext4"));
|
||||||
|
+
|
||||||
|
+ ped_disk_add_partition (disk, part, constraint);
|
||||||
|
+ ped_disk_commit (disk);
|
||||||
|
+ ped_constraint_destroy (constraint);
|
||||||
|
+
|
||||||
|
+ // Check flag to confirm it is still set
|
||||||
|
+ part = ped_disk_get_partition (disk, 1);
|
||||||
|
+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set");
|
||||||
|
+
|
||||||
|
+ ped_disk_destroy (disk);
|
||||||
|
+ ped_device_destroy (dev);
|
||||||
|
+}
|
||||||
|
+END_TEST
|
||||||
|
+
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
@@ -61,6 +89,7 @@ main (int argc, char **argv)
|
||||||
|
int number_failed;
|
||||||
|
Suite* suite = suite_create ("Partition Flags");
|
||||||
|
TCase* tcase_gpt = tcase_create ("GPT");
|
||||||
|
+ TCase* tcase_msdos = tcase_create ("MSDOS");
|
||||||
|
|
||||||
|
/* Fail when an exception is raised */
|
||||||
|
ped_exception_set_handler (_test_exception_handler);
|
||||||
|
@@ -71,6 +100,12 @@ main (int argc, char **argv)
|
||||||
|
tcase_set_timeout (tcase_gpt, 0);
|
||||||
|
suite_add_tcase (suite, tcase_gpt);
|
||||||
|
|
||||||
|
+ tcase_add_checked_fixture (tcase_msdos, create_disk, destroy_disk);
|
||||||
|
+ tcase_add_test (tcase_msdos, test_msdos_flag);
|
||||||
|
+ /* Disable timeout for this test */
|
||||||
|
+ tcase_set_timeout (tcase_msdos, 0);
|
||||||
|
+ suite_add_tcase (suite, tcase_msdos);
|
||||||
|
+
|
||||||
|
SRunner* srunner = srunner_create (suite);
|
||||||
|
srunner_run_all (srunner, CK_VERBOSE);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -1,103 +0,0 @@
|
|||||||
From 8ab27474806687a2af7efb008b80b33615e6eb1d Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 4 Feb 2015 16:31:00 -0800
|
|
||||||
Subject: [PATCH 09/11] tests: Add a test for device-mapper partition sizes
|
|
||||||
|
|
||||||
device-mapper uses 512b sector units, not device specific sector sizes.
|
|
||||||
This test ensures that the correct partition size is created, no matter
|
|
||||||
what the device's sector size is.
|
|
||||||
---
|
|
||||||
tests/Makefile.am | 1 +
|
|
||||||
tests/t6006-dm-512b-sectors.sh | 68 ++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 69 insertions(+)
|
|
||||||
create mode 100644 tests/t6006-dm-512b-sectors.sh
|
|
||||||
|
|
||||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
||||||
index b726366..ce8391d 100644
|
|
||||||
--- a/tests/Makefile.am
|
|
||||||
+++ b/tests/Makefile.am
|
|
||||||
@@ -69,6 +69,7 @@ TESTS = \
|
|
||||||
t6003-dm-hide.sh \
|
|
||||||
t6004-dm-many-partitions.sh \
|
|
||||||
t6005-dm-uuid.sh \
|
|
||||||
+ t6006-dm-512b-sectors.sh \
|
|
||||||
t6100-mdraid-partitions.sh \
|
|
||||||
t7000-scripting.sh \
|
|
||||||
t8000-loop.sh \
|
|
||||||
diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..31abba9
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/t6006-dm-512b-sectors.sh
|
|
||||||
@@ -0,0 +1,68 @@
|
|
||||||
+#!/bin/sh
|
|
||||||
+# device-mapper sector sizes are 512b, make sure partitions are the correct
|
|
||||||
+# size when using larger sector sizes and a linear dm table.
|
|
||||||
+
|
|
||||||
+# Copyright (C) 2015 Free Software Foundation, Inc.
|
|
||||||
+
|
|
||||||
+# 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 3 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/>.
|
|
||||||
+
|
|
||||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
+
|
|
||||||
+require_root_
|
|
||||||
+require_scsi_debug_module_
|
|
||||||
+
|
|
||||||
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
|
|
||||||
+ skip_ 'this system lacks a new-enough libblkid'
|
|
||||||
+
|
|
||||||
+(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
|
|
||||||
+
|
|
||||||
+# Device maps names - should be random to not conflict with existing ones on
|
|
||||||
+# the system
|
|
||||||
+linear_=plinear-$$test
|
|
||||||
+
|
|
||||||
+cleanup_fn_() {
|
|
||||||
+ i=0
|
|
||||||
+ udevadm settle
|
|
||||||
+ while [ $i -lt 10 ] ; do
|
|
||||||
+ [ -e "/dev/mapper/${linear_}1" ] && dmsetup remove ${linear_}1
|
|
||||||
+ sleep .2
|
|
||||||
+ [ -e "/dev/mapper/$linear_" ] && dmsetup remove $linear_
|
|
||||||
+ sleep .2
|
|
||||||
+ [ -e "/dev/mapper/${linear_}1" -o -e "/dev/mapper/$linear_" ] || i=10
|
|
||||||
+ i=$((i + 1))
|
|
||||||
+ done
|
|
||||||
+ udevadm settle
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Create a 500M device
|
|
||||||
+ss=$sector_size_
|
|
||||||
+scsi_debug_setup_ sector_size=$ss dev_size_mb=500 > dev-name ||
|
|
||||||
+ skip_ 'failed to create scsi_debug device'
|
|
||||||
+scsi_dev=$(cat dev-name)
|
|
||||||
+
|
|
||||||
+# Size of device, in 512b units
|
|
||||||
+scsi_dev_size=$(blockdev --getsz $scsi_dev) || framework_failure
|
|
||||||
+
|
|
||||||
+dmsetup create $linear_ --table "0 $scsi_dev_size linear $scsi_dev 0" || framework_failure
|
|
||||||
+dev="/dev/mapper/$linear_"
|
|
||||||
+
|
|
||||||
+# Create msdos partition table with a partition from 1MiB to 100MiB
|
|
||||||
+parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1
|
|
||||||
+compare /dev/null out || fail=1
|
|
||||||
+
|
|
||||||
+# The size of the partition should be 100MiB, or 204800 512b sectors
|
|
||||||
+p1_size=$(blockdev --getsz ${dev}1) || framework_failure
|
|
||||||
+[ $p1_size == 204800 ] || fail=1
|
|
||||||
+
|
|
||||||
+Exit $fail
|
|
||||||
--
|
|
||||||
2.1.0
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
|||||||
From f98f791e19669b900345dad7d96ea4df974e4596 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 4 Feb 2015 16:46:07 -0800
|
|
||||||
Subject: [PATCH 10/11] libparted: device mapper uses 512b sectors
|
|
||||||
|
|
||||||
device mapper doesn't use the device's sector size when creating a
|
|
||||||
table. It always uses 512b units. This causes partitions to be created
|
|
||||||
8x smaller than expected on devices with 4906b sectors.
|
|
||||||
---
|
|
||||||
NEWS | 4 ++++
|
|
||||||
libparted/arch/linux.c | 21 +++++++++++++++++----
|
|
||||||
2 files changed, 21 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/NEWS b/NEWS
|
|
||||||
index 10c9a6e..96135ed 100644
|
|
||||||
--- a/NEWS
|
|
||||||
+++ b/NEWS
|
|
||||||
@@ -4,6 +4,10 @@ GNU parted NEWS -*- outline -*-
|
|
||||||
|
|
||||||
** Bug Fixes
|
|
||||||
|
|
||||||
+ Use 512b sector size when communicating with device-mapper. Fixes
|
|
||||||
+ problems with partitions being created too small on dm devices
|
|
||||||
+ with sector sizes > 5121b
|
|
||||||
+
|
|
||||||
Don't crash in the disk_set command when a disk label is not found
|
|
||||||
|
|
||||||
libparted-fs-resize: Prevent crash resizing FAT16 file systems.
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 0f18904..90ab21d 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -2763,6 +2763,12 @@ _dm_get_partition_start_and_length(PedPartition const *part,
|
|
||||||
if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3)
|
|
||||||
goto err;
|
|
||||||
rc = 1;
|
|
||||||
+
|
|
||||||
+ /* device-mapper uses 512b units, make sure we return length and start in terms of the device's
|
|
||||||
+ * sector size.
|
|
||||||
+ */
|
|
||||||
+ *start /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT);
|
|
||||||
+ *length /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT);
|
|
||||||
err:
|
|
||||||
free (path);
|
|
||||||
dm_task_destroy(task);
|
|
||||||
@@ -2810,8 +2816,10 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
|
|
||||||
/* Caution: dm_task_destroy frees dev_name. */
|
|
||||||
dm_task_destroy (task);
|
|
||||||
task = NULL;
|
|
||||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
|
||||||
if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major,
|
|
||||||
- arch_specific->minor, part->geom.start)))
|
|
||||||
+ arch_specific->minor,
|
|
||||||
+ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT))))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
task = dm_task_create (DM_DEVICE_CREATE);
|
|
||||||
@@ -2821,7 +2829,8 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
|
|
||||||
dm_task_set_name (task, vol_name);
|
|
||||||
if (vol_uuid)
|
|
||||||
dm_task_set_uuid (task, vol_uuid);
|
|
||||||
- dm_task_add_target (task, 0, part->geom.length,
|
|
||||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
|
||||||
+ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT),
|
|
||||||
"linear", params);
|
|
||||||
if (!dm_task_set_cookie (task, &cookie, 0))
|
|
||||||
goto err;
|
|
||||||
@@ -2878,8 +2887,11 @@ _dm_resize_partition (PedDisk* disk, const PedPartition* part)
|
|
||||||
/* Caution: dm_task_destroy frees dev_name. */
|
|
||||||
dm_task_destroy (task);
|
|
||||||
task = NULL;
|
|
||||||
+
|
|
||||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
|
||||||
if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major,
|
|
||||||
- arch_specific->minor, part->geom.start)))
|
|
||||||
+ arch_specific->minor,
|
|
||||||
+ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT))))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
task = dm_task_create (DM_DEVICE_RELOAD);
|
|
||||||
@@ -2887,7 +2899,8 @@ _dm_resize_partition (PedDisk* disk, const PedPartition* part)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
dm_task_set_name (task, vol_name);
|
|
||||||
- dm_task_add_target (task, 0, part->geom.length,
|
|
||||||
+ /* device-mapper uses 512b units, not the device's sector size */
|
|
||||||
+ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT),
|
|
||||||
"linear", params);
|
|
||||||
if (!dm_task_set_cookie (task, &cookie, 0))
|
|
||||||
goto err;
|
|
||||||
--
|
|
||||||
2.1.0
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
From 098bf9ca4c1ea7955ad683694c64f0201760de60 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 1 Aug 2014 14:48:13 -0700
|
|
||||||
Subject: [PATCH 11/11] Update manpage NAME so whatis will work
|
|
||||||
|
|
||||||
---
|
|
||||||
doc/C/parted.8 | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
|
||||||
index 689011c..5304375 100644
|
|
||||||
--- a/doc/C/parted.8
|
|
||||||
+++ b/doc/C/parted.8
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
.TH PARTED 8 "2007 March 29" parted "GNU Parted Manual"
|
|
||||||
.SH NAME
|
|
||||||
-GNU Parted \- a partition manipulation program
|
|
||||||
+parted \- a partition manipulation program
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B parted
|
|
||||||
[options] [device [command [options...]...]]
|
|
||||||
--
|
|
||||||
2.1.0
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
|||||||
From 822439e4eaa4bb758d9058022154973cd690eca7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 5 Jun 2015 13:46:29 -0700
|
|
||||||
Subject: [PATCH] tests: Make sure the extended partition length is correct
|
|
||||||
(#1135493)
|
|
||||||
|
|
||||||
parted tells the kernel the wrong length when reporting a resize of an
|
|
||||||
extended partition. Make sure the length is 2 for 512b sectors and 1
|
|
||||||
sector for larger.
|
|
||||||
|
|
||||||
(cherry picked from commit 31b5bfa4cd0b2e2944af22466e7b7d88ad94c4c9)
|
|
||||||
---
|
|
||||||
tests/Makefile.am | 1 +
|
|
||||||
tests/t2320-dos-extended-noclobber.sh | 48 +++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 49 insertions(+)
|
|
||||||
create mode 100644 tests/t2320-dos-extended-noclobber.sh
|
|
||||||
|
|
||||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
||||||
index ce8391d..001b9de 100644
|
|
||||||
--- a/tests/Makefile.am
|
|
||||||
+++ b/tests/Makefile.am
|
|
||||||
@@ -47,6 +47,7 @@ TESTS = \
|
|
||||||
t2201-pc98-label-recog.sh \
|
|
||||||
t2300-dos-label-extended-bootcode.sh \
|
|
||||||
t2310-dos-extended-2-sector-min-offset.sh \
|
|
||||||
+ t2320-dos-extended-noclobber.sh \
|
|
||||||
t2400-dos-hfs-partition-type.sh \
|
|
||||||
t2500-probe-corrupt-hfs.sh \
|
|
||||||
t3000-resize-fs.sh \
|
|
||||||
diff --git a/tests/t2320-dos-extended-noclobber.sh b/tests/t2320-dos-extended-noclobber.sh
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..6f3dfff
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/t2320-dos-extended-noclobber.sh
|
|
||||||
@@ -0,0 +1,48 @@
|
|
||||||
+#!/bin/sh
|
|
||||||
+# Ensure that the extended partition reports the correct length
|
|
||||||
+# after adding another partition.
|
|
||||||
+
|
|
||||||
+# Copyright (C) 2015 Free Software Foundation, Inc.
|
|
||||||
+
|
|
||||||
+# 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 3 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/>.
|
|
||||||
+
|
|
||||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
+
|
|
||||||
+require_root_
|
|
||||||
+require_scsi_debug_module_
|
|
||||||
+
|
|
||||||
+# create memory-backed device
|
|
||||||
+ss=$sector_size_
|
|
||||||
+scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name ||
|
|
||||||
+ skip_ 'failed to create scsi_debug device'
|
|
||||||
+scsi_dev=$(cat dev-name)
|
|
||||||
+
|
|
||||||
+# Create a DOS label with an extended partition and a primary partition
|
|
||||||
+parted -s $scsi_dev mklabel msdos || fail=1
|
|
||||||
+parted -s $scsi_dev mkpart extended 1 5 > out 2>&1 || fail=1
|
|
||||||
+parted -s $scsi_dev mkpart primary 5 10 > out 2>&1 || fail=1
|
|
||||||
+
|
|
||||||
+# Make sure the size of the extended partition is correct.
|
|
||||||
+# 2 sectors for 512b and 1 sector for larger. /sys/.../size is in
|
|
||||||
+# 512b blocks so convert accordingly.
|
|
||||||
+dev=${scsi_dev#/dev/}
|
|
||||||
+ext_len=$(cat /sys/block/$dev/${dev}1/size)
|
|
||||||
+if [ $ss -eq 512 ]; then
|
|
||||||
+ expected_len=2
|
|
||||||
+else
|
|
||||||
+ expected_len=$((ss / 512))
|
|
||||||
+fi
|
|
||||||
+[ $ext_len -eq $expected_len ] || fail=1
|
|
||||||
+
|
|
||||||
+Exit $fail
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From 1174a9cca1610611ad5d8cf9f3611e9d4c984fb0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 5 Jun 2015 14:40:00 -0700
|
|
||||||
Subject: [PATCH 13/13] libparted: BLKPG_RESIZE_PARTITION uses bytes, not
|
|
||||||
sectors (#1135493)
|
|
||||||
|
|
||||||
This results in the extended partition vanishing after adding another
|
|
||||||
partition.
|
|
||||||
|
|
||||||
Resolves: rhbz#1135493
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 90ab21d..e73fe1c 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -2547,7 +2547,10 @@ static int _blkpg_resize_partition (PedDisk* disk, const PedPartition *part)
|
|
||||||
if (walk->geom.start == part->geom.start+1)
|
|
||||||
linux_part.length = 1;
|
|
||||||
}
|
|
||||||
- } else linux_part.length = 1;
|
|
||||||
+ } else {
|
|
||||||
+ linux_part.length = 1;
|
|
||||||
+ }
|
|
||||||
+ linux_part.length *= disk->dev->sector_size;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
linux_part.length = part->geom.length * disk->dev->sector_size;
|
|
||||||
--
|
|
||||||
2.4.0
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From f5c628dd51c7d77ff939554425159ab6e8aef1c0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 13 Jul 2015 16:43:11 -0700
|
|
||||||
Subject: [PATCH] parted: Fix crash with name command and no disklabel
|
|
||||||
(#1226067)
|
|
||||||
|
|
||||||
A typo (the last I think) from commit 7eac058 wasn't properly checking
|
|
||||||
the result of ped_disk_new so it could crash if there was no disklabel
|
|
||||||
on the device.
|
|
||||||
---
|
|
||||||
parted/parted.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index 2678554..a9426c4 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -860,7 +860,7 @@ do_name (PedDevice** dev, PedDisk** diskp)
|
|
||||||
|
|
||||||
if (!*diskp)
|
|
||||||
*diskp = ped_disk_new (*dev);
|
|
||||||
- if (!diskp)
|
|
||||||
+ if (!*diskp)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From 059c9548534bef5b0312ac7089eb60e8596469be Mon Sep 17 00:00:00 2001
|
|
||||||
From: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
||||||
Date: Fri, 31 Jul 2015 12:12:44 +0300
|
|
||||||
Subject: [PATCH 15/18] UI: Avoid memory leaks.
|
|
||||||
|
|
||||||
* parted/ui.c(command_line_get_sector): Don't leak input string.
|
|
||||||
* parted/ui.c(command_line_prompt_words): Don't leak _def string in
|
|
||||||
opt script mode.
|
|
||||||
|
|
||||||
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
(cherry picked from commit 50dc0862a94a3e6e77d4cfb2af21de117fbb4819)
|
|
||||||
---
|
|
||||||
parted/ui.c | 6 +++++-
|
|
||||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/parted/ui.c b/parted/ui.c
|
|
||||||
index 7365e7d..505b8ac 100644
|
|
||||||
--- a/parted/ui.c
|
|
||||||
+++ b/parted/ui.c
|
|
||||||
@@ -829,8 +829,11 @@ command_line_prompt_words (const char* prompt, const char* def,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_script_mode) {
|
|
||||||
- if (_def)
|
|
||||||
+ if (_def) {
|
|
||||||
command_line_push_line (_def, 0);
|
|
||||||
+ if (_def_needs_free)
|
|
||||||
+ free (_def);
|
|
||||||
+ }
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -938,6 +941,7 @@ command_line_get_sector (const char* prompt, PedDevice* dev, PedSector* value,
|
|
||||||
if (range) {
|
|
||||||
*range = ped_geometry_new (dev, *value, 1);
|
|
||||||
free (def_str);
|
|
||||||
+ free (input);
|
|
||||||
return *range != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
From bb1014e4e66c6a113f208d2ede8e484f7b702a9d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
||||||
Date: Mon, 3 Aug 2015 11:46:33 +0300
|
|
||||||
Subject: [PATCH 16/18] libparted: Fix memory leaks
|
|
||||||
|
|
||||||
* libparted/fs/r/hfs/hfs.c(hfsplus_resize): Don't leak embedded_geom
|
|
||||||
when volume resizing failed.
|
|
||||||
* libparted/fs/fat/fat.c(fat_create): Don't leake fs in-case of
|
|
||||||
fat_write_clustor failuer.
|
|
||||||
* libparted/arch/linux.c(_kernel_get_partition_start_and_length): Don't leak
|
|
||||||
dev_fd file descriptor.
|
|
||||||
|
|
||||||
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
(cherry picked from commit b70ecd7a7ef1f69b0afd5c239681decbf369f5d9)
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 1 +
|
|
||||||
libparted/fs/r/fat/fat.c | 2 +-
|
|
||||||
libparted/fs/r/hfs/hfs.c | 1 +
|
|
||||||
3 files changed, 3 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 1d4cf17..d33c02d 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -2655,6 +2655,7 @@ _kernel_get_partition_start_and_length(PedPartition const *part,
|
|
||||||
int dev_fd = open (dev_name, O_RDONLY);
|
|
||||||
if (dev_fd != -1 && ioctl (dev_fd, HDIO_GETGEO, &geom)) {
|
|
||||||
*start = geom.start;
|
|
||||||
+ close (dev_fd);
|
|
||||||
ok = true;
|
|
||||||
} else {
|
|
||||||
if (dev_fd != -1)
|
|
||||||
diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c
|
|
||||||
index 5aa72d8..4ecf5c5 100644
|
|
||||||
--- a/libparted/fs/r/fat/fat.c
|
|
||||||
+++ b/libparted/fs/r/fat/fat.c
|
|
||||||
@@ -305,7 +305,7 @@ fat_create (PedGeometry* geom, FatType fat_type, PedTimer* timer)
|
|
||||||
memset (fs_info->buffer, 0, fs_info->cluster_size);
|
|
||||||
if (!fat_write_cluster (fs, fs_info->buffer,
|
|
||||||
fs_info->root_cluster))
|
|
||||||
- return 0;
|
|
||||||
+ goto error_free_buffers;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs_info->serial_number = generate_random_uint32 ();
|
|
||||||
diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c
|
|
||||||
index a1c37cc..7109a45 100644
|
|
||||||
--- a/libparted/fs/r/hfs/hfs.c
|
|
||||||
+++ b/libparted/fs/r/hfs/hfs.c
|
|
||||||
@@ -985,6 +985,7 @@ hfsplus_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
|
|
||||||
/* Resize the HFS+ volume */
|
|
||||||
if (!hfsplus_volume_resize (fs, embedded_geom, timer_plus)) {
|
|
||||||
if (timer_plus != timer) ped_timer_destroy_nested (timer_plus);
|
|
||||||
+ if (priv_data->wrapper) ped_geometry_destroy (embedded_geom);
|
|
||||||
ped_exception_throw (
|
|
||||||
PED_EXCEPTION_ERROR,
|
|
||||||
PED_EXCEPTION_CANCEL,
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
|||||||
From c01a30a6821b243cb0f497b73bb5a7b7465b6aca Mon Sep 17 00:00:00 2001
|
|
||||||
From: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
||||||
Date: Tue, 4 Aug 2015 13:04:45 +0300
|
|
||||||
Subject: [PATCH 17/18] libparted: Fix possible memory leaks
|
|
||||||
|
|
||||||
* libparted/fs/r/fat/resize.c(fat_convert_directory): Possible leak
|
|
||||||
of sub_old_dir_trav or sub_new_dir_trav in error case.
|
|
||||||
* libparted/fs/r/fat/resize.c(fat_construct_converted_tree ): Possible
|
|
||||||
leak of new_trav_info or old_trav_info in error case.
|
|
||||||
|
|
||||||
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
(cherry picked from commit 4886bad13dd011ff56e1c46ff29e8067778c16fd)
|
|
||||||
---
|
|
||||||
libparted/fs/r/fat/resize.c | 11 +++++++++--
|
|
||||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c
|
|
||||||
index 919acf0..b512576 100644
|
|
||||||
--- a/libparted/fs/r/fat/resize.c
|
|
||||||
+++ b/libparted/fs/r/fat/resize.c
|
|
||||||
@@ -177,10 +177,13 @@ fat_convert_directory (FatOpContext* ctx, FatTraverseInfo* old_trav,
|
|
||||||
&& old_dir_entry->name [0] != '.') {
|
|
||||||
sub_old_dir_trav
|
|
||||||
= fat_traverse_directory (old_trav, old_dir_entry);
|
|
||||||
+ if (!sub_old_dir_trav) return 0;
|
|
||||||
sub_new_dir_trav
|
|
||||||
= fat_traverse_directory (new_trav, new_dir_entry);
|
|
||||||
- if (!sub_old_dir_trav || !sub_new_dir_trav)
|
|
||||||
+ if (!sub_new_dir_trav) {
|
|
||||||
+ fat_traverse_complete (sub_old_dir_trav);
|
|
||||||
return 0;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (!fat_convert_directory (ctx, sub_old_dir_trav,
|
|
||||||
sub_new_dir_trav))
|
|
||||||
@@ -315,17 +318,21 @@ fat_construct_converted_tree (FatOpContext* ctx)
|
|
||||||
if (new_fs_info->fat_type == FAT_TYPE_FAT32) {
|
|
||||||
new_trav_info = fat_traverse_begin (ctx->new_fs,
|
|
||||||
new_fs_info->root_cluster, "\\");
|
|
||||||
+ if (!new_trav_info) return 0;
|
|
||||||
old_trav_info = fat_traverse_begin (ctx->old_fs, FAT_ROOT,
|
|
||||||
"\\");
|
|
||||||
} else {
|
|
||||||
fat_clear_root_dir (ctx->new_fs);
|
|
||||||
new_trav_info = fat_traverse_begin (ctx->new_fs, FAT_ROOT,
|
|
||||||
"\\");
|
|
||||||
+ if (!new_trav_info) return 0;
|
|
||||||
old_trav_info = fat_traverse_begin (ctx->old_fs,
|
|
||||||
old_fs_info->root_cluster, "\\");
|
|
||||||
}
|
|
||||||
- if (!new_trav_info || !old_trav_info)
|
|
||||||
+ if (!old_trav_info) {
|
|
||||||
+ fat_traverse_complete (new_trav_info);
|
|
||||||
return 0;
|
|
||||||
+ }
|
|
||||||
if (!fat_convert_directory (ctx, old_trav_info, new_trav_info))
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From 6dc72201ff5b41c171863e6b8eb069b8f8c479cf Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 7 Aug 2015 13:59:58 -0700
|
|
||||||
Subject: [PATCH 18/18] libparted: Stop converting . in sys path to /
|
|
||||||
|
|
||||||
In _probe_sys_block it claimed that ! and . are replaced by / in sys
|
|
||||||
paths, but according to the kernel code only ! is replaced (for cciss
|
|
||||||
devices).
|
|
||||||
|
|
||||||
This is now causing problems with libnvdimm devices, the details are
|
|
||||||
here:
|
|
||||||
|
|
||||||
https://git.kernel.org/cgit/linux/kernel/git/djbw/nvdimm.git/tree/Documentation/nvdimm/nvdimm.txt?h=libnvdimm-for-next
|
|
||||||
(cherry picked from commit 579bd6878b07d8387451d36106ccf86d26818b77)
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index d33c02d..20a7235 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -2235,9 +2235,9 @@ _probe_sys_block ()
|
|
||||||
|
|
||||||
strcpy (dev_name, "/dev/");
|
|
||||||
strcat (dev_name, dirent->d_name);
|
|
||||||
- /* in /sys/block, '/'s are replaced with '!' or '.' */
|
|
||||||
+ /* in /sys/block, '/'s are replaced with '!' */
|
|
||||||
for (ptr = dev_name; *ptr != '\0'; ptr++) {
|
|
||||||
- if (*ptr == '!' || *ptr == '.')
|
|
||||||
+ if (*ptr == '!')
|
|
||||||
*ptr = '/';
|
|
||||||
}
|
|
||||||
_ped_device_probe (dev_name);
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,220 +0,0 @@
|
|||||||
From d66b197b227e1fbd4a72f002cb8b8a7ee9461062 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Thu, 6 Aug 2015 07:17:14 -0700
|
|
||||||
Subject: [PATCH 19/20] libparted: Use read only when probing devices on linux
|
|
||||||
(#1245144)
|
|
||||||
|
|
||||||
When a device is opened for RW closing it can trigger other actions,
|
|
||||||
like udev scanning it for partition changes. Use read only for the
|
|
||||||
init_* methods and RW for actual changes to the device.
|
|
||||||
|
|
||||||
This adds _device_open which takes mode flags as an argument and turns
|
|
||||||
linux_open into a wrapper for it with RW_MODE.
|
|
||||||
|
|
||||||
_device_open_ro is added to open the device with RD_MODE and increment
|
|
||||||
the open_counter. This is used in the init_* functions.
|
|
||||||
|
|
||||||
_device_close is a wrapper around linux_close that decrements the
|
|
||||||
open_counter and is used in the init_* functions.
|
|
||||||
|
|
||||||
All of these changes are self-contained with no external API changes.
|
|
||||||
The only visible change in behavior is that when a new PedDevice is
|
|
||||||
created the device is opened in RO_MODE instead of RW_MODE.
|
|
||||||
|
|
||||||
Resolves: rhbz#1245144
|
|
||||||
(cherry picked from commit 0e169215efcdb33d588ddc2267467593bbf717c9)
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 62 +++++++++++++++++++++++++++++++++++---------------
|
|
||||||
1 file changed, 44 insertions(+), 18 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index b68130b..3934a5b 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -291,7 +291,9 @@ struct blkdev_ioctl_param {
|
|
||||||
static char* _device_get_part_path (PedDevice const *dev, int num);
|
|
||||||
static int _partition_is_mounted_by_path (const char* path);
|
|
||||||
static unsigned int _device_get_partition_range(PedDevice const* dev);
|
|
||||||
-
|
|
||||||
+static int _device_open (PedDevice* dev, int flags);
|
|
||||||
+static int _device_open_ro (PedDevice* dev);
|
|
||||||
+static int _device_close (PedDevice* dev);
|
|
||||||
|
|
||||||
static int
|
|
||||||
_read_fd (int fd, char **buf)
|
|
||||||
@@ -910,7 +912,7 @@ init_ide (PedDevice* dev)
|
|
||||||
if (!_device_stat (dev, &dev_stat))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
- if (!ped_device_open (dev))
|
|
||||||
+ if (!_device_open_ro (dev))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi)) {
|
|
||||||
@@ -979,11 +981,11 @@ init_ide (PedDevice* dev)
|
|
||||||
if (!_device_probe_geometry (dev))
|
|
||||||
goto error_close_dev;
|
|
||||||
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
error_close_dev:
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
error:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1116,7 +1118,7 @@ init_scsi (PedDevice* dev)
|
|
||||||
char* vendor;
|
|
||||||
char* product;
|
|
||||||
|
|
||||||
- if (!ped_device_open (dev))
|
|
||||||
+ if (!_device_open_ro (dev))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (ioctl (arch_specific->fd, SCSI_IOCTL_GET_IDLUN, &idlun) < 0) {
|
|
||||||
@@ -1130,7 +1132,7 @@ init_scsi (PedDevice* dev)
|
|
||||||
goto error_close_dev;
|
|
||||||
if (!_device_probe_geometry (dev))
|
|
||||||
goto error_close_dev;
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1152,11 +1154,11 @@ init_scsi (PedDevice* dev)
|
|
||||||
if (!_device_probe_geometry (dev))
|
|
||||||
goto error_close_dev;
|
|
||||||
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
error_close_dev:
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
error:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1168,7 +1170,7 @@ init_file (PedDevice* dev)
|
|
||||||
|
|
||||||
if (!_device_stat (dev, &dev_stat))
|
|
||||||
goto error;
|
|
||||||
- if (!ped_device_open (dev))
|
|
||||||
+ if (!_device_open_ro (dev))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
dev->sector_size = PED_SECTOR_SIZE_DEFAULT;
|
|
||||||
@@ -1195,7 +1197,7 @@ init_file (PedDevice* dev)
|
|
||||||
goto error_close_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
|
|
||||||
dev->bios_geom.cylinders = dev->length / 4 / 32;
|
|
||||||
dev->bios_geom.heads = 4;
|
|
||||||
@@ -1206,7 +1208,7 @@ init_file (PedDevice* dev)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
error_close_dev:
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
error:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1222,7 +1224,7 @@ init_dasd (PedDevice* dev, const char* model_name)
|
|
||||||
if (!_device_stat (dev, &dev_stat))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
- if (!ped_device_open (dev))
|
|
||||||
+ if (!_device_open_ro (dev))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
|
|
||||||
@@ -1262,11 +1264,11 @@ init_dasd (PedDevice* dev, const char* model_name)
|
|
||||||
|
|
||||||
dev->model = strdup (model_name);
|
|
||||||
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
error_close_dev:
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
error:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1281,7 +1283,7 @@ init_generic (PedDevice* dev, const char* model_name)
|
|
||||||
if (!_device_stat (dev, &dev_stat))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
- if (!ped_device_open (dev))
|
|
||||||
+ if (!_device_open_ro (dev))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
ped_exception_fetch_all ();
|
|
||||||
@@ -1329,11 +1331,11 @@ init_generic (PedDevice* dev, const char* model_name)
|
|
||||||
|
|
||||||
dev->model = strdup (model_name);
|
|
||||||
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
error_close_dev:
|
|
||||||
- ped_device_close (dev);
|
|
||||||
+ _device_close (dev);
|
|
||||||
error:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1620,12 +1622,27 @@ retry:
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
+_device_open_ro (PedDevice* dev)
|
|
||||||
+{
|
|
||||||
+ int rc = _device_open (dev, RD_MODE);
|
|
||||||
+ if (rc)
|
|
||||||
+ dev->open_count++;
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
linux_open (PedDevice* dev)
|
|
||||||
{
|
|
||||||
+ return _device_open (dev, RW_MODE);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+_device_open (PedDevice* dev, int flags)
|
|
||||||
+{
|
|
||||||
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
|
|
||||||
|
|
||||||
retry:
|
|
||||||
- arch_specific->fd = open (dev->path, RW_MODE);
|
|
||||||
+ arch_specific->fd = open (dev->path, flags);
|
|
||||||
|
|
||||||
if (arch_specific->fd == -1) {
|
|
||||||
char* rw_error_msg = strerror (errno);
|
|
||||||
@@ -1694,6 +1711,15 @@ linux_refresh_close (PedDevice* dev)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int
|
|
||||||
+_device_close (PedDevice* dev)
|
|
||||||
+{
|
|
||||||
+ int rc = linux_close (dev);
|
|
||||||
+ if (dev->open_count > 0)
|
|
||||||
+ dev->open_count--;
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#if SIZEOF_OFF_T < 8
|
|
||||||
|
|
||||||
static _syscall5(int,_llseek,
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,209 +0,0 @@
|
|||||||
From f72968f996372d923dbeded302395d8f08445b31 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 7 Aug 2015 11:43:17 -0700
|
|
||||||
Subject: [PATCH 20/20] tests: Use wait_for_dev_to_ functions
|
|
||||||
|
|
||||||
Recent changes to udev have made some long-standing problems appear more
|
|
||||||
frequently. udev executes various actions when changes are made to
|
|
||||||
devices. Sometimes this can result in device nodes not appearing
|
|
||||||
immediately. Other times it can result in EBUSY being returned. This
|
|
||||||
patch only addresses devices that are slow to appear/disappear.
|
|
||||||
|
|
||||||
It is best to use the wait_for_dev_to_appear_ and
|
|
||||||
wait_for_dev_to_disappear_ functions than to test for existance. These
|
|
||||||
will loop and wait for up to 2 seconds for it to appear.
|
|
||||||
|
|
||||||
This also changes t9041 to fail if mkfs doesn't work since using skip
|
|
||||||
here may hide cases when the device node doesn't appear.
|
|
||||||
|
|
||||||
(cherry picked from commit 1dc13965e1108ab513662450e0171c3ea3af3bd1)
|
|
||||||
---
|
|
||||||
tests/t1100-busy-label.sh | 10 ++--------
|
|
||||||
tests/t1102-loop-label.sh | 25 +++++--------------------
|
|
||||||
tests/t2320-dos-extended-noclobber.sh | 1 +
|
|
||||||
tests/t6001-psep.sh | 4 ++--
|
|
||||||
tests/t6004-dm-many-partitions.sh | 6 ++----
|
|
||||||
tests/t6006-dm-512b-sectors.sh | 1 +
|
|
||||||
tests/t6100-mdraid-partitions.sh | 5 +++--
|
|
||||||
tests/t9041-undetected-in-use-16th-partition.sh | 2 +-
|
|
||||||
8 files changed, 17 insertions(+), 37 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh
|
|
||||||
index 4e256d3..70e8ede 100755
|
|
||||||
--- a/tests/t1100-busy-label.sh
|
|
||||||
+++ b/tests/t1100-busy-label.sh
|
|
||||||
@@ -27,22 +27,16 @@ dev=$(cat dev-name)
|
|
||||||
|
|
||||||
parted -s "$dev" mklabel msdos mkpart primary fat32 1 40 > out 2>&1 || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
-mkfs.vfat ${dev}1 || skip_ "mkfs.vfat failed"
|
|
||||||
+wait_for_dev_to_appear_ ${dev}1 || fail=1
|
|
||||||
+mkfs.vfat ${dev}1 || fail=1
|
|
||||||
|
|
||||||
mount_point="`pwd`/mnt"
|
|
||||||
|
|
||||||
# Be sure to unmount upon interrupt, failure, etc.
|
|
||||||
cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
|
|
||||||
|
|
||||||
-# There's a race condition here: on udev-based systems, the partition#1
|
|
||||||
-# device, ${dev}1 (i.e., /dev/sdd1) is not created immediately, and
|
|
||||||
-# without some delay, this mount command would fail. Using a flash card
|
|
||||||
-# as $dev, the loop below typically iterates 7-20 times.
|
|
||||||
-
|
|
||||||
# create mount point dir. and mount the just-created partition on it
|
|
||||||
mkdir $mount_point || fail=1
|
|
||||||
-i=0; while :; do test -e "${dev}1" && break; test $i = 90 && break;
|
|
||||||
- i=$(expr $i + 1); done;
|
|
||||||
mount "${dev}1" $mount_point || fail=1
|
|
||||||
|
|
||||||
# now that a partition is mounted, mklabel attempt must fail
|
|
||||||
diff --git a/tests/t1102-loop-label.sh b/tests/t1102-loop-label.sh
|
|
||||||
index 9752002..68b9af4 100644
|
|
||||||
--- a/tests/t1102-loop-label.sh
|
|
||||||
+++ b/tests/t1102-loop-label.sh
|
|
||||||
@@ -44,15 +44,9 @@ mv out o2 && sed -e "s,$dev,DEVICE,;s/ *$//" o2 > out
|
|
||||||
|
|
||||||
compare exp out || fail=1
|
|
||||||
parted -s $dev rm 1 || fail=1
|
|
||||||
-if [ -e ${dev}1 ]; then
|
|
||||||
- echo "Partition should not exist on loop device"
|
|
||||||
- fail=1
|
|
||||||
-fi
|
|
||||||
+wait_for_dev_to_disappear_ ${dev}1 2 || fail=1
|
|
||||||
partprobe $dev || fail=1
|
|
||||||
-if [ -e ${dev}1 ]; then
|
|
||||||
- echo "Partition should not exist on loop device"
|
|
||||||
- fail=1
|
|
||||||
-fi
|
|
||||||
+wait_for_dev_to_disappear_ ${dev}1 2 || fail=1
|
|
||||||
|
|
||||||
mount_point="`pwd`/mnt"
|
|
||||||
|
|
||||||
@@ -80,24 +74,15 @@ umount "$mount_point"
|
|
||||||
|
|
||||||
# make sure partprobe cleans up stale partition devices
|
|
||||||
parted -s $dev mklabel msdos mkpart primary ext2 0% 100% || fail=1
|
|
||||||
-if [ ! -e ${dev}1 ]; then
|
|
||||||
- echo "Partition doesn't exist on loop device"
|
|
||||||
- fail=1
|
|
||||||
-fi
|
|
||||||
+wait_for_dev_to_appear_ ${dev}1 || fail=1
|
|
||||||
|
|
||||||
mke2fs -F $dev
|
|
||||||
partprobe $dev || fail=1
|
|
||||||
-if [ -e ${dev}1 ]; then
|
|
||||||
- echo "Partition should not exist on loop device"
|
|
||||||
- fail=1
|
|
||||||
-fi
|
|
||||||
+wait_for_dev_to_disappear_ ${dev}1 2 || fail=1
|
|
||||||
|
|
||||||
# make sure new loop label removes old partitions > 1
|
|
||||||
parted -s $dev mklabel msdos mkpart primary ext2 0% 50% mkpart primary ext2 50% 100% || fail=1
|
|
||||||
parted -s $dev mklabel loop || fail=1
|
|
||||||
-if [ -e ${dev}2 ]; then
|
|
||||||
- echo "Partition 2 not removed"
|
|
||||||
- fail=1
|
|
||||||
-fi
|
|
||||||
+wait_for_dev_to_disappear_ ${dev}2 2 || fail=1
|
|
||||||
|
|
||||||
Exit $fail
|
|
||||||
diff --git a/tests/t2320-dos-extended-noclobber.sh b/tests/t2320-dos-extended-noclobber.sh
|
|
||||||
index 6f3dfff..bbc4f26 100644
|
|
||||||
--- a/tests/t2320-dos-extended-noclobber.sh
|
|
||||||
+++ b/tests/t2320-dos-extended-noclobber.sh
|
|
||||||
@@ -32,6 +32,7 @@ scsi_dev=$(cat dev-name)
|
|
||||||
parted -s $scsi_dev mklabel msdos || fail=1
|
|
||||||
parted -s $scsi_dev mkpart extended 1 5 > out 2>&1 || fail=1
|
|
||||||
parted -s $scsi_dev mkpart primary 5 10 > out 2>&1 || fail=1
|
|
||||||
+wait_for_dev_to_appear_ ${scsi_dev}1 || fail=1
|
|
||||||
|
|
||||||
# Make sure the size of the extended partition is correct.
|
|
||||||
# 2 sectors for 512b and 1 sector for larger. /sys/.../size is in
|
|
||||||
diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh
|
|
||||||
index f15090a..4c758e8 100644
|
|
||||||
--- a/tests/t6001-psep.sh
|
|
||||||
+++ b/tests/t6001-psep.sh
|
|
||||||
@@ -54,7 +54,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
|
|
||||||
#make sure device name is correct
|
|
||||||
-test -e ${dev}p1 || fail=1
|
|
||||||
+wait_for_dev_to_appear_ ${dev}p1 || fail=1
|
|
||||||
|
|
||||||
#repeat on name not ending in a digit
|
|
||||||
# setup: create a mapping
|
|
||||||
@@ -66,7 +66,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
|
|
||||||
#make sure device name is correct
|
|
||||||
-test -e ${dev}1 || fail=1
|
|
||||||
+wait_for_dev_to_appear_ ${dev}1 || fail=1
|
|
||||||
|
|
||||||
if [ -n "$fail" ]; then
|
|
||||||
ls /dev/mapper
|
|
||||||
diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh
|
|
||||||
index 8d291ef..7ebc48a 100755
|
|
||||||
--- a/tests/t6004-dm-many-partitions.sh
|
|
||||||
+++ b/tests/t6004-dm-many-partitions.sh
|
|
||||||
@@ -49,10 +49,8 @@ parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fa
|
|
||||||
|
|
||||||
# Make sure all the partitions appeared under /dev/mapper/
|
|
||||||
for ((i=1; i<=$n_partitions; i+=1)); do
|
|
||||||
- if [ ! -e "/dev/mapper/${dm_name}p$i" ]; then
|
|
||||||
- fail=1
|
|
||||||
- break
|
|
||||||
- fi
|
|
||||||
+ wait_for_dev_to_appear_ "/dev/mapper/${dm_name}p$i" || { fail=1; break; }
|
|
||||||
+
|
|
||||||
# remove the partitions as we go, otherwise cleanup won't work.
|
|
||||||
dmsetup remove /dev/mapper/${dm_name}p$i
|
|
||||||
done
|
|
||||||
diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh
|
|
||||||
index 31abba9..c3045af 100644
|
|
||||||
--- a/tests/t6006-dm-512b-sectors.sh
|
|
||||||
+++ b/tests/t6006-dm-512b-sectors.sh
|
|
||||||
@@ -60,6 +60,7 @@ dev="/dev/mapper/$linear_"
|
|
||||||
# Create msdos partition table with a partition from 1MiB to 100MiB
|
|
||||||
parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
+wait_for_dev_to_appear_ ${dev}1 || fail=1
|
|
||||||
|
|
||||||
# The size of the partition should be 100MiB, or 204800 512b sectors
|
|
||||||
p1_size=$(blockdev --getsz ${dev}1) || framework_failure
|
|
||||||
diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh
|
|
||||||
index 6f08442..dbc5986 100755
|
|
||||||
--- a/tests/t6100-mdraid-partitions.sh
|
|
||||||
+++ b/tests/t6100-mdraid-partitions.sh
|
|
||||||
@@ -54,13 +54,14 @@ parted -s $md_dev mklabel gpt \
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
|
|
||||||
# Verify that kernel has been informed about the second device.
|
|
||||||
-grep "${md_name}p2" /proc/partitions || { fail=1; cat /proc/partitions; }
|
|
||||||
+wait_for_dev_to_appear_ ${md_dev}p2 || { fail=1; cat /proc/partitions; }
|
|
||||||
|
|
||||||
# Remove partitions from the raid device.
|
|
||||||
parted -s $md_dev rm 2 rm 1 > out 2>&1 || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
|
|
||||||
# Verify that kernel has been informed about those removals.
|
|
||||||
-grep "${md_name}p[12]" /proc/partitions && { fail=1; cat /proc/partitions; }
|
|
||||||
+wait_for_dev_to_disappear_ ${md_dev}p1 2 || { fail=1; cat /proc/partitions; }
|
|
||||||
+wait_for_dev_to_disappear_ ${md_dev}p2 2 || { fail=1; cat /proc/partitions; }
|
|
||||||
|
|
||||||
Exit $fail
|
|
||||||
diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh
|
|
||||||
index edaae1b..673e508 100644
|
|
||||||
--- a/tests/t9041-undetected-in-use-16th-partition.sh
|
|
||||||
+++ b/tests/t9041-undetected-in-use-16th-partition.sh
|
|
||||||
@@ -72,7 +72,7 @@ wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear
|
|
||||||
|
|
||||||
partitions="${scsi_dev}14 ${scsi_dev}15 ${scsi_dev}16"
|
|
||||||
for i in $partitions; do
|
|
||||||
- mkfs.ext3 $i || skip_ mkfs.ext3 $i failed
|
|
||||||
+ mkfs.ext3 $i || fail=1
|
|
||||||
done
|
|
||||||
|
|
||||||
# be sure to unmount upon interrupt, failure, etc.
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,281 +0,0 @@
|
|||||||
From 4d480d980a9b69b432b8d60df3c4397ba8cdc965 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Date: Thu, 17 Sep 2015 15:33:28 +0200
|
|
||||||
Subject: [PATCH 21/22] fdasd: geometry handling updated from upstream
|
|
||||||
s390-tools
|
|
||||||
|
|
||||||
Remove the necessity for DASD-specific ioctls for partition handling.
|
|
||||||
This allows to correctly handle DASD-backed virtio block devices.
|
|
||||||
|
|
||||||
Note that this is necessary because virtio is just the transport.
|
|
||||||
A DASD, even if provided via virtio, still has it's unique
|
|
||||||
characteristics, which means that only traditional DASD partition
|
|
||||||
table formats can be used (no MBR, GPT, or similar).
|
|
||||||
|
|
||||||
Use bzero for initialization to make sure all struct members are
|
|
||||||
properly cleared. Also changed partition list handling code to be
|
|
||||||
more similar to upstream s390-tools fdasd.
|
|
||||||
|
|
||||||
Further, enhanced error handling capabilities by providing a
|
|
||||||
return code by fdasd_get_geometry.
|
|
||||||
|
|
||||||
Code is largely backported from s390-tools project.
|
|
||||||
|
|
||||||
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Acked-by: Stefan Haberland <stefan.haberland@de.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
include/parted/fdasd.in.h | 4 +-
|
|
||||||
libparted/labels/fdasd.c | 166 ++++++++++++++++++++++++++++++++--------------
|
|
||||||
2 files changed, 119 insertions(+), 51 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
|
|
||||||
index 6f6a7e0..4e351c4 100644
|
|
||||||
--- a/include/parted/fdasd.in.h
|
|
||||||
+++ b/include/parted/fdasd.in.h
|
|
||||||
@@ -190,6 +190,8 @@ typedef struct format_data_t {
|
|
||||||
#define BLKRRPART _IO(0x12,95)
|
|
||||||
/* get block device sector size */
|
|
||||||
#define BLKSSZGET _IO(0x12,104)
|
|
||||||
+/* device size in bytes (u64 *arg)*/
|
|
||||||
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
|
|
||||||
/* get device geometry */
|
|
||||||
#define HDIO_GETGEO 0x0301
|
|
||||||
|
|
||||||
@@ -285,7 +287,7 @@ enum fdasd_failure {
|
|
||||||
|
|
||||||
void fdasd_cleanup (fdasd_anchor_t *anchor);
|
|
||||||
void fdasd_initialize_anchor (fdasd_anchor_t * anc);
|
|
||||||
-void fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int fd);
|
|
||||||
+int fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int fd);
|
|
||||||
void fdasd_check_api_version (fdasd_anchor_t *anc, int fd);
|
|
||||||
int fdasd_check_volume (fdasd_anchor_t *anc, int fd);
|
|
||||||
int fdasd_write_labels (fdasd_anchor_t *anc, int fd);
|
|
||||||
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
|
|
||||||
index 1f87937..7e6a77a 100644
|
|
||||||
--- a/libparted/labels/fdasd.c
|
|
||||||
+++ b/libparted/labels/fdasd.c
|
|
||||||
@@ -210,27 +210,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
|
|
||||||
partition_info_t *p = NULL;
|
|
||||||
partition_info_t *q = NULL;
|
|
||||||
|
|
||||||
- anc->devno = 0;
|
|
||||||
- anc->dev_type = 0;
|
|
||||||
- anc->used_partitions = 0;
|
|
||||||
-
|
|
||||||
- anc->silent = 0;
|
|
||||||
- anc->verbose = 0;
|
|
||||||
- anc->big_disk = 0;
|
|
||||||
- anc->volid_specified = 0;
|
|
||||||
- anc->config_specified = 0;
|
|
||||||
- anc->auto_partition = 0;
|
|
||||||
- anc->devname_specified = 0;
|
|
||||||
- anc->print_table = 0;
|
|
||||||
-
|
|
||||||
- anc->option_reuse = 0;
|
|
||||||
- anc->option_recreate = 0;
|
|
||||||
-
|
|
||||||
- anc->vlabel_changed = 0;
|
|
||||||
- anc->vtoc_changed = 0;
|
|
||||||
- anc->blksize = 0;
|
|
||||||
- anc->fspace_trk = 0;
|
|
||||||
- anc->label_pos = 0;
|
|
||||||
+ bzero(anc, sizeof(fdasd_anchor_t));
|
|
||||||
|
|
||||||
for (i=0; i<USABLE_PARTITIONS; i++)
|
|
||||||
setpos(anc, i, -1);
|
|
||||||
@@ -272,24 +252,18 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
|
|
||||||
if (p == NULL)
|
|
||||||
fdasd_error(anc, malloc_failed,
|
|
||||||
_("No room for partition info."));
|
|
||||||
- p->used = 0x00;
|
|
||||||
- p->len_trk = 0;
|
|
||||||
- p->start_trk = 0;
|
|
||||||
- p->fspace_trk = 0;
|
|
||||||
- p->type = 0;
|
|
||||||
+ bzero(p, sizeof(partition_info_t));
|
|
||||||
|
|
||||||
/* add p to double pointered list */
|
|
||||||
if (i == 1) {
|
|
||||||
- anc->first = p;
|
|
||||||
- p->prev = NULL;
|
|
||||||
+ anc->first = p;
|
|
||||||
} else if (i == USABLE_PARTITIONS) {
|
|
||||||
- anc->last = p;
|
|
||||||
- p->next = NULL;
|
|
||||||
+ anc->last = p;
|
|
||||||
p->prev = q;
|
|
||||||
q->next = p;
|
|
||||||
} else {
|
|
||||||
- p->prev = q;
|
|
||||||
- q->next = p;
|
|
||||||
+ p->prev = q;
|
|
||||||
+ q->next = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->f1 = malloc(sizeof(format1_label_t));
|
|
||||||
@@ -947,15 +921,77 @@ fdasd_check_api_version (fdasd_anchor_t *anc, int f)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
+ * The following two functions match those in the DASD ECKD device driver.
|
|
||||||
+ * They are used to compute how many records of a given size can be stored
|
|
||||||
+ * in one track.
|
|
||||||
+ */
|
|
||||||
+static unsigned int ceil_quot(unsigned int d1, unsigned int d2)
|
|
||||||
+{
|
|
||||||
+ return (d1 + (d2 - 1)) / d2;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* kl: key length, dl: data length */
|
|
||||||
+static unsigned int recs_per_track(unsigned short dev_type, unsigned int kl,
|
|
||||||
+ unsigned int dl)
|
|
||||||
+{
|
|
||||||
+ unsigned int dn, kn;
|
|
||||||
+
|
|
||||||
+ switch (dev_type) {
|
|
||||||
+ case DASD_3380_TYPE:
|
|
||||||
+ if (kl)
|
|
||||||
+ return 1499 / (15 + 7 + ceil_quot(kl + 12, 32) +
|
|
||||||
+ ceil_quot(dl + 12, 32));
|
|
||||||
+ else
|
|
||||||
+ return 1499 / (15 + ceil_quot(dl + 12, 32));
|
|
||||||
+ case DASD_3390_TYPE:
|
|
||||||
+ dn = ceil_quot(dl + 6, 232) + 1;
|
|
||||||
+ if (kl) {
|
|
||||||
+ kn = ceil_quot(kl + 6, 232) + 1;
|
|
||||||
+ return 1729 / (10 + 9 + ceil_quot(kl + 6 * kn, 34) +
|
|
||||||
+ 9 + ceil_quot(dl + 6 * dn, 34));
|
|
||||||
+ } else
|
|
||||||
+ return 1729 / (10 + 9 + ceil_quot(dl + 6 * dn, 34));
|
|
||||||
+ case DASD_9345_TYPE:
|
|
||||||
+ dn = ceil_quot(dl + 6, 232) + 1;
|
|
||||||
+ if (kl) {
|
|
||||||
+ kn = ceil_quot(kl + 6, 232) + 1;
|
|
||||||
+ return 1420 / (18 + 7 + ceil_quot(kl + 6 * kn, 34) +
|
|
||||||
+ ceil_quot(dl + 6 * dn, 34));
|
|
||||||
+ } else
|
|
||||||
+ return 1420 / (18 + 7 + ceil_quot(dl + 6 * dn, 34));
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Verify that number of tracks (heads) per cylinder and number of
|
|
||||||
+ * sectors per track match the expected values for a given device type
|
|
||||||
+ * and block size.
|
|
||||||
+ * Returns 1 for a valid match and 0 otherwise.
|
|
||||||
+ */
|
|
||||||
+static int fdasd_verify_geometry(unsigned short dev_type, int blksize,
|
|
||||||
+ struct fdasd_hd_geometry *geometry)
|
|
||||||
+{
|
|
||||||
+ unsigned int expected_sectors;
|
|
||||||
+ if (geometry->heads != 15)
|
|
||||||
+ return 0;
|
|
||||||
+ expected_sectors = recs_per_track(dev_type, 0, blksize);
|
|
||||||
+ if (geometry->sectors == expected_sectors)
|
|
||||||
+ return 1;
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
* reads dasd geometry data
|
|
||||||
*/
|
|
||||||
-void
|
|
||||||
+int
|
|
||||||
fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
|
|
||||||
{
|
|
||||||
PDEBUG
|
|
||||||
int blksize = 0;
|
|
||||||
dasd_information_t dasd_info;
|
|
||||||
struct dasd_eckd_characteristics *characteristics;
|
|
||||||
+ unsigned long long size_in_bytes;
|
|
||||||
|
|
||||||
/* We can't get geometry from a regular file,
|
|
||||||
so simulate something usable, for the sake of testing. */
|
|
||||||
@@ -979,6 +1015,12 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
|
|
||||||
anc->geo.heads;
|
|
||||||
anc->is_file = 1;
|
|
||||||
} else {
|
|
||||||
+ if (ioctl(f, BLKGETSIZE64, &size_in_bytes) != 0) {
|
|
||||||
+ fdasd_error(anc, unable_to_ioctl,
|
|
||||||
+ _("Could not retrieve disk size."));
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
|
|
||||||
fdasd_error(anc, unable_to_ioctl,
|
|
||||||
_("Could not retrieve disk geometry information."));
|
|
||||||
@@ -988,27 +1030,51 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
|
|
||||||
_("Could not retrieve blocksize information."));
|
|
||||||
|
|
||||||
/* get disk type */
|
|
||||||
- if (ioctl(f, BIODASDINFO, &dasd_info) != 0)
|
|
||||||
- fdasd_error(anc, unable_to_ioctl,
|
|
||||||
- _("Could not retrieve disk information."));
|
|
||||||
-
|
|
||||||
- characteristics = (struct dasd_eckd_characteristics *)
|
|
||||||
- &dasd_info.characteristics;
|
|
||||||
- if (characteristics->no_cyl == LV_COMPAT_CYL &&
|
|
||||||
- characteristics->long_no_cyl)
|
|
||||||
- anc->hw_cylinders = characteristics->long_no_cyl;
|
|
||||||
- else
|
|
||||||
- anc->hw_cylinders = characteristics->no_cyl;
|
|
||||||
+ if (ioctl(f, BIODASDINFO, &dasd_info) != 0) {
|
|
||||||
+ /* verify that the geometry matches a 3390 DASD */
|
|
||||||
+ if (!fdasd_verify_geometry(DASD_3390_TYPE, blksize,
|
|
||||||
+ &anc->geo)) {
|
|
||||||
+ fdasd_error(anc, wrong_disk_type,
|
|
||||||
+ _("Disk geometry does not match a " \
|
|
||||||
+ "DASD device of type 3390."));
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ anc->dev_type = DASD_3390_TYPE;
|
|
||||||
+ anc->hw_cylinders =
|
|
||||||
+ size_in_bytes / (blksize * anc->geo.heads * anc->geo.sectors);
|
|
||||||
+ /* The VOL1 label on a CDL formatted ECKD DASD is in block 2
|
|
||||||
+ * It will be verified later, if this position actually holds a
|
|
||||||
+ * valid label record.
|
|
||||||
+ */
|
|
||||||
+ anc->label_pos = 2 * blksize;
|
|
||||||
+ /* A devno 0 is actually a valid devno, which could exist
|
|
||||||
+ * in the system. Since we use this number only to create
|
|
||||||
+ * a default volume serial, there is no serious conflict.
|
|
||||||
+ */
|
|
||||||
+ anc->devno = 0;
|
|
||||||
+ } else {
|
|
||||||
+ characteristics = (struct dasd_eckd_characteristics *)
|
|
||||||
+ &dasd_info.characteristics;
|
|
||||||
+ if (characteristics->no_cyl == LV_COMPAT_CYL &&
|
|
||||||
+ characteristics->long_no_cyl)
|
|
||||||
+ anc->hw_cylinders = characteristics->long_no_cyl;
|
|
||||||
+ else
|
|
||||||
+ anc->hw_cylinders = characteristics->no_cyl;
|
|
||||||
+ anc->dev_type = dasd_info.dev_type;
|
|
||||||
+ anc->label_pos = dasd_info.label_block * blksize;
|
|
||||||
+ anc->devno = dasd_info.devno;
|
|
||||||
+ anc->label_block = dasd_info.label_block;
|
|
||||||
+ anc->FBA_layout = dasd_info.FBA_layout;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
anc->is_file = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- anc->dev_type = dasd_info.dev_type;
|
|
||||||
- anc->blksize = blksize;
|
|
||||||
- anc->label_pos = dasd_info.label_block * blksize;
|
|
||||||
- anc->devno = dasd_info.devno;
|
|
||||||
- anc->label_block = dasd_info.label_block;
|
|
||||||
- anc->FBA_layout = dasd_info.FBA_layout;
|
|
||||||
+ anc->blksize = blksize;
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ error:
|
|
||||||
+ return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,238 +0,0 @@
|
|||||||
From 834713b5aee1edc004f863231dd489ee3a79f536 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Date: Thu, 17 Sep 2015 15:33:29 +0200
|
|
||||||
Subject: [PATCH 22/22] dasd: enhance device probing
|
|
||||||
|
|
||||||
Probe for all device/transport types as every block device
|
|
||||||
could be a DASD on s390.
|
|
||||||
|
|
||||||
Since the calculation of the minimum and optimum alignment
|
|
||||||
is different between DASDs and common fixed block disks
|
|
||||||
we need a means other than dev->type == PED_DEVICE_DASD.
|
|
||||||
For that purpose a static function _ped_device_like_dasd()
|
|
||||||
offering a DASD detection heuristic has been added to
|
|
||||||
arch/linux.c.
|
|
||||||
|
|
||||||
By always providing arch-specific alignment functions the
|
|
||||||
need for DASD-specific code could be removed from device.c.
|
|
||||||
|
|
||||||
Observe fdasd_get_geometry return code for proper error
|
|
||||||
handling.
|
|
||||||
|
|
||||||
Remove the obsolete API check as we no longer require the
|
|
||||||
DASD-specific IOCTLs.
|
|
||||||
|
|
||||||
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Acked-by: Stefan Haberland <stefan.haberland@de.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 85 ++++++++++++++++++++++++++++++++++++++++---------
|
|
||||||
libparted/device.c | 14 +++-----
|
|
||||||
libparted/labels/dasd.c | 18 +++++------
|
|
||||||
3 files changed, 82 insertions(+), 35 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index adc368d..9344ceb 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -785,9 +785,13 @@ _device_set_sector_size (PedDevice* dev)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined __s390__ || defined __s390x__
|
|
||||||
+ /* The real_sector_size is currently needed for DASD layouts,
|
|
||||||
+ * so we set it unconditionally. In the long run it should
|
|
||||||
+ * be considered to use the dev->phys_sector_size in label/dasd.c.
|
|
||||||
+ */
|
|
||||||
+ arch_specific->real_sector_size = dev->sector_size;
|
|
||||||
/* Return PED_SECTOR_SIZE_DEFAULT for DASDs. */
|
|
||||||
if (dev->type == PED_DEVICE_DASD) {
|
|
||||||
- arch_specific->real_sector_size = dev->sector_size;
|
|
||||||
dev->sector_size = PED_SECTOR_SIZE_DEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -3167,19 +3171,72 @@ linux_disk_commit (PedDisk* disk)
|
|
||||||
{
|
|
||||||
if (disk->dev->type != PED_DEVICE_FILE) {
|
|
||||||
|
|
||||||
- /* We now require BLKPG support. If this assertion fails,
|
|
||||||
- please write to the mailing list describing your system.
|
|
||||||
- Assuming it's never triggered, ...
|
|
||||||
- FIXME: remove this assertion in 2012. */
|
|
||||||
- assert (_have_blkpg ());
|
|
||||||
+ /* We now require BLKPG support. If this assertion fails,
|
|
||||||
+ please write to the mailing list describing your system.
|
|
||||||
+ Assuming it's never triggered, ...
|
|
||||||
+ FIXME: remove this assertion in 2012. */
|
|
||||||
+ assert (_have_blkpg ());
|
|
||||||
|
|
||||||
- if (!_disk_sync_part_table (disk))
|
|
||||||
- return 0;
|
|
||||||
+ if (!_disk_sync_part_table (disk))
|
|
||||||
+ return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if defined __s390__ || defined __s390x__
|
|
||||||
+/**
|
|
||||||
+ * Check whether this device could be a DASD
|
|
||||||
+ *
|
|
||||||
+ * The device probing yields PED_DEVICE_DASD for native DASD transport
|
|
||||||
+ * If the block device uses a different transport (e.g. virtio)
|
|
||||||
+ * a simplified heuristic (assuming a model 3390 with 4K sectors)
|
|
||||||
+ * is applied (only) on s390x systems for this check.
|
|
||||||
+ *
|
|
||||||
+ * \return 1 if the geometry indicates this could be a DASD
|
|
||||||
+ * and 0 otherwise
|
|
||||||
+ */
|
|
||||||
+static int
|
|
||||||
+_ped_device_like_dasd(const PedDevice *dev)
|
|
||||||
+{
|
|
||||||
+ return (dev->type == PED_DEVICE_DASD)
|
|
||||||
+ || (dev->hw_geom.heads == 15
|
|
||||||
+ && dev->hw_geom.sectors == 12
|
|
||||||
+ && (dev->hw_geom.cylinders
|
|
||||||
+ * dev->hw_geom.heads
|
|
||||||
+ * dev->hw_geom.sectors
|
|
||||||
+ * dev->phys_sector_size
|
|
||||||
+ == dev->length * dev->sector_size));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static PedAlignment*
|
|
||||||
+s390_get_minimum_alignment(const PedDevice *dev)
|
|
||||||
+{
|
|
||||||
+#if USE_BLKID
|
|
||||||
+ return linux_get_minimum_alignment(dev);
|
|
||||||
+#else
|
|
||||||
+ return ped_alignment_new(0,
|
|
||||||
+ dev->phys_sector_size
|
|
||||||
+ / dev->sector_size);
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static PedAlignment*
|
|
||||||
+s390_get_optimum_alignment(const PedDevice *dev)
|
|
||||||
+{
|
|
||||||
+ /* DASD needs to use minimum alignment */
|
|
||||||
+ if (_ped_device_like_dasd(dev))
|
|
||||||
+ return s390_get_minimum_alignment(dev);
|
|
||||||
+#if USE_BLKID
|
|
||||||
+ return linux_get_optimum_alignment(dev);
|
|
||||||
+#else
|
|
||||||
+ return NULL;
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#if USE_BLKID
|
|
||||||
static PedAlignment*
|
|
||||||
linux_get_minimum_alignment(const PedDevice *dev)
|
|
||||||
@@ -3220,15 +3277,10 @@ linux_get_optimum_alignment(const PedDevice *dev)
|
|
||||||
&& PED_DEFAULT_ALIGNMENT % optimal_io == 0)
|
|
||||||
|| (!optimal_io && minimum_io
|
|
||||||
&& PED_DEFAULT_ALIGNMENT % minimum_io == 0)
|
|
||||||
- ) {
|
|
||||||
- /* DASD needs to use minimum alignment */
|
|
||||||
- if (dev->type == PED_DEVICE_DASD)
|
|
||||||
- return linux_get_minimum_alignment(dev);
|
|
||||||
-
|
|
||||||
+ )
|
|
||||||
return ped_alignment_new(
|
|
||||||
blkid_topology_get_alignment_offset(tp) / dev->sector_size,
|
|
||||||
PED_DEFAULT_ALIGNMENT / dev->sector_size);
|
|
||||||
- }
|
|
||||||
|
|
||||||
/* If optimal_io_size is 0 and we don't meet the other criteria
|
|
||||||
for using the device.c default, return the minimum alignment. */
|
|
||||||
@@ -3255,7 +3307,10 @@ static PedDeviceArchOps linux_dev_ops = {
|
|
||||||
sync: linux_sync,
|
|
||||||
sync_fast: linux_sync_fast,
|
|
||||||
probe_all: linux_probe_all,
|
|
||||||
-#if USE_BLKID
|
|
||||||
+#if defined __s390__ || defined __s390x__
|
|
||||||
+ get_minimum_alignment: s390_get_minimum_alignment,
|
|
||||||
+ get_optimum_alignment: s390_get_optimum_alignment,
|
|
||||||
+#elif USE_BLKID
|
|
||||||
get_minimum_alignment: linux_get_minimum_alignment,
|
|
||||||
get_optimum_alignment: linux_get_optimum_alignment,
|
|
||||||
#endif
|
|
||||||
diff --git a/libparted/device.c b/libparted/device.c
|
|
||||||
index cdcc117..36fecd2 100644
|
|
||||||
--- a/libparted/device.c
|
|
||||||
+++ b/libparted/device.c
|
|
||||||
@@ -550,16 +550,10 @@ ped_device_get_optimum_alignment(const PedDevice *dev)
|
|
||||||
/* If the arch specific code could not give as an alignment
|
|
||||||
return a default value based on the type of device. */
|
|
||||||
if (align == NULL) {
|
|
||||||
- switch (dev->type) {
|
|
||||||
- case PED_DEVICE_DASD:
|
|
||||||
- align = ped_device_get_minimum_alignment(dev);
|
|
||||||
- break;
|
|
||||||
- default:
|
|
||||||
- /* Align to a grain of 1MiB (like vista / win7) */
|
|
||||||
- align = ped_alignment_new(0,
|
|
||||||
- (PED_DEFAULT_ALIGNMENT
|
|
||||||
- / dev->sector_size));
|
|
||||||
- }
|
|
||||||
+ /* Align to a grain of 1MiB (like vista / win7) */
|
|
||||||
+ align = ped_alignment_new(0,
|
|
||||||
+ (PED_DEFAULT_ALIGNMENT
|
|
||||||
+ / dev->sector_size));
|
|
||||||
}
|
|
||||||
|
|
||||||
return align;
|
|
||||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
|
||||||
index fa9414f..bb32d66 100644
|
|
||||||
--- a/libparted/labels/dasd.c
|
|
||||||
+++ b/libparted/labels/dasd.c
|
|
||||||
@@ -214,19 +214,13 @@ dasd_probe (const PedDevice *dev)
|
|
||||||
|
|
||||||
PED_ASSERT(dev != NULL);
|
|
||||||
|
|
||||||
- if (!(dev->type == PED_DEVICE_DASD
|
|
||||||
- || dev->type == PED_DEVICE_VIODASD
|
|
||||||
- || dev->type == PED_DEVICE_FILE))
|
|
||||||
- return 0;
|
|
||||||
-
|
|
||||||
arch_specific = LINUX_SPECIFIC(dev);
|
|
||||||
|
|
||||||
/* add partition test here */
|
|
||||||
fdasd_initialize_anchor(&anchor);
|
|
||||||
|
|
||||||
- fdasd_get_geometry(dev, &anchor, arch_specific->fd);
|
|
||||||
-
|
|
||||||
- fdasd_check_api_version(&anchor, arch_specific->fd);
|
|
||||||
+ if (fdasd_get_geometry(dev, &anchor, arch_specific->fd) == 0)
|
|
||||||
+ goto error_cleanup;
|
|
||||||
|
|
||||||
/* Labels are required on CDL formatted DASDs. */
|
|
||||||
if (fdasd_check_volume(&anchor, arch_specific->fd) &&
|
|
||||||
@@ -276,7 +270,9 @@ dasd_read (PedDisk* disk)
|
|
||||||
|
|
||||||
fdasd_initialize_anchor(&anchor);
|
|
||||||
|
|
||||||
- fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd);
|
|
||||||
+ if (fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd) == 0)
|
|
||||||
+ goto error_close_dev;
|
|
||||||
+
|
|
||||||
disk_specific->label_block = anchor.label_block;
|
|
||||||
|
|
||||||
if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE)
|
|
||||||
@@ -630,7 +626,9 @@ dasd_write (const PedDisk* disk)
|
|
||||||
|
|
||||||
/* initialize the anchor */
|
|
||||||
fdasd_initialize_anchor(&anchor);
|
|
||||||
- fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd);
|
|
||||||
+ if (fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd) == 0)
|
|
||||||
+ goto error;
|
|
||||||
+
|
|
||||||
fdasd_check_volume(&anchor, arch_specific->fd);
|
|
||||||
memcpy(anchor.vlabel, &disk_specific->vlabel, sizeof(volume_label_t));
|
|
||||||
anchor.vlabel_changed++;
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
|||||||
From 388bab890a4e09b09d2428c0e773ed083295f91b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Colin Watson <cjwatson@ubuntu.com>
|
|
||||||
Date: Thu, 29 Oct 2015 21:12:01 +0100
|
|
||||||
Subject: [PATCH] parted: fix build error on s390
|
|
||||||
|
|
||||||
The preceding dasd probing patches have introduced a compile error
|
|
||||||
when building with blkid support. Fixed by reordering function
|
|
||||||
definitions.
|
|
||||||
|
|
||||||
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
|
|
||||||
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 106 ++++++++++++++++++++++++-------------------------
|
|
||||||
1 file changed, 53 insertions(+), 53 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 9344ceb..1198f52 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -3184,59 +3184,6 @@ linux_disk_commit (PedDisk* disk)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if defined __s390__ || defined __s390x__
|
|
||||||
-/**
|
|
||||||
- * Check whether this device could be a DASD
|
|
||||||
- *
|
|
||||||
- * The device probing yields PED_DEVICE_DASD for native DASD transport
|
|
||||||
- * If the block device uses a different transport (e.g. virtio)
|
|
||||||
- * a simplified heuristic (assuming a model 3390 with 4K sectors)
|
|
||||||
- * is applied (only) on s390x systems for this check.
|
|
||||||
- *
|
|
||||||
- * \return 1 if the geometry indicates this could be a DASD
|
|
||||||
- * and 0 otherwise
|
|
||||||
- */
|
|
||||||
-static int
|
|
||||||
-_ped_device_like_dasd(const PedDevice *dev)
|
|
||||||
-{
|
|
||||||
- return (dev->type == PED_DEVICE_DASD)
|
|
||||||
- || (dev->hw_geom.heads == 15
|
|
||||||
- && dev->hw_geom.sectors == 12
|
|
||||||
- && (dev->hw_geom.cylinders
|
|
||||||
- * dev->hw_geom.heads
|
|
||||||
- * dev->hw_geom.sectors
|
|
||||||
- * dev->phys_sector_size
|
|
||||||
- == dev->length * dev->sector_size));
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-static PedAlignment*
|
|
||||||
-s390_get_minimum_alignment(const PedDevice *dev)
|
|
||||||
-{
|
|
||||||
-#if USE_BLKID
|
|
||||||
- return linux_get_minimum_alignment(dev);
|
|
||||||
-#else
|
|
||||||
- return ped_alignment_new(0,
|
|
||||||
- dev->phys_sector_size
|
|
||||||
- / dev->sector_size);
|
|
||||||
-#endif
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static PedAlignment*
|
|
||||||
-s390_get_optimum_alignment(const PedDevice *dev)
|
|
||||||
-{
|
|
||||||
- /* DASD needs to use minimum alignment */
|
|
||||||
- if (_ped_device_like_dasd(dev))
|
|
||||||
- return s390_get_minimum_alignment(dev);
|
|
||||||
-#if USE_BLKID
|
|
||||||
- return linux_get_optimum_alignment(dev);
|
|
||||||
-#else
|
|
||||||
- return NULL;
|
|
||||||
-#endif
|
|
||||||
-}
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
#if USE_BLKID
|
|
||||||
static PedAlignment*
|
|
||||||
linux_get_minimum_alignment(const PedDevice *dev)
|
|
||||||
@@ -3293,6 +3240,59 @@ linux_get_optimum_alignment(const PedDevice *dev)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#if defined __s390__ || defined __s390x__
|
|
||||||
+/**
|
|
||||||
+ * Check whether this device could be a DASD
|
|
||||||
+ *
|
|
||||||
+ * The device probing yields PED_DEVICE_DASD for native DASD transport
|
|
||||||
+ * If the block device uses a different transport (e.g. virtio)
|
|
||||||
+ * a simplified heuristic (assuming a model 3390 with 4K sectors)
|
|
||||||
+ * is applied (only) on s390x systems for this check.
|
|
||||||
+ *
|
|
||||||
+ * \return 1 if the geometry indicates this could be a DASD
|
|
||||||
+ * and 0 otherwise
|
|
||||||
+ */
|
|
||||||
+static int
|
|
||||||
+_ped_device_like_dasd(const PedDevice *dev)
|
|
||||||
+{
|
|
||||||
+ return (dev->type == PED_DEVICE_DASD)
|
|
||||||
+ || (dev->hw_geom.heads == 15
|
|
||||||
+ && dev->hw_geom.sectors == 12
|
|
||||||
+ && (dev->hw_geom.cylinders
|
|
||||||
+ * dev->hw_geom.heads
|
|
||||||
+ * dev->hw_geom.sectors
|
|
||||||
+ * dev->phys_sector_size
|
|
||||||
+ == dev->length * dev->sector_size));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static PedAlignment*
|
|
||||||
+s390_get_minimum_alignment(const PedDevice *dev)
|
|
||||||
+{
|
|
||||||
+#if USE_BLKID
|
|
||||||
+ return linux_get_minimum_alignment(dev);
|
|
||||||
+#else
|
|
||||||
+ return ped_alignment_new(0,
|
|
||||||
+ dev->phys_sector_size
|
|
||||||
+ / dev->sector_size);
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static PedAlignment*
|
|
||||||
+s390_get_optimum_alignment(const PedDevice *dev)
|
|
||||||
+{
|
|
||||||
+ /* DASD needs to use minimum alignment */
|
|
||||||
+ if (_ped_device_like_dasd(dev))
|
|
||||||
+ return s390_get_minimum_alignment(dev);
|
|
||||||
+#if USE_BLKID
|
|
||||||
+ return linux_get_optimum_alignment(dev);
|
|
||||||
+#else
|
|
||||||
+ return NULL;
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
static PedDeviceArchOps linux_dev_ops = {
|
|
||||||
_new: linux_new,
|
|
||||||
destroy: linux_destroy,
|
|
||||||
--
|
|
||||||
2.4.3
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
From 953f340c3e24c296e9e73f4a0b45ff6563359592 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Date: Fri, 5 Feb 2016 14:47:11 +0100
|
|
||||||
Subject: [PATCH] fdasd.c: Safeguard against geometry misprobing
|
|
||||||
|
|
||||||
Fixes an issue with parted print being run against a logical
|
|
||||||
volume realised by extents on a physical volume residing on
|
|
||||||
a DASD.
|
|
||||||
We must make sure that geometry, device blocksize and DASD
|
|
||||||
attributes are present before we start format verifications
|
|
||||||
If any of it is missing this is not a DASD.
|
|
||||||
|
|
||||||
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/labels/fdasd.c | 11 +++++++++--
|
|
||||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
|
|
||||||
index 7e6a77a..968b332 100644
|
|
||||||
--- a/libparted/labels/fdasd.c
|
|
||||||
+++ b/libparted/labels/fdasd.c
|
|
||||||
@@ -1021,13 +1021,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
|
|
||||||
+ if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0 ||
|
|
||||||
+ anc->geo.heads == 0 ||
|
|
||||||
+ anc->geo.sectors == 0 ||
|
|
||||||
+ anc->geo.cylinders == 0 ) {
|
|
||||||
fdasd_error(anc, unable_to_ioctl,
|
|
||||||
_("Could not retrieve disk geometry information."));
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- if (ioctl(f, BLKSSZGET, &blksize) != 0)
|
|
||||||
+ if (ioctl(f, BLKSSZGET, &blksize) != 0) {
|
|
||||||
fdasd_error(anc, unable_to_ioctl,
|
|
||||||
_("Could not retrieve blocksize information."));
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* get disk type */
|
|
||||||
if (ioctl(f, BIODASDINFO, &dasd_info) != 0) {
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
|||||||
From 151dd81cd1e86c1329488a892fa5df38aae132f5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 29 Feb 2016 11:34:31 -0800
|
|
||||||
Subject: [PATCH 25/28] Add libparted-fs-resize.pc
|
|
||||||
|
|
||||||
Add a pkgconfig file for the filesystem resize library.
|
|
||||||
|
|
||||||
(cherry picked from commit 56ede67e254132eba72b0c3e74b7b3677c22782d)
|
|
||||||
---
|
|
||||||
Makefile.am | 3 ++-
|
|
||||||
configure.ac | 1 +
|
|
||||||
libparted-fs-resize.pc.in | 10 ++++++++++
|
|
||||||
3 files changed, 13 insertions(+), 1 deletion(-)
|
|
||||||
create mode 100644 libparted-fs-resize.pc.in
|
|
||||||
|
|
||||||
diff --git a/Makefile.am b/Makefile.am
|
|
||||||
index 686b61c..c426b8c 100644
|
|
||||||
--- a/Makefile.am
|
|
||||||
+++ b/Makefile.am
|
|
||||||
@@ -6,6 +6,7 @@ EXTRA_DIST = \
|
|
||||||
.prev-version \
|
|
||||||
BUGS \
|
|
||||||
libparted.pc.in \
|
|
||||||
+ libparted-fs-resize.pc.in \
|
|
||||||
parted.spec.in \
|
|
||||||
parted.spec \
|
|
||||||
scripts/data/abi/baseline_symbols.txt \
|
|
||||||
@@ -18,7 +19,7 @@ EXTRA_DIST = \
|
|
||||||
aclocaldir=$(datadir)/aclocal
|
|
||||||
|
|
||||||
pcdir = $(libdir)/pkgconfig
|
|
||||||
-pc_DATA = libparted.pc
|
|
||||||
+pc_DATA = libparted.pc libparted-fs-resize.pc
|
|
||||||
|
|
||||||
# This is best not done via configure.ac, because automake's
|
|
||||||
# make distcheck target does not like auto-generated files
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 436d0e2..3d57157 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -613,6 +613,7 @@ libparted/labels/Makefile
|
|
||||||
libparted/fs/Makefile
|
|
||||||
libparted/tests/Makefile
|
|
||||||
libparted.pc
|
|
||||||
+libparted-fs-resize.pc
|
|
||||||
parted/Makefile
|
|
||||||
partprobe/Makefile
|
|
||||||
doc/Makefile
|
|
||||||
diff --git a/libparted-fs-resize.pc.in b/libparted-fs-resize.pc.in
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..ed9b3d6
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/libparted-fs-resize.pc.in
|
|
||||||
@@ -0,0 +1,10 @@
|
|
||||||
+prefix=@prefix@
|
|
||||||
+exec_prefix=@exec_prefix@
|
|
||||||
+libdir=@libdir@
|
|
||||||
+includedir=@includedir@
|
|
||||||
+
|
|
||||||
+Name: libparted-fs-resize
|
|
||||||
+Description: The GNU Parted filesystem resize shared library
|
|
||||||
+Version: @VERSION@
|
|
||||||
+Libs: -L${libdir} -lparted-fs-resize
|
|
||||||
+Cflags: -I${includedir}
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
|||||||
From 889e484922d3d5df300718ca229e12e5601e774a Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Tue, 1 Mar 2016 10:38:26 -0800
|
|
||||||
Subject: [PATCH 26/28] tests: Add udevadm settle to wait_for_ loop (#1260664)
|
|
||||||
|
|
||||||
Sometimes the device will vanish after the wait_for_dev_to_appear exits.
|
|
||||||
Add udevadm settle in an attempt to make sure the udev system is done
|
|
||||||
flapping around and the device will stay in place.
|
|
||||||
|
|
||||||
Related: rhbz#1260664
|
|
||||||
---
|
|
||||||
tests/t-lib-helpers.sh | 2 ++
|
|
||||||
tests/t-local.sh | 2 ++
|
|
||||||
tests/t6001-psep.sh | 2 ++
|
|
||||||
tests/t6004-dm-many-partitions.sh | 1 +
|
|
||||||
tests/t6005-dm-uuid.sh | 2 ++
|
|
||||||
tests/t6100-mdraid-partitions.sh | 1 +
|
|
||||||
6 files changed, 10 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
|
|
||||||
index 4e83a05..298f1fc 100644
|
|
||||||
--- a/tests/t-lib-helpers.sh
|
|
||||||
+++ b/tests/t-lib-helpers.sh
|
|
||||||
@@ -371,6 +371,7 @@ wait_for_dev_to_appear_()
|
|
||||||
local i=0
|
|
||||||
local incr=1
|
|
||||||
while :; do
|
|
||||||
+ udevadm settle
|
|
||||||
ls "$file" > /dev/null 2>&1 && return 0
|
|
||||||
sleep .1 2>/dev/null || { sleep 1; incr=10; }
|
|
||||||
i=$(expr $i + $incr); test $i = 20 && break
|
|
||||||
@@ -386,6 +387,7 @@ wait_for_dev_to_disappear_()
|
|
||||||
local i=0
|
|
||||||
local incr=1
|
|
||||||
while :; do
|
|
||||||
+ udevadm settle
|
|
||||||
ls "$file" > /dev/null 2>&1 || return 0
|
|
||||||
sleep .1 2>/dev/null || { sleep 1; incr=10; }
|
|
||||||
i=$(expr $i + $incr); test $i -ge $(expr $n_sec \* 10) && break
|
|
||||||
diff --git a/tests/t-local.sh b/tests/t-local.sh
|
|
||||||
index b40a5a0..a7d5226 100644
|
|
||||||
--- a/tests/t-local.sh
|
|
||||||
+++ b/tests/t-local.sh
|
|
||||||
@@ -47,6 +47,7 @@ wait_for_dev_to_appear_()
|
|
||||||
local i=0
|
|
||||||
local incr=1
|
|
||||||
while :; do
|
|
||||||
+ udevadm settle
|
|
||||||
ls "$file" > /dev/null 2>&1 && return 0
|
|
||||||
sleep .1 2>/dev/null || { sleep 1; incr=10; }
|
|
||||||
i=$(expr $i + $incr); test $i = 20 && break
|
|
||||||
@@ -110,6 +111,7 @@ scsi_debug_setup_()
|
|
||||||
local i=0
|
|
||||||
local new_dev
|
|
||||||
while :; do
|
|
||||||
+ udevadm settle
|
|
||||||
new_dev=$(new_sdX_) && break
|
|
||||||
sleep .1 2>/dev/null || { sleep 1; incr=10; }
|
|
||||||
i=$(expr $i + $incr); test $i = 20 && break
|
|
||||||
diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh
|
|
||||||
index 4c758e8..2985cf5 100644
|
|
||||||
--- a/tests/t6001-psep.sh
|
|
||||||
+++ b/tests/t6001-psep.sh
|
|
||||||
@@ -19,6 +19,8 @@
|
|
||||||
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
|
|
||||||
require_root_
|
|
||||||
+require_udevadm_settle_
|
|
||||||
+
|
|
||||||
(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
|
|
||||||
|
|
||||||
# Device maps names - should be random to not conflict with existing ones on
|
|
||||||
diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh
|
|
||||||
index 7ebc48a..01d7fc0 100755
|
|
||||||
--- a/tests/t6004-dm-many-partitions.sh
|
|
||||||
+++ b/tests/t6004-dm-many-partitions.sh
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
|
|
||||||
require_root_
|
|
||||||
+require_udevadm_settle_
|
|
||||||
(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
|
|
||||||
|
|
||||||
ss=$sector_size_
|
|
||||||
diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh
|
|
||||||
index ce1251a..a48ae72 100755
|
|
||||||
--- a/tests/t6005-dm-uuid.sh
|
|
||||||
+++ b/tests/t6005-dm-uuid.sh
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
|
|
||||||
require_root_
|
|
||||||
+require_udevadm_settle_
|
|
||||||
(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
|
|
||||||
|
|
||||||
ss=$sector_size_
|
|
||||||
@@ -46,6 +47,7 @@ for ((i=1; i<=$n_partitions; i+=1)); do
|
|
||||||
cmd="$cmd mkpart p$i ${s}s ${s}s"
|
|
||||||
done
|
|
||||||
parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1
|
|
||||||
+wait_for_dev_to_appear_ /dev/mapper/${dm_name}p${n_partitions} || fail=1
|
|
||||||
|
|
||||||
# Make sure all the partitions have UUIDs
|
|
||||||
for ((i=1; i<=$n_partitions; i+=1)); do
|
|
||||||
diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh
|
|
||||||
index dbc5986..dbb1686 100755
|
|
||||||
--- a/tests/t6100-mdraid-partitions.sh
|
|
||||||
+++ b/tests/t6100-mdraid-partitions.sh
|
|
||||||
@@ -38,6 +38,7 @@ parted -s "$scsi_dev" mklabel gpt \
|
|
||||||
mkpart p1 ext2 1M 4M \
|
|
||||||
mkpart p2 ext2 5M 8M > out 2>&1 || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
+wait_for_dev_to_appear_ ${scsi_dev}2 || { fail=1; cat /proc/partitions; }
|
|
||||||
|
|
||||||
cleanup_fn_() {
|
|
||||||
# stop mdraid array
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From 91c2993edc47f590f1d3199976c970768fd6964c Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Tue, 1 Mar 2016 13:51:54 -0800
|
|
||||||
Subject: [PATCH 27/28] tests: Add wait to t9042 (#1257415)
|
|
||||||
|
|
||||||
Also make the new disklabel and first partition all in one step to
|
|
||||||
prevent udev problems.
|
|
||||||
|
|
||||||
Resolves: rhbz#1257415
|
|
||||||
---
|
|
||||||
tests/t9042-dos-partition-limit.sh | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t9042-dos-partition-limit.sh b/tests/t9042-dos-partition-limit.sh
|
|
||||||
index b01828c..1a69384 100644
|
|
||||||
--- a/tests/t9042-dos-partition-limit.sh
|
|
||||||
+++ b/tests/t9042-dos-partition-limit.sh
|
|
||||||
@@ -44,8 +44,8 @@ printf '%s\n' "BYT;" \
|
|
||||||
"1:$((start-2))s:$((n-1))s:$((n-start+2))s:::lba;" \
|
|
||||||
> exp || fail=1
|
|
||||||
|
|
||||||
-parted -s $scsi_dev mklabel msdos || fail=1
|
|
||||||
-parted -s -a min $scsi_dev mkpart extended $((start-2))s 100% || fail=1
|
|
||||||
+parted -s -a min $scsi_dev mklabel msdos mkpart extended $((start-2))s 100% || fail=1
|
|
||||||
+wait_for_dev_to_appear_ ${scsi_dev}1 || fail=1
|
|
||||||
|
|
||||||
i=1
|
|
||||||
while :; do
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
From 1fc0439a5bd27697fb5daa911f776de4a69e0ca3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 29 Feb 2016 14:31:35 -0800
|
|
||||||
Subject: [PATCH 28/28] tests: Fix t1700 failing on a host with a 4k xfs
|
|
||||||
filesystem (#1260664)
|
|
||||||
|
|
||||||
The problem is that mkfs.xfs won't work if the file it is trying to
|
|
||||||
create is on a filesystem with a sector size larger than the passed
|
|
||||||
-ssize value. So a host with 4k disks (eg. s390) and the xfs filesystem
|
|
||||||
will fail with the error message:
|
|
||||||
illegal sector size 512; hw sector is 4096
|
|
||||||
|
|
||||||
Failures setting up the environment for the test aren't parted bugs.
|
|
||||||
This stops treating mkfs and dd errors as test failures, skipping the fs
|
|
||||||
and logging a warning.
|
|
||||||
|
|
||||||
Related: rhbz#1260664
|
|
||||||
---
|
|
||||||
tests/t1700-probe-fs.sh | 12 ++++++------
|
|
||||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
|
|
||||||
index 94ed9ae..b13cec0 100755
|
|
||||||
--- a/tests/t1700-probe-fs.sh
|
|
||||||
+++ b/tests/t1700-probe-fs.sh
|
|
||||||
@@ -39,13 +39,13 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus; do
|
|
||||||
hfsplus) fsname=hfs+;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
- # create an $type file system
|
|
||||||
+ # create an $type file system, creation failures are not parted bugs,
|
|
||||||
+ # skip the filesystem instead of failing the test.
|
|
||||||
if [ "$type" = "xfs" ]; then
|
|
||||||
- # Work around a problem with s390
|
|
||||||
- mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || fail=1
|
|
||||||
+ mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || { warn_ "$ME: mkfs.$type failed, skipping"; continue; }
|
|
||||||
else
|
|
||||||
- dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || fail=1
|
|
||||||
- mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
|
|
||||||
+ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || { warn_ "$ME: dd failed, skipping $type"; continue; }
|
|
||||||
+ mkfs.$type $force $dev || { warn_ "$ME: mkfs.$type failed skipping"; continue; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
# probe the $type file system
|
|
||||||
@@ -57,7 +57,7 @@ done
|
|
||||||
# Some features should indicate ext4 by themselves.
|
|
||||||
for feature in uninit_bg flex_bg; do
|
|
||||||
# create an ext3 file system
|
|
||||||
- dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || fail=1
|
|
||||||
+ dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || skip_ "dd failed"
|
|
||||||
mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed"
|
|
||||||
|
|
||||||
# set the feature
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From 9a95ca5da96846f3edea48ab18c6365001805e70 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sun, 28 Feb 2016 15:36:10 +0000
|
|
||||||
Subject: [PATCH 29/30] lib-fs-resize: Prevent crash resizing FAT with very
|
|
||||||
deep directories
|
|
||||||
|
|
||||||
Resizing a FAT file system crashes in libparted/fs/r/fat/count.c
|
|
||||||
flag_traverse_dir() if the length of any path name in the file system
|
|
||||||
overflows the 512 byte file_name local buffer. Increase buffer to 4096,
|
|
||||||
PATH_MAX on Linux.
|
|
||||||
|
|
||||||
Reported in
|
|
||||||
https://bugzilla.gnome.org/show_bug.cgi?id=762448
|
|
||||||
---
|
|
||||||
libparted/fs/r/fat/count.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c
|
|
||||||
index 7949e47..a5837c0 100644
|
|
||||||
--- a/libparted/fs/r/fat/count.c
|
|
||||||
+++ b/libparted/fs/r/fat/count.c
|
|
||||||
@@ -219,7 +219,7 @@ flag_traverse_dir (FatTraverseInfo* trav_info) {
|
|
||||||
PedFileSystem* fs = trav_info->fs;
|
|
||||||
FatDirEntry* this_entry;
|
|
||||||
FatTraverseInfo* subdir_trav_info;
|
|
||||||
- char file_name [512];
|
|
||||||
+ char file_name [4096];
|
|
||||||
char* file_name_start;
|
|
||||||
FatCluster first_cluster;
|
|
||||||
PedSector size;
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
From 599ce25c802fc1154ed619fde4249bb381430407 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sun, 28 Feb 2016 15:36:11 +0000
|
|
||||||
Subject: [PATCH 30/30] tests: t3000-resize-fs.sh: Add very deep directory
|
|
||||||
|
|
||||||
Create 500 deep directory tree, with longest name of 4000 characters, to
|
|
||||||
the file system being resized to test the fix to prevent crash when
|
|
||||||
resizing a FAT file system with such a long path.
|
|
||||||
---
|
|
||||||
tests/t3000-resize-fs.sh | 16 ++++++++++++++++
|
|
||||||
1 file changed, 16 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
|
|
||||||
index a79a307..608871c 100755
|
|
||||||
--- a/tests/t3000-resize-fs.sh
|
|
||||||
+++ b/tests/t3000-resize-fs.sh
|
|
||||||
@@ -46,6 +46,13 @@ device_sectors_required=$(echo $default_end | sed 's/s$//')
|
|
||||||
# Ensure that $dev is large enough for this test
|
|
||||||
test $device_sectors_required -le $dev_n_sectors || fail=1
|
|
||||||
|
|
||||||
+# create mount point dir
|
|
||||||
+mount_point="`pwd`/mnt"
|
|
||||||
+mkdir "$mount_point" || fail=1
|
|
||||||
+
|
|
||||||
+# be sure to unmount upon interrupt, failure, etc.
|
|
||||||
+cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
|
|
||||||
+
|
|
||||||
for fs_type in hfs+ fat32 fat16; do
|
|
||||||
echo "fs_type=$fs_type"
|
|
||||||
|
|
||||||
@@ -69,6 +76,15 @@ for fs_type in hfs+ fat32 fat16; do
|
|
||||||
# create the file system
|
|
||||||
$mkfs_cmd ${dev}1 || fail=1
|
|
||||||
|
|
||||||
+ # create 500 deep directory tree with longest name 4000 characters
|
|
||||||
+ # to catch core dump in libparted/fs/r/fat/count.c flag_traverse_dir()
|
|
||||||
+ # overflowing 512 byte file_name local buffer.
|
|
||||||
+ mount "${dev}1" "$mount_point" || fail=1
|
|
||||||
+ cat /dev/null > exp
|
|
||||||
+ ( cd "$mount_point"; for d in `seq 500`; do mkdir TESTDIR; cd TESTDIR; done ) > out
|
|
||||||
+ compare exp out || fail=1 # Ensure no errors creating directory tree
|
|
||||||
+ umount "${dev}1" || fail=1
|
|
||||||
+
|
|
||||||
# NOTE: shrinking is the only type of resizing that works.
|
|
||||||
# resize that file system to be one cylinder (8MiB) smaller
|
|
||||||
fs-resize ${dev}1 0 $new_end > out 2>&1 || fail=1
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
From 61dd3d4c5eb782eb43caa95342e63727db3f8281 Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Cantrell <dcantrell@redhat.com>
|
|
||||||
Date: Thu, 17 Mar 2016 09:24:55 -0400
|
|
||||||
Subject: [PATCH] Use BLKSSZGET to get device sector size in
|
|
||||||
_device_probe_geometry()
|
|
||||||
|
|
||||||
Seen on certain newer devices (such as >32G SDHC memory cards), the
|
|
||||||
HDIO_GETGEO ioctl does not return useful information. The libparted
|
|
||||||
code records hardware and bios reported geometry information, but all of
|
|
||||||
that is largely unusable these days. The information is used in the
|
|
||||||
PedConstraint code for aligning partitions. The sector count is most
|
|
||||||
useful. Rather than only trying HDIO_GETGIO, first initialize the
|
|
||||||
bios_geom fields to 0 and then use BLKSSZGET to capture the sector size.
|
|
||||||
If that fails, try HDIO_GETGEO. And if that fails, raise a warning and
|
|
||||||
fall back on the library's default sector size macro.
|
|
||||||
|
|
||||||
This problem showed up on Raspberry Pi devices where users were
|
|
||||||
attempting to grow a partition to fill the SDHC card. Using the
|
|
||||||
optimal_aligned_constraint returned invalid geometry information
|
|
||||||
(98703359 instead of 124735488 sectors). The issue was reported here:
|
|
||||||
|
|
||||||
https://github.com/fedberry/fedberry/issues/8
|
|
||||||
|
|
||||||
And to the pyparted project:
|
|
||||||
|
|
||||||
https://github.com/rhinstaller/pyparted/issues/25
|
|
||||||
|
|
||||||
I've applied this patch locally to parted, rebuilt, and reinstalled it
|
|
||||||
and it is working correctly for the problem SDHC cards.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 40 +++++++++++++++++++++++++---------------
|
|
||||||
1 file changed, 25 insertions(+), 15 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 1198f52..326b956 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -852,6 +852,7 @@ _device_probe_geometry (PedDevice* dev)
|
|
||||||
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
|
|
||||||
struct stat dev_stat;
|
|
||||||
struct hd_geometry geometry;
|
|
||||||
+ int sector_size = 0;
|
|
||||||
|
|
||||||
if (!_device_stat (dev, &dev_stat))
|
|
||||||
return 0;
|
|
||||||
@@ -863,26 +864,35 @@ _device_probe_geometry (PedDevice* dev)
|
|
||||||
if (!dev->length)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
- /* The GETGEO ioctl is no longer useful (as of linux 2.6.x). We could
|
|
||||||
- * still use it in 2.4.x, but this is contentious. Perhaps we should
|
|
||||||
- * move to EDD. */
|
|
||||||
- dev->bios_geom.sectors = 63;
|
|
||||||
- dev->bios_geom.heads = 255;
|
|
||||||
- dev->bios_geom.cylinders
|
|
||||||
- = dev->length / (63 * 255);
|
|
||||||
+ /* initialize the bios_geom values to something */
|
|
||||||
+ dev->bios_geom.sectors = 0;
|
|
||||||
+ dev->bios_geom.heads = 0;
|
|
||||||
+ dev->bios_geom.cylinders = 0;
|
|
||||||
|
|
||||||
- /* FIXME: what should we put here? (TODO: discuss on linux-kernel) */
|
|
||||||
- if (!ioctl (arch_specific->fd, HDIO_GETGEO, &geometry)
|
|
||||||
+ if (!ioctl (arch_specific->fd, BLKSSZGET, §or_size)) {
|
|
||||||
+ /* get the sector count first */
|
|
||||||
+ dev->bios_geom.sectors = 1 + (sector_size / PED_SECTOR_SIZE_DEFAULT);
|
|
||||||
+ dev->bios_geom.heads = 255;
|
|
||||||
+ } else if (!ioctl (arch_specific->fd, HDIO_GETGEO, &geometry)
|
|
||||||
&& geometry.sectors && geometry.heads) {
|
|
||||||
- dev->hw_geom.sectors = geometry.sectors;
|
|
||||||
- dev->hw_geom.heads = geometry.heads;
|
|
||||||
- dev->hw_geom.cylinders
|
|
||||||
- = dev->length / (dev->hw_geom.heads
|
|
||||||
- * dev->hw_geom.sectors);
|
|
||||||
+ /* if BLKSSZGET failed, try the deprecated HDIO_GETGEO */
|
|
||||||
+ dev->bios_geom.sectors = geometry.sectors;
|
|
||||||
+ dev->bios_geom.heads = geometry.heads;
|
|
||||||
} else {
|
|
||||||
- dev->hw_geom = dev->bios_geom;
|
|
||||||
+ ped_exception_throw (
|
|
||||||
+ PED_EXCEPTION_WARNING,
|
|
||||||
+ PED_EXCEPTION_OK,
|
|
||||||
+ _("Could not determine sector size for %s: %s.\n"
|
|
||||||
+ "Using the default sector size (%lld)."),
|
|
||||||
+ dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT);
|
|
||||||
+ dev->bios_geom.sectors = 2;
|
|
||||||
+ dev->bios_geom.heads = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ dev->bios_geom.cylinders
|
|
||||||
+ = dev->length / (dev->bios_geom.heads
|
|
||||||
+ * dev->bios_geom.sectors);
|
|
||||||
+ dev->hw_geom = dev->bios_geom;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.5.0
|
|
||||||
|
|
@ -1,106 +0,0 @@
|
|||||||
From 0b996d3ebe95fdb6704f2c1d1a82574e07e86798 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Tue, 12 Apr 2016 16:13:44 -0700
|
|
||||||
Subject: [PATCH 32/36] parted: fix the rescue command
|
|
||||||
|
|
||||||
The rescue command often failed to locate a filesystem due to it
|
|
||||||
leaving cylinder alignment on, which snapped the allowed bounds
|
|
||||||
of the filesystem down to the next lower cylinder boundary,
|
|
||||||
causing the detected filesystem to be rejected due to not fitting.
|
|
||||||
|
|
||||||
(cherry picked from commit e09c30fb53179319ba1543813b5b4024e923b795)
|
|
||||||
---
|
|
||||||
parted/parted.c | 4 ++++
|
|
||||||
tests/Makefile.am | 1 +
|
|
||||||
tests/t1701-rescue-fs.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
3 files changed, 57 insertions(+)
|
|
||||||
create mode 100644 tests/t1701-rescue-fs.sh
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index f8c81ca..18b778c 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -1472,6 +1472,10 @@ do_rescue (PedDevice** dev, PedDisk** diskp)
|
|
||||||
disk = ped_disk_new (*dev);
|
|
||||||
if (!disk)
|
|
||||||
goto error;
|
|
||||||
+ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
|
|
||||||
+ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
|
|
||||||
+ 0))
|
|
||||||
+ goto error;
|
|
||||||
|
|
||||||
if (!command_line_get_sector (_("Start?"), *dev, &start, NULL, NULL))
|
|
||||||
goto error_destroy_disk;
|
|
||||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
||||||
index 001b9de..6a06dce 100644
|
|
||||||
--- a/tests/Makefile.am
|
|
||||||
+++ b/tests/Makefile.am
|
|
||||||
@@ -43,6 +43,7 @@ TESTS = \
|
|
||||||
t1102-loop-label.sh \
|
|
||||||
t1104-remove-and-add-partition.sh \
|
|
||||||
t1700-probe-fs.sh \
|
|
||||||
+ t1701-rescue-fs.sh \
|
|
||||||
t2200-dos-label-recog.sh \
|
|
||||||
t2201-pc98-label-recog.sh \
|
|
||||||
t2300-dos-label-extended-bootcode.sh \
|
|
||||||
diff --git a/tests/t1701-rescue-fs.sh b/tests/t1701-rescue-fs.sh
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..9b726cf
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/t1701-rescue-fs.sh
|
|
||||||
@@ -0,0 +1,52 @@
|
|
||||||
+#!/bin/sh
|
|
||||||
+# rescue ext4 file system
|
|
||||||
+
|
|
||||||
+# Copyright (C) 2008-2014 Free Software Foundation, Inc.
|
|
||||||
+
|
|
||||||
+# 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 3 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/>.
|
|
||||||
+
|
|
||||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
+require_512_byte_sector_size_
|
|
||||||
+require_root_
|
|
||||||
+require_scsi_debug_module_
|
|
||||||
+
|
|
||||||
+# create memory-backed device
|
|
||||||
+scsi_debug_setup_ sector_size=$sector_size_ dev_size_mb=32 > dev-name ||
|
|
||||||
+ skip_ 'failed to create scsi_debug device'
|
|
||||||
+scsi_dev=$(cat dev-name)
|
|
||||||
+
|
|
||||||
+( mkfs.ext4 2>&1 | grep -i '^usage' ) > /dev/null \
|
|
||||||
+ || { warn_ "$ME: no ext4 support"; Exit $fail; }
|
|
||||||
+
|
|
||||||
+parted -s $scsi_dev mklabel msdos mkpart primary ext2 1m 100%
|
|
||||||
+mkfs.ext4 ${scsi_dev}1 || { warn_ $ME: mkfs.ext4 failed; fail=1; Exit $fail; }
|
|
||||||
+
|
|
||||||
+# remove the partition
|
|
||||||
+parted -s $scsi_dev rm 1 || fail=1
|
|
||||||
+
|
|
||||||
+# rescue the partition
|
|
||||||
+echo yes | parted ---pretend-input-tty $scsi_dev rescue 1m 100% > out 2>&1
|
|
||||||
+cat > exp <<EOF
|
|
||||||
+Information: A ext4 primary partition was found at 1049kB -> 33.6MB. Do you want to add it to the partition table?
|
|
||||||
+Yes/No/Cancel? yes
|
|
||||||
+Information: You may need to update /etc/fstab.
|
|
||||||
+EOF
|
|
||||||
+# Transform the actual output, to avoid spurious differences when
|
|
||||||
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
|
|
||||||
+# normalize the actual output
|
|
||||||
+mv out o2 && sed -e "s,
*
,,g;s, $,," \
|
|
||||||
+ -e "s,^.*/lt-parted: ,parted: ," o2 > out
|
|
||||||
+echo '' >> exp
|
|
||||||
+compare out exp || fail=1
|
|
||||||
+Exit $fail
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
From ac501e86dd95baa6f426cdd1395f2fe2a9c4e92a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Steven Lang <Steven.Lang@hgst.com>
|
|
||||||
Date: Thu, 8 Jan 2015 17:22:02 -0800
|
|
||||||
Subject: [PATCH 33/36] Use disk geometry as basis for ext2 sector sizes.
|
|
||||||
|
|
||||||
When creating the geom for probed ext2 based filesystems, the
|
|
||||||
size was being reported in 512 byte sectors, regardless of what
|
|
||||||
the actual sector size of the device is.
|
|
||||||
|
|
||||||
(cherry picked from commit d15a596a4436a08b9ad9db35729740b6314d536b)
|
|
||||||
---
|
|
||||||
libparted/fs/ext2/interface.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c
|
|
||||||
index 890a47b..a90c592 100644
|
|
||||||
--- a/libparted/fs/ext2/interface.c
|
|
||||||
+++ b/libparted/fs/ext2/interface.c
|
|
||||||
@@ -41,7 +41,7 @@ _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver)
|
|
||||||
struct ext2_super_block *sb = (struct ext2_super_block *)(sb_v + 1024);
|
|
||||||
|
|
||||||
if (EXT2_SUPER_MAGIC(*sb) == EXT2_SUPER_MAGIC_CONST) {
|
|
||||||
- PedSector block_size = 1 << (EXT2_SUPER_LOG_BLOCK_SIZE(*sb) + 1);
|
|
||||||
+ PedSector block_size = (EXT2_MIN_BLOCK_SIZE << (EXT2_SUPER_LOG_BLOCK_SIZE(*sb))) / geom->dev->sector_size;
|
|
||||||
PedSector block_count = EXT2_SUPER_BLOCKS_COUNT(*sb);
|
|
||||||
PedSector group_blocks = EXT2_SUPER_BLOCKS_PER_GROUP(*sb);
|
|
||||||
PedSector group_nr = EXT2_SUPER_BLOCK_GROUP_NR(*sb);
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From d1d40cda51078a5dd8843d8c54e7e112fa028518 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 29 Feb 2016 16:47:18 -0800
|
|
||||||
Subject: [PATCH 34/36] docs: Add list of filesystems for fs-type (#1311596)
|
|
||||||
|
|
||||||
Add the most common filesystem types to the parted manpage.
|
|
||||||
|
|
||||||
Resolves: rhbz#1311596
|
|
||||||
(cherry picked from commit c9f50a36aee0a4c373b5e1bd3069aeb18fac055d)
|
|
||||||
---
|
|
||||||
doc/C/parted.8 | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
|
||||||
index 5304375..a45f42f 100644
|
|
||||||
--- a/doc/C/parted.8
|
|
||||||
+++ b/doc/C/parted.8
|
|
||||||
@@ -76,6 +76,8 @@ should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac", "msdos",
|
|
||||||
.B mkpart \fIpart-type\fP \fI[fs-type]\fP \fIstart\fP \fIend\fP
|
|
||||||
Make a \fIpart-type\fP partition for filesystem \fIfs-type\fP (if specified),
|
|
||||||
beginning at \fIstart\fP and ending at \fIend\fP (by default in megabytes).
|
|
||||||
+\fIfs-type\fP can be one of "btrfs", "ext2", "ext3", "ext4", "fat16", "fat32",
|
|
||||||
+"hfs", "hfs+", "linux-swap", "ntfs", "reiserfs", or "xfs".
|
|
||||||
\fIpart-type\fP should be one of "primary", "logical", or "extended".
|
|
||||||
.TP
|
|
||||||
.B name \fIpartition\fP \fIname\fP
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,145 +0,0 @@
|
|||||||
From a7d850a3b39b160dcc23e12491cb2cc7c056cd01 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 28 Oct 2015 11:57:22 -0700
|
|
||||||
Subject: [PATCH 35/36] parted: Display details of partition alignment failure
|
|
||||||
(#726856)
|
|
||||||
|
|
||||||
When alignment for a new partition fails it isn't always obvious why it
|
|
||||||
failed. This adds printing the reason for the failure, in the form of:
|
|
||||||
|
|
||||||
start % grain != offset
|
|
||||||
|
|
||||||
This modifies align-check in interactive mode to print the alignment the
|
|
||||||
error details if it isn't aligned. Script mode behavior is unchanged.
|
|
||||||
|
|
||||||
Also cleanup pointer usage and handle asprintf failure by using a constant
|
|
||||||
string in the error report - "unknown (malloc failure)".
|
|
||||||
|
|
||||||
(cherry picked from commit 1726dbb4cd2dc4b19fe8d3c4b94e172fc0bd2c7c)
|
|
||||||
---
|
|
||||||
parted/parted.c | 64 +++++++++++++++++++++++++++++++++++++++++++++------------
|
|
||||||
1 file changed, 51 insertions(+), 13 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index 18b778c..06f9971 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -183,7 +183,8 @@ static TimerContext timer_context;
|
|
||||||
static int _print_list ();
|
|
||||||
static void _done (PedDevice* dev, PedDisk *diskp);
|
|
||||||
static bool partition_align_check (PedDisk const *disk,
|
|
||||||
- PedPartition const *part, enum AlignmentType a_type);
|
|
||||||
+ PedPartition const *part, enum AlignmentType a_type,
|
|
||||||
+ char **align_err);
|
|
||||||
|
|
||||||
static void
|
|
||||||
_timer_handler (PedTimer* timer, void* context)
|
|
||||||
@@ -783,21 +784,27 @@ do_mkpart (PedDevice** dev, PedDisk** diskp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ char *align_err = NULL;
|
|
||||||
if ((alignment == ALIGNMENT_OPTIMAL &&
|
|
||||||
- !partition_align_check(disk, part, PA_OPTIMUM)) ||
|
|
||||||
+ !partition_align_check(disk, part, PA_OPTIMUM, &align_err)) ||
|
|
||||||
(alignment == ALIGNMENT_MINIMAL &&
|
|
||||||
- !partition_align_check(disk, part, PA_MINIMUM))) {
|
|
||||||
+ !partition_align_check(disk, part, PA_MINIMUM, &align_err))) {
|
|
||||||
if (ped_exception_throw(
|
|
||||||
PED_EXCEPTION_WARNING,
|
|
||||||
(opt_script_mode
|
|
||||||
? PED_EXCEPTION_OK
|
|
||||||
: PED_EXCEPTION_IGNORE_CANCEL),
|
|
||||||
_("The resulting partition is not properly "
|
|
||||||
- "aligned for best performance.")) ==
|
|
||||||
+ "aligned for best performance: %s"),
|
|
||||||
+ align_err ? align_err : _("unknown (malloc failed)")) ==
|
|
||||||
PED_EXCEPTION_CANCEL) {
|
|
||||||
+ if (align_err)
|
|
||||||
+ free(align_err);
|
|
||||||
/* undo partition addition */
|
|
||||||
goto error_remove_part;
|
|
||||||
}
|
|
||||||
+ if (align_err)
|
|
||||||
+ free(align_err);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ped_exception_leave_all();
|
|
||||||
@@ -1629,10 +1636,18 @@ do_select (PedDevice** dev, PedDisk** diskp)
|
|
||||||
offset and alignment requirements. Also return true if there is
|
|
||||||
insufficient kernel support to determine DISK's alignment requirements.
|
|
||||||
Otherwise, return false. A_TYPE selects whether to check for minimal
|
|
||||||
- or optimal alignment requirements. */
|
|
||||||
+ or optimal alignment requirements.
|
|
||||||
+
|
|
||||||
+ If align_err is not NULL a string describing why the check failed
|
|
||||||
+ will be allocated and returned. It is up to the caller to free this.
|
|
||||||
+ Pass NULL if no error description is needed.
|
|
||||||
+
|
|
||||||
+ If allocating the error string fails *align_err will be set to NULL, the
|
|
||||||
+ caller should always check for this.
|
|
||||||
+*/
|
|
||||||
static bool
|
|
||||||
partition_align_check (PedDisk const *disk, PedPartition const *part,
|
|
||||||
- enum AlignmentType a_type)
|
|
||||||
+ enum AlignmentType a_type, char **align_err)
|
|
||||||
{
|
|
||||||
PED_ASSERT (part->disk == disk);
|
|
||||||
PedDevice const *dev = disk->dev;
|
|
||||||
@@ -1641,10 +1656,20 @@ partition_align_check (PedDisk const *disk, PedPartition const *part,
|
|
||||||
? ped_device_get_minimum_alignment (dev)
|
|
||||||
: ped_device_get_optimum_alignment (dev));
|
|
||||||
if (pa == NULL)
|
|
||||||
- return true;
|
|
||||||
+ return true;
|
|
||||||
|
|
||||||
PED_ASSERT (pa->grain_size != 0);
|
|
||||||
bool ok = (part->geom.start % pa->grain_size == pa->offset);
|
|
||||||
+
|
|
||||||
+ /* If it isn't aligned and the caller wants an explanation,
|
|
||||||
+ show them the math. */
|
|
||||||
+ if (!ok && align_err) {
|
|
||||||
+ if (asprintf(align_err,
|
|
||||||
+ "%llds %% %llds != %llds",
|
|
||||||
+ part->geom.start, pa->grain_size, pa->offset) < 0) {
|
|
||||||
+ *align_err = NULL;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
free (pa);
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
@@ -1665,12 +1690,25 @@ do_align_check (PedDevice **dev, PedDisk** diskp)
|
|
||||||
if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
- bool aligned = partition_align_check (*diskp, part, align_type);
|
|
||||||
- if (!opt_script_mode)
|
|
||||||
- printf(aligned ? _("%d aligned\n") : _("%d not aligned\n"), part->num);
|
|
||||||
-
|
|
||||||
- if (opt_script_mode)
|
|
||||||
- return aligned ? 1 : 0;
|
|
||||||
+ char *align_err = NULL;
|
|
||||||
+ bool aligned = partition_align_check (*diskp, part, align_type, &align_err);
|
|
||||||
+
|
|
||||||
+ /* Don't print the error in script mode */
|
|
||||||
+ if (opt_script_mode) {
|
|
||||||
+ if (align_err)
|
|
||||||
+ free(align_err);
|
|
||||||
+ return aligned ? 1 : 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (aligned)
|
|
||||||
+ printf(_("%d aligned\n"), part->num);
|
|
||||||
+ else
|
|
||||||
+ printf(_("%d not aligned: %s\n"),
|
|
||||||
+ part->num,
|
|
||||||
+ align_err ? align_err : _("unknown (malloc failed)"));
|
|
||||||
+
|
|
||||||
+ if (align_err)
|
|
||||||
+ free(align_err);
|
|
||||||
|
|
||||||
/* Always return 1 in interactive mode, to be consistent
|
|
||||||
with the other modes. */
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
From 02178bf3980410abdd57c9f1045ff27bc4f11d7e Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 11 Apr 2016 15:10:51 -0700
|
|
||||||
Subject: [PATCH 36/36] libparted: Remove fdasd geometry code from
|
|
||||||
alloc_metadata (#1244833)
|
|
||||||
|
|
||||||
commit db20944f changed how the trailing_metadata_end is calculated in
|
|
||||||
dasd_alloc_metadata, removing the need for setting up the anchor struct.
|
|
||||||
But dasd_alloc_metadata can be called in various contexts, and the
|
|
||||||
arch_specific->fd may or may not be valid during these calls. This can
|
|
||||||
result in unpredictable crashes when it uses a stale fd and tries to run
|
|
||||||
the file image code in fdasd_get_geometry instead of the device code.
|
|
||||||
|
|
||||||
The solution is to just drop the unneeded code, and to remember that
|
|
||||||
arch_specific->fd should only be used when ped_device_open has first
|
|
||||||
been called.
|
|
||||||
|
|
||||||
Resolves: rhbz#1244833
|
|
||||||
(cherry picked from commit 9da2f460bebf9a8281fdd52536d3676b0914b8fd)
|
|
||||||
---
|
|
||||||
libparted/labels/dasd.c | 4 ----
|
|
||||||
1 file changed, 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
|
||||||
index bb32d66..f79a867 100644
|
|
||||||
--- a/libparted/labels/dasd.c
|
|
||||||
+++ b/libparted/labels/dasd.c
|
|
||||||
@@ -948,7 +948,6 @@ dasd_alloc_metadata (PedDisk* disk)
|
|
||||||
PedPartition* part = NULL; /* initialize solely to placate gcc */
|
|
||||||
PedPartition* new_part2;
|
|
||||||
PedSector trailing_meta_start, trailing_meta_end;
|
|
||||||
- struct fdasd_anchor anchor;
|
|
||||||
|
|
||||||
PED_ASSERT (disk != NULL);
|
|
||||||
PED_ASSERT (disk->dev != NULL);
|
|
||||||
@@ -998,10 +997,7 @@ dasd_alloc_metadata (PedDisk* disk)
|
|
||||||
backed up, then restored to a larger size disk, etc.
|
|
||||||
*/
|
|
||||||
trailing_meta_start = part->geom.end + 1;
|
|
||||||
- fdasd_initialize_anchor(&anchor);
|
|
||||||
- fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd);
|
|
||||||
trailing_meta_end = (long long) disk->dev->length - 1;
|
|
||||||
- fdasd_cleanup(&anchor);
|
|
||||||
if (trailing_meta_end >= trailing_meta_start) {
|
|
||||||
new_part2 = ped_partition_new (disk,PED_PARTITION_METADATA,
|
|
||||||
NULL, trailing_meta_start, trailing_meta_end);
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
From 85cec179048914d165e3a11b1d8d8c759725d236 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 6 May 2016 14:39:09 -0700
|
|
||||||
Subject: [PATCH 37/38] libparted: Fix probing AIX disks on other arches
|
|
||||||
|
|
||||||
Not a likely scenario, but make sure the magic check works everywhere.
|
|
||||||
|
|
||||||
(cherry picked from commit 24cd71c0a7c4b2abdfff04be5a088a44ab5df2fe)
|
|
||||||
---
|
|
||||||
libparted/labels/aix.c | 18 +++---------------
|
|
||||||
1 file changed, 3 insertions(+), 15 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c
|
|
||||||
index 0fa6fe7..a831d95 100644
|
|
||||||
--- a/libparted/labels/aix.c
|
|
||||||
+++ b/libparted/labels/aix.c
|
|
||||||
@@ -34,23 +34,11 @@
|
|
||||||
# define _(String) (String)
|
|
||||||
#endif /* ENABLE_NLS */
|
|
||||||
|
|
||||||
-#define AIX_LABEL_MAGIC 0xc9c2d4c1
|
|
||||||
+#define AIX_LABEL_MAGIC (0xc9c2d4c1UL)
|
|
||||||
#define MAX_TOTAL_PART 16
|
|
||||||
|
|
||||||
static PedDiskType aix_disk_type;
|
|
||||||
|
|
||||||
-static inline int
|
|
||||||
-aix_label_magic_get (const char *label)
|
|
||||||
-{
|
|
||||||
- return *(unsigned int *)label;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static inline void
|
|
||||||
-aix_label_magic_set (char *label, int magic_val)
|
|
||||||
-{
|
|
||||||
- *(unsigned int *)label = magic_val;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static int
|
|
||||||
aix_probe (const PedDevice *dev)
|
|
||||||
{
|
|
||||||
@@ -59,9 +47,9 @@ aix_probe (const PedDevice *dev)
|
|
||||||
void *label;
|
|
||||||
if (!ptt_read_sector (dev, 0, &label))
|
|
||||||
return 0;
|
|
||||||
- unsigned int magic = aix_label_magic_get (label);
|
|
||||||
+ bool found = PED_BE32_TO_CPU(*(uint32_t *)label) == AIX_LABEL_MAGIC;
|
|
||||||
free (label);
|
|
||||||
- return magic == AIX_LABEL_MAGIC;
|
|
||||||
+ return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PedDisk*
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From f3cbda4bf581b407586f24c980cf2e5a9cb2b4b2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 25 May 2016 09:00:04 -0700
|
|
||||||
Subject: [PATCH 38/38] partprobe: Open the device once for probing
|
|
||||||
|
|
||||||
Previously there were 3 open/close pairs for the device, which may
|
|
||||||
result in triggering extra udev actions. Instead, open it once at the
|
|
||||||
start of process_dev and close it at the end.
|
|
||||||
---
|
|
||||||
partprobe/partprobe.c | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c
|
|
||||||
index 34997fe..8f2190b 100644
|
|
||||||
--- a/partprobe/partprobe.c
|
|
||||||
+++ b/partprobe/partprobe.c
|
|
||||||
@@ -105,6 +105,9 @@ process_dev (PedDevice* dev)
|
|
||||||
PedDiskType* disk_type;
|
|
||||||
PedDisk* disk;
|
|
||||||
|
|
||||||
+ if (!ped_device_open (dev))
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
disk_type = ped_disk_probe (dev);
|
|
||||||
if (!disk_type) {
|
|
||||||
/* Partition table not found, so create dummy,
|
|
||||||
@@ -128,11 +131,13 @@ process_dev (PedDevice* dev)
|
|
||||||
if (opt_summary)
|
|
||||||
summary (disk);
|
|
||||||
ped_disk_destroy (disk);
|
|
||||||
+ ped_device_close (dev);
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
error_destroy_disk:
|
|
||||||
ped_disk_destroy (disk);
|
|
||||||
error:
|
|
||||||
+ ped_device_close (dev);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
From a5a64f34ca3d64c4da04ed6e870d4c8e469c6098 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Thu, 5 Nov 2015 15:03:54 -0800
|
|
||||||
Subject: [PATCH 39/40] Cleanup mkpart manpage entry (#1183077)
|
|
||||||
|
|
||||||
(cherry picked from commit fa6cd8448f68e6661fb86a8331b44198edd02c9d)
|
|
||||||
---
|
|
||||||
doc/C/parted.8 | 8 ++++----
|
|
||||||
doc/parted.texi | 2 +-
|
|
||||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
|
||||||
index a45f42f..41baa1a 100644
|
|
||||||
--- a/doc/C/parted.8
|
|
||||||
+++ b/doc/C/parted.8
|
|
||||||
@@ -73,12 +73,12 @@ Create a new disklabel (partition table) of \fIlabel-type\fP. \fIlabel-type\fP
|
|
||||||
should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac", "msdos",
|
|
||||||
"pc98", or "sun".
|
|
||||||
.TP
|
|
||||||
-.B mkpart \fIpart-type\fP \fI[fs-type]\fP \fIstart\fP \fIend\fP
|
|
||||||
-Make a \fIpart-type\fP partition for filesystem \fIfs-type\fP (if specified),
|
|
||||||
-beginning at \fIstart\fP and ending at \fIend\fP (by default in megabytes).
|
|
||||||
+.B mkpart [\fIpart-type\fP \fIname\fP \fIfs-type\fP] \fIstart\fP \fIend\fP
|
|
||||||
+Create a new partition. \fIpart-type\fP may be specified only with msdos and
|
|
||||||
+dvh partition tables, it should be one of "primary", "logical", or "extended".
|
|
||||||
+\fIname\fP is required for GPT partition tables and \fIfs-type\fP is optional.
|
|
||||||
\fIfs-type\fP can be one of "btrfs", "ext2", "ext3", "ext4", "fat16", "fat32",
|
|
||||||
"hfs", "hfs+", "linux-swap", "ntfs", "reiserfs", or "xfs".
|
|
||||||
-\fIpart-type\fP should be one of "primary", "logical", or "extended".
|
|
||||||
.TP
|
|
||||||
.B name \fIpartition\fP \fIname\fP
|
|
||||||
Set the name of \fIpartition\fP to \fIname\fP. This option works only on Mac,
|
|
||||||
diff --git a/doc/parted.texi b/doc/parted.texi
|
|
||||||
index 07aa702..c727fb2 100644
|
|
||||||
--- a/doc/parted.texi
|
|
||||||
+++ b/doc/parted.texi
|
|
||||||
@@ -550,7 +550,7 @@ PCs.
|
|
||||||
@cindex mkpart, command description
|
|
||||||
@cindex command description, mkpart
|
|
||||||
|
|
||||||
-@deffn Command mkpart [@var{part-type} @var{fs-type} @var{name}] @var{start} @var{end}
|
|
||||||
+@deffn Command mkpart [@var{part-type} @var{name} @var{fs-type}] @var{start} @var{end}
|
|
||||||
|
|
||||||
Creates a new partition, @emph{without} creating a new file system on
|
|
||||||
that partition. This is useful for creating partitions for file systems
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
From fd311a9367ec342b7d1fa5265f4d2167a29de30d Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 6 Nov 2015 08:56:45 -0800
|
|
||||||
Subject: [PATCH 40/40] doc: Add information about quoting
|
|
||||||
|
|
||||||
Some shells (bash) will strip off the " so it needs to be
|
|
||||||
wrapped in '' to prevent it. eg.
|
|
||||||
|
|
||||||
parted -s ./disk.img mkpart '"EFI System Partition"' 1M 500M
|
|
||||||
|
|
||||||
(cherry picked from commit 8d5e7329a6984614ac9951f376bc77ea7f822ca3)
|
|
||||||
---
|
|
||||||
doc/C/parted.8 | 4 +++-
|
|
||||||
doc/parted.texi | 4 +++-
|
|
||||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
|
||||||
index 41baa1a..eb7cd98 100644
|
|
||||||
--- a/doc/C/parted.8
|
|
||||||
+++ b/doc/C/parted.8
|
|
||||||
@@ -82,7 +82,9 @@ dvh partition tables, it should be one of "primary", "logical", or "extended".
|
|
||||||
.TP
|
|
||||||
.B name \fIpartition\fP \fIname\fP
|
|
||||||
Set the name of \fIpartition\fP to \fIname\fP. This option works only on Mac,
|
|
||||||
-PC98, and GPT disklabels. The name can be placed in quotes, if necessary.
|
|
||||||
+PC98, and GPT disklabels. The name can be placed in double quotes, if necessary.
|
|
||||||
+And depending on the shell may need to also be wrapped in single quotes so that
|
|
||||||
+the shell doesn't strip off the double quotes.
|
|
||||||
.TP
|
|
||||||
.B print
|
|
||||||
Display the partition table.
|
|
||||||
diff --git a/doc/parted.texi b/doc/parted.texi
|
|
||||||
index c727fb2..1b9c084 100644
|
|
||||||
--- a/doc/parted.texi
|
|
||||||
+++ b/doc/parted.texi
|
|
||||||
@@ -628,7 +628,9 @@ $ @kbd{mkfs.vfat /dev/sdX2}
|
|
||||||
@deffn Command name @var{number} @var{name}
|
|
||||||
|
|
||||||
Sets the name for the partition @var{number} (GPT, Mac, MIPS and PC98 only).
|
|
||||||
-The name can be placed in quotes.
|
|
||||||
+The name can be placed in quotes. And depending on the shell may need to also
|
|
||||||
+be wrapped in single quotes so that the shell doesn't strip off the double
|
|
||||||
+quotes.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
From 40270928ff4ac2a87825f47e53c680ffb18b5bc4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Tue, 14 Jun 2016 12:19:40 +0200
|
|
||||||
Subject: [PATCH 41/53] libparted/dasd: correct the offset where the first
|
|
||||||
partition begins
|
|
||||||
|
|
||||||
The start point of first partition must start at least from the third
|
|
||||||
track of DASD, due to the existence of metadata in the first two track.
|
|
||||||
The previous constraint just sets all the device to be partitioned.
|
|
||||||
So when the start point of the first partition start before the third
|
|
||||||
track, (For example if it starts from.0) parted will exit abruptly.
|
|
||||||
And this kind of job must be done with constraint explicitly.
|
|
||||||
|
|
||||||
Then the constraint is modified to exclude the first two tracks and
|
|
||||||
to make the first partition start from the third track by default.
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
(cherry picked from commit 4126d0292c75cf7d50a2f4e9d485a52b5beafccc)
|
|
||||||
---
|
|
||||||
libparted/labels/dasd.c | 8 +++++++-
|
|
||||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
|
||||||
index f79a867..4e68512 100644
|
|
||||||
--- a/libparted/labels/dasd.c
|
|
||||||
+++ b/libparted/labels/dasd.c
|
|
||||||
@@ -829,6 +829,7 @@ _primary_constraint (PedDisk* disk)
|
|
||||||
PedSector sector_size;
|
|
||||||
LinuxSpecific* arch_specific;
|
|
||||||
DasdDiskSpecific* disk_specific;
|
|
||||||
+ PedSector start;
|
|
||||||
|
|
||||||
PDEBUG;
|
|
||||||
|
|
||||||
@@ -842,7 +843,12 @@ _primary_constraint (PedDisk* disk)
|
|
||||||
if (!ped_alignment_init (&end_align, -1,
|
|
||||||
disk->dev->hw_geom.sectors * sector_size))
|
|
||||||
return NULL;
|
|
||||||
- if (!ped_geometry_init (&max_geom, disk->dev, 0, disk->dev->length))
|
|
||||||
+
|
|
||||||
+ start = (FIRST_USABLE_TRK * (long long) disk->dev->hw_geom.sectors
|
|
||||||
+ * (long long) arch_specific->real_sector_size
|
|
||||||
+ / (long long) disk->dev->sector_size);
|
|
||||||
+
|
|
||||||
+ if (!ped_geometry_init (&max_geom, disk->dev, start, disk->dev->length))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return ped_constraint_new(&start_align, &end_align, &max_geom,
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
|||||||
From 797d7b90c677e49552fbe7c526ce849b964e1ffe Mon Sep 17 00:00:00 2001
|
|
||||||
From: Petr Uzel <petr.uzel@suse.cz>
|
|
||||||
Date: Tue, 14 Jun 2016 13:17:00 +0200
|
|
||||||
Subject: [PATCH 42/53] Add support for NVMe devices
|
|
||||||
|
|
||||||
Recognize NVMe Devices, so "parted -s /dev/nvme0n1" now prints
|
|
||||||
"NVMe Device (nvme)" instead of "Model: Unknown (unknown)".
|
|
||||||
|
|
||||||
In order for a device to be recognized as NVMe, it has to
|
|
||||||
have a 'blkext' major number. But since this major can be
|
|
||||||
used also by other device types, we also check the device
|
|
||||||
path contains 'nvme' as a substring.
|
|
||||||
|
|
||||||
* NEWS: Mention the change
|
|
||||||
* include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_NVME
|
|
||||||
* libparted/arch/linux.c(BLKEXT_MAJOR): New define.
|
|
||||||
* libparted/arch/linux.c(_is_blkext_major): New function.
|
|
||||||
* libparted/arch/linux.c(_device_probe_type): Recognize NVMe devices.
|
|
||||||
* libparted/arch/linux.c(linux_new): Handle NVMe devices.
|
|
||||||
* parted/parted.c(do_print): Add "nvme" to list of transports.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
(cherry picked from commit e4ae4330f3e33201aeeed3b7ca88e15d98d03e13)
|
|
||||||
---
|
|
||||||
include/parted/device.in.h | 3 ++-
|
|
||||||
libparted/arch/linux.c | 14 ++++++++++++++
|
|
||||||
parted/parted.c | 2 +-
|
|
||||||
3 files changed, 17 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/parted/device.in.h b/include/parted/device.in.h
|
|
||||||
index 82d4104..d38db44 100644
|
|
||||||
--- a/include/parted/device.in.h
|
|
||||||
+++ b/include/parted/device.in.h
|
|
||||||
@@ -49,7 +49,8 @@ typedef enum {
|
|
||||||
PED_DEVICE_VIRTBLK = 15,
|
|
||||||
PED_DEVICE_AOE = 16,
|
|
||||||
PED_DEVICE_MD = 17,
|
|
||||||
- PED_DEVICE_LOOP = 18
|
|
||||||
+ PED_DEVICE_LOOP = 18,
|
|
||||||
+ PED_DEVICE_NVME = 19
|
|
||||||
} PedDeviceType;
|
|
||||||
|
|
||||||
typedef struct _PedDevice PedDevice;
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index eb01deb..b7ba5de 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -278,6 +278,7 @@ struct blkdev_ioctl_param {
|
|
||||||
#define SDMMC_MAJOR 179
|
|
||||||
#define LOOP_MAJOR 7
|
|
||||||
#define MD_MAJOR 9
|
|
||||||
+#define BLKEXT_MAJOR 259
|
|
||||||
|
|
||||||
#define SCSI_BLK_MAJOR(M) ( \
|
|
||||||
(M) == SCSI_DISK0_MAJOR \
|
|
||||||
@@ -441,6 +442,12 @@ _is_virtblk_major (int major)
|
|
||||||
return _major_type_in_devices (major, "virtblk");
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int
|
|
||||||
+_is_blkext_major (int major)
|
|
||||||
+{
|
|
||||||
+ return _major_type_in_devices (major, "blkext");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#ifdef ENABLE_DEVICE_MAPPER
|
|
||||||
static int
|
|
||||||
_dm_task_run_wait (struct dm_task *task, uint32_t cookie)
|
|
||||||
@@ -692,6 +699,8 @@ _device_probe_type (PedDevice* dev)
|
|
||||||
dev->type = PED_DEVICE_LOOP;
|
|
||||||
} else if (dev_major == MD_MAJOR) {
|
|
||||||
dev->type = PED_DEVICE_MD;
|
|
||||||
+ } else if (_is_blkext_major(dev_major) && dev->path && strstr(dev->path, "nvme")) {
|
|
||||||
+ dev->type = PED_DEVICE_NVME;
|
|
||||||
} else {
|
|
||||||
dev->type = PED_DEVICE_UNKNOWN;
|
|
||||||
}
|
|
||||||
@@ -1465,6 +1474,11 @@ linux_new (const char* path)
|
|
||||||
goto error_free_arch_specific;
|
|
||||||
break;
|
|
||||||
|
|
||||||
+ case PED_DEVICE_NVME:
|
|
||||||
+ if (!init_generic (dev, _("NVMe Device")))
|
|
||||||
+ goto error_free_arch_specific;
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
case PED_DEVICE_ATARAID:
|
|
||||||
if (!init_generic (dev, _("ATARAID Controller")))
|
|
||||||
goto error_free_arch_specific;
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index 06f9971..bd848c3 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -979,7 +979,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp)
|
|
||||||
"cpqarray", "file", "ataraid", "i2o",
|
|
||||||
"ubd", "dasd", "viodasd", "sx8", "dm",
|
|
||||||
"xvd", "sd/mmc", "virtblk", "aoe",
|
|
||||||
- "md", "loopback"};
|
|
||||||
+ "md", "loopback", "nvme"};
|
|
||||||
|
|
||||||
char* start = ped_unit_format (dev, 0);
|
|
||||||
PedUnit default_unit = ped_unit_get_default ();
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
From 22a2fd360f5f0f8e7e522712a6187b1c6ac74ba7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Gareth Randall <gareth.randall@virgin.net>
|
|
||||||
Date: Fri, 30 Sep 2016 10:07:42 -0700
|
|
||||||
Subject: [PATCH 43/53] docs: Improve partition description in parted.texi
|
|
||||||
|
|
||||||
(cherry picked from commit e27ac8ff6706f67817f68246311899bd920b9c88)
|
|
||||||
---
|
|
||||||
doc/parted.texi | 36 +++++++++++++++++++++++++++++++-----
|
|
||||||
1 file changed, 31 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/doc/parted.texi b/doc/parted.texi
|
|
||||||
index 1b9c084..414179d 100644
|
|
||||||
--- a/doc/parted.texi
|
|
||||||
+++ b/doc/parted.texi
|
|
||||||
@@ -291,12 +291,38 @@ or you want to modify a root or boot partition, use GParted Live:
|
|
||||||
@section Introduction to Partitioning
|
|
||||||
@cindex partitioning overview
|
|
||||||
|
|
||||||
-Unfortunately, partitioning your disk is rather complicated. This is
|
|
||||||
-because there are interactions between many different systems that need
|
|
||||||
-to be taken into consideration.
|
|
||||||
+Partitioning is the process of dividing a storage device into local
|
|
||||||
+sections, called partitions, which help organize multiple filesystems
|
|
||||||
+and their associated operating systems.
|
|
||||||
+
|
|
||||||
+A storage device presents itself as a sequence of bytes, numbered
|
|
||||||
+starting from zero and increasing until the maximum capacity of the
|
|
||||||
+device is reached. Bytes are normally read and written a sector at a
|
|
||||||
+time, rather than individually. Each sector contains a fixed number
|
|
||||||
+of bytes, with the number determined by the device.
|
|
||||||
+
|
|
||||||
+@example
|
|
||||||
++------------------------------------------------------------+
|
|
||||||
+| storage device with no partitions |
|
|
||||||
++------------------------------------------------------------+
|
|
||||||
+0 start end
|
|
||||||
+@end example
|
|
||||||
+
|
|
||||||
+In order to store multiple filesystems, a storage device can be divided
|
|
||||||
+up in to multiple partitions. Each partition can be thought of as an
|
|
||||||
+area which contains a real filesystem inside of it. To show where these
|
|
||||||
+partitions are on the device a small table is written at the start,
|
|
||||||
+shown as PT in the diagram below. This table is called a partition
|
|
||||||
+table, or disklabel, and also stores the type of each partition and
|
|
||||||
+some flags.
|
|
||||||
+
|
|
||||||
+@example
|
|
||||||
++--+---------------+----------------+------------------------+
|
|
||||||
+|PT| Partition 1 | Partition 2 | Partition 3 |
|
|
||||||
++--+---------------+----------------+------------------------+
|
|
||||||
+0 start end
|
|
||||||
+@end example
|
|
||||||
|
|
||||||
-This manual used to introduce the reader to these systems and their
|
|
||||||
-working. This content has moved to the GNU Storage Guide.
|
|
||||||
|
|
||||||
@node Running Parted
|
|
||||||
@section Using GNU Parted
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
|||||||
From e4bf9b823452c0b98b394b8abcc67f887b6991b3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Petr Uzel <petr.uzel@suse.cz>
|
|
||||||
Date: Thu, 21 Jul 2016 16:46:46 +0200
|
|
||||||
Subject: [PATCH 44/53] libparted: only IEC units are treated as exact
|
|
||||||
|
|
||||||
If the user specifies start/end of the partition as a unit,
|
|
||||||
whose size happens to be power of two, we treat that as
|
|
||||||
exact address with exact placement.
|
|
||||||
|
|
||||||
Recently, commit 01900e056ec25083 added an exception for
|
|
||||||
percent units.
|
|
||||||
|
|
||||||
This logic however can fail also for cylinders, e.g. on DASD FBA disks,
|
|
||||||
which report CHS=(*, 128, 16) geometry, hence once cylinder is 1 MiB.
|
|
||||||
With cylinders as units, exact placement is not what the user wants.
|
|
||||||
|
|
||||||
Instead of adding cylinders to the blacklist, let's instead
|
|
||||||
whitelist units which should trigger exact placement.
|
|
||||||
|
|
||||||
* libparted/unit.c (is_power_of_2): Remove now unused function.
|
|
||||||
(ped_unit_parse_custom): Specify which units trigger exact placement.
|
|
||||||
* NEWS (Bug Fixes): Mention this.
|
|
||||||
|
|
||||||
(cherry picked from commit f4f38082fc4dbf0c28ccc7613c672fe279d3032e)
|
|
||||||
---
|
|
||||||
libparted/unit.c | 33 +++++++++++++++++----------------
|
|
||||||
1 file changed, 17 insertions(+), 16 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/unit.c b/libparted/unit.c
|
|
||||||
index dddb5db..e47e868 100644
|
|
||||||
--- a/libparted/unit.c
|
|
||||||
+++ b/libparted/unit.c
|
|
||||||
@@ -481,12 +481,6 @@ parse_unit_suffix (const char* suffix, PedUnit suggested_unit)
|
|
||||||
return suggested_unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static bool
|
|
||||||
-is_power_of_2 (long long n)
|
|
||||||
-{
|
|
||||||
- return (n & (n - 1)) == 0;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
/**
|
|
||||||
* If \p str contains a valid description of a location on \p dev, then
|
|
||||||
* \p *sector is modified to describe the location and a geometry is created
|
|
||||||
@@ -540,16 +534,23 @@ ped_unit_parse_custom (const char* str, const PedDevice* dev, PedUnit unit,
|
|
||||||
}
|
|
||||||
|
|
||||||
unit_size = ped_unit_get_size (dev, unit);
|
|
||||||
- radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
|
|
||||||
- if (radius < 0)
|
|
||||||
- radius = 0;
|
|
||||||
- /* If the user specifies units in a power of 2, e.g., 4MiB, as in
|
|
||||||
- parted -s -- $dev mklabel gpt mkpart P-NAME 4MiB -34s
|
|
||||||
- do not use 4MiB as the range. Rather, presume that they
|
|
||||||
- are specifying precisely the starting or ending number,
|
|
||||||
- and treat "4MiB" just as we would treat "4194304B". */
|
|
||||||
- if (is_power_of_2 (unit_size) && unit != PED_UNIT_PERCENT)
|
|
||||||
- radius = 0;
|
|
||||||
+ switch (unit) {
|
|
||||||
+ /* If the user specifies the address using IEC units e.g., 4MiB, as in
|
|
||||||
+ parted -s -- $dev mklabel gpt mkpart P-NAME 4MiB -34s
|
|
||||||
+ do not use size of the unit as the range. Rather, presume that they
|
|
||||||
+ are specifying precisely the starting or ending number,
|
|
||||||
+ and treat "4MiB" just as we would treat "4194304B". */
|
|
||||||
+ case PED_UNIT_KIBIBYTE:
|
|
||||||
+ case PED_UNIT_MEBIBYTE:
|
|
||||||
+ case PED_UNIT_GIBIBYTE:
|
|
||||||
+ case PED_UNIT_TEBIBYTE:
|
|
||||||
+ radius = 0;
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
+ radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
|
|
||||||
+ if (radius < 0)
|
|
||||||
+ radius = 0;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
*sector = num * unit_size / dev->sector_size;
|
|
||||||
/* negative numbers count from the end */
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,188 +0,0 @@
|
|||||||
From 450dbead63306b242e8159c85641698bddf6d19e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:16 +0100
|
|
||||||
Subject: [PATCH 45/53] tests: t3310-flags.sh: Query libparted for all flags to
|
|
||||||
be tested
|
|
||||||
|
|
||||||
Replace scanning the documentation for an incomplete list of flags with
|
|
||||||
querying libparted for the complete list of supported flags via the
|
|
||||||
added helper print-flags.
|
|
||||||
|
|
||||||
Correct $ME -> $ME_ in the warning messages. Improve the warning
|
|
||||||
messages by including the table type and flag name not correctly set or
|
|
||||||
cleared.
|
|
||||||
|
|
||||||
Plus minor changes:
|
|
||||||
(1) use slightly longer variable name primary_or_name;
|
|
||||||
(2) use longer test partition name PTNNAME; and
|
|
||||||
(3) stop shortening parted unit command to u.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
tests/Makefile.am | 3 ++-
|
|
||||||
tests/print-flags.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
tests/t3310-flags.sh | 32 ++++++++++++++++--------------
|
|
||||||
3 files changed, 75 insertions(+), 16 deletions(-)
|
|
||||||
create mode 100644 tests/print-flags.c
|
|
||||||
|
|
||||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
||||||
index 6a06dce..a840304 100644
|
|
||||||
--- a/tests/Makefile.am
|
|
||||||
+++ b/tests/Makefile.am
|
|
||||||
@@ -92,7 +92,8 @@ EXTRA_DIST = \
|
|
||||||
init.cfg init.sh t-lib-helpers.sh gpt-header-munge \
|
|
||||||
gpt-header-move msdos-overlap
|
|
||||||
|
|
||||||
-check_PROGRAMS = print-align print-max dup-clobber duplicate fs-resize
|
|
||||||
+check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \
|
|
||||||
+ fs-resize
|
|
||||||
fs_resize_LDADD = \
|
|
||||||
$(top_builddir)/libparted/fs/libparted-fs-resize.la \
|
|
||||||
$(top_builddir)/libparted/libparted.la
|
|
||||||
diff --git a/tests/print-flags.c b/tests/print-flags.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..3176ca6
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/print-flags.c
|
|
||||||
@@ -0,0 +1,56 @@
|
|
||||||
+/* Print the available flags for a particular partition. */
|
|
||||||
+
|
|
||||||
+#include <config.h>
|
|
||||||
+#include <parted/parted.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include "progname.h"
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+main (int argc, char **argv)
|
|
||||||
+{
|
|
||||||
+ PedDevice *dev;
|
|
||||||
+ PedDisk *disk;
|
|
||||||
+ PedPartition *part;
|
|
||||||
+
|
|
||||||
+ set_program_name (argv[0]);
|
|
||||||
+
|
|
||||||
+ if (argc != 2 ) {
|
|
||||||
+ fprintf (stderr, "Usage: %s <device>\n", argv[0]);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ dev = ped_device_get(argv[1]);
|
|
||||||
+ if (!dev) {
|
|
||||||
+ fprintf (stderr, "Error: failed to create device %s\n",
|
|
||||||
+ argv[1]);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+ if (!ped_device_open (dev)) {
|
|
||||||
+ fprintf (stderr, "Error: failed to open device %s\n", argv[1]);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+ disk = ped_disk_new (dev);
|
|
||||||
+ if (!disk) {
|
|
||||||
+ fprintf (stderr,
|
|
||||||
+ "Error: failed to read partition table from device %s\n",
|
|
||||||
+ argv[1]);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ part = ped_disk_get_partition (disk, 1);
|
|
||||||
+ if (!part) {
|
|
||||||
+ fprintf (stderr,
|
|
||||||
+ "Error: failed to get partition 1 from device %s\n",
|
|
||||||
+ argv[1]);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (PedPartitionFlag flag = PED_PARTITION_FIRST_FLAG;
|
|
||||||
+ flag <= PED_PARTITION_LAST_FLAG; flag++)
|
|
||||||
+ {
|
|
||||||
+ if (ped_partition_is_flag_available (part, flag))
|
|
||||||
+ puts (ped_partition_flag_get_name (flag));
|
|
||||||
+ }
|
|
||||||
+ return EXIT_SUCCESS;
|
|
||||||
+}
|
|
||||||
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
|
||||||
index cb3024a..85a673a 100644
|
|
||||||
--- a/tests/t3310-flags.sh
|
|
||||||
+++ b/tests/t3310-flags.sh
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
#!/bin/sh
|
|
||||||
-# Exercise the exclusive, single-bit flags.
|
|
||||||
+# Exercise partition flags.
|
|
||||||
|
|
||||||
# Copyright (C) 2010-2014 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
@@ -16,35 +16,37 @@
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
-. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted .
|
|
||||||
ss=$sector_size_
|
|
||||||
dev=dev-file
|
|
||||||
|
|
||||||
extract_flags()
|
|
||||||
{
|
|
||||||
- perl -nle '/^1:2048s:4095s:2048s::(?:P1)?:(.+);$/ and print $1' "$@"
|
|
||||||
+ perl -nle '/^1:2048s:4095s:2048s::(?:PTNNAME)?:(.+);$/ and print $1' "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
for table_type in msdos gpt; do
|
|
||||||
|
|
||||||
- # Extract flag names of type $table_type from the texinfo documentation.
|
|
||||||
case $table_type in
|
|
||||||
- msdos) search_term=MS-DOS; pri_or_name=pri;;
|
|
||||||
- gpt) search_term=GPT; pri_or_name=P1;;
|
|
||||||
+ gpt) primary_or_name='PTNNAME'
|
|
||||||
+ ;;
|
|
||||||
+ msdos) primary_or_name='primary'
|
|
||||||
+ ;;
|
|
||||||
esac
|
|
||||||
- flags=$(sed -n '/^@node set/,/^@node/p' \
|
|
||||||
- "$abs_top_srcdir/doc/parted.texi" \
|
|
||||||
- | perl -00 -ne \
|
|
||||||
- '/^\@item (\w+).*'"$search_term"'/s and print lc($1), "\n"')
|
|
||||||
|
|
||||||
n_sectors=5000
|
|
||||||
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
|
|
||||||
|
|
||||||
parted -s $dev mklabel $table_type \
|
|
||||||
- mkpart $pri_or_name ext2 $((1*2048))s $((2*2048-1))s \
|
|
||||||
+ mkpart $primary_or_name ext2 $((1*2048))s $((2*2048-1))s \
|
|
||||||
> out 2> err || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
|
|
||||||
+ # Query libparted for the available flags for this test partition.
|
|
||||||
+ flags=`print-flags $dev` \
|
|
||||||
+ || { warn_ "$ME_: $table_type: failed to get available flags";
|
|
||||||
+ fail=1; continue; }
|
|
||||||
+
|
|
||||||
for mode in on_only on_and_off ; do
|
|
||||||
for flag in $flags; do
|
|
||||||
|
|
||||||
@@ -53,18 +55,18 @@ for table_type in msdos gpt; do
|
|
||||||
case $flag in boot|lba|hidden) continue;; esac
|
|
||||||
|
|
||||||
# Turn on each flag, one at a time.
|
|
||||||
- parted -m -s $dev set 1 $flag on u s print > raw 2> err || fail=1
|
|
||||||
+ parted -m -s $dev set 1 $flag on unit s print > raw 2> err || fail=1
|
|
||||||
extract_flags raw > out
|
|
||||||
grep -F "$flag" out \
|
|
||||||
- || { warn_ "$ME: flag not turned on: $(cat out)"; fail=1; }
|
|
||||||
+ || { warn_ "$ME_: $table_type: flag '$flag' not turned on: $(cat out)"; fail=1; }
|
|
||||||
compare /dev/null err || fail=1
|
|
||||||
|
|
||||||
if test $mode = on_and_off; then
|
|
||||||
# Turn it off
|
|
||||||
- parted -m -s $dev set 1 $flag off u s print > raw 2> err || fail=1
|
|
||||||
+ parted -m -s $dev set 1 $flag off unit s print > raw 2> err || fail=1
|
|
||||||
extract_flags raw > out
|
|
||||||
grep -F "$flag" out \
|
|
||||||
- && { warn_ "$ME: flag not turned off: $(cat out)"; fail=1; }
|
|
||||||
+ && { warn_ "$ME_: $table_type: flag '$flag' not turned off: $(cat out)"; fail=1; }
|
|
||||||
compare /dev/null err || fail=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
From cfcfadac1d61093f900d1903f580818d244479ad Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:17 +0100
|
|
||||||
Subject: [PATCH 46/53] tests: t3310-flags.sh: Stop excluding certain flags
|
|
||||||
from being tested
|
|
||||||
|
|
||||||
Also grep for whole words, grep -w, to avoid flag 'boot' being matched
|
|
||||||
as a substring of flag 'legacy_boot'.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
tests/t3310-flags.sh | 9 ++-------
|
|
||||||
1 file changed, 2 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
|
||||||
index 85a673a..5cbf2da 100644
|
|
||||||
--- a/tests/t3310-flags.sh
|
|
||||||
+++ b/tests/t3310-flags.sh
|
|
||||||
@@ -49,15 +49,10 @@ for table_type in msdos gpt; do
|
|
||||||
|
|
||||||
for mode in on_only on_and_off ; do
|
|
||||||
for flag in $flags; do
|
|
||||||
-
|
|
||||||
- # Exclude the supplemental flags.
|
|
||||||
- # These are not boolean, like the others.
|
|
||||||
- case $flag in boot|lba|hidden) continue;; esac
|
|
||||||
-
|
|
||||||
# Turn on each flag, one at a time.
|
|
||||||
parted -m -s $dev set 1 $flag on unit s print > raw 2> err || fail=1
|
|
||||||
extract_flags raw > out
|
|
||||||
- grep -F "$flag" out \
|
|
||||||
+ grep -w "$flag" out \
|
|
||||||
|| { warn_ "$ME_: $table_type: flag '$flag' not turned on: $(cat out)"; fail=1; }
|
|
||||||
compare /dev/null err || fail=1
|
|
||||||
|
|
||||||
@@ -65,7 +60,7 @@ for table_type in msdos gpt; do
|
|
||||||
# Turn it off
|
|
||||||
parted -m -s $dev set 1 $flag off unit s print > raw 2> err || fail=1
|
|
||||||
extract_flags raw > out
|
|
||||||
- grep -F "$flag" out \
|
|
||||||
+ grep -w "$flag" out \
|
|
||||||
&& { warn_ "$ME_: $table_type: flag '$flag' not turned off: $(cat out)"; fail=1; }
|
|
||||||
compare /dev/null err || fail=1
|
|
||||||
fi
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
From d7bcb49f1313da7deae0ca41ab402980fb3094a4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:18 +0100
|
|
||||||
Subject: [PATCH 47/53] tests: t3310-flags.sh: Add test for bsd table flags
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
tests/t3310-flags.sh | 4 +++-
|
|
||||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
|
||||||
index 5cbf2da..3f80213 100644
|
|
||||||
--- a/tests/t3310-flags.sh
|
|
||||||
+++ b/tests/t3310-flags.sh
|
|
||||||
@@ -25,9 +25,11 @@ extract_flags()
|
|
||||||
perl -nle '/^1:2048s:4095s:2048s::(?:PTNNAME)?:(.+);$/ and print $1' "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
-for table_type in msdos gpt; do
|
|
||||||
+for table_type in bsd gpt msdos; do
|
|
||||||
|
|
||||||
case $table_type in
|
|
||||||
+ bsd) primary_or_name=''
|
|
||||||
+ ;;
|
|
||||||
gpt) primary_or_name='PTNNAME'
|
|
||||||
;;
|
|
||||||
msdos) primary_or_name='primary'
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From fa15f7d65ad76872f9019f34dd2a1db0f678b0f9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:19 +0100
|
|
||||||
Subject: [PATCH 48/53] libparted: Fix to report success when setting lvm flag
|
|
||||||
on bsd table
|
|
||||||
|
|
||||||
bsd_partition_set_flag() was falling through in the lvm flag case and
|
|
||||||
returning failure. Fix this by adding missing return 1 (success) like
|
|
||||||
for the other flags.
|
|
||||||
|
|
||||||
Found as a result of this bug reported by Timo Riikonen:
|
|
||||||
https://bugzilla.gnome.org/show_bug.cgi?id=769831
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/labels/bsd.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
|
|
||||||
index a8525a4..23daea8 100644
|
|
||||||
--- a/libparted/labels/bsd.c
|
|
||||||
+++ b/libparted/labels/bsd.c
|
|
||||||
@@ -488,6 +488,7 @@ bsd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
|
|
||||||
bsd_data->raid = 0;
|
|
||||||
}
|
|
||||||
bsd_data->lvm = state;
|
|
||||||
+ return 1;
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From fe6d1478172071779135001e494afffb993a9068 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:20 +0100
|
|
||||||
Subject: [PATCH 49/53] libparted: Remove commented local variable from
|
|
||||||
bsd_partition_set_flag()
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/labels/bsd.c | 1 -
|
|
||||||
1 file changed, 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
|
|
||||||
index 23daea8..f253a32 100644
|
|
||||||
--- a/libparted/labels/bsd.c
|
|
||||||
+++ b/libparted/labels/bsd.c
|
|
||||||
@@ -464,7 +464,6 @@ bsd_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
|
|
||||||
static int
|
|
||||||
bsd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
|
|
||||||
{
|
|
||||||
-// PedPartition* walk; // since -Werror, this unused variable would break build
|
|
||||||
BSDPartitionData* bsd_data;
|
|
||||||
|
|
||||||
PED_ASSERT (part != NULL);
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,126 +0,0 @@
|
|||||||
From 81b397bbc9eb270ef0b3ed52d40c3a76ecd9ac80 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:21 +0100
|
|
||||||
Subject: [PATCH 50/53] tests: t3310-flags.sh: Add test for mac table flags
|
|
||||||
|
|
||||||
MAC partition table reserves partition 1 for the partition map
|
|
||||||
partition, so the created test partition will be number 2. Adapt
|
|
||||||
accordingly.
|
|
||||||
|
|
||||||
Setting flags 'root' and 'swap' also sets the partition name to 'root'
|
|
||||||
and 'swap' respectively, so no longer match the partition name in
|
|
||||||
extract_flags().
|
|
||||||
|
|
||||||
Don't test lvm and raid flags as they fail to be cleared with a single
|
|
||||||
set off command. See FIXME comment in the test for more details.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
tests/print-flags.c | 12 +++++++-----
|
|
||||||
tests/t3310-flags.sh | 27 ++++++++++++++++++++++-----
|
|
||||||
2 files changed, 29 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/print-flags.c b/tests/print-flags.c
|
|
||||||
index 3176ca6..db088e8 100644
|
|
||||||
--- a/tests/print-flags.c
|
|
||||||
+++ b/tests/print-flags.c
|
|
||||||
@@ -12,11 +12,12 @@ main (int argc, char **argv)
|
|
||||||
PedDevice *dev;
|
|
||||||
PedDisk *disk;
|
|
||||||
PedPartition *part;
|
|
||||||
+ int partnum;
|
|
||||||
|
|
||||||
set_program_name (argv[0]);
|
|
||||||
|
|
||||||
- if (argc != 2 ) {
|
|
||||||
- fprintf (stderr, "Usage: %s <device>\n", argv[0]);
|
|
||||||
+ if (argc != 3 ) {
|
|
||||||
+ fprintf (stderr, "Usage: %s <device> <ptnnum>\n", argv[0]);
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -38,11 +39,12 @@ main (int argc, char **argv)
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
- part = ped_disk_get_partition (disk, 1);
|
|
||||||
+ partnum = atoi (argv[2]);
|
|
||||||
+ part = ped_disk_get_partition (disk, partnum);
|
|
||||||
if (!part) {
|
|
||||||
fprintf (stderr,
|
|
||||||
- "Error: failed to get partition 1 from device %s\n",
|
|
||||||
- argv[1]);
|
|
||||||
+ "Error: failed to get partition %d from device %s\n",
|
|
||||||
+ partnum, argv[1]);
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
|
||||||
index 3f80213..672160d 100644
|
|
||||||
--- a/tests/t3310-flags.sh
|
|
||||||
+++ b/tests/t3310-flags.sh
|
|
||||||
@@ -22,16 +22,22 @@ dev=dev-file
|
|
||||||
|
|
||||||
extract_flags()
|
|
||||||
{
|
|
||||||
- perl -nle '/^1:2048s:4095s:2048s::(?:PTNNAME)?:(.+);$/ and print $1' "$@"
|
|
||||||
+ perl -nle '/^[^:]*:2048s:4095s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
-for table_type in bsd gpt msdos; do
|
|
||||||
+for table_type in bsd gpt mac msdos; do
|
|
||||||
+ ptn_num=1
|
|
||||||
|
|
||||||
case $table_type in
|
|
||||||
bsd) primary_or_name=''
|
|
||||||
;;
|
|
||||||
gpt) primary_or_name='PTNNAME'
|
|
||||||
;;
|
|
||||||
+ mac) primary_or_name='PTNNAME'
|
|
||||||
+ # MAC table has the partition map partition as the first
|
|
||||||
+ # partition so the created test partition will be number 2.
|
|
||||||
+ ptn_num=2
|
|
||||||
+ ;;
|
|
||||||
msdos) primary_or_name='primary'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -45,14 +51,25 @@ for table_type in bsd gpt msdos; do
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
|
|
||||||
# Query libparted for the available flags for this test partition.
|
|
||||||
- flags=`print-flags $dev` \
|
|
||||||
+ flags=`print-flags $dev $ptn_num` \
|
|
||||||
|| { warn_ "$ME_: $table_type: failed to get available flags";
|
|
||||||
fail=1; continue; }
|
|
||||||
+ case $table_type in
|
|
||||||
+ mac) # FIXME: Setting root or swap flags also sets the partition
|
|
||||||
+ # name to root or swap respectively. Probably intended
|
|
||||||
+ # behaviour. Setting lvm or raid flags after root or swap
|
|
||||||
+ # takes two goes to clear the lvm or raid flag. Is this
|
|
||||||
+ # intended? For now don't test lvm or raid flags as this
|
|
||||||
+ # test only tries to clear the flags once which causes this
|
|
||||||
+ # test to fail.
|
|
||||||
+ flags=`echo "$flags" | egrep -v 'lvm|raid'`
|
|
||||||
+ ;;
|
|
||||||
+ esac
|
|
||||||
|
|
||||||
for mode in on_only on_and_off ; do
|
|
||||||
for flag in $flags; do
|
|
||||||
# Turn on each flag, one at a time.
|
|
||||||
- parted -m -s $dev set 1 $flag on unit s print > raw 2> err || fail=1
|
|
||||||
+ parted -m -s $dev set $ptn_num $flag on unit s print > raw 2> err || fail=1
|
|
||||||
extract_flags raw > out
|
|
||||||
grep -w "$flag" out \
|
|
||||||
|| { warn_ "$ME_: $table_type: flag '$flag' not turned on: $(cat out)"; fail=1; }
|
|
||||||
@@ -60,7 +77,7 @@ for table_type in bsd gpt msdos; do
|
|
||||||
|
|
||||||
if test $mode = on_and_off; then
|
|
||||||
# Turn it off
|
|
||||||
- parted -m -s $dev set 1 $flag off unit s print > raw 2> err || fail=1
|
|
||||||
+ parted -m -s $dev set $ptn_num $flag off unit s print > raw 2> err || fail=1
|
|
||||||
extract_flags raw > out
|
|
||||||
grep -w "$flag" out \
|
|
||||||
&& { warn_ "$ME_: $table_type: flag '$flag' not turned off: $(cat out)"; fail=1; }
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
From 797dbba3bb86178e17ccac46d3619936f75df1d4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:22 +0100
|
|
||||||
Subject: [PATCH 51/53] tests: t3310-flags.sh: Add test for dvh table flags
|
|
||||||
|
|
||||||
DVH table reserves the first 4 MiB for the volume header information so
|
|
||||||
move the created test partition to immediately after that.
|
|
||||||
|
|
||||||
Exclude testing the boot flag as that can only be set on logical
|
|
||||||
partitions and this test script only uses primary partitions so far.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
tests/t3310-flags.sh | 15 +++++++++++----
|
|
||||||
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
|
||||||
index 672160d..e449589 100644
|
|
||||||
--- a/tests/t3310-flags.sh
|
|
||||||
+++ b/tests/t3310-flags.sh
|
|
||||||
@@ -22,15 +22,17 @@ dev=dev-file
|
|
||||||
|
|
||||||
extract_flags()
|
|
||||||
{
|
|
||||||
- perl -nle '/^[^:]*:2048s:4095s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
|
||||||
+ perl -nle '/^[^:]*:4096s:6143s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
-for table_type in bsd gpt mac msdos; do
|
|
||||||
+for table_type in bsd dvh gpt mac msdos; do
|
|
||||||
ptn_num=1
|
|
||||||
|
|
||||||
case $table_type in
|
|
||||||
bsd) primary_or_name=''
|
|
||||||
;;
|
|
||||||
+ dvh) primary_or_name='primary'
|
|
||||||
+ ;;
|
|
||||||
gpt) primary_or_name='PTNNAME'
|
|
||||||
;;
|
|
||||||
mac) primary_or_name='PTNNAME'
|
|
||||||
@@ -42,11 +44,11 @@ for table_type in bsd gpt mac msdos; do
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
- n_sectors=5000
|
|
||||||
+ n_sectors=8192
|
|
||||||
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
|
|
||||||
|
|
||||||
parted -s $dev mklabel $table_type \
|
|
||||||
- mkpart $primary_or_name ext2 $((1*2048))s $((2*2048-1))s \
|
|
||||||
+ mkpart $primary_or_name ext2 $((4*1024))s $((6*1024-1))s \
|
|
||||||
> out 2> err || fail=1
|
|
||||||
compare /dev/null out || fail=1
|
|
||||||
|
|
||||||
@@ -55,6 +57,11 @@ for table_type in bsd gpt mac msdos; do
|
|
||||||
|| { warn_ "$ME_: $table_type: failed to get available flags";
|
|
||||||
fail=1; continue; }
|
|
||||||
case $table_type in
|
|
||||||
+ dvh) # FIXME: Exclude boot flag as that can only be set on logical
|
|
||||||
+ # partitions in the DVH disk label and this test only uses
|
|
||||||
+ # primary partitions.
|
|
||||||
+ flags=`echo "$flags" | egrep -v 'boot'`
|
|
||||||
+ ;;
|
|
||||||
mac) # FIXME: Setting root or swap flags also sets the partition
|
|
||||||
# name to root or swap respectively. Probably intended
|
|
||||||
# behaviour. Setting lvm or raid flags after root or swap
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
From 1bd5c463377b0e54dc3bed840906a8df37bf6f7e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
||||||
Date: Sat, 1 Oct 2016 16:40:23 +0100
|
|
||||||
Subject: [PATCH 52/53] tests: t3310-flags.sh: Add tests for remaining table
|
|
||||||
types
|
|
||||||
|
|
||||||
Add test of flags for remaining table types: aix, amiga, pc98, sun and
|
|
||||||
loop. Note that support of writing AIX tables is not yet implemented in
|
|
||||||
parted and LOOP tables don't support partitions nor flags.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
tests/t3310-flags.sh | 16 +++++++++++++++-
|
|
||||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
|
||||||
index e449589..e97c3b9 100644
|
|
||||||
--- a/tests/t3310-flags.sh
|
|
||||||
+++ b/tests/t3310-flags.sh
|
|
||||||
@@ -25,10 +25,16 @@ extract_flags()
|
|
||||||
perl -nle '/^[^:]*:4096s:6143s:2048s::[^:]*:(.+);$/ and print $1' "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
-for table_type in bsd dvh gpt mac msdos; do
|
|
||||||
+for table_type in aix amiga bsd dvh gpt mac msdos pc98 sun loop; do
|
|
||||||
ptn_num=1
|
|
||||||
|
|
||||||
case $table_type in
|
|
||||||
+ aix) # Support for writing AIX disk labels and adding partitions
|
|
||||||
+ # is not yet implemented.
|
|
||||||
+ continue
|
|
||||||
+ ;;
|
|
||||||
+ amiga) primary_or_name='PTNNAME'
|
|
||||||
+ ;;
|
|
||||||
bsd) primary_or_name=''
|
|
||||||
;;
|
|
||||||
dvh) primary_or_name='primary'
|
|
||||||
@@ -42,6 +48,14 @@ for table_type in bsd dvh gpt mac msdos; do
|
|
||||||
;;
|
|
||||||
msdos) primary_or_name='primary'
|
|
||||||
;;
|
|
||||||
+ pc98) primary_or_name='PTNNAME'
|
|
||||||
+ ;;
|
|
||||||
+ sun) primary_or_name=''
|
|
||||||
+ ;;
|
|
||||||
+ loop) # LOOP table doesn't support creation of a partition nor any
|
|
||||||
+ # flags.
|
|
||||||
+ continue
|
|
||||||
+ ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
n_sectors=8192
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From a5f1b41b0a10fc1dc64f17b677ddf14e15f8d40e Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Tue, 23 Aug 2016 08:55:18 -0700
|
|
||||||
Subject: [PATCH 53/53] tests: Set optimal blocks to 64 for scsi_debug devices
|
|
||||||
|
|
||||||
The Linux kernel 4.5 changed the optimal blocks count from 64 to 1024
|
|
||||||
This causes tests using scsi_debug devices to fail because of alignment
|
|
||||||
issues. Set the opt_blks to 64 so that we have consistent behavior
|
|
||||||
across kernels.
|
|
||||||
|
|
||||||
(cherry picked from commit bd2664285e4014d2d4c80cee3e87609272e1fca9)
|
|
||||||
---
|
|
||||||
tests/t-local.sh | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t-local.sh b/tests/t-local.sh
|
|
||||||
index a7d5226..13073d2 100644
|
|
||||||
--- a/tests/t-local.sh
|
|
||||||
+++ b/tests/t-local.sh
|
|
||||||
@@ -98,7 +98,7 @@ scsi_debug_setup_()
|
|
||||||
# It is not trivial to determine the name of the device we're creating.
|
|
||||||
# Record the names of all /sys/block/sd* devices *before* probing:
|
|
||||||
touch stamp
|
|
||||||
- modprobe scsi_debug "$@" || { rm -f stamp; return 1; }
|
|
||||||
+ modprobe scsi_debug opt_blks=64 "$@" || { rm -f stamp; return 1; }
|
|
||||||
scsi_debug_modprobe_succeeded_=1
|
|
||||||
test "$VERBOSE" = yes \
|
|
||||||
&& echo $ME_ modprobe scsi_debug succeeded 1>&2
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
From a6ba22e539ae5836326703cf4e6d549f6628b861 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Tue, 4 Oct 2016 16:11:25 -0700
|
|
||||||
Subject: [PATCH] tests: t3310-flags.sh skip pc98 when sector size != 512
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/t3310-flags.sh | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
|
|
||||||
index e97c3b9..10ac50d 100644
|
|
||||||
--- a/tests/t3310-flags.sh
|
|
||||||
+++ b/tests/t3310-flags.sh
|
|
||||||
@@ -49,6 +49,8 @@ for table_type in aix amiga bsd dvh gpt mac msdos pc98 sun loop; do
|
|
||||||
msdos) primary_or_name='primary'
|
|
||||||
;;
|
|
||||||
pc98) primary_or_name='PTNNAME'
|
|
||||||
+ # pc98 only supports 512b sectors
|
|
||||||
+ [ $ss -ne 512 ] && continue
|
|
||||||
;;
|
|
||||||
sun) primary_or_name=''
|
|
||||||
;;
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
|||||||
From 582d7cddcda260684d2bca7265294dc651bcb091 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 29 Feb 2016 16:54:05 -0800
|
|
||||||
Subject: [PATCH 55/75] tests: Stop timing t9040 (#1172675)
|
|
||||||
|
|
||||||
parted doesn't have any control over how long this takes, there is no
|
|
||||||
reason to consider this a parted bug if it takes longer than expected.
|
|
||||||
|
|
||||||
Resolves: rhbz#1172675
|
|
||||||
(cherry picked from commit fdd2e12b504c1d8a7829055cf8195d4aae4cd708)
|
|
||||||
---
|
|
||||||
tests/t9040-many-partitions.sh | 10 ----------
|
|
||||||
1 file changed, 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
|
|
||||||
index a3af5e7..4f58658 100644
|
|
||||||
--- a/tests/t9040-many-partitions.sh
|
|
||||||
+++ b/tests/t9040-many-partitions.sh
|
|
||||||
@@ -53,9 +53,7 @@ while :; do
|
|
||||||
done
|
|
||||||
|
|
||||||
# Time the actual command:
|
|
||||||
-t0=$(date +%s.%N)
|
|
||||||
parted -m -a min -s $scsi_dev mklabel gpt $cmd u s p > out 2>&1 || fail=1
|
|
||||||
-t_final=$(date +%s.%N)
|
|
||||||
|
|
||||||
i=1
|
|
||||||
while :; do
|
|
||||||
@@ -64,14 +62,6 @@ while :; do
|
|
||||||
printf "$i:${s}s:${e}s:${partition_sectors}s::p$i:;\n" >> exp
|
|
||||||
test $i = $n_partitions && break; i=$((i+1))
|
|
||||||
done
|
|
||||||
-
|
|
||||||
-# Fail the test if it takes too long.
|
|
||||||
-# On Fedora 16, this takes about 10 seconds for me.
|
|
||||||
-# With Fedora-12-era kernels, it typically took more than 150 seconds.
|
|
||||||
-$AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 < d;"\
|
|
||||||
-' printf "created %d partitions in %.2f seconds\n", n, d; exit st }' /dev/null \
|
|
||||||
- || fail=1
|
|
||||||
-
|
|
||||||
compare exp out || fail=1
|
|
||||||
|
|
||||||
Exit $fail
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From ef6a998695636d81d7d24ad8ae7405b03bf75c2f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Petr Uzel <petr.uzel@suse.cz>
|
|
||||||
Date: Thu, 10 Mar 2016 14:18:52 +0100
|
|
||||||
Subject: [PATCH 56/75] libparted: Fix starting CHS in protective MBR
|
|
||||||
|
|
||||||
The CHS address for protective partition start in protective MBR
|
|
||||||
should be 0/0/2, according to UEFI spec (v2.6, section 5.2.1).
|
|
||||||
|
|
||||||
* libparted/labels/gpt.c (_write_pmbr): Fix starting CHS address
|
|
||||||
|
|
||||||
Reported by Steffen Winterfeldt in https://bugzilla.suse.com/969165
|
|
||||||
|
|
||||||
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
|
|
||||||
---
|
|
||||||
libparted/labels/gpt.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
|
||||||
index d69377a..6027eb3 100644
|
|
||||||
--- a/libparted/labels/gpt.c
|
|
||||||
+++ b/libparted/labels/gpt.c
|
|
||||||
@@ -1139,7 +1139,7 @@ _write_pmbr (PedDevice *dev, bool pmbr_boot)
|
|
||||||
|
|
||||||
pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE);
|
|
||||||
pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
|
|
||||||
- pmbr->PartitionRecord[0].StartSector = 1;
|
|
||||||
+ pmbr->PartitionRecord[0].StartSector = 2;
|
|
||||||
pmbr->PartitionRecord[0].EndHead = 0xFE;
|
|
||||||
pmbr->PartitionRecord[0].EndSector = 0xFF;
|
|
||||||
pmbr->PartitionRecord[0].EndTrack = 0xFF;
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From a6612fb6dd3746cfc9138ebc84210945a8fffa10 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sebastian Parschauer <sparschauer@suse.de>
|
|
||||||
Date: Tue, 4 Oct 2016 11:37:30 +0200
|
|
||||||
Subject: [PATCH 57/75] libparted: Don't warn if no HDIO_GET_IDENTITY ioctl
|
|
||||||
|
|
||||||
Fully virtualized Xen VMs (HVM) use Linux IDE devices which don't
|
|
||||||
support the HDIO_GET_IDENTITY ioctl. EINVAL is returned, a warning
|
|
||||||
is printed and the device model is set to "Generic IDE" in that
|
|
||||||
case. The problem is seeing the warning all the time. So drop it
|
|
||||||
for this case.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 7 ++++++-
|
|
||||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index b7ba5de..2058697 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -931,6 +931,7 @@ init_ide (PedDevice* dev)
|
|
||||||
PedExceptionOption ex_status;
|
|
||||||
char hdi_buf[41];
|
|
||||||
int sector_multiplier = 0;
|
|
||||||
+ int r;
|
|
||||||
|
|
||||||
if (!_device_stat (dev, &dev_stat))
|
|
||||||
goto error;
|
|
||||||
@@ -938,7 +939,11 @@ init_ide (PedDevice* dev)
|
|
||||||
if (!_device_open_ro (dev))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
- if (ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi)) {
|
|
||||||
+ r = ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi);
|
|
||||||
+ if (r && errno == EINVAL) {
|
|
||||||
+ /* silently ignore unsupported ioctl */
|
|
||||||
+ dev->model = strdup(_("Generic IDE"));
|
|
||||||
+ } else if (r) {
|
|
||||||
ex_status = ped_exception_throw (
|
|
||||||
PED_EXCEPTION_WARNING,
|
|
||||||
PED_EXCEPTION_IGNORE_CANCEL,
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,272 +0,0 @@
|
|||||||
From ebb6eef20792a17388da30f1c312ede4b03140fd Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Wed, 26 Oct 2016 04:22:46 +0200
|
|
||||||
Subject: [PATCH 58/75] libparted/dasd: unify vtoc handling for cdl/ldl
|
|
||||||
|
|
||||||
Merge volume label cdl and ldl. It is convenient to manipulate
|
|
||||||
the same structure. Also remove unused arguments in the functions.
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
include/parted/vtoc.in.h | 34 +++++++++++++++++++---------------
|
|
||||||
libparted/labels/dasd.c | 8 +++-----
|
|
||||||
libparted/labels/vtoc.c | 38 +++++++++++++++++---------------------
|
|
||||||
3 files changed, 39 insertions(+), 41 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/parted/vtoc.in.h b/include/parted/vtoc.in.h
|
|
||||||
index 499c2d3..b9da23a 100644
|
|
||||||
--- a/include/parted/vtoc.in.h
|
|
||||||
+++ b/include/parted/vtoc.in.h
|
|
||||||
@@ -62,7 +62,6 @@ typedef struct cchh cchh_t;
|
|
||||||
typedef struct labeldate labeldate_t;
|
|
||||||
typedef struct volume_label volume_label_t;
|
|
||||||
typedef struct cms_volume_label cms_volume_label_t;
|
|
||||||
-typedef struct ldl_volume_label ldl_volume_label_t;
|
|
||||||
typedef struct extent extent_t;
|
|
||||||
typedef struct dev_const dev_const_t;
|
|
||||||
typedef struct format1_label format1_label_t;
|
|
||||||
@@ -94,6 +93,19 @@ struct __attribute__ ((packed)) labeldate {
|
|
||||||
u_int16_t day;
|
|
||||||
};
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * The following structure is a merger of the cdl and ldl volume label.
|
|
||||||
+ * On an ldl disk there is no key information, so when reading an
|
|
||||||
+ * ldl label from disk, the data should be copied at the address of vollbl.
|
|
||||||
+ * On the other side, the field ldl_version is reserved in a cdl record
|
|
||||||
+ * and the field formatted_blocks exists only for ldl labels. So when
|
|
||||||
+ * reading a cdl label from disk, the formatted_blocks field will contain
|
|
||||||
+ * arbitrary data.
|
|
||||||
+ * This layout may be a bit awkward, but the advantage of having the
|
|
||||||
+ * same label type for both disk layout types is bigger than the effort
|
|
||||||
+ * for taking a bit of extra care at the fringes.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
struct __attribute__ ((packed)) volume_label {
|
|
||||||
char volkey[4]; /* volume key = volume label */
|
|
||||||
char vollbl[4]; /* volume label ("VOL1" in EBCDIC) */
|
|
||||||
@@ -107,15 +119,8 @@ struct __attribute__ ((packed)) volume_label {
|
|
||||||
char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */
|
|
||||||
char res2[4]; /* reserved */
|
|
||||||
char lvtoc[14]; /* owner code for LVTOC */
|
|
||||||
- char res3[29]; /* reserved */
|
|
||||||
- char fudge[4]; /* filler to match length of ldl label */
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-struct __attribute__ ((packed)) ldl_volume_label {
|
|
||||||
- char vollbl[4]; /* Label identifier ("LNX1" in EBCDIC) */
|
|
||||||
- char volid[6]; /* Volume identifier */
|
|
||||||
- char res3[69]; /* Reserved field */
|
|
||||||
- char ldl_version[1]; /* Version number, valid for ldl format */
|
|
||||||
+ char res3[28]; /* reserved */
|
|
||||||
+ char ldl_version; /* version number, valid for ldl format */
|
|
||||||
u_int64_t formatted_blocks; /* valid when ldl_version >= "2" (in
|
|
||||||
EBCDIC) */
|
|
||||||
};
|
|
||||||
@@ -335,11 +340,10 @@ void vtoc_write_label (int fd, unsigned long position,
|
|
||||||
format7_label_t const *f7,
|
|
||||||
format9_label_t const *f9);
|
|
||||||
|
|
||||||
-void vtoc_init_format1_label (char *volid, unsigned int blksize,
|
|
||||||
+void vtoc_init_format1_label (unsigned int blksize,
|
|
||||||
extent_t *part_extent, format1_label_t *f1);
|
|
||||||
|
|
||||||
void vtoc_init_format4_label (format4_label_t *f4lbl,
|
|
||||||
- unsigned int usable_partitions,
|
|
||||||
unsigned int compat_cylinders,
|
|
||||||
unsigned int real_cylinders,
|
|
||||||
unsigned int tracks,
|
|
||||||
@@ -352,11 +356,11 @@ void vtoc_update_format4_label (format4_label_t *f4, cchhb_t *highest_f1,
|
|
||||||
|
|
||||||
void vtoc_init_format5_label (format5_label_t *f5);
|
|
||||||
|
|
||||||
-void vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl,
|
|
||||||
+void vtoc_update_format5_label_add (format5_label_t *f5, int verbose,
|
|
||||||
int trk, u_int16_t a, u_int16_t b,
|
|
||||||
u_int8_t c);
|
|
||||||
|
|
||||||
-void vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl,
|
|
||||||
+void vtoc_update_format5_label_del (format5_label_t *f5, int verbose,
|
|
||||||
int trk, u_int16_t a, u_int16_t b,
|
|
||||||
u_int8_t c);
|
|
||||||
|
|
||||||
@@ -368,7 +372,7 @@ void vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
|
|
||||||
void vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
|
|
||||||
u_int32_t a, u_int32_t b);
|
|
||||||
|
|
||||||
-void vtoc_init_format8_label (char *volid, unsigned int blksize,
|
|
||||||
+void vtoc_init_format8_label (unsigned int blksize,
|
|
||||||
extent_t *part_extent, format1_label_t *f1);
|
|
||||||
|
|
||||||
void vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8);
|
|
||||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
|
||||||
index 4e68512..7594e96 100644
|
|
||||||
--- a/libparted/labels/dasd.c
|
|
||||||
+++ b/libparted/labels/dasd.c
|
|
||||||
@@ -330,13 +330,12 @@ dasd_read (PedDisk* disk)
|
|
||||||
DasdPartitionData* dasd_data;
|
|
||||||
|
|
||||||
union vollabel {
|
|
||||||
- volume_label_t unused;
|
|
||||||
- ldl_volume_label_t ldl;
|
|
||||||
+ volume_label_t ldl;
|
|
||||||
cms_volume_label_t cms;
|
|
||||||
};
|
|
||||||
union vollabel *cms_ptr1 = (union vollabel *) anchor.vlabel;
|
|
||||||
cms_volume_label_t *cms_ptr = &cms_ptr1->cms;
|
|
||||||
- ldl_volume_label_t *ldl_ptr = &cms_ptr1->ldl;
|
|
||||||
+ volume_label_t *ldl_ptr = &cms_ptr1->ldl;
|
|
||||||
int partition_start_block;
|
|
||||||
|
|
||||||
disk_specific->format_type = 1;
|
|
||||||
@@ -360,8 +359,7 @@ dasd_read (PedDisk* disk)
|
|
||||||
* (long long) cms_ptr->disk_offset;
|
|
||||||
|
|
||||||
if (is_ldl)
|
|
||||||
- if (strncmp(ldl_ptr->ldl_version,
|
|
||||||
- vtoc_ebcdic_enc("2", str, 1), 1) >= 0)
|
|
||||||
+ if (ldl_ptr->ldl_version >= 0xf2)
|
|
||||||
end = (long long) arch_specific->real_sector_size
|
|
||||||
/ (long long) disk->dev->sector_size
|
|
||||||
* (long long) ldl_ptr->formatted_blocks - 1;
|
|
||||||
diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c
|
|
||||||
index fdfa94f..d47b791 100644
|
|
||||||
--- a/libparted/labels/vtoc.c
|
|
||||||
+++ b/libparted/labels/vtoc.c
|
|
||||||
@@ -150,7 +150,7 @@ enum failure {
|
|
||||||
unable_to_read
|
|
||||||
};
|
|
||||||
|
|
||||||
-static char buffer[89];
|
|
||||||
+static char buffer[93];
|
|
||||||
|
|
||||||
static void
|
|
||||||
vtoc_error (enum failure why, char const *s1, char const *s2)
|
|
||||||
@@ -329,7 +329,7 @@ void
|
|
||||||
vtoc_volume_label_init (volume_label_t *vlabel)
|
|
||||||
{
|
|
||||||
PDEBUG
|
|
||||||
- sprintf(buffer, "%88s", " ");
|
|
||||||
+ sprintf(buffer, "%92s", " ");
|
|
||||||
vtoc_ebcdic_enc(buffer, buffer, sizeof *vlabel);
|
|
||||||
memcpy(vlabel, buffer, sizeof *vlabel);
|
|
||||||
}
|
|
||||||
@@ -348,8 +348,8 @@ vtoc_read_volume_label (int f, unsigned long vlabel_start,
|
|
||||||
typedef union vollabel vollabel_t;
|
|
||||||
|
|
||||||
union __attribute__((packed)) vollabel {
|
|
||||||
+ /* cdl and ldl have the same data struct */
|
|
||||||
volume_label_t cdl;
|
|
||||||
- ldl_volume_label_t ldl;
|
|
||||||
cms_volume_label_t cms;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -373,9 +373,7 @@ vtoc_read_volume_label (int f, unsigned long vlabel_start,
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = read(f, vlabel, sizeof(volume_label_t));
|
|
||||||
- if (rc != sizeof(volume_label_t) &&
|
|
||||||
- /* For CDL we ask to read 88 bytes, but only get 84 */
|
|
||||||
- rc != sizeof(volume_label_t) - 4) {
|
|
||||||
+ if (rc != sizeof(volume_label_t)) {
|
|
||||||
vtoc_error(unable_to_read, "vtoc_read_volume_label",
|
|
||||||
_("Could not read volume label."));
|
|
||||||
return 1;
|
|
||||||
@@ -427,10 +425,8 @@ vtoc_write_volume_label (int f, unsigned long vlabel_start,
|
|
||||||
vtoc_error(unable_to_seek, "vtoc_write_volume_label",
|
|
||||||
_("Could not write volume label."));
|
|
||||||
|
|
||||||
- rc = write(f, vlabel, sizeof(volume_label_t) - 4);
|
|
||||||
- /* Subtract 4 to leave off the "fudge" variable when writing.
|
|
||||||
- We only write CDL volume labels, never LDL or CMS. */
|
|
||||||
- if (rc != sizeof(volume_label_t) - 4)
|
|
||||||
+ rc = write(f, vlabel, sizeof(volume_label_t));
|
|
||||||
+ if (rc != sizeof(volume_label_t))
|
|
||||||
vtoc_error(unable_to_write, "vtoc_write_volume_label",
|
|
||||||
_("Could not write volume label."));
|
|
||||||
|
|
||||||
@@ -632,7 +628,7 @@ vtoc_write_label (int f, unsigned long position,
|
|
||||||
* initializes a format4 label
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
-vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions,
|
|
||||||
+vtoc_init_format4_label (format4_label_t *f4,
|
|
||||||
unsigned int compat_cylinders,
|
|
||||||
unsigned int real_cylinders, unsigned int tracks,
|
|
||||||
unsigned int blocks, unsigned int blksize,
|
|
||||||
@@ -740,7 +736,7 @@ vtoc_init_format7_label (format7_label_t *f7)
|
|
||||||
* format1 or format 8 label, all but the field DS1FMTID
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
-vtoc_init_format_1_8_label (char *volid, unsigned int blksize,
|
|
||||||
+vtoc_init_format_1_8_label (unsigned int blksize,
|
|
||||||
extent_t *part_extent, format1_label_t *f1)
|
|
||||||
{
|
|
||||||
PDEBUG
|
|
||||||
@@ -794,18 +790,18 @@ vtoc_init_format_1_8_label (char *volid, unsigned int blksize,
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
-vtoc_init_format1_label (char *volid, unsigned int blksize,
|
|
||||||
+vtoc_init_format1_label (unsigned int blksize,
|
|
||||||
extent_t *part_extent, format1_label_t *f1)
|
|
||||||
{
|
|
||||||
- vtoc_init_format_1_8_label(volid, blksize, part_extent, f1);
|
|
||||||
+ vtoc_init_format_1_8_label(blksize, part_extent, f1);
|
|
||||||
f1->DS1FMTID = 0xf1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
-vtoc_init_format8_label (char *volid, unsigned int blksize,
|
|
||||||
+vtoc_init_format8_label (unsigned int blksize,
|
|
||||||
extent_t *part_extent, format1_label_t *f8)
|
|
||||||
{
|
|
||||||
- vtoc_init_format_1_8_label(volid, blksize, part_extent, f8);
|
|
||||||
+ vtoc_init_format_1_8_label(blksize, part_extent, f8);
|
|
||||||
f8->DS1FMTID = 0xf8;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -886,7 +882,7 @@ vtoc_reorganize_FMT5_extents (format5_label_t *f5)
|
|
||||||
* add a free space extent description to the VTOC FMT5 DSCB
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
-vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl,
|
|
||||||
+vtoc_update_format5_label_add (format5_label_t *f5, int verbose,
|
|
||||||
int trk, u_int16_t a, u_int16_t b, u_int8_t c)
|
|
||||||
{
|
|
||||||
PDEBUG
|
|
||||||
@@ -974,7 +970,7 @@ vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl,
|
|
||||||
* remove a free space extent description from the VTOC FMT5 DSCB
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
-vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl,
|
|
||||||
+vtoc_update_format5_label_del (format5_label_t *f5, int verbose,
|
|
||||||
int trk, u_int16_t a, u_int16_t b, u_int8_t c)
|
|
||||||
{
|
|
||||||
PDEBUG
|
|
||||||
@@ -1054,7 +1050,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl,
|
|
||||||
ext->ft = (a - ext->t) % trk;
|
|
||||||
|
|
||||||
vtoc_update_format5_label_add(f5, verbose,
|
|
||||||
- cyl, trk, x, y, z);
|
|
||||||
+ trk, x, y, z);
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
puts ("FMT5 del extent: 2 pieces");
|
|
||||||
@@ -1322,9 +1318,9 @@ vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5,
|
|
||||||
z = (u_int8_t) ((stop - start + 1) % trk);
|
|
||||||
|
|
||||||
if (ch == '+')
|
|
||||||
- vtoc_update_format5_label_add(f5, verbose, cyl, trk, x, y, z);
|
|
||||||
+ vtoc_update_format5_label_add(f5, verbose, trk, x, y, z);
|
|
||||||
else if (ch == '-')
|
|
||||||
- vtoc_update_format5_label_del(f5, verbose, cyl, trk, x, y, z);
|
|
||||||
+ vtoc_update_format5_label_del(f5, verbose, trk, x, y, z);
|
|
||||||
else
|
|
||||||
puts ("BUG: syntax error in vtoc_set_freespace call");
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,208 +0,0 @@
|
|||||||
From 1666d22aa8a044d57797d2f4c7f5448d5ef9606c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Wed, 26 Oct 2016 04:22:47 +0200
|
|
||||||
Subject: [PATCH 59/75] libparted/dasd: update and improve fdasd functions
|
|
||||||
|
|
||||||
Update the fdasd_anchor_t data structure and the fdasd_cleanup()
|
|
||||||
function. Also correct vtoc_changed and vlabel_changed accounting
|
|
||||||
because they are important to rewrite vtoc to save the changes.
|
|
||||||
|
|
||||||
Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
include/parted/fdasd.in.h | 14 +++++-------
|
|
||||||
libparted/labels/fdasd.c | 56 ++++++++++++++++++++++++-----------------------
|
|
||||||
2 files changed, 35 insertions(+), 35 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
|
|
||||||
index 4e351c4..09a35a0 100644
|
|
||||||
--- a/include/parted/fdasd.in.h
|
|
||||||
+++ b/include/parted/fdasd.in.h
|
|
||||||
@@ -186,6 +186,7 @@ typedef struct format_data_t {
|
|
||||||
/*****************************************************************************
|
|
||||||
* SECTION: Further IOCTL Definitions (see fs.h) *
|
|
||||||
*****************************************************************************/
|
|
||||||
+#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
|
|
||||||
/* re-read partition table */
|
|
||||||
#define BLKRRPART _IO(0x12,95)
|
|
||||||
/* get block device sector size */
|
|
||||||
@@ -198,15 +199,14 @@ typedef struct format_data_t {
|
|
||||||
/*****************************************************************************
|
|
||||||
* SECTION: FDASD internal types *
|
|
||||||
*****************************************************************************/
|
|
||||||
+#define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
|
|
||||||
+#define USABLE_PARTITIONS ((1 << DASD_PARTN_BITS) - 1)
|
|
||||||
|
|
||||||
#define DASD_MIN_API_VERSION 0
|
|
||||||
|
|
||||||
#define DEFAULT_FDASD_CONF "/etc/fdasd.conf" /* default config file */
|
|
||||||
|
|
||||||
-#define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
|
|
||||||
-#define USABLE_PARTITIONS ((1 << DASD_PARTN_BITS) - 1)
|
|
||||||
-
|
|
||||||
-#define FDASD_VERSION "1.05"
|
|
||||||
+#define FDASD_VERSION "1.32.0"
|
|
||||||
#define DEVICE "device"
|
|
||||||
#define DISC "disc"
|
|
||||||
#define PART "part"
|
|
||||||
@@ -233,9 +233,6 @@ typedef struct config_data {
|
|
||||||
typedef struct fdasd_anchor {
|
|
||||||
int vlabel_changed;
|
|
||||||
int vtoc_changed;
|
|
||||||
- int devname_specified;
|
|
||||||
- int volid_specified;
|
|
||||||
- int config_specified;
|
|
||||||
int auto_partition;
|
|
||||||
int print_table;
|
|
||||||
int big_disk;
|
|
||||||
@@ -282,7 +279,8 @@ enum fdasd_failure {
|
|
||||||
vlabel_corrupted,
|
|
||||||
dsname_corrupted,
|
|
||||||
malloc_failed,
|
|
||||||
- device_verification_failed
|
|
||||||
+ device_verification_failed,
|
|
||||||
+ volser_not_found
|
|
||||||
};
|
|
||||||
|
|
||||||
void fdasd_cleanup (fdasd_anchor_t *anchor);
|
|
||||||
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
|
|
||||||
index 968b332..e5df5cf 100644
|
|
||||||
--- a/libparted/labels/fdasd.c
|
|
||||||
+++ b/libparted/labels/fdasd.c
|
|
||||||
@@ -106,28 +106,26 @@ fdasd_cleanup (fdasd_anchor_t *anchor)
|
|
||||||
{
|
|
||||||
PDEBUG
|
|
||||||
int i;
|
|
||||||
- partition_info_t *p, *q;
|
|
||||||
+ partition_info_t *part_info, *next;
|
|
||||||
|
|
||||||
if (anchor == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
- free(anchor->f4);
|
|
||||||
- free(anchor->f5);
|
|
||||||
- free(anchor->f7);
|
|
||||||
- free(anchor->f9);
|
|
||||||
- free(anchor->vlabel);
|
|
||||||
-
|
|
||||||
- p = anchor->first;
|
|
||||||
- if (p == NULL)
|
|
||||||
- return;
|
|
||||||
-
|
|
||||||
- for (i=1; i <= USABLE_PARTITIONS; i++) {
|
|
||||||
- if (p == NULL)
|
|
||||||
- return;
|
|
||||||
- q = p->next;
|
|
||||||
- free(p->f1);
|
|
||||||
- free(p);
|
|
||||||
- p = q;
|
|
||||||
+ if (anchor->f4 != NULL)
|
|
||||||
+ free(anchor->f4);
|
|
||||||
+ if (anchor->f5 != NULL)
|
|
||||||
+ free(anchor->f5);
|
|
||||||
+ if (anchor->f7 != NULL)
|
|
||||||
+ free(anchor->f7);
|
|
||||||
+ if (anchor->vlabel != NULL)
|
|
||||||
+ free(anchor->vlabel);
|
|
||||||
+
|
|
||||||
+ part_info = anchor->first;
|
|
||||||
+ for (i = 1; i <= USABLE_PARTITIONS && part_info != NULL; i++) {
|
|
||||||
+ next = part_info->next;
|
|
||||||
+ free(part_info->f1);
|
|
||||||
+ free(part_info);
|
|
||||||
+ part_info = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -190,6 +188,9 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char const *str)
|
|
||||||
_("Device verification failed"),
|
|
||||||
_("The specified device is not a valid DASD device"));
|
|
||||||
break;
|
|
||||||
+ case volser_not_found:
|
|
||||||
+ sprintf(error, "fdasd: %s -- %s\n", _("VOLSER not found on device"), str);
|
|
||||||
+ break;
|
|
||||||
default:
|
|
||||||
sprintf(error, "fdasd: %s: %s\n", _("Fatal error"), str);
|
|
||||||
}
|
|
||||||
@@ -287,7 +288,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd)
|
|
||||||
PDEBUG
|
|
||||||
partition_info_t *p;
|
|
||||||
unsigned long b, maxblk;
|
|
||||||
- char dsno[6], s1[7], s2[45], *c1, *c2, *ch;
|
|
||||||
+ char dsno[6], s1[VOLSER_LENGTH + 1], s2[45], *c1, *c2, *ch;
|
|
||||||
int i = 0, k = 0;
|
|
||||||
cchhb_t f9addr;
|
|
||||||
format1_label_t emptyf1;
|
|
||||||
@@ -519,7 +520,6 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc)
|
|
||||||
int i;
|
|
||||||
|
|
||||||
vtoc_init_format4_label(anc->f4,
|
|
||||||
- USABLE_PARTITIONS,
|
|
||||||
anc->geo.cylinders,
|
|
||||||
anc->formatted_cylinders,
|
|
||||||
anc->geo.heads,
|
|
||||||
@@ -767,7 +767,7 @@ fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc)
|
|
||||||
anc->formatted_cylinders = anc->hw_cylinders;
|
|
||||||
anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
|
|
||||||
- FIRST_USABLE_TRK;
|
|
||||||
- vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
|
|
||||||
+ vtoc_init_format4_label(anc->f4,
|
|
||||||
anc->geo.cylinders, anc->formatted_cylinders,
|
|
||||||
anc->geo.heads, anc->geo.sectors,
|
|
||||||
anc->blksize, anc->dev_type);
|
|
||||||
@@ -781,6 +781,8 @@ fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc)
|
|
||||||
anc->formatted_cylinders, anc->geo.heads);
|
|
||||||
|
|
||||||
vtoc_set_cchhb(&anc->vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01);
|
|
||||||
+ anc->vtoc_changed++;
|
|
||||||
+ anc->vlabel_changed++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ -792,7 +794,7 @@ fdasd_process_invalid_vtoc(fdasd_anchor_t *anc)
|
|
||||||
anc->formatted_cylinders = anc->hw_cylinders;
|
|
||||||
anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
|
|
||||||
- FIRST_USABLE_TRK;
|
|
||||||
- vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
|
|
||||||
+ vtoc_init_format4_label(anc->f4,
|
|
||||||
anc->geo.cylinders, anc->formatted_cylinders,
|
|
||||||
anc->geo.heads, anc->geo.sectors,
|
|
||||||
anc->blksize, anc->dev_type);
|
|
||||||
@@ -803,6 +805,8 @@ fdasd_process_invalid_vtoc(fdasd_anchor_t *anc)
|
|
||||||
FIRST_USABLE_TRK,
|
|
||||||
anc->formatted_cylinders * anc->geo.heads - 1,
|
|
||||||
anc->formatted_cylinders, anc->geo.heads);
|
|
||||||
+
|
|
||||||
+ anc->vtoc_changed++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -875,7 +879,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd)
|
|
||||||
|
|
||||||
fdasd_init_volume_label(anc, fd);
|
|
||||||
|
|
||||||
- vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
|
|
||||||
+ vtoc_init_format4_label(anc->f4,
|
|
||||||
anc->geo.cylinders, anc->formatted_cylinders,
|
|
||||||
anc->geo.heads, anc->geo.sectors,
|
|
||||||
anc->blksize, anc->dev_type);
|
|
||||||
@@ -1286,12 +1290,10 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start,
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (anc->formatted_cylinders > LV_COMPAT_CYL) {
|
|
||||||
- vtoc_init_format8_label(anc->vlabel->volid, anc->blksize, &ext,
|
|
||||||
- p->f1);
|
|
||||||
+ vtoc_init_format8_label(anc->blksize, &ext, p->f1);
|
|
||||||
} else {
|
|
||||||
PDEBUG;
|
|
||||||
- vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext,
|
|
||||||
- p->f1);
|
|
||||||
+ vtoc_init_format1_label(anc->blksize, &ext, p->f1);
|
|
||||||
}
|
|
||||||
|
|
||||||
PDEBUG;
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,171 +0,0 @@
|
|||||||
From 3267b55ff764840cf267fd1e02fa467e4d87d388 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Wed, 26 Oct 2016 04:22:48 +0200
|
|
||||||
Subject: [PATCH 60/75] libparted/dasd: add new fdasd functions
|
|
||||||
|
|
||||||
Introduce a set of new functions from the fdasd utility of the s390-tools
|
|
||||||
to keep the code base in parted and s390-tools in sync.
|
|
||||||
|
|
||||||
These new functions are:
|
|
||||||
fdasd_check_volser(): validate the volser input
|
|
||||||
fdasd_get_volser(): get volume serial (volser)
|
|
||||||
fdasd_change_volser(): change volser with string
|
|
||||||
fdasd_reuse_vtoc(): re-create vtoc labels based on the existing vtoc
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
include/parted/fdasd.in.h | 4 ++
|
|
||||||
libparted/labels/fdasd.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 127 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
|
|
||||||
index 09a35a0..9e5d7d1 100644
|
|
||||||
--- a/include/parted/fdasd.in.h
|
|
||||||
+++ b/include/parted/fdasd.in.h
|
|
||||||
@@ -293,5 +293,9 @@ void fdasd_recreate_vtoc(fdasd_anchor_t *anc);
|
|
||||||
partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc,
|
|
||||||
unsigned int start, unsigned int stop);
|
|
||||||
int fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) ;
|
|
||||||
+void fdasd_check_volser(char *volser, int devno);
|
|
||||||
+int fdasd_get_volser(fdasd_anchor_t *anc, char *volser, int fd);
|
|
||||||
+void fdasd_change_volser(fdasd_anchor_t *anc, char *str);
|
|
||||||
+void fdasd_reuse_vtoc(fdasd_anchor_t *anc);
|
|
||||||
|
|
||||||
#endif /* FDASD_H */
|
|
||||||
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
|
|
||||||
index e5df5cf..713ed6b 100644
|
|
||||||
--- a/libparted/labels/fdasd.c
|
|
||||||
+++ b/libparted/labels/fdasd.c
|
|
||||||
@@ -1320,4 +1320,127 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start,
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * Check for valid volume serial characters (max. 6) - remove invalid.
|
|
||||||
+ * If volser is empty, fill with default volser.
|
|
||||||
+ */
|
|
||||||
+void fdasd_check_volser (char *volser, int devno)
|
|
||||||
+{
|
|
||||||
+ int from, to;
|
|
||||||
+
|
|
||||||
+ for (from = 0, to = 0; volser[from] && from < VOLSER_LENGTH; from++) {
|
|
||||||
+
|
|
||||||
+ if ((volser[from] >= 0x23 &&
|
|
||||||
+ volser[from] <= 0x25) ||
|
|
||||||
+ (volser[from] >= 0x30 &&
|
|
||||||
+ volser[from] <= 0x39) ||
|
|
||||||
+ (volser[from] >= 0x40 &&
|
|
||||||
+ volser[from] <= 0x5a) ||
|
|
||||||
+ (volser[from] >= 0x61 &&
|
|
||||||
+ volser[from] <= 0x7a))
|
|
||||||
+ volser[to++] = toupper(volser[from]);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ volser[to] = 0x00;
|
|
||||||
+
|
|
||||||
+ if (volser[0] == 0x00)
|
|
||||||
+ sprintf(volser, "0X%04x", devno);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * get volser from vtoc
|
|
||||||
+ */
|
|
||||||
+int fdasd_get_volser (fdasd_anchor_t *anc, char *volser, int fd)
|
|
||||||
+{
|
|
||||||
+ volume_label_t vlabel;
|
|
||||||
+
|
|
||||||
+ vtoc_read_volume_label(fd, anc->label_pos, &vlabel);
|
|
||||||
+ vtoc_volume_label_get_volser(&vlabel, volser);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Changes the volume serial (menu option)
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+void fdasd_change_volser (fdasd_anchor_t *anc, char *str)
|
|
||||||
+{
|
|
||||||
+ fdasd_check_volser(str, anc->devno);
|
|
||||||
+ vtoc_volume_label_set_volser(anc->vlabel, str);
|
|
||||||
+
|
|
||||||
+ vtoc_set_cchhb(&anc->vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01);
|
|
||||||
+ anc->vlabel_changed++;
|
|
||||||
+ anc->vtoc_changed++;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * re-create all VTOC labels, but use the partition information
|
|
||||||
+ * from existing VTOC
|
|
||||||
+ */
|
|
||||||
+void fdasd_reuse_vtoc (fdasd_anchor_t *anc)
|
|
||||||
+{
|
|
||||||
+ partition_info_t *part_info = anc->first;
|
|
||||||
+ struct fdasd_hd_geometry geo = anc->geo;
|
|
||||||
+ format1_label_t f1;
|
|
||||||
+ format4_label_t f4;
|
|
||||||
+ format5_label_t f5;
|
|
||||||
+ format7_label_t f7;
|
|
||||||
+
|
|
||||||
+ vtoc_init_format4_label(&f4, geo.cylinders, anc->formatted_cylinders,
|
|
||||||
+ geo.heads, geo.sectors,
|
|
||||||
+ anc->blksize, anc->dev_type);
|
|
||||||
+
|
|
||||||
+ /* reuse some FMT4 values */
|
|
||||||
+ f4.DS4HPCHR = anc->f4->DS4HPCHR;
|
|
||||||
+ f4.DS4DSREC = anc->f4->DS4DSREC;
|
|
||||||
+
|
|
||||||
+ /* re-initialize both free-space labels */
|
|
||||||
+ vtoc_init_format5_label(&f5);
|
|
||||||
+ vtoc_init_format7_label(&f7);
|
|
||||||
+
|
|
||||||
+ if (anc->fspace_trk > 0)
|
|
||||||
+ vtoc_set_freespace(&f4, &f5, &f7, '+', anc->verbose,
|
|
||||||
+ FIRST_USABLE_TRK,
|
|
||||||
+ FIRST_USABLE_TRK + anc->fspace_trk - 1,
|
|
||||||
+ anc->formatted_cylinders, geo.heads);
|
|
||||||
+
|
|
||||||
+ while (part_info != NULL) {
|
|
||||||
+ if (part_info->used != 0x01) {
|
|
||||||
+ part_info = part_info->next;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (anc->formatted_cylinders > LV_COMPAT_CYL)
|
|
||||||
+ vtoc_init_format8_label(anc->blksize,
|
|
||||||
+ &part_info->f1->DS1EXT1, &f1);
|
|
||||||
+ else
|
|
||||||
+ vtoc_init_format1_label(anc->blksize,
|
|
||||||
+ &part_info->f1->DS1EXT1, &f1);
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ strncpy(f1.DS1DSNAM, part_info->f1->DS1DSNAM, 44);
|
|
||||||
+ strncpy((char *)f1.DS1DSSN, (char *)part_info->f1->DS1DSSN, 6);
|
|
||||||
+ f1.DS1CREDT = part_info->f1->DS1CREDT;
|
|
||||||
+
|
|
||||||
+ memcpy(part_info->f1, &f1, sizeof(format1_label_t));
|
|
||||||
+
|
|
||||||
+ if (part_info->fspace_trk > 0)
|
|
||||||
+ vtoc_set_freespace(&f4, &f5, &f7, '+', anc->verbose,
|
|
||||||
+ part_info->end_trk + 1,
|
|
||||||
+ part_info->end_trk +
|
|
||||||
+ part_info->fspace_trk,
|
|
||||||
+ anc->formatted_cylinders, geo.heads);
|
|
||||||
+
|
|
||||||
+ part_info = part_info->next;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* over-write old labels with new ones */
|
|
||||||
+ memcpy(anc->f4, &f4, sizeof(format4_label_t));
|
|
||||||
+ memcpy(anc->f5, &f5, sizeof(format5_label_t));
|
|
||||||
+ memcpy(anc->f7, &f7, sizeof(format7_label_t));
|
|
||||||
+
|
|
||||||
+ anc->vtoc_changed++;
|
|
||||||
+
|
|
||||||
+ return;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* vim:set tabstop=4 shiftwidth=4 softtabstop=4: */
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 6872c0d2fd2038b366cc8086588a272465d6a553 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Wed, 26 Oct 2016 04:22:49 +0200
|
|
||||||
Subject: [PATCH 61/75] libparted/dasd: add test cases for the new fdasd
|
|
||||||
functions
|
|
||||||
|
|
||||||
The test case uses a temporary file in libparted/tests under
|
|
||||||
Check framwork. It can be issued by "make check" in the test dir.
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/tests/Makefile.am | 5 +++--
|
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
|
|
||||||
index c7c10a9..9689fb3 100644
|
|
||||||
--- a/libparted/tests/Makefile.am
|
|
||||||
+++ b/libparted/tests/Makefile.am
|
|
||||||
@@ -3,9 +3,9 @@
|
|
||||||
#
|
|
||||||
# This file may be modified and/or distributed without restriction.
|
|
||||||
|
|
||||||
-TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh
|
|
||||||
+TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh
|
|
||||||
EXTRA_DIST = $(TESTS)
|
|
||||||
-check_PROGRAMS = label disk zerolen symlink
|
|
||||||
+check_PROGRAMS = label disk zerolen symlink volser
|
|
||||||
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
|
||||||
|
|
||||||
LDADD = \
|
|
||||||
@@ -23,6 +23,7 @@ label_SOURCES = common.h common.c label.c
|
|
||||||
disk_SOURCES = common.h common.c disk.c
|
|
||||||
zerolen_SOURCES = common.h common.c zerolen.c
|
|
||||||
symlink_SOURCES = common.h common.c symlink.c
|
|
||||||
+volser_SOURCES = common.h common.c volser.c
|
|
||||||
|
|
||||||
# Arrange to symlink to tests/init.sh.
|
|
||||||
CLEANFILES = init.sh
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,202 +0,0 @@
|
|||||||
From f209b71efc693b97b7c812678e811698ffd2bc79 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Arvin Schnell <aschnell@suse.com>
|
|
||||||
Date: Thu, 22 Dec 2016 14:36:43 -0800
|
|
||||||
Subject: [PATCH 62/75] libparted: set swap flag on GPT partitions
|
|
||||||
|
|
||||||
The filesystem type is still detected as befor, but now setting the
|
|
||||||
'swap' flag will set the partition GUID to PARTITION_SWAP_GUID.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/labels/gpt.c | 42 +++++++++++++++++++++++++++++++++++++++---
|
|
||||||
1 file changed, 39 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
|
||||||
index 6027eb3..4f922b2 100644
|
|
||||||
--- a/libparted/labels/gpt.c
|
|
||||||
+++ b/libparted/labels/gpt.c
|
|
||||||
@@ -290,6 +290,7 @@ typedef struct _GPTPartitionData
|
|
||||||
efi_char16_t name[37];
|
|
||||||
char *translated_name;
|
|
||||||
int lvm;
|
|
||||||
+ int swap;
|
|
||||||
int raid;
|
|
||||||
int boot;
|
|
||||||
int bios_grub;
|
|
||||||
@@ -818,7 +819,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
|
|
||||||
gpt_part_data->name[i] = 0;
|
|
||||||
gpt_part_data->translated_name = 0;
|
|
||||||
|
|
||||||
- gpt_part_data->lvm = gpt_part_data->raid
|
|
||||||
+ gpt_part_data->lvm = gpt_part_data->swap
|
|
||||||
+ = 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
|
|
||||||
@@ -841,6 +843,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
|
|
||||||
gpt_part_data->raid = 1;
|
|
||||||
else if (!guid_cmp (gpt_part_data->type, PARTITION_LVM_GUID))
|
|
||||||
gpt_part_data->lvm = 1;
|
|
||||||
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_SWAP_GUID))
|
|
||||||
+ gpt_part_data->swap = 1;
|
|
||||||
else if (!guid_cmp (gpt_part_data->type, PARTITION_HPSERVICE_GUID))
|
|
||||||
gpt_part_data->hp_service = 1;
|
|
||||||
else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
|
|
||||||
@@ -1361,6 +1365,7 @@ gpt_partition_new (const PedDisk *disk,
|
|
||||||
|
|
||||||
gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
|
|
||||||
gpt_part_data->lvm = 0;
|
|
||||||
+ gpt_part_data->swap = 0;
|
|
||||||
gpt_part_data->raid = 0;
|
|
||||||
gpt_part_data->boot = 0;
|
|
||||||
gpt_part_data->bios_grub = 0;
|
|
||||||
@@ -1449,6 +1454,11 @@ gpt_partition_set_system (PedPartition *part,
|
|
||||||
gpt_part_data->type = PARTITION_LVM_GUID;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
+ if (gpt_part_data->swap)
|
|
||||||
+ {
|
|
||||||
+ gpt_part_data->type = PARTITION_SWAP_GUID;
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
if (gpt_part_data->raid)
|
|
||||||
{
|
|
||||||
gpt_part_data->type = PARTITION_RAID_GUID;
|
|
||||||
@@ -1636,6 +1646,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
if (state)
|
|
||||||
gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
@@ -1650,6 +1661,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
if (state)
|
|
||||||
gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->boot
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
@@ -1664,6 +1676,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
if (state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
@@ -1677,6 +1690,22 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->lvm = state;
|
|
||||||
if (state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
+ = gpt_part_data->raid
|
|
||||||
+ = 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->prep
|
|
||||||
+ = gpt_part_data->irst
|
|
||||||
+ = gpt_part_data->atvrecv = 0;
|
|
||||||
+ return gpt_partition_set_system (part, part->fs_type);
|
|
||||||
+ case PED_PARTITION_SWAP:
|
|
||||||
+ gpt_part_data->swap = state;
|
|
||||||
+ if (state)
|
|
||||||
+ gpt_part_data->boot
|
|
||||||
+ = gpt_part_data->lvm
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
@@ -1693,6 +1722,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
= gpt_part_data->msftdata
|
|
||||||
@@ -1707,6 +1737,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftdata
|
|
||||||
@@ -1721,6 +1752,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
@@ -1739,6 +1771,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftdata
|
|
||||||
@@ -1753,6 +1786,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
@@ -1766,6 +1800,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
@@ -1779,6 +1814,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
gpt_part_data->boot
|
|
||||||
= gpt_part_data->raid
|
|
||||||
= gpt_part_data->lvm
|
|
||||||
+ = gpt_part_data->swap
|
|
||||||
= gpt_part_data->bios_grub
|
|
||||||
= gpt_part_data->hp_service
|
|
||||||
= gpt_part_data->msftres
|
|
||||||
@@ -1793,7 +1829,6 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
||||||
case PED_PARTITION_LEGACY_BOOT:
|
|
||||||
gpt_part_data->legacy_boot = state;
|
|
||||||
return 1;
|
|
||||||
- case PED_PARTITION_SWAP:
|
|
||||||
case PED_PARTITION_ROOT:
|
|
||||||
case PED_PARTITION_LBA:
|
|
||||||
default:
|
|
||||||
@@ -1839,6 +1874,7 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
|
|
||||||
case PED_PARTITION_IRST:
|
|
||||||
return gpt_part_data->irst;
|
|
||||||
case PED_PARTITION_SWAP:
|
|
||||||
+ return gpt_part_data->swap;
|
|
||||||
case PED_PARTITION_LBA:
|
|
||||||
case PED_PARTITION_ROOT:
|
|
||||||
default:
|
|
||||||
@@ -1855,6 +1891,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
|
|
||||||
{
|
|
||||||
case PED_PARTITION_RAID:
|
|
||||||
case PED_PARTITION_LVM:
|
|
||||||
+ case PED_PARTITION_SWAP:
|
|
||||||
case PED_PARTITION_BOOT:
|
|
||||||
case PED_PARTITION_BIOS_GRUB:
|
|
||||||
case PED_PARTITION_HPSERVICE:
|
|
||||||
@@ -1868,7 +1905,6 @@ gpt_partition_is_flag_available (const PedPartition *part,
|
|
||||||
case PED_PARTITION_IRST:
|
|
||||||
case PED_PARTITION_ESP:
|
|
||||||
return 1;
|
|
||||||
- case PED_PARTITION_SWAP:
|
|
||||||
case PED_PARTITION_ROOT:
|
|
||||||
case PED_PARTITION_LBA:
|
|
||||||
default:
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 3228fcc714347701f48034288b5fa98c6bb0a50d Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Thu, 22 Dec 2016 16:59:27 -0800
|
|
||||||
Subject: [PATCH 63/75] tests: Update t0220 and t0280 for the swap flag.
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/t0220-gpt-msftres.sh | 6 +++++-
|
|
||||||
tests/t0280-gpt-corrupt.sh | 2 +-
|
|
||||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
|
|
||||||
index 79518ae..6721a47 100755
|
|
||||||
--- a/tests/t0220-gpt-msftres.sh
|
|
||||||
+++ b/tests/t0220-gpt-msftres.sh
|
|
||||||
@@ -56,7 +56,11 @@ 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)
|
|
||||||
- case $type in fat*|NTFS) flag=msftdata;; *) flag=;; esac
|
|
||||||
+ case $type in
|
|
||||||
+ fat*|NTFS) flag=msftdata;;
|
|
||||||
+ linux-swap) flag=swap;;
|
|
||||||
+ *) 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
|
|
||||||
diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
|
|
||||||
index a7c8d82..1b4d86b 100755
|
|
||||||
--- a/tests/t0280-gpt-corrupt.sh
|
|
||||||
+++ b/tests/t0280-gpt-corrupt.sh
|
|
||||||
@@ -89,7 +89,7 @@ compare exp err || fail=1
|
|
||||||
parted -m -s $dev u s print > out 2>&1 || fail=1
|
|
||||||
|
|
||||||
# check for expected output
|
|
||||||
-printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:;\n" > exp || fail=1
|
|
||||||
+printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:swap;\n" > exp || fail=1
|
|
||||||
sed "s/.*gpt::;/file/" out > k && mv k out || fail=1
|
|
||||||
compare exp out || fail=1
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
|||||||
From 105746f40724d94499a04a0d7036380aaa41c1f5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
|
|
||||||
Date: Sun, 4 Dec 2016 17:12:45 +0100
|
|
||||||
Subject: [PATCH 64/75] libparted:tests: Move get_sector_size() to common.c
|
|
||||||
|
|
||||||
Moving get_sector_size() from disk.c to common.c allows
|
|
||||||
us to use it in _implemented_disk_label() to test for
|
|
||||||
512-byte sectors. This change is required to be able to
|
|
||||||
enable this test for atari partition tables for which
|
|
||||||
support is added in a follow-up patch.
|
|
||||||
|
|
||||||
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/tests/common.c | 14 ++++++++++++++
|
|
||||||
libparted/tests/common.h | 5 +++++
|
|
||||||
libparted/tests/disk.c | 15 ---------------
|
|
||||||
3 files changed, 19 insertions(+), 15 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/tests/common.c b/libparted/tests/common.c
|
|
||||||
index a0be997..9115686 100644
|
|
||||||
--- a/libparted/tests/common.c
|
|
||||||
+++ b/libparted/tests/common.c
|
|
||||||
@@ -7,9 +7,23 @@
|
|
||||||
#include <check.h>
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
+#include "xstrtol.h"
|
|
||||||
|
|
||||||
#define STREQ(a, b) (strcmp (a, b) == 0)
|
|
||||||
|
|
||||||
+size_t get_sector_size (void)
|
|
||||||
+{
|
|
||||||
+ char *p = getenv ("PARTED_SECTOR_SIZE");
|
|
||||||
+ size_t ss = 512;
|
|
||||||
+ unsigned long val;
|
|
||||||
+ if (p
|
|
||||||
+ && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK
|
|
||||||
+ && val % 512 == 0)
|
|
||||||
+ ss = val;
|
|
||||||
+
|
|
||||||
+ return ss;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
PedExceptionOption
|
|
||||||
_test_exception_handler (PedException* e)
|
|
||||||
{
|
|
||||||
diff --git a/libparted/tests/common.h b/libparted/tests/common.h
|
|
||||||
index 1b1c801..5d7485e 100644
|
|
||||||
--- a/libparted/tests/common.h
|
|
||||||
+++ b/libparted/tests/common.h
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
#include <parted/parted.h>
|
|
||||||
|
|
||||||
+/* Determine sector size from environment
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+size_t get_sector_size (void);
|
|
||||||
+
|
|
||||||
/* Create an empty disk image
|
|
||||||
*
|
|
||||||
* filename: file (with full path) where to write the disk image
|
|
||||||
diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
|
|
||||||
index 48561b9..62d20c1 100644
|
|
||||||
--- a/libparted/tests/disk.c
|
|
||||||
+++ b/libparted/tests/disk.c
|
|
||||||
@@ -7,24 +7,9 @@
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "progname.h"
|
|
||||||
-#include "xstrtol.h"
|
|
||||||
|
|
||||||
static char* temporary_disk;
|
|
||||||
|
|
||||||
-static
|
|
||||||
-size_t get_sector_size (void)
|
|
||||||
-{
|
|
||||||
- char *p = getenv ("PARTED_SECTOR_SIZE");
|
|
||||||
- size_t ss = 512;
|
|
||||||
- unsigned long val;
|
|
||||||
- if (p
|
|
||||||
- && xstrtoul (p, NULL, 10, &val, NULL) == LONGINT_OK
|
|
||||||
- && val % 512 == 0)
|
|
||||||
- ss = val;
|
|
||||||
-
|
|
||||||
- return ss;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static void
|
|
||||||
create_disk (void)
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
|||||||
From 783e08a4e5f6769f7ebd2f3e43ca4ccfab003e8b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sergei Antonov <saproj@gmail.com>
|
|
||||||
Date: Fri, 3 Jul 2015 00:21:23 +0200
|
|
||||||
Subject: [PATCH 66/75] mac: copy partition type and name correctly
|
|
||||||
|
|
||||||
Use strncpy() instead of strcpy() to copy partition name and type.
|
|
||||||
This prevents possible buffer overflow, because the source string
|
|
||||||
occupies up to 33 bytes with a terminating null.
|
|
||||||
|
|
||||||
Static analysis tools complain about the code as it is now:
|
|
||||||
Function: _generate_raw_part
|
|
||||||
Destination buffer too small
|
|
||||||
string_overflow: You might overrun the 32 byte destination string
|
|
||||||
part_map_entry->type by writing 33 bytes from mac_part_data->system_name
|
|
||||||
(Destination buffer too small, line 933)
|
|
||||||
|
|
||||||
Cc: Sabas Rosales, Blanca E <blanca.e.sabas.rosales@intel.com>
|
|
||||||
Signed-off-by: Sergei Antonov <saproj@gmail.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@brianlane.com>
|
|
||||||
(cherry picked from commit 282e25e0384e8d1275ccacf904fdaf65f1d4a8af)
|
|
||||||
---
|
|
||||||
libparted/labels/mac.c | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
|
|
||||||
index 1034418..d8da941 100644
|
|
||||||
--- a/libparted/labels/mac.c
|
|
||||||
+++ b/libparted/labels/mac.c
|
|
||||||
@@ -930,8 +930,8 @@ _generate_raw_part (PedDisk* disk, PedPartition* part,
|
|
||||||
= PED_CPU_TO_BE32 (mac_disk_data->last_part_entry_num);
|
|
||||||
part_map_entry->start_block = PED_CPU_TO_BE32 (part->geom.start);
|
|
||||||
part_map_entry->block_count = PED_CPU_TO_BE32 (part->geom.length);
|
|
||||||
- strcpy (part_map_entry->name, mac_part_data->volume_name);
|
|
||||||
- strcpy (part_map_entry->type, mac_part_data->system_name);
|
|
||||||
+ strncpy (part_map_entry->name, mac_part_data->volume_name, 32);
|
|
||||||
+ strncpy (part_map_entry->type, mac_part_data->system_name, 32);
|
|
||||||
|
|
||||||
if (mac_part_data->is_driver) {
|
|
||||||
mac_part_data->boot_region_length = part->geom.length;
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,122 +0,0 @@
|
|||||||
From 526f3ee2afbe7cd90d282915b7b580d4f356c4eb Mon Sep 17 00:00:00 2001
|
|
||||||
From: Laurent Vivier <laurent@vivier.eu>
|
|
||||||
Date: Fri, 9 Dec 2016 15:10:53 +0100
|
|
||||||
Subject: [PATCH 67/75] libparted: Fix MacOS boot support
|
|
||||||
|
|
||||||
boot_region_length (or BootSize in the MacOS dialect) is the length
|
|
||||||
of the driver code in the driver partition. This length is used
|
|
||||||
to compute the checksum of the driver.
|
|
||||||
|
|
||||||
libparted updates this value by setting the whole size of the partition
|
|
||||||
without computing the checksum of the driver using this size.
|
|
||||||
|
|
||||||
As the checksum is wrong, the driver is broken and cannot be loaded
|
|
||||||
by the MacOS ROM, and thus the disk is not bootable anymore.
|
|
||||||
|
|
||||||
Moreover, parted try to update the driver list and makes it disappear.
|
|
||||||
|
|
||||||
As parted is not able to insert a driver in a partition,
|
|
||||||
the driver is generally inserted by the Apple HD Tool,
|
|
||||||
this patch removes the line updating the driver size.
|
|
||||||
|
|
||||||
We also simplify the driver list scan and fix endianess use.
|
|
||||||
|
|
||||||
This has been tested... and it works, now.
|
|
||||||
|
|
||||||
I have updated a bootable disk with parted on x86_64 and
|
|
||||||
then been able to boot it (again) on a Mac LC III.
|
|
||||||
|
|
||||||
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/labels/mac.c | 41 ++++++++++++++++++++---------------------
|
|
||||||
1 file changed, 20 insertions(+), 21 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
|
|
||||||
index d8da941..fa4e43f 100644
|
|
||||||
--- a/libparted/labels/mac.c
|
|
||||||
+++ b/libparted/labels/mac.c
|
|
||||||
@@ -411,14 +411,14 @@ _rawpart_has_driver (const MacRawPartition* raw_part, MacDiskData* mac_disk_data
|
|
||||||
{
|
|
||||||
MacDeviceDriver *driverlist;
|
|
||||||
uint16_t i;
|
|
||||||
- uint32_t driver_bs, driver_be, part_be;
|
|
||||||
+ uint32_t start_block, block_count;
|
|
||||||
|
|
||||||
+ start_block = PED_BE32_TO_CPU(raw_part->start_block);
|
|
||||||
+ block_count = PED_BE32_TO_CPU(raw_part->block_count);
|
|
||||||
driverlist = &mac_disk_data->driverlist[0];
|
|
||||||
for (i = 0; i < mac_disk_data->driver_count; i++) {
|
|
||||||
- driver_bs = driverlist->block;
|
|
||||||
- driver_be = driver_bs + driverlist->size;
|
|
||||||
- part_be = raw_part->start_block + raw_part->block_count;
|
|
||||||
- if (driver_bs >= raw_part->start_block && driver_be <= part_be)
|
|
||||||
+ if (start_block == PED_BE32_TO_CPU(driverlist->block) &&
|
|
||||||
+ block_count == PED_BE16_TO_CPU(driverlist->size))
|
|
||||||
return 1;
|
|
||||||
driverlist++;
|
|
||||||
}
|
|
||||||
@@ -751,11 +751,12 @@ mac_read (PedDisk* disk)
|
|
||||||
if (!ped_disk_delete_all (disk))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
- if (raw_disk->driver_count && raw_disk->driver_count < 62) {
|
|
||||||
+ if (PED_BE16_TO_CPU(raw_disk->driver_count) &&
|
|
||||||
+ PED_BE16_TO_CPU(raw_disk->driver_count) < 62) {
|
|
||||||
memcpy(&mac_disk_data->driverlist[0], &raw_disk->driverlist[0],
|
|
||||||
sizeof(mac_disk_data->driverlist));
|
|
||||||
- mac_disk_data->driver_count = raw_disk->driver_count;
|
|
||||||
- mac_disk_data->block_size = raw_disk->block_size;
|
|
||||||
+ mac_disk_data->driver_count = PED_BE16_TO_CPU(raw_disk->driver_count);
|
|
||||||
+ mac_disk_data->block_size = PED_BE16_TO_CPU(raw_disk->block_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If _disk_analyse_block_size has increased the sector_size,
|
|
||||||
@@ -877,17 +878,16 @@ static void
|
|
||||||
_update_driver_count (MacRawPartition* part_map_entry,
|
|
||||||
MacDiskData *mac_driverdata, const MacDiskData* mac_disk_data)
|
|
||||||
{
|
|
||||||
- uint16_t i, count_orig, count_cur;
|
|
||||||
- uint32_t driver_bs, driver_be, part_be;
|
|
||||||
-
|
|
||||||
- count_cur = mac_driverdata->driver_count;
|
|
||||||
- count_orig = mac_disk_data->driver_count;
|
|
||||||
- for (i = 0; i < count_orig; i++) {
|
|
||||||
- driver_bs = mac_disk_data->driverlist[i].block;
|
|
||||||
- driver_be = driver_bs + mac_disk_data->driverlist[i].size;
|
|
||||||
- part_be = part_map_entry->start_block + part_map_entry->block_count;
|
|
||||||
- if (driver_bs >= part_map_entry->start_block
|
|
||||||
- && driver_be <= part_be) {
|
|
||||||
+ uint16_t i;
|
|
||||||
+ uint32_t start_block, block_count;
|
|
||||||
+
|
|
||||||
+ start_block = PED_BE32_TO_CPU(part_map_entry->start_block);
|
|
||||||
+ block_count = PED_BE32_TO_CPU(part_map_entry->block_count);
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < mac_disk_data->driver_count; i++) {
|
|
||||||
+ if (start_block == PED_BE32_TO_CPU(mac_disk_data->driverlist[i].block) &&
|
|
||||||
+ block_count == PED_BE16_TO_CPU(mac_disk_data->driverlist[i].size)) {
|
|
||||||
+ uint16_t count_cur = mac_driverdata->driver_count;
|
|
||||||
mac_driverdata->driverlist[count_cur].block
|
|
||||||
= mac_disk_data->driverlist[i].block;
|
|
||||||
mac_driverdata->driverlist[count_cur].size
|
|
||||||
@@ -934,7 +934,6 @@ _generate_raw_part (PedDisk* disk, PedPartition* part,
|
|
||||||
strncpy (part_map_entry->type, mac_part_data->system_name, 32);
|
|
||||||
|
|
||||||
if (mac_part_data->is_driver) {
|
|
||||||
- mac_part_data->boot_region_length = part->geom.length;
|
|
||||||
if (mac_part_data->has_driver)
|
|
||||||
_update_driver_count(part_map_entry, mac_driverdata,
|
|
||||||
mac_disk_data);
|
|
||||||
@@ -1042,7 +1041,7 @@ write_block_zero (PedDisk* disk, MacDiskData* mac_driverdata)
|
|
||||||
raw_disk->block_size = PED_CPU_TO_BE16 (dev->sector_size);
|
|
||||||
raw_disk->block_count = PED_CPU_TO_BE32 (dev->length);
|
|
||||||
|
|
||||||
- raw_disk->driver_count = mac_driverdata->driver_count;
|
|
||||||
+ raw_disk->driver_count = PED_CPU_TO_BE16(mac_driverdata->driver_count);
|
|
||||||
memcpy(&raw_disk->driverlist[0], &mac_driverdata->driverlist[0],
|
|
||||||
sizeof(raw_disk->driverlist));
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
From c625f6769144472f3c099cdd512318cea18e2766 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sebastian Rasmussen <sebras@gmail.com>
|
|
||||||
Date: Thu, 19 Jan 2017 23:38:40 +0100
|
|
||||||
Subject: [PATCH 68/75] libparted: Fix typo in hfs error message
|
|
||||||
|
|
||||||
---
|
|
||||||
libparted/fs/r/hfs/cache.c | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/fs/r/hfs/cache.c b/libparted/fs/r/hfs/cache.c
|
|
||||||
index 68be366..03c2913 100644
|
|
||||||
--- a/libparted/fs/r/hfs/cache.c
|
|
||||||
+++ b/libparted/fs/r/hfs/cache.c
|
|
||||||
@@ -210,8 +210,8 @@ hfsc_cache_move_extent(HfsCPrivateCache* cache, uint32_t old_start,
|
|
||||||
ped_exception_throw (
|
|
||||||
PED_EXCEPTION_BUG,
|
|
||||||
PED_EXCEPTION_CANCEL,
|
|
||||||
- _("Trying to move an extent from block Ox%X to block "
|
|
||||||
- "Ox%X, but another one already exists at this "
|
|
||||||
+ _("Trying to move an extent from block 0x%X to block "
|
|
||||||
+ "0x%X, but another one already exists at this "
|
|
||||||
"position. This should not happen!"),
|
|
||||||
old_start, new_start);
|
|
||||||
return NULL;
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
From 1f1382ab8672b9bb679ecc7e79583fd826908f6f Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 1 May 2017 17:04:11 -0700
|
|
||||||
Subject: [PATCH 69/75] Fix crash when localized
|
|
||||||
|
|
||||||
The _() macro is only for translating string literals. It was
|
|
||||||
incorrectly applied to a runtime string representing the name
|
|
||||||
of a partition and this sometimes caused a gettext crash.
|
|
||||||
---
|
|
||||||
parted/parted.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index bd848c3..f767bec 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -1276,7 +1276,7 @@ do_print (PedDevice** dev, PedDisk** diskp)
|
|
||||||
putchar (':');
|
|
||||||
|
|
||||||
if (has_name)
|
|
||||||
- printf ("%s:", _(ped_partition_get_name (part)));
|
|
||||||
+ printf ("%s:", ped_partition_get_name (part));
|
|
||||||
else
|
|
||||||
putchar (':');
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
From eb927155680f75e570dc7375514e344a936a3fb5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 1 May 2017 17:05:01 -0700
|
|
||||||
Subject: [PATCH 70/75] Add support for RAM drives
|
|
||||||
|
|
||||||
Recognize RAM drives, so "parted -s /dev/ram0 p" now prints
|
|
||||||
"RAM Drive (brd)" instead of "Model: Unknown (unknown)".
|
|
||||||
|
|
||||||
In order for a device to be recognized as RAM drive, it has to
|
|
||||||
have major number 1. Also the BLKFLSBUF ioctl shouldn't be used
|
|
||||||
on RAM drives as it is used to zero the device.
|
|
||||||
|
|
||||||
* NEWS: Mention the change
|
|
||||||
* include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_RAM.
|
|
||||||
* libparted/arch/linux.c(RAM_MAJOR): New define.
|
|
||||||
* libparted/arch/linux.c(_device_probe_type): Recognize RAM drives.
|
|
||||||
* libparted/arch/linux.c(linux_new): Handle RAM drives.
|
|
||||||
* libparted/arch/linux.c(_flush_cache): Skip RAM drives.
|
|
||||||
* parted/parted.c(do_print): Add "brd" to list of transports.
|
|
||||||
|
|
||||||
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
|
|
||||||
---
|
|
||||||
include/parted/device.in.h | 3 ++-
|
|
||||||
libparted/arch/linux.c | 12 ++++++++++--
|
|
||||||
parted/parted.c | 2 +-
|
|
||||||
3 files changed, 13 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/parted/device.in.h b/include/parted/device.in.h
|
|
||||||
index d38db44..1b6e7b8 100644
|
|
||||||
--- a/include/parted/device.in.h
|
|
||||||
+++ b/include/parted/device.in.h
|
|
||||||
@@ -50,7 +50,8 @@ typedef enum {
|
|
||||||
PED_DEVICE_AOE = 16,
|
|
||||||
PED_DEVICE_MD = 17,
|
|
||||||
PED_DEVICE_LOOP = 18,
|
|
||||||
- PED_DEVICE_NVME = 19
|
|
||||||
+ PED_DEVICE_NVME = 19,
|
|
||||||
+ PED_DEVICE_RAM = 20
|
|
||||||
} PedDeviceType;
|
|
||||||
|
|
||||||
typedef struct _PedDevice PedDevice;
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 2058697..c2fdab0 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -279,6 +279,7 @@ struct blkdev_ioctl_param {
|
|
||||||
#define LOOP_MAJOR 7
|
|
||||||
#define MD_MAJOR 9
|
|
||||||
#define BLKEXT_MAJOR 259
|
|
||||||
+#define RAM_MAJOR 1
|
|
||||||
|
|
||||||
#define SCSI_BLK_MAJOR(M) ( \
|
|
||||||
(M) == SCSI_DISK0_MAJOR \
|
|
||||||
@@ -701,6 +702,8 @@ _device_probe_type (PedDevice* dev)
|
|
||||||
dev->type = PED_DEVICE_MD;
|
|
||||||
} else if (_is_blkext_major(dev_major) && dev->path && strstr(dev->path, "nvme")) {
|
|
||||||
dev->type = PED_DEVICE_NVME;
|
|
||||||
+ } else if (dev_major == RAM_MAJOR) {
|
|
||||||
+ dev->type = PED_DEVICE_RAM;
|
|
||||||
} else {
|
|
||||||
dev->type = PED_DEVICE_UNKNOWN;
|
|
||||||
}
|
|
||||||
@@ -1547,6 +1550,11 @@ linux_new (const char* path)
|
|
||||||
goto error_free_arch_specific;
|
|
||||||
break;
|
|
||||||
|
|
||||||
+ case PED_DEVICE_RAM:
|
|
||||||
+ if (!init_generic (dev, _("RAM Drive")))
|
|
||||||
+ goto error_free_arch_specific;
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
default:
|
|
||||||
ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
|
|
||||||
PED_EXCEPTION_CANCEL,
|
|
||||||
@@ -1619,9 +1627,9 @@ _flush_cache (PedDevice* dev)
|
|
||||||
{
|
|
||||||
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
|
|
||||||
int i;
|
|
||||||
- int lpn = _device_get_partition_range(dev);
|
|
||||||
+ int lpn = _device_get_partition_range(dev);
|
|
||||||
|
|
||||||
- if (dev->read_only)
|
|
||||||
+ if (dev->read_only || dev->type == PED_DEVICE_RAM)
|
|
||||||
return;
|
|
||||||
dev->dirty = 0;
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index f767bec..a7fcd3b 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -979,7 +979,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp)
|
|
||||||
"cpqarray", "file", "ataraid", "i2o",
|
|
||||||
"ubd", "dasd", "viodasd", "sx8", "dm",
|
|
||||||
"xvd", "sd/mmc", "virtblk", "aoe",
|
|
||||||
- "md", "loopback", "nvme"};
|
|
||||||
+ "md", "loopback", "nvme", "brd"};
|
|
||||||
|
|
||||||
char* start = ped_unit_format (dev, 0);
|
|
||||||
PedUnit default_unit = ped_unit_get_default ();
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 1a891f6d352d47a6a9422083bbb38a2c4c4e901b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Fri, 24 Mar 2017 03:11:08 +0100
|
|
||||||
Subject: [PATCH 71/75] parted: check the name of partition first when to name
|
|
||||||
a partition
|
|
||||||
|
|
||||||
The previous function works well for the labels supporting naming
|
|
||||||
partition, but not for these which don't. If the disk label does not
|
|
||||||
support partition naming, two exceptions will be raised. Even after the first
|
|
||||||
error indicates it does not support name, parted yet asks user for
|
|
||||||
name in iteractive mode.
|
|
||||||
|
|
||||||
First check if the disk label supports partition naming and if it
|
|
||||||
does, it will continue; otherwise, it will stop and raise an
|
|
||||||
exception.
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
---
|
|
||||||
parted/parted.c | 7 +++++++
|
|
||||||
1 file changed, 7 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index a7fcd3b..d2e1f24 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -870,6 +870,13 @@ do_name (PedDevice** dev, PedDisk** diskp)
|
|
||||||
if (!*diskp)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
+ if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_PARTITION_NAME)) {
|
|
||||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
|
||||||
+ _("%s disk labels do not support partition name."),
|
|
||||||
+ (*diskp)->type->name);
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
From eb5eb44f6ef009c68cc8867e3277fa832cad7f10 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Fri, 24 Mar 2017 03:11:10 +0100
|
|
||||||
Subject: [PATCH 72/75] parted/ui: remove unneccesary information of command
|
|
||||||
line
|
|
||||||
|
|
||||||
When some command fails, the information still exists in
|
|
||||||
command_line buffer. When in command mode or interactive mode,
|
|
||||||
if an interactive exception prompts, the remained information
|
|
||||||
will be processed as option from user. This will raise some other
|
|
||||||
information or even unexpected results. So before getting option
|
|
||||||
input from user, clean the command line buffer.
|
|
||||||
|
|
||||||
Example: When the disk label is invalid and user tries to make
|
|
||||||
new partition on the device with command like,
|
|
||||||
mkpart 0 50%. Then parted will raise an exception
|
|
||||||
telling an invalid disk label found and whether to correct it.
|
|
||||||
But at this time 0 as the input of mkpart will be
|
|
||||||
considered as the option input for the exception(yes/no).
|
|
||||||
So one more exception will raised with error information.
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
---
|
|
||||||
parted/ui.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/parted/ui.c b/parted/ui.c
|
|
||||||
index 505b8ac..c603ed2 100644
|
|
||||||
--- a/parted/ui.c
|
|
||||||
+++ b/parted/ui.c
|
|
||||||
@@ -1270,6 +1270,7 @@ command_line_get_ex_opt (const char* prompt, PedExceptionOption options)
|
|
||||||
PedExceptionOption opt;
|
|
||||||
char* opt_name;
|
|
||||||
|
|
||||||
+ command_line_flush ();
|
|
||||||
for (opt = option_get_next (options, 0); opt;
|
|
||||||
opt = option_get_next (options, opt)) {
|
|
||||||
options_strlist = str_list_append_unique (options_strlist,
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
From fb8167365502c7476d571fb279889ad2c6c2785e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Fri, 24 Mar 2017 03:11:12 +0100
|
|
||||||
Subject: [PATCH 73/75] libpartd/dasd: improve flag processing for DASD-LDL
|
|
||||||
|
|
||||||
DASD-LDL does not support flag now, so all the flags are
|
|
||||||
unavailable to it.
|
|
||||||
|
|
||||||
Signed-off-by: Andre Wild <wild@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
---
|
|
||||||
libparted/labels/dasd.c | 14 ++++++++++++++
|
|
||||||
1 file changed, 14 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
|
||||||
index 7594e96..e246ecb 100644
|
|
||||||
--- a/libparted/labels/dasd.c
|
|
||||||
+++ b/libparted/labels/dasd.c
|
|
||||||
@@ -773,10 +773,24 @@ dasd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * The DASD-LDL does not support flags now.
|
|
||||||
+ * So just return 0.
|
|
||||||
+*/
|
|
||||||
static int
|
|
||||||
dasd_partition_is_flag_available (const PedPartition* part,
|
|
||||||
PedPartitionFlag flag)
|
|
||||||
{
|
|
||||||
+ DasdDiskSpecific* disk_specific;
|
|
||||||
+ PED_ASSERT (part != NULL);
|
|
||||||
+ PED_ASSERT (part->disk != NULL);
|
|
||||||
+ PED_ASSERT (part->disk->disk_specific != NULL);
|
|
||||||
+
|
|
||||||
+ disk_specific = part->disk->disk_specific;
|
|
||||||
+
|
|
||||||
+ if (disk_specific->format_type == 1)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
switch (flag) {
|
|
||||||
case PED_PARTITION_RAID:
|
|
||||||
return 1;
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
From c6ada23e466d824efcaff699a3de2923895c2244 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Fri, 24 Mar 2017 11:20:09 +0100
|
|
||||||
Subject: [PATCH 74/75] libparted/dasd: add an exception for changing DASD-LDL
|
|
||||||
partition table
|
|
||||||
|
|
||||||
The partition table of DASD-LDL device with the dasd disk label
|
|
||||||
should not be changed according to its character in Linux.
|
|
||||||
When the user tries to modify the partition table, an exception
|
|
||||||
will be raised to inform user of this character.
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
---
|
|
||||||
libparted/labels/dasd.c | 6 +++++-
|
|
||||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
|
||||||
index e246ecb..632ec8e 100644
|
|
||||||
--- a/libparted/labels/dasd.c
|
|
||||||
+++ b/libparted/labels/dasd.c
|
|
||||||
@@ -619,8 +619,12 @@ dasd_write (const PedDisk* disk)
|
|
||||||
PDEBUG;
|
|
||||||
|
|
||||||
/* If not formated in CDL, don't write anything. */
|
|
||||||
- if (disk_specific->format_type == 1)
|
|
||||||
+ if (disk_specific->format_type == 1) {
|
|
||||||
+ ped_exception_throw (PED_EXCEPTION_ERROR,
|
|
||||||
+ PED_EXCEPTION_CANCEL,
|
|
||||||
+ _("The partition table of DASD-LDL device cannot be changed.\n"));
|
|
||||||
return 1;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* initialize the anchor */
|
|
||||||
fdasd_initialize_anchor(&anchor);
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,241 +0,0 @@
|
|||||||
From e76ec6107f63fbf17cc6daf00a9cdb21994e54c1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Date: Thu, 20 Apr 2017 10:20:07 +0200
|
|
||||||
Subject: [PATCH 75/75] libparted/dasd: add test cases for the new fdasd
|
|
||||||
functions
|
|
||||||
|
|
||||||
The test case uses a temporary file in libparted/tests under
|
|
||||||
Check framwork.It can be issued by "make check" in the test dir.
|
|
||||||
|
|
||||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
|
||||||
---
|
|
||||||
libparted/tests/t4000-volser.sh | 20 +++++
|
|
||||||
libparted/tests/volser.c | 188 ++++++++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 208 insertions(+)
|
|
||||||
create mode 100755 libparted/tests/t4000-volser.sh
|
|
||||||
create mode 100644 libparted/tests/volser.c
|
|
||||||
|
|
||||||
diff --git a/libparted/tests/t4000-volser.sh b/libparted/tests/t4000-volser.sh
|
|
||||||
new file mode 100755
|
|
||||||
index 0000000..89688ba
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/libparted/tests/t4000-volser.sh
|
|
||||||
@@ -0,0 +1,20 @@
|
|
||||||
+#!/bin/sh
|
|
||||||
+
|
|
||||||
+# 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 3 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/>.
|
|
||||||
+
|
|
||||||
+. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ .
|
|
||||||
+
|
|
||||||
+volser || fail=1
|
|
||||||
+
|
|
||||||
+Exit $fail
|
|
||||||
diff --git a/libparted/tests/volser.c b/libparted/tests/volser.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..9063821
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/libparted/tests/volser.c
|
|
||||||
@@ -0,0 +1,188 @@
|
|
||||||
+/*
|
|
||||||
+ * Author: Wang Dong <dongdwdw@cn.ibm.com>
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <config.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <check.h>
|
|
||||||
+
|
|
||||||
+#include <parted/vtoc.h>
|
|
||||||
+#include <parted/device.h>
|
|
||||||
+#include <parted/fdasd.h>
|
|
||||||
+#include <parted/vtoc.h>
|
|
||||||
+#include "../arch/linux.h"
|
|
||||||
+#include "common.h"
|
|
||||||
+#include "progname.h"
|
|
||||||
+
|
|
||||||
+/* set dasd first */
|
|
||||||
+static char vol_devno[7] = {0};
|
|
||||||
+static char *tmp_disk;
|
|
||||||
+static int fd;
|
|
||||||
+
|
|
||||||
+static PedDisk *disk;
|
|
||||||
+static struct fdasd_anchor anc;
|
|
||||||
+static fdasd_anchor_t *anchor = &anc;
|
|
||||||
+static LinuxSpecific *arch_specific;
|
|
||||||
+
|
|
||||||
+/* set the enviroment */
|
|
||||||
+static void set_test (void)
|
|
||||||
+{
|
|
||||||
+ PedDevice *dev;
|
|
||||||
+ PedDiskType *type;
|
|
||||||
+ type = ped_disk_type_get ("dasd");
|
|
||||||
+
|
|
||||||
+ tmp_disk = _create_disk (20*1024*1024);
|
|
||||||
+ fail_if (tmp_disk == NULL, "Failed to create temporary disk");
|
|
||||||
+ dev = ped_device_get (tmp_disk);
|
|
||||||
+ if (dev == NULL)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ disk = _create_disk_label (dev, type);
|
|
||||||
+ if (!ped_device_open (disk->dev))
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ fdasd_initialize_anchor (anchor);
|
|
||||||
+ arch_specific = LINUX_SPECIFIC (disk->dev);
|
|
||||||
+ fd = arch_specific->fd;
|
|
||||||
+ if (!fdasd_get_geometry (dev, anchor, fd))
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ fdasd_check_volume (anchor, fd);
|
|
||||||
+ sprintf (vol_devno, "0X%04x", anchor->devno);
|
|
||||||
+ ck_assert (strlen (vol_devno) == VOLSER_LENGTH);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void free_test (void)
|
|
||||||
+{
|
|
||||||
+ ped_device_close (disk->dev);
|
|
||||||
+ ped_device_destroy (disk->dev);
|
|
||||||
+ unlink (tmp_disk);
|
|
||||||
+ free (tmp_disk);
|
|
||||||
+ fdasd_cleanup (anchor);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Test with default volser */
|
|
||||||
+START_TEST (test_get_volser)
|
|
||||||
+{
|
|
||||||
+ char volser[7] = {0};
|
|
||||||
+ fdasd_change_volser (anchor, vol_devno);
|
|
||||||
+ fdasd_write_labels (anchor, fd);
|
|
||||||
+
|
|
||||||
+ fdasd_get_volser (anchor, volser, fd);
|
|
||||||
+ ck_assert (!strcmp (volser, vol_devno));
|
|
||||||
+}
|
|
||||||
+END_TEST
|
|
||||||
+
|
|
||||||
+START_TEST (test_check_volser)
|
|
||||||
+{
|
|
||||||
+ char vol[7] = {0};
|
|
||||||
+ char vol_long[] = "abcdefg";
|
|
||||||
+ char vol_short[] = "ab_c ";
|
|
||||||
+ char vol_null[] = " ";
|
|
||||||
+ char *vol_input = NULL;
|
|
||||||
+
|
|
||||||
+ vol_input = vol_long;
|
|
||||||
+ fdasd_check_volser (vol_input, anchor->devno);
|
|
||||||
+ ck_assert(!strcmp (vol_input, "ABCDEF"));
|
|
||||||
+
|
|
||||||
+ vol_input = vol_short;
|
|
||||||
+ fdasd_check_volser (vol_input, anchor->devno);
|
|
||||||
+ ck_assert (!strcmp (vol_input, "ABC"));
|
|
||||||
+
|
|
||||||
+ vol_input = vol_null;
|
|
||||||
+ fdasd_check_volser (vol_input, anchor->devno);
|
|
||||||
+ ck_assert (!strcmp (vol_input, vol_devno));
|
|
||||||
+}
|
|
||||||
+END_TEST
|
|
||||||
+
|
|
||||||
+START_TEST (test_change_volser)
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+ char vol[] = "000000";
|
|
||||||
+ char volser[7] = {0};
|
|
||||||
+
|
|
||||||
+ fdasd_change_volser (anchor, vol);
|
|
||||||
+ fdasd_write_labels (anchor, fd);
|
|
||||||
+
|
|
||||||
+ fdasd_get_volser (anchor, volser, fd);
|
|
||||||
+ ck_assert (!strcmp (volser, vol));
|
|
||||||
+}
|
|
||||||
+END_TEST
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * fdsad_recreate_vtoc recreate the VTOC with existing one.
|
|
||||||
+ * So the partition information should be not changed after recreating
|
|
||||||
+ * VTOC.
|
|
||||||
+*/
|
|
||||||
+START_TEST (test_reuse_vtoc)
|
|
||||||
+{
|
|
||||||
+ ds5ext_t before;
|
|
||||||
+ ds5ext_t after;
|
|
||||||
+
|
|
||||||
+ memcpy (&before, &anchor->f5->DS5AVEXT, sizeof(ds5ext_t));
|
|
||||||
+
|
|
||||||
+ if (anchor->fspace_trk) {
|
|
||||||
+ fdasd_reuse_vtoc (anchor);
|
|
||||||
+ memcpy (&after, &anchor->f5->DS5AVEXT, sizeof(ds5ext_t));
|
|
||||||
+ if ((before.t != after.t) && (before.fc != after.fc) && (before.ft != after.ft))
|
|
||||||
+ ck_abort ();
|
|
||||||
+ } else {
|
|
||||||
+ fdasd_reuse_vtoc (anchor);
|
|
||||||
+ memcpy (&after, &anchor->f5->DS5AVEXT, sizeof(ds5ext_t));
|
|
||||||
+ if ((before.t != after.t) && (before.fc != after.fc) && (before.ft != after.ft))
|
|
||||||
+ ck_abort ();
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+END_TEST
|
|
||||||
+
|
|
||||||
+int main (int argc, char **argv)
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+ set_program_name (argv[0]);
|
|
||||||
+
|
|
||||||
+#if defined __s390__ || defined __s390x__
|
|
||||||
+
|
|
||||||
+ int number_failed = 0;
|
|
||||||
+
|
|
||||||
+ Suite *suite = suite_create ("Volser");
|
|
||||||
+
|
|
||||||
+ TCase *tcase_get = tcase_create ("Get");
|
|
||||||
+ TCase *tcase_check = tcase_create ("Check");
|
|
||||||
+ TCase *tcase_change = tcase_create ("Change");
|
|
||||||
+ TCase *tcase_vtoc = tcase_create ("Vtoc");
|
|
||||||
+
|
|
||||||
+ ped_exception_set_handler (_test_exception_handler);
|
|
||||||
+
|
|
||||||
+ tcase_add_checked_fixture (tcase_check, set_test, free_test);
|
|
||||||
+ tcase_add_test (tcase_check, test_check_volser);
|
|
||||||
+ tcase_set_timeout (tcase_check, 0);
|
|
||||||
+ suite_add_tcase (suite, tcase_check);
|
|
||||||
+
|
|
||||||
+ tcase_add_checked_fixture (tcase_change, set_test, free_test);
|
|
||||||
+ tcase_add_test (tcase_change, test_change_volser);
|
|
||||||
+ tcase_set_timeout (tcase_change, 0);
|
|
||||||
+ suite_add_tcase (suite, tcase_change);
|
|
||||||
+
|
|
||||||
+ tcase_add_checked_fixture (tcase_get, set_test, free_test);
|
|
||||||
+ tcase_add_test (tcase_get, test_get_volser);
|
|
||||||
+ tcase_set_timeout (tcase_get, 0);
|
|
||||||
+ suite_add_tcase (suite, tcase_get);
|
|
||||||
+
|
|
||||||
+ tcase_add_checked_fixture (tcase_vtoc, set_test, free_test);
|
|
||||||
+ tcase_add_test (tcase_vtoc, test_reuse_vtoc);
|
|
||||||
+ tcase_set_timeout (tcase_vtoc, 0);
|
|
||||||
+ suite_add_tcase (suite, tcase_vtoc);
|
|
||||||
+
|
|
||||||
+ SRunner *srunner = srunner_create (suite);
|
|
||||||
+ /* When to debug, uncomment this line */
|
|
||||||
+ /* srunner_set_fork_status (srunner, CK_NOFORK); */
|
|
||||||
+
|
|
||||||
+ srunner_run_all (srunner, CK_VERBOSE);
|
|
||||||
+
|
|
||||||
+ number_failed = srunner_ntests_failed (srunner);
|
|
||||||
+ srunner_free (srunner);
|
|
||||||
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
||||||
+
|
|
||||||
+#endif
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
From 58986a509da1c6387435b27c4071944ee14613a2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 24 Feb 2017 11:06:20 -0800
|
|
||||||
Subject: [PATCH 76/77] Increase timeout for rmmod scsi_debug and make it a
|
|
||||||
framework failure
|
|
||||||
|
|
||||||
On some hardware scsi_debug can take longer to remove. If this fails it
|
|
||||||
inevitably results in the next test failing since it cannot load
|
|
||||||
scsi_debug.
|
|
||||||
|
|
||||||
Increse the timeout to 40 loops (8 seconds), and if it hits the limit
|
|
||||||
without succeeding call framework_failure_
|
|
||||||
|
|
||||||
(cherry picked from commit 40e55a0819862d5dbe2098803735f8c48fb30b6d)
|
|
||||||
---
|
|
||||||
tests/t-local.sh | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t-local.sh b/tests/t-local.sh
|
|
||||||
index 13073d2..2ba7ee1 100644
|
|
||||||
--- a/tests/t-local.sh
|
|
||||||
+++ b/tests/t-local.sh
|
|
||||||
@@ -27,13 +27,14 @@ scsi_debug_cleanup_()
|
|
||||||
# "Module scsi_debug is in use".
|
|
||||||
i=0
|
|
||||||
udevadm settle
|
|
||||||
- while [ $i -lt 10 ] ; do
|
|
||||||
+ while [ $i -lt 40 ] ; do
|
|
||||||
rmmod scsi_debug \
|
|
||||||
&& { test "$VERBOSE" = yes && warn_ $ME_ rmmod scsi_debug...; break; }
|
|
||||||
sleep .2 || sleep 1
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
udevadm settle
|
|
||||||
+ test $i = 40 && framework_failure_ rmmod scsi_debug failed.
|
|
||||||
fi
|
|
||||||
rm -fr $scsi_debug_lock_dir_
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
From 1eb7c40bcf7aeb359e9e605ebf2ae7e4a602a23c Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 24 Feb 2017 12:12:03 -0800
|
|
||||||
Subject: [PATCH 77/77] tests/t1701-rescue-fs wait for the device to appear.
|
|
||||||
|
|
||||||
After mkpart it needs to wait for the new partition to appear.
|
|
||||||
|
|
||||||
(cherry picked from commit 8d149b24eb2789fdf00743ef735e0cffde598040)
|
|
||||||
---
|
|
||||||
tests/t1701-rescue-fs.sh | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/tests/t1701-rescue-fs.sh b/tests/t1701-rescue-fs.sh
|
|
||||||
index 9b726cf..bbf5eac 100644
|
|
||||||
--- a/tests/t1701-rescue-fs.sh
|
|
||||||
+++ b/tests/t1701-rescue-fs.sh
|
|
||||||
@@ -30,6 +30,7 @@ scsi_dev=$(cat dev-name)
|
|
||||||
|| { warn_ "$ME: no ext4 support"; Exit $fail; }
|
|
||||||
|
|
||||||
parted -s $scsi_dev mklabel msdos mkpart primary ext2 1m 100%
|
|
||||||
+wait_for_dev_to_appear_ ${scsi_dev}1 || fail=1
|
|
||||||
mkfs.ext4 ${scsi_dev}1 || { warn_ $ME: mkfs.ext4 failed; fail=1; Exit $fail; }
|
|
||||||
|
|
||||||
# remove the partition
|
|
||||||
--
|
|
||||||
2.9.3
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
From e7870afe3c13dcc77845d48409daa35e3e42b5fb Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Thu, 25 May 2017 09:42:23 -0700
|
|
||||||
Subject: [PATCH] libparted: Fix udev cookie leak in _dm_resize_partition
|
|
||||||
|
|
||||||
The function is setting udev cookies, but not using them when waiting
|
|
||||||
for the task. This results in leaked cookies, which can eventually
|
|
||||||
exhaust the available number of semaphores.
|
|
||||||
|
|
||||||
'dmsetup udevcookies' will show a cookie remaining afterwards, and 'ipcs -s'
|
|
||||||
will show the semaphores in use.
|
|
||||||
|
|
||||||
Also simplified the exit so that the task is always destroyed and memory
|
|
||||||
is all freed in the same path.
|
|
||||||
|
|
||||||
Resolves: rhbz#1455564
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 14 +++++++-------
|
|
||||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 9886d6e..1a35964 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -2943,6 +2943,7 @@ _dm_resize_partition (PedDisk* disk, const PedPartition* part)
|
|
||||||
char* vol_name = NULL;
|
|
||||||
const char* dev_name = NULL;
|
|
||||||
uint32_t cookie = 0;
|
|
||||||
+ int rc = 0;
|
|
||||||
|
|
||||||
/* Get map name from devicemapper */
|
|
||||||
struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
|
|
||||||
@@ -2983,8 +2984,9 @@ _dm_resize_partition (PedDisk* disk, const PedPartition* part)
|
|
||||||
/* device-mapper uses 512b units, not the device's sector size */
|
|
||||||
dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT),
|
|
||||||
"linear", params);
|
|
||||||
- if (!dm_task_set_cookie (task, &cookie, 0))
|
|
||||||
- goto err;
|
|
||||||
+ /* NOTE: DM_DEVICE_RELOAD doesn't generate udev events, so no cookie is needed (it will freeze).
|
|
||||||
+ * DM_DEVICE_RESUME does, so get a cookie and synchronize with udev.
|
|
||||||
+ */
|
|
||||||
if (dm_task_run (task)) {
|
|
||||||
dm_task_destroy (task);
|
|
||||||
task = dm_task_create (DM_DEVICE_RESUME);
|
|
||||||
@@ -2993,10 +2995,8 @@ _dm_resize_partition (PedDisk* disk, const PedPartition* part)
|
|
||||||
dm_task_set_name (task, vol_name);
|
|
||||||
if (!dm_task_set_cookie (task, &cookie, 0))
|
|
||||||
goto err;
|
|
||||||
- if (dm_task_run (task)) {
|
|
||||||
- free (params);
|
|
||||||
- free (vol_name);
|
|
||||||
- return 1;
|
|
||||||
+ if (_dm_task_run_wait (task, cookie)) {
|
|
||||||
+ rc = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err:
|
|
||||||
@@ -3005,7 +3005,7 @@ err:
|
|
||||||
dm_task_destroy (task);
|
|
||||||
free (params);
|
|
||||||
free (vol_name);
|
|
||||||
- return 0;
|
|
||||||
+ return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
--
|
|
||||||
2.9.4
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
From 465fdd8d72e7f8517d67ec7b5f227f5482928ec1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 31 Jul 2017 15:20:45 -0700
|
|
||||||
Subject: [PATCH] atari.c: Drop xlocale.h (#1476934)
|
|
||||||
|
|
||||||
glibc no longer includes this header. locale.h should work just fine.
|
|
||||||
---
|
|
||||||
libparted/labels/atari.c | 1 -
|
|
||||||
1 file changed, 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/atari.c b/libparted/labels/atari.c
|
|
||||||
index 36e68b9..ea4c87f 100644
|
|
||||||
--- a/libparted/labels/atari.c
|
|
||||||
+++ b/libparted/labels/atari.c
|
|
||||||
@@ -37,7 +37,6 @@
|
|
||||||
#include <parted/endian.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <locale.h>
|
|
||||||
-#include <xlocale.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
--
|
|
||||||
2.9.4
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
From 8bec8bcc639cfc7ed0ca7cd3a5321513aa4348fd Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
|
|
||||||
Date: Sun, 5 Nov 2017 23:33:37 +0100
|
|
||||||
Subject: [PATCH 80/81] libparted/labels: link with libiconv if needed
|
|
||||||
|
|
||||||
gpt.c uses iconv so it should link with it. Otherwise, on platforms
|
|
||||||
where libiconv is a separate library, we get a link failure of parted:
|
|
||||||
|
|
||||||
CCLD parted
|
|
||||||
../libparted/.libs/libparted.so: undefined reference to `libiconv'
|
|
||||||
../libparted/.libs/libparted.so: undefined reference to `libiconv_open'
|
|
||||||
../libparted/.libs/libparted.so: undefined reference to `libiconv_close'
|
|
||||||
|
|
||||||
Since iconv functionality is needed unconditionally (not only when
|
|
||||||
gettext is enabled), AM_ICONV needs to be added to configure.ac.
|
|
||||||
|
|
||||||
(cherry picked from commit 571293e3f9ee45f37867578899c6a8a9cd35afd4)
|
|
||||||
---
|
|
||||||
configure.ac | 2 ++
|
|
||||||
libparted/labels/Makefile.am | 2 +-
|
|
||||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 3d57157..5251dfb 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -288,6 +288,8 @@ fi
|
|
||||||
AC_PROG_LIBTOOL
|
|
||||||
LT_INIT
|
|
||||||
|
|
||||||
+AM_ICONV
|
|
||||||
+
|
|
||||||
AM_GNU_GETTEXT_VERSION([0.18])
|
|
||||||
AM_GNU_GETTEXT([external])
|
|
||||||
if test "$USE_INCLUDED_LIBINTL" = "yes"; then
|
|
||||||
diff --git a/libparted/labels/Makefile.am b/libparted/labels/Makefile.am
|
|
||||||
index 3327c8c..db612d1 100644
|
|
||||||
--- a/libparted/labels/Makefile.am
|
|
||||||
+++ b/libparted/labels/Makefile.am
|
|
||||||
@@ -36,7 +36,7 @@ liblabels_la_SOURCES = \
|
|
||||||
rdb.c \
|
|
||||||
sun.c
|
|
||||||
|
|
||||||
-liblabels_la_LIBADD = $(OS_LIBS) $(INTLLIBS)
|
|
||||||
+liblabels_la_LIBADD = $(OS_LIBS) $(INTLLIBS) $(LIBICONV)
|
|
||||||
|
|
||||||
AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
|||||||
From b5bbee5db418e85c8fd26bf07142e71302914738 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sebastian Parschauer <sparschauer@suse.de>
|
|
||||||
Date: Tue, 24 Oct 2017 10:22:21 +0200
|
|
||||||
Subject: [PATCH] Add support for NVDIMM devices
|
|
||||||
|
|
||||||
Recognize NVDIMM devices, so that "parted -s /dev/pmem7 p" now
|
|
||||||
prints "Model: NVDIMM Device (pmem)" instead of
|
|
||||||
"Model: Unknown (unknown)".
|
|
||||||
|
|
||||||
In order for a device to be recognized as NVDIMM, it has to
|
|
||||||
have a 'blkext' major number. But since this major can be
|
|
||||||
used also by other device types, we also check that the device
|
|
||||||
path contains 'pmem' as a substring.
|
|
||||||
|
|
||||||
* NEWS: Mention the change
|
|
||||||
* include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_PMEM
|
|
||||||
* libparted/arch/linux.c(_device_probe_type): Recognize NVDIMM devices.
|
|
||||||
* libparted/arch/linux.c(linux_new): Handle NVDIMM devices.
|
|
||||||
* parted/parted.c(do_print): Add "pmem" to list of transports.
|
|
||||||
|
|
||||||
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
|
|
||||||
(cherry picked from commit 71885c5f493f3a5d950adbb3e8d17eff7e023053)
|
|
||||||
---
|
|
||||||
include/parted/device.in.h | 3 ++-
|
|
||||||
libparted/arch/linux.c | 7 +++++++
|
|
||||||
parted/parted.c | 3 ++-
|
|
||||||
3 files changed, 11 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/parted/device.in.h b/include/parted/device.in.h
|
|
||||||
index 1b6e7b8..d3af6bb 100644
|
|
||||||
--- a/include/parted/device.in.h
|
|
||||||
+++ b/include/parted/device.in.h
|
|
||||||
@@ -51,7 +51,8 @@ typedef enum {
|
|
||||||
PED_DEVICE_MD = 17,
|
|
||||||
PED_DEVICE_LOOP = 18,
|
|
||||||
PED_DEVICE_NVME = 19,
|
|
||||||
- PED_DEVICE_RAM = 20
|
|
||||||
+ PED_DEVICE_RAM = 20,
|
|
||||||
+ PED_DEVICE_PMEM = 21
|
|
||||||
} PedDeviceType;
|
|
||||||
|
|
||||||
typedef struct _PedDevice PedDevice;
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index b76000e..1c26b8c 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -704,6 +704,8 @@ _device_probe_type (PedDevice* dev)
|
|
||||||
dev->type = PED_DEVICE_NVME;
|
|
||||||
} else if (dev_major == RAM_MAJOR) {
|
|
||||||
dev->type = PED_DEVICE_RAM;
|
|
||||||
+ } else if (_is_blkext_major(dev_major) && dev->path && strstr(dev->path, "pmem")) {
|
|
||||||
+ dev->type = PED_DEVICE_PMEM;
|
|
||||||
} else {
|
|
||||||
dev->type = PED_DEVICE_UNKNOWN;
|
|
||||||
}
|
|
||||||
@@ -1487,6 +1489,11 @@ linux_new (const char* path)
|
|
||||||
goto error_free_arch_specific;
|
|
||||||
break;
|
|
||||||
|
|
||||||
+ case PED_DEVICE_PMEM:
|
|
||||||
+ if (!init_generic (dev, _("NVDIMM Device")))
|
|
||||||
+ goto error_free_arch_specific;
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
case PED_DEVICE_ATARAID:
|
|
||||||
if (!init_generic (dev, _("ATARAID Controller")))
|
|
||||||
goto error_free_arch_specific;
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index d2e1f24..b49e1df 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -986,7 +986,8 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp)
|
|
||||||
"cpqarray", "file", "ataraid", "i2o",
|
|
||||||
"ubd", "dasd", "viodasd", "sx8", "dm",
|
|
||||||
"xvd", "sd/mmc", "virtblk", "aoe",
|
|
||||||
- "md", "loopback", "nvme", "brd"};
|
|
||||||
+ "md", "loopback", "nvme", "brd",
|
|
||||||
+ "pmem"};
|
|
||||||
|
|
||||||
char* start = ped_unit_format (dev, 0);
|
|
||||||
PedUnit default_unit = ped_unit_get_default ();
|
|
||||||
--
|
|
||||||
2.13.6
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
|||||||
From 0e70861c9f72fb2e06f9a121e6dac0e542ee1230 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 27 Jun 2018 13:45:09 -0700
|
|
||||||
Subject: [PATCH 82/86] Modify gpt-header-move and msdos-overlap to work with
|
|
||||||
py2 or py3
|
|
||||||
|
|
||||||
Distributions are starting to remove python2 and only use python3.
|
|
||||||
Modify these test scripts so that they will work with either python 2.7
|
|
||||||
or python 3.X
|
|
||||||
---
|
|
||||||
tests/gpt-header-move | 15 ++++++++-------
|
|
||||||
tests/msdos-overlap | 5 ++---
|
|
||||||
2 files changed, 10 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/gpt-header-move b/tests/gpt-header-move
|
|
||||||
index 05cdc65..3dda5cb 100755
|
|
||||||
--- a/tests/gpt-header-move
|
|
||||||
+++ b/tests/gpt-header-move
|
|
||||||
@@ -3,20 +3,21 @@
|
|
||||||
# open img file, subtract 33 from altlba address, and move the last 33 sectors
|
|
||||||
# back by 33 sectors
|
|
||||||
|
|
||||||
-from struct import *
|
|
||||||
+from struct import unpack_from, pack_into
|
|
||||||
from zipfile import crc32
|
|
||||||
import array
|
|
||||||
import sys
|
|
||||||
+
|
|
||||||
file = open(sys.argv[1],'rb+')
|
|
||||||
file.seek(512)
|
|
||||||
gptheader = file.read(512)
|
|
||||||
-altlba = unpack_from('<q', gptheader,offset=32)[0]
|
|
||||||
-gptheader = array.array('c',gptheader)
|
|
||||||
+altlba = unpack_from('<q', gptheader, offset=32)[0]
|
|
||||||
+gptheader = array.array('B', gptheader)
|
|
||||||
pack_into('<Q', gptheader, 32, altlba-33)
|
|
||||||
#zero header crc
|
|
||||||
pack_into('<L', gptheader, 16, 0)
|
|
||||||
#compute new crc
|
|
||||||
-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
|
|
||||||
+newcrc = ((crc32(gptheader[:92])) & 0xFFFFFFFF)
|
|
||||||
pack_into('<L', gptheader, 16, newcrc)
|
|
||||||
file.seek(512)
|
|
||||||
file.write(gptheader)
|
|
||||||
@@ -25,7 +26,7 @@ gptheader = file.read(512)
|
|
||||||
file.seek(512*(altlba-32))
|
|
||||||
backup = file.read(512*32)
|
|
||||||
altlba -= 33
|
|
||||||
-gptheader = array.array('c',gptheader)
|
|
||||||
+gptheader = array.array('B',gptheader)
|
|
||||||
#update mylba
|
|
||||||
pack_into('<Q', gptheader, 24, altlba)
|
|
||||||
#update table lba
|
|
||||||
@@ -33,9 +34,9 @@ pack_into('<Q', gptheader, 72, altlba-32)
|
|
||||||
#zero header crc
|
|
||||||
pack_into('<L', gptheader, 16, 0)
|
|
||||||
#compute new crc
|
|
||||||
-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
|
|
||||||
+newcrc = ((crc32(gptheader[:92])) & 0xFFFFFFFF)
|
|
||||||
pack_into('<L', gptheader, 16, newcrc)
|
|
||||||
file.seek(512*(altlba-32))
|
|
||||||
file.write(backup)
|
|
||||||
file.write(gptheader)
|
|
||||||
-file.write("\0" * (512 * 33))
|
|
||||||
+file.write(b"\0" * (512 * 33))
|
|
||||||
diff --git a/tests/msdos-overlap b/tests/msdos-overlap
|
|
||||||
index 5bddfb0..d6ae8d6 100755
|
|
||||||
--- a/tests/msdos-overlap
|
|
||||||
+++ b/tests/msdos-overlap
|
|
||||||
@@ -14,12 +14,11 @@ BAD_ENTRY = (0x72, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
OFFSET = 0x1b8
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
- print "%s: <image or device>"
|
|
||||||
+ print("%s: <image or device>" % sys.argv[0])
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
-data = "".join(chr(c) for c in BAD_ENTRY)
|
|
||||||
with open(sys.argv[1], "rb+") as f:
|
|
||||||
f.seek(OFFSET, 0)
|
|
||||||
- f.write(data)
|
|
||||||
+ f.write(bytes(bytearray(BAD_ENTRY)))
|
|
||||||
|
|
||||||
sys.exit(0)
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From 8a0e65d53cfd7dc83016cfebe3f001edb8de63b5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 27 Jun 2018 13:47:33 -0700
|
|
||||||
Subject: [PATCH 83/86] Switch gpt-header-move and msdos-overlap to python3
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/gpt-header-move | 2 +-
|
|
||||||
tests/msdos-overlap | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/gpt-header-move b/tests/gpt-header-move
|
|
||||||
index 3dda5cb..18f58d0 100755
|
|
||||||
--- a/tests/gpt-header-move
|
|
||||||
+++ b/tests/gpt-header-move
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/python
|
|
||||||
+#!/usr/bin/python3
|
|
||||||
|
|
||||||
# open img file, subtract 33 from altlba address, and move the last 33 sectors
|
|
||||||
# back by 33 sectors
|
|
||||||
diff --git a/tests/msdos-overlap b/tests/msdos-overlap
|
|
||||||
index d6ae8d6..b2b03e6 100755
|
|
||||||
--- a/tests/msdos-overlap
|
|
||||||
+++ b/tests/msdos-overlap
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/python
|
|
||||||
+#!/usr/bin/python3
|
|
||||||
"""
|
|
||||||
Write an overlapping partition to a msdos disk
|
|
||||||
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
|||||||
From 531eb00aaa03f448cdb3f0c647db7f8d4544c50a Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 23 Jul 2018 14:34:30 -0700
|
|
||||||
Subject: [PATCH 84/88] Fix the length of several strncpy calls
|
|
||||||
|
|
||||||
These need to be 1 less than the allocated size of the buffer, strncpy
|
|
||||||
will fill shorter strings with zeros, but there needs to be room for at
|
|
||||||
least one 0x00 at the end if the string is the same length as the buffer
|
|
||||||
and has no terminating 0x00.
|
|
||||||
|
|
||||||
Related: rhbz#1602652
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 12 ++++++++----
|
|
||||||
libparted/labels/mac.c | 9 ++++++---
|
|
||||||
2 files changed, 14 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 1c26b8c..dd4820d 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -2571,9 +2571,12 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part)
|
|
||||||
linux_part.length = part->geom.length * disk->dev->sector_size;
|
|
||||||
}
|
|
||||||
linux_part.pno = part->num;
|
|
||||||
- strncpy (linux_part.devname, dev_name, BLKPG_DEVNAMELTH);
|
|
||||||
- if (vol_name)
|
|
||||||
- strncpy (linux_part.volname, vol_name, BLKPG_VOLNAMELTH);
|
|
||||||
+ strncpy (linux_part.devname, dev_name, BLKPG_DEVNAMELTH-1);
|
|
||||||
+ linux_part.devname[BLKPG_DEVNAMELTH-1] = '\0';
|
|
||||||
+ if (vol_name) {
|
|
||||||
+ strncpy (linux_part.volname, vol_name, BLKPG_VOLNAMELTH-1);
|
|
||||||
+ linux_part.volname[BLKPG_VOLNAMELTH-1] = '\0';
|
|
||||||
+ }
|
|
||||||
|
|
||||||
free (dev_name);
|
|
||||||
|
|
||||||
@@ -2629,7 +2632,8 @@ static int _blkpg_resize_partition (PedDisk* disk, const PedPartition *part)
|
|
||||||
else
|
|
||||||
linux_part.length = part->geom.length * disk->dev->sector_size;
|
|
||||||
linux_part.pno = part->num;
|
|
||||||
- strncpy (linux_part.devname, dev_name, BLKPG_DEVNAMELTH);
|
|
||||||
+ strncpy (linux_part.devname, dev_name, BLKPG_DEVNAMELTH-1);
|
|
||||||
+ linux_part.devname[BLKPG_DEVNAMELTH-1] = '\0';
|
|
||||||
|
|
||||||
free (dev_name);
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
|
|
||||||
index fa4e43f..4942c82 100644
|
|
||||||
--- a/libparted/labels/mac.c
|
|
||||||
+++ b/libparted/labels/mac.c
|
|
||||||
@@ -930,8 +930,10 @@ _generate_raw_part (PedDisk* disk, PedPartition* part,
|
|
||||||
= PED_CPU_TO_BE32 (mac_disk_data->last_part_entry_num);
|
|
||||||
part_map_entry->start_block = PED_CPU_TO_BE32 (part->geom.start);
|
|
||||||
part_map_entry->block_count = PED_CPU_TO_BE32 (part->geom.length);
|
|
||||||
- strncpy (part_map_entry->name, mac_part_data->volume_name, 32);
|
|
||||||
- strncpy (part_map_entry->type, mac_part_data->system_name, 32);
|
|
||||||
+ strncpy (part_map_entry->name, mac_part_data->volume_name, 31);
|
|
||||||
+ part_map_entry->name[31] = '\0';
|
|
||||||
+ strncpy (part_map_entry->type, mac_part_data->system_name, 31);
|
|
||||||
+ part_map_entry->type[31] = '\0';
|
|
||||||
|
|
||||||
if (mac_part_data->is_driver) {
|
|
||||||
if (mac_part_data->has_driver)
|
|
||||||
@@ -954,7 +956,8 @@ _generate_raw_part (PedDisk* disk, PedPartition* part,
|
|
||||||
part_map_entry->boot_cksum =
|
|
||||||
PED_CPU_TO_BE32 (mac_part_data->boot_checksum);
|
|
||||||
|
|
||||||
- strncpy (part_map_entry->processor, mac_part_data->processor_name, 16);
|
|
||||||
+ strncpy (part_map_entry->processor, mac_part_data->processor_name, 15);
|
|
||||||
+ part_map_entry->processor[15] = '\0';
|
|
||||||
|
|
||||||
if (!_pad_raw_part (disk, part->num, part_map))
|
|
||||||
goto error;
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
From d42cea08828c72c6f289add05acd3b93d481fbee Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 23 Jul 2018 15:12:38 -0700
|
|
||||||
Subject: [PATCH 85/86] parted.c: Always free peek_word
|
|
||||||
|
|
||||||
If command_line_get_fs_type failed it would never free it, so put a free
|
|
||||||
in both branches of the if.
|
|
||||||
|
|
||||||
Related: rhbz#1602652
|
|
||||||
---
|
|
||||||
parted/parted.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index b49e1df..dae35a5 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -684,12 +684,13 @@ do_mkpart (PedDevice** dev, PedDisk** diskp)
|
|
||||||
if (part_type == PED_PARTITION_EXTENDED
|
|
||||||
|| (peek_word && isdigit (peek_word[0]))) {
|
|
||||||
fs_type = NULL;
|
|
||||||
+ free (peek_word);
|
|
||||||
} else {
|
|
||||||
+ free (peek_word);
|
|
||||||
if (!command_line_get_fs_type (_("File system type?"),
|
|
||||||
&fs_type))
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
- free (peek_word);
|
|
||||||
|
|
||||||
if (!command_line_get_sector (_("Start?"), *dev, &start, &range_start, NULL))
|
|
||||||
goto error;
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
From d68bd3d8afc97c2c9fcf9aab7819c078f4a21290 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 23 Jul 2018 15:18:37 -0700
|
|
||||||
Subject: [PATCH 86/86] parted.c: Make sure dev_name is freed
|
|
||||||
|
|
||||||
If there was a problem with ped_device_get or ped_device_open it would not be freed.
|
|
||||||
|
|
||||||
Related: rhbz#1602652
|
|
||||||
---
|
|
||||||
parted/parted.c | 10 ++++------
|
|
||||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/parted/parted.c b/parted/parted.c
|
|
||||||
index dae35a5..c95fbbf 100644
|
|
||||||
--- a/parted/parted.c
|
|
||||||
+++ b/parted/parted.c
|
|
||||||
@@ -1100,6 +1100,7 @@ do_print (PedDevice** dev, PedDisk** diskp)
|
|
||||||
if (has_devices_arg) {
|
|
||||||
char* dev_name;
|
|
||||||
PedDevice* current_dev = NULL;
|
|
||||||
+ int status = 0;
|
|
||||||
|
|
||||||
ped_device_probe_all();
|
|
||||||
|
|
||||||
@@ -1115,14 +1116,11 @@ do_print (PedDevice** dev, PedDisk** diskp)
|
|
||||||
ped_device_free_all ();
|
|
||||||
|
|
||||||
*dev = ped_device_get (dev_name);
|
|
||||||
- if (!*dev)
|
|
||||||
- return 0;
|
|
||||||
- if (!ped_device_open (*dev))
|
|
||||||
- return 0;
|
|
||||||
-
|
|
||||||
+ if (*dev && ped_device_open (*dev))
|
|
||||||
+ status = 1;
|
|
||||||
free (dev_name);
|
|
||||||
|
|
||||||
- return 1;
|
|
||||||
+ return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (has_list_arg)
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
From 784d8ff89e1771a5592b38989f5253fa53536cba Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 23 Jul 2018 16:07:40 -0700
|
|
||||||
Subject: [PATCH] t6100--mdraid-partitions: Use v0.90 metadata for the test
|
|
||||||
|
|
||||||
Newer metadata types use more disk space, causing the test to fail.
|
|
||||||
---
|
|
||||||
tests/t6100-mdraid-partitions.sh | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh
|
|
||||||
index dbb1686..f051589 100755
|
|
||||||
--- a/tests/t6100-mdraid-partitions.sh
|
|
||||||
+++ b/tests/t6100-mdraid-partitions.sh
|
|
||||||
@@ -45,8 +45,8 @@ cleanup_fn_() {
|
|
||||||
mdadm -S $md_dev || warn_ "Failed to stop MD array, $md_dev"
|
|
||||||
}
|
|
||||||
|
|
||||||
-# create mdraid on top of both partitions
|
|
||||||
-mdadm -C $md_dev --force -R -l1 -n2 "${scsi_dev}1" "${scsi_dev}2"
|
|
||||||
+# create mdraid on top of both partitions with v0.90 metadata
|
|
||||||
+mdadm -C $md_dev -e0 --force -R -l1 -n2 "${scsi_dev}1" "${scsi_dev}2"
|
|
||||||
|
|
||||||
# create gpt and two partitions on the raid device
|
|
||||||
parted -s $md_dev mklabel gpt \
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
From 027f5669d4c78b035a0c9134608d8411d9617c4b Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Mon, 13 Aug 2018 12:04:23 -0700
|
|
||||||
Subject: [PATCH] linux.c: Use sys/sysmacros.h for major/minor
|
|
||||||
|
|
||||||
gcc is also going to deprecate this at some point, so start using
|
|
||||||
sys/sysmacros.h directly.
|
|
||||||
|
|
||||||
Resolves: rhbz#1615592
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 4ec3440..8eb54fa 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -36,6 +36,7 @@
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
+#include <sys/sysmacros.h> /* for major() and minor() */
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/utsname.h> /* for uname() */
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
From dd07c39b0845bd8542fc38e92da84a5180ad37dc Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Fri, 11 Jan 2019 12:13:46 -0800
|
|
||||||
Subject: [PATCH] t6000-dm: Stop using private lvm root
|
|
||||||
|
|
||||||
On Fedora 30 it has stopped working, and really isn't necessary as long
|
|
||||||
as our device names are unique.
|
|
||||||
|
|
||||||
Related: rhbz#1653912
|
|
||||||
---
|
|
||||||
tests/t6000-dm.sh | 6 +-----
|
|
||||||
1 file changed, 1 insertion(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/t6000-dm.sh b/tests/t6000-dm.sh
|
|
||||||
index 5b29660..c260b96 100755
|
|
||||||
--- a/tests/t6000-dm.sh
|
|
||||||
+++ b/tests/t6000-dm.sh
|
|
||||||
@@ -19,10 +19,6 @@
|
|
||||||
. "${srcdir=.}/init.sh"; path_prepend_ ../parted
|
|
||||||
|
|
||||||
require_root_
|
|
||||||
-lvm_init_root_dir_
|
|
||||||
-
|
|
||||||
-test "x$ENABLE_DEVICE_MAPPER" = xyes \
|
|
||||||
- || skip_ "no device-mapper support"
|
|
||||||
|
|
||||||
# Device maps names - should be random to not conflict with existing ones on
|
|
||||||
# the system
|
|
||||||
@@ -71,7 +67,7 @@ for type in linear ; do
|
|
||||||
|
|
||||||
# setup: create a mapping
|
|
||||||
echo "$dmsetup_cmd" | dmsetup create "$type_kwd" || fail=1
|
|
||||||
- dev="$DM_DEV_DIR/mapper/$type_kwd"
|
|
||||||
+ dev="/dev/mapper/$type_kwd"
|
|
||||||
|
|
||||||
# Create msdos partition table
|
|
||||||
parted -s $dev mklabel msdos > out 2>&1 || fail=1
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
From d74cd53b7a0db94e08c9e034bdf9d59273ada723 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Viktor Mihajlovski <mihajlov@linux.ibm.com>
|
|
||||||
Date: Fri, 27 Sep 2019 18:34:46 +0300
|
|
||||||
Subject: [PATCH] libparted/s390: Re-enabled virtio-attached DASD heuristics
|
|
||||||
|
|
||||||
DASDs attached to KVM guest as virtio-blk devices are only handled
|
|
||||||
properly, if the unique DASD geometry is detected. Commit id
|
|
||||||
61dd3d4c5eb782eb43caa95342e63727db3f8281 has prevented proper geometry
|
|
||||||
detection. Fixed by making sure that HDIO_GETGEO takes precedence
|
|
||||||
on s390[x].
|
|
||||||
|
|
||||||
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
---
|
|
||||||
libparted/arch/linux.c | 13 ++++++++++---
|
|
||||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
|
||||||
index 7771a8b..a40e9f8 100644
|
|
||||||
--- a/libparted/arch/linux.c
|
|
||||||
+++ b/libparted/arch/linux.c
|
|
||||||
@@ -867,6 +867,7 @@ _device_probe_geometry (PedDevice* dev)
|
|
||||||
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
|
|
||||||
struct stat dev_stat;
|
|
||||||
struct hd_geometry geometry;
|
|
||||||
+ int geometry_is_valid = 0;
|
|
||||||
int sector_size = 0;
|
|
||||||
|
|
||||||
if (!_device_stat (dev, &dev_stat))
|
|
||||||
@@ -884,13 +885,19 @@ _device_probe_geometry (PedDevice* dev)
|
|
||||||
dev->bios_geom.heads = 0;
|
|
||||||
dev->bios_geom.cylinders = 0;
|
|
||||||
|
|
||||||
+ geometry_is_valid = !ioctl (arch_specific->fd, HDIO_GETGEO, &geometry)
|
|
||||||
+ && geometry.sectors && geometry.heads;
|
|
||||||
+
|
|
||||||
+#if defined __s390__ || defined __s390x__
|
|
||||||
+ if (geometry_is_valid) {
|
|
||||||
+#else
|
|
||||||
if (!ioctl (arch_specific->fd, BLKSSZGET, §or_size)) {
|
|
||||||
/* get the sector count first */
|
|
||||||
dev->bios_geom.sectors = 1 + (sector_size / PED_SECTOR_SIZE_DEFAULT);
|
|
||||||
dev->bios_geom.heads = 255;
|
|
||||||
- } else if (!ioctl (arch_specific->fd, HDIO_GETGEO, &geometry)
|
|
||||||
- && geometry.sectors && geometry.heads) {
|
|
||||||
- /* if BLKSSZGET failed, try the deprecated HDIO_GETGEO */
|
|
||||||
+ } else if (geometry_is_valid) {
|
|
||||||
+ /* if BLKSSZGET failed, use deprecated HDIO_GETGEO result */
|
|
||||||
+#endif
|
|
||||||
dev->bios_geom.sectors = geometry.sectors;
|
|
||||||
dev->bios_geom.heads = geometry.heads;
|
|
||||||
} else {
|
|
||||||
--
|
|
||||||
2.21.0
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From da8572e6696c2593150af4ba6917dcfc142eebab Mon Sep 17 00:00:00 2001
|
|
||||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
|
||||||
Date: Mon, 5 Aug 2019 09:05:00 -0700
|
|
||||||
Subject: [PATCH 91/97] libparted: Fix endian bug in bsd.c
|
|
||||||
|
|
||||||
You have to add 1 *before* doing the endian conversion, not after.
|
|
||||||
|
|
||||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
||||||
(cherry picked from commit d5827cf0606680b4c4e6bf25ac1a4af6e1092f3f)
|
|
||||||
|
|
||||||
Resolves: rhbz#1980105
|
|
||||||
---
|
|
||||||
libparted/labels/bsd.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
|
|
||||||
index f253a32..1e79408 100644
|
|
||||||
--- a/libparted/labels/bsd.c
|
|
||||||
+++ b/libparted/labels/bsd.c
|
|
||||||
@@ -364,7 +364,7 @@ bsd_write (const PedDisk* disk)
|
|
||||||
max_part = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
- label->d_npartitions = PED_CPU_TO_LE16 (max_part) + 1;
|
|
||||||
+ label->d_npartitions = PED_CPU_TO_LE16 (max_part + 1);
|
|
||||||
label->d_checksum = xbsd_dkcksum (label);
|
|
||||||
|
|
||||||
alpha_bootblock_checksum (bsd_specific->boot_code);
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user