From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Fri, 05 Oct 2012 17:46:35 -0600 Subject: [U-Boot] [PATCH 1/2] FAT: check for partition 0 not 1 for whole-disk fs In-Reply-To: <506F6FC8.3010300@ti.com> References: <1349479060-3211-1-git-send-email-swarren@wwwdotorg.org> <506F6CE4.8080802@ti.com> <506F6EE8.7060308@wwwdotorg.org> <506F6FC8.3010300@ti.com> Message-ID: <506F715B.4020007@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/05/2012 05:39 PM, Tom Rini wrote: > On 10/05/12 16:36, Stephen Warren wrote: >> On 10/05/2012 05:27 PM, Tom Rini wrote: >>> On 10/05/12 16:17, Stephen Warren wrote: >>>> From: Stephen Warren >>> >>>> The recent switch to use get_device_and_partition() from >>>> do_fat_ls() broke the ability to access a FAT filesystem >>>> directly on a whole device; FAT only works within a >>>> partition on a device. >>> >>>> This change makes e.g. "fatls mmc 0:0" work; explicitly >>>> requesting partition ID 0 is something that >>>> get_device_and_partition() fully supports. However, >>>> fat_register_device() expects partition ID 1 to be used in >>>> the full-disk case; partition ID 1 was previously implicitly >>>> specified when the user didn't actually specify a partition >>>> ID. Update fat_register_device() to expect the correct ID. >>> >>>> This change does imply that if a user explicitly executes >>>> "fatls mmc 0:1" then this will fail, and may be a change in >>>> behaviour. >>> >>> So wait, you can't list device 0, bus 1 after this patch? > >> That's partition 1 not bus 1. > > Er yes, thinko there. > >> In the context of having a raw FAT filesystem on a device with no >> partition table, the partition specification "0:1" doesn't work >> before or after this patch; I believe (if it worked at all ever >> before) it was broken by the previous get_device_and_partition() >> rework. > >> If you do have a partition table, then "0:1" works just fine >> with/without this patch. > > OK, so the behavior change here, potentially involves 2 partitions > without a partition table? What is the case where fatls mmc 0:1 > would fail now? The failure case involves zero partitions. The issue is that the following works just fine: fdisk /dev/sda mkfs.dos /dev/sdaN for any N but the following fails: mkfs.dos /dev/sda (i.e. raw on the disk with no partition table) In the latter case, I /think/ either of the following might have worked in U-Boot until recently: (1) fatls mmc 0 / # Surely this worked (2) fatls mmc 0:1 / # I'm not sure if this works This patch makes (1) above work. Patch 2 in this series makes the new equivalent of (2) work, namely: fatls mmc 0:0 / The second 0 there is "partition 0" which means "the whole disk". IIRC, I called out that behaviour change in the get_device_and_partition() series anyway.