简体   繁体   中英

Implementing ls command for NTFS in Linux

I am trying to build a bash like script provides some functionalities such as ls,pwd,cat etc. working on NTFS in a linux system. Suppose that I have an NTFS image and I open that as a file with fopen. Then, I read some sectors such as BPB residing at 0x0B and fetched some general info about the NTFS image. I need to reach to the root directory pointer then traverse through the filesystem in order to implement those functions especially for ls and pwd. I google'd a lot about internal details and offsets of NTFS but I could not find out how to achieve the goal. I can not progress further without understandable documentation or samples.

Any help, documentation, hint, offset table etc. would be highly appreciated.

Thank you.

I'm guessing this is a learning exercise. So, first:

  1. Writing a bash like interpreter for a specific filesystem is the wrong thing to do. You should be concentrating on understanding the details of the NTFS filesystem instead.

  2. Writing ls , cat to be able to work with files in a specific filesystem is the wrong thing to do. You should be concentrating on understanding the details of the NTFS filesystem instead.

  3. If you write a filesystem driver (say using FUSE ), then the original bash , ls , cat will automatically work with that filesystem. Because the driver will be able to translate system calls like open and read into the filesystem specific procedure.

Finally:

  1. Learn about FUSE . It is awesome . See this Hello World FUSE module . Run it, play with it.

  2. Download the sources for NTFS-3G , which is the NTFS driver used by most GNU/Linux distros these days. It uses FUSE. Learn how it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM