[U-Boot] [PATCH] Fixes the load command return code under btrfs
Stephane Gilbert
stephane.gilbert at exfo.com
Thu Sep 13 18:48:41 UTC 2018
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(-)
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;
}
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;
--
2.14.4
More information about the U-Boot
mailing list