-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.txt
251 lines (129 loc) · 5.77 KB
/
readme.txt
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
**Assignment 1: Storage Manager**
****************************************************
CONTENTS
*********
1)Instructions to run the code
2)Description of functions used
3)Additional Test Cases
4)Implementation
*****************************************************************
1)Instructions to run the code
*******************************
a)For executing mandatory test cases:
1) In the terminal,navigate to the assignment directory.
2) Type:
make -f makefile1
3) ./assign1
b) For executing additional test cases:
1) In the terminal,navigate to the assignment directory.
2) Type:
make -f makefile2
3) ./assign2
*****************************************************************
2)Description of functions used
********************************
Function : CreatePageFile
-------------------------
1)Check for file existence.If the file exists,throw an error message that the file is already present.
2)If the file does not exist,create the file and fill the first page with null bytes.
Function : OpenPageFile
------------------------
1) Check if the file with the provided file name exists and also the acess for that particular file.
2) If it does not exist, throw an error.
3) If opening the file is successful,then the fields of this file handle are initialized with the information about the opened file.
4) The file pointer is stored for book keeping i.e. in mgmtInfo
Function : ClosePageFile
-----------------------------
1) Close the file and return a success message upon success.
2) Upon failure, return an appropriate error message.
Function : DestroyPageFile
------------------------------
1) If the file is present, remove the file.
2) Upon success, return a success message.
3) Upon failure, return a failure message.
Function : readBlock
---------------------
1)Check if the file handler has been initialzed and if the page exists.
2)Seek the file descriptors position to the page requested.
3)Read the content of the page and load it to the memory which is specified in mempage.
Function : getBlockPos
-----------------------
1)Check if the file handler has been initialzed.
2)If initialized,return position of the page in file.
Function : readFirstBlock
-------------------------
1)Check if the file handler has been initialzed.
2)Seek the file pointer to the first page of the file.
3)Read the content to mempage.
Function : readPreviousBlock
----------------------------
1)Check if the file handler has been initialzed.
2)Check if we are trying to access non existing page in the file.
3)Seek the file pointer to the previous block.
4)Read the content to mempage.
Function : readCurrentBlock
---------------------------
1)Check if the file handler has been initialzed.
2)If we are reading a non existing page ,then throw an error.
3)Read the content of the current page position to mempage.
Function : readNextBlock
------------------------
1)Check if the file handler has been initialzed.
2)Check if we are trying to access a non existing page in the file.
3)Seek the file pointer to the next block.
4)Read the content to mempage.
Function : readLastBlock
------------------------
1)Check if the file handler has been initialzed.
2)Move the file file pointer to the last page of the file.
3)Read the content to mempage.
Function: writeBlock
---------------------
1)Check if the file handler has been initialzed.
2)Get the current Position of the file.
3)Write Contents to the file. If failed,throw an error message.
Function: writeCurrentBlock
----------------------------
1)Check if the file handler has been initialzed.
2)Check if we are trying to access a non existing page in the file.
3)Seek the file pointer to the number of pages passed.
4)Write Contents to the file. If failed,throw an error message.
Function : appendEmptyBlock
-------------------------------
1)Check if the file handler has been initialzed.
2.Check for the total number of pages and update the total number of pages.
3.Seek the file pointerto the lat page and print'\0' for PAGE_SIZE bytes.
Function : ensureCapacity
-----------------------------
1) Get the size of the page block.
2) Check if the size of the page block is greater than the number of pages.If true,then the capacity has been ensured.
3) Else,print'\0' for the remaining pages.
3) Additional Test Cases
------------------------
We have included additional test cases for executing the following functions.
-GetBlockPosition
-ReadCurrentBlock
-ReadPreviousBlock
-ReadNextBlock
-WriteCurrentBlock
-ReadLastBlock
-EnsureCapacity
4) Implementation
-----------------
Before the actual coding of the project was done,we figured out the cause and effect of the problem,which made the implementation more systematic.
We then split the project into 3 modules and worked on the modules.
The modules being:
a)Functions pertaning to open,close,destroy a page file.
b)Functions pertaining to read operations.
c)Functions pertaining to write operation.
then,the code was integrated using GitHub.
The implementation versions with the descriptions are as follows.
Version Date Description
---------- -------- ------------
version 1.0 9/25/2014 Initial code had logical and syntax errors
version 1.1 9/26/2014 Errors had been rectified and makefile was created
version 1.2 9/27/2014 Changes in ensure capacity were incorporated
version 1.3 10/02/2014 All test cases were sucessfully implemented and additional test cases were added
version 1.4 10/03/2014 makefile was updated and comments were
(FINAL) added to improve readability of the code.
----------------------------------------------------------------------------------------------------------------------------------