Patchwork [U-Boot,v1,1/1] jffs2: change U_BOOT_CMD ls to fsls

login
register
mail settings
Submitter Suriyan Ramasami
Date Oct. 10, 2013, 1:01 a.m.
Message ID <1381366918-17590-1-git-send-email-suriyan.r@gmail.com>
Download mbox | patch
Permalink /patch/282106/
State New
Delegated to: Tom Rini
Headers show

Comments

Suriyan Ramasami - Oct. 10, 2013, 1:01 a.m.
multiple definitions of `_u_boot_list_2_cmd_2_ls' if CONFIG_CMD_JFFS2
and CONFIG_CMD_FS_GENERIC are defined.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>
---
 common/cmd_jffs2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Wolfgang Denk - Oct. 12, 2013, 6:38 p.m.
Dear Suriyan Ramasami,

In message <1381366918-17590-1-git-send-email-suriyan.r@gmail.com> you wrote:
> multiple definitions of `_u_boot_list_2_cmd_2_ls' if CONFIG_CMD_JFFS2
> and CONFIG_CMD_FS_GENERIC are defined.
> 
> Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>
> ---
>  common/cmd_jffs2.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
> index bce0983..f38455f 100644
> --- a/common/cmd_jffs2.c
> +++ b/common/cmd_jffs2.c
> @@ -606,7 +606,7 @@ U_BOOT_CMD(
>  	"      with offset 'off'"
>  );
>  U_BOOT_CMD(
> -	ls,	2,	1,	do_jffs2_ls,
> +	fsls,	2,	1,	do_jffs2_ls,

This makes no sense to me.  Either we mimick Unix style, then the
command name shouldbe "ls' (where else but in a file system could you
LiSt files?); or we implement file system specific commands, than the
name of the file system should be recognizable.

I think your problem should be fixed differently (such that "ls" also
works with JFFS2).


Best regards,

Wolfgang Denk
Suriyan Ramasami - Oct. 13, 2013, 9:03 p.m.
Hello Wolfgang Denk,

On Sat, Oct 12, 2013 at 11:38 AM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Suriyan Ramasami,
>
> In message <1381366918-17590-1-git-send-email-suriyan.r@gmail.com> you wrote:
>> multiple definitions of `_u_boot_list_2_cmd_2_ls' if CONFIG_CMD_JFFS2
>> and CONFIG_CMD_FS_GENERIC are defined.
>>
>> Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>
>> ---
>>  common/cmd_jffs2.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
>> index bce0983..f38455f 100644
>> --- a/common/cmd_jffs2.c
>> +++ b/common/cmd_jffs2.c
>> @@ -606,7 +606,7 @@ U_BOOT_CMD(
>>       "      with offset 'off'"
>>  );
>>  U_BOOT_CMD(
>> -     ls,     2,      1,      do_jffs2_ls,
>> +     fsls,   2,      1,      do_jffs2_ls,
>
> This makes no sense to me.  Either we mimick Unix style, then the
> command name shouldbe "ls' (where else but in a file system could you
> LiSt files?); or we implement file system specific commands, than the
> name of the file system should be recognizable.
>
> I think your problem should be fixed differently (such that "ls" also
> works with JFFS2).
>
I think I haven't defined the problem properly. I am sure you know
about the below, but am just reemphasizing so we could discuss the
issue.

The macro U_BOOT_CMD maps the user invocable commands at the u-boot
prompt to actual function calls. For example, looking at
common/cmd_ext4.c It defines the below:
ext4ls maps to do_ext4_ls()
ext4load maps to do_ext4_load()
etc.
Looking at the CMD_SYS_FS_GENERIC (common/cmd_fs.c) implementation
which works with the u-boot commands ls and load as follows:
ls maps to do_ls_wrapper()
load maps to do_load_wrapper()
Looking at CONFIG_CMD_JFFS2 with comman/cmd_jffs2.c, we see that it
defines the u-boot commands ls, fsinfo and fsload as follows:
ls maps to do_jffs_fsload()
fsload maps to do_jffs_fsload()
fsinfo maps to do_jffs2_fsinfo()

Firstly, this is a little inconsistent in the u-boot command name,
namely, ls is for ls of jffs fs, but the load and info commands have
an fs prefix - fsload, fsinfo.

Hence, we are left with two u-boot commands with the same name - ls,
one for jffs2 and the other for fs.c leading to the linking issue.


>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
> backups: always in season, never out of style.

Patch

diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index bce0983..f38455f 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -606,7 +606,7 @@  U_BOOT_CMD(
 	"      with offset 'off'"
 );
 U_BOOT_CMD(
-	ls,	2,	1,	do_jffs2_ls,
+	fsls,	2,	1,	do_jffs2_ls,
 	"list files in a directory (default /)",
 	"[ directory ]"
 );