By the way, I think there are some errors in function grub_xxx_iterate_dir
.For example, in
grub_hfsplus_iterate_dir , if the malloc of node is wrong it will return 1,
added in commit
df042ccb21ac70dfffea67c8d78e2feb6b15c895, you can find it here
<https://github.com/Archstacker/GRUB/commit/df042ccb21ac70dfffea67c8d78e2feb6b15c895#diff-85c3a97748d2944220596c91ddee32efR870>.At
the same time,if the malloc of filename is wrong it will return 0, you can
find it here
<https://github.com/Archstacker/GRUB/commit/df042ccb21ac70dfffea67c8d78e2feb6b15c895#diff-85c3a97748d2944220596c91ddee32efR835>
.
I suggest to recheck the grub_xxx_iterate_dir function in all the
filesystem codes.

On Sat, Sep 19, 2015 at 9:50 PM, Arch Stack <archstac...@gmail.com> wrote:

> I want to
> create a filesystem driver to read different type of filesystems(Ext2/3/4
> , Reiserfs, XFS, Btrfs...) on Windows with the help of the related codes in 
> GRUB. I asked it on help-grub with the subject
> "How to reuse the the part of codes about file system in grub ?
> <http://lists.gnu.org/archive/html/help-grub/2015-08/msg00009.html>"。
>
> Now I have finished with the help of dokany
> <https://github.com/dokan-dev/dokany>
> (similar to FUSE but works on Windows).You can find the what I have done on
> https://github.com/Archstacker/GRUB. The most important file is
> grub-mount-win.c
> <https://github.com/Archstacker/GRUB/blob/e18c93/util/grub-mount-win.c>
> , which implements the interface to dokany.
>
>
> These are what I have done above the codes above GRUB:
>
> 1.Add check for file_name in grub_file_open. It has been fixed in ‘
> [PATCH] file: ignore host disk in blocklist check’
>
> 2.
> Add size and symlink attribute to grub_dirhook_info. Otherwise I must open 
> each file when readdir, and it
> ’s very slow.You can test it with grub-mount, when you ‘ls’
>  in a directory which has thousands of files(such as /bin), it will cost a 
> lot of time.
>
> 3.Use ‘fs->open’ rather than ‘grub_file_open’.Because the grub_file_open
>  must probe for the type of filesystem each time, which will cost a lot of 
> time and is unnecessary. And it will try to decompress each file it opened, 
> but I think it
> ’s not suitable.I think it’
> s better to check for whether the filesystem has enabled compress or not.
>
> 4.
> Add check when store disk cache.You can find it on grub-devel. Because dokany 
> will start multi thread at the same time, the function grub_disk_cache_store 
> must check for cache->lock before copy something to it. Otherwise ,the 
> program may crash because cache->data is set to zero by other thread before 
> grub_memcpy in grub_disk_cache_store.
>
>
>
>
> But because GRUB is single thread and it use a global variable 
> grub_errno.When it was called with dokany in multi thread, the grub_errno 
> will be wrong in some times, which will cause the crash of the program or the 
> other things unexpected.
>
> I don’
> t know how to solve it suitable, so I have set the ThreadCount of dokany to 1 
> now. But it will be too slow when open a directory with a lot of files in it.
>
> You can try what I have done in
> https://github.com/Archstacker/GRUB/releases/latest
>
> Do you have good ideas to solve it? And what do you think of this project?
>
_______________________________________________
Help-grub mailing list
Help-grub@gnu.org
https://lists.gnu.org/mailman/listinfo/help-grub

Reply via email to