diff options
author | Mike Buland <mbuland@penny-arcade.com> | 2018-12-11 10:26:26 -0800 |
---|---|---|
committer | Mike Buland <mbuland@penny-arcade.com> | 2018-12-11 10:26:26 -0800 |
commit | 3f67108249b5c4f97841beee18fdd761919fe754 (patch) | |
tree | 81afeb5975690e63f99f2eba7f0abb0d91341152 /src | |
parent | 0cf743be2d6b351b1c09d240aa7a20443c8026ed (diff) | |
download | libbu++-3f67108249b5c4f97841beee18fdd761919fe754.tar.gz libbu++-3f67108249b5c4f97841beee18fdd761919fe754.tar.bz2 libbu++-3f67108249b5c4f97841beee18fdd761919fe754.tar.xz libbu++-3f67108249b5c4f97841beee18fdd761919fe754.zip |
Fixed MyriadFS path exists error.
Also started some FS related thread safety.
Diffstat (limited to '')
-rw-r--r-- | src/unstable/myriadfs.cpp | 7 | ||||
-rw-r--r-- | src/unstable/myriadfs.h | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/unstable/myriadfs.cpp b/src/unstable/myriadfs.cpp index cbc9e27..673956e 100644 --- a/src/unstable/myriadfs.cpp +++ b/src/unstable/myriadfs.cpp | |||
@@ -165,8 +165,6 @@ void Bu::MyriadFs::create( const Bu::String &sPath, uint16_t iPerms, | |||
165 | { | 165 | { |
166 | iNode = lookupInode( sPath, iParent ); | 166 | iNode = lookupInode( sPath, iParent ); |
167 | sio << "File found." << sio.nl; | 167 | sio << "File found." << sio.nl; |
168 | // The file was found | ||
169 | throw Bu::MyriadFsException("Path already exists."); | ||
170 | } | 168 | } |
171 | catch( Bu::MyriadFsException &e ) | 169 | catch( Bu::MyriadFsException &e ) |
172 | { | 170 | { |
@@ -185,6 +183,8 @@ void Bu::MyriadFs::create( const Bu::String &sPath, uint16_t iPerms, | |||
185 | iNode = create( iParent, sName, iPerms, uSpecial ); | 183 | iNode = create( iParent, sName, iPerms, uSpecial ); |
186 | sio << "New iNode: " << iNode << sio.nl; | 184 | sio << "New iNode: " << iNode << sio.nl; |
187 | } | 185 | } |
186 | // The file was found | ||
187 | //throw Bu::MyriadFsException("Path already exists."); | ||
188 | } | 188 | } |
189 | 189 | ||
190 | void Bu::MyriadFs::mkDir( const Bu::String &sPath, uint16_t iPerms ) | 190 | void Bu::MyriadFs::mkDir( const Bu::String &sPath, uint16_t iPerms ) |
@@ -200,7 +200,6 @@ void Bu::MyriadFs::mkSymLink( const Bu::String &sTarget, | |||
200 | try | 200 | try |
201 | { | 201 | { |
202 | iNode = lookupInode( sPath, iParent ); | 202 | iNode = lookupInode( sPath, iParent ); |
203 | throw Bu::MyriadFsException("Path already exists."); | ||
204 | } | 203 | } |
205 | catch( Bu::MyriadFsException &e ) | 204 | catch( Bu::MyriadFsException &e ) |
206 | { | 205 | { |
@@ -220,7 +219,9 @@ void Bu::MyriadFs::mkSymLink( const Bu::String &sTarget, | |||
220 | sio << "New iNode: " << iNode << sio.nl; | 219 | sio << "New iNode: " << iNode << sio.nl; |
221 | MyriadStream ms = openByInode( iNode ); | 220 | MyriadStream ms = openByInode( iNode ); |
222 | ms.write( sTarget ); | 221 | ms.write( sTarget ); |
222 | return; | ||
223 | } | 223 | } |
224 | throw Bu::MyriadFsException("Path already exists."); | ||
224 | } | 225 | } |
225 | 226 | ||
226 | void Bu::MyriadFs::mkHardLink( const Bu::String &sTarget, | 227 | void Bu::MyriadFs::mkHardLink( const Bu::String &sTarget, |
diff --git a/src/unstable/myriadfs.h b/src/unstable/myriadfs.h index f9faf9a..5a79c39 100644 --- a/src/unstable/myriadfs.h +++ b/src/unstable/myriadfs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <sys/types.h> | 11 | #include <sys/types.h> |
12 | 12 | ||
13 | #include "bu/myriad.h" | 13 | #include "bu/myriad.h" |
14 | #include "bu/readwritemutex.h" | ||
14 | 15 | ||
15 | namespace Bu | 16 | namespace Bu |
16 | { | 17 | { |
@@ -194,6 +195,7 @@ namespace Bu | |||
194 | private: | 195 | private: |
195 | Bu::Stream &rStore; | 196 | Bu::Stream &rStore; |
196 | Bu::Myriad mStore; | 197 | Bu::Myriad mStore; |
198 | Bu::ReadWriteMutex mNodeIndex; | ||
197 | NodeIndex hNodeIndex; | 199 | NodeIndex hNodeIndex; |
198 | int32_t iUser; | 200 | int32_t iUser; |
199 | int32_t iGroup; | 201 | int32_t iGroup; |