
From: Simon Glass <sjg@chromium.org> The existing disk and partition code assumes a block device. Sandbox provides access to host files and does not operate through a block device. This is currently handled with special-case logic. We want to add virtio-fs support, which is also not a block device. It is not easy to have these two co-exist, so add a new type field to struct disk_partition to indicate the type. This is a work-around to deal with the fact that the type needs to be set by blk_get_device_part_str() in such a way that it is visible to fs_readdir() There is a global fs_type in disk/part.c but this is not available in the fs/ code. Signed-off-by: Simon Glass <sjg@chromium.org> --- disk/part.c | 3 ++- fs/fs_legacy.c | 4 ++++ include/part.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/disk/part.c b/disk/part.c index 303178161c0..bab27ba07d8 100644 --- a/disk/part.c +++ b/disk/part.c @@ -477,7 +477,8 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, if (!strcmp(ifname, "hostfs")) { strcpy((char *)info->type, BOOT_PART_TYPE); strcpy((char *)info->name, "Host filesystem"); - + info->fs_type = IS_ENABLED(CONFIG_SANDBOX) ? FS_TYPE_SANDBOX : + FS_TYPE_SEMIHOSTING; return 0; } #endif diff --git a/fs/fs_legacy.c b/fs/fs_legacy.c index 5a7a3ae4194..82936142c07 100644 --- a/fs/fs_legacy.c +++ b/fs/fs_legacy.c @@ -483,7 +483,11 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) if (!fs_dev_desc && !info->null_dev_desc_ok) continue; + if (fs_partition.fs_type && + fs_partition.fs_type != info->fstype) + continue; + log_debug("probe %s\n", info->name); if (!info->probe(fs_dev_desc, &fs_partition)) { fs_type = info->fstype; fs_dev_part = part; diff --git a/include/part.h b/include/part.h index fcb3c13dea4..0fd7c18d6b6 100644 --- a/include/part.h +++ b/include/part.h @@ -7,6 +7,7 @@ #define _PART_H #include <blk.h> +#include <fs_common.h> #include <ide.h> #include <u-boot/uuid.h> #include <linker_lists.h> @@ -84,6 +85,7 @@ struct disk_partition { #ifdef CONFIG_DOS_PARTITION uchar sys_ind; /* partition type */ #endif + enum fs_type_t fs_type; /* type used for hostfs and virtio-fs */ }; /* Accessors for struct disk_partition field ->uuid */ -- 2.43.0