]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
disk: part_dos: don't claim whole-disk FAT filesystems
authorStephen Warren <swarren@nvidia.com>
Fri, 5 Oct 2012 13:17:40 +0000 (13:17 +0000)
committerTom Rini <trini@ti.com>
Mon, 8 Oct 2012 18:15:04 +0000 (11:15 -0700)
commitd1efb6442a0a0eec1933fce500f69008e2df70fd
treefe9d39a29126ed3c638f877a89cb296821919cfa
parentbd1a7e3034006ec121d35d745fd455212a56f7fd
disk: part_dos: don't claim whole-disk FAT filesystems

Logically, a disk that contains a raw FAT filesystem does not in fact
have a partition table. However, test_part_dos() was claiming that such
disks did in fact have a DOS-style partition table. This caused
get_device_and_partition() not to return a whole-disk disk_partition_t,
since part_type != PART_TYPE_UNKNOWN.

part_dos.c's print_partition_extended() detected the raw FAT filesystem
condition and printed a fake partition table that encompassed the whole
disk.

However, part_dos.c's get_partition_info_extended() did not return any
valid partitions in this case. This combination caused
get_device_and_partition() not to find any valid partitions, and hence
to return an error.

Fix test_part_dos() not to claim that raw FAT filesystems are DOS
partition tables. In turn, this causes get_device_and_partition() to
return a whole-disk disk_partition_t, and hence the following commands
work:

fatls mmc 0 /
fatls mmc 0:auto /

An alternative would be to modify print_partition_extended() to detect
raw FAT filesystems, just like print_partition_extended() does, and to
return a fake partition in this case. However, this seems logically
incorrect, and also duplicates code, since get_device_and_partition()
falls back to returning a whole-disk partition when there is no partition
table on the device.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
disk/part_dos.c