Replace uses of obsolescent BReference[able] API.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39870 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-12-16 14:29:37 +00:00
parent c3e066cf6d
commit 88e38c178a
42 changed files with 238 additions and 204 deletions

View File

@ -96,7 +96,7 @@ UserMessagingListener::operator==(const NotificationListener& _other) const
&& other->Token() == Token();
}
class NotificationService : public Referenceable {
class NotificationService : public BReferenceable {
public:
virtual ~NotificationService();

View File

@ -161,7 +161,7 @@ struct free_user_thread {
class AssociatedDataOwner;
class AssociatedData : public Referenceable,
class AssociatedData : public BReferenceable,
public DoublyLinkedListLinkImpl<AssociatedData> {
public:
AssociatedData();

View File

@ -6,7 +6,7 @@
// constructor
ExtendedShareInfo::ExtendedShareInfo()
:
BReferenceable(true),
BReferenceable(),
fShareName()
{
}
@ -35,7 +35,7 @@ ExtendedShareInfo::GetShareName() const
// constructor
ExtendedServerInfo::ExtendedServerInfo(const NetAddress& address)
:
BReferenceable(true),
BReferenceable(),
fAddress(address),
fState(0)
{
@ -46,7 +46,7 @@ ExtendedServerInfo::~ExtendedServerInfo()
{
int32 count = CountShares();
for (int32 i = 0; i < count; i++)
ShareInfoAt(i)->RemoveReference();
ShareInfoAt(i)->ReleaseReference();
}
// GetAddress

View File

@ -5,7 +5,7 @@
// constructor
QueryIterator::QueryIterator(Volume* volume)
:
BReferenceable(false),
BReferenceable(),
fVolume(volume),
fParentIterator(NULL),
fVolumeLink()
@ -49,6 +49,13 @@ QueryIterator::ReadQuery(struct dirent* buffer, size_t bufferSize, int32 count,
}
void
QueryIterator::LastReferenceReleased()
{
// don't delete
}
// #pragma mark -
// constructor

View File

@ -29,6 +29,9 @@ public:
struct GetVolumeLink;
friend struct GetVolumeLink;
protected:
virtual void LastReferenceReleased();
private:
Volume* fVolume;
HierarchicalQueryIterator* fParentIterator;

View File

@ -89,7 +89,7 @@ QueryManager::AddIterator(QueryIterator* iterator)
iteratorList->Insert(iterator);
// get a volume reference for the iterator
iterator->GetVolume()->AddReference();
iterator->GetVolume()->AcquireReference();
return B_OK;
}
@ -138,7 +138,7 @@ QueryManager::GetCurrentSubIterator(HierarchicalQueryIterator* iterator)
AutoLocker<Locker> _(fLock);
QueryIterator* subIterator = iterator->GetCurrentSubIterator();
if (subIterator)
subIterator->AddReference();
subIterator->AcquireReference();
return subIterator;
}
@ -172,7 +172,7 @@ QueryManager::PutIterator(QueryIterator* iterator)
return;
AutoLocker<Locker> locker(fLock);
if (iterator->RemoveReference()) {
if (iterator->ReleaseReference()) {
// last reference removed: remove the iterator
// remove its subiterators (if any)
@ -250,7 +250,7 @@ QueryManager::VolumeUnmounting(Volume* volume)
iterator->GetParentIterator()->RemoveSubIterator(iterator);
// remove reference
if (iterator->RemoveReference()) {
if (iterator->ReleaseReference()) {
// no more reference: move to our local list
iteratorList->Remove(iterator);
iterators.Insert(iterator);

View File

@ -24,7 +24,7 @@ struct ServerConnection::VolumeMap : HashMap<HashKey32<int32>, ShareVolume*> {
ServerConnection::ServerConnection(VolumeManager* volumeManager,
ExtendedServerInfo* serverInfo)
:
BReferenceable(true),
BReferenceable(),
RequestHandler(),
fLock("server connection"),
fVolumeManager(volumeManager),
@ -35,7 +35,7 @@ ServerConnection::ServerConnection(VolumeManager* volumeManager,
fConnected(false)
{
if (fServerInfo)
fServerInfo->AddReference();
fServerInfo->AcquireReference();
}
// destructor
@ -46,9 +46,9 @@ PRINT(("ServerConnection::~ServerConnection()\n"))
delete fConnection;
delete fVolumes;
if (fConnectionBrokenEvent)
fConnectionBrokenEvent->RemoveReference();
fConnectionBrokenEvent->ReleaseReference();
if (fServerInfo)
fServerInfo->RemoveReference();
fServerInfo->ReleaseReference();
}
// Init

View File

@ -12,7 +12,7 @@ ServerConnectionProvider::ServerConnectionProvider(VolumeManager* volumeManager,
ExtendedServerInfo* serverInfo,
vnode_id connectionBrokenTarget)
:
BReferenceable(true),
BReferenceable(),
fLock("server connection provider"),
fVolumeManager(volumeManager),
fServerInfo(serverInfo),
@ -20,7 +20,7 @@ ServerConnectionProvider::ServerConnectionProvider(VolumeManager* volumeManager,
fConnectionBrokenTarget(connectionBrokenTarget)
{
if (fServerInfo)
fServerInfo->AddReference();
fServerInfo->AcquireReference();
}
// destructor
@ -29,11 +29,11 @@ ServerConnectionProvider::~ServerConnectionProvider()
AutoLocker<Locker> _(fLock);
if (fServerConnection) {
fServerConnection->Close();
fServerConnection->RemoveReference();
fServerConnection->ReleaseReference();
}
if (fServerInfo)
fServerInfo->RemoveReference();
fServerInfo->ReleaseReference();
}
// Init
@ -64,7 +64,7 @@ ServerConnectionProvider::GetServerConnection(
if (!fServerConnection->IsConnected())
return B_ERROR;
fServerConnection->AddReference();
fServerConnection->AcquireReference();
*serverConnection = fServerConnection;
return B_OK;
}
@ -79,7 +79,7 @@ ServerConnectionProvider::GetExistingServerConnection()
if (!fServerConnection || !fServerConnection->IsConnected())
return NULL;
fServerConnection->AddReference();
fServerConnection->AcquireReference();
return fServerConnection;
}

View File

@ -55,7 +55,7 @@ public:
fSuccess(false)
{
if (fServerInfo)
fServerInfo->AddReference();
fServerInfo->AcquireReference();
}
virtual ~ServerInfoTask()
@ -68,7 +68,7 @@ public:
fServerManager->_AddingServerFailed(fServerInfo);
}
if (fServerInfo)
fServerInfo->RemoveReference();
fServerInfo->ReleaseReference();
}
status_t Init()
@ -195,7 +195,7 @@ ServerManager::Uninit()
for (ServerInfoMap::Iterator it = fServerInfos->GetIterator();
it.HasNext();) {
ExtendedServerInfo* serverInfo = it.Next().value;
serverInfo->RemoveReference();
serverInfo->ReleaseReference();
}
fServerInfos->Clear();
}
@ -219,7 +219,7 @@ ServerManager::GetServerInfo(const NetAddress& address)
&& serverInfo->GetState() != STATE_UPDATING)) {
return NULL;
}
serverInfo->AddReference();
serverInfo->AcquireReference();
return serverInfo;
}
@ -239,11 +239,11 @@ ServerManager::AddServer(const NetAddress& address)
if (!serverInfo)
return B_NO_MEMORY;
serverInfo->SetState(STATE_ADDING);
Reference<ExtendedServerInfo> serverInfoReference(serverInfo, true);
BReference<ExtendedServerInfo> serverInfoReference(serverInfo, true);
status_t error = fServerInfos->Put(address, serverInfo);
if (error != B_OK)
return error;
serverInfo->AddReference();
serverInfo->AcquireReference();
// create and execute the task -- it will do what is necessary
ServerInfoTask task(this, NULL, serverInfo);
@ -269,7 +269,7 @@ ServerManager::RemoveServer(const NetAddress& address)
// trying to add/update it. We mark the info STATE_REMOVING, which will
// remove the info as soon as possible.
if (serverInfo->GetState() == STATE_READY) {
Reference<ExtendedServerInfo> _(serverInfo);
BReference<ExtendedServerInfo> _(serverInfo);
_RemoveServer(serverInfo);
locker.Unlock();
fListener->ServerRemoved(serverInfo);
@ -366,14 +366,14 @@ ServerManager::_BroadcastListener()
if (!serverInfo)
return B_NO_MEMORY;
serverInfo->SetState(STATE_ADDING);
Reference<ExtendedServerInfo> serverInfoReference(serverInfo, true);
BReference<ExtendedServerInfo> serverInfoReference(serverInfo, true);
if (oldServerInfo) {
oldServerInfo->SetState(STATE_UPDATING);
} else {
status_t error = fServerInfos->Put(netAddress, serverInfo);
if (error != B_OK)
continue;
serverInfo->AddReference();
serverInfo->AcquireReference();
}
// create a task to add/update the server info
@ -384,7 +384,7 @@ ServerManager::_BroadcastListener()
oldServerInfo->SetState(STATE_READY);
} else {
fServerInfos->Remove(serverInfo->GetAddress());
serverInfo->RemoveReference();
serverInfo->ReleaseReference();
}
continue;
}
@ -484,26 +484,26 @@ ServerManager::_ServerUpdated(ExtendedServerInfo* serverInfo)
if (serverInfo != oldInfo) {
// check whether someone told us to remove the server in the meantime
if (oldInfo->GetState() == STATE_REMOVING) {
oldInfo->AddReference();
oldInfo->AcquireReference();
_RemoveServer(oldInfo);
if (fListener) {
locker.Unlock();
fListener->ServerRemoved(oldInfo);
}
oldInfo->RemoveReference();
oldInfo->ReleaseReference();
return;
}
// no, everything is fine: go on...
fServerInfos->Put(serverInfo->GetAddress(), serverInfo);
serverInfo->AddReference();
serverInfo->AcquireReference();
serverInfo->SetState(STATE_READY);
oldInfo->SetState(STATE_OBSOLETE);
if (fListener) {
locker.Unlock();
fListener->ServerUpdated(oldInfo, serverInfo);
}
oldInfo->RemoveReference();
oldInfo->ReleaseReference();
} else {
WARN("ServerManager::_ServerUpdated(%p): WARNING: Unexpected server "
"info.\n", serverInfo);
@ -518,7 +518,7 @@ ServerManager::_AddingServerFailed(ExtendedServerInfo* serverInfo)
if (fServerInfos->Get(serverInfo->GetAddress()) == serverInfo) {
bool removing = (serverInfo->GetState() == STATE_REMOVING);
fServerInfos->Remove(serverInfo->GetAddress());
serverInfo->RemoveReference();
serverInfo->ReleaseReference();
serverInfo->SetState(STATE_OBSOLETE);
// notify the listener, if someone told us in the meantime to remove
@ -542,13 +542,13 @@ ServerManager::_UpdatingServerFailed(ExtendedServerInfo* serverInfo)
if (serverInfo != oldInfo) {
// check whether someone told us to remove the server in the meantime
if (oldInfo->GetState() == STATE_REMOVING) {
oldInfo->AddReference();
oldInfo->AcquireReference();
_RemoveServer(oldInfo);
if (fListener) {
locker.Unlock();
fListener->ServerRemoved(oldInfo);
}
oldInfo->RemoveReference();
oldInfo->ReleaseReference();
serverInfo->SetState(STATE_OBSOLETE);
return;
}
@ -575,7 +575,7 @@ ServerManager::_RemoveServer(ExtendedServerInfo* serverInfo)
if (oldInfo) {
fServerInfos->Remove(oldInfo->GetAddress());
oldInfo->SetState(STATE_OBSOLETE);
oldInfo->RemoveReference();
oldInfo->ReleaseReference();
}
}

View File

@ -27,16 +27,16 @@ ServerVolume::ServerVolume(VolumeManager* volumeManager,
fServerInfo(serverInfo),
fConnectionProvider(NULL)
{
fServerInfo->AddReference();
fServerInfo->AcquireReference();
}
// destructor
ServerVolume::~ServerVolume()
{
if (fConnectionProvider)
fConnectionProvider->RemoveReference();
fConnectionProvider->ReleaseReference();
if (fServerInfo)
fServerInfo->RemoveReference();
fServerInfo->ReleaseReference();
}
// GetServerAddress
@ -56,10 +56,10 @@ ServerVolume::SetServerInfo(ExtendedServerInfo* serverInfo)
// set the new info
fLock.Lock();
fServerInfo->RemoveReference();
fServerInfo->ReleaseReference();
fServerInfo = serverInfo;
fServerInfo->AddReference();
Reference<ExtendedServerInfo> newReference(fServerInfo);
fServerInfo->AcquireReference();
BReference<ExtendedServerInfo> newReference(fServerInfo);
// remove shares, that are no longer there

View File

@ -8,7 +8,7 @@
ShareDirEntry::ShareDirEntry(ShareDir* directory, const char* name,
ShareNode* node)
:
BReferenceable(true),
BReferenceable(),
fDirectory(directory),
fName(name),
fNode(node),
@ -344,7 +344,7 @@ void
RemoteShareDirIterator::Clear()
{
for (int32 i = 0; i < fCount; i++)
fEntries[i]->RemoveReference();
fEntries[i]->ReleaseReference();
fCount = 0;
fIndex = 0;
fDone = false;
@ -359,7 +359,7 @@ RemoteShareDirIterator::AddEntry(ShareDirEntry* entry)
return false;
fEntries[fCount++] = entry;
entry->AddReference();
entry->AcquireReference();
return true;
}

View File

@ -167,11 +167,11 @@ ShareVolume::ShareVolume(VolumeManager* volumeManager,
{
fFlags = fVolumeManager->GetMountFlags();
if (fServerConnectionProvider)
fServerConnectionProvider->AddReference();
fServerConnectionProvider->AcquireReference();
if (fServerInfo)
fServerInfo->AddReference();
fServerInfo->AcquireReference();
if (fShareInfo)
fShareInfo->AddReference();
fShareInfo->AcquireReference();
}
// destructor
@ -214,13 +214,13 @@ PRINT(("ShareVolume::~ShareVolume()\n"));
delete fRemoteNodeIDs;
if (fShareInfo)
fShareInfo->RemoveReference();
fShareInfo->ReleaseReference();
if (fServerInfo)
fServerInfo->RemoveReference();
fServerInfo->ReleaseReference();
if (fServerConnection)
fServerConnection->RemoveReference();
fServerConnection->ReleaseReference();
if (fServerConnectionProvider)
fServerConnectionProvider->RemoveReference();
fServerConnectionProvider->ReleaseReference();
}
// GetID
@ -466,7 +466,7 @@ ShareVolume::ReadVNode(vnode_id vnid, char reenter, Node** _node)
*_node = node;
// add a volume reference for the node
AddReference();
AcquireReference();
return B_OK;
}
@ -505,7 +505,7 @@ ShareVolume::ReadVNode(vnode_id vnid, char reenter, Node** _node)
*_node = node;
// add a volume reference for the node
AddReference();
AcquireReference();
return B_OK;
}
@ -2616,7 +2616,7 @@ ShareVolume::_RemoveEntry(ShareDirEntry* entry)
entry->GetName()));
entry->GetDirectory()->RemoveEntry(entry);
entry->GetNode()->RemoveReferringEntry(entry);
entry->RemoveReference();
entry->ReleaseReference();
}
// _IsObsoleteEntryInfo
@ -3001,8 +3001,8 @@ ShareVolume::_MountShare()
{
// get references to the server and share info
AutoLocker<Locker> locker(fLock);
Reference<ExtendedServerInfo> serverInfoReference(fServerInfo);
Reference<ExtendedShareInfo> shareInfoReference(fShareInfo);
BReference<ExtendedServerInfo> serverInfoReference(fServerInfo);
BReference<ExtendedShareInfo> shareInfoReference(fShareInfo);
ExtendedServerInfo* serverInfo = fServerInfo;
ExtendedShareInfo* shareInfo = fShareInfo;
locker.Unlock();

View File

@ -147,7 +147,7 @@ VirtualVolume::AddChildVolume(Volume* volume)
// set the volume's parent volume
volume->SetParentVolume(this);
AddReference();
AcquireReference();
// send out a notification
vnode_id dirID = fRootNode->GetID();
@ -290,7 +290,7 @@ VirtualVolume::ReadVNode(vnode_id vnid, char reenter, Node** node)
*node = fRootNode;
// add a volume reference for the node
AddReference();
AcquireReference();
return B_OK;
}

View File

@ -5,7 +5,7 @@
// constructor
VolumeEvent::VolumeEvent(uint32 type, vnode_id target)
:
BReferenceable(true),
BReferenceable(),
fType(type),
fTarget(target)
{

View File

@ -54,7 +54,7 @@ public:
while (VolumeEvent* event = fEvents.First()) {
fEvents.Remove(event);
event->RemoveReference();
event->ReleaseReference();
}
}
@ -67,7 +67,7 @@ public:
if (fCounterSem < 0)
return;
fEvents.Insert(event);
event->AddReference();
event->AcquireReference();
release_sem(fCounterSem);
}
@ -208,7 +208,7 @@ VolumeManager::MountRootVolume(const char* device,
PutVolume(rootVolume);
return error;
}
rootVolume->AddReference();
rootVolume->AcquireReference();
*volume = rootVolume;
// run the event deliverer
@ -283,7 +283,7 @@ VolumeManager::GetVolume(Volume* volume)
AutoLocker<Locker> _(this);
if (fVolumes->Contains(volume)) {
// TODO: Any restrictions regarding volumes about to be removed?
volume->AddReference();
volume->AcquireReference();
return volume;
}
return NULL;
@ -332,7 +332,7 @@ VolumeManager::PutVolume(Volume* volume)
// we unmount and delete it.
{
AutoLocker<Locker> locker(this);
if (volume->RemoveReference() && volume->IsRemoved()) {
if (volume->ReleaseReference() && volume->IsRemoved()) {
PRINT(("VolumeManager::PutVolume(%p): Removed volume unreferenced. "
"Unmounting...\n", volume));
// remove from volume set -- now noone can get a reference to it
@ -400,7 +400,7 @@ VolumeManager::_EventDeliverer()
volume->HandleEvent(event);
PutVolume(volume);
}
event->RemoveReference();
event->ReleaseReference();
}
return 0;
}

View File

@ -13,6 +13,9 @@ public:
void MarkRemoved();
bool IsRemoved() const;
protected:
virtual void LastReferenceReleased();
private:
bool fRemoved;
};

View File

@ -125,13 +125,13 @@ struct ClientConnection::VolumeNodeMonitoringEvent {
event(event)
{
if (event)
event->AddReference();
event->AcquireReference();
}
~VolumeNodeMonitoringEvent()
{
if (event)
event->RemoveReference();
event->ReleaseReference();
}
int32 volumeID;
@ -544,7 +544,7 @@ ClientConnection::VisitMountRequest(MountRequest* request)
AutoLocker<Locker> securityContextLocker(fSecurityContextLock);
const char* userName = request->user.GetString();
User* user = fUser;
Reference<User> userReference(user);
BReference<User> userReference(user);
bool noPermission = false;
if (result == B_OK && !user) {
if (userName) {
@ -588,7 +588,7 @@ ClientConnection::VisitMountRequest(MountRequest* request)
} else
SET_ERROR(result, B_ENTRY_NOT_FOUND);
}
Reference<Share> shareReference(share, true);
BReference<Share> shareReference(share, true);
// mount the volume
MountReply reply;
@ -2774,7 +2774,7 @@ ClientConnection::_GetVolume(int32 id)
ClientVolume* volume = fVolumes->Get(id);
if (!volume || volume->IsRemoved())
return NULL;
volume->AddReference();
volume->AcquireReference();
return volume;
}
@ -2789,7 +2789,7 @@ ClientConnection::_PutVolume(ClientVolume* volume)
// decrement reference counter and remove the volume, if 0
AutoLocker<VolumeMap> locker(fVolumes);
bool removed = (volume->RemoveReference() && volume->IsRemoved());
bool removed = (volume->ReleaseReference() && volume->IsRemoved());
if (removed)
fVolumes->Remove(volume->GetID());
locker.Unlock();
@ -2818,7 +2818,7 @@ ClientConnection::_UnmountVolume(ClientVolume* volume)
event->opcode = B_DEVICE_UNMOUNTED;
_PushNodeMonitoringEvent(volume->GetID(), event);
event->RemoveReference();
event->ReleaseReference();
}
}
@ -3233,7 +3233,7 @@ ClientConnection::_OpenQuery(const char* queryString, uint32 flags,
flags, remotePort, remoteToken, &queryHandle);
if (error != B_OK)
return error;
Reference<QueryHandle> handleReference(queryHandle, true);
BReference<QueryHandle> handleReference(queryHandle, true);
// lock the handle
queryHandle->Lock();

View File

@ -43,7 +43,7 @@ ClientVolume::~ClientVolume()
Unmount();
if (fShare)
fShare->RemoveReference();
fShare->ReleaseReference();
delete fNodeHandles;
delete fSecurityContext;
@ -84,7 +84,7 @@ ClientVolume::Mount(UserSecurityContext* securityContext, Share* share)
securityContextDeleter.Detach();
fShare = share;
fShare->AddReference();
fShare->AcquireReference();
dev_t volumeID = share->GetVolumeID();
ino_t nodeID = share->GetNodeID();
@ -400,7 +400,7 @@ ClientVolume::Open(Node* node, int openMode, FileHandle** _handle)
status_t error = node->Open(openMode, &handle);
if (error != B_OK)
return error;
Reference<NodeHandle> handleReference(handle, true);
BReference<NodeHandle> handleReference(handle, true);
// lock the handle
handle->Lock();
@ -429,7 +429,7 @@ ClientVolume::OpenDir(Directory* directory, DirIterator** _iterator)
status_t error = directory->OpenDir(&iterator);
if (error != B_OK)
return error;
Reference<NodeHandle> handleReference(iterator, true);
BReference<NodeHandle> handleReference(iterator, true);
// lock the handle
iterator->Lock();
@ -458,7 +458,7 @@ ClientVolume::OpenAttrDir(Node* node, AttrDirIterator** _iterator)
status_t error = node->OpenAttrDir(&iterator);
if (error != B_OK)
return error;
Reference<NodeHandle> handleReference(iterator, true);
BReference<NodeHandle> handleReference(iterator, true);
// lock the handle
iterator->Lock();

View File

@ -408,7 +408,7 @@ NetFSServer::MessageReceived(BMessage* message)
connection->UserRemoved(user);
}
user->RemoveReference();
user->ReleaseReference();
}
_SendReply(message, error);
@ -446,7 +446,7 @@ NetFSServer::MessageReceived(BMessage* message)
_SendReply(message, B_ENTRY_NOT_FOUND);
break;
}
Reference<User> userReference(user, true);
BReference<User> userReference(user, true);
// get the statistics
BMessage statistics;
@ -509,7 +509,7 @@ NetFSServer::MessageReceived(BMessage* message)
connection->ShareRemoved(share);
}
share->RemoveReference();
share->ReleaseReference();
}
if (error == B_OK)
@ -552,7 +552,7 @@ NetFSServer::MessageReceived(BMessage* message)
_SendReply(message, B_ENTRY_NOT_FOUND);
break;
}
Reference<Share> shareReference(share, true);
BReference<Share> shareReference(share, true);
// get all users
BMessage allUsers;
@ -572,7 +572,7 @@ NetFSServer::MessageReceived(BMessage* message)
// get the user's permissions
Permissions permissions = fSecurityContext
->GetNodePermissions(share->GetPath(), user);
user->RemoveReference();
user->ReleaseReference();
// add the user, if they have the permission to mount the
// share
@ -616,7 +616,7 @@ NetFSServer::MessageReceived(BMessage* message)
_SendReply(message, B_ENTRY_NOT_FOUND);
break;
}
Reference<Share> shareReference(share, true);
BReference<Share> shareReference(share, true);
// get the statistics
BMessage statistics;
@ -653,8 +653,8 @@ NetFSServer::MessageReceived(BMessage* message)
// get the share and the user
Share* share = fSecurityContext->FindShare(shareName);
User* user = fSecurityContext->FindUser(userName);
Reference<Share> shareReference(share);
Reference<User> userReference(user);
BReference<Share> shareReference(share);
BReference<User> userReference(user);
if (!share || !user) {
_SendReply(message, B_ENTRY_NOT_FOUND);
break;
@ -699,8 +699,8 @@ NetFSServer::MessageReceived(BMessage* message)
// get the share and the user
Share* share = fSecurityContext->FindShare(shareName);
User* user = fSecurityContext->FindUser(userName);
Reference<Share> shareReference(share);
Reference<User> userReference(user);
BReference<Share> shareReference(share);
BReference<User> userReference(user);
if (!share || !user) {
_SendReply(message, B_ENTRY_NOT_FOUND);
break;
@ -837,7 +837,7 @@ NetFSServer::_LoadSecurityContext(SecurityContext** _securityContext)
ERROR("ERROR: Failed to add share `%s'\n", shareName);
continue;
}
Reference<Share> shareReference(share, true);
BReference<Share> shareReference(share, true);
DriverParameter userParameter;
// iterate through the share users
for (DriverParameterIterator userIt
@ -850,7 +850,7 @@ NetFSServer::_LoadSecurityContext(SecurityContext** _securityContext)
ERROR("ERROR: Undefined user `%s'.\n", userName);
continue;
}
Reference<User> userReference(user, true);
BReference<User> userReference(user, true);
DriverParameter permissionsParameter;
if (!userParameter.FindParameter("permissions",
&permissionsParameter)) {

View File

@ -21,7 +21,7 @@
// constructor
NodeHandle::NodeHandle()
: BReferenceable(true),
: BReferenceable(),
Lockable(),
fCookie(-1),
fNodeRef()

View File

@ -42,7 +42,7 @@ NodeHandleMap::AddNodeHandle(NodeHandle* handle)
status_t error = Put(handle->GetCookie(), handle);
if (error == B_OK)
handle->AddReference();
handle->AcquireReference();
return error;
}
@ -60,7 +60,7 @@ NodeHandleMap::RemoveNodeHandle(NodeHandle* handle)
return false;
Remove(handle->GetCookie());
handle->RemoveReference();
handle->ReleaseReference();
return true;
}
@ -81,7 +81,7 @@ NodeHandleMap::LockNodeHandle(int32 cookie, NodeHandle** _handle)
handle = Get(cookie);
if (!handle)
return B_ENTRY_NOT_FOUND;
handle->AddReference();
handle->AcquireReference();
// first attempt: we just try to lock the node handle, which will fail,
// if someone else has the lock at the momemt
@ -109,7 +109,7 @@ NodeHandleMap::LockNodeHandle(int32 cookie, NodeHandle** _handle)
// wait for the lock
status_t error = lockerCandidate.Block();
if (error != B_OK) {
handle->RemoveReference();
handle->ReleaseReference();
return error;
}
@ -130,7 +130,7 @@ NodeHandleMap::UnlockNodeHandle(NodeHandle* nodeHandle)
AutoLocker<Locker> _(this);
nodeHandle->Unlock();
nodeHandle->RemoveReference();
nodeHandle->ReleaseReference();
}
}

View File

@ -10,7 +10,7 @@
// constructor
NodeMonitoringEvent::NodeMonitoringEvent()
: BReferenceable(true),
: BReferenceable(),
time(system_time()),
queryHandler(NULL),
remotePort(-1),
@ -22,7 +22,7 @@ NodeMonitoringEvent::NodeMonitoringEvent()
NodeMonitoringEvent::~NodeMonitoringEvent()
{
if (queryHandler)
queryHandler->RemoveReference();
queryHandler->ReleaseReference();
}

View File

@ -38,7 +38,7 @@ get_node_ref_for_path(const char* path, node_ref* ref)
// constructor
User::User()
: BReferenceable(true),
: BReferenceable(),
BArchivable(),
fName(),
fPassword()
@ -47,7 +47,7 @@ User::User()
// constructor
User::User(BMessage* archive)
: BReferenceable(true),
: BReferenceable(),
BArchivable(archive),
fName(),
fPassword()
@ -145,7 +145,7 @@ User::GetPassword() const
// constructor
Share::Share()
: BReferenceable(true),
: BReferenceable(),
BArchivable(),
fName(),
fNodeRef(),
@ -155,7 +155,7 @@ Share::Share()
// constructor
Share::Share(BMessage* archive)
: BReferenceable(true),
: BReferenceable(),
BArchivable(archive),
fName(),
fNodeRef(),
@ -436,7 +436,7 @@ SecurityContext::SecurityContext(BMessage* archive)
User* user = FindUser(userName);
if (!user)
return;
Reference<User> userReference(user, true);
BReference<User> userReference(user, true);
error = permissionsArchive.FindMessage(userName, &userArchive);
if (error != B_OK)
return;
@ -464,13 +464,13 @@ SecurityContext::~SecurityContext()
// remove all user references
for (UserMap::Iterator it = fUsers->GetIterator(); it.HasNext();) {
User* user = it.Next().value;
user->RemoveReference();
user->ReleaseReference();
}
// remove all share references
for (ShareMap::Iterator it = fShares->GetIterator(); it.HasNext();) {
Share* share = it.Next().value;
share->RemoveReference();
share->ReleaseReference();
}
delete fUsers;
@ -609,7 +609,7 @@ SecurityContext::AddUser(const char* name, const char* password, User** _user)
User* user = new(std::nothrow) User;
if (!user)
return B_NO_MEMORY;
Reference<User> userReference(user, true);
BReference<User> userReference(user, true);
status_t error = user->Init(name, password);
if (error != B_OK)
return error;
@ -622,7 +622,7 @@ SecurityContext::AddUser(const char* name, const char* password, User** _user)
userReference.Detach();
if (_user) {
*_user = user;
user->AddReference();
user->AcquireReference();
}
return B_OK;
}
@ -642,13 +642,13 @@ SecurityContext::RemoveUser(const char* name, User** _user)
User* user = FindUser(name);
if (!user)
return B_ENTRY_NOT_FOUND;
Reference<User> userReference(user, true);
BReference<User> userReference(user, true);
// remove it
status_t error = RemoveUser(user);
if (error == B_OK && _user) {
*_user = user;
user->AddReference();
user->AcquireReference();
}
return error;
@ -677,7 +677,7 @@ SecurityContext::RemoveUser(User* user)
}
// surrender our user reference
user->RemoveReference();
user->ReleaseReference();
return B_OK;
}
@ -694,7 +694,7 @@ SecurityContext::FindUser(const char* name)
ContextLocker _(this);
User* user = fUsers->Get(name);
if (user)
user->AddReference();
user->AcquireReference();
return user;
}
@ -713,7 +713,7 @@ SecurityContext::AuthenticateUser(const char* name, const char* password,
User* user = FindUser(name);
if (!user)
return B_PERMISSION_DENIED;
Reference<User> userReference(user, true);
BReference<User> userReference(user, true);
// check password
if (user->GetPassword()) {
@ -773,7 +773,7 @@ SecurityContext::AddShare(const char* name, const node_ref& ref, Share** _share)
Share* share = new(std::nothrow) Share;
if (!share)
return B_NO_MEMORY;
Reference<Share> shareReference(share, true);
BReference<Share> shareReference(share, true);
status_t error = share->Init(name, ref);
if (error != B_OK)
return error;
@ -786,7 +786,7 @@ SecurityContext::AddShare(const char* name, const node_ref& ref, Share** _share)
shareReference.Detach();
if (_share) {
*_share = share;
share->AddReference();
share->AcquireReference();
}
return B_OK;
}
@ -809,7 +809,7 @@ SecurityContext::AddShare(const char* name, const char* path, Share** _share)
Share* share = new(std::nothrow) Share;
if (!share)
return B_NO_MEMORY;
Reference<Share> shareReference(share, true);
BReference<Share> shareReference(share, true);
status_t error = share->Init(name, path);
if (error != B_OK)
return error;
@ -822,7 +822,7 @@ SecurityContext::AddShare(const char* name, const char* path, Share** _share)
shareReference.Detach();
if (_share) {
*_share = share;
share->AddReference();
share->AcquireReference();
}
return B_OK;
}
@ -842,13 +842,13 @@ SecurityContext::RemoveShare(const char* name, Share** _share)
Share* share = FindShare(name);
if (!share)
return B_ENTRY_NOT_FOUND;
Reference<Share> shareReference(share, true);
BReference<Share> shareReference(share, true);
// remove it
status_t error = RemoveShare(share);
if (error == B_OK && _share) {
*_share = share;
share->AddReference();
share->AcquireReference();
}
return error;
@ -869,7 +869,7 @@ SecurityContext::RemoveShare(Share* share)
fShares->Remove(share->GetName());
// surrender our share reference
share->RemoveReference();
share->ReleaseReference();
return B_OK;
}
@ -886,7 +886,7 @@ SecurityContext::FindShare(const char* name)
ContextLocker _(this);
Share* share = fShares->Get(name);
if (share)
share->AddReference();
share->AcquireReference();
return share;
}

View File

@ -23,7 +23,7 @@ UserSecurityContext::UserSecurityContext()
UserSecurityContext::~UserSecurityContext()
{
if (fUser)
fUser->RemoveReference();
fUser->ReleaseReference();
delete fPermissions;
}
@ -33,11 +33,11 @@ status_t
UserSecurityContext::Init(User* user)
{
if (fUser)
fUser->RemoveReference();
fUser->ReleaseReference();
fUser = user;
if (fUser)
fUser->AddReference();
fUser->AcquireReference();
delete fPermissions;
fPermissions = new(std::nothrow) PermissionMap;

View File

@ -38,7 +38,7 @@ public:
:
BHandler(),
QueryListener(),
BReferenceable(true),
BReferenceable(),
fListener(listener),
fQueryDomain(queryDomain),
fHandle(handle)
@ -77,7 +77,7 @@ public:
}
if (event) {
event->queryHandler = this;
AddReference();
AcquireReference();
if (event->Init(message) == B_OK)
fListener->ProcessNodeMonitoringEvent(event);
else
@ -98,7 +98,7 @@ public:
looper->Unlock();
}
handle->SetQueryListener(NULL);
RemoveReference();
ReleaseReference();
}
private:
@ -227,21 +227,21 @@ VolumeManager::~VolumeManager()
// entry created events
for (EntryCreatedEventMap::Iterator it = fEntryCreatedEvents->GetIterator();
it.HasNext();) {
it.Next().value->RemoveReference();
it.Next().value->ReleaseReference();
}
delete fEntryCreatedEvents;
// entry removed events
for (EntryRemovedEventMap::Iterator it = fEntryRemovedEvents->GetIterator();
it.HasNext();) {
it.Next().value->RemoveReference();
it.Next().value->ReleaseReference();
}
delete fEntryRemovedEvents;
// entry moved events
for (EntryMovedEventMap::Iterator it = fEntryMovedEvents->GetIterator();
it.HasNext();) {
it.Next().value->RemoveReference();
it.Next().value->ReleaseReference();
}
delete fEntryMovedEvents;
@ -249,7 +249,7 @@ VolumeManager::~VolumeManager()
for (NodeStatChangedEventMap::Iterator it
= fNodeStatChangedEvents->GetIterator();
it.HasNext();) {
it.Next().value->RemoveReference();
it.Next().value->ReleaseReference();
}
delete fNodeStatChangedEvents;
@ -257,7 +257,7 @@ VolumeManager::~VolumeManager()
for (NodeAttributeChangedEventMap::Iterator it
= fNodeAttributeChangedEvents->GetIterator();
it.HasNext();) {
it.Next().value->RemoveReference();
it.Next().value->ReleaseReference();
}
delete fNodeAttributeChangedEvents;
@ -1071,13 +1071,13 @@ VolumeManager::_EntryCreated(EntryCreatedEvent* event)
fEntryCreatedEvents->Remove(ref);
fRecentNodeMonitoringEvents.Remove(oldEvent);
notify = !_IsRecentEvent(oldEvent);
oldEvent->RemoveReference();
oldEvent->ReleaseReference();
}
// add the new event
if (fEntryCreatedEvents->Put(ref, event) == B_OK) {
fRecentNodeMonitoringEvents.Insert(event);
event->AddReference();
event->AcquireReference();
}
// if the directory is complete or at least has iterators attached to it,
@ -1148,13 +1148,13 @@ VolumeManager::_EntryRemoved(EntryRemovedEvent* event, bool keepNode)
fEntryRemovedEvents->Remove(ref);
fRecentNodeMonitoringEvents.Remove(oldEvent);
notify = !_IsRecentEvent(oldEvent);
oldEvent->RemoveReference();
oldEvent->ReleaseReference();
}
// add the new event
if (fEntryRemovedEvents->Put(ref, event) == B_OK) {
fRecentNodeMonitoringEvents.Insert(event);
event->AddReference();
event->AcquireReference();
}
// remove the entry
@ -1236,13 +1236,13 @@ VolumeManager::_EntryMoved(EntryMovedEvent* event)
fEntryMovedEvents->Remove(key);
fRecentNodeMonitoringEvents.Remove(oldEvent);
notify = !_IsRecentEvent(oldEvent);
oldEvent->RemoveReference();
oldEvent->ReleaseReference();
}
// add the new event
if (fEntryMovedEvents->Put(key, event) == B_OK) {
fRecentNodeMonitoringEvents.Insert(event);
event->AddReference();
event->AcquireReference();
}
}
@ -1301,7 +1301,7 @@ VolumeManager::_EntryMoved(EntryMovedEvent* event)
if (event->fromName.GetLength() > 0)
removedEvent->name = event->fromName;
clientVolume->ProcessNodeMonitoringEvent(removedEvent);
removedEvent->RemoveReference();
removedEvent->ReleaseReference();
}
} else if (containsTo) {
// contains only the target directory: generate an
@ -1316,7 +1316,7 @@ VolumeManager::_EntryMoved(EntryMovedEvent* event)
createdEvent->directoryID = event->toDirectoryID;
createdEvent->name = event->toName;
clientVolume->ProcessNodeMonitoringEvent(createdEvent);
createdEvent->RemoveReference();
createdEvent->ReleaseReference();
}
}
}
@ -1341,13 +1341,13 @@ VolumeManager::_NodeStatChanged(StatChangedEvent* event)
fNodeStatChangedEvents->Remove(ref);
fRecentNodeMonitoringEvents.Remove(oldEvent);
notify = !_IsRecentEvent(oldEvent);
oldEvent->RemoveReference();
oldEvent->ReleaseReference();
}
// add the new event
if (fNodeStatChangedEvents->Put(ref, event) == B_OK) {
fRecentNodeMonitoringEvents.Insert(event);
event->AddReference();
event->AcquireReference();
}
if (notify) {
@ -1384,13 +1384,13 @@ VolumeManager::_NodeAttributeChanged(AttributeChangedEvent* event)
fNodeAttributeChangedEvents->Remove(ref);
fRecentNodeMonitoringEvents.Remove(oldEvent);
notify = !_IsRecentEvent(oldEvent);
oldEvent->RemoveReference();
oldEvent->ReleaseReference();
}
// add the new event
if (fNodeAttributeChangedEvents->Put(ref, event) == B_OK) {
fRecentNodeMonitoringEvents.Insert(event);
event->AddReference();
event->AcquireReference();
}
// send notifications
@ -1425,7 +1425,7 @@ VolumeManager::_VolumeMounted(VolumeMountedEvent* event)
if (_GenerateEntryRemovedEvent(entry, system_time(),
&event) == B_OK) {
_EntryRemoved(event, true);
event->RemoveReference();
event->ReleaseReference();
} else {
RemoveEntry(entry);
delete entry;
@ -1471,7 +1471,7 @@ VolumeManager::_VolumeUnmounted(VolumeUnmountedEvent* event)
if (_GenerateEntryRemovedEvent(entry, event->time,
&removedEvent) == B_OK) {
_EntryRemoved(removedEvent, true);
removedEvent->RemoveReference();
removedEvent->ReleaseReference();
} else {
RemoveEntry(entry);
delete entry;
@ -1590,7 +1590,7 @@ VolumeManager::_QueryEntryMoved(EntryMovedEvent* event)
removedEvent->opcode = B_ENTRY_REMOVED;
removedEvent->time = event->time;
removedEvent->queryHandler = event->queryHandler;
removedEvent->queryHandler->AddReference();
removedEvent->queryHandler->AcquireReference();
removedEvent->volumeID = event->volumeID;
removedEvent->directoryID = event->fromDirectoryID;
removedEvent->nodeVolumeID = event->volumeID;
@ -1601,7 +1601,7 @@ VolumeManager::_QueryEntryMoved(EntryMovedEvent* event)
createdEvent->opcode = B_ENTRY_CREATED;
createdEvent->time = event->time;
createdEvent->queryHandler = event->queryHandler;
createdEvent->queryHandler->AddReference();
createdEvent->queryHandler->AcquireReference();
createdEvent->volumeID = event->volumeID;
createdEvent->directoryID = event->toDirectoryID;
createdEvent->nodeID = event->nodeID;
@ -1609,9 +1609,9 @@ VolumeManager::_QueryEntryMoved(EntryMovedEvent* event)
// send them
_QueryEntryRemoved(removedEvent);
removedEvent->RemoveReference();
removedEvent->ReleaseReference();
_QueryEntryCreated(createdEvent);
createdEvent->RemoveReference();
createdEvent->ReleaseReference();
}
// _IsRecentEvent
@ -1650,7 +1650,7 @@ VolumeManager::_GenerateEntryCreatedEvent(const entry_ref& ref, bigtime_t time,
*_event = event;
} else {
_EntryCreated(event);
event->RemoveReference();
event->ReleaseReference();
}
return B_OK;
@ -1682,7 +1682,7 @@ VolumeManager::_GenerateEntryRemovedEvent(Entry* entry, bigtime_t time,
*_event = event;
} else {
_EntryRemoved(event, false);
event->RemoveReference();
event->ReleaseReference();
}
return B_OK;
@ -1776,7 +1776,7 @@ VolumeManager::_NodeMonitoringProcessor()
break;
}
}
event->RemoveReference();
event->ReleaseReference();
// If there is another event available, get it as long as we
// have the VolumeManager lock.

View File

@ -5,7 +5,7 @@
// constructor
FSObject::FSObject()
:
BReferenceable(false),
BReferenceable(),
fRemoved(false)
{
}
@ -29,3 +29,9 @@ FSObject::IsRemoved() const
return fRemoved;
}
void
FSObject::LastReferenceReleased()
{
// don't delete
}

View File

@ -191,7 +191,7 @@ NetAddress::operator!=(const NetAddress& address) const
class NetAddressResolver::Resolver : public BReferenceable {
public:
Resolver()
: BReferenceable(false),
: BReferenceable(),
fLock()
{
}
@ -217,6 +217,12 @@ public:
return B_OK;
}
protected:
virtual void LastReferenceReleased()
{
// don't delete
}
private:
Locker fLock;
};
@ -227,7 +233,7 @@ NetAddressResolver::NetAddressResolver()
_Lock();
// initialize static instance, if not done yet
if (sResolver) {
sResolver->AddReference();
sResolver->AcquireReference();
fResolver = sResolver;
} else {
sResolver = new(std::nothrow) Resolver;
@ -247,7 +253,7 @@ NetAddressResolver::~NetAddressResolver()
{
if (fResolver) {
_Lock();
if (sResolver->RemoveReference()) {
if (sResolver->ReleaseReference()) {
delete sResolver;
sResolver = NULL;
}

View File

@ -382,7 +382,7 @@ FileSystem::Mount(fs_volume* fsVolume, const char* device, uint32 flags,
MutexLocker locker(fVolumeLock);
fVolumes.Remove(volume);
locker.Unlock();
volume->RemoveReference();
volume->ReleaseReference();
return error;
}
@ -442,7 +442,7 @@ FileSystem::GetVolume(dev_t id)
it++) {
Volume* volume = *it;
if (volume->GetID() == id) {
volume->AddReference();
volume->AcquireReference();
return volume;
}
}

View File

@ -26,7 +26,7 @@
// constructor
FileSystemInitializer::FileSystemInitializer(const char* name)
:
Referenceable(false),
BReferenceable(),
fName(name),
fFileSystem(NULL)
{
@ -99,6 +99,13 @@ FileSystemInitializer::FirstTimeInit()
}
void
FileSystemInitializer::LastReferenceReleased()
{
// don't delete
}
status_t
FileSystemInitializer::_Init(port_id port)
{

View File

@ -20,7 +20,7 @@ using UserlandFSUtil::RequestPort;
class FileSystem;
class FileSystemInitializer : public LazyInitializable, public Referenceable {
class FileSystemInitializer : public LazyInitializable, public BReferenceable {
public:
FileSystemInitializer(const char* name);
~FileSystemInitializer();
@ -30,6 +30,8 @@ public:
protected:
virtual status_t FirstTimeInit();
virtual void LastReferenceReleased();
private:
status_t _Init(port_id port);

View File

@ -24,7 +24,7 @@ public:
~VolumePutter()
{
if (fVolume)
fVolume->RemoveReference();
fVolume->ReleaseReference();
}
private:
@ -906,7 +906,7 @@ KernelRequestHandler::_GetVolume(dev_t id, Volume** volume)
*volume = NULL;
return B_BAD_VALUE;
}
fVolume->AddReference();
fVolume->AcquireReference();
*volume = fVolume;
return B_OK;
}

View File

@ -87,7 +87,7 @@ UserlandFS::RegisterFileSystem(const char* name, FileSystem** _fileSystem)
FileSystemLocker _(fFileSystems);
fileSystemInitializer = fFileSystems->Get(name);
if (fileSystemInitializer) {
fileSystemInitializer->AddReference();
fileSystemInitializer->AcquireReference();
} else {
fileSystemInitializer = new(nothrow) FileSystemInitializer(name);
if (!fileSystemInitializer)
@ -164,7 +164,7 @@ UserlandFS::_UnregisterFileSystem(const char* name)
if (!fileSystemInitializer)
return B_BAD_VALUE;
deleteFS = fileSystemInitializer->RemoveReference();
deleteFS = fileSystemInitializer->ReleaseReference();
if (deleteFS)
fFileSystems->Remove(name);
}

View File

@ -173,7 +173,7 @@ struct Volume::IORequestStructMap
// IterativeFDIOCookie
struct Volume::IterativeFDIOCookie : public Referenceable {
struct Volume::IterativeFDIOCookie : public BReferenceable {
Volume* volume;
int fd;
int32 requestID;
@ -295,7 +295,7 @@ Volume::HasVNodeCapability(VNode* vnode, int capability) const
// constructor
Volume::Volume(FileSystem* fileSystem, fs_volume* fsVolume)
:
Referenceable(true),
BReferenceable(),
fFileSystem(fileSystem),
fFSVolume(fsVolume),
fUserlandVolume(NULL),
@ -741,7 +741,7 @@ Volume::DoIterativeFDIO(int fd, int32 requestID, void* clientCookie,
}
// we need another reference, so we can still access the cookie below
cookie->AddReference();
cookie->AcquireReference();
// TODO: Up to this point we're responsible for calling the finished hook on
// error!
@ -754,7 +754,7 @@ Volume::DoIterativeFDIO(int fd, int32 requestID, void* clientCookie,
MutexLocker _(fLock);
cookie->vecs = NULL;
cookie->vecCount = 0;
cookie->RemoveReference();
cookie->ReleaseReference();
return error;
}
@ -4765,7 +4765,7 @@ Volume::_IterativeFDIOFinished(void* _cookie, io_request* ioRequest,
// At any rate, we're done with the cookie after this call -- it will not
// be used anymore.
Reference<IterativeFDIOCookie> _(cookie, true);
BReference<IterativeFDIOCookie> _(cookie, true);
// We also want to dispose of the request.
IORequestRemover _2(volume, cookie->requestID);

View File

@ -32,7 +32,7 @@ using UserlandFSUtil::userlandfs_ioctl;
class FileSystem;
class Volume : public Referenceable {
class Volume : public BReferenceable {
public:
Volume(FileSystem* fileSystem,
fs_volume* fsVolume);

View File

@ -125,7 +125,7 @@ userlandfs_unmount(fs_volume* fsVolume)
status_t error = volume->Unmount();
// The error code the FS's unmount hook returns is completely irrelevant to
// the VFS. It considers the volume unmounted in any case.
volume->RemoveReference();
volume->ReleaseReference();
UserlandFS::GetUserlandFS()->UnregisterFileSystem(fileSystem);
PRINT(("userlandfs_unmount() done: %lx\n", error));

View File

@ -22,9 +22,9 @@ static const int32 kTrueValueStringCount
// #pragma mark ----- DriverParameterIterator -----
// Delegate
class DriverParameterIterator::Delegate : public Referenceable {
class DriverParameterIterator::Delegate : public BReferenceable {
public:
Delegate() : Referenceable(true) {}
Delegate() : BReferenceable() {}
virtual ~Delegate() {}
virtual Delegate* Clone() const = 0;
@ -94,10 +94,10 @@ void
DriverParameterIterator::_SetTo(Delegate* delegate, bool addReference)
{
if (fDelegate)
fDelegate->RemoveReference();
fDelegate->ReleaseReference();
fDelegate = delegate;
if (fDelegate && addReference)
fDelegate->AddReference();
fDelegate->AcquireReference();
}

View File

@ -90,7 +90,7 @@ UnixEndpoint::Uninit()
Close();
}
RemoveReference();
ReleaseReference();
}
@ -115,7 +115,7 @@ UnixEndpoint::Close()
TRACE("[%ld] %p->UnixEndpoint::Close()\n", find_thread(NULL), this);
UnixEndpointLocker locker(this);
if (fState == UNIX_ENDPOINT_CONNECTED) {
UnixEndpointLocker peerLocker;
if (_LockConnectedEndpoints(locker, peerLocker) == B_OK) {
@ -317,7 +317,7 @@ UnixEndpoint::Connect(const struct sockaddr *_address)
UnixEndpoint* listeningEndpoint = gAddressManager.Lookup(unixAddress);
if (listeningEndpoint == NULL)
RETURN_ERROR(ECONNREFUSED);
Reference<UnixEndpoint> peerReference(listeningEndpoint);
BReference<UnixEndpoint> peerReference(listeningEndpoint);
addressLocker.Unlock();
UnixEndpointLocker peerLocker(listeningEndpoint);
@ -359,7 +359,7 @@ UnixEndpoint::Connect(const struct sockaddr *_address)
fPeerEndpoint = connectedEndpoint;
PeerAddress().SetTo(&connectedEndpoint->socket->address);
fPeerEndpoint->AddReference();
fPeerEndpoint->AcquireReference();
fReceiveFifo = fifo;
fCredentials.pid = getpid();
@ -433,7 +433,7 @@ UnixEndpoint::Send(const iovec *vecs, size_t vecCount,
UnixEndpointLocker locker(this);
Reference<UnixEndpoint> peerReference;
BReference<UnixEndpoint> peerReference;
UnixEndpointLocker peerLocker;
status_t error = _LockConnectedEndpoints(locker, peerLocker);
@ -445,7 +445,7 @@ UnixEndpoint::Send(const iovec *vecs, size_t vecCount,
// lock the peer's FIFO
UnixFifo* peerFifo = peerEndpoint->fReceiveFifo;
Reference<UnixFifo> _(peerFifo);
BReference<UnixFifo> _(peerFifo);
UnixFifoLocker fifoLocker(peerFifo);
// unlock endpoints
@ -530,7 +530,7 @@ UnixEndpoint::Receive(const iovec *vecs, size_t vecCount,
RETURN_ERROR(ENOTCONN);
UnixEndpoint* peerEndpoint = fPeerEndpoint;
Reference<UnixEndpoint> peerReference(peerEndpoint);
BReference<UnixEndpoint> peerReference(peerEndpoint);
// Copy the peer address upfront. This way, if we read something, we don't
// get into a potential race with Close().
@ -542,7 +542,7 @@ UnixEndpoint::Receive(const iovec *vecs, size_t vecCount,
// lock our FIFO
UnixFifo* fifo = fReceiveFifo;
Reference<UnixFifo> _(fifo);
BReference<UnixFifo> _(fifo);
UnixFifoLocker fifoLocker(fifo);
// unlock endpoint
@ -742,7 +742,7 @@ UnixEndpoint::_Spawn(UnixEndpoint* connectingEndpoint,
fIsChild = true;
fPeerEndpoint = connectingEndpoint;
fPeerEndpoint->AddReference();
fPeerEndpoint->AcquireReference();
fReceiveFifo = fifo;
@ -769,7 +769,7 @@ UnixEndpoint::_Disconnect()
gSocketModule->notify(socket, B_SELECT_WRITE, ECONNRESET);
// Unset the peer endpoint.
fPeerEndpoint->RemoveReference();
fPeerEndpoint->ReleaseReference();
fPeerEndpoint = NULL;
// We're officially disconnected.
@ -788,7 +788,7 @@ UnixEndpoint::_LockConnectedEndpoints(UnixEndpointLocker& locker,
// We need to lock the peer, too. Get a reference -- we might need to
// unlock ourselves to get the locking order right.
Reference<UnixEndpoint> peerReference(fPeerEndpoint);
BReference<UnixEndpoint> peerReference(fPeerEndpoint);
UnixEndpoint* peerEndpoint = fPeerEndpoint;
if (fIsChild) {
@ -852,7 +852,7 @@ void
UnixEndpoint::_UnsetReceiveFifo()
{
if (fReceiveFifo) {
fReceiveFifo->RemoveReference();
fReceiveFifo->ReleaseReference();
fReceiveFifo = NULL;
}
}

View File

@ -38,7 +38,7 @@ typedef AutoLocker<UnixEndpoint> UnixEndpointLocker;
class UnixEndpoint : public net_protocol, public ProtocolSocket,
public Referenceable {
public BReferenceable {
public:
UnixEndpoint(net_socket* socket);
virtual ~UnixEndpoint();

View File

@ -84,7 +84,7 @@ private:
};
class UnixFifo : public Referenceable {
class UnixFifo : public BReferenceable {
public:
UnixFifo(size_t capacity);
~UnixFifo();

View File

@ -30,7 +30,7 @@ struct net_device_interface;
struct InterfaceAddress : DoublyLinkedListLinkImpl<InterfaceAddress>,
net_interface_address, Referenceable {
net_interface_address, BReferenceable {
InterfaceAddress();
InterfaceAddress(net_interface* interface,
net_domain* domain);
@ -112,7 +112,7 @@ typedef BOpenHashTable<DatalinkHashDefinition, true, true> DatalinkTable;
class Interface : public DoublyLinkedListLinkImpl<Interface>,
public net_interface, public Referenceable {
public net_interface, public BReferenceable {
public:
Interface(const char* name,
net_device_interface* deviceInterface);

View File

@ -504,7 +504,7 @@ NotificationManager::RegisterService(NotificationService& service)
status_t status = fServiceHash.Insert(&service);
if (status == B_OK)
service.AddReference();
service.AcquireReference();
return status;
}
@ -515,7 +515,7 @@ NotificationManager::UnregisterService(NotificationService& service)
{
MutexLocker _(fLock);
fServiceHash.Remove(&service);
service.RemoveReference();
service.ReleaseReference();
}
@ -541,7 +541,7 @@ NotificationManager::AddListener(const char* serviceName,
if (service == NULL)
return B_NAME_NOT_FOUND;
Reference<NotificationService> reference(service);
BReference<NotificationService> reference(service);
locker.Unlock();
return service->AddListener(eventSpecifier, listener);
@ -570,7 +570,7 @@ NotificationManager::UpdateListener(const char* serviceName,
if (service == NULL)
return B_NAME_NOT_FOUND;
Reference<NotificationService> reference(service);
BReference<NotificationService> reference(service);
locker.Unlock();
return service->UpdateListener(eventSpecifier, listener);
@ -586,7 +586,7 @@ NotificationManager::RemoveListener(const char* serviceName,
if (service == NULL)
return B_NAME_NOT_FOUND;
Reference<NotificationService> reference(service);
BReference<NotificationService> reference(service);
locker.Unlock();
return service->RemoveListener(eventSpecifier, listener);

View File

@ -50,7 +50,7 @@ static SystemProfiler* sProfiler = NULL;
static struct system_profiler_parameters* sRecordedParameters = NULL;
class SystemProfiler : public Referenceable, private NotificationListener,
class SystemProfiler : public BReferenceable, private NotificationListener,
private SchedulerListener, private WaitObjectListener {
public:
SystemProfiler(team_id team,
@ -611,7 +611,7 @@ SystemProfiler::EventOccurred(NotificationService& service,
sProfiler = NULL;
locker.Unlock();
RemoveReference();
ReleaseReference();
return;
}
@ -1474,7 +1474,7 @@ stop_system_profiler()
sProfiler = NULL;
locker.Unlock();
profiler->RemoveReference();
profiler->ReleaseReference();
}
@ -1558,7 +1558,7 @@ _user_system_profiler_next_buffer(size_t bytesRead, uint64* _droppedEvents)
// get a reference to the profiler
SystemProfiler* profiler = sProfiler;
Reference<SystemProfiler> reference(profiler);
BReference<SystemProfiler> reference(profiler);
locker.Unlock();
uint64 droppedEvents;
@ -1584,7 +1584,7 @@ _user_system_profiler_stop()
sProfiler = NULL;
locker.Unlock();
profiler->RemoveReference();
profiler->ReleaseReference();
return B_OK;
}