#ifndef _FS_H #define _FS_H #include #include #define NRSUPER 8 #define NRFILE 128 #define NROPEN 32 /* these shouldn't change */ #define BLOCK_SIZE 1024 #define SUPER_MAGIC 0x137F struct file { uint16_t f_mode; uint16_t f_flags; struct m_inode *f_inode; off_t f_pos; }; struct super_block { uint16_t s_ninodes; uint16_t s_nzones; uint16_t s_imap_blocks; uint16_t s_zmap_blocks; uint16_t s_firstdatazone; uint16_t s_log_zone_size; uint32_t s_max_size; uint16_t s_magic; /* loaded in memory only */ struct s_buff *s_imap[8]; struct s_buff *s_zmap[8]; uint16_t s_dev; uint16_t s_dirt; uint16_t s_start; uint16_t s_super; uint16_t s_imap_off; uint16_t s_zmap_off; uint16_t s_inode_off; } __attribute__((packed)); struct m_inode { uint16_t i_mode; uint16_t i_uid; uint32_t i_size; uint32_t i_mtime; uint8_t i_gid; uint8_t i_nlinks; uint16_t i_zone[9]; } __attribute__((packed)); struct buffer { void *b_data; int b_present; uint16_t b_device; uint16_t b_block; struct task_struct *b_wait; struct buffer *b_next; struct buffer *b_prev; }; extern struct super_block sblocks[NRSUPER]; void block_read(struct buffer*); void block_write(struct buffer*); struct buffer *buffer_get_block(uint16_t, uint16_t); void mount_root(void); void fs_init(void); /* various init functions called by fs_init() */ void buffer_init(void); #endif