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:
@@ -477,7 +477,8 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
|
|||||||
if (!strcmp(ifname, "hostfs")) {
|
if (!strcmp(ifname, "hostfs")) {
|
||||||
strcpy((char *)info->type, BOOT_PART_TYPE);
|
strcpy((char *)info->type, BOOT_PART_TYPE);
|
||||||
strcpy((char *)info->name, "Host filesystem");
|
strcpy((char *)info->name, "Host filesystem");
|
||||||
|
info->fs_type = IS_ENABLED(CONFIG_SANDBOX) ? FS_TYPE_SANDBOX :
|
||||||
|
FS_TYPE_SEMIHOSTING;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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)
|
if (!fs_dev_desc && !info->null_dev_desc_ok)
|
||||||
continue;
|
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)) {
|
if (!info->probe(fs_dev_desc, &fs_partition)) {
|
||||||
fs_type = info->fstype;
|
fs_type = info->fstype;
|
||||||
fs_dev_part = part;
|
fs_dev_part = part;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#define _PART_H
|
#define _PART_H
|
||||||
|
|
||||||
#include <blk.h>
|
#include <blk.h>
|
||||||
|
#include <fs_common.h>
|
||||||
#include <ide.h>
|
#include <ide.h>
|
||||||
#include <u-boot/uuid.h>
|
#include <u-boot/uuid.h>
|
||||||
#include <linker_lists.h>
|
#include <linker_lists.h>
|
||||||
@@ -84,6 +85,7 @@ struct disk_partition {
|
|||||||
#ifdef CONFIG_DOS_PARTITION
|
#ifdef CONFIG_DOS_PARTITION
|
||||||
uchar sys_ind; /* partition type */
|
uchar sys_ind; /* partition type */
|
||||||
#endif
|
#endif
|
||||||
|
enum fs_type_t fs_type; /* type used for hostfs and virtio-fs */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Accessors for struct disk_partition field ->uuid */
|
/* Accessors for struct disk_partition field ->uuid */
|
||||||
|
|||||||
Reference in New Issue
Block a user