All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/4] ubifs: Add generic fs support
Date: Sat, 22 Aug 2015 20:04:52 +0200	[thread overview]
Message-ID: <1440266693-15664-4-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1440266693-15664-1-git-send-email-hdegoede@redhat.com>

Add generic fs support, so that commands like ls, load and test -e can be
used on ubifs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 disk/part.c  | 23 +++++++++++++++++++++++
 fs/fs.c      | 16 ++++++++++++++++
 include/fs.h |  1 +
 3 files changed, 40 insertions(+)

diff --git a/disk/part.c b/disk/part.c
index 43485c9..e1a8bde 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -10,6 +10,7 @@
 #include <ide.h>
 #include <malloc.h>
 #include <part.h>
+#include <ubifs_uboot.h>
 
 #undef	PART_DEBUG
 
@@ -530,6 +531,28 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str,
 		return 0;
 	}
 
+#ifdef CONFIG_CMD_UBIFS
+	/*
+	 * Special-case ubi, ubi goes through a mtd, rathen then through
+	 * a regular block device.
+	 */
+	if (0 == strcmp(ifname, "ubi")) {
+		if (!ubifs_mounted) {
+			printf("UBIFS not mounted, use ubifsmount to mount volume first!\n");
+			return -1;
+		}
+
+		*dev_desc = NULL;
+		memset(info, 0, sizeof(*info));
+		strcpy((char *)info->type, BOOT_PART_TYPE);
+		strcpy((char *)info->name, "UBI");
+#ifdef CONFIG_PARTITION_UUIDS
+		info->uuid[0] = 0;
+#endif
+		return 0;
+	}
+#endif
+
 	/* If no dev_part_str, use bootdevice environment variable */
 	if (!dev_part_str || !strlen(dev_part_str) ||
 	    !strcmp(dev_part_str, "-"))
diff --git a/fs/fs.c b/fs/fs.c
index 827b143..b2d6a53 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -23,6 +23,7 @@
 #include <fat.h>
 #include <fs.h>
 #include <sandboxfs.h>
+#include <ubifs_uboot.h>
 #include <asm/io.h>
 #include <div64.h>
 #include <linux/math64.h>
@@ -157,6 +158,21 @@ static struct fstype_info fstypes[] = {
 		.uuid = fs_uuid_unsupported,
 	},
 #endif
+#ifdef CONFIG_CMD_UBIFS
+	{
+		.fstype = FS_TYPE_UBIFS,
+		.name = "ubifs",
+		.null_dev_desc_ok = true,
+		.probe = ubifs_set_blk_dev,
+		.close = ubifs_close,
+		.ls = ubifs_ls,
+		.exists = ubifs_exists,
+		.size = ubifs_size,
+		.read = ubifs_read,
+		.write = fs_write_unsupported,
+		.uuid = fs_uuid_unsupported,
+	},
+#endif
 	{
 		.fstype = FS_TYPE_ANY,
 		.name = "unsupported",
diff --git a/include/fs.h b/include/fs.h
index fd1e4ab..059a395 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -22,6 +22,7 @@
 #define FS_TYPE_FAT	1
 #define FS_TYPE_EXT	2
 #define FS_TYPE_SANDBOX	3
+#define FS_TYPE_UBIFS	4
 
 /*
  * Tell the fs layer which block device an partition to use for future
-- 
2.4.3

  parent reply	other threads:[~2015-08-22 18:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-22 18:04 [U-Boot] [PATCH v2 0/4] distro_bootcmd: Add support for booting from ubifs Hans de Goede
2015-08-22 18:04 ` [U-Boot] [PATCH v2 1/4] ubifs: Modify ubifs u-boot wrapper function prototypes for generic fs use Hans de Goede
2015-08-25 11:00   ` Heiko Schocher
2015-08-25 11:32     ` Hans de Goede
2015-08-28 14:52       ` Tom Rini
2015-08-28 15:33         ` Heiko Schocher
2015-08-31 16:08         ` Hans de Goede
2015-09-01  3:46           ` Heiko Schocher
2015-09-01 10:57             ` Heiko Schocher
2015-08-22 18:04 ` [U-Boot] [PATCH v2 2/4] ubifs: Add functions " Hans de Goede
2015-08-25 11:02   ` Heiko Schocher
2015-09-01 19:57   ` Stephen Warren
2015-09-01 20:01     ` Michael Trimarchi
2015-09-14 17:29     ` Hans de Goede
2015-08-22 18:04 ` Hans de Goede [this message]
2015-08-25 11:20   ` [U-Boot] [PATCH v2 3/4] ubifs: Add generic fs support Heiko Schocher
2015-09-01 20:03   ` Stephen Warren
2015-09-14 17:35     ` Hans de Goede
2015-09-21 18:11       ` Stephen Warren
2015-08-22 18:04 ` [U-Boot] [PATCH v2 4/4] distro_bootcmd: Add support for booting from ubifs Hans de Goede
2015-09-01 20:13   ` Stephen Warren
2015-09-14 17:48     ` Hans de Goede
2015-08-24 16:57 ` [U-Boot] [PATCH v2 0/4] " Scott Wood
2015-08-25  7:15   ` Hans de Goede
2015-08-25  7:31     ` Heiko Schocher

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=1440266693-15664-4-git-send-email-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=u-boot@lists.denx.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 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.