All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs/fat: avoid noisy message fat_read_file()
@ 2023-01-19 15:11 Heinrich Schuchardt
  2023-01-19 15:13 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-01-19 15:11 UTC (permalink / raw)
  To: Tom Rini; +Cc: Simon Glass, u-boot, Ilias Apalodimas, Heinrich Schuchardt

UEFI applications call file system functions to determine if a file exists.
The return codes are evaluated to show appropriate messages.
U-Boot's file system layer should not interfere with the output.

Rename file_fat_read_at() to fat_read_file() adjusting the parameter
sequence and names and eliminate the old wrapper function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 fs/fat/fat.c  | 22 +++++-----------------
 include/fat.h |  2 --
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index a945904785..2da93dae3c 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -1243,8 +1243,8 @@ out_free_itr:
 	return ret;
 }
 
-int file_fat_read_at(const char *filename, loff_t pos, void *buffer,
-		     loff_t maxsize, loff_t *actread)
+int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len,
+		  loff_t *actread)
 {
 	fsdata fsdata;
 	fat_itr *itr;
@@ -1261,12 +1261,12 @@ int file_fat_read_at(const char *filename, loff_t pos, void *buffer,
 	if (ret)
 		goto out_free_both;
 
-	debug("reading %s at pos %llu\n", filename, pos);
+	debug("reading %s at pos %llu\n", filename, offset);
 
 	/* For saving default max clustersize memory allocated to malloc pool */
 	dir_entry *dentptr = itr->dent;
 
-	ret = get_contents(&fsdata, dentptr, pos, buffer, maxsize, actread);
+	ret = get_contents(&fsdata, dentptr, offset, buf, len, actread);
 
 out_free_both:
 	free(fsdata.fatbuf);
@@ -1280,25 +1280,13 @@ int file_fat_read(const char *filename, void *buffer, int maxsize)
 	loff_t actread;
 	int ret;
 
-	ret =  file_fat_read_at(filename, 0, buffer, maxsize, &actread);
+	ret =  fat_read_file(filename, buffer, 0, maxsize, &actread);
 	if (ret)
 		return ret;
 	else
 		return actread;
 }
 
-int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len,
-		  loff_t *actread)
-{
-	int ret;
-
-	ret = file_fat_read_at(filename, offset, buf, len, actread);
-	if (ret)
-		printf("** Unable to read file %s **\n", filename);
-
-	return ret;
-}
-
 typedef struct {
 	struct fs_dir_stream parent;
 	struct fs_dirent dirent;
diff --git a/include/fat.h b/include/fat.h
index bd8e450b33..a9756fb4cd 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -200,8 +200,6 @@ static inline u32 sect_to_clust(fsdata *fsdata, int sect)
 int file_fat_detectfs(void);
 int fat_exists(const char *filename);
 int fat_size(const char *filename, loff_t *size);
-int file_fat_read_at(const char *filename, loff_t pos, void *buffer,
-		     loff_t maxsize, loff_t *actread);
 int file_fat_read(const char *filename, void *buffer, int maxsize);
 int fat_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
 int fat_register_device(struct blk_desc *dev_desc, int part_no);
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] fs/fat: avoid noisy message fat_read_file()
  2023-01-19 15:11 [PATCH 1/1] fs/fat: avoid noisy message fat_read_file() Heinrich Schuchardt
@ 2023-01-19 15:13 ` Tom Rini
  2023-01-19 15:16   ` Heinrich Schuchardt
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2023-01-19 15:13 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Simon Glass, u-boot, Ilias Apalodimas

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

On Thu, Jan 19, 2023 at 04:11:48PM +0100, Heinrich Schuchardt wrote:

> UEFI applications call file system functions to determine if a file exists.
> The return codes are evaluated to show appropriate messages.
> U-Boot's file system layer should not interfere with the output.
> 
> Rename file_fat_read_at() to fat_read_file() adjusting the parameter
> sequence and names and eliminate the old wrapper function.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

With this change, what is the output when you "fatload" a non-existent
file?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] fs/fat: avoid noisy message fat_read_file()
  2023-01-19 15:13 ` Tom Rini
@ 2023-01-19 15:16   ` Heinrich Schuchardt
  2023-01-19 15:17     ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-01-19 15:16 UTC (permalink / raw)
  To: Tom Rini; +Cc: Simon Glass, u-boot, Ilias Apalodimas

On 1/19/23 16:13, Tom Rini wrote:
> On Thu, Jan 19, 2023 at 04:11:48PM +0100, Heinrich Schuchardt wrote:
> 
>> UEFI applications call file system functions to determine if a file exists.
>> The return codes are evaluated to show appropriate messages.
>> U-Boot's file system layer should not interfere with the output.
>>
>> Rename file_fat_read_at() to fat_read_file() adjusting the parameter
>> sequence and names and eliminate the old wrapper function.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> 
> With this change, what is the output when you "fatload" a non-existent
> file?
> 
=> host bind 0 ../../sandbox.img
=> fatload host 0:1 $loadaddr voodoo
Failed to load 'voodoo'

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] fs/fat: avoid noisy message fat_read_file()
  2023-01-19 15:16   ` Heinrich Schuchardt
@ 2023-01-19 15:17     ` Tom Rini
  2023-01-19 15:56       ` Ilias Apalodimas
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2023-01-19 15:17 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Simon Glass, u-boot, Ilias Apalodimas

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

On Thu, Jan 19, 2023 at 04:16:24PM +0100, Heinrich Schuchardt wrote:
> On 1/19/23 16:13, Tom Rini wrote:
> > On Thu, Jan 19, 2023 at 04:11:48PM +0100, Heinrich Schuchardt wrote:
> > 
> > > UEFI applications call file system functions to determine if a file exists.
> > > The return codes are evaluated to show appropriate messages.
> > > U-Boot's file system layer should not interfere with the output.
> > > 
> > > Rename file_fat_read_at() to fat_read_file() adjusting the parameter
> > > sequence and names and eliminate the old wrapper function.
> > > 
> > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> > 
> > With this change, what is the output when you "fatload" a non-existent
> > file?
> > 
> => host bind 0 ../../sandbox.img
> => fatload host 0:1 $loadaddr voodoo
> Failed to load 'voodoo'

Thanks.

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] fs/fat: avoid noisy message fat_read_file()
  2023-01-19 15:17     ` Tom Rini
@ 2023-01-19 15:56       ` Ilias Apalodimas
  0 siblings, 0 replies; 5+ messages in thread
From: Ilias Apalodimas @ 2023-01-19 15:56 UTC (permalink / raw)
  To: Tom Rini; +Cc: Heinrich Schuchardt, Simon Glass, u-boot

On Thu, 19 Jan 2023 at 17:17, Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Jan 19, 2023 at 04:16:24PM +0100, Heinrich Schuchardt wrote:
> > On 1/19/23 16:13, Tom Rini wrote:
> > > On Thu, Jan 19, 2023 at 04:11:48PM +0100, Heinrich Schuchardt wrote:
> > >
> > > > UEFI applications call file system functions to determine if a file exists.
> > > > The return codes are evaluated to show appropriate messages.
> > > > U-Boot's file system layer should not interfere with the output.
> > > >
> > > > Rename file_fat_read_at() to fat_read_file() adjusting the parameter
> > > > sequence and names and eliminate the old wrapper function.
> > > >
> > > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> > >
> > > With this change, what is the output when you "fatload" a non-existent
> > > file?
> > >
> > => host bind 0 ../../sandbox.img
> > => fatload host 0:1 $loadaddr voodoo
> > Failed to load 'voodoo'
>
> Thanks.
>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

>
> --
> Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-19 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 15:11 [PATCH 1/1] fs/fat: avoid noisy message fat_read_file() Heinrich Schuchardt
2023-01-19 15:13 ` Tom Rini
2023-01-19 15:16   ` Heinrich Schuchardt
2023-01-19 15:17     ` Tom Rini
2023-01-19 15:56       ` Ilias Apalodimas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.