mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] partition: Create links with partition names
Date: Fri, 11 Dec 2015 11:40:35 +0100	[thread overview]
Message-ID: <1449830435-6964-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1449830435-6964-1-git-send-email-s.hauer@pengutronix.de>

When a partition has a name create a link to the original partition
rather than registering a second cdev.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/partitions.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/common/partitions.c b/common/partitions.c
index 4f50bfe..82ec508 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -71,20 +71,14 @@ static int register_one_partition(struct block_device *blk,
 	if (!part->name[0])
 		return 0;
 
-	partition_name = asprintf("%s.%s", blk->cdev.name, part->name);
-	if (!partition_name)
-		return -ENOMEM;
-
-	dev_dbg(blk->dev, "Registering partition %s on drive %s\n",
-				partition_name, blk->cdev.name);
-	cdev = devfs_add_partition(blk->cdev.name,
-				start, size, 0, partition_name);
-
-	if (IS_ERR(cdev))
-		dev_warn(blk->dev, "Registering partition %s on drive %s failed\n",
-				partition_name, blk->cdev.name);
+	partition_name = xasprintf("%s.%s", blk->cdev.name, part->name);
+	ret = devfs_create_link(cdev, partition_name);
+	if (ret)
+		dev_warn(blk->dev, "Failed to create link from %s to %s\n",
+			 partition_name, blk->cdev.name);
+	free(partition_name);
 
-	ret = 0;
+	return 0;
 out:
 	free(partition_name);
 	return ret;
-- 
2.6.2


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

  reply	other threads:[~2015-12-11 10:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 10:40 [PATCH 1/2] devfs: Add symlink support Sascha Hauer
2015-12-11 10:40 ` Sascha Hauer [this message]
2015-12-11 19:29   ` [PATCH 2/2] partition: Create links with partition names Trent Piepho
2015-12-14  9:25     ` Sascha Hauer
2015-12-14 18:44       ` Trent Piepho
2015-12-16  9:47 [PATCH v2] Symlink support for devfs Sascha Hauer
2015-12-16  9:47 ` [PATCH 2/2] partition: Create links with partition names 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=1449830435-6964-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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