1 #include "library/filesystem.hpp"
6 int main(int argc
, char** argv
)
9 if(!strcmp(argv
[2], "allocate")) {
10 uint32_t c
= x
.allocate_cluster();
11 std::cerr
<< "Allocated cluster " << c
<< std::endl
;
13 if(!strcmp(argv
[2], "delete")) {
14 std::istringstream
s(argv
[3]);
17 x
.free_cluster_chain(c
);
19 if(!strcmp(argv
[2], "skip")) {
20 std::istringstream
s1(argv
[3]);
21 std::istringstream
s2(argv
[4]);
22 std::istringstream
s3(argv
[5]);
27 size_t r
= x
.skip_data(c1
, c2
, c3
);
28 std::cerr
<< "Skip_data: cluster=" << c1
<< " ptr=" << c2
<< " amount=" << r
<< std::endl
;
30 if(!strcmp(argv
[2], "read")) {
31 std::istringstream
s1(argv
[3]);
32 std::istringstream
s2(argv
[4]);
33 std::istringstream
s3(argv
[5]);
38 char* buf
= (char*)calloc(c3
+ 1, 1);
39 size_t r
= x
.read_data(c1
, c2
, buf
, c3
);
40 std::cerr
<< "Read_data: cluster=" << c1
<< " ptr=" << c2
<< " amount=" << r
<< std::endl
;
41 std::cerr
<< buf
<< std::endl
;
43 if(!strcmp(argv
[2], "write")) {
44 std::istringstream
s1(argv
[3]);
45 std::istringstream
s2(argv
[4]);
46 uint32_t c1
, c2
, c4
, c5
;
49 x
.write_data(c1
, c2
, argv
[5], strlen(argv
[5]), c4
, c5
);
50 std::cerr
<< "Write_data: cluster=" << c1
<< " ptr=" << c2
<< " rcluster=" << c4
51 << " rptr=" << c5
<< std::endl
;