[U-Boot] [PATCH] fs/fat: add a parameter: allow_whole_dev to fat_register_device()

Wolfgang Denk
2014-06-13T04:38:36Z

Dear Josh Wu,

In message <539A70FF.4080003@atmel.com> you wrote:
>
> > Don;t we also support plain "ifname dev", i. e. without partition
> > specification?
>
> The problem is we only support "ifname dev" on command line mode or the
> filesystem call which calls get_device_and_partition().
>
> For environment save/load and SPL load on FAT, which use
> fat_register_device() instead of calling get_device_and_partition(),
> we need specify the partition number. It DOESN'T support "ifname dev"
> without partition number.

OK. so we have indentified the problem. It seems we should fix that?

> > I think, we should implemnt consistent behaviour here.
>
> I agree. I will read the get_device_and_partition() code to understand it.

The commit message of the patch you referred to has a nice description
of how it is supposed to work.

> After the discussing I get a further think of this problem. Let me
> summary here:
>
> The problem I met is FAT env save/load and FAT spl load use
> fat_register_device() instead of get_device_and_partition().
> So that means I must specify a partition number.
>
> I think for usually user case, we don't want to specify the partition
> number. that means:
> 1. if has partition table, please use partition #1.

This is different from the non-SPL case then, which uses the first
bootable partition instead, which may or may bnot be # 1.

> if we agree with above, then the solution should be implement a way to
> support the case we don't specify a partition number.
> 1. use get_device_and_partition().
> 2. add a unspecify partition number support in fat_register_device()
>
> I think #1 is the best way be cause we don't have to implement same
> things in two place. But I am doubt that the FAT spl can use it. I'll
> check this.

Using the same code is also a good way to make sure the behaviour is
the same :-)

> What do think of that?

Sounds good to me.

> >>> Please make this an "int" type, and use 0 and 1.
> >> Is there any special concern for that? like cause machine compatiable issue?
> > Boolean values in C are 1 and 0. Hiding these under other names (like
> > "true" and "false") doesn't buy anything.
>
> Okay. I just think use bool will be more readable. That also can make
> people less use an integer number, which in some case it's hard to
> understand it.

None of the related code uses ant bool types so far, so please do not
introduce it now.

Thanks.

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 at denx.de
There is is no reason for any individual to have a computer in their
home. -- Ken Olsen (President of Digital Equipment Corporation),
Convention of the World Future Society, in Boston, 1977