view include/fs.h @ 53:b22b6a83cf04

Added a function to check whether a specific block is in use
author Jonathan Pevarnek <pevarnj@gmail.com>
date Sat, 09 Apr 2011 11:18:57 -0400
parents 2de1c2597a60
children 39fcefab46ed
line wrap: on
line source

#ifndef __FS_H
#define __FS_H

struct SUPERBLOCK {
	u32 magic;              // == 0x42420374
	u32 root_inode;         // the disk block containing the root inode
	u32 nblocks;            // number of block on the disk
	u32 _pad[253];          // unused (should be '\0' filled)
};
typedef struct SUPERBLOCK Superblock;

struct INODE {
	u32 size;               // file length in bytes
	u32 _pad0;              // unused (should be 0)
	u64 ctime;              // creation time stamp
	u64 mtime;              // last modification time stamp
	u16 nblocks;            // number of data blocks in this file
	u16 _pad1;              // unused (should be 0)
	u32 _pad2;              // unused (should be 0)
	u32 blocks[248];        // file block ptrs
};
typedef struct INODE Inode;

struct DIRENTRY { //32 bytes
	char fname[28];
	u32 inode;
};
typedef struct DIRENTRY Direntry;

int fsInit(u32 devnum);
void listFiles();
u32 lookupFile(char *fname);
int getFSize(u32 fid, u32 *size);
int getFData(u32 fid, void *ptr);
short isBlockAt(u32 block);
void printFname(char *name);
void getFname(char *fname);
int fnameCmp(const char *a, const char *b);

#endif //__FSH_H