fs: Provide information about non-block filesystems

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>
This commit is contained in:
Simon Glass
2025-06-25 06:23:03 -06:00
parent 8630e568b2
commit b3cbdc4951
3 changed files with 8 additions and 1 deletions

View File

@@ -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