mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +03:00
Fix strict-aliasing compile warning in partition table scanning
This commit is contained in:
parent
8f1ead4640
commit
f7311db64f
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.75 -
|
Version 2.02.75 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Fix strict-aliasing compile warning in partition table scanning.
|
||||||
Add an option to automatically extend snapshots through dmeventd.
|
Add an option to automatically extend snapshots through dmeventd.
|
||||||
Remove dependency on libm, floor() is replaced with integer algorithm.
|
Remove dependency on libm, floor() is replaced with integer algorithm.
|
||||||
Fix hang when repairing a mirrored-log that had both devs fail.
|
Fix hang when repairing a mirrored-log that had both devs fail.
|
||||||
|
@ -58,9 +58,11 @@ static int _has_partition_table(struct device *dev)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
unsigned p;
|
unsigned p;
|
||||||
uint16_t buf[SECTOR_SIZE/sizeof(uint16_t)];
|
struct {
|
||||||
uint16_t *part_magic;
|
uint8_t skip[PART_OFFSET];
|
||||||
struct partition *part;
|
struct partition part[4];
|
||||||
|
uint16_t magic;
|
||||||
|
} __attribute__((packed)) buf; /* sizeof() == SECTOR_SIZE */
|
||||||
|
|
||||||
if (!dev_read(dev, UINT64_C(0), sizeof(buf), &buf))
|
if (!dev_read(dev, UINT64_C(0), sizeof(buf), &buf))
|
||||||
return_0;
|
return_0;
|
||||||
@ -68,17 +70,15 @@ static int _has_partition_table(struct device *dev)
|
|||||||
/* FIXME Check for other types of partition table too */
|
/* FIXME Check for other types of partition table too */
|
||||||
|
|
||||||
/* Check for msdos partition table */
|
/* Check for msdos partition table */
|
||||||
part_magic = buf + PART_MAGIC_OFFSET/sizeof(buf[0]);
|
if (buf.magic == xlate16(PART_MAGIC)) {
|
||||||
if ((*part_magic == xlate16(PART_MAGIC))) {
|
for (p = 0; p < 4; ++p) {
|
||||||
part = (struct partition *) (buf + PART_OFFSET/sizeof(buf[0]));
|
|
||||||
for (p = 0; p < 4; p++, part++) {
|
|
||||||
/* Table is invalid if boot indicator not 0 or 0x80 */
|
/* Table is invalid if boot indicator not 0 or 0x80 */
|
||||||
if ((part->boot_ind & 0x7f)) {
|
if (buf.part[p].boot_ind & 0x7f) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Must have at least one non-empty partition */
|
/* Must have at least one non-empty partition */
|
||||||
if (part->nr_sects)
|
if (buf.part[p].nr_sects)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user