* implement fetching of initial domain from the mount parameters in
order to be able to mount packages from somewhere else than '/boot/common/packages' (squashes a TODO) * squashed another TODO about needing to remove nodes of already installed packages if anything goes wrong during the activation of a package domain * fix what to me looks like a bug in Volume::AddPackageDomainJob::Do(), fDomain is accessed unconditionally in the destructor, so NULLing it here is bad (it doesn't make sense from a reference-passing POV either). The problem never showed as this code is never being executed currently (no way to add additional package domains as of yet) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40214 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <new>
|
||||
|
||||
#include <AppDefs.h>
|
||||
#include <driver_settings.h>
|
||||
#include <KernelExport.h>
|
||||
#include <NodeMonitor.h>
|
||||
|
||||
@@ -82,7 +83,6 @@ struct Volume::AddPackageDomainJob : Job {
|
||||
virtual void Do()
|
||||
{
|
||||
fVolume->_AddPackageDomain(fDomain, true);
|
||||
fDomain = NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -336,7 +336,7 @@ Volume::~Volume()
|
||||
|
||||
|
||||
status_t
|
||||
Volume::Mount()
|
||||
Volume::Mount(const char* parameterString)
|
||||
{
|
||||
// init the node table
|
||||
status_t error = fNodes.Init();
|
||||
@@ -349,9 +349,19 @@ Volume::Mount()
|
||||
RETURN_ERROR(B_NO_MEMORY);
|
||||
fNodes.Insert(fRootDirectory);
|
||||
|
||||
// create default package domains
|
||||
// TODO: Get them from the mount parameters instead!
|
||||
error = _AddInitialPackageDomain("/boot/common/packages");
|
||||
const char* domain = NULL;
|
||||
void* parameterHandle = parse_driver_settings_string(parameterString);
|
||||
if (parameterHandle != NULL) {
|
||||
domain = get_driver_parameter(parameterHandle, "domain", NULL, NULL);
|
||||
delete_driver_settings(parameterHandle);
|
||||
}
|
||||
if (domain == NULL || domain[0] == '\0') {
|
||||
ERROR("need package folder ('domain' parameter)!\n");
|
||||
RETURN_ERROR(B_BAD_VALUE);
|
||||
}
|
||||
|
||||
// create default package domain
|
||||
error = _AddInitialPackageDomain(domain);
|
||||
if (error != B_OK)
|
||||
RETURN_ERROR(error);
|
||||
|
||||
@@ -554,7 +564,11 @@ Volume::_AddPackageDomain(PackageDomain* domain, bool notify)
|
||||
Package* package = it.Next();) {
|
||||
error = _AddPackageContent(package, notify);
|
||||
if (error != B_OK) {
|
||||
// TODO: Remove the already added packages!
|
||||
for (it.Rewind(); Package* activePackage = it.Next();) {
|
||||
if (activePackage == package)
|
||||
break;
|
||||
_RemovePackageContent(activePackage, NULL, notify);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
dev_t ID() const { return fFSVolume->id; }
|
||||
Directory* RootDirectory() const { return fRootDirectory; }
|
||||
|
||||
status_t Mount();
|
||||
status_t Mount(const char* parameterString);
|
||||
void Unmount();
|
||||
|
||||
Node* FindNode(ino_t nodeID) const
|
||||
|
||||
@@ -113,7 +113,7 @@ packagefs_mount(fs_volume* fsVolume, const char* device, uint32 flags,
|
||||
RETURN_ERROR(B_NO_MEMORY);
|
||||
ObjectDeleter<Volume> volumeDeleter(volume);
|
||||
|
||||
status_t error = volume->Mount();
|
||||
status_t error = volume->Mount(parameters);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user