-
Notifications
You must be signed in to change notification settings - Fork 0
/
ufs.h
37 lines (29 loc) · 1.03 KB
/
ufs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef __ufs_h__
#define __ufs_h__
#define UFS_DIRECTORY (0)
#define UFS_REGULAR_FILE (1)
#define UFS_BLOCK_SIZE (4096)
#define DIRECT_PTRS (30)
typedef struct {
int type; // MFS_DIRECTORY or MFS_REGULAR
int size; // bytes
unsigned int direct[DIRECT_PTRS];
} inode_t;
typedef struct {
char name[28]; // up to 28 bytes of name in directory (including \0)
int inum; // inode number of entry (-1 means entry not used)
} dir_ent_t;
// presumed: block 0 is the super block
typedef struct __super {
int inode_bitmap_addr; // block address (in blocks)
int inode_bitmap_len; // in blocks
int data_bitmap_addr; // block address (in blocks)
int data_bitmap_len; // in blocks
int inode_region_addr; // block address (in blocks)
int inode_region_len; // in blocks
int data_region_addr; // block address (in blocks)
int data_region_len; // in blocks
int num_inodes; // just the number of inodes
int num_data; // and data blocks...
} super_t;
#endif // __ufs_h__