flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Query: FAT12 File System Working..

Author
Thread Post new topic Reply to topic
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
I read about the structure of FAT12.. It has 2 FAT's in it which contain the entry for each cluster.. It also has a Root Directory where it keeps information about each file..

My question is, when we create a new file in that file system, then how do the Root Directory entry and the FAT entries corresponding to the new file get updated.. I mean who updates them..??
Post 12 Apr 2012, 10:09
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
The Disk Operating System (DOS) does, but if you are writing the OS, then you would. Pseudo code:

1. Find and empty directory entry to use for the filename and associated attributes
2. Find open locations on the disc via the FAT
3. Update the FATs with corresponding information to where the file is being store

There are some details within that but that's the crux of it.
Post 12 Apr 2012, 10:46
View user's profile Send private message Reply with quote
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
Ok.. So where can i learn more about it..??
I Googled it, but had no luck..

What does "Open Locations" mean in point 2..??

One more question..
We define a BPB table in the bootloader.. It merely tells about the disk attributes, such as number of sectors per clusters and stuffs.. So how can the system know that we are using a FAT12 file system..?
Post 12 Apr 2012, 14:07
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
uautkarsh wrote:
Ok.. So where can i learn more about it..??


Here is a good link for a lot of OS developmental items online (there are far more): http://wiki.osdev.org/Main_Page

uautkarsh wrote:
I Googled it, but had no luck..
Try FAT12/FAT16/FAT32/VFAT and you will get tons of hits.

uautkarsh wrote:
What does "Open Locations" mean in point 2..??
The File Allocation Table(s) (FAT) store file location information and point to a particular location on the disc that stores that part of the file in a sector identified by the address associated with the FAT location (it is a linked list, if I recall correctly). The directory entry points to the first FAT entry. The details you can find in a document I will provide the link for.

uautkarsh wrote:
One more question..
We define a BPB table in the bootloader.. It merely tells about the disk attributes, such as number of sectors per clusters and stuffs.. So how can the system know that we are using a FAT12 file system..?
This will be explained better within the document here: http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/fatgen103.doc

Here's a OS Wiki link: http://wiki.osdev.org/FAT

I hope this helps, though be warned, you have a lot of reading to do. Smile
Post 12 Apr 2012, 16:40
View user's profile Send private message Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach
This is one of the best documents that I have found about FAT12:
http://bos.asmhackers.net/docs/filesystems/fat12-16-32/docs/FAT12Description.pdf

I also have many other documents and code examples if you go up the directory structure on the server, like:
http://bos.asmhackers.net/docs/filesystems/fat12-16-32/

The FAT table contains cluster/fat pointers to the next part of any file or directory entries, and you can read in the cluster according to a formula based on the FAT value, but it also serves as a pointer to where in the FAt table the next part is stored.
For any sub-directory you have to look up which clusters to load from the FAT table and then the clusters loaded will have the same entry structure as the root directory itself. So the root is a special case becasue it has a fixed location and size so it's easier to get something from it then to first look up the directory entries for the folder, and then search for files within that.

I'm not sure if i made any sense, but the document that I linked to has it all explained in a good way.
Post 12 Apr 2012, 18:26
View user's profile Send private message Reply with quote
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
@Smiddy:
OSDev WIki is one of my favorites.. Smile
I will read the document you've given..
So what do i need to do to define my own File System..??

@Bubach:
I have read the document..
It was really useful..
I will check the asmhackers..
Thanks.. Smile
Post 12 Apr 2012, 18:38
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
uautkarsh wrote:
So what do i need to do to define my own File System..??
Knowledge, pen and paper (or ability to write out a plan on a computer, etcetera). Check the same site for file systems. There are so many out there. There was a guy on here who wrote a very simple one, I think, Bogdan? The problem using your own is you run into no one else can read/write to it. BTW, you can think of a File System as a big file with pointers etcetera to locations on a disc. Your canvas, so to speak, is the disc itself, you can do it however you wish. Wink
Post 12 Apr 2012, 20:41
View user's profile Send private message Reply with quote
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
@Smiddy:
Hehe.. Nice one with the canvas thing.. Razz
I will check it out.. And if i get any further problems.. I will post it here.. Smile
Post 13 Apr 2012, 08:24
View user's profile Send private message Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239
Post 30 Apr 2012, 05:30
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.