* 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 <new>
|
||||||
|
|
||||||
#include <AppDefs.h>
|
#include <AppDefs.h>
|
||||||
|
#include <driver_settings.h>
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
|
|
||||||
@@ -82,7 +83,6 @@ struct Volume::AddPackageDomainJob : Job {
|
|||||||
virtual void Do()
|
virtual void Do()
|
||||||
{
|
{
|
||||||
fVolume->_AddPackageDomain(fDomain, true);
|
fVolume->_AddPackageDomain(fDomain, true);
|
||||||
fDomain = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -336,7 +336,7 @@ Volume::~Volume()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Volume::Mount()
|
Volume::Mount(const char* parameterString)
|
||||||
{
|
{
|
||||||
// init the node table
|
// init the node table
|
||||||
status_t error = fNodes.Init();
|
status_t error = fNodes.Init();
|
||||||
@@ -349,9 +349,19 @@ Volume::Mount()
|
|||||||
RETURN_ERROR(B_NO_MEMORY);
|
RETURN_ERROR(B_NO_MEMORY);
|
||||||
fNodes.Insert(fRootDirectory);
|
fNodes.Insert(fRootDirectory);
|
||||||
|
|
||||||
// create default package domains
|
const char* domain = NULL;
|
||||||
// TODO: Get them from the mount parameters instead!
|
void* parameterHandle = parse_driver_settings_string(parameterString);
|
||||||
error = _AddInitialPackageDomain("/boot/common/packages");
|
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)
|
if (error != B_OK)
|
||||||
RETURN_ERROR(error);
|
RETURN_ERROR(error);
|
||||||
|
|
||||||
@@ -554,7 +564,11 @@ Volume::_AddPackageDomain(PackageDomain* domain, bool notify)
|
|||||||
Package* package = it.Next();) {
|
Package* package = it.Next();) {
|
||||||
error = _AddPackageContent(package, notify);
|
error = _AddPackageContent(package, notify);
|
||||||
if (error != B_OK) {
|
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;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
dev_t ID() const { return fFSVolume->id; }
|
dev_t ID() const { return fFSVolume->id; }
|
||||||
Directory* RootDirectory() const { return fRootDirectory; }
|
Directory* RootDirectory() const { return fRootDirectory; }
|
||||||
|
|
||||||
status_t Mount();
|
status_t Mount(const char* parameterString);
|
||||||
void Unmount();
|
void Unmount();
|
||||||
|
|
||||||
Node* FindNode(ino_t nodeID) const
|
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);
|
RETURN_ERROR(B_NO_MEMORY);
|
||||||
ObjectDeleter<Volume> volumeDeleter(volume);
|
ObjectDeleter<Volume> volumeDeleter(volume);
|
||||||
|
|
||||||
status_t error = volume->Mount();
|
status_t error = volume->Mount(parameters);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user