From 6403224b6fe50dfc28d3c25725b6d0910b7eb6c3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 3 Oct 2024 11:28:44 -0700 Subject: Minor tweaks/additions. Now to fix MyriadFs --- src/unstable/myriadcache.h | 4 ++-- src/unstable/myriadfs.cpp | 19 +++++-------------- src/unstable/myriadfs.h | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) (limited to 'src/unstable') diff --git a/src/unstable/myriadcache.h b/src/unstable/myriadcache.h index d6842a5..f71f9b5 100644 --- a/src/unstable/myriadcache.h +++ b/src/unstable/myriadcache.h @@ -86,8 +86,8 @@ namespace Bu { Bu::ReadWriteMutex::WriteLocker wl( rwStore ); { - Bu::MyriadStream ms = mStore.create( Bu::Myriad::Create ); - hIndex.insert( o->getKey(), ms.getId() ); + Bu::Myriad::StreamId id = mStore.allocate(); + hIndex.insert( o->getKey(), id ); } _save( o ); diff --git a/src/unstable/myriadfs.cpp b/src/unstable/myriadfs.cpp index 2eda0be..a2386c2 100644 --- a/src/unstable/myriadfs.cpp +++ b/src/unstable/myriadfs.cpp @@ -8,6 +8,7 @@ #include "bu/config.h" #include "bu/myriadfs.h" #include "bu/myriadstream.h" +#include "bu/mutexlocker.h" #include #include @@ -572,27 +573,17 @@ int32_t Bu::MyriadFs::allocInode( uint16_t uPerms, uint32_t uSpecial ) { case typeRegFile: case typeSymLink: - { - Bu::MyriadStream ms = mStore.create( - Bu::Myriad::Read - ); - rs.uStreamIndex = ms.getId(); - } + rs.uStreamIndex = mStore.allocate(); break; case typeDir: - { - Bu::MyriadStream ms = mStore.create( - Bu::Myriad::Read - ); - rs.uStreamIndex = ms.getId(); - } // sio << "Creating directory node, storage: " // << rs.uStreamIndex << sio.nl; { - Bu::MyriadStream msDir = mStore.open( - rs.uStreamIndex, Bu::Myriad::Write + Bu::MyriadStream msDir = mStore.create( + Bu::Myriad::Write ); + rs.uStreamIndex = msDir.getId(); uint32_t uSize = 0; msDir.write( &uSize, 4 ); } diff --git a/src/unstable/myriadfs.h b/src/unstable/myriadfs.h index eccac65..4e1749e 100644 --- a/src/unstable/myriadfs.h +++ b/src/unstable/myriadfs.h @@ -11,7 +11,7 @@ #include #include "bu/myriad.h" -#include "bu/readwritemutex.h" +#include "bu/mutex.h" namespace Bu { @@ -195,7 +195,7 @@ namespace Bu private: Bu::Stream &rStore; Bu::Myriad mStore; - Bu::ReadWriteMutex mNodeIndex; + Bu::Mutex mAccess; NodeIndex hNodeIndex; int32_t iUser; int32_t iGroup; -- cgit v1.2.3