All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org, Rob Herring <rob.herring@calxeda.com>
Subject: Re: [PATCH 2/5] filetype: add GPT support
Date: Fri, 15 Feb 2013 11:56:47 +0100	[thread overview]
Message-ID: <20130215105647.GO1906@pengutronix.de> (raw)
In-Reply-To: <20130215104526.GZ19322@game.jcrosoft.org>

On Fri, Feb 15, 2013 at 11:45:26AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 10:00 Fri 15 Feb     , Sascha Hauer wrote:
> > On Thu, Feb 14, 2013 at 11:44:30PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > GPT need to be check before MBR
> > > 
> > > Cc: Rob Herring <rob.herring@calxeda.com>
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > >  common/filetype.c  |   47 +++++++++++++++++++++++++++++++++++++++++++++++
> > >  include/filetype.h |    1 +
> > >  2 files changed, 48 insertions(+)
> > > 
> > > diff --git a/common/filetype.c b/common/filetype.c
> > > index 22fc621..a685ea5 100644
> > > --- a/common/filetype.c
> > > +++ b/common/filetype.c
> > > @@ -48,6 +48,7 @@ static const struct filetype_str filetype_str[] = {
> > >  	[filetype_bmp] = { "BMP image", "bmp" },
> > >  	[filetype_png] = { "PNG image", "png" },
> > >  	[filetype_ext] = { "ext filesystem", "ext" },
> > > +	[filetype_gpt] = { "GUID Partition Table", "gpt" },
> > >  };
> > >  
> > >  const char *file_type_to_string(enum filetype f)
> > > @@ -69,9 +70,52 @@ const char *file_type_to_short_string(enum filetype f)
> > >  #define MBR_StartSector		8	/* MBR: Offset of Starting Sector in Partition Table Entry */
> > >  #define BS_55AA			510	/* Boot sector signature (2) */
> > >  #define MBR_Table		446	/* MBR: Partition table offset (2) */
> > > +#define MBR_partition_size	16	/* MBR: Partition table offset (2) */
> > >  #define BS_FilSysType32		82	/* File system type (1) */
> > >  #define BS_FilSysType		54	/* File system type (1) */
> > >  
> > > +#define MBR_PART_sys_ind	4
> > > +#define MBR_PART_start_sect	8
> > > +#define MBR_OSTYPE_EFI_GPT	0xee
> > > +
> > > +static inline int pmbr_part_valid(const uint8_t *buf)
> > > +{
> > > +	if (buf[MBR_PART_sys_ind] == MBR_OSTYPE_EFI_GPT &&
> > > +		get_unaligned_le32(&buf[MBR_PART_start_sect]) == 1UL) {
> > > +		return 1;
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +/**
> > > + * is_pmbr_valid(): test Protective MBR for validity
> > > + * @mbr: pointer to a legacy mbr structure
> > > + *
> > > + * Description: Returns 1 if PMBR is valid, 0 otherwise.
> > > + * Validity depends on two things:
> > > + *  1) MSDOS signature is in the last two bytes of the MBR
> > > + *  2) One partition of type 0xEE is found
> > > + */
> > > +static int is_gpt_valid(const uint8_t *buf)
> > 
> > The function name doesn't match the description.
> can you fix while applying?

Nope, because I don't know whether the description or the implementation
matches what you intend to do.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-02-15 10:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 22:42 [PATCH 0/5] add EFI GUID Partition Table support Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 22:44 ` [PATCH 1/5] linux/types: import __aligned_x64 from the kernel Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 22:44   ` [PATCH 2/5] filetype: add GPT support Jean-Christophe PLAGNIOL-VILLARD
2013-02-15  7:46     ` Johannes Stezenbach
2013-02-15  9:00     ` Sascha Hauer
2013-02-15 10:45       ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 10:56         ` Sascha Hauer [this message]
2013-02-14 22:44   ` [PATCH 3/5] partitons: add framework Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 22:44   ` [PATCH 4/5] disk: introduce partition name Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 22:44   ` [PATCH 5/5] disk: partitions: add EFI GUID Partition Table Jean-Christophe PLAGNIOL-VILLARD
  -- strict thread matches above, loose matches on Subject: below --
2013-02-16 11:38 [PATCH 0/5 v4] add EFI GUID Partition Table support Jean-Christophe PLAGNIOL-VILLARD
2013-02-16 13:47 ` [PATCH 1/5] linux/types: import __aligned_x64 from the kernel Jean-Christophe PLAGNIOL-VILLARD
2013-02-16 13:47   ` [PATCH 2/5] filetype: add GPT support Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 12:59 [PATCH 0/5 v3] add EFI GUID Partition Table support Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 13:35 ` [PATCH 1/5] linux/types: import __aligned_x64 from the kernel Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 13:35   ` [PATCH 2/5] filetype: add GPT support Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 17:32     ` Sascha Hauer
2013-02-15 17:36       ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 17:48         ` Sascha Hauer
2013-02-14 15:47 [PATCH 0/5] add EFI GUID Partition Table support Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 15:52 ` [PATCH 1/5] linux/types: import __aligned_x64 from the kernel Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 15:52   ` [PATCH 2/5] filetype: add GPT support Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 16:36     ` Sascha Hauer
2013-02-14 16:53       ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 17:05         ` Johannes Stezenbach
2013-02-14 19:17           ` Sascha Hauer
2013-02-14 22:08             ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-15  7:43               ` Johannes Stezenbach
2013-02-15 10:47                 ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130215105647.GO1906@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    --cc=rob.herring@calxeda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.