[Parted-commits] GNU Parted Official Repository: Changes to 'stable-1.8.x'
Otavio Salvador
otavio at alioth.debian.org
Thu Jul 26 22:56:22 UTC 2007
configure.ac | 5 +++--
libparted/fs/ext2/ext2_block_relocator.c | 8 ++++++--
libparted/fs/ext2/ext2_meta.c | 2 +-
libparted/labels/gpt.c | 15 +++++++++------
4 files changed, 19 insertions(+), 11 deletions(-)
New commits:
commit 1b69b32a53e6ae1a837d1613fd3d9e201959818b
Author: Flavio Leitner <flavio.leitner at gmail.com>
Date: Tue Jun 12 14:54:26 2007 -0300
Fix block state checking for realocated blocks
A busy block should be realocated and it's correct in
ext2_block_relocator_mark(), but not in ext2_metadata_push().
Signed-off-by: Flavio Leitner <flavio.leitner at gmail.com>
Signed-off-by: Jim Meyering <jim at meyering.net>
(cherry picked from commit 986d88f0f5174aa044fe5d5dad6eb84db11e18fc)
diff --git a/libparted/fs/ext2/ext2_meta.c b/libparted/fs/ext2/ext2_meta.c
index 653bd87..09fb8ad 100644
--- a/libparted/fs/ext2/ext2_meta.c
+++ b/libparted/fs/ext2/ext2_meta.c
@@ -64,7 +64,7 @@ int ext2_metadata_push(struct ext2_fs *fs, blk_t newsize)
if (fs->opt_debug)
{
for (j=0;j<diff;j++)
- if (ext2_get_block_state(fs, fromblock+j))
+ if (!ext2_get_block_state(fs, fromblock+j))
{
fprintf(stderr,
"error: block relocator "
commit 67fd393d6f97f912ebcccd43388adc037f8f448b
Author: Flavio Leitner <flavio.leitner at gmail.com>
Date: Tue Jun 12 14:53:20 2007 -0300
Fix block number used when checking for state
Hi there,
The ext2_bread() returns a descriptor containing a
pointer ->data representing the contents of 1 block.
In ext2_block_relocate_grow(), it reads the block bitmap from
a group descriptor representing a range of blocks:
bh = ext2_bread(fs, EXT2_GROUP_BLOCK_BITMAP(fs->gd[i]));
Then it does:
k = EXT2_GROUP_INODE_TABLE(fs->gd[i]) + fs->inodeblocks + j;
k is the absolute block number and then checks the state doing:
if (bh->data[k>>3] & _bitmap[k&7])
The k should be the offset inside of group descriptor and not
the absolute block number. Example:
. Block bitmap represents 512 blocks
. Block absolute number is 1023.
GrpDesc = Block absolute number / block bitmap size = 1
bh = ext2_bread(fs, EXT2_GROUP_BLOCK_BITMAP(fs->gd[GrpDesc]))
bh->data[] contains a bitmap of 512 blocks from 512-1024
relative = absolute block number % block bitmap size
relative = 1023/512 = 511
The block state is in bitmap bh->data[relative>>3] & ...
Signed-off-by: Flavio Leitner <flavio.leitner at gmail.com>
Signed-off-by: Jim Meyering <jim at meyering.net>
(cherry picked from commit 640f523b9e200874bc46348370f56e68dfe7107c)
diff --git a/libparted/fs/ext2/ext2_block_relocator.c b/libparted/fs/ext2/ext2_block_relocator.c
index 5b2b37c..b75a4c5 100644
--- a/libparted/fs/ext2/ext2_block_relocator.c
+++ b/libparted/fs/ext2/ext2_block_relocator.c
@@ -796,17 +796,21 @@ static int ext2_block_relocate_grow(struct ext2_fs *fs, struct ext2_block_reloca
for (j=0;j<diff;j++)
{
+ blk_t block;
blk_t k;
k = EXT2_GROUP_INODE_TABLE(fs->gd[i])
+ fs->inodeblocks + j;
- if (bh->data[k>>3] & _bitmap[k&7])
+ block = k % EXT2_SUPER_BLOCKS_PER_GROUP(fs->sb);
+ if (bh->data[block>>3] & _bitmap[block&7]) {
+ k += EXT2_SUPER_FIRST_DATA_BLOCK(fs->sb);
if (!ext2_block_relocator_mark(fs,
- state, start + k))
+ state, k))
{
ext2_brelse(bh, 0);
return 0;
}
+ }
}
}
commit a0717dad223d00275796d2d6c7c6a13a3f772728
Author: Michael Brennan <brennan.brisad at gmail.com>
Date: Tue Jul 10 04:26:38 2007 +0200
Fix syntax error and LIBS problem in configure.ac
Make sure LIBS doesn't contain libraries that will prevent
successful compilations after libreadline has been tested.
A trailing comma generated a syntax error in the configure script.
Signed-off-by: Michael Brennan <brennan.brisad at gmail.com>
(cherry picked from commit 30b73bfa856168db826a11ea09183cf24b1b550e)
diff --git a/configure.ac b/configure.ac
index 5095f88..f04cf59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,7 +325,7 @@ package as well (which may be called readline-devel or something similar).
exit,
$PARTED_LIBS
)
- LIBS="$OLD_LIBS"
+ LIBS="$OLD_LIBS $PARTED_LIBS"
# See if libreadline is too old to be used.
# The readline function in Debian's libreadline5 5.0-10 fails to
@@ -357,8 +357,9 @@ Consider upgrading to version 5.2 or newer.)
if test $found_working_libreadline = yes; then
PARTED_LIBS="-lreadline $PARTED_LIBS"
- AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline]),
+ AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline])
fi
+ LIBS="$OLD_LIBS"
fi
AC_SUBST(PARTED_LIBS)
commit b4f83344eba5ba1e0c80b609fa2639684d22548c
Author: Matthew S. Harris <mharris312 at gmail.com>
Date: Sun Jul 8 12:27:07 2007 -0700
More correct handling of the HeaderSize field in GPT labels
- Use the HeaderSize field value when determining how many bytes to
compute the CRC over.
- Don't abort if the HeaderSize field value is bigger than our struct,
since more fields may be defined in the future.
Signed-off-by: Matthew S. Harris <mharris at coruscant.(none)>
(cherry picked from commit 6be273f13b07f1e6b16922fc1555c12be1427cc0)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 45c1c74..4dc4f10 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -389,7 +389,7 @@ pth_crc32(const PedDevice* dev, const GuidPartitionTableHeader_t* pth)
PED_ASSERT (dev != NULL, return 0);
PED_ASSERT (pth != NULL, return 0);
- crc32 = efi_crc32 (pth_raw, pth_get_size_static (dev));
+ crc32 = efi_crc32 (pth_raw, PED_LE32_TO_CPU (pth->HeaderSize));
ped_free (pth_raw);
@@ -589,8 +589,13 @@ _header_is_valid (const PedDevice* dev, GuidPartitionTableHeader_t* gpt)
if (PED_LE64_TO_CPU (gpt->Signature) != GPT_HEADER_SIGNATURE)
return 0;
- if (PED_LE32_TO_CPU (gpt->HeaderSize)
- > pth_get_size_static (dev))
+ /*
+ * "While the GUID Partition Table Header's size may increase
+ * in the future it cannot span more than one block on the
+ * device." EFI Specification, version 1.10, 11.2.2.1
+ */
+ if (PED_LE32_TO_CPU (gpt->HeaderSize) < pth_get_size_static (dev)
+ || PED_LE32_TO_CPU (gpt->HeaderSize) > dev->sector_size)
return 0;
origcrc = gpt->HeaderCRC32;
@@ -638,9 +643,7 @@ _parse_header (PedDisk* disk, GuidPartitionTableHeader_t* gpt,
PED_ASSERT (_header_is_valid (disk->dev, gpt), return 0);
#ifndef DISCOVER_ONLY
- if (PED_LE32_TO_CPU (gpt->Revision) > GPT_HEADER_REVISION_V1_02
- || PED_LE32_TO_CPU (gpt->HeaderSize) != pth_get_size_static (
- disk->dev)) {
+ if (PED_LE32_TO_CPU (gpt->Revision) > GPT_HEADER_REVISION_V1_02) {
if (ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE_CANCEL,
More information about the Parted-commits
mailing list