hrev52265 adds 4 changesets to branch 'master'
old head: de66924c46fcd4f3cd4d99852561387e98db19bf
new head: a41d815c671e5dc7ac0793f640204a7f98c4debb
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=a41d815c671e+%5Ede66924c46fc
----------------------------------------------------------------------------
e0d28cdccfa1: reiserfs: Fix the build and enable on x86_64.
47b079afc914: Debug.h: Implement a real STATIC_ASSERT on non-GCC2.
c7919fc71af6: packagefs: Move DebugSupport up into the file_systems shared
folder.
ramfs will find it useful also.
a41d815c671e: ramfs: Lots of fixes to the build.
* Store pointers in an addr_t instead of int32, for 64-bit's sake
* Use DebugSupport.h instead of userlandfs Debug.h and remove extra
parentheses
* Create a header-only String class based on the userlandfs String and use it
* RecursiveLock instead of Locker.
* Jamfile cleanups and other misc. changes.
It isn't yet adapted to the new VFS API, so the build is still somewhat
broken.
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
34 files changed, 374 insertions(+), 169 deletions(-)
build/jam/ArchitectureRules | 2 +-
build/jam/images/definitions/minimum | 2 +-
headers/os/support/Debug.h | 22 +-
.../private/file_systems}/DebugSupport.h | 2 +-
headers/private/kernel/debug.h | 18 +-
.../kernel/file_systems/packagefs/Jamfile | 4 +-
.../kernel/file_systems/ramfs/AllocationInfo.cpp | 2 +-
.../kernel/file_systems/ramfs/AreaUtils.cpp | 10 +-
.../file_systems/ramfs/AttributeIndexImpl.cpp | 10 +-
.../kernel/file_systems/ramfs/BlockAllocator.cpp | 12 +-
.../kernel/file_systems/ramfs/BlockAllocator.h | 2 +-
.../file_systems/ramfs/BlockAllocatorArea.cpp | 86 ++++----
.../ramfs/BlockAllocatorAreaBucket.cpp | 8 +-
.../ramfs/BlockAllocatorAreaBucket.h | 2 +-
.../file_systems/ramfs/BlockReferenceManager.cpp | 10 +-
.../kernel/file_systems/ramfs/DataContainer.cpp | 4 +-
.../kernel/file_systems/ramfs/Directory.cpp | 6 +-
src/add-ons/kernel/file_systems/ramfs/Entry.cpp | 2 +-
src/add-ons/kernel/file_systems/ramfs/Index.cpp | 2 +-
.../kernel/file_systems/ramfs/IndexDirectory.cpp | 2 +-
src/add-ons/kernel/file_systems/ramfs/Jamfile | 70 +++----
.../file_systems/ramfs/LastModifiedIndex.cpp | 2 +-
.../kernel/file_systems/ramfs/NameIndex.cpp | 2 +-
src/add-ons/kernel/file_systems/ramfs/Node.cpp | 2 +-
.../kernel/file_systems/ramfs/NodeChildTable.h | 2 +-
.../kernel/file_systems/ramfs/NodeTable.cpp | 2 +-
src/add-ons/kernel/file_systems/ramfs/Query.cpp | 8 +-
src/add-ons/kernel/file_systems/ramfs/String.h | 203 +++++++++++++++++++
.../kernel/file_systems/ramfs/SymLink.cpp | 2 +-
src/add-ons/kernel/file_systems/ramfs/Volume.cpp | 8 +-
src/add-ons/kernel/file_systems/ramfs/Volume.h | 8 +-
.../file_systems/ramfs/kernel_interface.cpp | 18 +-
.../kernel/file_systems/reiserfs/Iterators.cpp | 8 +-
.../{packagefs/util => shared}/DebugSupport.cpp | 0
############################################################################
Commit: e0d28cdccfa1c3a26bd67b59c9cbe42b3a18cf99
URL: https://git.haiku-os.org/haiku/commit/?id=e0d28cdccfa1
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Wed Aug 22 04:03:43 2018 UTC
reiserfs: Fix the build and enable on x86_64.
----------------------------------------------------------------------------
diff --git a/build/jam/images/definitions/minimum
b/build/jam/images/definitions/minimum
index 7cdf2bda93..88999a1fb1 100644
--- a/build/jam/images/definitions/minimum
+++ b/build/jam/images/definitions/minimum
@@ -235,7 +235,7 @@ SYSTEM_ADD_ONS_FILE_SYSTEMS =
log_overlay
ntfs
packagefs
- reiserfs@x86
+ reiserfs
udf
write_overlay
;
diff --git a/src/add-ons/kernel/file_systems/reiserfs/Iterators.cpp
b/src/add-ons/kernel/file_systems/reiserfs/Iterators.cpp
index 78093cefdd..25010b4bee 100644
--- a/src/add-ons/kernel/file_systems/reiserfs/Iterators.cpp
+++ b/src/add-ons/kernel/file_systems/reiserfs/Iterators.cpp
@@ -1336,8 +1336,8 @@ StreamReader::ReadAt(off_t position, void *buffer, size_t
bufferSize,
&& (error = _SeekTo(position)) == B_OK) {
//PRINT((" seeked to %Ld: fItemOffset: %Ld, fItemSize: %Ld\n", position,
//fItemOffset, fItemSize));
- off_t inItemOffset = max(0LL, position - fItemOffset);
- off_t toRead = min(fItemSize - inItemOffset,
(off_t)bufferSize);
+ off_t inItemOffset = max_c(0LL, position - fItemOffset);
+ off_t toRead = min_c(fItemSize - inItemOffset,
(off_t)bufferSize);
switch (fItem.GetType()) {
case TYPE_INDIRECT:
error = _ReadIndirectItem(inItemOffset,
buffer, toRead);
@@ -1520,8 +1520,8 @@ StreamReader::_ReadIndirectItem(off_t offset, void
*buffer, size_t bufferSize)
if (error == B_OK) {
// copy the data into the buffer
off_t blockOffset = i * (off_t)fBlockSize;
- uint32 localOffset = max(0LL, offset - blockOffset);
- uint32 toRead = min(fBlockSize - localOffset,
bufferSize);
+ uint32 localOffset = max_c(0LL, offset - blockOffset);
+ uint32 toRead = min_c(fBlockSize - localOffset,
bufferSize);
memcpy(buffer, (uint8*)block->GetData() + localOffset,
toRead);
block->Put();
bufferSize -= toRead;
############################################################################
Commit: 47b079afc91467a64937c24590bc6c9acb579f13
URL: https://git.haiku-os.org/haiku/commit/?id=47b079afc914
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Wed Aug 22 04:32:30 2018 UTC
Debug.h: Implement a real STATIC_ASSERT on non-GCC2.
----------------------------------------------------------------------------
diff --git a/headers/os/support/Debug.h b/headers/os/support/Debug.h
index 9cc39fd8c9..cc701cab73 100644
--- a/headers/os/support/Debug.h
+++ b/headers/os/support/Debug.h
@@ -63,7 +63,7 @@ extern "C" {
#define ASSERT_WITH_MESSAGE(expr, msg) \
(!(expr) ?
_debuggerAssert( __FILE__,__LINE__, msg) \
-
: (int)0)
+
: (int)0)
#define TRESPASS() DEBUGGER("Should not be here");
@@ -72,7 +72,7 @@ extern "C" {
#else /* DEBUG == 0 */
#define SET_DEBUG_ENABLED(FLAG) (void)0
#define IS_DEBUG_ENABLED() (void)0
-
+
#define SERIAL_PRINT(ARGS) (void)0
#define PRINT(ARGS) (void)0
#define PRINT_OBJECT(OBJ) (void)0
@@ -90,12 +90,18 @@ extern "C" {
/* STATIC_ASSERT is a compile-time check that can be used to */
/* verify static expressions such as: STATIC_ASSERT(sizeof(int64) == 8); */
-#define STATIC_ASSERT(x)
\
- do {
\
- struct __staticAssertStruct__ {
\
- char __static_assert_failed__[2*(x) - 1]; \
- };
\
- } while (false)
+#if __GNUC__ >= 5 && !defined(__cplusplus)
+# define STATIC_ASSERT(x) _Static_assert(x, "static assert failed!")
+#elif defined(__cplusplus) && __cplusplus >= 201103L
+# define STATIC_ASSERT(x) static_assert(x, "static assert failed!")
+#else
+# define STATIC_ASSERT(x)
\
+ do {
\
+ struct __staticAssertStruct__ {
\
+ char __static_assert_failed__[2*(x) - 1];
\
+ };
\
+ } while (false)
+#endif
#endif /* _DEBUG_H */
diff --git a/headers/private/kernel/debug.h b/headers/private/kernel/debug.h
index 45332e4dbd..c8037ca8ee 100644
--- a/headers/private/kernel/debug.h
+++ b/headers/private/kernel/debug.h
@@ -69,12 +69,18 @@
# define ASSERT_PRINT(x, format, args...) do { } while(0)
#endif
-#define STATIC_ASSERT(x)
\
- do {
\
- struct __staticAssertStruct__ {
\
- char __static_assert_failed__[2*(x) - 1]; \
- };
\
- } while (false)
+#if __GNUC__ >= 5 && !defined(__cplusplus)
+# define STATIC_ASSERT(x) _Static_assert(x, "static assert failed!")
+#elif defined(__cplusplus) && __cplusplus >= 201103L
+# define STATIC_ASSERT(x) static_assert(x, "static assert failed!")
+#else
+# define STATIC_ASSERT(x)
\
+ do {
\
+ struct __staticAssertStruct__ {
\
+ char __static_assert_failed__[2*(x) - 1];
\
+ };
\
+ } while (false)
+#endif
#if KDEBUG
# define KDEBUG_ONLY(x) x
############################################################################
Commit: c7919fc71af6a1ff599bcb5791ca95f30da88a68
URL: https://git.haiku-os.org/haiku/commit/?id=c7919fc71af6
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Wed Aug 22 04:39:19 2018 UTC
packagefs: Move DebugSupport up into the file_systems shared folder.
ramfs will find it useful also.
----------------------------------------------------------------------------
diff --git a/src/add-ons/kernel/file_systems/packagefs/util/DebugSupport.h
b/headers/private/file_systems/DebugSupport.h
similarity index 99%
rename from src/add-ons/kernel/file_systems/packagefs/util/DebugSupport.h
rename to headers/private/file_systems/DebugSupport.h
index c85816fc3e..8e7626e681 100644
--- a/src/add-ons/kernel/file_systems/packagefs/util/DebugSupport.h
+++ b/headers/private/file_systems/DebugSupport.h
@@ -32,7 +32,7 @@
# define DEBUG_PRINT 0
#endif
#ifndef DEBUG_APP
-# define DEBUG_APP "packagefs"
+# define DEBUG_APP "unknown"
#endif
#ifndef DEBUG_PRINT_FILE
# define DEBUG_PRINT_FILE "/var/log/" DEBUG_APP ".log"
diff --git a/src/add-ons/kernel/file_systems/packagefs/Jamfile
b/src/add-ons/kernel/file_systems/packagefs/Jamfile
index 5a31abff21..b6153ded35 100644
--- a/src/add-ons/kernel/file_systems/packagefs/Jamfile
+++ b/src/add-ons/kernel/file_systems/packagefs/Jamfile
@@ -3,7 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel file_systems packagefs ;
UseBuildFeatureHeaders zlib ;
UsePrivateKernelHeaders ;
-UsePrivateHeaders package shared storage support ;
+UsePrivateHeaders package shared storage support file_systems ;
local zstdSources ;
local zstdKernelLib ;
@@ -37,7 +37,6 @@ HAIKU_PACKAGE_FS_SOURCES =
AutoPackageAttributes.cpp
BlockBufferPoolKernel.cpp
CachedDataReader.cpp
- DebugSupport.cpp
Dependency.cpp
Directory.cpp
EmptyAttributeDirectoryCookie.cpp
@@ -82,6 +81,7 @@ HAIKU_PACKAGE_FS_SOURCES =
HAIKU_PACKAGE_FS_SHARED_SOURCES =
QueryParserUtils.cpp
+ DebugSupport.cpp
;
HAIKU_PACKAGE_FS_PACKAGE_READER_SOURCES =
diff --git a/src/add-ons/kernel/file_systems/packagefs/util/DebugSupport.cpp
b/src/add-ons/kernel/file_systems/shared/DebugSupport.cpp
similarity index 100%
rename from src/add-ons/kernel/file_systems/packagefs/util/DebugSupport.cpp
rename to src/add-ons/kernel/file_systems/shared/DebugSupport.cpp
############################################################################
Revision: hrev52265
Commit: a41d815c671e5dc7ac0793f640204a7f98c4debb
URL: https://git.haiku-os.org/haiku/commit/?id=a41d815c671e
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Wed Aug 22 23:16:09 2018 UTC
ramfs: Lots of fixes to the build.
* Store pointers in an addr_t instead of int32, for 64-bit's sake
* Use DebugSupport.h instead of userlandfs Debug.h and remove extra parentheses
* Create a header-only String class based on the userlandfs String and use it
* RecursiveLock instead of Locker.
* Jamfile cleanups and other misc. changes.
It isn't yet adapted to the new VFS API, so the build is still somewhat
broken.
----------------------------------------------------------------------------
diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 5afcefce30..07bd79e646 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -570,7 +570,7 @@ rule ArchitectureSetupWarnings architecture
EnableWerror src add-ons kernel file_systems nfs4 ;
# EnableWerror src add-ons kernel file_systems ntfs ;
EnableWerror src add-ons kernel file_systems packagefs ;
- EnableWerror src add-ons kernel file_systems ramfs ;
+# EnableWerror src add-ons kernel file_systems ramfs ;
# EnableWerror src add-ons kernel file_systems reiserfs ;
EnableWerror src add-ons kernel file_systems udf ;
EnableWerror src add-ons kernel file_systems userlandfs ;
diff --git a/src/add-ons/kernel/file_systems/ramfs/AllocationInfo.cpp
b/src/add-ons/kernel/file_systems/ramfs/AllocationInfo.cpp
index 7665fafdfa..a5ca653ed9 100644
--- a/src/add-ons/kernel/file_systems/ramfs/AllocationInfo.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/AllocationInfo.cpp
@@ -1,7 +1,7 @@
// AllocationInfo.cpp
#include "AllocationInfo.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Attribute.h"
#include "Directory.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/AreaUtils.cpp
b/src/add-ons/kernel/file_systems/ramfs/AreaUtils.cpp
index 5c95dda09b..7ae34547fc 100644
--- a/src/add-ons/kernel/file_systems/ramfs/AreaUtils.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/AreaUtils.cpp
@@ -28,7 +28,7 @@
#include <OS.h>
#include "AreaUtils.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Misc.h"
#ifndef USE_STANDARD_FUNCTIONS
@@ -79,8 +79,8 @@ AreaUtils::free(void *ptr)
// everything is fine, delete the area
delete_area(info.area);
} else {
- INFORM(("WARNING: AreaUtils::free(%p): area
begin is %p."
- "Ignored.\n", ptr,
info.address));
+ INFORM("WARNING: AreaUtils::free(%p): area
begin is %p."
+ "Ignored.\n", ptr,
info.address);
}
}
}
@@ -149,8 +149,8 @@ AreaUtils::realloc(void * ptr, size_t size)
}
}
} else {
- INFORM(("WARNING: AreaUtils::realloc(%p): area
begin is %p."
- "Ignored.\n", ptr,
info.address));
+ INFORM("WARNING: AreaUtils::realloc(%p): area
begin is %p."
+ "Ignored.\n", ptr,
info.address);
}
}
}
diff --git a/src/add-ons/kernel/file_systems/ramfs/AttributeIndexImpl.cpp
b/src/add-ons/kernel/file_systems/ramfs/AttributeIndexImpl.cpp
index 01844e7ce8..22730ef8bc 100644
--- a/src/add-ons/kernel/file_systems/ramfs/AttributeIndexImpl.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/AttributeIndexImpl.cpp
@@ -3,7 +3,7 @@
#include <TypeConstants.h>
#include "AttributeIndexImpl.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Entry.h"
#include "EntryListener.h"
#include "IndexImpl.h"
@@ -377,16 +377,16 @@ AttributeIndexImpl::Iterator::GetCurrent(uint8 *buffer,
size_t *keyLength)
if ((*attribute)->GetNode() == entry->GetNode()) {
(*attribute)->GetKey(buffer, keyLength);
} else {
- FATAL(("Node of current attribute and node of
current entry "
+ FATAL("Node of current attribute and node of
current entry "
"differ: %Ld vs. %Ld\n",
(*attribute)->GetNode()->GetID(),
- entry->GetNode()->GetID()));
+ entry->GetNode()->GetID());
entry = NULL;
}
} else {
- FATAL(("We have a current entry (`%s', node: %Ld), but
no current "
+ FATAL("We have a current entry (`%s', node: %Ld), but
no current "
"attribute.\n", entry->GetName(),
- entry->GetNode()->GetID()));
+ entry->GetNode()->GetID());
entry = NULL;
}
}
diff --git a/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.cpp
b/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.cpp
index d7b015a5d4..38aaf639f7 100644
--- a/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.cpp
@@ -7,7 +7,7 @@
#include "BlockAllocator.h"
#include "BlockAllocatorArea.h"
#include "BlockAllocatorAreaBucket.h"
-#include "Debug.h"
+#include "DebugSupport.h"
// BlockAllocator
@@ -175,15 +175,15 @@ BlockAllocator::SanityCheck(bool deep) const
}
// area count
if (areaCount != fAreaCount) {
- FATAL(("fAreaCount is %ld, but should be %ld\n", fAreaCount,
- areaCount));
+ FATAL("fAreaCount is %ld, but should be %ld\n", fAreaCount,
+ areaCount);
BA_PANIC("BlockAllocator: Bad free bytes.");
return false;
}
// free bytes
if (fFreeBytes != freeBytes) {
- FATAL(("fFreeBytes is %lu, but should be %lu\n", fFreeBytes,
- freeBytes));
+ FATAL("fFreeBytes is %lu, but should be %lu\n", fFreeBytes,
+ freeBytes);
BA_PANIC("BlockAllocator: Bad free bytes.");
return false;
}
@@ -203,7 +203,7 @@ BlockAllocator::CheckArea(Area *checkArea)
return true;
}
}
- FATAL(("Area %p is not a valid Area!\n", checkArea));
+ FATAL("Area %p is not a valid Area!\n", checkArea);
BA_PANIC("Invalid Area.");
return false;
}
diff --git a/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.h
b/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.h
index 6cb793f79f..703a430a4e 100644
--- a/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.h
+++ b/src/add-ons/kernel/file_systems/ramfs/BlockAllocator.h
@@ -7,7 +7,7 @@
#include "Block.h"
#include "BlockReferenceManager.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "List.h"
#define ENABLE_BA_PANIC 1
diff --git a/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorArea.cpp
b/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorArea.cpp
index 98daa2e0e5..5bf3baba2f 100644
--- a/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorArea.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorArea.cpp
@@ -1,7 +1,7 @@
// BlockAllocatorArea.cpp
#include "BlockAllocatorArea.h"
-#include "Debug.h"
+#include "DebugSupport.h"
// constructor
BlockAllocator::Area::Area(area_id id, size_t size)
@@ -58,8 +58,8 @@ Block *
BlockAllocator::Area::AllocateBlock(size_t usableSize, bool dontDefragment)
{
if (kMinBlockSize != block_align_ceil(sizeof(TFreeBlock))) {
-FATAL(("kMinBlockSize is not correctly initialized! Is %lu, but should be: "
-"%lu\n", kMinBlockSize, block_align_ceil(sizeof(TFreeBlock))));
+FATAL("kMinBlockSize is not correctly initialized! Is %lu, but should be: "
+"%lu\n", kMinBlockSize, block_align_ceil(sizeof(TFreeBlock)));
BA_PANIC("kMinBlockSize not correctly initialized.");
return NULL;
}
@@ -80,9 +80,9 @@ return NULL;
// Our data structures seem to be corrupted,
since
// _GetBlockFreeBytes() promised that we would
have enough
// free space.
- FATAL(("Couldn't find free block of min size
%lu after "
+ FATAL("Couldn't find free block of min size %lu
after "
"defragmenting, although we should
have %lu usable free "
- "bytes!\n", size,
_GetBlockFreeBytes()));
+ "bytes!\n", size,
_GetBlockFreeBytes());
BA_PANIC("Bad area free bytes.");
}
}
@@ -247,22 +247,22 @@ BlockAllocator::Area::SanityCheck() const
{
// area ID
if (fID < 0) {
- FATAL(("Area ID < 0: %lx\n", fID));
+ FATAL("Area ID < 0: %lx\n", fID);
BA_PANIC("Bad area ID.");
return false;
}
// size
size_t areaHeaderSize = block_align_ceil(sizeof(Area));
if (fSize < areaHeaderSize + sizeof(TFreeBlock)) {
- FATAL(("Area too small to contain area header and at least one
free "
- "block: %lu bytes\n", fSize));
+ FATAL("Area too small to contain area header and at least one
free "
+ "block: %lu bytes\n", fSize);
BA_PANIC("Bad area size.");
return false;
}
// free bytes
if (fFreeBytes > fSize) {
- FATAL(("Free size greater than area size: %lu vs %lu\n",
fFreeBytes,
- fSize));
+ FATAL("Free size greater than area size: %lu vs %lu\n",
fFreeBytes,
+ fSize);
BA_PANIC("Bad area free bytes.");
return false;
}
@@ -277,8 +277,8 @@ BlockAllocator::Area::SanityCheck() const
uint32 freeBlockCount = 0;
size_t freeBytes = 0;
if (!fFirstBlock || !fLastBlock) {
- FATAL(("Invalid block list: first or last block NULL: first:
%p, "
- "last: %p\n", fFirstBlock, fLastBlock));
+ FATAL("Invalid block list: first or last block NULL: first: %p,
"
+ "last: %p\n", fFirstBlock, fLastBlock);
BA_PANIC("Bad area block list.");
return false;
} else {
@@ -292,42 +292,42 @@ BlockAllocator::Area::SanityCheck() const
for (int32 i = 0; i < blockCount; i++) {
blockListOK = false;
if (!block) {
- FATAL(("Encountered NULL in block list at index
%ld, although "
- "list should have %ld blocks\n", i,
blockCount));
+ FATAL("Encountered NULL in block list at index
%ld, although "
+ "list should have %ld blocks\n", i,
blockCount);
BA_PANIC("Bad area block list.");
return false;
}
- uint64 address = (uint32)block;
+ uint64 address = (addr_t)block;
// block within area?
- if (address < (uint32)this + areaHeaderSize
- || address + sizeof(TFreeBlock) > (uint32)this
+ fSize) {
- FATAL(("Utterly mislocated block: %p, area: %p,
"
- "size: %lu\n", block, this, fSize));
+ if (address < (addr_t)this + areaHeaderSize
+ || address + sizeof(TFreeBlock) > (addr_t)this
+ fSize) {
+ FATAL("Utterly mislocated block: %p, area: %p, "
+ "size: %lu\n", block, this, fSize);
BA_PANIC("Bad area block.");
return false;
}
// block too large for area?
size_t blockSize = block->GetSize();
if (blockSize < sizeof(TFreeBlock)
- || address + blockSize > (uint32)this + fSize) {
- FATAL(("Mislocated block: %p, size: %lu, area:
%p, "
- "size: %lu\n", block, blockSize,
this, fSize));
+ || address + blockSize > (addr_t)this + fSize) {
+ FATAL("Mislocated block: %p, size: %lu, area:
%p, "
+ "size: %lu\n", block, blockSize,
this, fSize);
BA_PANIC("Bad area block.");
return false;
}
// alignment
if (block_align_floor(address) != address
|| block_align_floor(blockSize) != blockSize) {
- FATAL(("Block %ld not properly aligned: %p,
size: %lu\n",
- i, block, blockSize));
+ FATAL("Block %ld not properly aligned: %p,
size: %lu\n",
+ i, block, blockSize);
BA_PANIC("Bad area block.");
return false;
}
// previous block
if (block->GetPreviousBlock() != prevBlock) {
- FATAL(("Previous block of block %ld was not the
previous "
+ FATAL("Previous block of block %ld was not the
previous "
"block in list: %p vs %p\n", i,
- block->GetPreviousBlock(),
prevBlock));
+ block->GetPreviousBlock(),
prevBlock);
BA_PANIC("Bad area block list.");
return false;
}
@@ -341,16 +341,16 @@ BlockAllocator::Area::SanityCheck() const
freeBytes += freeBlock->GetUsableSize();
// block == next free block of previous free
block
if (freeBlock != nextFree) {
- FATAL(("Free block %ld is not the next
block in free "
- "list: %p vs %p\n", i,
freeBlock, nextFree));
+ FATAL("Free block %ld is not the next
block in free "
+ "list: %p vs %p\n", i,
freeBlock, nextFree);
BA_PANIC("Bad area free list.");
return false;
}
// previous free block
if (freeBlock->GetPreviousFreeBlock() !=
prevFree) {
- FATAL(("Previous free block of block
%ld was not the "
+ FATAL("Previous free block of block %ld
was not the "
" previous block in free
list: %p vs %p\n", i,
-
freeBlock->GetPreviousFreeBlock(), prevFree));
+
freeBlock->GetPreviousFreeBlock(), prevFree);
BA_PANIC("Bad area free list.");
return false;
}
@@ -365,37 +365,37 @@ BlockAllocator::Area::SanityCheck() const
// final checks on block list
if (blockListOK) {
if (block) {
- FATAL(("More blocks in block list than
expected\n"));
+ FATAL("More blocks in block list than
expected\n");
BA_PANIC("Bad area block count.");
return false;
} else if (fLastBlock != prevBlock) {
- FATAL(("last block in block list was %p, but
should be "
- "%p\n", fLastBlock, prevBlock));
+ FATAL("last block in block list was %p, but
should be "
+ "%p\n", fLastBlock, prevBlock);
BA_PANIC("Bad area last block.");
return false;
} else if (prevFree != fLastFree) {
- FATAL(("last block in free list was %p, but
should be %p\n",
- fLastFree, prevFree));
+ FATAL("last block in free list was %p, but
should be %p\n",
+ fLastFree, prevFree);
BA_PANIC("Bad area last free block.");
return false;
}
// block counts (a bit reduntant)
if (freeBlockCount != fFreeBlockCount) {
- FATAL(("Free block count is %ld, but should be
%ld\n",
- fFreeBlockCount, freeBlockCount));
+ FATAL("Free block count is %ld, but should be
%ld\n",
+ fFreeBlockCount, freeBlockCount);
BA_PANIC("Bad area free block count.");
return false;
}
if (usedBlockCount != fUsedBlockCount) {
- FATAL(("Used block count is %ld, but should be
%ld\n",
- fUsedBlockCount, usedBlockCount));
+ FATAL("Used block count is %ld, but should be
%ld\n",
+ fUsedBlockCount, usedBlockCount);
BA_PANIC("Bad area used block count.");
return false;
}
// free bytes
if (fFreeBytes != freeBytes) {
- FATAL(("Free bytes is %lu, but should be %lu\n",
- fFreeBytes, freeBytes));
+ FATAL("Free bytes is %lu, but should be %lu\n",
+ fFreeBytes, freeBytes);
BA_PANIC("Bad area free bytes.");
return false;
}
@@ -412,7 +412,7 @@ BlockAllocator::Area::CheckBlock(Block *checkBlock, size_t
minSize)
if (block == checkBlock)
return (block->GetUsableSize() >= minSize);
}
- FATAL(("Block %p is not in area %p!\n", checkBlock, this));
+ FATAL("Block %p is not in area %p!\n", checkBlock, this);
BA_PANIC("Invalid Block.");
return false;
}
@@ -441,7 +441,7 @@ BlockAllocator::Area::_InsertFreeBlock(TFreeBlock *block)
for (nextFree = GetFirstFreeBlock();
nextFree;
nextFree = nextFree->GetNextFreeBlock()) {
- if ((uint32)nextFree > (uint32)block)
+ if ((addr_t)nextFree > (addr_t)block)
break;
}
// get the previous block and insert the block between the two
diff --git a/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.cpp
b/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.cpp
index 2fd04f7879..1adfb7828e 100644
--- a/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.cpp
@@ -32,16 +32,16 @@ BlockAllocator::AreaBucket::SanityCheck(bool deep) const
}
// bucket
if (area->GetBucket() != this) {
- FATAL(("Area %p is in bucket %p, but thinks it is in
bucket %p\n",
- area, this, area->GetBucket()));
+ FATAL("Area %p is in bucket %p, but thinks it is in
bucket %p\n",
+ area, this, area->GetBucket());
BA_PANIC("Wrong area bucket.");
return false;
}
// size
size_t areaSize = area->GetFreeBytes();
if (areaSize < fMinSize || areaSize >= fMaxSize) {
- FATAL(("Area is in wrong bucket: free: %lu, min: %lu,
max: %lu\n",
- areaSize, fMinSize, fMaxSize));
+ FATAL("Area is in wrong bucket: free: %lu, min: %lu,
max: %lu\n",
+ areaSize, fMinSize, fMaxSize);
BA_PANIC("Area in wrong bucket.");
return false;
}
diff --git a/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.h
b/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.h
index e010505266..fa2308c868 100644
--- a/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.h
+++ b/src/add-ons/kernel/file_systems/ramfs/BlockAllocatorAreaBucket.h
@@ -7,7 +7,7 @@
#include "BlockAllocator.h"
#include "BlockAllocatorArea.h"
-#include "Debug.h"
+#include "DebugSupport.h"
class BlockAllocator::AreaBucket {
diff --git a/src/add-ons/kernel/file_systems/ramfs/BlockReferenceManager.cpp
b/src/add-ons/kernel/file_systems/ramfs/BlockReferenceManager.cpp
index 99d170348f..ace924706c 100644
--- a/src/add-ons/kernel/file_systems/ramfs/BlockReferenceManager.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/BlockReferenceManager.cpp
@@ -4,7 +4,7 @@
#include "Block.h"
#include "BlockAllocator.h" // only for BA_PANIC
#include "BlockReferenceManager.h"
-#include "Debug.h"
+#include "DebugSupport.h"
static const int kBlockReferenceTableSize = 128;
@@ -49,17 +49,17 @@ bool
BlockReferenceManager::CheckReference(BlockReference *reference)
{
if (reference) {
- uint32 address = (uint32)reference;
+ uint32 address = (addr_t)reference;
int32 tableCount = fTables.CountItems();
for (int32 i = 0; i < tableCount; i++) {
Table *table = &fTables.ItemAt(i);
- uint32 first = (uint32)table->GetReferences();
- uint32 last = (uint32)(table->GetReferences() +
table->GetSize());
+ uint32 first = (addr_t)table->GetReferences();
+ uint32 last = (addr_t)(table->GetReferences() +
table->GetSize());
if (first <= address && address < last)
return true;
}
}
- FATAL(("BlockReference %p does not exist!\n", reference));
+ FATAL("BlockReference %p does not exist!\n", reference);
BA_PANIC("BlockReference doesn't exist.");
return false;
}
diff --git a/src/add-ons/kernel/file_systems/ramfs/DataContainer.cpp
b/src/add-ons/kernel/file_systems/ramfs/DataContainer.cpp
index 37e6f4d6ee..14e7e7628f 100644
--- a/src/add-ons/kernel/file_systems/ramfs/DataContainer.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/DataContainer.cpp
@@ -4,7 +4,7 @@
#include "Attribute.h" // for debugging only
#include "Block.h"
#include "DataContainer.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Misc.h"
#include "Node.h" // for debugging only
#include "Volume.h"
@@ -405,7 +405,7 @@ DataContainer::_SwitchToSmallBufferMode(size_t newSize)
// remove the first (and only) block
BlockList *blocks = _GetBlockList();
BlockReference *block = blocks->ItemAt(0);
- blocks->RemoveItem(0L);
+ blocks->RemoveItem((int32)0L);
// destroy the block list and copy the data into the small buffer
blocks->~BlockList();
if (newSize > 0)
diff --git a/src/add-ons/kernel/file_systems/ramfs/Directory.cpp
b/src/add-ons/kernel/file_systems/ramfs/Directory.cpp
index e5c0b68feb..6108ee6cad 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Directory.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/Directory.cpp
@@ -1,7 +1,7 @@
// Directory.cpp
#include "AllocationInfo.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Directory.h"
#include "Entry.h"
#include "EntryIterator.h"
@@ -231,8 +231,8 @@ Directory::DeleteEntry(Entry *entry)
if (error == B_OK)
delete entry;
else {
- FATAL(("Failed to Unlink() entry %p from node %Ld!\n",
entry,
- entry->GetNode()->GetID()));
+ FATAL("Failed to Unlink() entry %p from node %Ld!\n",
entry,
+ entry->GetNode()->GetID());
AddEntry(entry);
}
}
diff --git a/src/add-ons/kernel/file_systems/ramfs/Entry.cpp
b/src/add-ons/kernel/file_systems/ramfs/Entry.cpp
index f04a648271..37c0949d1c 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Entry.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/Entry.cpp
@@ -1,7 +1,7 @@
// Entry.cpp
#include "AllocationInfo.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Entry.h"
#include "EntryIterator.h"
#include "Node.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/Index.cpp
b/src/add-ons/kernel/file_systems/ramfs/Index.cpp
index 81bdd2234d..03d05a45e2 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Index.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/Index.cpp
@@ -1,6 +1,6 @@
// Index.cpp
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Directory.h"
#include "Entry.h"
#include "Index.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/IndexDirectory.cpp
b/src/add-ons/kernel/file_systems/ramfs/IndexDirectory.cpp
index 6cac79ef20..ecde6423d0 100644
--- a/src/add-ons/kernel/file_systems/ramfs/IndexDirectory.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/IndexDirectory.cpp
@@ -3,7 +3,7 @@
#include <TypeConstants.h>
#include "AttributeIndexImpl.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "IndexDirectory.h"
#include "LastModifiedIndex.h"
#include "NameIndex.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/Jamfile
b/src/add-ons/kernel/file_systems/ramfs/Jamfile
index 5cf9133c31..939866f791 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Jamfile
+++ b/src/add-ons/kernel/file_systems/ramfs/Jamfile
@@ -1,48 +1,38 @@
SubDir HAIKU_TOP src add-ons kernel file_systems ramfs ;
-local userlandFSTop = [ FDirName $(HAIKU_TOP) src add-ons kernel
- file_systems userlandfs ] ;
-local userlandFSIncludes = [ PrivateHeaders userlandfs ] ;
-
-UsePrivateHeaders shared ;
UsePrivateKernelHeaders ;
-
-SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ;
-
-SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ;
+UsePrivateHeaders file_systems ;
DEFINES += DEBUG_APP="\\\"ramfs\\\"" ;
KernelAddon ramfs
- : Debug.cpp
- String.cpp
-
- AllocationInfo.cpp
- AreaUtils.cpp
- Attribute.cpp
- AttributeIndex.cpp
- AttributeIndexImpl.cpp
- AttributeIterator.cpp
- BlockAllocator.cpp
- BlockAllocatorArea.cpp
- BlockAllocatorAreaBucket.cpp
- BlockReferenceManager.cpp
- DataContainer.cpp
- Directory.cpp
- Entry.cpp
- EntryIterator.cpp
- EntryListener.cpp
- File.cpp
- Index.cpp
- IndexDirectory.cpp
- kernel_interface.cpp
- LastModifiedIndex.cpp
- NameIndex.cpp
- Node.cpp
- NodeListener.cpp
- NodeTable.cpp
- Query.cpp
- SizeIndex.cpp
- SymLink.cpp
- Volume.cpp
+ :
+ AllocationInfo.cpp
+ AreaUtils.cpp
+ Attribute.cpp
+ AttributeIndex.cpp
+ AttributeIndexImpl.cpp
+ AttributeIterator.cpp
+ BlockAllocator.cpp
+ BlockAllocatorArea.cpp
+ BlockAllocatorAreaBucket.cpp
+ BlockReferenceManager.cpp
+ DataContainer.cpp
+ Directory.cpp
+ Entry.cpp
+ EntryIterator.cpp
+ EntryListener.cpp
+ File.cpp
+ Index.cpp
+ IndexDirectory.cpp
+ kernel_interface.cpp
+ LastModifiedIndex.cpp
+ NameIndex.cpp
+ Node.cpp
+ NodeListener.cpp
+ NodeTable.cpp
+ Query.cpp
+ SizeIndex.cpp
+ SymLink.cpp
+ Volume.cpp
;
diff --git a/src/add-ons/kernel/file_systems/ramfs/LastModifiedIndex.cpp
b/src/add-ons/kernel/file_systems/ramfs/LastModifiedIndex.cpp
index 21cd0b4d08..490781348c 100644
--- a/src/add-ons/kernel/file_systems/ramfs/LastModifiedIndex.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/LastModifiedIndex.cpp
@@ -2,7 +2,7 @@
#include <TypeConstants.h>
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Entry.h"
#include "EntryListener.h"
#include "IndexImpl.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/NameIndex.cpp
b/src/add-ons/kernel/file_systems/ramfs/NameIndex.cpp
index 473fdbba67..2ab27e0528 100644
--- a/src/add-ons/kernel/file_systems/ramfs/NameIndex.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/NameIndex.cpp
@@ -2,7 +2,7 @@
#include <TypeConstants.h>
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Entry.h"
#include "IndexImpl.h"
#include "NameIndex.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/Node.cpp
b/src/add-ons/kernel/file_systems/ramfs/Node.cpp
index 72aba18202..29b772d2c8 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Node.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/Node.cpp
@@ -1,7 +1,7 @@
// Node.cpp
#include "AllocationInfo.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "EntryIterator.h"
#include "LastModifiedIndex.h"
#include "Node.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/NodeChildTable.h
b/src/add-ons/kernel/file_systems/ramfs/NodeChildTable.h
index 0781e8a581..b983b8c78e 100644
--- a/src/add-ons/kernel/file_systems/ramfs/NodeChildTable.h
+++ b/src/add-ons/kernel/file_systems/ramfs/NodeChildTable.h
@@ -4,7 +4,7 @@
#define NODE_CHILD_TABLE_H
#include "AllocationInfo.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Misc.h"
#include "Node.h"
#include "OpenHashTable.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/NodeTable.cpp
b/src/add-ons/kernel/file_systems/ramfs/NodeTable.cpp
index c75b4aa42f..b81ed57761 100644
--- a/src/add-ons/kernel/file_systems/ramfs/NodeTable.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/NodeTable.cpp
@@ -1,6 +1,6 @@
// NodeTable.cpp
-#include "Debug.h"
+#include "DebugSupport.h"
#include "NodeTable.h"
// constructor
diff --git a/src/add-ons/kernel/file_systems/ramfs/Query.cpp
b/src/add-ons/kernel/file_systems/ramfs/Query.cpp
index 19fbcc0a70..29a31a5e77 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Query.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/Query.cpp
@@ -12,7 +12,7 @@
#include "Query.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Directory.h"
#include "Entry.h"
#include "Misc.h"
@@ -874,7 +874,7 @@ Equation::ConvertValue(type_code type)
fSize = sizeof(double);
break;
default:
- FATAL(("query value conversion to 0x%lx requested!\n",
type));
+ FATAL("query value conversion to 0x%lx requested!\n",
type);
// should we fail here or just do a safety int32
conversion?
return B_ERROR;
}
@@ -921,7 +921,7 @@ Equation::CompareTo(const uint8 *value, uint16 size)
case OP_GREATER_THAN_OR_EQUAL:
return compare >= 0;
}
- FATAL(("Unknown/Unsupported operation: %d\n", fOp));
+ FATAL("Unknown/Unsupported operation: %d\n", fOp);
return false;
}
@@ -1202,7 +1202,7 @@ Equation::GetNextMatching(Volume *volume, IndexIterator
*iterator,
other = parent->Left();
if (other == NULL) {
- FATAL(("&&-operator has only one
child... (parent = %p)\n", parent));
+ FATAL("&&-operator has only one
child... (parent = %p)\n", parent);
break;
}
status = other->Match(entry, entry->GetNode());
diff --git a/src/add-ons/kernel/file_systems/ramfs/String.h
b/src/add-ons/kernel/file_systems/ramfs/String.h
new file mode 100644
index 0000000000..a112b5cf75
--- /dev/null
+++ b/src/add-ons/kernel/file_systems/ramfs/String.h
@@ -0,0 +1,203 @@
+// String.h
+
+#ifndef STRING_H
+#define STRING_H
+
+#include <SupportDefs.h>
+#include <string.h>
+#include <new>
+
+
+// string_hash
+//
+// from the Dragon Book: a slightly modified hashpjw()
+static inline
+uint32
+string_hash(const char *name)
+{
+ uint32 h = 0;
+ if (name) {
+ for (; *name; name++) {
+ uint32 g = h & 0xf0000000;
+ if (g)
+ h ^= g >> 24;
+ h = (h << 4) + *name;
+ }
+ }
+ return h;
+}
+
+#ifdef __cplusplus
+
+// String
+class String {
+public:
+ inline String();
+ inline String(const String &string);
+ inline String(const char *string, int32 length = -1);
+ inline ~String();
+
+ inline bool SetTo(const char *string, int32 maxLength = -1);
+ inline void Unset();
+
+ inline void Truncate(int32 newLength);
+
+ inline const char *GetString() const;
+ inline int32 GetLength() const { return fLength; }
+
+ inline uint32 GetHashCode() const { return
string_hash(GetString()); }
+
+ inline String &operator=(const String &string);
+ inline bool operator==(const String &string) const;
+ inline bool operator!=(const String &string) const { return !(*this ==
string); }
+
+private:
+ inline bool _SetTo(const char *string, int32 length);
+
+private:
+ int32 fLength;
+ char *fString;
+};
+
+// strnlen
+size_t
+strnlen(const char *str, size_t maxLen)
+{
+ if (str) {
+ size_t origMaxLen = maxLen;
+ while (maxLen > 0 && *str != '\0') {
+ maxLen--;
+ str++;
+ }
+ return origMaxLen - maxLen;
+ }
+ return 0;
+}
+
+
+/*!
+ \class String
+ \brief A very simple string class.
+*/
+
+// constructor
+String::String()
+ : fLength(0),
+ fString(NULL)
+{
+}
+
+// copy constructor
+String::String(const String &string)
+ : fLength(0),
+ fString(NULL)
+{
+ *this = string;
+}
+
+// constructor
+String::String(const char *string, int32 length)
+ : fLength(0),
+ fString(NULL)
+{
+ SetTo(string, length);
+}
+
+// destructor
+String::~String()
+{
+ Unset();
+}
+
+// SetTo
+bool
+String::SetTo(const char *string, int32 maxLength)
+{
+ if (string) {
+ if (maxLength > 0)
+ maxLength = strnlen(string, maxLength);
+ else if (maxLength < 0)
+ maxLength = strlen(string);
+ }
+ return _SetTo(string, maxLength);
+}
+
+// Unset
+void
+String::Unset()
+{
+ if (fString) {
+ delete[] fString;
+ fString = NULL;
+ }
+ fLength = 0;
+}
+
+// Truncate
+void
+String::Truncate(int32 newLength)
+{
+ if (newLength < 0)
+ newLength = 0;
+ if (newLength < fLength) {
+ char *string = fString;
+ int32 len = fLength;
+ fString = NULL;
+ len = 0;
+ if (!_SetTo(string, newLength)) {
+ fString = string;
+ fLength = newLength;
+ fString[fLength] = '\0';
+ } else
+ delete[] string;
+ }
+}
+
+// GetString
+const char *
+String::GetString() const
+{
+ if (fString)
+ return fString;
+ return "";
+}
+
+// =
+String &
+String::operator=(const String &string)
+{
+ if (&string != this)
+ _SetTo(string.fString, string.fLength);
+ return *this;
+}
+
+// ==
+bool
+String::operator==(const String &string) const
+{
+ return (fLength == string.fLength
+ && (fLength == 0 || !strcmp(fString, string.fString)));
+}
+
+// _SetTo
+bool
+String::_SetTo(const char *string, int32 length)
+{
+ bool result = true;
+ Unset();
+ if (string && length > 0) {
+ fString = new(std::nothrow) char[length + 1];
+ if (fString) {
+ memcpy(fString, string, length);
+ fString[length] = '\0';
+ fLength = length;
+ } else
+ result = false;
+ }
+ return result;
+}
+
+
+#endif // __cplusplus
+
+#endif // STRING_H
diff --git a/src/add-ons/kernel/file_systems/ramfs/SymLink.cpp
b/src/add-ons/kernel/file_systems/ramfs/SymLink.cpp
index 428389ad57..2a7ac8738d 100644
--- a/src/add-ons/kernel/file_systems/ramfs/SymLink.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/SymLink.cpp
@@ -3,7 +3,7 @@
#include <limits.h>
#include "AllocationInfo.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "SizeIndex.h"
#include "SymLink.h"
#include "Volume.h"
diff --git a/src/add-ons/kernel/file_systems/ramfs/Volume.cpp
b/src/add-ons/kernel/file_systems/ramfs/Volume.cpp
index e5dfbce119..492de141b8 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Volume.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/Volume.cpp
@@ -28,7 +28,7 @@
#include "Block.h"
#include "BlockAllocator.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Directory.h"
#include "Entry.h"
#include "EntryListener.h"
@@ -754,7 +754,7 @@ Volume::FindAttributeIndex(const char *name, uint32 type)
void
Volume::AddQuery(Query *query)
{
- AutoLocker<Locker> _(fQueryLocker);
+ AutoLocker<RecursiveLock> _(fQueryLocker);
if (query)
fQueries.Insert(query);
@@ -764,7 +764,7 @@ Volume::AddQuery(Query *query)
void
Volume::RemoveQuery(Query *query)
{
- AutoLocker<Locker> _(fQueryLocker);
+ AutoLocker<RecursiveLock> _(fQueryLocker);
if (query)
fQueries.Remove(query);
@@ -776,7 +776,7 @@ Volume::UpdateLiveQueries(Entry *entry, Node* node, const
char *attribute,
int32 type, const uint8 *oldKey, size_t oldLength, const uint8 *newKey,
size_t newLength)
{
- AutoLocker<Locker> _(fQueryLocker);
+ AutoLocker<RecursiveLock> _(fQueryLocker);
for (Query* query = fQueries.First();
query;
diff --git a/src/add-ons/kernel/file_systems/ramfs/Volume.h
b/src/add-ons/kernel/file_systems/ramfs/Volume.h
index 6863606268..8f137b7d90 100644
--- a/src/add-ons/kernel/file_systems/ramfs/Volume.h
+++ b/src/add-ons/kernel/file_systems/ramfs/Volume.h
@@ -25,11 +25,11 @@
#include <fs_interface.h>
#include <SupportDefs.h>
+#include <userlandfs/shared/RecursiveLock.h>
#include <util/DoublyLinkedList.h>
#include "Entry.h"
#include "List.h"
-#include "Locker.h"
#include "Query.h"
#include "String.h"
@@ -191,9 +191,9 @@ private:
IndexDirectory *fIndexDirectory;
Directory *fRootDirectory;
String fName;
- Locker fLocker;
- Locker fIteratorLocker;
- Locker fQueryLocker;
+ RecursiveLock fLocker;
+ RecursiveLock fIteratorLocker;
+ RecursiveLock fQueryLocker;
NodeListenerTree *fNodeListeners;
NodeListenerList fAnyNodeListeners;
EntryListenerTree *fEntryListeners;
diff --git a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp
b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp
index 64427a095e..25271d9ec9 100644
--- a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp
+++ b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp
@@ -45,7 +45,7 @@
#include "AllocationInfo.h"
#include "AttributeIndex.h"
#include "AttributeIterator.h"
-#include "Debug.h"
+#include "DebugSupport.h"
#include "Directory.h"
#include "Entry.h"
#include "EntryIterator.h"
@@ -376,8 +376,8 @@ ramfs_read_symlink(fs_volume* _volume, fs_vnode* _node,
char *buffer,
memcpy(buffer,
symLink->GetLinkedPath(), toRead);
*bufferSize = toRead;
} else {
- FATAL(("Node %Ld pretends to be a SymLink, but
isn't!\n",
- node->GetID()));
+ FATAL("Node %Ld pretends to be a SymLink, but
isn't!\n",
+ node->GetID());
error = B_BAD_VALUE;
}
}
@@ -957,8 +957,8 @@ ramfs_read(fs_volume* _volume, fs_vnode* _node, void*
_cookie, off_t pos,
if (File *file = dynamic_cast<File*>(node))
error = file->ReadAt(pos, buffer, *bufferSize,
bufferSize);
else {
- FATAL(("Node %Ld pretends to be a File, but
isn't!\n",
- node->GetID()));
+ FATAL("Node %Ld pretends to be a File, but
isn't!\n",
+ node->GetID());
error = B_BAD_VALUE;
}
}
@@ -999,8 +999,8 @@ ramfs_write(fs_volume* _volume, fs_vnode* _node, void*
_cookie, off_t pos,
error = file->WriteAt(pos, buffer,
*bufferSize,
bufferSize);
} else {
- FATAL(("Node %Ld pretends to be a File,
but isn't!\n",
- node->GetID()));
+ FATAL("Node %Ld pretends to be a File,
but isn't!\n",
+ node->GetID());
error = B_BAD_VALUE;
}
}
@@ -1217,8 +1217,8 @@ ramfs_open_dir(fs_volume* /*fs*/, fs_vnode* _node, void**
_cookie)
if (error == B_OK) {
dir = dynamic_cast<Directory*>(node);
if (!dir) {
- FATAL(("Node %Ld pretends to be a Directory, but
isn't!\n",
- node->GetID()));
+ FATAL("Node %Ld pretends to be a Directory, but
isn't!\n",
+ node->GetID());
error = B_NOT_A_DIRECTORY;
}
}