-
Notifications
You must be signed in to change notification settings - Fork 1
/
Inode.cpp
103 lines (84 loc) · 1.59 KB
/
Inode.cpp
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include"Inode.h"
#include<string.h>
Inode::Inode()
{
id = -1;
file_type = DIRECTORY_TYPE;
file_count = 0;
created_time = time(0);
modified_time = created_time;
byte_size = 0;
for(int i = 0; i < 10; i++)
{
direct_block_address[i] = -1;
}
//memset(direct_block_address,0,sizeof(direct_block_address));
indirect_block_address = -1;
}
Inode::~Inode()
{
}
int Inode::get_id()
{
return id;
}
int Inode::get_byte_size()
{
return byte_size;
}
time_t Inode::get_created_time()
{
return created_time;
}
time_t Inode::get_modified_time()
{
return modified_time;
}
int* Inode::get_direct_block_address()
{
return direct_block_address;
}
int Inode::get_indirect_block_address()
{
return indirect_block_address;
}
int Inode::get_file_type()
{
return file_type;
}
int Inode::get_file_count()
{
return file_count;
}
void Inode::set_id(int id)
{
this->id = id;
}
void Inode::set_byte_size(int byte_size)
{
this->byte_size = byte_size;
}
void Inode::set_created_time(time_t created_time)
{
this->created_time = created_time;
}
void Inode::set_modified_time(time_t modified_time)
{
this->modified_time = modified_time;
}
void Inode::set_direct_block_address(int direct_block_address[])
{
memcpy(this->direct_block_address,direct_block_address,10*sizeof(int));
}
void Inode::set_indirect_block_address(int indirect_block_address)
{
this->indirect_block_address = indirect_block_address;
}
void Inode::set_file_type(int type)
{
file_type = type;
}
void Inode::set_file_count(int count)
{
file_count = count;
}