From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Date: Sat, 22 Aug 2015 20:04:52 +0200 Subject: [U-Boot] [PATCH v2 3/4] ubifs: Add generic fs support In-Reply-To: <1440266693-15664-1-git-send-email-hdegoede@redhat.com> References: <1440266693-15664-1-git-send-email-hdegoede@redhat.com> Message-ID: <1440266693-15664-4-git-send-email-hdegoede@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add generic fs support, so that commands like ls, load and test -e can be used on ubifs. Signed-off-by: Hans de Goede --- 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 #include #include +#include #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 #include #include +#include #include #include #include @@ -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