From 4d907025d6a530c0f3d2e869331e863c3e3cc3c2 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 12 Jun 2014 10:28:32 -0600 Subject: sandbox: restore ability to access host fs through standard commands Commit 95fac6ab4589 "sandbox: Use os functions to read host device tree" removed the ability for get_device_and_partition() to handle the "host" device type, and redirect accesses to it to the host filesystem. This broke some unit tests that use this feature. So, revert that change. The code added back by this patch is slightly different to pacify checkpatch. However, we're then left with "host" being both: - A pseudo device that accesses the hosts real filesystem. - An emulated block device, which accesses "sectors" inside a file stored on the host. In order to resolve this discrepancy, rename the pseudo device from host to hostfs, and adjust the unit-tests for this change. The "help sb" output is modified to reflect this rename, and state where the host and hostfs devices should be used. Signed-off-by: Stephen Warren Tested-by: Josh Wu Acked-by: Simon Glass Tested-by: Simon Glass --- disk/part.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'disk') diff --git a/disk/part.c b/disk/part.c index b3097e32f0..baceb19c60 100644 --- a/disk/part.c +++ b/disk/part.c @@ -510,6 +510,25 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str, int part; disk_partition_t tmpinfo; + /* + * Special-case a psuedo block device "hostfs", to allow access to the + * host's own filesystem. + */ + if (0 == strcmp(ifname, "hostfs")) { + *dev_desc = NULL; + info->start = 0; + info->size = 0; + info->blksz = 0; + info->bootable = 0; + strcpy((char *)info->type, BOOT_PART_TYPE); + strcpy((char *)info->name, "Sandbox host"); +#ifdef CONFIG_PARTITION_UUIDS + info->uuid[0] = 0; +#endif + + return 0; + } + /* If no dev_part_str, use bootdevice environment variable */ if (!dev_part_str || !strlen(dev_part_str) || !strcmp(dev_part_str, "-")) -- cgit v1.2.1