-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructures.h
More file actions
52 lines (45 loc) · 1.02 KB
/
Copy pathstructures.h
File metadata and controls
52 lines (45 loc) · 1.02 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "mfs.h"
#define MFS_DIRECTORY (0)
#define MFS_REGULAR_FILE (1)
#define MAX_NUM_INODES (4096)
#define IMAP_PIECE_SIZE (16)
#define NUM_INODE_PIECES (MAX_NUM_INODES/IMAP_PIECE_SIZE) // 256
#define MFS_BLOCK_SIZE (4096)
enum MFS_REQ {
REQ_INIT,
REQ_LOOKUP,
REQ_STAT,
REQ_WRITE,
REQ_READ,
REQ_CREAT,
REQ_UNLINK,
REQ_RESPONSE,
REQ_SHUTDOWN
};
// struct message/packet
typedef struct Packet {
enum MFS_REQ request;
int inum;
int block;
int type;
char name[64];
char buffer[MFS_BLOCK_SIZE];
MFS_Stat_t stat;
} Packet;
// struct for INode
typedef struct INode {
int type; // MFS_DIRECTORY or MFS_REGULAR
int size; // bytes
int blocks[14];
} INode;
// struct for checkpoint region
typedef struct CheckpointRegion {
int logEnd;
int iNodeMaps[256];
} CheckpointRegion;
// struct for imap piece
//takes inode number as input and produces the disk address
//of the most recent version of the inode
typedef struct ImapPiece {
int inodes[IMAP_PIECE_SIZE]; // holds 16 inodes
} ImapPiece;