Compare commits
85 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66c2ad5f01 | ||
|
|
a13c518ae5 | ||
|
|
2e579d4323 | ||
|
|
c89e7cb3be | ||
|
|
b1522a9711 | ||
|
|
b58c412aed | ||
|
|
ff0683d294 | ||
|
|
b8c84c9982 | ||
|
|
c438024286 | ||
|
|
7a70ad0b82 | ||
|
|
92a16b9fb1 | ||
|
|
33a7d91cd0 | ||
|
|
dd51fedd16 | ||
|
|
e932a887a1 | ||
|
|
5243164589 | ||
|
|
7fdac872b5 | ||
|
|
d747d1a8fe | ||
|
|
dc75c40906 | ||
|
|
fb7cd25e73 | ||
|
|
270e49b966 | ||
|
|
d2e6c54e3e | ||
|
|
7fc0182f62 | ||
|
|
8298c363a4 | ||
|
|
cc64ab77d5 | ||
|
|
3318fc5238 | ||
|
|
8b0c9ee0a5 | ||
|
|
953543a358 | ||
|
|
4cce40f55c | ||
|
|
dc62f3b119 | ||
|
|
e0dc6bb4b8 | ||
|
|
e78da4c42a | ||
|
|
514b0689bd | ||
|
|
ece299beb7 | ||
|
|
fb6ff33ba9 | ||
|
|
27d77ddc17 | ||
|
|
e3d368e543 | ||
|
|
152bd148e9 | ||
|
|
e7b34705b0 | ||
|
|
ce8126ec00 | ||
|
|
1a6875dda1 | ||
|
|
cabbcbc983 | ||
|
|
9017fc8519 | ||
|
|
c9bde538a7 | ||
|
|
4ff1a768b4 | ||
|
|
a0755650de | ||
|
|
8207dbd150 | ||
|
|
04d1488083 | ||
|
|
e59dafa4c9 | ||
|
|
633c371306 | ||
|
|
28a7decb69 | ||
|
|
0dd29ac6e1 | ||
|
|
7bd556f35f | ||
|
|
ec86b620a2 | ||
|
|
c4782e273c | ||
|
|
a21276aead | ||
|
|
ac53ea06ad | ||
|
|
5dbd295bd4 | ||
|
|
512a61e4a8 | ||
|
|
9afea59440 | ||
|
|
5f329fbe24 | ||
|
|
399a450ce8 | ||
|
|
d3035b6b7f | ||
|
|
c3686805a4 |
||
|
|
9b87badc1f | ||
|
|
e4f4556ff6 | ||
|
|
0bd0e13f0d | ||
|
|
21f562c24e | ||
|
|
901c30f0f2 | ||
|
|
185ade9225 | ||
|
|
c7c469766d |
||
|
|
8f615e462d | ||
|
|
c0bbbd4bbe | ||
|
|
30d99a722c | ||
|
|
14abe5ec64 | ||
|
|
d6652ea632 | ||
|
|
3166d30c65 | ||
|
|
749ef2e667 | ||
|
|
639e36f434 | ||
|
|
d16b395769 |
||
|
|
b4c887cad2 | ||
|
|
abca6a9a06 | ||
|
|
633c511c8c | ||
|
|
4e3bf318ee | ||
|
|
a0d503db4c | ||
|
|
d75d85cc43 |
75 changed files with 944 additions and 5295 deletions
1
.fmf/version
Normal file
1
.fmf/version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
17
.gitignore
vendored
17
.gitignore
vendored
|
|
@ -11,3 +11,20 @@ clog
|
|||
/parted-3.1.90.tar.xz.sig
|
||||
/parted-3.2.tar.xz
|
||||
/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.4.64.tar.xz
|
||||
/parted-3.4.64.tar.xz.sig
|
||||
/parted-3.5.tar.xz
|
||||
/parted-3.5.tar.xz.sig
|
||||
/parted-3.5.28.tar.xz
|
||||
/parted-3.5.28.tar.xz.sig
|
||||
/parted-3.6.tar.xz
|
||||
/parted-3.6.tar.xz.sig
|
||||
/parted-3.6.tar.xz.sug
|
||||
|
|
|
|||
28
0001-parted-Print-the-Fixing.-message-to-stderr.patch
Normal file
28
0001-parted-Print-the-Fixing.-message-to-stderr.patch
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
From fc16e90a9fd64e2db12a815417b538b193fe48db Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 10 Jul 2024 15:41:16 -0700
|
||||
Subject: [PATCH 1/2] parted: Print the Fixing... message to stderr
|
||||
|
||||
Otherwise it messes up stdout of things like --json
|
||||
|
||||
Thanks to Mikael Q for reporting this.
|
||||
---
|
||||
parted/ui.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/parted/ui.c b/parted/ui.c
|
||||
index 33a1808..d6d1da4 100644
|
||||
--- a/parted/ui.c
|
||||
+++ b/parted/ui.c
|
||||
@@ -645,7 +645,7 @@ exception_handler (PedException* ex)
|
||||
/* script-mode and fix? */
|
||||
int fix_is_an_option = (ex->options & PED_EXCEPTION_FIX);
|
||||
if (opt_script_mode && opt_fix_mode && fix_is_an_option) {
|
||||
- printf ("Fixing, due to --fix\n");
|
||||
+ fprintf (stderr, "Fixing, due to --fix\n");
|
||||
return PED_EXCEPTION_FIX;
|
||||
}
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
37
0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch
Normal file
37
0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
From e34c1477cfa446f1b44287b10425a9e69602b519 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Fri, 12 Jul 2024 16:24:58 -0700
|
||||
Subject: [PATCH 2/2] doc: Document IEC unit behavior in the manpage
|
||||
|
||||
Previously this has only been documented in the info page.
|
||||
---
|
||||
doc/C/parted.8 | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
||||
index 3069c33..171269c 100644
|
||||
--- a/doc/C/parted.8
|
||||
+++ b/doc/C/parted.8
|
||||
@@ -151,6 +151,19 @@ Toggle the state of the disk \fIflag\fP.
|
||||
.B version
|
||||
Display version information and a copyright message.
|
||||
.RE
|
||||
+.SH UNITS
|
||||
+\fBparted\fP will compute sensible ranges for the locations you specify when using
|
||||
+units like "GB", "MB", etc. Use the sector unit "s" or IEC binary units like
|
||||
+"GiB", "MiB", to specify exact locations.
|
||||
+
|
||||
+When you specify start or end values using IEC binary units like "MiB",
|
||||
+"GiB", "TiB", etc., \fBparted\fP treats those values as exact, and equivalent to
|
||||
+the same number specified in bytes (i.e., with the "B" suffix), in that it
|
||||
+provides no helpful range of sloppiness. Contrast that with a partition
|
||||
+start request of "4GB", which may actually resolve to some sector up to 500MB
|
||||
+before or after that point. Thus, when creating a partition in an exact location
|
||||
+you should use units of bytes ("B"), sectors ("s"), or IEC binary units like
|
||||
+"MiB", "GiB", but not "MB", "GB", etc.
|
||||
.SH REPORTING BUGS
|
||||
Report bugs to <bug-parted@gnu.org>
|
||||
.SH SEE ALSO
|
||||
--
|
||||
2.45.2
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
From f1cdf08806caf7d71779a5fe67af797c8e3ab09e Mon Sep 17 00:00:00 2001
|
||||
From: Phillip Susi <psusi@ubuntu.com>
|
||||
Date: Mon, 28 Jul 2014 23:19:51 -0400
|
||||
Subject: [PATCH 2/6] maint: post-release administrivia
|
||||
|
||||
* NEWS: Add header line for next release.
|
||||
* .prev-version: Record previous version.
|
||||
* cfg.mk (old_NEWS_hash): Auto-update.
|
||||
---
|
||||
.prev-version | 2 +-
|
||||
NEWS | 3 +++
|
||||
cfg.mk | 2 +-
|
||||
3 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/.prev-version b/.prev-version
|
||||
index 8c50098..a3ec5a4 100644
|
||||
--- a/.prev-version
|
||||
+++ b/.prev-version
|
||||
@@ -1 +1 @@
|
||||
-3.1
|
||||
+3.2
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 49c8129..297b0a5 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -1,5 +1,8 @@
|
||||
GNU parted NEWS -*- outline -*-
|
||||
|
||||
+* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
+
|
||||
+
|
||||
* Noteworthy changes in release 3.2 (2014-07-28) [stable]
|
||||
|
||||
** New Features
|
||||
diff --git a/cfg.mk b/cfg.mk
|
||||
index ade72d7..62a02b6 100644
|
||||
--- a/cfg.mk
|
||||
+++ b/cfg.mk
|
||||
@@ -43,7 +43,7 @@ local-checks-to-skip = \
|
||||
# Now that we have better (check.mk) tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
-old_NEWS_hash = bd453bcf049e292a9677c094d24a29dd
|
||||
+old_NEWS_hash = 85f2e93c40425e202491675d97e40166
|
||||
|
||||
include $(srcdir)/dist-check.mk
|
||||
|
||||
--
|
||||
1.9.3
|
||||
|
||||
55
0003-libparted-Fail-early-when-detecting-nilfs2.patch
Normal file
55
0003-libparted-Fail-early-when-detecting-nilfs2.patch
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
From 8623f65e1fd064a679f75e3e075dff86f30282a7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= <oldium.pro@gmail.com>
|
||||
Date: Sat, 6 Apr 2024 19:21:11 +0200
|
||||
Subject: [PATCH] libparted: Fail early when detecting nilfs2
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When the disk is encrypted with TCG Opal HW encryption (supported by
|
||||
cryptsetup 2.7.0+), the partition initially contains locked area, which
|
||||
shows reading errors in kernel logs and may lead to configuring the disk
|
||||
to work with lower reading speed. When the disk area is unlocked with
|
||||
password, the reading succeeds. The beginning of the protected partition is
|
||||
not locked and contains LUKS header, this is always readable.
|
||||
|
||||
To work around the errors when reading from the locked area, try first
|
||||
detecting nilfs2 at the beginning (may be an unprotected LUKS header area)
|
||||
and only check the second superblock that is at the end of the area (and
|
||||
possibly locked) if the first one is valid (meaning the partition is not
|
||||
LUKS-protected).
|
||||
|
||||
This is a change in behavior, but is consistent with the nilfs2 code, which
|
||||
considers both superblocks mandatory, see [1].
|
||||
|
||||
[1] https://github.com/nilfs-dev/nilfs-utils/blob/master/lib/sb.c#L135-L158
|
||||
|
||||
Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
|
||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||
---
|
||||
libparted/fs/nilfs2/nilfs2.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
|
||||
index 6204542..40f8567 100644
|
||||
--- a/libparted/fs/nilfs2/nilfs2.c
|
||||
+++ b/libparted/fs/nilfs2/nilfs2.c
|
||||
@@ -118,11 +118,12 @@ nilfs2_probe (PedGeometry* geom)
|
||||
|
||||
if (ped_geometry_read(geom, buf, 0, sectors))
|
||||
sb = (struct nilfs2_super_block*)(buf + 1024);
|
||||
+ if (!sb || !is_valid_nilfs_sb(sb))
|
||||
+ return NULL;
|
||||
+
|
||||
if (ped_geometry_read(geom, buff2, sb2off, sectors2))
|
||||
sb2 = (struct nilfs2_super_block*)buff2;
|
||||
-
|
||||
- if ((!sb || !is_valid_nilfs_sb(sb)) &&
|
||||
- (!sb2 || !is_valid_nilfs_sb(sb2)))
|
||||
+ if (!sb2 || !is_valid_nilfs_sb(sb2))
|
||||
return NULL;
|
||||
|
||||
/* reserve 4k bytes for secondary superblock */
|
||||
--
|
||||
2.47.0
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
41
0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch
Normal file
41
0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
From 16343bda6ce0d41edf43f8dac368db3bbb63d271 Mon Sep 17 00:00:00 2001
|
||||
From: Rudi Heitbaum <rudi@heitbaum.com>
|
||||
Date: Wed, 20 Nov 2024 12:22:22 +0000
|
||||
Subject: [PATCH] bug#74444: [PATCH] parted: fix do_version declaration
|
||||
|
||||
With gcc 15-20241117 compile fails with the below error, update the
|
||||
do_version declaration to match the header in command.h
|
||||
|
||||
../../parted/parted.c: In function '_init_commands':
|
||||
../../parted/parted.c:2469:9: error: passing argument 2 of 'command_create' from incompatible pointer type [-Wincompatible-pointer-types]
|
||||
2469 | do_version,
|
||||
| ^~~~~~~~~~
|
||||
| |
|
||||
| int (*)(void)
|
||||
In file included from ../../parted/parted.c:28:
|
||||
../../parted/command.h:35:39: note: expected 'int (*)(PedDevice **, PedDisk **)' {aka 'int (*)(struct _PedDevice **, struct _PedDisk **)'} but argument is of type 'int (*)(void)'
|
||||
35 | int (*method) (PedDevice** dev, PedDisk** diskp),
|
||||
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
|
||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||
---
|
||||
parted/parted.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/parted/parted.c b/parted/parted.c
|
||||
index 3abb52f..fc2aeba 100644
|
||||
--- a/parted/parted.c
|
||||
+++ b/parted/parted.c
|
||||
@@ -2172,7 +2172,7 @@ do_unit (PedDevice** dev, PedDisk** diskp)
|
||||
}
|
||||
|
||||
static int
|
||||
-do_version ()
|
||||
+do_version (PedDevice** dev, PedDisk** diskp)
|
||||
{
|
||||
printf ("\n%s\n%s",
|
||||
prog_name,
|
||||
--
|
||||
2.47.0
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
31
0005-libparted-Fix-sun-disklabel-unhandled-exception.patch
Normal file
31
0005-libparted-Fix-sun-disklabel-unhandled-exception.patch
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
From 95b877cfa36c1571487c2a67a3902f1f5c4dc747 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Tue, 7 Jan 2025 16:50:21 -0800
|
||||
Subject: [PATCH 5/8] libparted: Fix sun disklabel unhandled exception
|
||||
|
||||
The CHS warning should only continue if ignored, not if unhandled.
|
||||
|
||||
Script mode, or exception handlers can return PED_EXCEPTION_UNHANDLED
|
||||
which should act the same as a cancel. Previously it would only exit if
|
||||
cancel was selected, allowing it to continue to use the bad CHS and
|
||||
crash later.
|
||||
---
|
||||
libparted/labels/sun.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c
|
||||
index 5ed2886..853576b 100644
|
||||
--- a/libparted/labels/sun.c
|
||||
+++ b/libparted/labels/sun.c
|
||||
@@ -284,7 +284,7 @@ _check_geometry_sanity (PedDisk* disk, SunRawLabel* label)
|
||||
PED_BE16_TO_CPU(label->pcylcount),
|
||||
PED_BE16_TO_CPU(label->ntrks),
|
||||
PED_BE16_TO_CPU(label->nsect))
|
||||
- == PED_EXCEPTION_CANCEL)
|
||||
+ != PED_EXCEPTION_IGNORE)
|
||||
return 0;
|
||||
#endif
|
||||
dev->bios_geom.sectors = PED_BE16_TO_CPU(label->nsect);
|
||||
--
|
||||
2.47.1
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
116
0006-tests-Add-test-for-SUN-disklabel-handling.patch
Normal file
116
0006-tests-Add-test-for-SUN-disklabel-handling.patch
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
From bdb92f73112177c091a764836a9ceaa59f7e9b15 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 8 Jan 2025 11:59:40 -0800
|
||||
Subject: [PATCH 6/8] tests: Add test for SUN disklabel handling
|
||||
|
||||
When fixed the output from script mode should be an unknown disklabel,
|
||||
not sun.
|
||||
---
|
||||
tests/Makefile.am | 3 ++-
|
||||
tests/sun-badlabel | 42 +++++++++++++++++++++++++++++++++++++
|
||||
tests/t4002-sun-badlabel.sh | 23 ++++++++++++++++++++
|
||||
3 files changed, 67 insertions(+), 1 deletion(-)
|
||||
create mode 100755 tests/sun-badlabel
|
||||
create mode 100644 tests/t4002-sun-badlabel.sh
|
||||
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index fa27b44..00f4a9d 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -67,6 +67,7 @@ TESTS = \
|
||||
t3400-whole-disk-FAT-partition.sh \
|
||||
t4000-sun-raid-type.sh \
|
||||
t4001-sun-vtoc.sh \
|
||||
+ t4002-sun-badlabel.sh \
|
||||
t4100-msdos-partition-limits.sh \
|
||||
t4100-dvh-partition-limits.sh \
|
||||
t4100-msdos-starting-sector.sh \
|
||||
@@ -103,7 +104,7 @@ TESTS = \
|
||||
EXTRA_DIST = \
|
||||
$(TESTS) t-local.sh t-lvm.sh \
|
||||
init.cfg init.sh t-lib-helpers.sh gpt-header-munge \
|
||||
- gpt-header-move msdos-overlap gpt-attrs
|
||||
+ gpt-header-move msdos-overlap gpt-attrs sun-badlabel
|
||||
|
||||
check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \
|
||||
fs-resize
|
||||
diff --git a/tests/sun-badlabel b/tests/sun-badlabel
|
||||
new file mode 100755
|
||||
index 0000000..6a28e86
|
||||
--- /dev/null
|
||||
+++ b/tests/sun-badlabel
|
||||
@@ -0,0 +1,42 @@
|
||||
+#!/usr/bin/python3
|
||||
+# Mangle the CHS values stored in a SUN disklabel
|
||||
+# This sets CHS to 1 track, 2 sectors and updates the checksum
|
||||
+# This triggers a bug in the SUN disklabel code when the CHS
|
||||
+# error is UNHANDLED (in script mode or with a custom exception
|
||||
+# handler) and it continues using a bad label which will coredump
|
||||
+# when .duplicate() is called on it.
|
||||
+
|
||||
+import array
|
||||
+from struct import unpack_from, pack_into
|
||||
+import sys
|
||||
+
|
||||
+file = open(sys.argv[1],'rb+')
|
||||
+header = file.read(512)
|
||||
+
|
||||
+# Make sure it looks like a SUN disklabel first
|
||||
+magic = unpack_from(">H", header, 0x1FC)[0]
|
||||
+if magic != 0xDABE:
|
||||
+ raise RuntimeError("Not a SUN disklabel. magic = 0x%04X" % magic)
|
||||
+csum = unpack_from(">H", header, 0x1FE)[0]
|
||||
+ntrks = unpack_from(">H", header, 0x1B4)[0]
|
||||
+nsect = unpack_from(">H", header, 0x1B6)[0]
|
||||
+
|
||||
+header = array.array('B', header)
|
||||
+# cylinders at 0x1B0
|
||||
+# modify ntrks at offset 0x1B4
|
||||
+pack_into('>H', header, 0x1B4, 1)
|
||||
+# modify nsect at offset 0x1B6
|
||||
+pack_into('>H', header, 0x1B6, 2)
|
||||
+
|
||||
+## Undo old values
|
||||
+csum ^= ntrks
|
||||
+csum ^= nsect
|
||||
+
|
||||
+## Add new
|
||||
+csum ^= 1
|
||||
+csum ^= 2
|
||||
+pack_into('>H', header, 0x1FE, csum)
|
||||
+
|
||||
+file.seek(0)
|
||||
+file.write(header)
|
||||
+file.close()
|
||||
diff --git a/tests/t4002-sun-badlabel.sh b/tests/t4002-sun-badlabel.sh
|
||||
new file mode 100644
|
||||
index 0000000..177c0e4
|
||||
--- /dev/null
|
||||
+++ b/tests/t4002-sun-badlabel.sh
|
||||
@@ -0,0 +1,23 @@
|
||||
+#!/bin/sh
|
||||
+# Test exception handling on a bad SUN disklabel
|
||||
+
|
||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
|
||||
+ss=$sector_size_
|
||||
+
|
||||
+n_sectors=2000 # number of sectors
|
||||
+dev=sun-disk-file
|
||||
+# create an empty file as a test disk
|
||||
+dd if=/dev/zero of=$dev bs=$ss count=$n_sectors 2> /dev/null || fail=1
|
||||
+
|
||||
+# label the test disk as a sun disk
|
||||
+parted -s $dev mklabel sun > out 2>&1 || fail=1
|
||||
+compare /dev/null out || fail=1
|
||||
+
|
||||
+# Mangle the disklabel to have incorrect CHS values, but a valid checksum
|
||||
+sun-badlabel $dev || fail=1
|
||||
+
|
||||
+# Check the output (this should return 1, but depend on checking the output for the test)
|
||||
+parted -m -s $dev p > out 2>&1
|
||||
+grep unknown out || { cat out; fail=1; }
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
2.47.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
|
||||
|
||||
29
0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch
Normal file
29
0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
From 1480769f2a7071c5a251b6c69658808199e8b05b Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 8 Jan 2025 13:35:04 -0800
|
||||
Subject: [PATCH 7/8] libparted: Fix dvh disklabel unhandled exception
|
||||
|
||||
When an exception is using PED_EXCEPTION_IGNORE_CANCEL it should check
|
||||
for !PED_EXCEPTION_IGNORE so that an unhandled exception is treated the
|
||||
same as cancel. Otherwise it could lead to using the disklabel with
|
||||
incorrect values.
|
||||
---
|
||||
libparted/labels/dvh.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c
|
||||
index 0f9124d..7d7dae3 100644
|
||||
--- a/libparted/labels/dvh.c
|
||||
+++ b/libparted/labels/dvh.c
|
||||
@@ -308,7 +308,7 @@ dvh_read (PedDisk* disk)
|
||||
PED_EXCEPTION_IGNORE_CANCEL,
|
||||
_("Checksum is wrong, indicating the partition "
|
||||
"table is corrupt."))
|
||||
- == PED_EXCEPTION_CANCEL)
|
||||
+ != PED_EXCEPTION_IGNORE)
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.47.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
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
57
0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch
Normal file
57
0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
From 82b582996ce691eb635bed124603207515b92efe Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 8 Jan 2025 14:01:39 -0800
|
||||
Subject: [PATCH 8/8] tests: Add test for dvh with a bad checksum
|
||||
|
||||
When using script mode it should return an unknown partition type, not
|
||||
dvh, because the exception is unhandled.
|
||||
---
|
||||
tests/Makefile.am | 1 +
|
||||
tests/t4101-dvh-badlabel.sh | 23 +++++++++++++++++++++++
|
||||
2 files changed, 24 insertions(+)
|
||||
create mode 100644 tests/t4101-dvh-badlabel.sh
|
||||
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index 00f4a9d..5eeab08 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -71,6 +71,7 @@ TESTS = \
|
||||
t4100-msdos-partition-limits.sh \
|
||||
t4100-dvh-partition-limits.sh \
|
||||
t4100-msdos-starting-sector.sh \
|
||||
+ t4101-dvh-badlabel.sh \
|
||||
t4200-partprobe.sh \
|
||||
t4300-nilfs2-tiny.sh \
|
||||
t4301-nilfs2-badsb2.sh \
|
||||
diff --git a/tests/t4101-dvh-badlabel.sh b/tests/t4101-dvh-badlabel.sh
|
||||
new file mode 100644
|
||||
index 0000000..075c044
|
||||
--- /dev/null
|
||||
+++ b/tests/t4101-dvh-badlabel.sh
|
||||
@@ -0,0 +1,23 @@
|
||||
+#!/bin/sh
|
||||
+# Test exception handling on a bad DVH disklabel
|
||||
+
|
||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
|
||||
+ss=$sector_size_
|
||||
+
|
||||
+n_sectors=2000 # number of sectors
|
||||
+dev=sun-disk-file
|
||||
+# create an empty file as a test disk
|
||||
+dd if=/dev/zero of=$dev bs=$ss count=$n_sectors 2> /dev/null || fail=1
|
||||
+
|
||||
+# label the test disk as a dvh disk
|
||||
+parted -s $dev mklabel dvh > out 2>&1 || fail=1
|
||||
+compare /dev/null out || fail=1
|
||||
+
|
||||
+# Mangle the disklabel to have incorrect checksum
|
||||
+dd if=/dev/zero of=$dev conv=notrunc bs=4 count=1 seek=1
|
||||
+
|
||||
+# Check the output (this should return 1, but depend on checking the output for the test)
|
||||
+parted -m -s $dev p > out 2>&1
|
||||
+grep unknown out || { cat out; fail=1; }
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
2.47.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
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
From 43c2b908396e8b7baa475e009f3f4dbf9b9beac7 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 28 May 2025 11:24:21 -0700
|
||||
Subject: [PATCH 09/12] tests: probing ext4 without journal should still
|
||||
indicate ext4
|
||||
|
||||
t1700 tests a fix for the ext filesystem probe code, it was previously
|
||||
returning ext2 when the filesystem is really ext4 without a journal.
|
||||
|
||||
t3200 is updated to reflect the correct filesystem type -- it creates a
|
||||
fs too small for a journal so it used to identify it as ext2 but now
|
||||
correctly identifies it as ext4.
|
||||
---
|
||||
tests/t1700-probe-fs.sh | 10 ++++++++++
|
||||
tests/t3200-resize-partition.sh | 2 +-
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
|
||||
index 7557f92..2bf2810 100755
|
||||
--- a/tests/t1700-probe-fs.sh
|
||||
+++ b/tests/t1700-probe-fs.sh
|
||||
@@ -70,4 +70,14 @@ for feature in uninit_bg flex_bg; do
|
||||
rm $dev
|
||||
done
|
||||
|
||||
+# ext4 without a journal should still indicate ext4
|
||||
+# create an ext3 file system
|
||||
+dd if=/dev/null of=$dev bs=1024 seek=8192 >/dev/null || skip_ "dd failed"
|
||||
+mkfs.ext4 -O ^has_journal -F $dev >/dev/null || skip_ "mkfs.ext4 failed"
|
||||
+
|
||||
+# probe the file system, which should still be ext4
|
||||
+parted -m -s $dev u s print >out 2>&1 || fail=1
|
||||
+grep '^1:.*:ext4::;$' out || fail=1
|
||||
+rm $dev
|
||||
+
|
||||
Exit $fail
|
||||
diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh
|
||||
index 846fbc3..c9decab 100755
|
||||
--- a/tests/t3200-resize-partition.sh
|
||||
+++ b/tests/t3200-resize-partition.sh
|
||||
@@ -111,7 +111,7 @@ compare exp out || fail=1
|
||||
parted -m -s $dev u s p > out 2>&1 || fail=1
|
||||
|
||||
sed -n 3p out > k && mv k out || fail=1
|
||||
-printf "1:$default_start:$new_end:3073s:ext2::$ms;\n" > exp || fail=1
|
||||
+printf "1:$default_start:$new_end:3073s:ext4::$ms;\n" > exp || fail=1
|
||||
compare exp out || fail=1
|
||||
|
||||
umount "${dev}1" || fail=1
|
||||
--
|
||||
2.49.0
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From e61584ddeb952ff04823936dabd1a6a241f04f38 Mon Sep 17 00:00:00 2001
|
||||
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
|
||||
Date: Thu, 17 Apr 2025 18:42:33 +0200
|
||||
Subject: [PATCH 10/12] libparted: Do not detect ext4 without journal as ext2
|
||||
|
||||
ext4 may have other incompatible features than journal and cannot be
|
||||
mounted as ext2 by linux, so detect it as ext4 even without journal
|
||||
if it has other incompatible features.
|
||||
|
||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||
---
|
||||
libparted/fs/ext2/interface.c | 33 +++++++++++++++------------------
|
||||
1 file changed, 15 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c
|
||||
index 7e0b197..5f64ab3 100644
|
||||
--- a/libparted/fs/ext2/interface.c
|
||||
+++ b/libparted/fs/ext2/interface.c
|
||||
@@ -52,24 +52,21 @@ _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver)
|
||||
int is_ext3 = 0;
|
||||
int is_ext4 = 0;
|
||||
|
||||
- is_ext3 = (EXT2_SUPER_FEATURE_COMPAT (*sb)
|
||||
- & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0;
|
||||
- if (is_ext3) {
|
||||
- is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
|
||||
- & EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
|
||||
- || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
|
||||
- & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
|
||||
- || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
|
||||
- & EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
|
||||
- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
|
||||
- & EXT4_FEATURE_INCOMPAT_EXTENTS)
|
||||
- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
|
||||
- & EXT4_FEATURE_INCOMPAT_64BIT)
|
||||
- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
|
||||
- & EXT4_FEATURE_INCOMPAT_FLEX_BG));
|
||||
- if (is_ext4)
|
||||
- is_ext3 = 0;
|
||||
- }
|
||||
+ is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
|
||||
+ & EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
|
||||
+ || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
|
||||
+ & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
|
||||
+ || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb)
|
||||
+ & EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
|
||||
+ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
|
||||
+ & EXT4_FEATURE_INCOMPAT_EXTENTS)
|
||||
+ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
|
||||
+ & EXT4_FEATURE_INCOMPAT_64BIT)
|
||||
+ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb)
|
||||
+ & EXT4_FEATURE_INCOMPAT_FLEX_BG));
|
||||
+ if (!is_ext4)
|
||||
+ is_ext3 = (EXT2_SUPER_FEATURE_COMPAT (*sb)
|
||||
+ & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0;
|
||||
if (expect_ext_ver == 2 && (is_ext3 || is_ext4))
|
||||
return NULL;
|
||||
if (expect_ext_ver == 3 && !is_ext3)
|
||||
--
|
||||
2.49.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
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From 2fad7d827d27e75298f1d17b5fa6567ddfc4c338 Mon Sep 17 00:00:00 2001
|
||||
From: Anton Butenko <abutenko@akamai.com>
|
||||
Date: Fri, 28 Feb 2025 16:09:18 +0100
|
||||
Subject: [PATCH 11/12] nilfs2: Fixed possible sigsegv in case of corrupted
|
||||
superblock
|
||||
|
||||
bytes value comes from the superblock and it must be at least as long as
|
||||
s_sum which is a 32 bit value. So sumoff + 4 is the correct lower limit
|
||||
for it, not sumoff - 4.
|
||||
|
||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||
---
|
||||
libparted/fs/nilfs2/nilfs2.c | 2 +-
|
||||
tests/t4301-nilfs2-badsb2.sh | 10 ++++++++--
|
||||
2 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
|
||||
index 40f8567..74186f1 100644
|
||||
--- a/libparted/fs/nilfs2/nilfs2.c
|
||||
+++ b/libparted/fs/nilfs2/nilfs2.c
|
||||
@@ -88,7 +88,7 @@ is_valid_nilfs_sb(struct nilfs2_super_block *sb)
|
||||
return 0;
|
||||
|
||||
bytes = PED_LE16_TO_CPU(sb->s_bytes);
|
||||
- if (bytes > 1024 || bytes < sumoff - 4)
|
||||
+ if (bytes > 1024 || bytes < sumoff + 4)
|
||||
return 0;
|
||||
|
||||
crc = __efi_crc32(sb, sumoff, PED_LE32_TO_CPU(sb->s_crc_seed));
|
||||
diff --git a/tests/t4301-nilfs2-badsb2.sh b/tests/t4301-nilfs2-badsb2.sh
|
||||
index 2a1205b..45b6644 100755
|
||||
--- a/tests/t4301-nilfs2-badsb2.sh
|
||||
+++ b/tests/t4301-nilfs2-badsb2.sh
|
||||
@@ -27,16 +27,22 @@ end=$(($len * 512 / $ss))
|
||||
parted -s $dev mklabel msdos mkpart primary 1s ${end}s || framework_failure_
|
||||
|
||||
# Write a secondary superblock with the nilfs magic number and a nilfs
|
||||
-# superblock length (s_bytes) field of only 10 bytes.
|
||||
+# superblock length (s_bytes) field of only 13 bytes.
|
||||
# struct nilfs2_super_block starts with these four fields...
|
||||
# uint32_t s_rev_level;
|
||||
# uint16_t s_minor_rev_level;
|
||||
# uint16_t s_magic;
|
||||
# uint16_t s_bytes;
|
||||
sb2_offset=$(( 24 / ($ss / 512) + 1))
|
||||
-perl -e "print pack 'LSSS.', 0, 0, 0x3434, 10, $ss" |
|
||||
+perl -e "print pack 'LSSS.', 0, 0, 0x3434, 13, $ss" |
|
||||
dd of=$dev bs=$ss seek=$sb2_offset count=1 conv=notrunc
|
||||
|
||||
+# Write primary nilfs magic number and a nilfs
|
||||
+# superblock length (s_bytes) field of only 13 bytes.
|
||||
+sb_offset=3
|
||||
+perl -e "print pack 'LSSS.', 0, 0, 0x3434, 13, $ss" |
|
||||
+ dd of=$dev bs=$ss seek=$sb_offset count=1 conv=notrunc
|
||||
+
|
||||
# This used to give parted a sigsegv.
|
||||
parted -s $dev print || fail=1
|
||||
|
||||
--
|
||||
2.49.0
|
||||
|
||||
90
0012-doc-Fix-some-groff-mandoc-linting-complaints.patch
Normal file
90
0012-doc-Fix-some-groff-mandoc-linting-complaints.patch
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
From a2164c99b4d7d37334f9ca5ece55d8af95d002b7 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
Date: Wed, 28 May 2025 13:09:32 -0700
|
||||
Subject: [PATCH 12/12] doc: Fix some groff/mandoc linting complaints
|
||||
|
||||
---
|
||||
doc/C/parted.8 | 27 ++++++++++++---------------
|
||||
1 file changed, 12 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
||||
index 171269c..c852112 100644
|
||||
--- a/doc/C/parted.8
|
||||
+++ b/doc/C/parted.8
|
||||
@@ -54,7 +54,6 @@ Use optimum alignment as given by the disk topology information. This
|
||||
aligns to a multiple of the physical block size in a way that guarantees
|
||||
optimal performance.
|
||||
.RE
|
||||
-
|
||||
.SH COMMANDS
|
||||
.TP
|
||||
.B [device]
|
||||
@@ -62,8 +61,7 @@ The block device to be used. When none is given, \fBparted\fP will use the
|
||||
first block device it finds.
|
||||
.TP
|
||||
.B [command [options]]
|
||||
-Specifies the command to be executed. If no command is given,
|
||||
-.BR parted
|
||||
+Specifies the command to be executed. If no command is given, \fBparted\fP
|
||||
will present a command prompt. Possible commands are:
|
||||
.RS
|
||||
.TP
|
||||
@@ -119,8 +117,8 @@ or an LVM logical volume if necessary.
|
||||
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
|
||||
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
|
||||
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
|
||||
-"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home",
|
||||
-"no_automount", "bios_grub", and "palo".
|
||||
+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot",
|
||||
+"linux-home", "no_automount", "bios_grub", and "palo".
|
||||
\fIstate\fP should be either "on" or "off".
|
||||
.TP
|
||||
.B unit \fIunit\fP
|
||||
@@ -140,10 +138,10 @@ On MS-DOS set the type aka. partition id of \fIpartition\fP to
|
||||
the type-uuid of \fIpartition\fP to \fIuuid\fP.
|
||||
.TP
|
||||
.B disk_set \fIflag\fP \fIstate\fP
|
||||
-Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or "off".
|
||||
-Some or all of these flags will be available, depending on what disk label you
|
||||
-are using. Supported flags are: "pmbr_boot" on GPT to enable the boot flag on the
|
||||
-GPT's protective MBR partition.
|
||||
+Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or
|
||||
+"off". Some or all of these flags will be available, depending on what disk
|
||||
+abel you are using. Supported flags are: "pmbr_boot" on GPT to enable the
|
||||
+boot flag on the GPT's protective MBR partition.
|
||||
.TP
|
||||
.B disk_toggle \fIflag\fP
|
||||
Toggle the state of the disk \fIflag\fP.
|
||||
@@ -155,24 +153,23 @@ Display version information and a copyright message.
|
||||
\fBparted\fP will compute sensible ranges for the locations you specify when using
|
||||
units like "GB", "MB", etc. Use the sector unit "s" or IEC binary units like
|
||||
"GiB", "MiB", to specify exact locations.
|
||||
-
|
||||
When you specify start or end values using IEC binary units like "MiB",
|
||||
"GiB", "TiB", etc., \fBparted\fP treats those values as exact, and equivalent to
|
||||
the same number specified in bytes (i.e., with the "B" suffix), in that it
|
||||
provides no helpful range of sloppiness. Contrast that with a partition
|
||||
start request of "4GB", which may actually resolve to some sector up to 500MB
|
||||
-before or after that point. Thus, when creating a partition in an exact location
|
||||
-you should use units of bytes ("B"), sectors ("s"), or IEC binary units like
|
||||
-"MiB", "GiB", but not "MB", "GB", etc.
|
||||
+before or after that point. Thus, when creating a partition in an exact
|
||||
+location you should use units of bytes ("B"), sectors ("s"), or IEC binary units
|
||||
+like "MiB", "GiB", but not "MB", "GB", etc.
|
||||
.SH REPORTING BUGS
|
||||
Report bugs to <bug-parted@gnu.org>
|
||||
.SH SEE ALSO
|
||||
.BR fdisk (8),
|
||||
.BR mkfs (8),
|
||||
The \fIparted\fP program is fully documented in the
|
||||
-.BR info(1)
|
||||
+.BR info (1)
|
||||
format
|
||||
-.IR "GNU partitioning software"
|
||||
+.I "GNU partitioning software"
|
||||
manual.
|
||||
.SH AUTHOR
|
||||
This manual page was written by Timshel Knoll <timshel@debian.org>,
|
||||
--
|
||||
2.49.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
|
||||
|
||||
7
gating.yaml
Normal file
7
gating.yaml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_contexts: [bodhi_update_push_stable]
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
1369
parted.spec
1369
parted.spec
File diff suppressed because it is too large
Load diff
8
plans/test-parted.fmf
Normal file
8
plans/test-parted.fmf
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
summary: Run a basic parted test
|
||||
prepare:
|
||||
how: install
|
||||
package:
|
||||
- parted
|
||||
- jq
|
||||
execute:
|
||||
script: ./tests/scripts/run_tests.sh
|
||||
108
pubkey.brian.lane
Normal file
108
pubkey.brian.lane
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQENBEt+xXMBCACkA1ZtcO4H7ZUG/0aL4RlZIozsorXzFrrTAsJEHvdy+rHCH3xR
|
||||
cFz6IMbfCOdV+oKxlDP7PS0vWKfqxwkenOUut5o9b32uDdFMW4IbFXEQ94AuSQpS
|
||||
jo8PlVMm/51pmmRxdJzyPnr0YD38mVK6qUEYLI/4zXSgFk493GT8Y4m3N18O/+ye
|
||||
PnOOItj7qbrCMASoBx1TG8Zdg8ufehMnfb85x4xxAebXkqJQpEVTjt4lj4p6BhrW
|
||||
R+pIW/nBUrz3OsV7WwPKjSLjJtTJFxYX+RFSCqOdfusuysoOxpIHOx1WxjGUOB5j
|
||||
fnhmq41nWXf8ozb58zSpjDrJ7jGQ9pdUpAtRABEBAAG0HkJyaWFuIEMuIExhbmUg
|
||||
PGJjbEByZWRoYXQuY29tPokBVAQTAQoAPgIbAwIeAQIXgAULCQgHAwUVCgkICwUW
|
||||
AgMBABYhBLTGtFHk+otCMsoZHhF+jBaO/jp/BQJglc7SBQkW+DzfAAoJEBF+jBaO
|
||||
/jp/H4sH/A/92VVmfKssdC41fIO2iBIokLLfAAYzw75unKS84ovjeussUHqgDVCt
|
||||
ZzXcHixo6oiYGgtyb5/EXTgEK6blZiUgsiWLFcFAo3tvCpMz9xa3XcaSw7MKwHCI
|
||||
lmcdZalnQD47cu3E0CjFRoo9p3yueDYh3ZjMEzAFilGiZOBeoMwKxCofVqQCstp0
|
||||
0XZVMjAD/ZvhuNyXmqYykAcjORY2eVq92tOAdW6cAqv963hlDs6GRdYxBbx6Jorx
|
||||
8bqpTQA9o/y3g6clt/oPmjAXtBPnHQFH6XlVIXodCPc5iuEe6gFmvL29JDARTkee
|
||||
hIsqNbrPy11JQkD6EfC6vaWQ5G1DbsWIRgQQEQIABgUCS37G6QAKCRAh+2P+lxLC
|
||||
zbmrAJ9ENIweBGv/eRERFJAhU5vS+pzqQACfbUM8Bl4ayxWcznUVmIlnAkG1+f+J
|
||||
AhwEEAEKAAYFAlVhGI8ACgkQ0phFpw9QF94AEBAAj9g/cR2fv6ognKbd3noTz7zt
|
||||
8unMKD33s4evHaLQCaeqZLa26RPg2LDlPBmUbyAT75KMqEnAo5Mm5cLTrQY0k3mF
|
||||
/Ngz3B4FzGisQeD73i0J5Pu9nNqp3h2j1cn/mm9FsbWmTSvxEKsIUIbmSC+vsTNg
|
||||
Wte9Uw2QuRpFlxUPL8VkCgY94cHBtH1ths+ZdWP9c5FQm4C+f1ZFpWvxD5ISLLXH
|
||||
YEChsB/wzZYsBtOu8PuHj7Po7jKjpKiG9tF1HK2naD2b2nTtwaJWzBgidfWjJGXn
|
||||
wViwozEU+DrWH1XRaqiKtAgKQq8ggtduHsQ2SPjYC4FuQ+cwIUPJPB+Xox7e+S01
|
||||
2utBsK32tGkCa1ACjDrwePbs65c+/krz3oSRaPPzCTakboGUVL0qxk+nWNvjdxls
|
||||
iL0SCFgRRS6bxokLrb4xBmBX3qiHP7TIcEDu4WYNBLwsGtV+g89Yh8gXquizDo9H
|
||||
UU5/+/f4wJmXr6o86R/QqjGj5MAUOUZTHyBTPtEDOYnEOQSYPBnZfxAeH/zKVnLz
|
||||
TbL6fsB4juddE084bY08gM0utYVuKNudkykHMFLzO5Iou2te3lMKGlePSau/eAi0
|
||||
xHpsy4s/Ykls+KBXHYWghBouZJ18RkPwbQ6WFH18B3frh6ge4lAJ+HprXAEPk6Ag
|
||||
pJxRGbLxdozB6ZSOrsaJATgEEwECACIFAkt+xXMCGwMGCwkIBwMCBhUIAgkKCwQW
|
||||
AgMBAh4BAheAAAoJEBF+jBaO/jp/XYAH/R4titTCnJi5A3klCF5FyAMNJwM5dlAx
|
||||
i1hHQ6gIBcT+lGglbTiEQq+8+BAzkKMQ+5pHXpGx9luRnEzuIfDEAR2A/RJGOx/5
|
||||
UynIZRX7JmnzqAN2P7QyzyrvjiHx/TKp9jH+8DGBq51kkTSmILwuc5DIJIaD1Jkj
|
||||
zx8gWm7HUvyoOWQH+N2nPzF2PVfDJOs6mwZY+kGKoydJwQ+r8KM6w0OYCbQ1C5kI
|
||||
aNd8z5+JQSZfWCVY3IEQdlm84EmTpZ9A31dtknmouur56+TcmjiMOQfUC0jYTRGj
|
||||
xbMBAyygrJ7PXZA7hhV+dvzLf4uyckr8ITAahxJT81psAh3mOOTPIAWJAT0EEwEK
|
||||
ACcCGwMCHgECF4AFCwkIBwMFFQoJCAsFFgIDAQAFAlVYGtMFCQu6iNwACgkQEX6M
|
||||
Fo7+On8IuggAj6souVSKFq26OaRPhV1L7kaKBI+1NO/s8G4tCNDu9x+M1dS1uGBP
|
||||
K4L/ojAKiE8KTdrV8PIo/8O95TRMzVvBNXxtvwKkcL+/E8OCIEN/IDfQ16kj69iJ
|
||||
5mpZ3cOjQ8QTqsqITXsNZseyKRd3Z1bUKmUXlROErH9zHgHu4u+t/HVxTq8dAqvy
|
||||
vdq9B+KHdO8QuJWV889i92McrGGnzfV8m40tGXhxeaXpVRAdk7fl+Uy0vyv9gCyL
|
||||
+Zc76i+Ol+18iG96sHNrAse2fcrPMQci9GBJ/zHyYImJzyNOdO3e6KDUAWm1kRth
|
||||
tC2LbT91uLq5f2l1WF3taNy5rjmvjANFBIkBPQQTAQoAJwIbAwIeAQIXgAULCQgH
|
||||
AwUVCgkICwUWAgMBAAUCVz5PnQUJDaC9pQAKCRARfowWjv46f6JrB/4oC8tTjYV+
|
||||
htspYII6nhAMyAhLq6ooaZthDAoekLOdXVv1m4+unn1fSHO3dptksuhAXlrcclDf
|
||||
Da8itF625ZbkuN0tAaj6eeIRqV4cYd77UYrd8tF4DGIjJTn/4e6sM+ssRm03Lo2s
|
||||
OPE5HFbv5q3X4K9+zxI3md3nepUenLZhVKFG1xKtpw+nxkgj/i7oaEknMDq59Jx/
|
||||
YgYswCozAHwN61S/XyFyh3DgVSVmZOi+ut/QJRio8vti+6KUwHAkD+s43oKF1I1m
|
||||
EB455DZQqNs/z+ThIRfCCeftDtECB58o1n7KQ0OHf607Qina9OtPECufgIcXYFC4
|
||||
BhaF1E9XjkmmiQE9BBMBCgAnAhsDAh4BAheABQsJCAcDBRUKCQgLBRYCAwEABQJZ
|
||||
JKWdBQkPjvyYAAoJEBF+jBaO/jp/XtcH/RrsPIyfUmQwRLMxCqy35yh0yePsE2zZ
|
||||
WKocpZ4TaVe83hKCbDdFLEPclezY5v8j9hq1a2uYdlmQJHESfksNT9qTqLv6djWh
|
||||
74UDVnzyyQ1zQ7mjrNwUu14zBt8pUJF/rJX5v6jqCWVwgWvWmbUDvn5faTqRdxoN
|
||||
3sx2Z0/V/dKHXCa5+UxGYqm8KjM2+pcjYFNOh3XK4DWR6kiwkX3RnQwKs5Ptijqv
|
||||
PXERCn4FRP8gP+UBTUUY/cE4dD5jxcz5LjDR7teqvYnPOKGVLjHMXLFV+QeAJyMZ
|
||||
DNfqPdPxdcrfez1ncdVk8L0qkzTGd+UKu1y1AUH807kaEZOi+onJRPmJAT0EEwEK
|
||||
ACcCGwMCHgECF4AFCwkIBwMFFQoJCAsFFgIDAQAFAlsAUi4FCRFcKLcACgkQEX6M
|
||||
Fo7+On/cBAf/ewi1vMBCSuafD+OUQxidePAo9QvgGFMbIHgyVGm2kL2fxjIt4QAZ
|
||||
XL+s4pm5hTMF1s+HcfQ/sa8oLfJD02CPz/aaDo2EEFQd6s4mJEtWJwsMHwktc1lm
|
||||
Gt8IpwVYxC7EGsFgXXZQE6yNy6OhfxAcIHQopbBs7eQedoqIP/4LlOj2cjqjEAAS
|
||||
XlhJgYAao72wAuglbRlBOhsYAmyhW19I+dzlslCvM082ui0S1ps/tMTbDyXrTGib
|
||||
wlek733G+6h/09JDp1GzVPHwGigh9auB4W+5Emh6AtwnwAynbJr+QCcDft4PXZUW
|
||||
ew9kgHk0lwawPXa6WsJ+MxZAx8QVYJduFYkBPgQTAQIAKAIbAwYLCQgHAwIGFQgC
|
||||
CQoLBBYCAwECHgECF4AFAlVYFjwFCQu6hEUACgkQEX6MFo7+On/aogf/fiBGl5jN
|
||||
UuY17p4sFlqfdNtKdbfubFPesQtE9BpRy2DNd0Y3QrDUnrLZr9UE7umN2lx8PrJJ
|
||||
Y33hLj6DbcVuBvbxJxrhGD9hWgBzren4xzGW2dX1WqPLupg3zrmbNOeoUbR1iKUA
|
||||
s+rO6/lsr+9j6hLWuCADDusOe4pSLfwvU3UDZEV3D11kE+5I9HLR1JEyuJpIp9cf
|
||||
jFjKY55V/t/vO9UiNK9djSTGuwlBG5BbfQYSKqidvWcd5OswiZ0GRA4vjd5Hg50R
|
||||
8bh8JpD8ILLYjpL4C2juDjSuiI84+SvC7eXJ+wuMDBvNe2btzuELgFElKmikgeK1
|
||||
fNT3G7eKXQq8kLkBDQRLfsVzAQgAvN5jr95pJthv2w9co9/7omhM5rAnr9WJfbML
|
||||
LiUfPPUvpL24RGO6SKy03aiVTUjlaHc+cGqOciwnNKMCSt+noyG2kNnAESTDtCiv
|
||||
psjonaFP8jA3TqL0QK+yzBRKJnMnLEY1nWE1FtkMRccXvzi0Z/XQVhiWQyTvDFoK
|
||||
tepBFrH9UqWbNHyki22aighumUsW01pcPH2ogSj+HR01r7SfI/y2EkE6loHQfCDy
|
||||
cHmlqYV+X6GZEvf1qu2+EHEQChsHIAxWyshsxM/ZPmx/8e5S3Xmjl7h/6E9wcsIp
|
||||
vnf504sLX5j4Km9I5HgJSRxHxgRPpqJ2/XiClAJanO5gCw0RdQARAQABiQE8BBgB
|
||||
CgAmAhsMFiEEtMa0UeT6i0IyyhkeEX6MFo7+On8FAmCVzrsFCRb4PMgACgkQEX6M
|
||||
Fo7+On/svQgAnigeMeQPF3mDhjy88yNwL2cIdP8IPNU/lx70e5IJfL0cOWX8xX7n
|
||||
n446Tj7KvACWLlFyhCNI3Wm9a2WMTsTKA8gG/WgDFgOONFN+2KyrCza1fgvzgv89
|
||||
ybovdksM5PGtS660O8SsMAIa7HUyObnTJHWJIUQxyzZrw9EQ6kX/JB1NHEX/zKfN
|
||||
n5E0CPeBXfDYvNzUnBuJkTyBBk0zMF/k05RQ0FrA08SkF/YMAWWrzBbMQTnooSuP
|
||||
7AHuVudX+P3XIqtVLL3S55HMag0hSA0aW0ghSFqiqabmvtLmJOHL7Ai3/FKCafou
|
||||
SEd7AfZKfWLGgBslnLrcST5ytRNs4LI9KZkBDQRLfsVzAQgApANWbXDuB+2VBv9G
|
||||
i+EZWSKM7KK18xa60wLCRB73cvqxwh98UXBc+iDG3wjnVfqCsZQz+z0tL1in6scJ
|
||||
HpzlLreaPW99rg3RTFuCGxVxEPeALkkKUo6PD5VTJv+daZpkcXSc8j569GA9/JlS
|
||||
uqlBGCyP+M10oBZOPdxk/GOJtzdfDv/snj5zjiLY+6m6wjAEqAcdUxvGXYPLn3oT
|
||||
J32/OceMcQHm15KiUKRFU47eJY+KegYa1kfqSFv5wVK89zrFe1sDyo0i4ybUyRcW
|
||||
F/kRUgqjnX7rLsrKDsaSBzsdVsYxlDgeY354ZquNZ1l3/KM2+fM0qYw6ye4xkPaX
|
||||
VKQLUQARAQABtB5CcmlhbiBDLiBMYW5lIDxiY2xAcmVkaGF0LmNvbT6JAT0EEwEK
|
||||
ACcCGwMCHgECF4AFCwkIBwMFFQoJCAsFFgIDAQAFAlVYGtMFCQu6iNwACgkQEX6M
|
||||
Fo7+On8IuggAj6souVSKFq26OaRPhV1L7kaKBI+1NO/s8G4tCNDu9x+M1dS1uGBP
|
||||
K4L/ojAKiE8KTdrV8PIo/8O95TRMzVvBNXxtvwKkcL+/E8OCIEN/IDfQ16kj69iJ
|
||||
5mpZ3cOjQ8QTqsqITXsNZseyKRd3Z1bUKmUXlROErH9zHgHu4u+t/HVxTq8dAqvy
|
||||
vdq9B+KHdO8QuJWV889i92McrGGnzfV8m40tGXhxeaXpVRAdk7fl+Uy0vyv9gCyL
|
||||
+Zc76i+Ol+18iG96sHNrAse2fcrPMQci9GBJ/zHyYImJzyNOdO3e6KDUAWm1kRth
|
||||
tC2LbT91uLq5f2l1WF3taNy5rjmvjANFBLkBDQRLfsVzAQgAvN5jr95pJthv2w9c
|
||||
o9/7omhM5rAnr9WJfbMLLiUfPPUvpL24RGO6SKy03aiVTUjlaHc+cGqOciwnNKMC
|
||||
St+noyG2kNnAESTDtCivpsjonaFP8jA3TqL0QK+yzBRKJnMnLEY1nWE1FtkMRccX
|
||||
vzi0Z/XQVhiWQyTvDFoKtepBFrH9UqWbNHyki22aighumUsW01pcPH2ogSj+HR01
|
||||
r7SfI/y2EkE6loHQfCDycHmlqYV+X6GZEvf1qu2+EHEQChsHIAxWyshsxM/ZPmx/
|
||||
8e5S3Xmjl7h/6E9wcsIpvnf504sLX5j4Km9I5HgJSRxHxgRPpqJ2/XiClAJanO5g
|
||||
Cw0RdQARAQABiQElBBgBAgAPAhsMBQJVWBYHBQkLuoQNAAoJEBF+jBaO/jp/S90H
|
||||
/i/evVsbDpDexbwy2Smg/Kv1ymdqYDsRKhsXln7+nQJteryTwLtIQUHpe0255vTR
|
||||
4rjvHKYK+JvyjTuuyg5XEEIarqokwlyNiSq3qi5PGCYRkUBzQXxs+lEFoitiRTWr
|
||||
UH6H0kR9up567mQO3xy6Rw4NdiLwpGpBjofH8u69vkFMNXxWYwlscM70Ye3uCP6E
|
||||
TFYYdlnD+KHlXtaCKqu4vh9QEVV9lx6qx3Gh4gNcKYQwsGBtNi+QcGlR+cQZnIfQ
|
||||
yNDmEqwON6sW2LqKSrkBjwN18jK3kDSSTMXKAEIM4OTTayqD9jdoA+j6pJ3QF8m5
|
||||
MupQVzWmw8NNbNuPfGmsE/s=
|
||||
=Frrv
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
4
sources
4
sources
|
|
@ -1,2 +1,2 @@
|
|||
0247b6a7b314f8edeb618159fa95f9cb parted-3.2.tar.xz
|
||||
1b7304b51580d7121a890376ea7406d7 parted-3.2.tar.xz.sig
|
||||
SHA512 (parted-3.6.tar.xz) = 034a44b25718acba175212019d24f092972a791c5bd1d921ae91e17478657a77c5c5dd0c832bed7968c3a07ec6c65c0785acfac2f90c1ca5e1692f3c141693ef
|
||||
SHA512 (parted-3.6.tar.xz.sig) = 7c845026937b29fb49085ef9e3354226b73a1c3b5f9082d440d9a8ac13d76b1d07dae0bc10d8c974d4e57bc582f38c0a908e80718dd1ff1adfad3b04699c672c
|
||||
|
|
|
|||
1
tests/.fmf/version
Normal file
1
tests/.fmf/version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
30
tests/scripts/run_tests.sh
Executable file
30
tests/scripts/run_tests.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/bash
|
||||
set -eux
|
||||
|
||||
DISK=/var/tmp/parted-disk.img
|
||||
|
||||
# Make a temporary disk image to use for tests
|
||||
fallocate -l 100MiB $DISK
|
||||
|
||||
# Make a disklabel and a couple of partitions
|
||||
parted -s $DISK mklabel gpt
|
||||
parted -s $DISK mkpart vfat 1MiB 10MiB
|
||||
parted -s $DISK mkpart ext4 10MiB 50MiB
|
||||
parted -s $DISK mkpart ext4 50MiB 75MiB
|
||||
parted -s $DISK set 1 boot
|
||||
parted -s $DISK set 3 linux-home
|
||||
|
||||
# Check p1 for ESP UUID c12a7328-f81f-11d2-ba4b-00a0c93ec93b
|
||||
P1_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[0]."type-uuid"')
|
||||
[ "$P1_TYPE" == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" ] || exit 1
|
||||
|
||||
# Check p2 for linux data type 0fc63daf-8483-4772-8e79-3d69d8477de4
|
||||
P2_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[1]."type-uuid"')
|
||||
[ "$P2_TYPE" == "0fc63daf-8483-4772-8e79-3d69d8477de4" ] || exit 1
|
||||
|
||||
# Check p3 for linux home type 933ac7e1-2eb4-4f13-b844-0e14e2aef915
|
||||
P3_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[2]."type-uuid"')
|
||||
[ "$P3_TYPE" == "933ac7e1-2eb4-4f13-b844-0e14e2aef915" ] || exit 1
|
||||
|
||||
echo "PASS"
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue