-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
74 lines (57 loc) · 2.8 KB
/
main.c
File metadata and controls
74 lines (57 loc) · 2.8 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include<stdio.h>
#include"fs.h"
#include<string.h>
int main(){
//logical_blocks=malloc(BLOCK_SIZE*100);
//init_super()
copy_to_logical_blocks(logical_blocks,&deb);
init_inodes();
init_buffers();
display_buffers();
display_inodes();
mount_root(DEVICE_NUM);
puts("\n-----------------AFter mount-------------------------\n");
display_inodes();
display_buffers();
display_super();
printf("blkno of root is : %d\n",uarea.curr_dir->i_disk[0]);
struct dir_entry* entry=(struct dir_entry*)malloc(sizeof(struct dir_entry));
puts("block 4 logical \n");
memcpy(&entry->inode,&logical_blocks[(BLOCK_SIZE*4)],sizeof(unsigned short));
memcpy(entry->name,&logical_blocks[(BLOCK_SIZE*4)+sizeof(unsigned short)],sizeof(entry->name));
printf("%u\n",entry->inode);
printf("%s\n",entry->name);
puts("block 4 logical \n");
memcpy(&entry->inode,&logical_blocks[(BLOCK_SIZE*4)+sizeof(struct dir_entry)],sizeof(unsigned short));
memcpy(entry->name,&logical_blocks[(BLOCK_SIZE*4)+sizeof(unsigned short)+sizeof(struct dir_entry)],sizeof(entry->name));
printf("%u\n",entry->inode);
printf("%s\n",entry->name);
puts("block 4 logical \n");
memcpy(&entry->inode,&logical_blocks[(BLOCK_SIZE*4)+(sizeof(struct dir_entry)*2)],sizeof(unsigned short));
memcpy(entry->name,&logical_blocks[(BLOCK_SIZE*4)+sizeof(unsigned short)+(sizeof(struct dir_entry)*2)],sizeof(entry->name));
printf("%u\n",entry->inode);
printf("%s\n",entry->name);
puts("block 4 logical \n");
memcpy(&entry->inode,&logical_blocks[(BLOCK_SIZE*4)+(sizeof(struct dir_entry)*3)],sizeof(unsigned short));
memcpy(entry->name,&logical_blocks[(BLOCK_SIZE*4)+sizeof(unsigned short)+(sizeof(struct dir_entry)*3)],sizeof(entry->name));
printf("%u\n",entry->inode);
printf("%s\n",entry->name);
puts("block 4 logical \n");
memcpy(&entry->inode,&logical_blocks[(BLOCK_SIZE*4)+(sizeof(struct dir_entry)*4)],sizeof(unsigned short));
memcpy(entry->name,&logical_blocks[(BLOCK_SIZE*4)+sizeof(unsigned short)+(sizeof(struct dir_entry)*4)],sizeof(entry->name));
printf("%u\n",entry->inode);
printf("%s\n",entry->name);
puts("block 4 logical \n");
memcpy(&entry->inode,&logical_blocks[(BLOCK_SIZE*4)+(sizeof(struct dir_entry)*5)],sizeof(unsigned short));
memcpy(entry->name,&logical_blocks[(BLOCK_SIZE*4)+sizeof(unsigned short)+(sizeof(struct dir_entry)*5)],sizeof(entry->name));
printf("%u\n",entry->inode);
printf("%s\n",entry->name);
printf("%u\n",sizeof(struct disk_inode)); //48
printf("%u\n",sizeof(struct disk_inode*)); //8
printf("%d\n",sizeof(struct super));
printf("%d\n",sizeof(struct filesystem));
return 0;
}
/*
gcc main.c buffer.c super.c inode.c panic.c block.c namei.c syscalls.c file_dev.c -o myexe
*/