headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the class to BOpenHashTable and changed the interface slightly so that HashTableLink became superfluous. Adapted all the code that used it. Since the OpenHashTables no longer clash, this should fix the GCC4 build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -108,11 +108,11 @@ public:
|
||||
NotificationListener& listener) = 0;
|
||||
|
||||
virtual const char* Name() = 0;
|
||||
HashTableLink<NotificationService>&
|
||||
NotificationService*&
|
||||
Link() { return fLink; }
|
||||
|
||||
private:
|
||||
HashTableLink<NotificationService> fLink;
|
||||
NotificationService* fLink;
|
||||
};
|
||||
|
||||
struct default_listener : public DoublyLinkedListLinkImpl<default_listener> {
|
||||
@@ -226,11 +226,11 @@ private:
|
||||
{ return hash_hash_string(service->Name()); }
|
||||
bool Compare(const char* key, NotificationService* service) const
|
||||
{ return !strcmp(key, service->Name()); }
|
||||
HashTableLink<NotificationService>* GetLink(
|
||||
NotificationService*& GetLink(
|
||||
NotificationService* service) const
|
||||
{ return &service->Link(); }
|
||||
{ return service->Link(); }
|
||||
};
|
||||
typedef OpenHashTable<HashDefinition> ServiceHash;
|
||||
typedef BOpenHashTable<HashDefinition> ServiceHash;
|
||||
|
||||
static NotificationManager sManager;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
struct ConditionVariable : protected HashTableLink<ConditionVariable> {
|
||||
struct ConditionVariable {
|
||||
public:
|
||||
void Init(const void* object,
|
||||
const char* objectType);
|
||||
@@ -81,6 +81,7 @@ protected:
|
||||
const void* fObject;
|
||||
const char* fObjectType;
|
||||
EntryList fEntries;
|
||||
ConditionVariable* fNext;
|
||||
|
||||
friend struct ConditionVariableEntry;
|
||||
friend struct ConditionVariableHashDefinition;
|
||||
|
||||
@@ -18,7 +18,7 @@ struct team;
|
||||
struct image {
|
||||
struct image* next;
|
||||
struct image* prev;
|
||||
HashTableLink<image> hash_link;
|
||||
struct image* hash_link;
|
||||
image_info info;
|
||||
team_id team;
|
||||
};
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
template<typename Definition, bool AutoExpand = true,
|
||||
bool CheckDuplicates = false>
|
||||
class MultiHashTable : private OpenHashTable<Definition,
|
||||
class MultiHashTable : private BOpenHashTable<Definition,
|
||||
AutoExpand, CheckDuplicates> {
|
||||
public:
|
||||
typedef OpenHashTable<Definition, AutoExpand, CheckDuplicates> HashTable;
|
||||
typedef BOpenHashTable<Definition, AutoExpand, CheckDuplicates> HashTable;
|
||||
typedef MultiHashTable<Definition, AutoExpand, CheckDuplicates> MultiTable;
|
||||
|
||||
typedef typename HashTable::Iterator Iterator;
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
while (slot) {
|
||||
if (HashTable::fDefinition.Compare(key, slot))
|
||||
break;
|
||||
slot = HashTable::_Link(slot)->fNext;
|
||||
slot = HashTable::_Link(slot);
|
||||
}
|
||||
|
||||
if (slot == NULL)
|
||||
@@ -140,18 +140,18 @@ private:
|
||||
// group values with the same key
|
||||
for (previous = table[index]; previous
|
||||
&& !HashTable::fDefinition.CompareValues(previous, value);
|
||||
previous = HashTable::_Link(previous)->fNext);
|
||||
previous = HashTable::_Link(previous));
|
||||
|
||||
if (previous) {
|
||||
_Link(value)->fNext = _Link(previous)->fNext;
|
||||
_Link(previous)->fNext = value;
|
||||
_Link(value) = _Link(previous);
|
||||
_Link(previous) = value;
|
||||
} else {
|
||||
_Link(value)->fNext = table[index];
|
||||
_Link(value) = table[index];
|
||||
table[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO use OpenHashTable's _Resize
|
||||
// TODO use BOpenHashTable's _Resize
|
||||
bool _Resize(size_t newSize)
|
||||
{
|
||||
ValueType **newTable = new ValueType *[newSize];
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
for (size_t i = 0; i < HashTable::fTableSize; i++) {
|
||||
ValueType *bucket = HashTable::fTable[i];
|
||||
while (bucket) {
|
||||
ValueType *next = _Link(bucket)->fNext;
|
||||
ValueType *next = _Link(bucket);
|
||||
_Insert(newTable, newSize, bucket);
|
||||
bucket = next;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
`Compare' and `GetLink;. It must also define several types as shown in the
|
||||
following example:
|
||||
|
||||
struct Foo : HashTableLink<Foo> {
|
||||
struct Foo {
|
||||
int bar;
|
||||
|
||||
HashTableLink<Foo> otherLink;
|
||||
Foo* fNext;
|
||||
};
|
||||
|
||||
struct HashTableDefinition {
|
||||
@@ -34,22 +34,18 @@
|
||||
HashTableDefinition(const HashTableDefinition&) {}
|
||||
|
||||
size_t HashKey(int key) const { return key >> 1; }
|
||||
size_t Hash(Foo *value) const { return HashKey(value->bar); }
|
||||
bool Compare(int key, Foo *value) const { return value->bar == key; }
|
||||
HashTableLink<Foo> *GetLink(Foo *value) const { return value; }
|
||||
size_t Hash(Foo* value) const { return HashKey(value->bar); }
|
||||
bool Compare(int key, Foo* value) const { return value->bar == key; }
|
||||
Foo*& GetLink(Foo* value) const { return value->fNext; }
|
||||
};
|
||||
*/
|
||||
|
||||
template<typename Type>
|
||||
struct HashTableLink {
|
||||
Type *fNext;
|
||||
};
|
||||
|
||||
template<typename Definition, bool AutoExpand = true,
|
||||
bool CheckDuplicates = false>
|
||||
class OpenHashTable {
|
||||
class BOpenHashTable {
|
||||
public:
|
||||
typedef OpenHashTable<Definition, AutoExpand, CheckDuplicates> HashTable;
|
||||
typedef BOpenHashTable<Definition, AutoExpand, CheckDuplicates> HashTable;
|
||||
typedef typename Definition::KeyType KeyType;
|
||||
typedef typename Definition::ValueType ValueType;
|
||||
|
||||
@@ -62,7 +58,7 @@ public:
|
||||
// regrowth factor: 200 / 256 = 78.125%
|
||||
// 50 / 256 = 19.53125%
|
||||
|
||||
OpenHashTable()
|
||||
BOpenHashTable()
|
||||
:
|
||||
fTableSize(0),
|
||||
fItemCount(0),
|
||||
@@ -70,7 +66,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
OpenHashTable(const Definition& definition)
|
||||
BOpenHashTable(const Definition& definition)
|
||||
:
|
||||
fDefinition(definition),
|
||||
fTableSize(0),
|
||||
@@ -79,7 +75,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~OpenHashTable()
|
||||
~BOpenHashTable()
|
||||
{
|
||||
free(fTable);
|
||||
}
|
||||
@@ -101,24 +97,24 @@ public:
|
||||
return fItemCount;
|
||||
}
|
||||
|
||||
ValueType *Lookup(const KeyType &key) const
|
||||
ValueType* Lookup(const KeyType& key) const
|
||||
{
|
||||
if (fTableSize == 0)
|
||||
return NULL;
|
||||
|
||||
size_t index = fDefinition.HashKey(key) & (fTableSize - 1);
|
||||
ValueType *slot = fTable[index];
|
||||
ValueType* slot = fTable[index];
|
||||
|
||||
while (slot) {
|
||||
if (fDefinition.Compare(key, slot))
|
||||
break;
|
||||
slot = _Link(slot)->fNext;
|
||||
slot = _Link(slot);
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
status_t Insert(ValueType *value)
|
||||
status_t Insert(ValueType* value)
|
||||
{
|
||||
if (fTableSize == 0) {
|
||||
if (!_Resize(kMinimumSize))
|
||||
@@ -130,7 +126,7 @@ public:
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void InsertUnchecked(ValueType *value)
|
||||
void InsertUnchecked(ValueType* value)
|
||||
{
|
||||
if (CheckDuplicates && _ExhaustiveSearch(value)) {
|
||||
#ifdef _KERNEL_MODE
|
||||
@@ -146,7 +142,7 @@ public:
|
||||
|
||||
// TODO: a ValueType* Remove(const KeyType& key) method is missing
|
||||
|
||||
bool Remove(ValueType *value)
|
||||
bool Remove(ValueType* value)
|
||||
{
|
||||
if (!RemoveUnchecked(value))
|
||||
return false;
|
||||
@@ -158,17 +154,18 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RemoveUnchecked(ValueType *value)
|
||||
bool RemoveUnchecked(ValueType* value)
|
||||
{
|
||||
size_t index = fDefinition.Hash(value) & (fTableSize - 1);
|
||||
ValueType *previous = NULL, *slot = fTable[index];
|
||||
ValueType* previous = NULL;
|
||||
ValueType* slot = fTable[index];
|
||||
|
||||
while (slot) {
|
||||
ValueType *next = _Link(slot)->fNext;
|
||||
ValueType* next = _Link(slot);
|
||||
|
||||
if (value == slot) {
|
||||
if (previous)
|
||||
_Link(previous)->fNext = next;
|
||||
_Link(previous) = next;
|
||||
else
|
||||
fTable[index] = next;
|
||||
break;
|
||||
@@ -217,7 +214,7 @@ public:
|
||||
// update nextPointer to point to the fNext of the last
|
||||
// element in the bucket
|
||||
while (element != NULL) {
|
||||
nextPointer = &_Link(element)->fNext;
|
||||
nextPointer = &_Link(element);
|
||||
element = *nextPointer;
|
||||
}
|
||||
}
|
||||
@@ -274,20 +271,20 @@ public:
|
||||
|
||||
class Iterator {
|
||||
public:
|
||||
Iterator(const HashTable *table)
|
||||
Iterator(const HashTable* table)
|
||||
: fTable(table)
|
||||
{
|
||||
Rewind();
|
||||
}
|
||||
|
||||
Iterator(const HashTable *table, size_t index, ValueType *value)
|
||||
Iterator(const HashTable* table, size_t index, ValueType* value)
|
||||
: fTable(table), fIndex(index), fNext(value) {}
|
||||
|
||||
bool HasNext() const { return fNext != NULL; }
|
||||
|
||||
ValueType *Next()
|
||||
ValueType* Next()
|
||||
{
|
||||
ValueType *current = fNext;
|
||||
ValueType* current = fNext;
|
||||
_GetNext();
|
||||
return current;
|
||||
}
|
||||
@@ -306,15 +303,15 @@ public:
|
||||
void _GetNext()
|
||||
{
|
||||
if (fNext)
|
||||
fNext = fTable->_Link(fNext)->fNext;
|
||||
fNext = fTable->_Link(fNext);
|
||||
|
||||
while (fNext == NULL && fIndex < fTable->fTableSize)
|
||||
fNext = fTable->fTable[fIndex++];
|
||||
}
|
||||
|
||||
const HashTable *fTable;
|
||||
const HashTable* fTable;
|
||||
size_t fIndex;
|
||||
ValueType *fNext;
|
||||
ValueType* fNext;
|
||||
};
|
||||
|
||||
Iterator GetIterator() const { return Iterator(this); }
|
||||
@@ -323,11 +320,11 @@ protected:
|
||||
// for g++ 2.95
|
||||
friend class Iterator;
|
||||
|
||||
void _Insert(ValueType **table, size_t tableSize, ValueType *value)
|
||||
void _Insert(ValueType** table, size_t tableSize, ValueType* value)
|
||||
{
|
||||
size_t index = fDefinition.Hash(value) & (tableSize - 1);
|
||||
|
||||
_Link(value)->fNext = table[index];
|
||||
_Link(value) = table[index];
|
||||
table[index] = value;
|
||||
}
|
||||
|
||||
@@ -349,9 +346,9 @@ protected:
|
||||
|
||||
if (fTable) {
|
||||
for (size_t i = 0; i < fTableSize; i++) {
|
||||
ValueType *bucket = fTable[i];
|
||||
ValueType* bucket = fTable[i];
|
||||
while (bucket) {
|
||||
ValueType *next = _Link(bucket)->fNext;
|
||||
ValueType* next = _Link(bucket);
|
||||
_Insert(newTable, newSize, bucket);
|
||||
bucket = next;
|
||||
}
|
||||
@@ -364,28 +361,29 @@ protected:
|
||||
fTable = newTable;
|
||||
}
|
||||
|
||||
HashTableLink<ValueType> *_Link(ValueType *bucket) const
|
||||
ValueType*& _Link(ValueType* bucket) const
|
||||
{
|
||||
return fDefinition.GetLink(bucket);
|
||||
}
|
||||
|
||||
bool _ExhaustiveSearch(ValueType *value) const
|
||||
bool _ExhaustiveSearch(ValueType* value) const
|
||||
{
|
||||
for (size_t i = 0; i < fTableSize; i++) {
|
||||
ValueType *bucket = fTable[i];
|
||||
ValueType* bucket = fTable[i];
|
||||
while (bucket) {
|
||||
if (bucket == value)
|
||||
return true;
|
||||
bucket = _Link(bucket)->fNext;
|
||||
bucket = _Link(bucket);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Definition fDefinition;
|
||||
size_t fTableSize, fItemCount;
|
||||
ValueType **fTable;
|
||||
Definition fDefinition;
|
||||
size_t fTableSize;
|
||||
size_t fItemCount;
|
||||
ValueType** fTable;
|
||||
};
|
||||
|
||||
#endif // _KERNEL_UTIL_OPEN_HASH_TABLE_H
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
// HashMapElement
|
||||
template<typename Key, typename Value>
|
||||
class HashMapElement : public HashTableLink<HashMapElement<Key, Value> > {
|
||||
class HashMapElement {
|
||||
private:
|
||||
typedef HashMapElement<Key, Value> Element;
|
||||
|
||||
@@ -34,8 +34,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Key fKey;
|
||||
Value fValue;
|
||||
Key fKey;
|
||||
Value fValue;
|
||||
HashMapElement* fNext;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,8 +52,8 @@ struct HashMapTableDefinition {
|
||||
{ return HashKey(value->fKey); }
|
||||
bool Compare(const KeyType& key, const ValueType* value) const
|
||||
{ return value->fKey == key; }
|
||||
HashTableLink<ValueType>* GetLink(ValueType* value) const
|
||||
{ return value; }
|
||||
ValueType*& GetLink(ValueType* value) const
|
||||
{ return value->fNext; }
|
||||
};
|
||||
|
||||
|
||||
@@ -128,7 +129,8 @@ public:
|
||||
|
||||
private:
|
||||
friend class HashMap<Key, Value>;
|
||||
typedef OpenHashTable<HashMapTableDefinition<Key, Value> > ElementTable;
|
||||
typedef BOpenHashTable<HashMapTableDefinition<Key, Value> >
|
||||
ElementTable;
|
||||
|
||||
HashMap<Key, Value>* fMap;
|
||||
typename ElementTable::Iterator fIterator;
|
||||
@@ -152,7 +154,7 @@ public:
|
||||
Iterator GetIterator();
|
||||
|
||||
protected:
|
||||
typedef OpenHashTable<HashMapTableDefinition<Key, Value> > ElementTable;
|
||||
typedef BOpenHashTable<HashMapTableDefinition<Key, Value> > ElementTable;
|
||||
typedef HashMapElement<Key, Value> Element;
|
||||
friend class Iterator;
|
||||
|
||||
|
||||
@@ -74,8 +74,9 @@
|
||||
#define BIND_APERTURE 0x20000000
|
||||
#define APERTURE_PUBLIC_FLAGS_MASK 0x0000ffff
|
||||
|
||||
struct aperture_memory : HashTableLink<aperture_memory> {
|
||||
struct aperture_memory {
|
||||
aperture_memory *next;
|
||||
aperture_memory *hash_link;
|
||||
addr_t base;
|
||||
size_t size;
|
||||
uint32 flags;
|
||||
@@ -104,21 +105,21 @@ public:
|
||||
{ return (memory->base - fInfo.base) / B_PAGE_SIZE; }
|
||||
bool Compare(const KeyType &base, aperture_memory *memory) const
|
||||
{ return base == memory->base; }
|
||||
HashTableLink<aperture_memory> *GetLink(aperture_memory *memory) const
|
||||
{ return memory; }
|
||||
aperture_memory *&GetLink(aperture_memory *memory) const
|
||||
{ return memory->hash_link; }
|
||||
|
||||
private:
|
||||
aperture_info &fInfo;
|
||||
};
|
||||
|
||||
typedef OpenHashTable<MemoryHashDefinition> MemoryHashTable;
|
||||
typedef BOpenHashTable<MemoryHashDefinition> MemoryHashTable;
|
||||
|
||||
struct agp_device_info {
|
||||
uint8 address; /* location of AGP interface in PCI capabilities */
|
||||
agp_info info;
|
||||
};
|
||||
|
||||
class Aperture : public HashTableLink<Aperture> {
|
||||
class Aperture {
|
||||
public:
|
||||
Aperture(agp_gart_bus_module_info *module, void *aperture);
|
||||
~Aperture();
|
||||
@@ -156,6 +157,9 @@ private:
|
||||
MemoryHashTable fHashTable;
|
||||
aperture_memory *fFirstMemory;
|
||||
void *fPrivateAperture;
|
||||
|
||||
public:
|
||||
Aperture *fNext;
|
||||
};
|
||||
|
||||
class ApertureHashDefinition {
|
||||
@@ -169,11 +173,11 @@ public:
|
||||
{ return aperture->ID(); }
|
||||
bool Compare(const KeyType &id, Aperture *aperture) const
|
||||
{ return id == aperture->ID(); }
|
||||
HashTableLink<Aperture> *GetLink(Aperture *aperture) const
|
||||
{ return aperture; }
|
||||
Aperture *&GetLink(Aperture *aperture) const
|
||||
{ return aperture->fNext; }
|
||||
};
|
||||
|
||||
typedef OpenHashTable<ApertureHashDefinition> ApertureHashTable;
|
||||
typedef BOpenHashTable<ApertureHashDefinition> ApertureHashTable;
|
||||
|
||||
|
||||
static agp_device_info sDeviceInfos[MAX_DEVICES];
|
||||
|
||||
@@ -76,7 +76,7 @@ FileSystem::~FileSystem()
|
||||
int32 count = 0;
|
||||
while (ops != NULL) {
|
||||
count++;
|
||||
VNodeOps* next = ops->fNext;
|
||||
VNodeOps* next = ops->hash_link;
|
||||
free(ops);
|
||||
ops = next;
|
||||
}
|
||||
|
||||
@@ -25,10 +25,11 @@ class Settings;
|
||||
class Volume;
|
||||
|
||||
|
||||
struct VNodeOps : HashTableLink<VNodeOps> {
|
||||
struct VNodeOps {
|
||||
int32 refCount;
|
||||
FSVNodeCapabilities capabilities;
|
||||
fs_vnode_ops* ops;
|
||||
VNodeOps* hash_link;
|
||||
|
||||
VNodeOps(const FSVNodeCapabilities& capabilities, fs_vnode_ops* ops)
|
||||
:
|
||||
@@ -55,8 +56,8 @@ struct VNodeOpsHashDefinition {
|
||||
{ return HashKey(value->capabilities); }
|
||||
bool Compare(const FSVNodeCapabilities& key, const VNodeOps* value) const
|
||||
{ return value->capabilities == key; }
|
||||
HashTableLink<VNodeOps>* GetLink(VNodeOps* value) const
|
||||
{ return value; }
|
||||
VNodeOps*& GetLink(VNodeOps* value) const
|
||||
{ return value->hash_link; }
|
||||
};
|
||||
|
||||
|
||||
@@ -109,7 +110,7 @@ private:
|
||||
friend class KernelDebug;
|
||||
struct SelectSyncEntry;
|
||||
struct SelectSyncMap;
|
||||
typedef OpenHashTable<VNodeOpsHashDefinition> VNodeOpsMap;
|
||||
typedef BOpenHashTable<VNodeOpsHashDefinition> VNodeOpsMap;
|
||||
|
||||
Vector<Volume*> fVolumes;
|
||||
mutex fVolumeLock;
|
||||
|
||||
@@ -47,7 +47,7 @@ static const bigtime_t kUserlandServerlandPortTimeout = 10000000; // 10s
|
||||
|
||||
|
||||
// VNode
|
||||
struct Volume::VNode : HashTableLink<VNode> {
|
||||
struct Volume::VNode {
|
||||
ino_t id;
|
||||
void* clientNode;
|
||||
void* fileCache;
|
||||
@@ -55,6 +55,7 @@ struct Volume::VNode : HashTableLink<VNode> {
|
||||
int32 useCount;
|
||||
bool valid;
|
||||
bool published;
|
||||
VNode* hash_link;
|
||||
|
||||
VNode(ino_t id, void* clientNode, VNodeOps* ops)
|
||||
:
|
||||
@@ -98,14 +99,14 @@ struct Volume::VNodeHashDefinition {
|
||||
{ return HashKey(value->id); }
|
||||
bool Compare(ino_t key, const VNode* value) const
|
||||
{ return value->id == key; }
|
||||
HashTableLink<VNode>* GetLink(VNode* value) const
|
||||
{ return value; }
|
||||
VNode*& GetLink(VNode* value) const
|
||||
{ return value->hash_link; }
|
||||
};
|
||||
|
||||
|
||||
// VNodeMap
|
||||
struct Volume::VNodeMap
|
||||
: public OpenHashTable<VNodeHashDefinition> {
|
||||
: public BOpenHashTable<VNodeHashDefinition> {
|
||||
};
|
||||
|
||||
|
||||
@@ -114,8 +115,8 @@ struct Volume::IORequestInfo {
|
||||
io_request* request;
|
||||
int32 id;
|
||||
|
||||
HashTableLink<IORequestInfo> idLink;
|
||||
HashTableLink<IORequestInfo> structLink;
|
||||
IORequestInfo* idLink;
|
||||
IORequestInfo* structLink;
|
||||
|
||||
IORequestInfo(io_request* request, int32 id)
|
||||
:
|
||||
@@ -137,8 +138,8 @@ struct Volume::IORequestIDHashDefinition {
|
||||
{ return HashKey(value->id); }
|
||||
bool Compare(int32 key, const IORequestInfo* value) const
|
||||
{ return value->id == key; }
|
||||
HashTableLink<IORequestInfo>* GetLink(IORequestInfo* value) const
|
||||
{ return &value->idLink; }
|
||||
IORequestInfo*& GetLink(IORequestInfo* value) const
|
||||
{ return value->idLink; }
|
||||
};
|
||||
|
||||
|
||||
@@ -153,20 +154,20 @@ struct Volume::IORequestStructHashDefinition {
|
||||
{ return HashKey(value->request); }
|
||||
bool Compare(io_request* key, const IORequestInfo* value) const
|
||||
{ return value->request == key; }
|
||||
HashTableLink<IORequestInfo>* GetLink(IORequestInfo* value) const
|
||||
{ return &value->structLink; }
|
||||
IORequestInfo*& GetLink(IORequestInfo* value) const
|
||||
{ return value->structLink; }
|
||||
};
|
||||
|
||||
|
||||
// IORequestIDMap
|
||||
struct Volume::IORequestIDMap
|
||||
: public OpenHashTable<IORequestIDHashDefinition> {
|
||||
: public BOpenHashTable<IORequestIDHashDefinition> {
|
||||
};
|
||||
|
||||
|
||||
// IORequestStructMap
|
||||
struct Volume::IORequestStructMap
|
||||
: public OpenHashTable<IORequestStructHashDefinition> {
|
||||
: public BOpenHashTable<IORequestStructHashDefinition> {
|
||||
};
|
||||
|
||||
|
||||
@@ -802,7 +803,7 @@ Volume::Unmount()
|
||||
if (fVNodes != NULL) {
|
||||
VNode* node = fVNodes->Clear(true);
|
||||
while (node != NULL) {
|
||||
VNode* nextNode = node->fNext;
|
||||
VNode* nextNode = node->hash_link;
|
||||
node->Delete(this);
|
||||
node = nextNode;
|
||||
}
|
||||
@@ -820,7 +821,7 @@ Volume::Unmount()
|
||||
if (fIORequestInfosByStruct != NULL) {
|
||||
IORequestInfo* info = fIORequestInfosByStruct->Clear(true);
|
||||
while (info != NULL) {
|
||||
IORequestInfo* nextInfo = info->structLink.fNext;
|
||||
IORequestInfo* nextInfo = info->structLink;
|
||||
delete info;
|
||||
info = nextInfo;
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@ struct FUSEEntryRef {
|
||||
};
|
||||
|
||||
|
||||
struct FUSEEntry : public HashTableLink<FUSEEntry>,
|
||||
DoublyLinkedListLinkImpl<FUSEEntry> {
|
||||
struct FUSEEntry : DoublyLinkedListLinkImpl<FUSEEntry> {
|
||||
FUSENode* parent;
|
||||
char* name;
|
||||
FUSENode* node;
|
||||
FUSEEntry* hashLink;
|
||||
|
||||
FUSEEntry()
|
||||
:
|
||||
@@ -77,12 +77,13 @@ struct FUSEEntry : public HashTableLink<FUSEEntry>,
|
||||
typedef DoublyLinkedList<FUSEEntry> FUSEEntryList;
|
||||
|
||||
|
||||
struct FUSENode : RWLockable, HashTableLink<FUSENode> {
|
||||
struct FUSENode : RWLockable {
|
||||
ino_t id;
|
||||
FUSEEntryList entries;
|
||||
int type;
|
||||
int32 refCount;
|
||||
bool dirty;
|
||||
FUSENode* hashLink;
|
||||
|
||||
FUSENode(ino_t id, int type)
|
||||
:
|
||||
@@ -113,8 +114,8 @@ struct FUSEEntryHashDefinition {
|
||||
bool Compare(const FUSEEntryRef& key, const FUSEEntry* value) const
|
||||
{ return value->parent->id == key.parentID
|
||||
&& strcmp(value->name, key.name) == 0; }
|
||||
HashTableLink<FUSEEntry>* GetLink(FUSEEntry* value) const
|
||||
{ return value; }
|
||||
FUSEEntry*& GetLink(FUSEEntry* value) const
|
||||
{ return value->hashLink; }
|
||||
};
|
||||
|
||||
|
||||
@@ -128,13 +129,13 @@ struct FUSENodeHashDefinition {
|
||||
{ return HashKey(value->id); }
|
||||
bool Compare(ino_t key, const FUSENode* value) const
|
||||
{ return value->id == key; }
|
||||
HashTableLink<FUSENode>* GetLink(FUSENode* value) const
|
||||
{ return value; }
|
||||
FUSENode*& GetLink(FUSENode* value) const
|
||||
{ return value->hashLink; }
|
||||
};
|
||||
|
||||
|
||||
typedef OpenHashTable<FUSEEntryHashDefinition> FUSEEntryTable;
|
||||
typedef OpenHashTable<FUSENodeHashDefinition> FUSENodeTable;
|
||||
typedef BOpenHashTable<FUSEEntryHashDefinition> FUSEEntryTable;
|
||||
typedef BOpenHashTable<FUSENodeHashDefinition> FUSENodeTable;
|
||||
|
||||
|
||||
} // namespace UserlandFS
|
||||
|
||||
@@ -32,15 +32,14 @@ struct HaikuKernelFileSystem::IORequestHashDefinition {
|
||||
{ return value->id; }
|
||||
bool Compare(int32 key, const HaikuKernelIORequest* value) const
|
||||
{ return value->id == key; }
|
||||
HashTableLink<HaikuKernelIORequest>*
|
||||
GetLink(HaikuKernelIORequest* value) const
|
||||
{ return value; }
|
||||
HaikuKernelIORequest*& GetLink(HaikuKernelIORequest* value) const
|
||||
{ return value->hashLink; }
|
||||
};
|
||||
|
||||
|
||||
// IORequestTable
|
||||
struct HaikuKernelFileSystem::IORequestTable
|
||||
: public OpenHashTable<IORequestHashDefinition> {
|
||||
: public BOpenHashTable<IORequestHashDefinition> {
|
||||
typedef int32 KeyType;
|
||||
typedef HaikuKernelIORequest ValueType;
|
||||
|
||||
@@ -50,9 +49,8 @@ struct HaikuKernelFileSystem::IORequestTable
|
||||
{ return value->id; }
|
||||
bool Compare(int32 key, const HaikuKernelIORequest* value) const
|
||||
{ return value->id == key; }
|
||||
HashTableLink<HaikuKernelIORequest>*
|
||||
GetLink(HaikuKernelIORequest* value) const
|
||||
{ return value; }
|
||||
HaikuKernelIORequest*& GetLink(HaikuKernelIORequest* value) const
|
||||
{ return value->hashLink; }
|
||||
};
|
||||
|
||||
|
||||
@@ -67,14 +65,14 @@ struct HaikuKernelFileSystem::NodeCapabilitiesHashDefinition {
|
||||
{ return HashKey(value->ops); }
|
||||
bool Compare(fs_vnode_ops* key, const ValueType* value) const
|
||||
{ return value->ops == key; }
|
||||
HashTableLink<ValueType>* GetLink(ValueType* value) const
|
||||
{ return value; }
|
||||
ValueType*& GetLink(ValueType* value) const
|
||||
{ return value->hashLink; }
|
||||
};
|
||||
|
||||
|
||||
// NodeCapabilitiesTable
|
||||
struct HaikuKernelFileSystem::NodeCapabilitiesTable
|
||||
: public OpenHashTable<NodeCapabilitiesHashDefinition> {
|
||||
: public BOpenHashTable<NodeCapabilitiesHashDefinition> {
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace UserlandFS {
|
||||
|
||||
class HaikuKernelVolume;
|
||||
|
||||
struct HaikuKernelIORequest : HashTableLink<HaikuKernelIORequest>,
|
||||
IORequestInfo {
|
||||
struct HaikuKernelIORequest : IORequestInfo {
|
||||
|
||||
HaikuKernelVolume* volume;
|
||||
int32 refCount;
|
||||
HaikuKernelVolume* volume;
|
||||
int32 refCount;
|
||||
HaikuKernelIORequest* hashLink;
|
||||
|
||||
HaikuKernelIORequest(HaikuKernelVolume* volume, const IORequestInfo& info)
|
||||
:
|
||||
|
||||
@@ -41,10 +41,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
struct HaikuKernelNode::Capabilities : HashTableLink<Capabilities> {
|
||||
struct HaikuKernelNode::Capabilities {
|
||||
int32 refCount;
|
||||
fs_vnode_ops* ops;
|
||||
FSVNodeCapabilities capabilities;
|
||||
Capabilities* hashLink;
|
||||
|
||||
Capabilities(fs_vnode_ops* ops, FSVNodeCapabilities capabilities)
|
||||
:
|
||||
|
||||
@@ -150,7 +150,7 @@ struct MulticastStateHash {
|
||||
bool CompareValues(ValueType* value1, ValueType* value2) const
|
||||
{ return value1->Interface()->index == value2->Interface()->index
|
||||
&& value1->Address().s_addr == value2->Address().s_addr; }
|
||||
HashTableLink<ValueType>* GetLink(ValueType* value) const { return value; }
|
||||
ValueType*& GetLink(ValueType* value) const { return value->HashLink(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -126,11 +126,9 @@ private:
|
||||
|
||||
|
||||
template<typename Addressing>
|
||||
class MulticastGroupInterface
|
||||
: public HashTableLink< MulticastGroupInterface<Addressing> > {
|
||||
class MulticastGroupInterface {
|
||||
public:
|
||||
typedef MulticastGroupInterface<Addressing> ThisType;
|
||||
typedef HashTableLink<ThisType> HashLink;
|
||||
typedef typename Addressing::AddressType AddressType;
|
||||
typedef MulticastFilter<Addressing> Filter;
|
||||
typedef ::AddressSet<AddressType> AddressSet;
|
||||
@@ -176,9 +174,12 @@ public:
|
||||
bool Compare(const KeyType &key, ValueType *value) const
|
||||
{ return value->Interface()->index == key.second
|
||||
&& value->Address().s_addr == key.first->s_addr; }
|
||||
HashLink *GetLink(ValueType *value) const { return &value->fLink; }
|
||||
MulticastGroupInterface*& GetLink(ValueType *value) const
|
||||
{ return value->HashLink(); }
|
||||
};
|
||||
|
||||
MulticastGroupInterface*& HashLink() { return fLink; }
|
||||
|
||||
private:
|
||||
// for g++ 2.95
|
||||
friend class HashDefinition;
|
||||
@@ -188,7 +189,7 @@ private:
|
||||
net_interface *fInterface;
|
||||
FilterMode fFilterMode;
|
||||
AddressSet fAddresses;
|
||||
HashLink fLink;
|
||||
MulticastGroupInterface* fLink;
|
||||
};
|
||||
|
||||
template<typename Addressing>
|
||||
@@ -209,7 +210,7 @@ public:
|
||||
|
||||
private:
|
||||
typedef typename GroupInterface::HashDefinition HashDefinition;
|
||||
typedef OpenHashTable<HashDefinition> States;
|
||||
typedef BOpenHashTable<HashDefinition> States;
|
||||
|
||||
void _ReturnState(GroupInterface *state);
|
||||
|
||||
|
||||
@@ -165,10 +165,10 @@ ConnectionHashDefinition::Compare(const KeyType& key,
|
||||
}
|
||||
|
||||
|
||||
HashTableLink<TCPEndpoint>*
|
||||
TCPEndpoint*&
|
||||
ConnectionHashDefinition::GetLink(TCPEndpoint* endpoint) const
|
||||
{
|
||||
return &endpoint->fConnectionHashLink;
|
||||
return endpoint->fConnectionHashLink;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,10 +204,10 @@ EndpointHashDefinition::CompareValues(TCPEndpoint* first,
|
||||
}
|
||||
|
||||
|
||||
HashTableLink<TCPEndpoint>*
|
||||
TCPEndpoint*&
|
||||
EndpointHashDefinition::GetLink(TCPEndpoint* endpoint) const
|
||||
{
|
||||
return &endpoint->fEndpointHashLink;
|
||||
return endpoint->fEndpointHashLink;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
size_t Hash(TCPEndpoint* endpoint) const;
|
||||
bool Compare(const KeyType& key,
|
||||
TCPEndpoint* endpoint) const;
|
||||
HashTableLink<TCPEndpoint>* GetLink(TCPEndpoint* endpoint) const;
|
||||
TCPEndpoint*& GetLink(TCPEndpoint* endpoint) const;
|
||||
|
||||
private:
|
||||
EndpointManager* fManager;
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
bool Compare(uint16 port, TCPEndpoint* endpoint) const;
|
||||
bool CompareValues(TCPEndpoint* first,
|
||||
TCPEndpoint* second) const;
|
||||
HashTableLink<TCPEndpoint>* GetLink(TCPEndpoint* endpoint) const;
|
||||
TCPEndpoint*& GetLink(TCPEndpoint* endpoint) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ private:
|
||||
status_t _BindToEphemeral(TCPEndpoint* endpoint,
|
||||
const sockaddr* address);
|
||||
|
||||
typedef OpenHashTable<ConnectionHashDefinition> ConnectionTable;
|
||||
typedef BOpenHashTable<ConnectionHashDefinition> ConnectionTable;
|
||||
typedef MultiHashTable<EndpointHashDefinition> EndpointTable;
|
||||
|
||||
rw_lock fLock;
|
||||
|
||||
@@ -133,8 +133,8 @@ private:
|
||||
void* _endpoint);
|
||||
|
||||
private:
|
||||
HashTableLink<TCPEndpoint> fConnectionHashLink;
|
||||
HashTableLink<TCPEndpoint> fEndpointHashLink;
|
||||
TCPEndpoint* fConnectionHashLink;
|
||||
TCPEndpoint* fEndpointHashLink;
|
||||
friend class EndpointManager;
|
||||
friend class ConnectionHashDefinition;
|
||||
friend class EndpointHashDefinition;
|
||||
|
||||
@@ -96,15 +96,15 @@ public:
|
||||
bool IsActive() const { return fActive; }
|
||||
void SetActive(bool newValue) { fActive = newValue; }
|
||||
|
||||
::HashTableLink<UdpEndpoint> *HashTableLink() { return &fLink; }
|
||||
UdpEndpoint *&HashTableLink() { return fLink; }
|
||||
|
||||
private:
|
||||
UdpDomainSupport *fManager;
|
||||
bool fActive;
|
||||
// an active UdpEndpoint is part of the endpoint
|
||||
// an active UdpEndpoint is part of the endpoint
|
||||
// hash (and it is bound and optionally connected)
|
||||
|
||||
::HashTableLink<UdpEndpoint> fLink;
|
||||
UdpEndpoint *fLink;
|
||||
};
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ struct UdpHashDefinition {
|
||||
&& endpoint->PeerAddress().EqualTo(key.second, true);
|
||||
}
|
||||
|
||||
::HashTableLink<UdpEndpoint> *GetLink(UdpEndpoint *endpoint) const
|
||||
UdpEndpoint *&GetLink(UdpEndpoint *endpoint) const
|
||||
{
|
||||
return endpoint->HashTableLink();
|
||||
}
|
||||
@@ -189,7 +189,7 @@ private:
|
||||
net_address_module_info *AddressModule() const
|
||||
{ return fDomain->address_module; }
|
||||
|
||||
typedef OpenHashTable<UdpHashDefinition, false> EndpointTable;
|
||||
typedef BOpenHashTable<UdpHashDefinition, false> EndpointTable;
|
||||
|
||||
mutex fLock;
|
||||
net_domain *fDomain;
|
||||
|
||||
@@ -31,7 +31,7 @@ struct UnixAddressHashDefinition {
|
||||
return key == endpoint->Address();
|
||||
}
|
||||
|
||||
HashTableLink<UnixEndpoint>* GetLink(UnixEndpoint* endpoint) const
|
||||
UnixEndpoint*& GetLink(UnixEndpoint* endpoint) const
|
||||
{
|
||||
return endpoint->HashTableLink();
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
typedef OpenHashTable<UnixAddressHashDefinition, false> EndpointTable;
|
||||
typedef BOpenHashTable<UnixAddressHashDefinition, false> EndpointTable;
|
||||
|
||||
mutex fLock;
|
||||
EndpointTable fBoundEndpoints;
|
||||
|
||||
@@ -90,9 +90,9 @@ public:
|
||||
return fAddress;
|
||||
}
|
||||
|
||||
::HashTableLink<UnixEndpoint>* HashTableLink()
|
||||
UnixEndpoint*& HashTableLink()
|
||||
{
|
||||
return &fAddressHashLink;
|
||||
return fAddressHashLink;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
private:
|
||||
mutex fLock;
|
||||
UnixAddress fAddress;
|
||||
::HashTableLink<UnixEndpoint> fAddressHashLink;
|
||||
UnixEndpoint* fAddressHashLink;
|
||||
UnixEndpoint* fPeerEndpoint;
|
||||
UnixFifo* fReceiveFifo;
|
||||
unix_endpoint_state fState;
|
||||
|
||||
@@ -34,7 +34,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class SubWindow : public BWindow, public HashTableLink<SubWindow> {
|
||||
class SubWindow : public BWindow {
|
||||
public:
|
||||
SubWindow(SubWindowManager* manager,
|
||||
BRect frame, const char* title,
|
||||
@@ -50,6 +50,9 @@ public:
|
||||
protected:
|
||||
SubWindowManager* fSubWindowManager;
|
||||
SubWindowKey* fSubWindowKey;
|
||||
|
||||
public:
|
||||
SubWindow* fNext;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -49,13 +49,13 @@ private:
|
||||
return key.Equals(value->GetSubWindowKey());
|
||||
}
|
||||
|
||||
HashTableLink<SubWindow>* GetLink(SubWindow* value) const
|
||||
SubWindow*& GetLink(SubWindow* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
typedef OpenHashTable<HashDefinition> SubWindowTable;
|
||||
typedef BOpenHashTable<HashDefinition> SubWindowTable;
|
||||
|
||||
private:
|
||||
BLooper* fParent;
|
||||
|
||||
@@ -130,7 +130,7 @@ ModelLoader::FinishLoading(bool success)
|
||||
{
|
||||
ThreadInfo* threadInfo = fThreads.Clear(true);
|
||||
while (threadInfo != NULL) {
|
||||
ThreadInfo* nextInfo = threadInfo->fNext;
|
||||
ThreadInfo* nextInfo = threadInfo->next;
|
||||
delete threadInfo;
|
||||
threadInfo = nextInfo;
|
||||
}
|
||||
|
||||
@@ -44,11 +44,12 @@ private:
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
struct ThreadInfo : HashTableLink<ThreadInfo> {
|
||||
struct ThreadInfo {
|
||||
Model::Thread* thread;
|
||||
ScheduleState state;
|
||||
bigtime_t lastTime;
|
||||
Model::ThreadWaitObject* waitObject;
|
||||
ThreadInfo* next;
|
||||
|
||||
ThreadInfo(Model::Thread* thread);
|
||||
|
||||
@@ -68,11 +69,11 @@ private:
|
||||
bool Compare(thread_id key, const ThreadInfo* value) const
|
||||
{ return key == value->ID(); }
|
||||
|
||||
HashTableLink<ThreadInfo>* GetLink(ThreadInfo* value) const
|
||||
{ return value; }
|
||||
ThreadInfo*& GetLink(ThreadInfo* value) const
|
||||
{ return value->next; }
|
||||
};
|
||||
|
||||
typedef OpenHashTable<ThreadTableDefinition> ThreadTable;
|
||||
typedef BOpenHashTable<ThreadTableDefinition> ThreadTable;
|
||||
|
||||
// shorthands for the longish structure names
|
||||
typedef system_profiler_thread_enqueued_in_run_queue
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
struct TeamDebugger::ImageHandler : public Referenceable,
|
||||
public HashTableLink<ImageHandler>, private LocatableFile::Listener {
|
||||
private LocatableFile::Listener {
|
||||
public:
|
||||
ImageHandler(TeamDebugger* teamDebugger, Image* image)
|
||||
:
|
||||
@@ -85,6 +85,9 @@ private:
|
||||
private:
|
||||
TeamDebugger* fTeamDebugger;
|
||||
Image* fImage;
|
||||
|
||||
public:
|
||||
ImageHandler* fNext;
|
||||
};
|
||||
|
||||
|
||||
@@ -110,9 +113,9 @@ struct TeamDebugger::ImageHandlerHashDefinition {
|
||||
return value->ImageID() == key;
|
||||
}
|
||||
|
||||
HashTableLink<ImageHandler>* GetLink(ImageHandler* value) const
|
||||
ImageHandler*& GetLink(ImageHandler* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
private:
|
||||
struct ImageHandler;
|
||||
struct ImageHandlerHashDefinition;
|
||||
typedef OpenHashTable<ImageHandlerHashDefinition> ImageHandlerTable;
|
||||
typedef BOpenHashTable<ImageHandlerHashDefinition> ImageHandlerTable;
|
||||
|
||||
private:
|
||||
static status_t _DebugEventListenerEntry(void* data);
|
||||
|
||||
@@ -22,8 +22,7 @@ class Statement;
|
||||
class Worker;
|
||||
|
||||
|
||||
class ThreadHandler : public Referenceable,
|
||||
public HashTableLink<ThreadHandler>, private ImageDebugInfoProvider,
|
||||
class ThreadHandler : public Referenceable, private ImageDebugInfoProvider,
|
||||
private BreakpointClient {
|
||||
public:
|
||||
ThreadHandler(Thread* thread, Worker* worker,
|
||||
@@ -98,6 +97,9 @@ private:
|
||||
target_addr_t fBreakpointAddress;
|
||||
target_addr_t fPreviousInstructionPointer;
|
||||
bool fSingleStepping;
|
||||
|
||||
public:
|
||||
ThreadHandler* fNext;
|
||||
};
|
||||
|
||||
|
||||
@@ -120,13 +122,13 @@ struct ThreadHandlerHashDefinition {
|
||||
return value->ThreadID() == key;
|
||||
}
|
||||
|
||||
HashTableLink<ThreadHandler>* GetLink(ThreadHandler* value) const
|
||||
ThreadHandler*& GetLink(ThreadHandler* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
typedef OpenHashTable<ThreadHandlerHashDefinition> ThreadHandlerTable;
|
||||
typedef BOpenHashTable<ThreadHandlerHashDefinition> ThreadHandlerTable;
|
||||
|
||||
|
||||
#endif // THREAD_HANDLER_H
|
||||
|
||||
@@ -241,7 +241,7 @@ Worker::ShutDown()
|
||||
// abort all jobs
|
||||
Job* job = fJobs.Clear(true);
|
||||
while (job != NULL) {
|
||||
Job* nextJob = static_cast<HashTableLink<Job>*>(job)->fNext;
|
||||
Job* nextJob = job->fNext;
|
||||
_AbortJob(job, false);
|
||||
job = nextJob;
|
||||
|
||||
|
||||
@@ -75,8 +75,7 @@ public:
|
||||
typedef DoublyLinkedList<Job> JobList;
|
||||
|
||||
|
||||
class Job : public Referenceable, public DoublyLinkedListLinkImpl<Job>,
|
||||
public HashTableLink<Job> {
|
||||
class Job : public Referenceable, public DoublyLinkedListLinkImpl<Job> {
|
||||
public:
|
||||
Job();
|
||||
virtual ~Job();
|
||||
@@ -119,6 +118,9 @@ private:
|
||||
JobList fDependentJobs;
|
||||
job_wait_status fWaitStatus;
|
||||
ListenerList fListeners;
|
||||
|
||||
public:
|
||||
Job* fNext;
|
||||
};
|
||||
|
||||
|
||||
@@ -161,18 +163,18 @@ private:
|
||||
return HashKey(value->Key());
|
||||
}
|
||||
|
||||
bool Compare(const JobKey& key, Job *value) const
|
||||
bool Compare(const JobKey& key, Job* value) const
|
||||
{
|
||||
return value->Key() == key;
|
||||
}
|
||||
|
||||
HashTableLink<Job>* GetLink(Job* value) const
|
||||
Job*& GetLink(Job* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
typedef OpenHashTable<JobHashDefinition> JobTable;
|
||||
typedef BOpenHashTable<JobHashDefinition> JobTable;
|
||||
|
||||
private:
|
||||
job_wait_status WaitForJob(Job* waitingJob, const JobKey& key);
|
||||
|
||||
@@ -115,8 +115,7 @@ private:
|
||||
// #pragma mark - DwarfType
|
||||
|
||||
|
||||
struct DwarfInterfaceFactory::DwarfType : virtual Type,
|
||||
HashTableLink<DwarfType> {
|
||||
struct DwarfInterfaceFactory::DwarfType : virtual Type {
|
||||
public:
|
||||
DwarfType(const BString& name)
|
||||
:
|
||||
@@ -143,8 +142,11 @@ public:
|
||||
virtual DIEType* GetDIEType() const = 0;
|
||||
|
||||
private:
|
||||
BString fName;
|
||||
uint64 fByteSize;
|
||||
BString fName;
|
||||
uint64 fByteSize;
|
||||
|
||||
public:
|
||||
DwarfType* fNext;
|
||||
};
|
||||
|
||||
|
||||
@@ -487,9 +489,9 @@ struct DwarfInterfaceFactory::DwarfTypeHashDefinition {
|
||||
return key == value->GetDIEType();
|
||||
}
|
||||
|
||||
HashTableLink<DwarfType>* GetLink(DwarfType* value) const
|
||||
DwarfType*& GetLink(DwarfType* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
struct DwarfArrayType;
|
||||
struct DwarfTypeHashDefinition;
|
||||
|
||||
typedef OpenHashTable<DwarfTypeHashDefinition> TypeTable;
|
||||
typedef BOpenHashTable<DwarfTypeHashDefinition> TypeTable;
|
||||
|
||||
private:
|
||||
status_t _CreateType(DIEType* typeEntry,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class FileSourceCode;
|
||||
|
||||
|
||||
class Function : public Referenceable, public HashTableLink<Function> {
|
||||
class Function : public Referenceable {
|
||||
public:
|
||||
class Listener;
|
||||
|
||||
@@ -69,6 +69,10 @@ private:
|
||||
function_source_state fSourceCodeState;
|
||||
ListenerList fListeners;
|
||||
int32 fNotificationsDisabled;
|
||||
|
||||
public:
|
||||
// BOpenHashTable support
|
||||
Function* fNext;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ struct TeamDebugInfo::FunctionHashDefinition {
|
||||
&& key->Name() == value->Name();
|
||||
}
|
||||
|
||||
HashTableLink<Function>* GetLink(Function* value) const
|
||||
Function*& GetLink(Function* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ struct TeamDebugInfo::FunctionHashDefinition {
|
||||
// #pragma mark - SourceFileEntry
|
||||
|
||||
|
||||
struct TeamDebugInfo::SourceFileEntry : public HashTableLink<SourceFileEntry> {
|
||||
struct TeamDebugInfo::SourceFileEntry {
|
||||
SourceFileEntry(LocatableFile* sourceFile)
|
||||
:
|
||||
fSourceFile(sourceFile),
|
||||
@@ -207,9 +207,12 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
LocatableFile* fSourceFile;
|
||||
FileSourceCode* fSourceCode;
|
||||
FunctionList fFunctions;
|
||||
LocatableFile* fSourceFile;
|
||||
FileSourceCode* fSourceCode;
|
||||
FunctionList fFunctions;
|
||||
|
||||
public:
|
||||
SourceFileEntry* fNext;
|
||||
};
|
||||
|
||||
|
||||
@@ -235,9 +238,9 @@ struct TeamDebugInfo::SourceFileHashDefinition {
|
||||
return key == value->SourceFile();
|
||||
}
|
||||
|
||||
HashTableLink<SourceFileEntry>* GetLink(SourceFileEntry* value) const
|
||||
SourceFileEntry*& GetLink(SourceFileEntry* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -71,8 +71,8 @@ private:
|
||||
|
||||
typedef BObjectList<SpecificTeamDebugInfo> SpecificInfoList;
|
||||
typedef BObjectList<ImageDebugInfo> ImageList;
|
||||
typedef OpenHashTable<FunctionHashDefinition> FunctionTable;
|
||||
typedef OpenHashTable<SourceFileHashDefinition> SourceFileTable;
|
||||
typedef BOpenHashTable<FunctionHashDefinition> FunctionTable;
|
||||
typedef BOpenHashTable<SourceFileHashDefinition> SourceFileTable;
|
||||
|
||||
private:
|
||||
status_t _AddFunction(Function* function);
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
#include "Dwarf.h"
|
||||
|
||||
|
||||
struct AbbreviationTableEntry : HashTableLink<AbbreviationTableEntry> {
|
||||
uint32 code;
|
||||
off_t offset;
|
||||
off_t size;
|
||||
struct AbbreviationTableEntry {
|
||||
uint32 code;
|
||||
off_t offset;
|
||||
off_t size;
|
||||
AbbreviationTableEntry* next;
|
||||
|
||||
AbbreviationTableEntry(uint32 code, off_t offset, off_t size)
|
||||
:
|
||||
@@ -88,10 +89,9 @@ struct AbbreviationTableHashDefinition {
|
||||
return value->code == key;
|
||||
}
|
||||
|
||||
HashTableLink<AbbreviationTableEntry>* GetLink(
|
||||
AbbreviationTableEntry* value) const
|
||||
AbbreviationTableEntry*& GetLink(AbbreviationTableEntry* value) const
|
||||
{
|
||||
return value;
|
||||
return value->next;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
AbbreviationEntry& entry);
|
||||
|
||||
private:
|
||||
typedef OpenHashTable<AbbreviationTableHashDefinition> EntryTable;
|
||||
typedef BOpenHashTable<AbbreviationTableHashDefinition> EntryTable;
|
||||
|
||||
private:
|
||||
status_t _ParseAbbreviationEntry(
|
||||
|
||||
@@ -92,9 +92,9 @@ struct FileManager::EntryHashDefinition {
|
||||
return EntryPath(value) == key;
|
||||
}
|
||||
|
||||
HashTableLink<LocatableEntry>* GetLink(LocatableEntry* value) const
|
||||
LocatableEntry*& GetLink(LocatableEntry* value) const
|
||||
{
|
||||
return value;
|
||||
return value->fNext;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -459,12 +459,12 @@ private:
|
||||
// #pragma mark - SourceFileEntry
|
||||
|
||||
|
||||
struct FileManager::SourceFileEntry : public SourceFileOwner,
|
||||
public HashTableLink<SourceFileEntry> {
|
||||
struct FileManager::SourceFileEntry : public SourceFileOwner {
|
||||
|
||||
FileManager* manager;
|
||||
BString path;
|
||||
SourceFile* file;
|
||||
FileManager* manager;
|
||||
BString path;
|
||||
SourceFile* file;
|
||||
SourceFileEntry* next;
|
||||
|
||||
SourceFileEntry(FileManager* manager, const BString& path)
|
||||
:
|
||||
@@ -509,9 +509,9 @@ struct FileManager::SourceFileHashDefinition {
|
||||
return value->path == key;
|
||||
}
|
||||
|
||||
HashTableLink<SourceFileEntry>* GetLink(SourceFileEntry* value) const
|
||||
SourceFileEntry*& GetLink(SourceFileEntry* value) const
|
||||
{
|
||||
return value;
|
||||
return value->next;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ private:
|
||||
struct SourceFileEntry;
|
||||
struct SourceFileHashDefinition;
|
||||
|
||||
typedef OpenHashTable<EntryHashDefinition> LocatableEntryTable;
|
||||
typedef OpenHashTable<SourceFileHashDefinition> SourceFileTable;
|
||||
typedef BOpenHashTable<EntryHashDefinition> LocatableEntryTable;
|
||||
typedef BOpenHashTable<SourceFileHashDefinition> SourceFileTable;
|
||||
|
||||
friend struct SourceFileEntry;
|
||||
// for gcc 2
|
||||
|
||||
@@ -35,8 +35,7 @@ public:
|
||||
|
||||
|
||||
class LocatableEntry : public Referenceable,
|
||||
public DoublyLinkedListLinkImpl<LocatableEntry>,
|
||||
public HashTableLink<LocatableEntry> {
|
||||
public DoublyLinkedListLinkImpl<LocatableEntry> {
|
||||
public:
|
||||
LocatableEntry(LocatableEntryOwner* owner,
|
||||
LocatableDirectory* parent);
|
||||
@@ -58,6 +57,9 @@ protected:
|
||||
LocatableEntryOwner* fOwner;
|
||||
LocatableDirectory* fParent;
|
||||
locatable_entry_state fState;
|
||||
|
||||
public:
|
||||
LocatableEntry* fNext;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -35,8 +35,9 @@ struct StackFrameValues::Key {
|
||||
};
|
||||
|
||||
|
||||
struct StackFrameValues::ValueEntry : Key, HashTableLink<ValueEntry> {
|
||||
struct StackFrameValues::ValueEntry : Key {
|
||||
BVariant value;
|
||||
ValueEntry* next;
|
||||
|
||||
ValueEntry(ObjectID* variable, TypeComponentPath* path)
|
||||
:
|
||||
@@ -73,9 +74,9 @@ struct StackFrameValues::ValueEntryHashDefinition {
|
||||
return key == *value;
|
||||
}
|
||||
|
||||
HashTableLink<ValueEntry>* GetLink(ValueEntry* value) const
|
||||
ValueEntry*& GetLink(ValueEntry* value) const
|
||||
{
|
||||
return value;
|
||||
return value->next;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -172,7 +173,7 @@ StackFrameValues::_Cleanup()
|
||||
ValueEntry* entry = fValues->Clear(true);
|
||||
|
||||
while (entry != NULL) {
|
||||
ValueEntry* next = entry->fNext;
|
||||
ValueEntry* next = entry->next;
|
||||
delete entry;
|
||||
entry = next;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
struct ValueEntry;
|
||||
struct ValueEntryHashDefinition;
|
||||
|
||||
typedef OpenHashTable<ValueEntryHashDefinition> ValueTable;
|
||||
typedef BOpenHashTable<ValueEntryHashDefinition> ValueTable;
|
||||
|
||||
private:
|
||||
StackFrameValues& operator=(const StackFrameValues& other);
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <agg_array.h>
|
||||
|
||||
#include <util/OpenHashTable.h>
|
||||
|
||||
#include <Autolock.h>
|
||||
|
||||
#include "utf8_functions.h"
|
||||
@@ -52,7 +54,7 @@ public:
|
||||
{
|
||||
GlyphCache* glyph = fGlyphTable.Clear(true);
|
||||
while (glyph != NULL) {
|
||||
GlyphCache* next = glyph->fNext;
|
||||
GlyphCache* next = glyph->hash_link;
|
||||
delete glyph;
|
||||
glyph = next;
|
||||
}
|
||||
@@ -111,13 +113,13 @@ private:
|
||||
return value->glyph_index == key;
|
||||
}
|
||||
|
||||
HashTableLink<GlyphCache>* GetLink(GlyphCache* value) const
|
||||
GlyphCache*& GetLink(GlyphCache* value) const
|
||||
{
|
||||
return value;
|
||||
return value->hash_link;
|
||||
}
|
||||
};
|
||||
|
||||
typedef OpenHashTable<GlyphHashTableDefinition> GlyphTable;
|
||||
typedef BOpenHashTable<GlyphHashTableDefinition> GlyphTable;
|
||||
|
||||
GlyphTable fGlyphTable;
|
||||
};
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#include <agg_conv_contour.h>
|
||||
#include <agg_conv_transform.h>
|
||||
|
||||
#include <util/OpenHashTable.h>
|
||||
|
||||
#include "ServerFont.h"
|
||||
#include "FontEngine.h"
|
||||
#include "MultiLocker.h"
|
||||
@@ -42,7 +40,7 @@
|
||||
#include "Transformable.h"
|
||||
|
||||
|
||||
struct GlyphCache : public HashTableLink<GlyphCache> {
|
||||
struct GlyphCache {
|
||||
GlyphCache(uint32 glyphIndex, uint32 dataSize, glyph_data_type dataType,
|
||||
const agg::rect_i& bounds, float advanceX, float advanceY,
|
||||
float insetLeft, float insetRight)
|
||||
@@ -73,6 +71,8 @@ struct GlyphCache : public HashTableLink<GlyphCache> {
|
||||
float advance_y;
|
||||
float inset_left;
|
||||
float inset_right;
|
||||
|
||||
GlyphCache* hash_link;
|
||||
};
|
||||
|
||||
class FontCache;
|
||||
|
||||
@@ -36,11 +36,11 @@ struct ConditionVariableHashDefinition {
|
||||
{ return (size_t)variable->fObject; }
|
||||
bool Compare(const void* key, ConditionVariable* variable) const
|
||||
{ return key == variable->fObject; }
|
||||
HashTableLink<ConditionVariable>* GetLink(ConditionVariable* variable) const
|
||||
{ return variable; }
|
||||
ConditionVariable*& GetLink(ConditionVariable* variable) const
|
||||
{ return variable->fNext; }
|
||||
};
|
||||
|
||||
typedef OpenHashTable<ConditionVariableHashDefinition> ConditionVariableHash;
|
||||
typedef BOpenHashTable<ConditionVariableHashDefinition> ConditionVariableHash;
|
||||
static ConditionVariableHash sConditionVariableHash;
|
||||
static spinlock sConditionVariablesLock;
|
||||
|
||||
|
||||
@@ -126,7 +126,8 @@ private:
|
||||
};
|
||||
|
||||
struct WaitObject : DoublyLinkedListLinkImpl<WaitObject>,
|
||||
HashTableLink<WaitObject>, WaitObjectKey {
|
||||
WaitObjectKey {
|
||||
struct WaitObject* hash_link;
|
||||
};
|
||||
|
||||
struct WaitObjectTableDefinition {
|
||||
@@ -150,14 +151,14 @@ private:
|
||||
&& value->object == key.object;
|
||||
}
|
||||
|
||||
HashTableLink<WaitObject>* GetLink(WaitObject* value) const
|
||||
WaitObject*& GetLink(WaitObject* value) const
|
||||
{
|
||||
return value;
|
||||
return value->hash_link;
|
||||
}
|
||||
};
|
||||
|
||||
typedef DoublyLinkedList<WaitObject> WaitObjectList;
|
||||
typedef OpenHashTable<WaitObjectTableDefinition> WaitObjectTable;
|
||||
typedef BOpenHashTable<WaitObjectTableDefinition> WaitObjectTable;
|
||||
|
||||
private:
|
||||
spinlock fLock;
|
||||
|
||||
@@ -87,12 +87,12 @@ struct IOScheduler::RequestOwnerHashDefinition {
|
||||
size_t Hash(const IORequestOwner* value) const { return value->thread; }
|
||||
bool Compare(thread_id key, const IORequestOwner* value) const
|
||||
{ return value->thread == key; }
|
||||
HashTableLink<IORequestOwner>* GetLink(IORequestOwner* value) const
|
||||
{ return value; }
|
||||
IORequestOwner*& GetLink(IORequestOwner* value) const
|
||||
{ return value->hash_link; }
|
||||
};
|
||||
|
||||
struct IOScheduler::RequestOwnerHashTable
|
||||
: OpenHashTable<RequestOwnerHashDefinition, false> {
|
||||
: BOpenHashTable<RequestOwnerHashDefinition, false> {
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@ public:
|
||||
typedef status_t (*io_callback)(void* data, io_operation* operation);
|
||||
|
||||
|
||||
struct IORequestOwner : DoublyLinkedListLinkImpl<IORequestOwner>,
|
||||
HashTableLink<IORequestOwner> {
|
||||
struct IORequestOwner : DoublyLinkedListLinkImpl<IORequestOwner> {
|
||||
team_id team;
|
||||
thread_id thread;
|
||||
int32 priority;
|
||||
IORequestList requests;
|
||||
IORequestList completed_requests;
|
||||
IOOperationList operations;
|
||||
IORequestOwner* hash_link;
|
||||
|
||||
bool IsActive() const
|
||||
{ return !requests.IsEmpty()
|
||||
|
||||
@@ -120,8 +120,8 @@ struct driver_entry : public DoublyLinkedListLinkImpl<driver_entry> {
|
||||
typedef DoublyLinkedList<driver_entry> DriverEntryList;
|
||||
|
||||
struct directory_node_entry {
|
||||
HashTableLink<directory_node_entry> link;
|
||||
ino_t node;
|
||||
directory_node_entry* hash_link;
|
||||
ino_t node;
|
||||
};
|
||||
|
||||
struct DirectoryNodeHashDefinition {
|
||||
@@ -134,15 +134,15 @@ struct DirectoryNodeHashDefinition {
|
||||
{ return _Hash(entry->node); }
|
||||
bool Compare(ino_t* key, directory_node_entry* entry) const
|
||||
{ return *key == entry->node; }
|
||||
HashTableLink<directory_node_entry>*
|
||||
directory_node_entry*&
|
||||
GetLink(directory_node_entry* entry) const
|
||||
{ return &entry->link; }
|
||||
{ return entry->hash_link; }
|
||||
|
||||
uint32 _Hash(ino_t node) const
|
||||
{ return (uint32)(node >> 32) + (uint32)node; }
|
||||
};
|
||||
|
||||
typedef OpenHashTable<DirectoryNodeHashDefinition> DirectoryNodeHash;
|
||||
typedef BOpenHashTable<DirectoryNodeHashDefinition> DirectoryNodeHash;
|
||||
|
||||
class DirectoryIterator {
|
||||
public:
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef DoublyLinkedList<monitor_listener, DoublyLinkedListMemberGetLink<
|
||||
monitor_listener, &monitor_listener::monitor_link> > MonitorListenerList;
|
||||
|
||||
struct node_monitor {
|
||||
HashTableLink<node_monitor> link;
|
||||
node_monitor* hash_link;
|
||||
dev_t device;
|
||||
ino_t node;
|
||||
MonitorListenerList listeners;
|
||||
@@ -164,9 +164,8 @@ class NodeMonitorService : public NotificationService {
|
||||
&& key->node == monitor->node;
|
||||
}
|
||||
|
||||
HashTableLink<node_monitor>* GetLink(
|
||||
node_monitor* monitor) const
|
||||
{ return &monitor->link; }
|
||||
node_monitor*& GetLink(node_monitor* monitor) const
|
||||
{ return monitor->hash_link; }
|
||||
|
||||
uint32 _Hash(dev_t device, ino_t node) const
|
||||
{
|
||||
@@ -174,7 +173,7 @@ class NodeMonitorService : public NotificationService {
|
||||
}
|
||||
};
|
||||
|
||||
typedef OpenHashTable<HashDefinition> MonitorHash;
|
||||
typedef BOpenHashTable<HashDefinition> MonitorHash;
|
||||
MonitorHash fMonitors;
|
||||
recursive_lock fRecursiveLock;
|
||||
};
|
||||
|
||||
@@ -123,11 +123,11 @@ struct EntryCacheKey {
|
||||
};
|
||||
|
||||
|
||||
struct EntryCacheEntry : HashTableLink<EntryCacheEntry>,
|
||||
DoublyLinkedListLinkImpl<EntryCacheEntry> {
|
||||
ino_t node_id;
|
||||
ino_t dir_id;
|
||||
char name[1];
|
||||
struct EntryCacheEntry : DoublyLinkedListLinkImpl<EntryCacheEntry> {
|
||||
EntryCacheEntry* hash_link;
|
||||
ino_t node_id;
|
||||
ino_t dir_id;
|
||||
char name[1];
|
||||
};
|
||||
|
||||
|
||||
@@ -153,9 +153,9 @@ struct EntryCacheHashDefinition {
|
||||
&& strcmp(value->name, key.name) == 0;
|
||||
}
|
||||
|
||||
HashTableLink<EntryCacheEntry>* GetLink(EntryCacheEntry* value) const
|
||||
EntryCacheEntry*& GetLink(EntryCacheEntry* value) const
|
||||
{
|
||||
return value;
|
||||
return value->hash_link;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
typedef OpenHashTable<EntryCacheHashDefinition> EntryTable;
|
||||
typedef BOpenHashTable<EntryCacheHashDefinition> EntryTable;
|
||||
typedef DoublyLinkedList<EntryCacheEntry> EntryList;
|
||||
|
||||
mutex fLock;
|
||||
|
||||
@@ -41,11 +41,11 @@ struct ImageTableDefinition {
|
||||
size_t Hash(struct image* value) const { return value->info.id; }
|
||||
bool Compare(image_id key, struct image* value) const
|
||||
{ return value->info.id == key; }
|
||||
HashTableLink<struct image>* GetLink(struct image* value) const
|
||||
{ return &value->hash_link; }
|
||||
struct image*& GetLink(struct image* value) const
|
||||
{ return value->hash_link; }
|
||||
};
|
||||
|
||||
typedef OpenHashTable<ImageTableDefinition> ImageTable;
|
||||
typedef BOpenHashTable<ImageTableDefinition> ImageTable;
|
||||
|
||||
|
||||
class ImageNotificationService : public DefaultNotificationService {
|
||||
|
||||
@@ -154,7 +154,7 @@ struct hash_entry : entry {
|
||||
free((char*)path);
|
||||
}
|
||||
|
||||
HashTableLink<hash_entry> link;
|
||||
hash_entry* hash_link;
|
||||
const char* path;
|
||||
};
|
||||
|
||||
@@ -164,8 +164,8 @@ struct NodeHashDefinition {
|
||||
|
||||
size_t Hash(ValueType* entry) const
|
||||
{ return HashKey(entry); }
|
||||
HashTableLink<ValueType>* GetLink(ValueType* entry) const
|
||||
{ return &entry->link; }
|
||||
ValueType*& GetLink(ValueType* entry) const
|
||||
{ return entry->hash_link; }
|
||||
|
||||
size_t HashKey(KeyType key) const
|
||||
{
|
||||
@@ -179,7 +179,7 @@ struct NodeHashDefinition {
|
||||
}
|
||||
};
|
||||
|
||||
typedef OpenHashTable<NodeHashDefinition> NodeHash;
|
||||
typedef BOpenHashTable<NodeHashDefinition> NodeHash;
|
||||
|
||||
struct module_listener : DoublyLinkedListLinkImpl<module_listener> {
|
||||
~module_listener()
|
||||
|
||||
@@ -134,19 +134,19 @@ public:
|
||||
ReleaseReference();
|
||||
}
|
||||
|
||||
HashTableLink<NamedSem>* HashLink()
|
||||
NamedSem*& HashLink()
|
||||
{
|
||||
return &fHashLink;
|
||||
return fHashLink;
|
||||
}
|
||||
|
||||
private:
|
||||
char* fName;
|
||||
vint32 fRefCount;
|
||||
uid_t fUID;
|
||||
gid_t fGID;
|
||||
mode_t fPermissions;
|
||||
char* fName;
|
||||
vint32 fRefCount;
|
||||
uid_t fUID;
|
||||
gid_t fGID;
|
||||
mode_t fPermissions;
|
||||
|
||||
::HashTableLink<NamedSem> fHashLink;
|
||||
NamedSem* fHashLink;
|
||||
};
|
||||
|
||||
|
||||
@@ -238,13 +238,13 @@ public:
|
||||
delete this;
|
||||
}
|
||||
|
||||
HashTableLink<UnnamedSharedSem>* HashLink()
|
||||
UnnamedSharedSem*& HashLink()
|
||||
{
|
||||
return &fHashLink;
|
||||
return fHashLink;
|
||||
}
|
||||
|
||||
private:
|
||||
::HashTableLink<UnnamedSharedSem> fHashLink;
|
||||
UnnamedSharedSem* fHashLink;
|
||||
};
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ struct NamedSemHashDefinition {
|
||||
return strcmp(key, semaphore->Name()) == 0;
|
||||
}
|
||||
|
||||
HashTableLink<NamedSem>* GetLink(NamedSem* semaphore) const
|
||||
NamedSem*& GetLink(NamedSem* semaphore) const
|
||||
{
|
||||
return semaphore->HashLink();
|
||||
}
|
||||
@@ -293,7 +293,7 @@ struct UnnamedSemHashDefinition {
|
||||
return key == semaphore->SemaphoreID();
|
||||
}
|
||||
|
||||
HashTableLink<UnnamedSharedSem>* GetLink(UnnamedSharedSem* semaphore) const
|
||||
UnnamedSharedSem*& GetLink(UnnamedSharedSem* semaphore) const
|
||||
{
|
||||
return semaphore->HashLink();
|
||||
}
|
||||
@@ -442,8 +442,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
typedef OpenHashTable<NamedSemHashDefinition, true> NamedSemTable;
|
||||
typedef OpenHashTable<UnnamedSemHashDefinition, true> UnnamedSemTable;
|
||||
typedef BOpenHashTable<NamedSemHashDefinition, true> NamedSemTable;
|
||||
typedef BOpenHashTable<UnnamedSemHashDefinition, true> UnnamedSemTable;
|
||||
|
||||
mutex fLock;
|
||||
NamedSemTable fNamedSemaphores;
|
||||
@@ -502,17 +502,17 @@ public:
|
||||
return clone;
|
||||
}
|
||||
|
||||
HashTableLink<TeamSemInfo>* HashLink()
|
||||
TeamSemInfo*& HashLink()
|
||||
{
|
||||
return &fHashLink;
|
||||
return fHashLink;
|
||||
}
|
||||
|
||||
private:
|
||||
SemInfo* fSemaphore;
|
||||
sem_t* fUserSemaphore;
|
||||
int32 fOpenCount;
|
||||
SemInfo* fSemaphore;
|
||||
sem_t* fUserSemaphore;
|
||||
int32 fOpenCount;
|
||||
|
||||
::HashTableLink<TeamSemInfo> fHashLink;
|
||||
TeamSemInfo* fHashLink;
|
||||
};
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ struct TeamSemHashDefinition {
|
||||
return key == semaphore->ID();
|
||||
}
|
||||
|
||||
HashTableLink<TeamSemInfo>* GetLink(TeamSemInfo* semaphore) const
|
||||
TeamSemInfo*& GetLink(TeamSemInfo* semaphore) const
|
||||
{
|
||||
return semaphore->HashLink();
|
||||
}
|
||||
@@ -799,7 +799,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
typedef OpenHashTable<TeamSemHashDefinition, true> SemTable;
|
||||
typedef BOpenHashTable<TeamSemHashDefinition, true> SemTable;
|
||||
|
||||
mutex fLock;
|
||||
SemTable fSemaphores;
|
||||
|
||||
@@ -266,9 +266,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
HashTableLink<XsiMessageQueue>* Link()
|
||||
XsiMessageQueue*& Link()
|
||||
{
|
||||
return &fLink;
|
||||
return fLink;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -284,7 +284,7 @@ private:
|
||||
ThreadQueue fWaitingToReceive;
|
||||
ThreadQueue fWaitingToSend;
|
||||
|
||||
::HashTableLink<XsiMessageQueue> fLink;
|
||||
XsiMessageQueue* fLink;
|
||||
};
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ struct MessageQueueHashTableDefinition {
|
||||
return (int)key == (int)variable->ID();
|
||||
}
|
||||
|
||||
HashTableLink<XsiMessageQueue>* GetLink(XsiMessageQueue *variable) const
|
||||
XsiMessageQueue*& GetLink(XsiMessageQueue *variable) const
|
||||
{
|
||||
return variable->Link();
|
||||
}
|
||||
@@ -339,15 +339,15 @@ public:
|
||||
fMessageQueueId = messageQueue->ID();
|
||||
}
|
||||
|
||||
HashTableLink<Ipc>* Link()
|
||||
Ipc*& Link()
|
||||
{
|
||||
return &fLink;
|
||||
return fLink;
|
||||
}
|
||||
|
||||
private:
|
||||
key_t fKey;
|
||||
int fMessageQueueId;
|
||||
HashTableLink<Ipc> fLink;
|
||||
Ipc* fLink;
|
||||
};
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@ struct IpcHashTableDefinition {
|
||||
return (key_t)key == (key_t)variable->Key();
|
||||
}
|
||||
|
||||
HashTableLink<Ipc>* GetLink(Ipc *variable) const
|
||||
Ipc*& GetLink(Ipc *variable) const
|
||||
{
|
||||
return variable->Link();
|
||||
}
|
||||
@@ -379,8 +379,8 @@ struct IpcHashTableDefinition {
|
||||
// Arbitrary limits
|
||||
#define MAX_XSI_MESSAGE 4096
|
||||
#define MAX_XSI_MESSAGE_QUEUE 1024
|
||||
static OpenHashTable<IpcHashTableDefinition> sIpcHashTable;
|
||||
static OpenHashTable<MessageQueueHashTableDefinition> sMessageQueueHashTable;
|
||||
static BOpenHashTable<IpcHashTableDefinition> sIpcHashTable;
|
||||
static BOpenHashTable<MessageQueueHashTableDefinition> sMessageQueueHashTable;
|
||||
|
||||
static mutex sIpcLock;
|
||||
static mutex sXsiMessageQueueLock;
|
||||
|
||||
@@ -515,9 +515,9 @@ public:
|
||||
return fUndoList;
|
||||
}
|
||||
|
||||
HashTableLink<XsiSemaphoreSet>* Link()
|
||||
XsiSemaphoreSet*& Link()
|
||||
{
|
||||
return &fLink;
|
||||
return fLink;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -532,7 +532,7 @@ private:
|
||||
uint32 fSequenceNumber; // used as a second id
|
||||
UndoList fUndoList; // undo list requests
|
||||
|
||||
::HashTableLink<XsiSemaphoreSet> fLink;
|
||||
XsiSemaphoreSet* fLink;
|
||||
};
|
||||
|
||||
// Xsi semaphore set hash table
|
||||
@@ -555,7 +555,7 @@ struct SemaphoreHashTableDefinition {
|
||||
return (int)key == (int)variable->ID();
|
||||
}
|
||||
|
||||
HashTableLink<XsiSemaphoreSet>* GetLink(XsiSemaphoreSet *variable) const
|
||||
XsiSemaphoreSet*& GetLink(XsiSemaphoreSet *variable) const
|
||||
{
|
||||
return variable->Link();
|
||||
}
|
||||
@@ -586,15 +586,15 @@ public:
|
||||
fSemaphoreSetId = semaphoreSet->ID();
|
||||
}
|
||||
|
||||
HashTableLink<Ipc>* Link()
|
||||
Ipc*& Link()
|
||||
{
|
||||
return &fLink;
|
||||
return fLink;
|
||||
}
|
||||
|
||||
private:
|
||||
key_t fKey;
|
||||
int fSemaphoreSetId;
|
||||
HashTableLink<Ipc> fLink;
|
||||
Ipc* fLink;
|
||||
};
|
||||
|
||||
|
||||
@@ -617,7 +617,7 @@ struct IpcHashTableDefinition {
|
||||
return (key_t)key == (key_t)variable->Key();
|
||||
}
|
||||
|
||||
HashTableLink<Ipc>* GetLink(Ipc *variable) const
|
||||
Ipc*& GetLink(Ipc *variable) const
|
||||
{
|
||||
return variable->Link();
|
||||
}
|
||||
@@ -626,8 +626,8 @@ struct IpcHashTableDefinition {
|
||||
// Arbitrary limit
|
||||
#define MAX_XSI_SEMAPHORE 4096
|
||||
#define MAX_XSI_SEMAPHORE_SET 2048
|
||||
static OpenHashTable<IpcHashTableDefinition> sIpcHashTable;
|
||||
static OpenHashTable<SemaphoreHashTableDefinition> sSemaphoreHashTable;
|
||||
static BOpenHashTable<IpcHashTableDefinition> sIpcHashTable;
|
||||
static BOpenHashTable<SemaphoreHashTableDefinition> sSemaphoreHashTable;
|
||||
|
||||
static mutex sIpcLock;
|
||||
static mutex sXsiSemaphoreSetLock;
|
||||
|
||||
@@ -122,9 +122,10 @@ struct SmallObjectCache : object_cache {
|
||||
|
||||
|
||||
struct HashedObjectCache : object_cache {
|
||||
struct Link : HashTableLink<Link> {
|
||||
const void *buffer;
|
||||
slab *parent;
|
||||
struct Link {
|
||||
const void* buffer;
|
||||
slab* parent;
|
||||
Link* next;
|
||||
};
|
||||
|
||||
struct Definition {
|
||||
@@ -144,12 +145,12 @@ struct HashedObjectCache : object_cache {
|
||||
size_t Hash(Link *value) const { return HashKey(value->buffer); }
|
||||
bool Compare(const void *key, Link *value) const
|
||||
{ return value->buffer == key; }
|
||||
HashTableLink<Link> *GetLink(Link *value) const { return value; }
|
||||
Link*& GetLink(Link *value) const { return value->next; }
|
||||
|
||||
HashedObjectCache *parent;
|
||||
};
|
||||
|
||||
typedef OpenHashTable<Definition> HashTable;
|
||||
typedef BOpenHashTable<Definition> HashTable;
|
||||
|
||||
HashedObjectCache()
|
||||
: hash_table(this) {}
|
||||
|
||||
@@ -80,7 +80,8 @@ struct swap_hash_key {
|
||||
|
||||
// Each swap block contains swap address information for
|
||||
// SWAP_BLOCK_PAGES continuous pages from the same cache
|
||||
struct swap_block : HashTableLink<swap_block> {
|
||||
struct swap_block {
|
||||
swap_block* hash_link;
|
||||
swap_hash_key key;
|
||||
uint32 used;
|
||||
swap_addr_t swap_slots[SWAP_BLOCK_PAGES];
|
||||
@@ -111,13 +112,13 @@ struct SwapHashTableDefinition {
|
||||
&& key.cache == value->key.cache;
|
||||
}
|
||||
|
||||
HashTableLink<swap_block> *GetLink(swap_block *value) const
|
||||
swap_block*& GetLink(swap_block *value) const
|
||||
{
|
||||
return value;
|
||||
return value->hash_link;
|
||||
}
|
||||
};
|
||||
|
||||
typedef OpenHashTable<SwapHashTableDefinition> SwapHashTable;
|
||||
typedef BOpenHashTable<SwapHashTableDefinition> SwapHashTable;
|
||||
typedef DoublyLinkedList<swap_file> SwapFileList;
|
||||
|
||||
static SwapHashTable sSwapHashTable;
|
||||
|
||||
@@ -41,11 +41,11 @@ struct ConditionVariableHashDefinition {
|
||||
{ return (size_t)variable->fObject; }
|
||||
bool Compare(const void* key, ConditionVariable* variable) const
|
||||
{ return key == variable->fObject; }
|
||||
HashTableLink<ConditionVariable>* GetLink(ConditionVariable* variable) const
|
||||
{ return variable; }
|
||||
ConditionVariable*& GetLink(ConditionVariable* variable) const
|
||||
{ return variable->fNext; }
|
||||
};
|
||||
|
||||
typedef OpenHashTable<ConditionVariableHashDefinition> ConditionVariableHash;
|
||||
typedef BOpenHashTable<ConditionVariableHashDefinition> ConditionVariableHash;
|
||||
static ConditionVariableHash sConditionVariableHash;
|
||||
static mutex sConditionVariablesLock = MUTEX_INITIALIZER("condition variables");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user