Path: blob/master/filesystems-distributed-ufs/ufs.h
909 views
#ifndef __ufs_h__1#define __ufs_h__23#define UFS_DIRECTORY (0)4#define UFS_REGULAR_FILE (1)56#define UFS_BLOCK_SIZE (4096)78#define DIRECT_PTRS (30)910typedef struct {11int type; // MFS_DIRECTORY or MFS_REGULAR12int size; // bytes13unsigned int direct[DIRECT_PTRS];14} inode_t;1516typedef struct {17char name[28]; // up to 28 bytes of name in directory (including \0)18int inum; // inode number of entry (-1 means entry not used)19} dir_ent_t;2021// presumed: block 0 is the super block22typedef struct __super {23int inode_bitmap_addr; // block address (in blocks)24int inode_bitmap_len; // in blocks25int data_bitmap_addr; // block address (in blocks)26int data_bitmap_len; // in blocks27int inode_region_addr; // block address (in blocks)28int inode_region_len; // in blocks29int data_region_addr; // block address (in blocks)30int data_region_len; // in blocks31int num_inodes; // just the number of inodes32int num_data; // and data blocks...33} super_t;343536#endif // __ufs_h__373839