diff mbox

[1/1] partitions/msdos: FreeBSD UFS2 file systems are not recognized

Message ID alpine.LNX.2.21.1705171824100.2450@joy.test (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Narron May 18, 2017, 1:28 a.m. UTC
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:

Signed-off-by: Richard Narron <comet.berkeley@gmail.com>
---
  block/partitions/msdos.c | 2 ++
  1 file changed, 2 insertions(+)

Comments

Christoph Hellwig May 18, 2017, 6:37 a.m. UTC | #1
Thanks Richard,

this looks good to me.

Reviewed-by: Christoph Hellwig <hch@lst.de>

On Wed, May 17, 2017 at 06:28:53PM -0700, Richard Narron wrote:
> 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:
> 
> Signed-off-by: Richard Narron <comet.berkeley@gmail.com>
> ---
>  block/partitions/msdos.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/block/partitions/msdos.c  2015-12-27 18:17:37.000000000 -0800
> +++ b/block/partitions/msdos.c  2015-12-29 10:44:25.813773357 -0800
> @@ -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 = bsd_start + offset;

this could be +=, but I don't think it really matters.
Richard May 21, 2017, 7:21 p.m. UTC | #2
On Wed, 17 May 2017, Christoph Hellwig wrote:

> Thanks Richard,
>
> this looks good to me.
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> On Wed, May 17, 2017 at 06:28:53PM -0700, Richard Narron wrote:
> > 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:
> >
> > Signed-off-by: Richard Narron <comet.berkeley@gmail.com>
> > ---
> >  block/partitions/msdos.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > --- a/block/partitions/msdos.c  2015-12-27 18:17:37.000000000 -0800
> > +++ b/block/partitions/msdos.c  2015-12-29 10:44:25.813773357 -0800
5~> > @@ -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 = bsd_start + offset;
>
> this could be +=, but I don't think it really matters.
>

Thanks Christophe,

I will create a version 2 with +=.

Good style makes maintenance easier.

--
Richard Narron
diff mbox

Patch

--- a/block/partitions/msdos.c  2015-12-27 18:17:37.000000000 -0800
+++ b/block/partitions/msdos.c  2015-12-29 10:44:25.813773357 -0800
@@ -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 = bsd_start + offset;
                 if (offset == bsd_start && size == bsd_size)
                         /* full parent partition, we have it already */
                         continue;