flat assembler
Message board for the users of flat assembler.

Index > OS Construction > My Own file system

Author
Thread Post new topic Reply to topic
majidkamali1370



Joined: 31 Oct 2010
Posts: 50
Location: Iran
majidkamali1370
Hello.
I want to write a simple OS just for learning.
I want to know, is it better to learn an existing file system like FAT12 or implement my own?

Thanks Very Happy
Post 30 Apr 2012, 07:00
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
IMHO, FAT32 is better to be learned. FAT12 have very limited use.
Whether you will use some file system standard or use your own file system is actually design choice in your OS planning. Both variants have advantages and disadvantages.
My suggestion is to not use particular file system, but to implement in your OS core, some driver interface that to allow connecting modules that to handle different file systems. As a beginning you can write one file system driver for FAT32 (because there are ready made implementations that you can use).
Later, you can implement another modules, including your own file system(s).
Post 30 Apr 2012, 07:36
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
majidkamali1370



Joined: 31 Oct 2010
Posts: 50
Location: Iran
majidkamali1370
Quote:
As a beginning you can write one file system driver for FAT32 (because there are ready made implementations that you can use).
Later, you can implement another modules, including your own file system(s).

You mean I write FAT32 as an interface to my own FS or vise versa?
What is difference between functions that I use to read/write hard disk and my own FS? Aren't both one thing? FS is just a template. Isn't it true?
So, how physical division of hard drive should be?
Post 30 Apr 2012, 08:27
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
I mean, that the proper approach is to not rely on particular file system. Plan your OS in module way, so in order to be able to use several file system drivers simultaneously.
Post 30 Apr 2012, 09:19
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
majidkamali1370



Joined: 31 Oct 2010
Posts: 50
Location: Iran
majidkamali1370
Excuse me, I don't understand what you say. Sad
These functions/modules that you say must operate on a pattern-like format on Hard Disk for read/write.
How should I implement that pattern? Isn't it what I call my own FS?

Again, excuse me for much questioning Confused
Post 30 Apr 2012, 12:05
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach
You implement an abstraction layer, that each filesystem driver hooks into, so you can call functions like openfile(path), writeFile(path) and it will automatically tell from the path which drive (for hdd vs floppy driver) and which filesystem (fat32, fat12, your own) to use - because the it's separated from the low level parts of each driver.

This interface/driver, would have a list of all hardware drivers for harddrives, floppies and so on, one list for all filesystem drivers, and one struct like list of which drives where found by what driver, and what filesystem was found on it. each hardware and filesystem driver could have an entry point where there's a calltable for the common operations it can preform, or zero if it's unimplemented, that way you know how to call it dynamically.

HTH
Post 30 Apr 2012, 12:23
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
OK, I will try to explain in details.
There are two aspects of storage devices access. First is the physical access - read and write of the sectors or clusters of the device. Different devices need different programs, depending on the interface. In general for every possible device your OS support you will need some subroutines to read or write sectors.
The second aspect is the file system. The subroutines that manage the filesystem have as arguments different file parameters - file names, file attributes, etc. These subroutines process its operations reading and writing physical sectors - i.e. calling the subroutines of the previous layer, described.
As long as there are different physical interfaces and different file systems, it is good idea to provide ability to use several of such libraries at the same time - some driver interface.

At first time, you can keep your OS simple and use BIOS for the disk physical access and support only one file system.
But it is good idea to make proper planning that to allow easy growth of the OS later.
Post 30 Apr 2012, 12:33
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
majidkamali1370



Joined: 31 Oct 2010
Posts: 50
Location: Iran
majidkamali1370
I think now I understand what you said.
Thank you guys Wink
Post 30 Apr 2012, 22:46
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
adroit



Joined: 21 Feb 2010
Posts: 252
adroit
An easier task would be the learn a existing filesystem, study it and try to re-implement it. From there, you may design your own filesystem, may it be a derivation of the existing one or not. But you've done some studying as to how the proper design of a filesystem is done. I haven't no experience in filesystems, but this seems like preferred thing to do, in my opinion.

_________________
meshnix
Post 02 May 2012, 15:56
View user's profile Send private message Reply with quote
majidkamali1370



Joined: 31 Oct 2010
Posts: 50
Location: Iran
majidkamali1370
@JohnFound:
Quote:
use BIOS for the disk physical access

How can I use BIOS interrupts in pmode?
Post 02 May 2012, 16:22
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
majidkamali1370 wrote:
@JohnFound:
Quote:
use BIOS for the disk physical access

How can I use BIOS interrupts in pmode?


With some simple code (depending on your OS design), there are many advantages to using it, along with drivers for the hardware.

EG: As a backup if you do not have a suitable drivers.
One of the big advantages is that you can read/write to USB fobs or USB FDD/HDD drives.
Without the need for usb stack (you will need to add one at some point).

Heres is some simple code, it goes to and from pm to switch modes, to swich between vesa mode and text mode every 10 seconds.
You can use the same switching code to read/write using int 13h function.
Best to switch evey 512bytes.

(See DexOS code if you want a working example).

Or see the work of "Mike Gonta" as a way to use BIOS interrupts in pmode.


Description: VesaDemo code
Download
Filename: VesaDemo.zip
Filesize: 108.1 KB
Downloaded: 177 Time(s)

Post 02 May 2012, 17:20
View user's profile Send private message Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 238
Location: the-ideom
Mike Gonta
majidkamali1370 wrote:
@JohnFound:
Quote:
use BIOS for the disk physical access

How can I use BIOS interrupts in pmode?
You can't!
That's the job of the BIOS extender.
bootstrap32 is a PM32 USB FAT32 bootloader which includes a free BIOS extender (free in the sense that you
are free to use it or not once loaded). Over 5 years in development and production. Tested on many PC's both
old and new (with traditional BIOS). Correctly handles System Management Mode transitions. Directly supports
the most commonly used BIOS functions. Access to the core function which allows access to any native
motherboard BIOS function. No setup or special calls to make, just initialize the registers and make an interrupt call.

Or you can roll your own as Craig has suggested.


Last edited by Mike Gonta on 19 Nov 2012, 21:59; edited 2 times in total
Post 03 May 2012, 20:29
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
Great comments, excellent thread. Thanks to all, much appreciated. A link to a tutorial explaining FAT 32 could also be useful for those wishing to follow the recommendation of first learning/using FAT 32, then designing one's own file system.
Post 06 May 2012, 11:22
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.