This makes the FileMapDisk code work. zbeos can now locate an haiku.image embedded within another one as BEOS/IMAGE.BE (that's just for testing, it will be used with FAT or ISO9660 later on). It starts to boot the kernel but crashes later, it will need an fmap driver anyway.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26970 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4141741265
commit
6a5919034d
@ -15,6 +15,13 @@
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#define TRACE_FILEMAPDISK
|
||||
#ifdef TRACE_FILEMAPDISK
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
// constructor
|
||||
FileMapDisk::FileMapDisk()
|
||||
{
|
||||
@ -29,6 +36,7 @@ FileMapDisk::~FileMapDisk()
|
||||
status_t
|
||||
FileMapDisk::Init(Node *node/*, Partition *partition, FileMap *map, off_t imageSize*/)
|
||||
{
|
||||
TRACE(("FileMapDisk::FileMapDisk(%p)\n", node));
|
||||
fNode = node;
|
||||
/*
|
||||
fPartition = partition;
|
||||
@ -52,6 +60,7 @@ FileMapDisk::Init(Node *node/*, Partition *partition, FileMap *map, off_t imageS
|
||||
status_t
|
||||
FileMapDisk::Open(void **_cookie, int mode)
|
||||
{
|
||||
TRACE(("FileMapDisk::Open(, 0x%08x)\n", mode));
|
||||
if (!fNode)
|
||||
return B_NO_INIT;
|
||||
|
||||
@ -62,6 +71,7 @@ FileMapDisk::Open(void **_cookie, int mode)
|
||||
status_t
|
||||
FileMapDisk::Close(void *cookie)
|
||||
{
|
||||
TRACE(("FileMapDisk::Close(%p)\n", cookie));
|
||||
if (!fNode)
|
||||
return B_NO_INIT;
|
||||
|
||||
@ -74,6 +84,7 @@ ssize_t
|
||||
FileMapDisk::ReadAt(void *cookie, off_t pos, void *_buffer,
|
||||
size_t bufferSize)
|
||||
{
|
||||
TRACE(("FileMapDisk::ReadAt(%p, %lld, , %ld)\n", cookie, pos, bufferSize));
|
||||
if (!fNode)
|
||||
return B_NO_INIT;
|
||||
|
||||
@ -127,13 +138,21 @@ FileMapDisk::GetFileMap(FileMap **map)
|
||||
FileMapDisk *
|
||||
FileMapDisk::FindAnyFileMapDisk(Directory *volume)
|
||||
{
|
||||
TRACE(("FileMapDisk::FindAnyFileMapDisk(%p)\n", volume));
|
||||
Node *node;
|
||||
status_t error;
|
||||
|
||||
if (!volume)
|
||||
return NULL;
|
||||
|
||||
node = volume->Lookup(FMAP_FOLDER_NAME "/" FMAP_IMAGE_NAME, true);
|
||||
//XXX: check lower/mixed case as well
|
||||
Node *dirnode;
|
||||
Directory *dir;
|
||||
dirnode = volume->Lookup(FMAP_FOLDER_NAME, true);
|
||||
if (!dirnode || !S_ISDIR(dirnode->Type()))
|
||||
return NULL;
|
||||
dir = (Directory *)dirnode;
|
||||
node = dir->Lookup(FMAP_IMAGE_NAME, true);
|
||||
if (!node)
|
||||
return NULL;
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "RootFileSystem.h"
|
||||
|
||||
#include <boot/FileMapDisk.h>
|
||||
#include <boot/partitions.h>
|
||||
#include <boot/vfs.h>
|
||||
#include <boot/platform.h>
|
||||
@ -234,6 +235,15 @@ Partition::_Mount(file_system_module_info *module, Directory **_fileSystem)
|
||||
fModuleName = module->module_name;
|
||||
|
||||
fIsFileSystem = true;
|
||||
|
||||
// see if it contains an image file we could mount in turn
|
||||
// XXX: avoid recursing too much
|
||||
FileMapDisk *disk = FileMapDisk::FindAnyFileMapDisk(fileSystem);
|
||||
if (disk) {
|
||||
TRACE(("%p Partition::_Mount: found FileMapDisk\n", this));
|
||||
add_partitions_for(disk, true, false);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user