Fix build of makeudfimage tests.
* The Udf namespace was removed from the headers, but not all the implementation files * kernel_cpp.h is not actually used * TRACE_ERROR can't be set to dprintf when building as part of the test (and not as a kernel add-on) First step on the way to get jam -q unittests to work again...
This commit is contained in:
parent
080f5d5f5d
commit
49a6a0ebf3
@ -10,8 +10,6 @@
|
||||
#include "SupportDefs.h"
|
||||
#include "UdfDebug.h"
|
||||
|
||||
#include <util/kernel_cpp.h>
|
||||
|
||||
/*! \brief Slightly more typesafe static array type than built-in arrays,
|
||||
with array length information stored implicitly (i.e. consuming no
|
||||
physical space in the actual struct) via the \c arrayLength template
|
||||
|
@ -158,7 +158,7 @@ static void unindent(uint8 tabCount);
|
||||
#endif
|
||||
|
||||
//! Used to keep the tls handle from being allocated more than once.
|
||||
vint32 tls_spinlock = 0;
|
||||
int32 tls_spinlock = 0;
|
||||
|
||||
/*! \brief Used to flag whether the tls handle has been allocated yet.
|
||||
|
||||
|
@ -47,8 +47,6 @@ extern "C" int vsprintf(char *s, const char *format, va_list arg);
|
||||
//# define __out printf
|
||||
#endif
|
||||
|
||||
#include <util/kernel_cpp.h>
|
||||
|
||||
class DebugHelper;
|
||||
|
||||
int32 _get_debug_indent_level();
|
||||
@ -229,7 +227,12 @@ private:
|
||||
#endif // ifdef DEBUG else
|
||||
|
||||
#define TRACE(x) /*dprintf x*/
|
||||
#define TRACE_ERROR(x) dprintf x
|
||||
|
||||
#ifdef TEST_HAIKU
|
||||
#define TRACE_ERROR(x) printf x
|
||||
#else
|
||||
#define TRACE_ERROR(x) dprintf x
|
||||
#endif
|
||||
|
||||
// These macros turn on or off extensive and generally unnecessary
|
||||
// debugging output regarding table of contents parsing
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "Array.h"
|
||||
#include "UdfDebug.h"
|
||||
|
||||
#include <new.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <util/kernel_cpp.h>
|
||||
|
||||
/*! \brief UdfString class that takes as input either a UTF8 string or a
|
||||
CS0 unicode string and then provides access to said string in both
|
||||
formats.
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
#include "Array.h"
|
||||
|
||||
#include <util/kernel_cpp.h>
|
||||
|
||||
/*! \file UdfStructures.h
|
||||
|
||||
\brief UDF on-disk data structure declarations
|
||||
|
@ -24,7 +24,7 @@ Allocator::Allocator(uint32 blockSize)
|
||||
, fBlockShift(0)
|
||||
, fInitStatus(B_NO_INIT)
|
||||
{
|
||||
status_t error = Udf::get_block_shift(BlockSize(), fBlockShift);
|
||||
status_t error = get_block_shift(BlockSize(), fBlockShift);
|
||||
if (!error)
|
||||
fInitStatus = B_OK;
|
||||
}
|
||||
@ -44,7 +44,7 @@ Allocator::InitCheck() const
|
||||
status_t
|
||||
Allocator::GetBlock(uint32 block)
|
||||
{
|
||||
Udf::extent_address extent(block, BlockSize());
|
||||
extent_address extent(block, BlockSize());
|
||||
return GetExtent(extent);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ Allocator::GetBlock(uint32 block)
|
||||
been allocated.
|
||||
*/
|
||||
status_t
|
||||
Allocator::GetExtent(Udf::extent_address extent)
|
||||
Allocator::GetExtent(extent_address extent)
|
||||
{
|
||||
status_t error = InitCheck();
|
||||
if (!error) {
|
||||
@ -68,7 +68,7 @@ Allocator::GetExtent(Udf::extent_address extent)
|
||||
// Add a new chunk to the end of the chunk list if
|
||||
// necessary
|
||||
if (offset > Length()) {
|
||||
Udf::extent_address chunk(Length(), (offset-Length())<<BlockShift());
|
||||
extent_address chunk(Length(), (offset-Length())<<BlockShift());
|
||||
fChunkList.push_back(chunk);
|
||||
}
|
||||
// Adjust the tail
|
||||
@ -76,7 +76,7 @@ Allocator::GetExtent(Udf::extent_address extent)
|
||||
return B_OK;
|
||||
} else {
|
||||
// Block is not past tail, so check the chunk list
|
||||
for (list<Udf::extent_address>::iterator i = fChunkList.begin();
|
||||
for (list<extent_address>::iterator i = fChunkList.begin();
|
||||
i != fChunkList.end();
|
||||
i++)
|
||||
{
|
||||
@ -88,7 +88,7 @@ Allocator::GetExtent(Udf::extent_address extent)
|
||||
if (chunkOffset < offset) {
|
||||
// Orhpan before; add a new chunk in front
|
||||
// of the current one
|
||||
Udf::extent_address chunk(chunkOffset, (offset-chunkOffset)<<BlockShift());
|
||||
extent_address chunk(chunkOffset, (offset-chunkOffset)<<BlockShift());
|
||||
fChunkList.insert(i, chunk);
|
||||
}
|
||||
if ((offset+length) < (chunkOffset+chunkLength)) {
|
||||
@ -125,7 +125,7 @@ Allocator::GetNextBlock(uint32 &block, uint32 minimumBlock)
|
||||
{
|
||||
status_t error = InitCheck();
|
||||
if (!error) {
|
||||
Udf::extent_address extent;
|
||||
extent_address extent;
|
||||
error = GetNextExtent(BlockSize(), true, extent, minimumBlock);
|
||||
if (!error)
|
||||
block = extent.location();
|
||||
@ -154,7 +154,7 @@ Allocator::GetNextBlock(uint32 &block, uint32 minimumBlock)
|
||||
*/
|
||||
status_t
|
||||
Allocator::GetNextExtent(uint32 _length, bool contiguous,
|
||||
Udf::extent_address &extent,
|
||||
extent_address &extent,
|
||||
uint32 minimumStartingBlock)
|
||||
{
|
||||
DEBUG_INIT_ETC("Allocator", ("length: %lld, contiguous: %d", _length, contiguous));
|
||||
@ -163,7 +163,7 @@ Allocator::GetNextExtent(uint32 _length, bool contiguous,
|
||||
status_t error = InitCheck();
|
||||
PRINT(("allocation length: %lu\n", Length()));
|
||||
if (!error) {
|
||||
for (list<Udf::extent_address>::iterator i = fChunkList.begin();
|
||||
for (list<extent_address>::iterator i = fChunkList.begin();
|
||||
i != fChunkList.end();
|
||||
i++)
|
||||
{
|
||||
@ -180,7 +180,7 @@ Allocator::GetNextExtent(uint32 _length, bool contiguous,
|
||||
uint32 newLength = chunkLength-difference;
|
||||
if (length <= newLength) {
|
||||
// new chunk is still long enough
|
||||
Udf::extent_address newExtent(newOffset, _length);
|
||||
extent_address newExtent(newOffset, _length);
|
||||
if (GetExtent(newExtent) == B_OK) {
|
||||
extent = newExtent;
|
||||
return B_OK;
|
||||
@ -188,7 +188,7 @@ Allocator::GetNextExtent(uint32 _length, bool contiguous,
|
||||
} else if (!contiguous) {
|
||||
// new chunk is too short, but we're allowed to
|
||||
// allocate a shorter extent, so we'll do it.
|
||||
Udf::extent_address newExtent(newOffset, newLength<<BlockShift());
|
||||
extent_address newExtent(newOffset, newLength<<BlockShift());
|
||||
if (GetExtent(newExtent) == B_OK) {
|
||||
extent = newExtent;
|
||||
return B_OK;
|
||||
@ -232,7 +232,7 @@ Allocator::GetNextExtent(uint32 _length, bool contiguous,
|
||||
}
|
||||
}
|
||||
if (!error) {
|
||||
Udf::extent_address newExtent(tail, isPartial ? length<<BlockShift() : _length);
|
||||
extent_address newExtent(tail, isPartial ? length<<BlockShift() : _length);
|
||||
if (GetExtent(newExtent) == B_OK) {
|
||||
extent = newExtent;
|
||||
return B_OK;
|
||||
|
@ -28,11 +28,11 @@ public:
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t GetBlock(uint32 block);
|
||||
status_t GetExtent(Udf::extent_address extent);
|
||||
status_t GetExtent(extent_address extent);
|
||||
|
||||
status_t GetNextBlock(uint32 &block, uint32 minimumBlock = 0);
|
||||
status_t GetNextExtent(uint32 length, bool contiguous,
|
||||
Udf::extent_address &extent,
|
||||
extent_address &extent,
|
||||
uint32 minimumStartingBlock = 0);
|
||||
|
||||
uint32 Length() const { return fLength; }
|
||||
@ -42,7 +42,7 @@ public:
|
||||
|
||||
uint32 BlocksFor(off_t bytes);
|
||||
private:
|
||||
list<Udf::extent_address> fChunkList;
|
||||
list<extent_address> fChunkList;
|
||||
uint32 fLength; //!< Length of allocation so far, in blocks.
|
||||
uint32 fBlockSize;
|
||||
uint32 fBlockShift;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "PhysicalPartitionAllocator.h"
|
||||
|
||||
Udf::extent_address PhysicalPartitionAllocator::dummyExtent;
|
||||
extent_address PhysicalPartitionAllocator::dummyExtent;
|
||||
|
||||
PhysicalPartitionAllocator::PhysicalPartitionAllocator(uint16 number,
|
||||
uint32 offset,
|
||||
@ -70,8 +70,8 @@ PhysicalPartitionAllocator::GetNextBlock(uint32 &block, uint32 &physicalBlock)
|
||||
status_t
|
||||
PhysicalPartitionAllocator::GetNextExtent(uint32 length,
|
||||
bool contiguous,
|
||||
Udf::long_address &extent,
|
||||
Udf::extent_address &physicalExtent)
|
||||
long_address &extent,
|
||||
extent_address &physicalExtent)
|
||||
{
|
||||
status_t error = fAllocator.GetNextExtent(length, contiguous, physicalExtent, fOffset);
|
||||
if (!error) {
|
||||
@ -96,8 +96,8 @@ PhysicalPartitionAllocator::GetNextExtent(uint32 length,
|
||||
- error code: Failure.
|
||||
*/
|
||||
status_t
|
||||
PhysicalPartitionAllocator::GetNextExtents(off_t length, std::list<Udf::long_address> &extents,
|
||||
std::list<Udf::extent_address> &physicalExtents)
|
||||
PhysicalPartitionAllocator::GetNextExtents(off_t length, std::list<long_address> &extents,
|
||||
std::list<extent_address> &physicalExtents)
|
||||
{
|
||||
DEBUG_INIT_ETC("PhysicalPartitionAllocator", ("length: %lld", length));
|
||||
extents.empty();
|
||||
@ -106,8 +106,8 @@ PhysicalPartitionAllocator::GetNextExtents(off_t length, std::list<Udf::long_add
|
||||
// Allocate extents until we're done or we hit an error
|
||||
status_t error = B_OK;
|
||||
while (error == B_OK) {
|
||||
Udf::long_address extent;
|
||||
Udf::extent_address physicalExtent;
|
||||
long_address extent;
|
||||
extent_address physicalExtent;
|
||||
uint32 chunkLength = length <= ULONG_MAX ? uint32(length) : ULONG_MAX;
|
||||
error = GetNextExtent(chunkLength, false, extent, physicalExtent);
|
||||
if (!error) {
|
||||
|
@ -25,16 +25,16 @@ public:
|
||||
PhysicalPartitionAllocator(uint16 number, uint32 offset, Allocator &allocator);
|
||||
|
||||
status_t GetNextBlock(uint32 &block, uint32 &physicalBlock);
|
||||
status_t GetNextExtent(uint32 length, bool contiguous, Udf::long_address &extent,
|
||||
Udf::extent_address &physicalExtent = dummyExtent);
|
||||
status_t GetNextExtents(off_t length, std::list<Udf::long_address> &extents,
|
||||
std::list<Udf::extent_address> &physicalExtents);
|
||||
status_t GetNextExtent(uint32 length, bool contiguous, long_address &extent,
|
||||
extent_address &physicalExtent = dummyExtent);
|
||||
status_t GetNextExtents(off_t length, std::list<long_address> &extents,
|
||||
std::list<extent_address> &physicalExtents);
|
||||
|
||||
|
||||
uint16 PartitionNumber() const { return fNumber; }
|
||||
uint32 Length() const;
|
||||
private:
|
||||
static Udf::extent_address dummyExtent;
|
||||
static extent_address dummyExtent;
|
||||
uint16 fNumber; //!< The partition number of this partition
|
||||
uint32 fOffset; //!< The offset of the start of this partition in physical space
|
||||
Allocator &fAllocator;
|
||||
|
@ -22,8 +22,8 @@ AllocatorTest::Suite() {
|
||||
CppUnit::TestSuite *suite = new CppUnit::TestSuite("Yo");
|
||||
|
||||
// And our tests
|
||||
suite->addTest(new CppUnit::TestCaller<AllocatorTest>("Udf::Allocator::BlockSize Test", &AllocatorTest::BlockSizeTest));
|
||||
suite->addTest(new CppUnit::TestCaller<AllocatorTest>("Udf::Allocator::Partition Full Test", &AllocatorTest::PartitionFullTest));
|
||||
suite->addTest(new CppUnit::TestCaller<AllocatorTest>("Allocator::BlockSize Test", &AllocatorTest::BlockSizeTest));
|
||||
suite->addTest(new CppUnit::TestCaller<AllocatorTest>("Allocator::Partition Full Test", &AllocatorTest::PartitionFullTest));
|
||||
|
||||
return suite;
|
||||
}
|
||||
@ -85,7 +85,7 @@ AllocatorTest::BlockSizeTest() {
|
||||
void
|
||||
AllocatorTest::PartitionFullTest() {
|
||||
{
|
||||
Udf::extent_address extent;
|
||||
extent_address extent;
|
||||
const uint32 blockSize = 2048;
|
||||
Allocator allocator(blockSize);
|
||||
CHK(allocator.InitCheck() == B_OK);
|
||||
@ -100,7 +100,7 @@ AllocatorTest::PartitionFullTest() {
|
||||
}
|
||||
NextSubTest();
|
||||
{
|
||||
Udf::extent_address extent;
|
||||
extent_address extent;
|
||||
Allocator allocator(2048);
|
||||
CHK(allocator.InitCheck() == B_OK);
|
||||
CHK(allocator.GetNextExtent(ULONG_MAX-1, true, extent) == B_OK);
|
||||
@ -112,7 +112,7 @@ AllocatorTest::PartitionFullTest() {
|
||||
}
|
||||
NextSubTest();
|
||||
{
|
||||
Udf::extent_address extent;
|
||||
extent_address extent;
|
||||
const uint32 blockSize = 2048;
|
||||
Allocator allocator(blockSize);
|
||||
CHK(allocator.InitCheck() == B_OK);
|
||||
@ -123,20 +123,20 @@ AllocatorTest::PartitionFullTest() {
|
||||
CHK(allocator.GetExtent(extent) != B_OK);
|
||||
CHK(allocator.GetBlock(13) != B_OK);
|
||||
PhysicalPartitionAllocator partition(0, 0, allocator);
|
||||
std::list<Udf::long_address> extents;
|
||||
std::list<Udf::extent_address> physicalExtents;
|
||||
std::list<long_address> extents;
|
||||
std::list<extent_address> physicalExtents;
|
||||
CHK(partition.GetNextExtents(1, extents, physicalExtents) == B_OK);
|
||||
}
|
||||
NextSubTest();
|
||||
{
|
||||
Udf::extent_address extent;
|
||||
extent_address extent;
|
||||
const uint32 blockSize = 2048;
|
||||
Allocator allocator(blockSize);
|
||||
CHK(allocator.InitCheck() == B_OK);
|
||||
CHK(allocator.GetNextExtent(ULONG_MAX, true, extent) == B_OK);
|
||||
PhysicalPartitionAllocator partition(0, 0, allocator);
|
||||
std::list<Udf::long_address> extents;
|
||||
std::list<Udf::extent_address> physicalExtents;
|
||||
std::list<long_address> extents;
|
||||
std::list<extent_address> physicalExtents;
|
||||
CHK(partition.GetNextExtents(1, extents, physicalExtents) != B_OK);
|
||||
}
|
||||
NextSubTest();
|
||||
|
@ -5,6 +5,7 @@ AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UsePublicHeaders add-ons/file_system ; # For fsproto.h
|
||||
UsePrivateHeaders [ FDirName kernel util ] ; # For kernel_cpp.h
|
||||
UsePrivateHeaders private shared ;
|
||||
SubDirHdrs [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems udf ] ;
|
||||
SubDirHdrs [ FDirName $(HAIKU_TOP) src bin makeudfimage ] ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user