-
Notifications
You must be signed in to change notification settings - Fork 0
/
testfs4a.c
39 lines (32 loc) · 909 Bytes
/
testfs4a.c
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "filesystem.h"
#include "softwaredisk.h"
// RUN formatfs before conducting this test then run testfs4b *after* this test
int main(int argc, char *argv[]) {
int ret, i;
File f;
char buf[SOFTWARE_DISK_BLOCK_SIZE];
// tests block alignment, along with testfs4b
f=create_file("line-em-up");
printf("ret from create_file(\"line-em-up\") = %p\n",
f);
fs_print_error();
if (f) {
for (i=0; i < 50; i++) {
memset(buf, 'A'+i, SOFTWARE_DISK_BLOCK_SIZE);
ret = write_file(f, buf, SOFTWARE_DISK_BLOCK_SIZE);
printf("ret from write_file(f, buf, SOFTWARE_DISK_BLOCK_SIZE) = %d\n",
ret);
fs_print_error();
}
close_file(f);
printf("Executed close_file(f).\n");
fs_print_error();
}
else {
printf("FAIL. Did you run formatfs before this test?\n");
}
return 0;
}