RSFS - Really Simple File System

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: RSFS - Really Simple File System

Post by b.zaar »

iansjack wrote: I still don't think it's a filesystem and not even useful as a template for one. It fails to address some of the most basic points of filesystems such as allocation of storage space. It's not so much a

printf("Hello World")

filesystem as a

puts(’H')

one.
Agreed...

@Antti It's just a file with an internal structure without much to gain over a regular flat file. The same thing as your mkdir/cd/type example could be done using existing file types like tar or zip. Working with a stored zip file (compression method = 0) would handle all the same tests you want to do without having to write the tool to create the file. The format really isn't complicated, check out 4.3.7 for the file meta data. If you really want a system simpler than this you can just ignore everything but the uncompressed size and the filename.

http://www.pkware.com/documents/casestudies/APPNOTE.TXT
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: RSFS - Really Simple File System

Post by Antti »

Combuster wrote:It forces you to cover all the cases needed in a device driver without actually designing a filesystem
Yes and it is easy to have a device driver that is really perfect, e.g. no missing features. It is simple but it works. Perhaps in the future all hobby OSes have an "rsfs.c" in their "fsdrivers".
b.zaar wrote:Working with a stored zip file...
An interesting side note, I studied that format few months ago. I thought I could use it as a boot RAM disk but I discarded that idea for now. But yes, the zip format could work.

Please note that an RSFS partition must be bootable. Perhaps the structure could be something like this:

Code: Select all

Offset                  Length      Description
0x0000000000000000      124         reserved area

0x000000000000007C      4           signature 'RSFS'
0x0000000000000080      8           volume size
0x0000000000000088      8           file start offset
0x0000000000000090      8           file size
0x0000000000000098      8           modification time
0x00000000000000A0      4           file checksum (optional)
0x00000000000000A4      2           file flags (implicit folders are "default")
0x00000000000000A6      2           header checksum (from 0x7C to 0xFF)
0x00000000000000A8      1-88        file name (zero terminated UTF-8, zero-byte padded)

0x0000000000000100      256         reserved area
0x0000000000000200      ?           optional system area (if "file start offset" is not 0x200)
0x????????????????      ?           file data
I removed the backup block. Comments?
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: RSFS - Really Simple File System

Post by Antti »

"Hidden sectors" information is important. A new draft version:

Code: Select all

Offset                  Length      Description
0x0000000000000000      120         reserved area

0x0000000000000078      4           signature 'RSFS'
0x000000000000007C      2           header checksum
0x000000000000007E      2           file flags
0x0000000000000080      8           volume offset
0x0000000000000088      8           volume size
0x0000000000000090      8           file offset
0x0000000000000098      8           file size
0x00000000000000A0      8           creation time
0x00000000000000A8      8           modification time
0x00000000000000B0      0-80        file name (zero terminated UTF-8, zero-byte padded)

0x0000000000000100      256         reserved area
0x0000000000000200      ?           optional system area (if "file offset" is not 0x200)
0x????????????????      ?           file data
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: RSFS - Really Simple File System

Post by b.zaar »

Antti wrote:Please note that an RSFS partition must be bootable.
How big is a partition for a single file?

What kind of data do you plan to store in this one file?
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: RSFS - Really Simple File System

Post by Antti »

b.zaar wrote:How big is a partition for a single file?
You can decide the partition size. It must be at least (max file size + 512) bytes. Also, I would recommend using a well-aligned partition size.
b.zaar wrote:What kind of data do you plan to store in this one file?
Any data, e.g. it could be an image file of another file system. The file data is always continuous, i.e. not fragmented.
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: RSFS - Really Simple File System

Post by b.zaar »

So it's just a wrapper around real files?
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: RSFS - Really Simple File System

Post by Antti »

b.zaar wrote:So it's just a wrapper around real files?
I would not want think it that way. It is a full file system on its own. How the file data is handled, e.g. if it is a file system image, is not RSFS's policy.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: RSFS - Really Simple File System

Post by Antti »

Code: Select all

Offset                  Length      Description
0x0000000000000000      120         reserved area

0x0000000000000078      4           signature 'RSFS'
0x000000000000007C      2           header checksum
0x000000000000007E      2           file flags
0x0000000000000080      8           volume offset
0x0000000000000088      8           volume size
0x0000000000000090      8           file offset
0x0000000000000098      8           file size
0x00000000000000A0      8           creation time
0x00000000000000A8      8           modification time
0x00000000000000B0      0-80        file name (zero terminated UTF-8, zero-byte padded)

0x0000000000000100      256         reserved area
0x0000000000000200      ?           optional system area (if "file offset" is not 0x200)
0x????????????????      ?           file data

Units

A byte is an 8-bit unit. Multibyte values are little-endian.


File flags

Code: Select all

Flag            Description
0x0001          reading allowed
0x0002          writing allowed
0x0004          executing allowed
0x0008          deleting allowed
0x0010          archive flag

Other flags are not used and they shall be zero.

Volume offset and size

Volume offset defines how many bytes there are before this volume in a storage device. The size defines the RSFS file system size in bytes.


File offset and size

File offset defines how many bytes there are before the file data (starting from the beginning of RSFS). Must be at least 512 bytes. File size defines the file data length in bytes.


Creation and modification time

The number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds.


File name

E.g. "FILE.TXT", "FOLDER/FILE.TXT". Name rules defined later.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: RSFS - Really Simple File System

Post by Antti »

This is an informal description but you got the idea. I need to write an extremely official specification. Otherwise this is pointless and no one is going to use it.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: RSFS - Really Simple File System

Post by Combuster »

And instead of bothering with the notion of leap seconds, you may want to consider using TAI or GPS seconds instead, and add a conversion to UTC/POSIX time as an implementation note.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
AndrewAPrice
Member
Member
Posts: 2303
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: RSFS - Really Simple File System

Post by AndrewAPrice »

Antti wrote:I plan to create a file system specification. The idea is to have a file system that supports only one file.
I do see some use for this. A database engine that takes full control of a partition or device.
My OS is Perception.
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: RSFS - Really Simple File System

Post by iansjack »

MessiahAndrw wrote:
Antti wrote:I plan to create a file system specification. The idea is to have a file system that supports only one file.
I do see some use for this. A database engine that takes full control of a partition or device.
Well, yes. I believe that's how early databases were implemented. But it's hardly a file system, is it?
User avatar
AndrewAPrice
Member
Member
Posts: 2303
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: RSFS - Really Simple File System

Post by AndrewAPrice »

iansjack wrote:
MessiahAndrw wrote:
Antti wrote:I plan to create a file system specification. The idea is to have a file system that supports only one file.
I do see some use for this. A database engine that takes full control of a partition or device.
Well, yes. I believe that's how early databases were implemented. But it's hardly a file system, is it?
It is a system for storing a file, no?

I could see the advantage in writing a gzip file directly onto to a block device.
My OS is Perception.
User avatar
iansjack
Member
Member
Posts: 4707
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: RSFS - Really Simple File System

Post by iansjack »

But a filesystem is more than a means of storing a single file. The essence of a filesystem is that it divides the data stored on a device into named chunks, which conventionally are known as files. Most useful filesystems also organize those files into a hierarchy of containers known as directories.

A "filesystem" consisting of a single file is similar to a Periodic Table containing only one element - and just as useful.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: RSFS - Really Simple File System

Post by Kevin »

It is a system for storing a file, no?

I could see the advantage in writing a gzip file directly onto to a block device.
But then why don't you just write it directly to the device, without a pseudo-filesystem in between? Do you really need any filesystem metadata? (Well, for gzip it actually looks like you need to have the file length, but for a database I'd expect this information to be contained in the file data.)
Developer of tyndur - community OS of Lowlevel (German)
Post Reply