From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fs: fat: read: fix fat16 ls/read issue
Date: Thu, 18 Dec 2014 16:12:15 +0100 [thread overview]
Message-ID: <5492EECF.6050606@samsung.com> (raw)
In-Reply-To: <CAPnjgZ0twmDnpxNH27EaP_9FHubCxmnTetUSXA91Om_RHkNPDg@mail.gmail.com>
Hello,
On 12/18/2014 03:56 PM, Simon Glass wrote:
> Hi,
>
> On 18 December 2014 at 07:40, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>> Hello,
>>
>>
>> On 12/18/2014 03:34 PM, Simon Glass wrote:
>>>
>>> Hi Przemyslaw,
>>>
>>> On 18 December 2014 at 07:32, Przemyslaw Marczak <p.marczak@samsung.com>
>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> On 12/18/2014 02:47 PM, Simon Glass wrote:
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> On 11 December 2014 at 05:01, Przemyslaw Marczak <p.marczak@samsung.com>
>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> The present fat implementation ignores FAT16 long name
>>>>>> directory entries which aren't placed in a single sector.
>>>>>>
>>>>>> This was becouse of the buffer was always filled by the
>>>>>> two sectors, and the loop was made also for two sectors.
>>>>>>
>>>>>> If some file long name entries are stored in two sectors,
>>>>>> the we have two cases:
>>>>>>
>>>>>> Case 1:
>>>>>> Both of sectors are in the buffer - all required data
>>>>>> for long file name is in the buffer.
>>>>>> - Read OK!
>>>>>>
>>>>>> Case 2:
>>>>>> The current directory entry is placed at the end of the
>>>>>> second buffered sector. And the next entries are placed
>>>>>> in a sector which is not buffered yet. Then two next
>>>>>> sectors are buffered and the mentioned entry is ignored.
>>>>>> - Read fail!
>>>>>>
>>>>>> This commit fixes this issue by:
>>>>>> - read two sectors after loop on each single is done
>>>>>> - keep the last used sector as a first in the buffer
>>>>>> before the read of two next
>>>>>>
>>>>>> The commit doesn't affects the fat32 imlementation,
>>>>>> which works good as previous.
>>>>>>
>>>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>>>> Cc: Mikhail Zolotaryov <lebon@lebon.org.ua>
>>>>>> Cc: Tom Rini <trini@ti.com>
>>>>>> Cc: Stephen Warren <swarren@nvidia.com>
>>>>>> Cc: Simon Glass <sjg@chromium.org>
>>>>>> Cc: Suriyan Ramasami <suriyan.r@gmail.com>
>>>>>> Cc: Lukasz Majewski <l.majewski@samsung.com>
>>>>>> Cc: Wolfgang Denk <wd@denx.de>
>>>>>> ---
>>>>>> fs/fat/fat.c | 33 ++++++++++++++++++++++++---------
>>>>>> 1 file changed, 24 insertions(+), 9 deletions(-)
>>>>>
>>>>>
>>>>>
>>>>> Tested-by: Simon Glass <sjg@chomium.org>
>>>>>
>>>>>>
>>>>>> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
>>>>>> index 04a51db..afbf12d 100644
>>>>>> --- a/fs/fat/fat.c
>>>>>> +++ b/fs/fat/fat.c
>>>>>> @@ -823,8 +823,11 @@ int do_fat_read_at(const char *filename, loff_t
>>>>>> pos,
>>>>>> void *buffer,
>>>>>> int ret = -1;
>>>>>> int firsttime;
>>>>>> __u32 root_cluster = 0;
>>>>>> + __u32 read_blk;
>>>>>> int rootdir_size = 0;
>>>>>> - int j;
>>>>>> + int j, k;
>>>>>
>>>>>
>>>>>
>>>>> What is k? Can we use a proper variable name? Also for j. That might
>>>>> save needing a comment for them.
>>>>>
>>>>>> + int do_read;
>>>>>> + __u8 *dir_ptr;
>>>>>
>>>>>
>>>>>
>>>>> Why does it use __u8 instead of u8 or uint8_t for example?
>>>>
>>>>
>>>>
>>>> __u8 is used in a whole fat code, and also as a directory entry buffer,
>>>> so
>>>> why not to keep the whole code style?
>>>
>>>
>>> OK, sounds good.
>>>
>>> Do you have any ideas on the bug I reported?
>>>
>>
>> No, but I think that this is not any fat issue.
>
> Can you explain what you mean here? What other software could be causing this?
>
> Regards,
> Simon
>
The fat code is quite unreadable, but it is simple.
Passing the "/syslinux/..//bcm2835-rpi-b-rev2.dtb" as the fatload
argument is just treat as a "/syslinux" directory which doesn't exists.
So the file can't be read, right?
Best regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
next prev parent reply other threads:[~2014-12-18 15:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 12:01 [U-Boot] [PATCH] fs: fat: read: fix fat16 ls/read issue Przemyslaw Marczak
2014-12-12 0:32 ` Simon Glass
2014-12-12 15:30 ` Przemyslaw Marczak
2014-12-12 15:52 ` [U-Boot] [PATCH] fat: scripts for prepare and test read fat files Przemyslaw Marczak
2014-12-12 15:54 ` Przemyslaw Marczak
2014-12-16 20:41 ` Simon Glass
2014-12-17 8:53 ` Przemyslaw Marczak
2014-12-16 22:26 ` [U-Boot] [PATCH] fs: fat: read: fix fat16 ls/read issue Simon Glass
2014-12-17 8:53 ` Przemyslaw Marczak
2014-12-17 9:03 ` Przemyslaw Marczak
2014-12-18 3:39 ` Simon Glass
2014-12-18 10:26 ` Przemyslaw Marczak
2014-12-18 13:14 ` Simon Glass
2014-12-18 13:31 ` Przemyslaw Marczak
2014-12-18 13:36 ` Simon Glass
2014-12-18 13:41 ` Przemyslaw Marczak
2014-12-18 13:47 ` Simon Glass
2014-12-18 14:06 ` Przemyslaw Marczak
2014-12-18 14:32 ` Przemyslaw Marczak
2014-12-18 14:34 ` Simon Glass
2014-12-18 14:40 ` Przemyslaw Marczak
2014-12-18 14:56 ` Simon Glass
2014-12-18 15:12 ` Przemyslaw Marczak [this message]
2014-12-18 15:21 ` [U-Boot] [PATCH v2] " Przemyslaw Marczak
2014-12-18 16:14 ` [U-Boot] [PATCH v3] " Przemyslaw Marczak
2015-01-07 15:12 ` [U-Boot] [U-Boot,v3] " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5492EECF.6050606@samsung.com \
--to=p.marczak@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox