mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org, Rob Herring <rob.herring@calxeda.com>
Subject: Re: [PATCH 4/5] disk: introduce partition name
Date: Sat, 16 Feb 2013 12:29:16 +0100	[thread overview]
Message-ID: <20130216112916.GF19322@game.jcrosoft.org> (raw)
In-Reply-To: <20130215174357.GZ1906@pengutronix.de>

On 18:43 Fri 15 Feb     , Sascha Hauer wrote:
> On Fri, Feb 15, 2013 at 02:35:16PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > so we can register partion with name as present in EFI GPT
> > 
> > Cc: Rob Herring <rob.herring@calxeda.com>
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  common/partitions.c        |   54 ++++++++++++++++++++++++++++++++++----------
> >  common/partitions/parser.h |    2 ++
> >  2 files changed, 44 insertions(+), 12 deletions(-)
> > 
> > diff --git a/common/partitions.c b/common/partitions.c
> > index c1578c9..b0f48be 100644
> > --- a/common/partitions.c
> > +++ b/common/partitions.c
> > @@ -44,15 +44,43 @@ LIST_HEAD(partition_parser_list);
> >  static int register_one_partition(struct block_device *blk,
> >  					struct partition *part, int no)
> >  {
> > -	char partition_name[19];
> > +	char *partition_name;
> > +	int ret;
> > +	uint64_t start = part->first_sec * SECTOR_SIZE;
> > +	uint64_t size = part->size * SECTOR_SIZE;
> > +
> > +	partition_name = asprintf("%s.%d", blk->cdev.name, no);
> > +	if (!partition_name)
> > +		return -ENOMEM;
> > +	dev_dbg(blk->dev, "Registering partition %s on drive %s\n",
> > +				partition_name, blk->cdev.name);
> > +	ret = devfs_add_partition(blk->cdev.name,
> > +				start, size, 0, partition_name);
> > +	if (ret)
> > +		goto out;
> > +
> > +	free(partition_name);
> > +
> > +	if (!part->name[0])
> > +		return 0;
> 
> So when a name is not given then you also don't register the partition
> with a number?

we register with number first and only register with name if present

Best Regards,
J.
> 
> > +
> > +	partition_name = asprintf("%s.%s", blk->cdev.name, part->name);
> > +	if (!partition_name)
> > +		return -ENOMEM;
> >  
> > -	sprintf(partition_name, "%s.%d", blk->cdev.name, no);
> >  	dev_dbg(blk->dev, "Registering partition %s on drive %s\n",
> >  				partition_name, blk->cdev.name);
> > -	return devfs_add_partition(blk->cdev.name,
> > -				part->first_sec * SECTOR_SIZE,
> > -				part->size * SECTOR_SIZE,
> > -				0, partition_name);
> > +	ret = devfs_add_partition(blk->cdev.name,
> > +				start, size, 0, partition_name);
> > +
> > +	if (ret)
> > +		dev_warn(blk->dev, "Registering partition %s on drive %s failled\n",
> > +				partition_name, blk->cdev.name);
> 
> s/failled/failed/
> 
> 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-16 11:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-15 13:35   ` [PATCH 3/5] partitons: add framework Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 17:37     ` Sascha Hauer
2013-02-15 13:35   ` [PATCH 4/5] disk: introduce partition name Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 17:43     ` Sascha Hauer
2013-02-16 11:29       ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-02-15 13:35   ` [PATCH 5/5] disk: partitions: add EFI GUID Partition Table Jean-Christophe PLAGNIOL-VILLARD
2013-02-15 17:46     ` Sascha Hauer
  -- 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 4/5] disk: introduce partition name Jean-Christophe PLAGNIOL-VILLARD
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 4/5] disk: introduce partition name Jean-Christophe PLAGNIOL-VILLARD
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 4/5] disk: introduce partition name Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 20:51     ` Sascha Hauer
2013-02-14 21:30       ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-14 21:42         ` Sascha Hauer

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=20130216112916.GF19322@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=rob.herring@calxeda.com \
    --cc=s.hauer@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox