* Removed UserlandFS shared Locker class. Instead use BLocker in userland and
RecursiveLock in the kernel. * Several adjustments according to UserlandFS header changes. * Re-added reiserfs to image. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29410 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -139,7 +139,7 @@ BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi
|
||||
config_manager agp_gart usb firewire $(X86_ONLY)acpi
|
||||
;
|
||||
BEOS_ADD_ONS_FILE_SYSTEMS = bfs cdda ext2 fat iso9660 nfs attribute_overlay
|
||||
write_overlay ;
|
||||
write_overlay $(GPL_ONLY)reiserfs ;
|
||||
#googlefs $(GPL_ONLY)ntfs ;
|
||||
|
||||
|
||||
|
||||
@@ -1,59 +1,33 @@
|
||||
//
|
||||
// $Id: Locker.h,v 1.1 2002/07/09 12:24:33 ejakowatz Exp $
|
||||
//
|
||||
// This is the Locker interface for OpenBeOS. It has been created to
|
||||
// be source and binary compatible with the BeOS version of Locker.
|
||||
//
|
||||
// bonefish:
|
||||
// * Removed `virtual' from destructor and FBC reserved space.
|
||||
// * Renamed to Locker.
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _USERLAND_FS_LOCKER_H
|
||||
#define _USERLAND_FS_LOCKER_H
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
// kernel: use the RecursiveLock class
|
||||
|
||||
|
||||
#ifndef _OPENBEOS_LOCKER_H
|
||||
#define _OPENBEOS_LOCKER_H
|
||||
#include "RecursiveLock.h"
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
namespace UserlandFSUtil {
|
||||
|
||||
class Locker {
|
||||
public:
|
||||
Locker();
|
||||
Locker(const char *name);
|
||||
Locker(bool benaphore_style);
|
||||
Locker(const char *name, bool benaphore_style);
|
||||
|
||||
// The following constructor is not documented in the BeBook
|
||||
// and is only listed here to ensure binary compatibility.
|
||||
// DO NOT USE THIS CONSTRUCTOR!
|
||||
Locker(const char *name, bool benaphore_style, bool);
|
||||
|
||||
~Locker();
|
||||
|
||||
bool Lock(void);
|
||||
status_t LockWithTimeout(bigtime_t timeout);
|
||||
void Unlock(void);
|
||||
|
||||
thread_id LockingThread(void) const;
|
||||
bool IsLocked(void) const;
|
||||
int32 CountLocks(void) const;
|
||||
int32 CountLockRequests(void) const;
|
||||
sem_id Sem(void) const;
|
||||
|
||||
private:
|
||||
void InitLocker(const char *name, bool benaphore_style);
|
||||
bool AcquireLock(bigtime_t timeout, status_t *error);
|
||||
|
||||
int32 fBenaphoreCount;
|
||||
sem_id fSemaphoreID;
|
||||
thread_id fLockOwner;
|
||||
int32 fRecursiveCount;
|
||||
typedef RecursiveLock Locker;
|
||||
};
|
||||
|
||||
} // namespace UserlandFSUtil
|
||||
|
||||
#else
|
||||
// userland: use the BLocker class
|
||||
|
||||
#include <Locker.h>
|
||||
|
||||
namespace UserlandFSUtil {
|
||||
typedef BLocker Locker;
|
||||
};
|
||||
|
||||
#endif // kernel/userland
|
||||
|
||||
using UserlandFSUtil::Locker;
|
||||
|
||||
#endif // _OPENBEOS_LOCKER_H
|
||||
#endif // _USERLAND_FS_LOCKER_H
|
||||
|
||||
@@ -3,17 +3,19 @@
|
||||
#ifndef ATTRIBUTE_H
|
||||
#define ATTRIBUTE_H
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "AttributeIndex.h"
|
||||
#include "AttributeIterator.h"
|
||||
#include "DataContainer.h"
|
||||
#include "DLList.h"
|
||||
#include "String.h"
|
||||
|
||||
class AllocationInfo;
|
||||
class Node;
|
||||
class Volume;
|
||||
|
||||
class Attribute : public DataContainer, public DLListLinkImpl<Attribute> {
|
||||
class Attribute : public DataContainer,
|
||||
public DoublyLinkedListLinkImpl<Attribute> {
|
||||
public:
|
||||
Attribute(Volume *volume, Node *node, const char *name, uint32 type = 0);
|
||||
~Attribute();
|
||||
@@ -44,7 +46,7 @@ public:
|
||||
// iterator management
|
||||
void AttachAttributeIterator(AttributeIterator *iterator);
|
||||
void DetachAttributeIterator(AttributeIterator *iterator);
|
||||
inline DLList<AttributeIterator> *GetAttributeIteratorList()
|
||||
inline DoublyLinkedList<AttributeIterator> *GetAttributeIteratorList()
|
||||
{ return &fIterators; }
|
||||
|
||||
// debugging
|
||||
@@ -58,7 +60,7 @@ private:
|
||||
bool fInIndex;
|
||||
|
||||
// iterator management
|
||||
DLList<AttributeIterator> fIterators;
|
||||
DoublyLinkedList<AttributeIterator> fIterators;
|
||||
};
|
||||
|
||||
#endif // ATTRIBUTE_H
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
class AttributeIndexImpl::Iterator
|
||||
: public NodeEntryIterator<
|
||||
AttributeNodeIterator<AttributeTree::Iterator> >,
|
||||
public DLListLinkImpl<Iterator>, public EntryListener,
|
||||
public DoublyLinkedListLinkImpl<Iterator>, public EntryListener,
|
||||
public NodeListener {
|
||||
public:
|
||||
Iterator();
|
||||
@@ -182,7 +182,7 @@ private:
|
||||
|
||||
|
||||
// IteratorList
|
||||
class AttributeIndexImpl::IteratorList : public DLList<Iterator> {};
|
||||
class AttributeIndexImpl::IteratorList : public DoublyLinkedList<Iterator> {};
|
||||
|
||||
|
||||
// AttributeIndexImpl
|
||||
@@ -203,7 +203,7 @@ AttributeIndexImpl::~AttributeIndexImpl()
|
||||
{
|
||||
if (fIterators) {
|
||||
// unset the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
iterator->SetTo(NULL, NULL, 0);
|
||||
@@ -243,7 +243,7 @@ AttributeIndexImpl::Changed(Attribute *attribute, const uint8 *oldKey,
|
||||
if (foundAttribute && *foundAttribute == attribute) {
|
||||
Node *node = attribute->GetNode();
|
||||
// update the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
if (iterator->GetCurrentNode() == node)
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
|
||||
class Attribute;
|
||||
class Node;
|
||||
|
||||
class AttributeIterator : public DLListLinkImpl<AttributeIterator> {
|
||||
class AttributeIterator : public DoublyLinkedListLinkImpl<AttributeIterator> {
|
||||
public:
|
||||
AttributeIterator(Node *node = NULL);
|
||||
~AttributeIterator();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "BlockAllocatorArea.h"
|
||||
#include "BlockAllocatorAreaBucket.h"
|
||||
#include "Debug.h"
|
||||
#include "DLList.h"
|
||||
|
||||
|
||||
// BlockAllocator
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
#ifndef BLOCK_ALLOCATOR_AREA_H
|
||||
#define BLOCK_ALLOCATOR_AREA_H
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "BlockAllocator.h"
|
||||
#include "BlockAllocatorMisc.h"
|
||||
#include "DLList.h"
|
||||
|
||||
class BlockAllocator::Area : public DLListLinkImpl<Area> {
|
||||
|
||||
class BlockAllocator::Area : public DoublyLinkedListLinkImpl<Area> {
|
||||
public:
|
||||
static Area *Create(size_t size);
|
||||
void Delete();
|
||||
|
||||
@@ -14,7 +14,7 @@ BlockAllocator::AreaBucket::AreaBucket()
|
||||
// destructor
|
||||
BlockAllocator::AreaBucket::~AreaBucket()
|
||||
{
|
||||
while (Area *area = fAreas.GetFirst()) {
|
||||
while (Area *area = fAreas.First()) {
|
||||
RemoveArea(area);
|
||||
area->Delete();
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
#ifndef BLOCK_ALLOCATOR_AREA_BUCKET_H
|
||||
#define BLOCK_ALLOCATOR_AREA_BUCKET_H
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "BlockAllocator.h"
|
||||
#include "BlockAllocatorArea.h"
|
||||
#include "Debug.h"
|
||||
#include "DLList.h"
|
||||
|
||||
|
||||
class BlockAllocator::AreaBucket {
|
||||
public:
|
||||
@@ -23,8 +25,8 @@ public:
|
||||
inline void AddArea(Area *area);
|
||||
inline void RemoveArea(Area *area);
|
||||
|
||||
inline Area *GetFirstArea() const { return fAreas.GetFirst(); }
|
||||
inline Area *GetLastArea() const { return fAreas.GetLast(); }
|
||||
inline Area *GetFirstArea() const { return fAreas.First(); }
|
||||
inline Area *GetLastArea() const { return fAreas.Last(); }
|
||||
inline Area *GetNextArea(Area* area) const;
|
||||
|
||||
inline bool IsEmpty() const { return fAreas.IsEmpty(); }
|
||||
@@ -33,7 +35,7 @@ public:
|
||||
bool SanityCheck(bool deep = false) const;
|
||||
|
||||
private:
|
||||
DLList<Area> fAreas;
|
||||
DoublyLinkedList<Area> fAreas;
|
||||
int32 fIndex;
|
||||
size_t fMinSize;
|
||||
size_t fMaxSize;
|
||||
|
||||
@@ -20,7 +20,7 @@ Directory::Directory(Volume *volume)
|
||||
Directory::~Directory()
|
||||
{
|
||||
// delete all entries
|
||||
while (Entry *entry = fEntries.GetFirst()) {
|
||||
while (Entry *entry = fEntries.First()) {
|
||||
if (DeleteEntry(entry) != B_OK) {
|
||||
FATAL(("Could not delete all entries in directory.\n"));
|
||||
break;
|
||||
@@ -41,7 +41,7 @@ Directory::Link(Entry *entry)
|
||||
status_t
|
||||
Directory::Unlink(Entry *entry)
|
||||
{
|
||||
if (entry == fReferrers.GetFirst())
|
||||
if (entry == fReferrers.First())
|
||||
return Node::Unlink(entry);
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ Directory::GetSize() const
|
||||
Directory *
|
||||
Directory::GetParent() const
|
||||
{
|
||||
Entry *entry = fReferrers.GetFirst();
|
||||
Entry *entry = fReferrers.First();
|
||||
return (entry ? entry->GetParent() : NULL);
|
||||
}
|
||||
|
||||
@@ -190,8 +190,9 @@ Directory::RemoveEntry(Entry *entry)
|
||||
if (GetVolume()->IteratorLock()) {
|
||||
// set the iterators' current entry
|
||||
Entry *nextEntry = fEntries.GetNext(entry);
|
||||
DLList<EntryIterator> *iterators = entry->GetEntryIteratorList();
|
||||
for (EntryIterator *iterator = iterators->GetFirst();
|
||||
DoublyLinkedList<EntryIterator> *iterators
|
||||
= entry->GetEntryIteratorList();
|
||||
for (EntryIterator *iterator = iterators->First();
|
||||
iterator;
|
||||
iterator = iterators->GetNext(iterator)) {
|
||||
iterator->SetCurrent(nextEntry, true);
|
||||
@@ -199,7 +200,7 @@ Directory::RemoveEntry(Entry *entry)
|
||||
// Move the iterators from one list to the other, or just remove
|
||||
// them, if there is no next entry.
|
||||
if (nextEntry) {
|
||||
DLList<EntryIterator> *nextIterators
|
||||
DoublyLinkedList<EntryIterator> *nextIterators
|
||||
= nextEntry->GetEntryIteratorList();
|
||||
nextIterators->MoveFrom(iterators);
|
||||
} else
|
||||
@@ -292,7 +293,7 @@ Directory::GetPreviousEntry(Entry **entry) const
|
||||
status_t error = (entry ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*entry)
|
||||
*entry = fEntries.GetLast();
|
||||
*entry = fEntries.Last();
|
||||
else if ((*entry)->GetParent() == this)
|
||||
*entry = fEntries.GetPrevious(*entry);
|
||||
else
|
||||
@@ -310,7 +311,7 @@ Directory::GetNextEntry(Entry **entry) const
|
||||
status_t error = (entry ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*entry)
|
||||
*entry = fEntries.GetFirst();
|
||||
*entry = fEntries.First();
|
||||
else if ((*entry)->GetParent() == this)
|
||||
*entry = fEntries.GetNext(*entry);
|
||||
else
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
#ifndef DIRECTORY_H
|
||||
#define DIRECTORY_H
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "Node.h"
|
||||
|
||||
|
||||
class Entry;
|
||||
class File;
|
||||
class SymLink;
|
||||
@@ -50,7 +52,7 @@ private:
|
||||
status_t _CreateCommon(Node *node, const char *name);
|
||||
|
||||
private:
|
||||
DLList<Entry> fEntries;
|
||||
DoublyLinkedList<Entry> fEntries;
|
||||
};
|
||||
|
||||
#endif // DIRECTORY_H
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#include <fs_interface.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "String.h"
|
||||
|
||||
class AllocationInfo;
|
||||
@@ -14,7 +15,7 @@ class Directory;
|
||||
class EntryIterator;
|
||||
class Node;
|
||||
|
||||
class Entry : public DLListLinkImpl<Entry> {
|
||||
class Entry : public DoublyLinkedListLinkImpl<Entry> {
|
||||
public:
|
||||
Entry(const char *name, Node *node = NULL, Directory *parent = NULL);
|
||||
~Entry();
|
||||
@@ -33,13 +34,14 @@ public:
|
||||
inline const char *GetName() const { return fName.GetString(); }
|
||||
|
||||
// inline Volume *GetVolume() const { return fVolume; }
|
||||
|
||||
inline DLListLink<Entry> *GetReferrerLink() { return &fReferrerLink; }
|
||||
|
||||
inline DoublyLinkedListLink<Entry> *GetReferrerLink()
|
||||
{ return &fReferrerLink; }
|
||||
|
||||
// entry iterator management
|
||||
void AttachEntryIterator(EntryIterator *iterator);
|
||||
void DetachEntryIterator(EntryIterator *iterator);
|
||||
inline DLList<EntryIterator> *GetEntryIteratorList()
|
||||
inline DoublyLinkedList<EntryIterator> *GetEntryIteratorList()
|
||||
{ return &fIterators; }
|
||||
|
||||
// debugging
|
||||
@@ -49,15 +51,15 @@ private:
|
||||
Directory *fParent;
|
||||
Node *fNode;
|
||||
String fName;
|
||||
DLListLink<Entry> fReferrerLink;
|
||||
DoublyLinkedListLink<Entry> fReferrerLink;
|
||||
// iterator management
|
||||
DLList<EntryIterator> fIterators;
|
||||
DoublyLinkedList<EntryIterator> fIterators;
|
||||
};
|
||||
|
||||
// GetNodeReferrerLink
|
||||
class GetNodeReferrerLink {
|
||||
private:
|
||||
typedef DLListLink<Entry> Link;
|
||||
typedef DoublyLinkedListLink<Entry> Link;
|
||||
|
||||
public:
|
||||
inline Link *operator()(Entry *entry) const
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
class Directory;
|
||||
class Entry;
|
||||
|
||||
class EntryIterator : public DLListLinkImpl<EntryIterator> {
|
||||
class EntryIterator : public DoublyLinkedListLinkImpl<EntryIterator> {
|
||||
public:
|
||||
EntryIterator(Directory *directory = NULL);
|
||||
~EntryIterator();
|
||||
|
||||
@@ -4,7 +4,7 @@ local userlandFSTop = [ FDirName $(HAIKU_TOP) src add-ons kernel
|
||||
file_systems userlandfs ] ;
|
||||
local userlandFSIncludes = [ PrivateHeaders userlandfs ] ;
|
||||
|
||||
UsePrivateHeaders kernel ; # for <util/*>
|
||||
UsePrivateHeaders kernel shared ;
|
||||
|
||||
SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ;
|
||||
|
||||
@@ -14,7 +14,6 @@ DEFINES += DEBUG_APP="\\\"ramfs\\\"" ;
|
||||
|
||||
KernelAddon ramfs
|
||||
: Debug.cpp
|
||||
Locker.cpp
|
||||
String.cpp
|
||||
|
||||
AllocationInfo.cpp
|
||||
|
||||
@@ -66,13 +66,13 @@ class LastModifiedIndex::NodeTree : public _NodeTree {};
|
||||
|
||||
|
||||
// IteratorList
|
||||
class LastModifiedIndex::IteratorList : public DLList<Iterator> {};
|
||||
class LastModifiedIndex::IteratorList : public DoublyLinkedList<Iterator> {};
|
||||
|
||||
|
||||
// Iterator
|
||||
class LastModifiedIndex::Iterator
|
||||
: public NodeEntryIterator<LastModifiedIndex::NodeTree::Iterator>,
|
||||
public DLListLinkImpl<Iterator>, public EntryListener,
|
||||
public DoublyLinkedListLinkImpl<Iterator>, public EntryListener,
|
||||
public NodeListener {
|
||||
public:
|
||||
Iterator();
|
||||
@@ -122,7 +122,7 @@ LastModifiedIndex::~LastModifiedIndex()
|
||||
fVolume->RemoveNodeListener(this, NULL);
|
||||
if (fIterators) {
|
||||
// unset the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
iterator->SetTo(NULL, 0);
|
||||
@@ -151,7 +151,7 @@ LastModifiedIndex::Changed(Node *node, time_t oldModified)
|
||||
oldModified), node, &it);
|
||||
if (foundNode && *foundNode == node) {
|
||||
// update the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
if (iterator->GetCurrentNode() == node)
|
||||
|
||||
@@ -64,7 +64,7 @@ Node::Node(Volume *volume, uint8 type)
|
||||
Node::~Node()
|
||||
{
|
||||
// delete all attributes
|
||||
while (Attribute *attribute = fAttributes.GetFirst()) {
|
||||
while (Attribute *attribute = fAttributes.First()) {
|
||||
status_t error = DeleteAttribute(attribute);
|
||||
if (error != B_OK) {
|
||||
FATAL(("Node::~Node(): Failed to delete attribute!\n"));
|
||||
@@ -96,7 +96,7 @@ Node::AddReference()
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// RemoveReference
|
||||
void
|
||||
Node::RemoveReference()
|
||||
@@ -234,9 +234,9 @@ Node::RemoveAttribute(Attribute *attribute)
|
||||
if (GetVolume()->IteratorLock()) {
|
||||
// set the iterators' current entry
|
||||
Attribute *nextAttr = fAttributes.GetNext(attribute);
|
||||
DLList<AttributeIterator> *iterators
|
||||
DoublyLinkedList<AttributeIterator> *iterators
|
||||
= attribute->GetAttributeIteratorList();
|
||||
for (AttributeIterator *iterator = iterators->GetFirst();
|
||||
for (AttributeIterator *iterator = iterators->First();
|
||||
iterator;
|
||||
iterator = iterators->GetNext(iterator)) {
|
||||
iterator->SetCurrent(nextAttr, true);
|
||||
@@ -244,7 +244,7 @@ Node::RemoveAttribute(Attribute *attribute)
|
||||
// Move the iterators from one list to the other, or just remove
|
||||
// them, if there is no next attribute.
|
||||
if (nextAttr) {
|
||||
DLList<AttributeIterator> *nextIterators
|
||||
DoublyLinkedList<AttributeIterator> *nextIterators
|
||||
= nextAttr->GetAttributeIteratorList();
|
||||
nextIterators->MoveFrom(iterators);
|
||||
} else
|
||||
@@ -293,7 +293,7 @@ Node::GetPreviousAttribute(Attribute **attribute) const
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*attribute)
|
||||
*attribute = fAttributes.GetLast();
|
||||
*attribute = fAttributes.Last();
|
||||
else if ((*attribute)->GetNode() == this)
|
||||
*attribute = fAttributes.GetPrevious(*attribute);
|
||||
else
|
||||
@@ -311,7 +311,7 @@ Node::GetNextAttribute(Attribute **attribute) const
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*attribute)
|
||||
*attribute = fAttributes.GetFirst();
|
||||
*attribute = fAttributes.First();
|
||||
else if ((*attribute)->GetNode() == this)
|
||||
*attribute = fAttributes.GetNext(*attribute);
|
||||
else
|
||||
@@ -326,14 +326,14 @@ Node::GetNextAttribute(Attribute **attribute) const
|
||||
Entry *
|
||||
Node::GetFirstReferrer() const
|
||||
{
|
||||
return fReferrers.GetHead();
|
||||
return fReferrers.First();
|
||||
}
|
||||
|
||||
// GetLastReferrer
|
||||
Entry *
|
||||
Node::GetLastReferrer() const
|
||||
{
|
||||
return fReferrers.GetTail();
|
||||
return fReferrers.Last();
|
||||
}
|
||||
|
||||
// GetPreviousReferrer
|
||||
|
||||
@@ -29,7 +29,7 @@ enum {
|
||||
ACCESS_X = S_IXOTH,
|
||||
};
|
||||
|
||||
class Node : public DLListLinkImpl<Node> {
|
||||
class Node : public DoublyLinkedListLinkImpl<Node> {
|
||||
public:
|
||||
Node(Volume *volume, uint8 type);
|
||||
virtual ~Node();
|
||||
@@ -121,11 +121,11 @@ private:
|
||||
bool fIsKnownToVFS;
|
||||
|
||||
// attribute management
|
||||
DLList<Attribute> fAttributes;
|
||||
DoublyLinkedList<Attribute> fAttributes;
|
||||
|
||||
protected:
|
||||
// entries referring to this node
|
||||
DLList<Entry, GetNodeReferrerLink> fReferrers;
|
||||
DoublyLinkedList<Entry, GetNodeReferrerLink> fReferrers;
|
||||
};
|
||||
|
||||
// MarkUnmodified
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "Index.h"
|
||||
#include "Stack.h"
|
||||
#include "ramfs.h"
|
||||
@@ -93,7 +94,7 @@ class Expression {
|
||||
Term *fTerm;
|
||||
};
|
||||
|
||||
class Query : public DLListLinkImpl<Query> {
|
||||
class Query : public DoublyLinkedListLinkImpl<Query> {
|
||||
public:
|
||||
Query(Volume *volume, Expression *expression, uint32 flags);
|
||||
~Query();
|
||||
|
||||
@@ -65,13 +65,13 @@ class SizeIndex::NodeTree : public _NodeTree {};
|
||||
|
||||
|
||||
// IteratorList
|
||||
class SizeIndex::IteratorList : public DLList<Iterator> {};
|
||||
class SizeIndex::IteratorList : public DoublyLinkedList<Iterator> {};
|
||||
|
||||
|
||||
// Iterator
|
||||
class SizeIndex::Iterator
|
||||
: public NodeEntryIterator<SizeIndex::NodeTree::Iterator>,
|
||||
public DLListLinkImpl<Iterator>, public EntryListener,
|
||||
public DoublyLinkedListLinkImpl<Iterator>, public EntryListener,
|
||||
public NodeListener {
|
||||
public:
|
||||
Iterator();
|
||||
@@ -120,7 +120,7 @@ SizeIndex::~SizeIndex()
|
||||
fVolume->RemoveNodeListener(this, NULL);
|
||||
if (fIterators) {
|
||||
// unset the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
iterator->SetTo(NULL, 0);
|
||||
@@ -149,7 +149,7 @@ SizeIndex::Changed(Node *node, off_t oldSize)
|
||||
node, &it);
|
||||
if (foundNode && *foundNode == node) {
|
||||
// update the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
if (iterator->GetCurrentNode() == node)
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -774,7 +774,7 @@ Volume::UpdateLiveQueries(Entry *entry, Node* node, const char *attribute,
|
||||
{
|
||||
AutoLocker<Locker> _(fQueryLocker);
|
||||
|
||||
for (Query* query = fQueries.GetFirst();
|
||||
for (Query* query = fQueries.First();
|
||||
query;
|
||||
query = fQueries.GetNext(query)) {
|
||||
query->LiveUpdate(entry, node, attribute, type, oldKey, oldLength,
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -25,7 +25,8 @@
|
||||
#include <fs_interface.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "Entry.h"
|
||||
#include "List.h"
|
||||
#include "Locker.h"
|
||||
@@ -176,7 +177,7 @@ public:
|
||||
void IteratorUnlock();
|
||||
|
||||
private:
|
||||
typedef DLList<Query> QueryList;
|
||||
typedef DoublyLinkedList<Query> QueryList;
|
||||
|
||||
dev_t fID;
|
||||
ino_t fNextNodeID;
|
||||
|
||||
@@ -40,10 +40,11 @@
|
||||
#include <NodeMonitor.h>
|
||||
#include <TypeConstants.h>
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
|
||||
#include "AllocationInfo.h"
|
||||
#include "AttributeIndex.h"
|
||||
#include "AttributeIterator.h"
|
||||
#include "AutoDeleter.h"
|
||||
#include "Debug.h"
|
||||
#include "Directory.h"
|
||||
#include "Entry.h"
|
||||
|
||||
@@ -4,6 +4,7 @@ local userlandFSTop = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems
|
||||
userlandfs ] ;
|
||||
local userlandFSIncludes = [ PrivateHeaders userlandfs ] ;
|
||||
|
||||
UsePrivateHeaders kernel ;
|
||||
SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ;
|
||||
|
||||
SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ;
|
||||
@@ -11,9 +12,8 @@ SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ;
|
||||
DEFINES += DEBUG_APP="\\\"reiserfs\\\"" ;
|
||||
|
||||
KernelAddon reiserfs
|
||||
:
|
||||
:
|
||||
Debug.cpp
|
||||
Locker.cpp
|
||||
String.cpp
|
||||
|
||||
Block.cpp
|
||||
@@ -26,7 +26,7 @@ KernelAddon reiserfs
|
||||
SuperBlock.cpp
|
||||
Tree.cpp
|
||||
VNode.cpp
|
||||
Volume.cpp
|
||||
Volume.cpp
|
||||
|
||||
: $(HAIKU_LIBSUPC++)
|
||||
;
|
||||
|
||||
@@ -18,7 +18,6 @@ KernelAddon userlandfs
|
||||
: AreaSupport.cpp
|
||||
Debug.cpp
|
||||
LazyInitializable.cpp
|
||||
Locker.cpp
|
||||
ObjectTracker.cpp
|
||||
Port.cpp
|
||||
Request.cpp
|
||||
|
||||
@@ -22,7 +22,6 @@ Application userlandfs_server
|
||||
Debug.cpp
|
||||
driver_settings.c
|
||||
LazyInitializable.cpp
|
||||
Locker.cpp
|
||||
ObjectTracker.cpp
|
||||
Port.cpp
|
||||
Request.cpp
|
||||
|
||||
@@ -35,4 +35,5 @@ SharedLibrary libuserlandfs_haiku_kernel.so
|
||||
|
||||
:
|
||||
<nogrist>userlandfs_server
|
||||
be # for BLocker only
|
||||
;
|
||||
|
||||
@@ -1,303 +0,0 @@
|
||||
//
|
||||
// $Id: Locker.cpp,v 1.1 2002/07/09 12:24:49 ejakowatz Exp $
|
||||
//
|
||||
// This file contains the OpenBeOS implementation of Locker.
|
||||
//
|
||||
|
||||
|
||||
#include "Debug.h"
|
||||
#include "Locker.h"
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Data Member Documentation:
|
||||
//
|
||||
// The "fBenaphoreCount" member is set to 1 if the Locker style is
|
||||
// semaphore. If the style is benaphore, it is initialized to 0 and
|
||||
// is incremented atomically when it is acquired, decremented when it
|
||||
// is released. By setting the benaphore count to 1 when the style is
|
||||
// semaphore, the benaphore effectively becomes a semaphore. I was able
|
||||
// to determine this is what Be's implementation does by testing the
|
||||
// result of the CountLockRequests() member.
|
||||
//
|
||||
// The "fSemaphoreID" member holds the sem_id returned from create_sem()
|
||||
// when the Locker is constructed. It is used to acquire and release
|
||||
// the lock regardless of the lock style (semaphore or benaphore).
|
||||
//
|
||||
// The "fLockOwner" member holds the thread_id of the thread which
|
||||
// currently holds the lock. If no thread holds the lock, it is set to
|
||||
// B_ERROR.
|
||||
//
|
||||
// The "fRecursiveCount" member holds a count of the number of times the
|
||||
// thread holding the lock has acquired the lock without a matching unlock.
|
||||
// It is basically the number of times the thread must call Unlock() before
|
||||
// the lock can be acquired by a different thread.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Constructors:
|
||||
//
|
||||
// All constructors just pass their arguments to InitLocker(). Note that
|
||||
// the default for "name" is "some Locker" and "benaphore_style" is true.
|
||||
//
|
||||
|
||||
Locker::Locker()
|
||||
{
|
||||
InitLocker("some Locker", true);
|
||||
}
|
||||
|
||||
|
||||
Locker::Locker(const char *name)
|
||||
{
|
||||
InitLocker(name, true);
|
||||
}
|
||||
|
||||
|
||||
Locker::Locker(bool benaphore_style)
|
||||
{
|
||||
InitLocker("some Locker", benaphore_style);
|
||||
}
|
||||
|
||||
|
||||
Locker::Locker(const char *name,
|
||||
bool benaphore_style)
|
||||
{
|
||||
InitLocker(name, benaphore_style);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This constructor is not documented. The final argument is ignored for
|
||||
// now. In Be's headers, its called "for_IPC". DO NOT USE THIS
|
||||
// CONSTRUCTOR!
|
||||
//
|
||||
Locker::Locker(const char *name,
|
||||
bool benaphore_style,
|
||||
bool)
|
||||
{
|
||||
InitLocker(name, benaphore_style);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// The destructor just deletes the semaphore. By deleting the semaphore,
|
||||
// any threads waiting to acquire the Locker will be unblocked.
|
||||
//
|
||||
Locker::~Locker()
|
||||
{
|
||||
delete_sem(fSemaphoreID);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Locker::Lock(void)
|
||||
{
|
||||
status_t result;
|
||||
|
||||
return (AcquireLock(B_INFINITE_TIMEOUT, &result));
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Locker::LockWithTimeout(bigtime_t timeout)
|
||||
{
|
||||
status_t result;
|
||||
|
||||
AcquireLock(timeout, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
Locker::Unlock(void)
|
||||
{
|
||||
// If the thread currently holds the lockdecrement
|
||||
if (IsLocked()) {
|
||||
|
||||
// Decrement the number of outstanding locks this thread holds
|
||||
// on this Locker.
|
||||
fRecursiveCount--;
|
||||
|
||||
// If the recursive count is now at 0, that means the Locker has
|
||||
// been released by the thread.
|
||||
if (fRecursiveCount == 0) {
|
||||
|
||||
// The Locker is no longer owned by any thread.
|
||||
fLockOwner = B_ERROR;
|
||||
|
||||
// Decrement the benaphore count and store the undecremented
|
||||
// value in oldBenaphoreCount.
|
||||
int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, -1);
|
||||
|
||||
// If the oldBenaphoreCount is greater than 1, then there is
|
||||
// at lease one thread waiting for the lock in the case of a
|
||||
// benaphore.
|
||||
if (oldBenaphoreCount > 1) {
|
||||
|
||||
// Since there are threads waiting for the lock, it must
|
||||
// be released. Note, the old benaphore count will always be
|
||||
// greater than 1 for a semaphore so the release is always done.
|
||||
release_sem(fSemaphoreID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
thread_id
|
||||
Locker::LockingThread(void) const
|
||||
{
|
||||
return fLockOwner;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Locker::IsLocked(void) const
|
||||
{
|
||||
// This member returns true if the calling thread holds the lock.
|
||||
// The easiest way to determine this is to compare the result of
|
||||
// find_thread() to the fLockOwner.
|
||||
return (find_thread(NULL) == fLockOwner);
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
Locker::CountLocks(void) const
|
||||
{
|
||||
return fRecursiveCount;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
Locker::CountLockRequests(void) const
|
||||
{
|
||||
return fBenaphoreCount;
|
||||
}
|
||||
|
||||
|
||||
sem_id
|
||||
Locker::Sem(void) const
|
||||
{
|
||||
return fSemaphoreID;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Locker::InitLocker(const char *name,
|
||||
bool benaphore)
|
||||
{
|
||||
if (benaphore) {
|
||||
// Because this is a benaphore, initialize the benaphore count and
|
||||
// create the semaphore. Because this is a benaphore, the semaphore
|
||||
// count starts at 0 (ie acquired).
|
||||
fBenaphoreCount = 0;
|
||||
fSemaphoreID = create_sem(0, name);
|
||||
} else {
|
||||
// Because this is a semaphore, initialize the benaphore count to -1
|
||||
// and create the semaphore. Because this is semaphore style, the
|
||||
// semaphore count starts at 1 so that one thread can acquire it and
|
||||
// the next thread to acquire it will block.
|
||||
fBenaphoreCount = 1;
|
||||
fSemaphoreID = create_sem(1, name);
|
||||
}
|
||||
|
||||
// bonefish: make kernel safe
|
||||
#if !USER
|
||||
set_sem_owner(fSemaphoreID, B_SYSTEM_TEAM);
|
||||
#endif
|
||||
|
||||
// The lock is currently not acquired so there is no owner.
|
||||
fLockOwner = B_ERROR;
|
||||
|
||||
// The lock is currently not acquired so the recursive count is zero.
|
||||
fRecursiveCount = 0;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Locker::AcquireLock(bigtime_t timeout,
|
||||
status_t *error)
|
||||
{
|
||||
// By default, return no error.
|
||||
*error = B_NO_ERROR;
|
||||
|
||||
// Only try to acquire the lock if the thread doesn't already own it.
|
||||
if (!IsLocked()) {
|
||||
|
||||
// Increment the benaphore count and test to see if it was already greater
|
||||
// than 0. If it is greater than 0, then some thread already has the
|
||||
// benaphore or the style is a semaphore. Either way, we need to acquire
|
||||
// the semaphore in this case.
|
||||
int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, 1);
|
||||
if (oldBenaphoreCount > 0) {
|
||||
|
||||
*error = acquire_sem_etc(fSemaphoreID, 1, B_RELATIVE_TIMEOUT,
|
||||
timeout);
|
||||
// Note, if the lock here does time out, the benaphore count
|
||||
// is not decremented. By doing this, the benaphore count will
|
||||
// never go back to zero. This means that the locking essentially
|
||||
// changes to semaphore style if this was a benaphore.
|
||||
//
|
||||
// Doing the decrement of the benaphore count when the acquisition
|
||||
// fails is a risky thing to do. If you decrement the counter at
|
||||
// the same time the thread which holds the benaphore does an
|
||||
// Unlock(), there is serious risk of a race condition.
|
||||
//
|
||||
// If the Unlock() sees a positive count and releases the semaphore
|
||||
// and then the timed out thread decrements the count to 0, there
|
||||
// is no one to take the semaphore. The next two threads will be
|
||||
// able to acquire the benaphore at the same time! The first will
|
||||
// increment the counter and acquire the lock. The second will
|
||||
// acquire the semaphore and therefore the lock. Not good.
|
||||
//
|
||||
// This has been discussed on the becodetalk mailing list and
|
||||
// Trey from Be had this to say:
|
||||
//
|
||||
// I looked at the LockWithTimeout() code, and it does not have
|
||||
// _this_ (ie the race condition) problem. It circumvents it by
|
||||
// NOT doing the atomic_add(&count, -1) if the semaphore
|
||||
// acquisition fails. This means that if a
|
||||
// Locker::LockWithTimeout() times out, all other Lock*() attempts
|
||||
// turn into guaranteed semaphore grabs, _with_ the overhead of a
|
||||
// (now) useless atomic_add().
|
||||
//
|
||||
// Given Trey's comments, it looks like Be took the same approach
|
||||
// I did. The output of CountLockRequests() of Be's implementation
|
||||
// confirms Trey's comments also.
|
||||
//
|
||||
// Finally some thoughts for the future with this code:
|
||||
// - If 2^31 timeouts occur on a 32-bit machine (ie today),
|
||||
// the benaphore count will wrap to a negative number. This
|
||||
// would have unknown consequences on the ability of the Locker
|
||||
// to continue to function.
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
// If the lock has successfully been acquired.
|
||||
if (*error == B_NO_ERROR) {
|
||||
|
||||
// Set the lock owner to this thread and increment the recursive count
|
||||
// by one. The recursive count is incremented because one more Unlock()
|
||||
// is now required to release the lock (ie, 0 => 1, 1 => 2 etc).
|
||||
fLockOwner = find_thread(NULL);
|
||||
fRecursiveCount++;
|
||||
}
|
||||
|
||||
// Return true if the lock has been acquired.
|
||||
return (*error == B_NO_ERROR);
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
@@ -3,17 +3,19 @@
|
||||
#ifndef ATTRIBUTE_H
|
||||
#define ATTRIBUTE_H
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "AttributeIndex.h"
|
||||
#include "AttributeIterator.h"
|
||||
#include "DataContainer.h"
|
||||
#include "DLList.h"
|
||||
#include "String.h"
|
||||
|
||||
class AllocationInfo;
|
||||
class Node;
|
||||
class Volume;
|
||||
|
||||
class Attribute : public DataContainer, public DLListLinkImpl<Attribute> {
|
||||
class Attribute : public DataContainer,
|
||||
public DoublyLinkedListLinkImpl<Attribute> {
|
||||
public:
|
||||
Attribute(Volume *volume, Node *node, const char *name, uint32 type = 0);
|
||||
~Attribute();
|
||||
@@ -41,7 +43,7 @@ public:
|
||||
// iterator management
|
||||
void AttachAttributeIterator(AttributeIterator *iterator);
|
||||
void DetachAttributeIterator(AttributeIterator *iterator);
|
||||
inline DLList<AttributeIterator> *GetAttributeIteratorList()
|
||||
inline DoublyLinkedList<AttributeIterator> *GetAttributeIteratorList()
|
||||
{ return &fIterators; }
|
||||
|
||||
// debugging
|
||||
@@ -55,7 +57,7 @@ private:
|
||||
bool fInIndex;
|
||||
|
||||
// iterator management
|
||||
DLList<AttributeIterator> fIterators;
|
||||
DoublyLinkedList<AttributeIterator> fIterators;
|
||||
};
|
||||
|
||||
#endif // ATTRIBUTE_H
|
||||
|
||||
+4
-4
@@ -157,7 +157,7 @@ public:
|
||||
class AttributeIndexImpl::Iterator
|
||||
: public NodeEntryIterator<
|
||||
AttributeNodeIterator<AttributeTree::Iterator> >,
|
||||
public DLListLinkImpl<Iterator>, public EntryListener,
|
||||
public DoublyLinkedListLinkImpl<Iterator>, public EntryListener,
|
||||
public NodeListener {
|
||||
public:
|
||||
Iterator();
|
||||
@@ -186,7 +186,7 @@ private:
|
||||
|
||||
|
||||
// IteratorList
|
||||
class AttributeIndexImpl::IteratorList : public DLList<Iterator> {};
|
||||
class AttributeIndexImpl::IteratorList : public DoublyLinkedList<Iterator> {};
|
||||
|
||||
|
||||
// AttributeIndexImpl
|
||||
@@ -207,7 +207,7 @@ AttributeIndexImpl::~AttributeIndexImpl()
|
||||
{
|
||||
if (fIterators) {
|
||||
// unset the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
iterator->SetTo(NULL, NULL, 0);
|
||||
@@ -247,7 +247,7 @@ AttributeIndexImpl::Changed(Attribute *attribute, const uint8 *oldKey,
|
||||
if (foundAttribute && *foundAttribute == attribute) {
|
||||
Node *node = attribute->GetNode();
|
||||
// update the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
if (iterator->GetCurrentNode() == node)
|
||||
|
||||
+3
-2
@@ -5,12 +5,13 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
|
||||
class Attribute;
|
||||
class Node;
|
||||
|
||||
class AttributeIterator : public DLListLinkImpl<AttributeIterator> {
|
||||
class AttributeIterator : public DoublyLinkedListLinkImpl<AttributeIterator> {
|
||||
public:
|
||||
AttributeIterator(Node *node = NULL);
|
||||
~AttributeIterator();
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
#include "BlockAllocatorArea.h"
|
||||
#include "BlockAllocatorAreaBucket.h"
|
||||
#include "Debug.h"
|
||||
#include "DLList.h"
|
||||
|
||||
|
||||
// BlockAllocator
|
||||
|
||||
|
||||
+4
-2
@@ -3,11 +3,13 @@
|
||||
#ifndef BLOCK_ALLOCATOR_AREA_H
|
||||
#define BLOCK_ALLOCATOR_AREA_H
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "BlockAllocator.h"
|
||||
#include "BlockAllocatorMisc.h"
|
||||
#include "DLList.h"
|
||||
|
||||
class BlockAllocator::Area : public DLListLinkImpl<Area> {
|
||||
|
||||
class BlockAllocator::Area : public DoublyLinkedListLinkImpl<Area> {
|
||||
public:
|
||||
static Area *Create(size_t size);
|
||||
void Delete();
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ BlockAllocator::AreaBucket::AreaBucket()
|
||||
// destructor
|
||||
BlockAllocator::AreaBucket::~AreaBucket()
|
||||
{
|
||||
while (Area *area = fAreas.GetFirst()) {
|
||||
while (Area *area = fAreas.First()) {
|
||||
RemoveArea(area);
|
||||
area->Delete();
|
||||
}
|
||||
|
||||
+6
-4
@@ -3,10 +3,12 @@
|
||||
#ifndef BLOCK_ALLOCATOR_AREA_BUCKET_H
|
||||
#define BLOCK_ALLOCATOR_AREA_BUCKET_H
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "BlockAllocator.h"
|
||||
#include "BlockAllocatorArea.h"
|
||||
#include "Debug.h"
|
||||
#include "DLList.h"
|
||||
|
||||
|
||||
class BlockAllocator::AreaBucket {
|
||||
public:
|
||||
@@ -23,8 +25,8 @@ public:
|
||||
inline void AddArea(Area *area);
|
||||
inline void RemoveArea(Area *area);
|
||||
|
||||
inline Area *GetFirstArea() const { return fAreas.GetFirst(); }
|
||||
inline Area *GetLastArea() const { return fAreas.GetLast(); }
|
||||
inline Area *GetFirstArea() const { return fAreas.First(); }
|
||||
inline Area *GetLastArea() const { return fAreas.Last(); }
|
||||
inline Area *GetNextArea(Area* area) const;
|
||||
|
||||
inline bool IsEmpty() const { return fAreas.IsEmpty(); }
|
||||
@@ -33,7 +35,7 @@ public:
|
||||
bool SanityCheck(bool deep = false) const;
|
||||
|
||||
private:
|
||||
DLList<Area> fAreas;
|
||||
DoublyLinkedList<Area> fAreas;
|
||||
int32 fIndex;
|
||||
size_t fMinSize;
|
||||
size_t fMaxSize;
|
||||
|
||||
@@ -20,7 +20,7 @@ Directory::Directory(Volume *volume)
|
||||
Directory::~Directory()
|
||||
{
|
||||
// delete all entries
|
||||
while (Entry *entry = fEntries.GetFirst()) {
|
||||
while (Entry *entry = fEntries.First()) {
|
||||
if (DeleteEntry(entry) != B_OK) {
|
||||
FATAL(("Could not delete all entries in directory.\n"));
|
||||
break;
|
||||
@@ -41,7 +41,7 @@ Directory::Link(Entry *entry)
|
||||
status_t
|
||||
Directory::Unlink(Entry *entry)
|
||||
{
|
||||
if (entry == fReferrers.GetFirst())
|
||||
if (entry == fReferrers.First())
|
||||
return Node::Unlink(entry);
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ Directory::GetSize() const
|
||||
Directory *
|
||||
Directory::GetParent() const
|
||||
{
|
||||
Entry *entry = fReferrers.GetFirst();
|
||||
Entry *entry = fReferrers.First();
|
||||
return (entry ? entry->GetParent() : NULL);
|
||||
}
|
||||
|
||||
@@ -190,8 +190,9 @@ Directory::RemoveEntry(Entry *entry)
|
||||
if (GetVolume()->IteratorLock()) {
|
||||
// set the iterators' current entry
|
||||
Entry *nextEntry = fEntries.GetNext(entry);
|
||||
DLList<EntryIterator> *iterators = entry->GetEntryIteratorList();
|
||||
for (EntryIterator *iterator = iterators->GetFirst();
|
||||
DoublyLinkedList<EntryIterator> *iterators
|
||||
= entry->GetEntryIteratorList();
|
||||
for (EntryIterator *iterator = iterators->First();
|
||||
iterator;
|
||||
iterator = iterators->GetNext(iterator)) {
|
||||
iterator->SetCurrent(nextEntry, true);
|
||||
@@ -199,7 +200,7 @@ Directory::RemoveEntry(Entry *entry)
|
||||
// Move the iterators from one list to the other, or just remove
|
||||
// them, if there is no next entry.
|
||||
if (nextEntry) {
|
||||
DLList<EntryIterator> *nextIterators
|
||||
DoublyLinkedList<EntryIterator> *nextIterators
|
||||
= nextEntry->GetEntryIteratorList();
|
||||
nextIterators->MoveFrom(iterators);
|
||||
} else
|
||||
@@ -292,7 +293,7 @@ Directory::GetPreviousEntry(Entry **entry) const
|
||||
status_t error = (entry ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*entry)
|
||||
*entry = fEntries.GetLast();
|
||||
*entry = fEntries.Last();
|
||||
else if ((*entry)->GetParent() == this)
|
||||
*entry = fEntries.GetPrevious(*entry);
|
||||
else
|
||||
@@ -310,7 +311,7 @@ Directory::GetNextEntry(Entry **entry) const
|
||||
status_t error = (entry ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*entry)
|
||||
*entry = fEntries.GetFirst();
|
||||
*entry = fEntries.First();
|
||||
else if ((*entry)->GetParent() == this)
|
||||
*entry = fEntries.GetNext(*entry);
|
||||
else
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
#ifndef DIRECTORY_H
|
||||
#define DIRECTORY_H
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "Node.h"
|
||||
|
||||
|
||||
class Entry;
|
||||
class File;
|
||||
class SymLink;
|
||||
@@ -50,7 +52,7 @@ private:
|
||||
status_t _CreateCommon(Node *node, const char *name);
|
||||
|
||||
private:
|
||||
DLList<Entry> fEntries;
|
||||
DoublyLinkedList<Entry> fEntries;
|
||||
};
|
||||
|
||||
#endif // DIRECTORY_H
|
||||
|
||||
@@ -5,16 +5,18 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "fsproto.h"
|
||||
#include "String.h"
|
||||
|
||||
|
||||
class AllocationInfo;
|
||||
class Directory;
|
||||
class EntryIterator;
|
||||
class Node;
|
||||
|
||||
class Entry : public DLListLinkImpl<Entry> {
|
||||
class Entry : public DoublyLinkedListLinkImpl<Entry> {
|
||||
public:
|
||||
Entry(const char *name, Node *node = NULL, Directory *parent = NULL);
|
||||
~Entry();
|
||||
@@ -33,13 +35,14 @@ public:
|
||||
inline const char *GetName() const { return fName.GetString(); }
|
||||
|
||||
// inline Volume *GetVolume() const { return fVolume; }
|
||||
|
||||
inline DLListLink<Entry> *GetReferrerLink() { return &fReferrerLink; }
|
||||
|
||||
inline DoublyLinkedListLink<Entry> *GetReferrerLink()
|
||||
{ return &fReferrerLink; }
|
||||
|
||||
// entry iterator management
|
||||
void AttachEntryIterator(EntryIterator *iterator);
|
||||
void DetachEntryIterator(EntryIterator *iterator);
|
||||
inline DLList<EntryIterator> *GetEntryIteratorList()
|
||||
inline DoublyLinkedList<EntryIterator> *GetEntryIteratorList()
|
||||
{ return &fIterators; }
|
||||
|
||||
// debugging
|
||||
@@ -49,15 +52,15 @@ private:
|
||||
Directory *fParent;
|
||||
Node *fNode;
|
||||
String fName;
|
||||
DLListLink<Entry> fReferrerLink;
|
||||
DoublyLinkedListLink<Entry> fReferrerLink;
|
||||
// iterator management
|
||||
DLList<EntryIterator> fIterators;
|
||||
DoublyLinkedList<EntryIterator> fIterators;
|
||||
};
|
||||
|
||||
// GetNodeReferrerLink
|
||||
class GetNodeReferrerLink {
|
||||
private:
|
||||
typedef DLListLink<Entry> Link;
|
||||
typedef DoublyLinkedListLink<Entry> Link;
|
||||
|
||||
public:
|
||||
inline Link *operator()(Entry *entry) const
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
class Directory;
|
||||
class Entry;
|
||||
|
||||
class EntryIterator : public DLListLinkImpl<EntryIterator> {
|
||||
class EntryIterator : public DoublyLinkedListLinkImpl<EntryIterator> {
|
||||
public:
|
||||
EntryIterator(Directory *directory = NULL);
|
||||
~EntryIterator();
|
||||
|
||||
@@ -25,7 +25,6 @@ SEARCH_SOURCE += [ FDirName $(userlandFSTop) src shared ] ;
|
||||
|
||||
Addon <test>ramfs
|
||||
: Debug.cpp
|
||||
Locker.cpp
|
||||
String.cpp
|
||||
|
||||
AllocationInfo.cpp
|
||||
|
||||
+4
-4
@@ -66,13 +66,13 @@ class LastModifiedIndex::NodeTree : public _NodeTree {};
|
||||
|
||||
|
||||
// IteratorList
|
||||
class LastModifiedIndex::IteratorList : public DLList<Iterator> {};
|
||||
class LastModifiedIndex::IteratorList : public DoublyLinkedList<Iterator> {};
|
||||
|
||||
|
||||
// Iterator
|
||||
class LastModifiedIndex::Iterator
|
||||
: public NodeEntryIterator<LastModifiedIndex::NodeTree::Iterator>,
|
||||
public DLListLinkImpl<Iterator>, public EntryListener,
|
||||
public DoublyLinkedListLinkImpl<Iterator>, public EntryListener,
|
||||
public NodeListener {
|
||||
public:
|
||||
Iterator();
|
||||
@@ -122,7 +122,7 @@ LastModifiedIndex::~LastModifiedIndex()
|
||||
fVolume->RemoveNodeListener(this, NULL);
|
||||
if (fIterators) {
|
||||
// unset the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
iterator->SetTo(NULL, 0);
|
||||
@@ -151,7 +151,7 @@ LastModifiedIndex::Changed(Node *node, time_t oldModified)
|
||||
oldModified), node, &it);
|
||||
if (foundNode && *foundNode == node) {
|
||||
// update the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
if (iterator->GetCurrentNode() == node)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef LOCKING_H
|
||||
#define LOCKING_H
|
||||
|
||||
#include "AutoLocker.h"
|
||||
#include <AutoLocker.h>
|
||||
|
||||
class Volume;
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ Node::Node(Volume *volume, uint8 type)
|
||||
Node::~Node()
|
||||
{
|
||||
// delete all attributes
|
||||
while (Attribute *attribute = fAttributes.GetFirst()) {
|
||||
while (Attribute *attribute = fAttributes.First()) {
|
||||
status_t error = DeleteAttribute(attribute);
|
||||
if (error != B_OK) {
|
||||
FATAL(("Node::~Node(): Failed to delete attribute!\n"));
|
||||
@@ -96,7 +96,7 @@ Node::AddReference()
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// RemoveReference
|
||||
void
|
||||
Node::RemoveReference()
|
||||
@@ -234,9 +234,9 @@ Node::RemoveAttribute(Attribute *attribute)
|
||||
if (GetVolume()->IteratorLock()) {
|
||||
// set the iterators' current entry
|
||||
Attribute *nextAttr = fAttributes.GetNext(attribute);
|
||||
DLList<AttributeIterator> *iterators
|
||||
DoublyLinkedList<AttributeIterator> *iterators
|
||||
= attribute->GetAttributeIteratorList();
|
||||
for (AttributeIterator *iterator = iterators->GetFirst();
|
||||
for (AttributeIterator *iterator = iterators->First();
|
||||
iterator;
|
||||
iterator = iterators->GetNext(iterator)) {
|
||||
iterator->SetCurrent(nextAttr, true);
|
||||
@@ -244,7 +244,7 @@ Node::RemoveAttribute(Attribute *attribute)
|
||||
// Move the iterators from one list to the other, or just remove
|
||||
// them, if there is no next attribute.
|
||||
if (nextAttr) {
|
||||
DLList<AttributeIterator> *nextIterators
|
||||
DoublyLinkedList<AttributeIterator> *nextIterators
|
||||
= nextAttr->GetAttributeIteratorList();
|
||||
nextIterators->MoveFrom(iterators);
|
||||
} else
|
||||
@@ -293,7 +293,7 @@ Node::GetPreviousAttribute(Attribute **attribute) const
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*attribute)
|
||||
*attribute = fAttributes.GetLast();
|
||||
*attribute = fAttributes.Last();
|
||||
else if ((*attribute)->GetNode() == this)
|
||||
*attribute = fAttributes.GetPrevious(*attribute);
|
||||
else
|
||||
@@ -311,7 +311,7 @@ Node::GetNextAttribute(Attribute **attribute) const
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
if (!*attribute)
|
||||
*attribute = fAttributes.GetFirst();
|
||||
*attribute = fAttributes.First();
|
||||
else if ((*attribute)->GetNode() == this)
|
||||
*attribute = fAttributes.GetNext(*attribute);
|
||||
else
|
||||
@@ -326,14 +326,14 @@ Node::GetNextAttribute(Attribute **attribute) const
|
||||
Entry *
|
||||
Node::GetFirstReferrer() const
|
||||
{
|
||||
return fReferrers.GetHead();
|
||||
return fReferrers.First();
|
||||
}
|
||||
|
||||
// GetLastReferrer
|
||||
Entry *
|
||||
Node::GetLastReferrer() const
|
||||
{
|
||||
return fReferrers.GetTail();
|
||||
return fReferrers.Last();
|
||||
}
|
||||
|
||||
// GetPreviousReferrer
|
||||
|
||||
@@ -29,7 +29,7 @@ enum {
|
||||
ACCESS_X = S_IXOTH,
|
||||
};
|
||||
|
||||
class Node : public DLListLinkImpl<Node> {
|
||||
class Node : public DoublyLinkedListLinkImpl<Node> {
|
||||
public:
|
||||
Node(Volume *volume, uint8 type);
|
||||
virtual ~Node();
|
||||
@@ -122,11 +122,11 @@ private:
|
||||
bool fIsKnownToVFS;
|
||||
|
||||
// attribute management
|
||||
DLList<Attribute> fAttributes;
|
||||
DoublyLinkedList<Attribute> fAttributes;
|
||||
|
||||
protected:
|
||||
// entries referring to this node
|
||||
DLList<Entry, GetNodeReferrerLink> fReferrers;
|
||||
DoublyLinkedList<Entry, GetNodeReferrerLink> fReferrers;
|
||||
};
|
||||
|
||||
// MarkUnmodified
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "Index.h"
|
||||
#include "Stack.h"
|
||||
#include "ramfs.h"
|
||||
@@ -92,7 +93,7 @@ class Expression {
|
||||
Term *fTerm;
|
||||
};
|
||||
|
||||
class Query : public DLListLinkImpl<Query> {
|
||||
class Query : public DoublyLinkedListLinkImpl<Query> {
|
||||
public:
|
||||
Query(Volume *volume, Expression *expression, uint32 flags);
|
||||
~Query();
|
||||
|
||||
@@ -65,13 +65,13 @@ class SizeIndex::NodeTree : public _NodeTree {};
|
||||
|
||||
|
||||
// IteratorList
|
||||
class SizeIndex::IteratorList : public DLList<Iterator> {};
|
||||
class SizeIndex::IteratorList : public DoublyLinkedList<Iterator> {};
|
||||
|
||||
|
||||
// Iterator
|
||||
class SizeIndex::Iterator
|
||||
: public NodeEntryIterator<SizeIndex::NodeTree::Iterator>,
|
||||
public DLListLinkImpl<Iterator>, public EntryListener,
|
||||
public DoublyLinkedListLinkImpl<Iterator>, public EntryListener,
|
||||
public NodeListener {
|
||||
public:
|
||||
Iterator();
|
||||
@@ -120,7 +120,7 @@ SizeIndex::~SizeIndex()
|
||||
fVolume->RemoveNodeListener(this, NULL);
|
||||
if (fIterators) {
|
||||
// unset the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
iterator->SetTo(NULL, 0);
|
||||
@@ -149,7 +149,7 @@ SizeIndex::Changed(Node *node, off_t oldSize)
|
||||
node, &it);
|
||||
if (foundNode && *foundNode == node) {
|
||||
// update the iterators
|
||||
for (Iterator *iterator = fIterators->GetFirst();
|
||||
for (Iterator *iterator = fIterators->First();
|
||||
iterator;
|
||||
iterator = fIterators->GetNext(iterator)) {
|
||||
if (iterator->GetCurrentNode() == node)
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -763,7 +763,7 @@ Volume::UpdateLiveQueries(Entry *entry, Node* node, const char *attribute,
|
||||
{
|
||||
AutoLocker<Locker> _(fQueryLocker);
|
||||
|
||||
for (Query* query = fQueries.GetFirst();
|
||||
for (Query* query = fQueries.First();
|
||||
query;
|
||||
query = fQueries.GetNext(query)) {
|
||||
query->LiveUpdate(entry, node, attribute, type, oldKey, oldLength,
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -25,7 +25,8 @@
|
||||
#include <fsproto.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "DLList.h"
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "Entry.h"
|
||||
#include "List.h"
|
||||
#include "Locker.h"
|
||||
@@ -173,7 +174,7 @@ public:
|
||||
void IteratorUnlock();
|
||||
|
||||
private:
|
||||
typedef DLList<Query> QueryList;
|
||||
typedef DoublyLinkedList<Query> QueryList;
|
||||
|
||||
nspace_id fID;
|
||||
vnode_id fNextNodeID;
|
||||
|
||||
+2
-1
@@ -40,10 +40,11 @@
|
||||
//#include "cache.h"
|
||||
#include "fsproto.h"
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
|
||||
#include "AllocationInfo.h"
|
||||
#include "AttributeIndex.h"
|
||||
#include "AttributeIterator.h"
|
||||
#include "AutoDeleter.h"
|
||||
#include "Debug.h"
|
||||
#include "Directory.h"
|
||||
#include "Entry.h"
|
||||
|
||||
@@ -7,6 +7,8 @@ local userlandFSIncludes = [ PrivateHeaders userlandfs ] ;
|
||||
local ramFSTop = [ FDirName $(HAIKU_TOP) src tests add-ons kernel
|
||||
file_systems userlandfs r5 src test ramfs ] ;
|
||||
|
||||
UsePrivateHeaders kernel shared ;
|
||||
|
||||
DEFINES += USER=1 ;
|
||||
|
||||
# avoid inclusion of <drivers/Select.h>
|
||||
@@ -25,7 +27,6 @@ SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ;
|
||||
|
||||
Addon <userland-beos>ramfs
|
||||
: Debug.cpp
|
||||
Locker.cpp
|
||||
String.cpp
|
||||
|
||||
AllocationInfo.cpp
|
||||
@@ -57,4 +58,5 @@ Addon <userland-beos>ramfs
|
||||
SymLink.cpp
|
||||
Volume.cpp
|
||||
: libuserlandfs_beos_kernel.so
|
||||
be # for BLocker only
|
||||
;
|
||||
|
||||
@@ -14,9 +14,8 @@ SEARCH_SOURCE += $(reiserFSTop) ;
|
||||
SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ;
|
||||
|
||||
Addon <userland>reiserfs
|
||||
:
|
||||
:
|
||||
Debug.cpp
|
||||
Locker.cpp
|
||||
String.cpp
|
||||
|
||||
Block.cpp
|
||||
@@ -29,9 +28,10 @@ Addon <userland>reiserfs
|
||||
SuperBlock.cpp
|
||||
Tree.cpp
|
||||
VNode.cpp
|
||||
Volume.cpp
|
||||
Volume.cpp
|
||||
|
||||
: libuserlandfs_haiku_kernel.so
|
||||
be # for BLocker only
|
||||
;
|
||||
|
||||
HaikuSubInclude beos_interface ;
|
||||
|
||||
Reference in New Issue
Block a user