[U-Boot] [PATCH V2 2/5] fs: implement infra-structure for an 'exists' function
Simon Glass
sjg at chromium.org
Sun Jan 26 16:41:07 CET 2014
Hi Stephen,
On 23 January 2014 12:56, Stephen Warren <swarren at wwwdotorg.org> wrote:
> From: Stephen Warren <swarren at nvidia.com>
>
> This could be used in scripts such as:
>
> if exists mmc 0:1 /boot/boot.scr; then
> load mmc 0:1 ${scriptaddr} /boot/boot.scr
> source ${scriptaddr}
> fi
>
> rather than:
>
> if load mmc 0:1 ${scriptaddr} /boot/boot.scr; then
> source ${scriptaddr}
> fi
>
> This prevents errors being printed by attempts to load non-existent
> files, which can be important when checking for a large set of files,
> such as /boot/boot.scr.uimg, /boot/boot.scr, /boot/extlinux.conf,
> /boot.scr.uimg, /boot.scr, /extlinux.conf.
>
Change log?
>
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
>
Acked-by: Simon Glass <sjg at chromium.org>
Seems useful.
In addition, if it is just the error messages you are worried about (and I
agree they should be eliminated) I wonder if we should consider adding a -e
flag (or similar) to the read command to make it silently fail when the
file does not exist? Arguably your code fragment above could be:
if load -e mmc 0:1 ${scriptaddr} /boot/boot.scr; then
source ${scriptaddr}
fi
Regards,
Simon
More information about the U-Boot
mailing list