From 26bb069c535e3fd5b0e0fb28fb54a2a540b60a84 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 18 Feb 2011 17:41:24 +0000 Subject: Some Uuid tweaks, not much, just figuring out the format. MyriadFs is coming along quite nicely. It looks like it works great for normal programs, but there need to be some tweaks made to a few things before it's working 100% via fuse. Also, the fuse module won't let you specify a file, a little odd. --- src/tests/myriadfs.cpp | 24 +++++++++++++++++++++++- src/tests/uuid.cpp | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'src/tests') diff --git a/src/tests/myriadfs.cpp b/src/tests/myriadfs.cpp index fd96c02..5946b27 100644 --- a/src/tests/myriadfs.cpp +++ b/src/tests/myriadfs.cpp @@ -8,19 +8,41 @@ using namespace Bu; int main( int argc, char *argv[] ) { - Bu::MemBuf mb; +// Bu::MemBuf mb; + Bu::File mb("store.myr", File::Read|File::Write|File::Create ); Bu::MyriadFs mfs( mb, 512 ); + sio << "Creating dirs..." << sio.nl; + mfs.create("/etc", Bu::MyriadFs::typeDir|0755 ); + mfs.create("/dev", Bu::MyriadFs::typeDir|0755 ); + mfs.create("/usr", Bu::MyriadFs::typeDir|0755 ); + + mfs.create("/dev/null", Bu::MyriadFs::typeChrDev|0666, 1, 3 ); + mfs.create("/dev/zero", Bu::MyriadFs::typeChrDev|0666, 1, 5 ); + mfs.create("/dev/sda", Bu::MyriadFs::typeBlkDev|0660, 8, 0 ); + + sio << "Creating files..." << sio.nl; { Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); ms.write("world!"); } + { + Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); + ms.write("world, again!"); + } + sio << "Reading files..." << sio.nl; { Bu::MyriadStream ms = mfs.open("/hello", Bu::MyriadFs::Read ); char buf[512]; buf[ms.read( buf, 512 )] = '\0'; sio << "read: '" << buf << "'" << sio.nl; } + { + Bu::MyriadStream ms = mfs.open("/etc/hello", Bu::MyriadFs::Read ); + char buf[512]; + buf[ms.read( buf, 512 )] = '\0'; + sio << "read: '" << buf << "'" << sio.nl; + } } diff --git a/src/tests/uuid.cpp b/src/tests/uuid.cpp index b6470fa..d2f67b1 100644 --- a/src/tests/uuid.cpp +++ b/src/tests/uuid.cpp @@ -15,6 +15,7 @@ int main() Uuid i = Uuid::gen(); sio << i.toString() << sio.nl; + sio << "Version: " << i.getVersion() << sio.nl; return 0; } -- cgit v1.2.3