Giter Club home page Giter Club logo

Comments (1)

bztsrc avatar bztsrc commented on July 27, 2024

Well, I use the same code for both fat16 and fat32. The only difference is that I get the same initial values from different fields for fat32, see fat.c line 116.
root_sec: starting sector of root directory
data_sec: starting sector of data area (cluster 2 in other words)

Later when the file allocation table is parsed, I either use 16 bit wide ints (for fat16) or 32 bits wide ints (for fat32) as the elements of the table, see line 161. That's all, everything else is the same. I made the distintion by checking the 16 bits long version of sector per fat: (bpb->spf16?bpb->spf16:bpb->spf32). If it's zero, then it must be a fat32, see line 167 for example. I also dump all the important variables used in calculations at line 180.

If you want to better understand what sector positions are calculated and why, I suggest to read Microsoft's documentation on the FAT filesystem. The wikipedia's article is also a good start, as it has a figure illustrating the regions on the disk. They are the same, save that root directory is included in data area for FAT32 (hence the checks in lines 123 and 173).

Hope this helps. Cheers,
bzt

from raspi3-tutorial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.