On Thu, Mar 9, 2023 at 2:34 PM KIKUCHI Takeyoshi <kiku...@centurysys.co.jp>
wrote:

> Thanks for your reply.
>
> I see, there are hard-coded devices...
>
> Then, would it be acceptable to make an entry in CONFIG that says, for
> example, "support automatic partition parsing" and if enabled,
> automatically parse the partition when a block device is registered?
>
>
Since both builtin block/flash device and external storage(usb mass
storage, sd/emmc) exist in the complex case, the compiler time selection
may be hard to handle.


> I don't think the partition parsing in the initialization process can
> handle the case of active wire insertion and removal, such as USB
> storage and SD cards.
>
> However, the problem is how to handle the case when it is pulled out
> during mount, and I think it is difficult to know how to handle it (the
> same for Linux ?).
>
> If the implementation concept is OK, I could automatically analyze the
> partition as shown in the example below, so I would like to organize it
> a bit more and submit a pull request.
> (Device names have been changed to match Linux)
>
>
fs already has the code handle the auto mount/unmount case:
https://github.com/apache/nuttx/blob/master/fs/mount/fs_automount.c
The improvement could be added parse_block_partition to the suitable place.


> nsh> ls -l /dev/
> /dev:
>   crw-rw-rw-           0 console
>   crw-rw-rw-           0 eeprom
>   cr--r--r--           0 eeprom.uuid
>   crw-rw-rw-           0 i2c1
>   crw-rw-rw-           0 kmsg
>   crw-rw-rw-           0 loop
>   brw-rw-rw-  1929379840 mmcblk0
>   brw-rw-rw-   629145600 mmcblk0p1
>   brw-rw-rw-  1299185664 mmcblk0p2
>   brw-rw-rw-  2016411648 mmcblk1
>   brw-rw-rw-   268435456 mmcblk1p1
>   brw-rw-rw-  1746927616 mmcblk1p2
>   crw-rw-rw-           0 null
>   crw-rw-rw-           0 rtc0
>   crw-rw-rw-           0 telnet
>   crw-rw-rw-           0 ttyS0
>   crw-rw-rw-           0 tun
>   crw-rw-rw-           0 zero
>
>
> KIKUCHI Takeyoshi
>
>
> On 2023/03/09 15:11, Xiang Xiao wrote:
> > On Thu, Mar 9, 2023 at 6:05 AM KIKUCHI Takeyoshi <
> kiku...@centurysys.co.jp>
> > wrote:
> >
> >> Hi, All.
> >>
> >> The code to parse block device partitions is included (as well as the
> >> code to register partitions as devices), but it seems that the process
> >> to parse partitions is not called from the location where the block
> >> device is registered.
> >> (There is a function called "register_blockpartition", but it is not
> >> called from anywhere.)
> >>
> >> Is there an intentional reason for not parsing partitions?
> >
> >
> > It's because some devices hardcode the partition layout in code. So, the
> > board file will call parse_block_partition after creating  the block
> device
> > and finish the initialization in the original design.
> >
> >
> >> Would it be a
> >> problem to add an automatic partition parsing process call?
> >>
> >>
> > It could be added a new function to simplify the common usage.
> >
> > KIKUCHI Takeyoshi
> >>
> >> ---
> >> kiku...@centurysys.co.jp
> >>
> >
>
> --
> kiku...@centurysys.co.jp
>

Reply via email to