Skip to contentSkip to conversation

partitions/msdos: FreeBSD UFS2 file systems are not recognized

PATCH Superseded Richard Narron 2 participants 2 messages May 21, 2017 – May 22, 2017 Block layer

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 partitions/msdos: FreeBSD UFS2 file systems are not recognized

The code in block/partitions/msdos.c recognizes FreeBSD, OpenBSD and NetBSD partitions and does a reasonable job picking out OpenBSD and NetBSD UFS subpartitions.

But for FreeBSD the subpartitions are always "bad".

Kernel: <bsd:bad subpartition - ignored

Though all 3 of these BSD systems use UFS as a file system, only FreeBSD uses relative start addresses in the subpartition declarations.

The following patch fixes this for FreeBSD partitions and leaves the code for OpenBSD and NetBSD intact:

---
Changelog v1->v2:
- Improve style, use += ---

 block/partitions/msdos.c | 2 ++
 1 file changed, 2 insertions(+)
block/partitions/msdos.c +2 -0
@@ -300,6 +300,8 @@ static void parse_bsd(struct parsed_part
 			continue;
 		bsd_start = le32_to_cpu(p->p_offset);
 		bsd_size = le32_to_cpu(p->p_size);
+		if (memcmp(flavour, "bsd\0", 4) == 0)
+			bsd_start += offset;
 		if (offset == bsd_start && size == bsd_size)
 			/* full parent partition, we have it already */
 			continue;