This project is read-only.

File System for COSMOS in C

Topics: Developing Cosmos (Working on Cosmos source code directly)
Jul 21, 2013 at 3:09 AM
Edited Jul 25, 2013 at 11:44 AM
Hello Cosmos,
I copied a open simple file system from a site in C not C#(cause it's useless for these jobs),
Here's the code :
#define uint unsigned int
enum bool {false=0, true=1};
/* Block service structures */
struct superblock {
    char fs_name[15];
 
    uint sb_count; //number of blocks superblock occupies
    uint block_size;
    uint block_count; //number of blocks file system has
    uint bbitmap_count; //number of blocks block bitmap occupies
    uint free_blocks; //how many blocks are free
    uint fs_rsv_blocks; //how many blocks are reserved from file system structs
 
    uint inode_size; //how many block an inode indexes
    uint inode_count; //total blocks occupied by inodes
    uint ibitmap_count; //how many blocks occupied by inode bitmap 
    uint fs_rsv_inodes; //how many inodes reserved from file system structures
    //i think its wrong the above but i grouped in inodes all the blocks of the disk so in some of        
    //them will hold filesystem's structures (will not be used at the end)
 
    uint dir_table_count; //how many blocks the directory table occupies
};
 
//an array of them will be created depended on how many blocks the filesystem will be
struct block_bitmap {
    enum bool block_bitmap;
};
 

//an array of them will be created depended on how many blocks the filesystem will be
struct inode_bitmap {
    enum bool inode_bitmap;
};
 

struct inode {
     uint block;
};
 
//structure to hold a single file, file size is used to know, how many inodes we have to search
struct index {
    uint file_size;
    struct inode inode;
    struct inode *indirect;
};
 

struct dir_table {
    char filename[16];
    struct index index;
    struct dir_table *next;
};
So how do I use this in COSMOS ,
I have heard and seen that COSMOS uses NASM, to compile the OS,
Also I could link this .c and convert it to .obj and use as in NASM
But the problem is C#, I will have to use C# for COSMOS not NASM,
How to I use .C files as reference in COSMOS?
Jul 21, 2013 at 9:24 AM

What you implemented is perfectly possible in c#.

Op 21 jul. 2013 04:09 schreef "ALLDESP" <[email removed]> het volgende:

From: ALLDESP

Hello Cosmos,
I wrote a simple file system in C not C#(cause it's useless for these jobs),
Here's the code :
#define uint unsigned int
enum bool {false=0, true=1};
/* Block service structures */
struct superblock {
    char fs_name[15];
 
    uint sb_count; //number of blocks superblock occupies
    uint block_size;
    uint block_count; //number of blocks file system has
    uint bbitmap_count; //number of blocks block bitmap occupies
    uint free_blocks; //how many blocks are free
    uint fs_rsv_blocks; //how many blocks are reserved from file system structs
 
    uint inode_size; //how many block an inode indexes
    uint inode_count; //total blocks occupied by inodes
    uint ibitmap_count; //how many blocks occupied by inode bitmap 
    uint fs_rsv_inodes; //how many inodes reserved from file system structures
    //i think its wrong the above but i grouped in inodes all the blocks of the disk so in some of        
    //them will hold filesystem's structures (will not be used at the end)
 
    uint dir_table_count; //how many blocks the directory table occupies
};
 
//an array of them will be created depended on how many blocks the filesystem will be
struct block_bitmap {
    enum bool block_bitmap;
};
 

//an array of them will be created depended on how many blocks the filesystem will be
struct inode_bitmap {
    enum bool inode_bitmap;
};
 

struct inode {
     uint block;
};
 
//structure to hold a single file, file size is used to know, how many inodes we have to search
struct index {
    uint file_size;
    struct inode inode;
    struct inode *indirect;
};
 

struct dir_table {
    char filename[16];
    struct index index;
    struct dir_table *next;
};
So how do I use this in ,
I have heard and seen that COSMOS uses NASM, to compile the OS,
Also I could link this .c and convert it to .obj and use as in NASM
But the problem is C#, I will have to use C# for COSMOS not NASM,
How to I use .C files as reference in COSMOS

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jul 21, 2013 at 11:20 PM
Edited Jul 21, 2013 at 11:34 PM
'I wrote a filesystem in C' more like copied and pasted...

http://cboard.cprogramming.com/linux-programming/122773-simple-file-system-c.html

Shame on you, claiming credit for someone elses work. And btw that can easily be rewritten in C#
Jul 25, 2013 at 11:46 AM
Just changed the post. Lol (I always have the habit of writing "wrote") Really Shame on me. Anyways anything could be done to this?
Jul 25, 2013 at 11:50 AM
just implement the fs in c# instead of c..


Jul 25, 2013 at 1:48 PM
Can I use the System.IO class?
Jul 25, 2013 at 1:49 PM
no
we hav a blockdevice (in the newest release)