u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 2/5] fs: implement infra-structure for an 'exists' function
Date: Mon, 27 Jan 2014 10:03:04 -0700	[thread overview]
Message-ID: <52E69148.5040400@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ1aDNDW=Vvgxb8ZG6LZRaxKx=HZBB2FEyHRu22TOHYygw@mail.gmail.com>

On 01/26/2014 08:41 AM, Simon Glass wrote:
> Hi Stephen,
> 
> On 23 January 2014 12:56, Stephen Warren <swarren@wwwdotorg.org
> <mailto:swarren@wwwdotorg.org>> wrote:
> 
>     From: Stephen Warren <swarren at nvidia.com <mailto:swarren@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
...
> Acked-by: Simon Glass <sjg at chromium.org <mailto:sjg@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

That would certainly work, although I think a direct check of
file-existence is more in line with how a regular Unix shell script
would work (test -e). I could imagine wanting to test for the existence
of a file without caring about its contents (e.g. using a file as a flag
to trigger a firmware upgrade or something)

  reply	other threads:[~2014-01-27 17:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 19:56 [U-Boot] [PATCH V2 1/5] fs: fix generic save command implementation Stephen Warren
2014-01-23 19:56 ` [U-Boot] [PATCH V2 2/5] fs: implement infra-structure for an 'exists' function Stephen Warren
2014-01-26 15:41   ` Simon Glass
2014-01-27 17:03     ` Stephen Warren [this message]
2014-01-27 17:50       ` Simon Glass
2014-01-26 19:44   ` Wolfgang Denk
2014-01-27 20:51     ` Stephen Warren
2014-01-27 21:44       ` Wolfgang Denk
2014-01-23 19:56 ` [U-Boot] [PATCH V2 3/5] sandbox: implement fs_exists() and 'sb exists' shell function Stephen Warren
2014-01-26 15:42   ` Simon Glass
2014-01-23 19:56 ` [U-Boot] [PATCH V2 4/5] ext4: implement exists() for ext4fs Stephen Warren
2014-01-26 15:45   ` Simon Glass
2014-01-23 19:57 ` [U-Boot] [PATCH V2 5/5] fat: implement exists() for FAT fs Stephen Warren
2014-01-26 15:52   ` Simon Glass
2014-01-27 17:09     ` Stephen Warren
2014-01-26 15:26 ` [U-Boot] [PATCH V2 1/5] fs: fix generic save command implementation Simon Glass
2014-01-27 17:00   ` Stephen Warren

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=52E69148.5040400@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --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;
as well as URLs for NNTP newsgroup(s).