view include/fs.h @ 52:2de1c2597a60

Modified getFSize so it now returns a value indicating success/failure Also modified the lookup function so it does not load the file into the cache
author Jonathan Pevarnek <pevarnj@gmail.com>
date Sat, 09 Apr 2011 01:28:06 -0400
parents eda059d74100
children b22b6a83cf04
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);
void printFname(char *name);
void getFname(char *fname);
int fnameCmp(const char *a, const char *b);

#endif //__FSH_H