Hi Vincent,
On 2026-05-11T11:53:35, Vincent Jardin <[email protected]> wrote:
> fs: dispatch null_dev_desc_ok filesystems before block lookup
>
> Filesystems that are null_dev_desc_ok (semihosting, ubifs) have
> no UCLASS_BLK device under their ifname, so on real hardware
> fs_set_blk_dev() always fails at the partition lookup.
> The workaround was to add a per-filesystem
> command (example cmd/ubifs.c), which duplicates thue plumbing of
> fstype_info.
>
> Honour the opt-in directly: probe such entries with block_desc=NULL up
> front, so "load semihosting <addr> <file>" works without a new
> command.
>
> Sandbox boards that exercise the existing fallback through "host
> bind" stay unchanged.
>
> Signed-off-by: Vincent Jardin <[email protected]>
>
> fs/fs.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
> diff --git a/fs/fs.c b/fs/fs.c
> @@ -464,6 +464,24 @@ int fs_set_blk_dev(const char *ifname, const char
> *dev_part_str, int fstype)
> struct fstype_info *info;
> int part, i;
>
> + for (i = 0, info = fstypes; i < ARRAY_SIZE(fstypes); i++, info++) {
> + if (fstype != FS_TYPE_ANY && info->fstype != FS_TYPE_ANY &&
> + fstype != info->fstype)
> + continue;
> + if (!info->null_dev_desc_ok || !info->name)
> + continue;
> + if (strcmp(info->name, ifname) != 0)
> + continue;
if (strcmp(...))
For the commit message:
1. Typo: 'thue' should be 'the'
2. If cmd/ubifs.c is the duplication this patch obsoletes, please
either remove it in the same series or reword the motivation - as it
stands the duplication is still in-tree after the patch, so the reader
is left wondering whether 'load ubifs ...' is now the preferred entry
point or whether ubifsload remains supported
Please also spell out which user-visible commands get this new support
('load semihosting ...', 'load ubifs ...').
> + for (i = 0, info = fstypes; i < ARRAY_SIZE(fstypes); i++, info++) {
Can you add a test for this, that loads via the new semihosting
ifname? Do we need a doc/ update?
BTW, what do you think of this 'desc being NULL' approach? We should
perhaps improve it so that we can support non-block filesystems more
generally.
Regards,
Simon