|Subject:||Re: Mount different filesystems with the related codes in GRUB|
|Date:||Sat, 19 Sep 2015 22:56:25 +0800|
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 ?"。
Now I have finished with the help of 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 , 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?
|[Prev in Thread]||Current Thread||[Next in Thread]|