2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
14 #include <ObjectList.h>
16 #include <package/PackageDefs.h>
19 #include <Referenceable.h>
21 #include <package/packagefs.h>
27 class Root
: public BReferenceable
, private Volume::Listener
{
32 status_t
Init(const node_ref
& nodeRef
,
35 const node_ref
& NodeRef() const { return fNodeRef
; }
36 dev_t
DeviceID() const { return fNodeRef
.device
; }
37 ino_t
NodeID() const { return fNodeRef
.node
; }
38 const BString
& Path() const { return fPath
; }
40 bool IsSystemRoot() const
41 { return fIsSystemRoot
; }
43 status_t
RegisterVolume(Volume
* volume
);
44 void UnregisterVolume(Volume
* volume
);
45 // deletes the volume (eventually)
47 Volume
* FindVolume(dev_t deviceID
) const;
49 BPackageInstallationLocation location
);
51 void HandleRequest(BMessage
* message
);
55 virtual void VolumeNodeMonitorEventOccurred(Volume
* volume
);
58 virtual void LastReferenceReleased();
61 struct AbstractVolumeJob
;
63 struct ProcessNodeMonitorEventsJob
;
64 struct CommitTransactionJob
;
65 struct VolumeJobFilter
;
67 friend struct CommitTransactionJob
;
70 Volume
** _GetVolume(PackageFSMountType mountType
);
71 Volume
* _NextVolumeFor(Volume
* volume
);
73 void _InitPackages(Volume
* volume
);
74 void _DeleteVolume(Volume
* volume
);
75 void _ProcessNodeMonitorEvents(Volume
* volume
);
76 void _CommitTransaction(Volume
* volume
,
79 status_t
_QueueJob(Job
* job
);
81 static status_t
_JobRunnerEntry(void* data
);
82 status_t
_JobRunner();
84 static void _ShowError(const char* errorMessage
);
87 mutable BLocker fLock
;
91 Volume
* fSystemVolume
;