Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
remzi-arpacidusseau
GitHub Repository: remzi-arpacidusseau/ostep-projects
Path: blob/master/filesystems-distributed-ufs/ufs.h
909 views
1
#ifndef __ufs_h__
2
#define __ufs_h__
3
4
#define UFS_DIRECTORY (0)
5
#define UFS_REGULAR_FILE (1)
6
7
#define UFS_BLOCK_SIZE (4096)
8
9
#define DIRECT_PTRS (30)
10
11
typedef struct {
12
int type; // MFS_DIRECTORY or MFS_REGULAR
13
int size; // bytes
14
unsigned int direct[DIRECT_PTRS];
15
} inode_t;
16
17
typedef struct {
18
char name[28]; // up to 28 bytes of name in directory (including \0)
19
int inum; // inode number of entry (-1 means entry not used)
20
} dir_ent_t;
21
22
// presumed: block 0 is the super block
23
typedef struct __super {
24
int inode_bitmap_addr; // block address (in blocks)
25
int inode_bitmap_len; // in blocks
26
int data_bitmap_addr; // block address (in blocks)
27
int data_bitmap_len; // in blocks
28
int inode_region_addr; // block address (in blocks)
29
int inode_region_len; // in blocks
30
int data_region_addr; // block address (in blocks)
31
int data_region_len; // in blocks
32
int num_inodes; // just the number of inodes
33
int num_data; // and data blocks...
34
} super_t;
35
36
37
#endif // __ufs_h__
38
39