[U-Boot] Fixes the load command return code under btrfs

Tom Rini trini at konsulko.com
Wed Sep 26 01:51:18 UTC 2018


On Thu, Sep 13, 2018 at 06:48:41PM +0000, Stephane Gilbert wrote:

> Hi,
> 
> I am submitting the following patch to resolve issue below:
> When using the load command with a btrfs filesystem, the return code of
> that command if always success even if the command failed. The problem
> is the do_load command in fs.c who assume any positive return code from
> fs_read as success. However the brtfs read function returns positive
> error code in case of failure. Other fs read fonction like fat and ext4
> returns negative error codes on failure. So this patch change the
> return code of the btrfs read function to be consistent with other read
> functions. This way it will be possible to use the return code in the
> Hush shell with btrfs file systems as with other filesystems.
> 
> >From 8b8141dbdfc43456b85585e99a2dfa4340800a95 Mon Sep 17 00:00:00 2001
> From: Stephane Gilbert <stephane.gilbert at exfo.com>
> Date: Thu, 13 Sep 2018 14:47:16 -0400
> Subject: [PATCH] Fixes the load command return code under btrfs
> filesystem
> ---
>  fs/btrfs/btrfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
>  	if (!len)
> @@ -200,7 +200,7 @@ int btrfs_read(const char *file, void *buf, loff_t
> offset, loff_t len,
>  	rd = btrfs_file_read(&root, inr, offset, len, buf);
>  	if (rd == -1ULL) {
>  		printf("An error occured while reading file %s\n",
> file);
> -		return 1;
> +		return -5;
>  	}
>  
>  	*actread = rd;
> 
> diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
> index 6f35854823..64ec1af5a9 100644
> --- a/fs/btrfs/btrfs.c
> +++ b/fs/btrfs/btrfs.c
> @@ -183,12 +183,12 @@ int btrfs_read(const char *file, void *buf,
> loff_t offset, loff_t len,
>  
>  	if (inr == -1ULL) {
>  		printf("Cannot lookup file %s\n", file);
> -		return 1;
> +		return -2;
>  	}
>  
>  	if (type != BTRFS_FT_REG_FILE) {
>  		printf("Not a regular file: %s\n", file);
> -		return 1;
> +		return -2;
>  	}
>  

Your patch itself seems to have been garbled, please resubmit as v2,
thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180925/ee6ac2c7/attachment.sig>


More information about the U-Boot mailing list