diff options
Diffstat (limited to 'src/tests/myriadfs.cpp')
-rw-r--r-- | src/tests/myriadfs.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/tests/myriadfs.cpp b/src/tests/myriadfs.cpp index f57f02d..cb6c6c3 100644 --- a/src/tests/myriadfs.cpp +++ b/src/tests/myriadfs.cpp | |||
@@ -8,41 +8,41 @@ using namespace Bu; | |||
8 | 8 | ||
9 | int main() | 9 | int main() |
10 | { | 10 | { |
11 | // Bu::MemBuf mb; | 11 | // Bu::MemBuf mb; |
12 | Bu::File mb("store.myr", File::Read|File::Write|File::Create ); | 12 | Bu::File mb("store.myr", File::Read|File::Write|File::Create ); |
13 | Bu::MyriadFs mfs( mb, 512 ); | 13 | Bu::MyriadFs mfs( mb, 512 ); |
14 | 14 | ||
15 | sio << "Creating dirs..." << sio.nl; | 15 | sio << "Creating dirs..." << sio.nl; |
16 | mfs.create("/etc", Bu::MyriadFs::typeDir|0755 ); | 16 | mfs.create("/etc", Bu::MyriadFs::typeDir|0755 ); |
17 | mfs.create("/dev", Bu::MyriadFs::typeDir|0755 ); | 17 | mfs.create("/dev", Bu::MyriadFs::typeDir|0755 ); |
18 | mfs.create("/usr", Bu::MyriadFs::typeDir|0755 ); | 18 | mfs.create("/usr", Bu::MyriadFs::typeDir|0755 ); |
19 | 19 | ||
20 | mfs.create("/dev/null", Bu::MyriadFs::typeChrDev|0666, 1, 3 ); | 20 | mfs.create("/dev/null", Bu::MyriadFs::typeChrDev|0666, 1, 3 ); |
21 | mfs.create("/dev/zero", Bu::MyriadFs::typeChrDev|0666, 1, 5 ); | 21 | mfs.create("/dev/zero", Bu::MyriadFs::typeChrDev|0666, 1, 5 ); |
22 | mfs.create("/dev/sda", Bu::MyriadFs::typeBlkDev|0660, 8, 0 ); | 22 | mfs.create("/dev/sda", Bu::MyriadFs::typeBlkDev|0660, 8, 0 ); |
23 | 23 | ||
24 | sio << "Creating files..." << sio.nl; | 24 | sio << "Creating files..." << sio.nl; |
25 | { | 25 | { |
26 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); | 26 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); |
27 | ms.write("world!"); | 27 | ms.write("world!"); |
28 | } | 28 | } |
29 | { | 29 | { |
30 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); | 30 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); |
31 | ms.write("world, again!"); | 31 | ms.write("world, again!"); |
32 | } | 32 | } |
33 | 33 | ||
34 | sio << "Reading files..." << sio.nl; | 34 | sio << "Reading files..." << sio.nl; |
35 | { | 35 | { |
36 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); | 36 | Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); |
37 | char buf[512]; | 37 | char buf[512]; |
38 | buf[ms.read( buf, 512 )] = '\0'; | 38 | buf[ms.read( buf, 512 )] = '\0'; |
39 | sio << "read: '" << buf << "'" << sio.nl; | 39 | sio << "read: '" << buf << "'" << sio.nl; |
40 | } | 40 | } |
41 | { | 41 | { |
42 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); | 42 | Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); |
43 | char buf[512]; | 43 | char buf[512]; |
44 | buf[ms.read( buf, 512 )] = '\0'; | 44 | buf[ms.read( buf, 512 )] = '\0'; |
45 | sio << "read: '" << buf << "'" << sio.nl; | 45 | sio << "read: '" << buf << "'" << sio.nl; |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||