bonefish+stippi:
Implemented the needed fs API hooks to support identifying partitions (so ReiserFS partitions appear in the Tracker Mount menu now). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26211 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -86,6 +86,19 @@ Volume::~Volume()
|
|||||||
Unmount();
|
Unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Identify
|
||||||
|
status_t
|
||||||
|
Volume::Identify(int fd, partition_data *partition)
|
||||||
|
{
|
||||||
|
// open disk
|
||||||
|
fDevice = dup(fd);
|
||||||
|
if (fDevice < 0)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
// read and analyze super block
|
||||||
|
return _ReadSuperBlock();
|
||||||
|
}
|
||||||
|
|
||||||
// Mount
|
// Mount
|
||||||
status_t
|
status_t
|
||||||
Volume::Mount(fs_volume *fsVolume, const char *path)
|
Volume::Mount(fs_volume *fsVolume, const char *path)
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public:
|
|||||||
Volume();
|
Volume();
|
||||||
~Volume();
|
~Volume();
|
||||||
|
|
||||||
|
status_t Identify(int fd, partition_data *partition);
|
||||||
|
|
||||||
status_t Mount(fs_volume *fsVolume, const char *path);
|
status_t Mount(fs_volume *fsVolume, const char *path);
|
||||||
status_t Unmount();
|
status_t Unmount();
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@
|
|||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
|
|
||||||
|
|
||||||
|
using std::nothrow;
|
||||||
|
|
||||||
static const size_t kOptimalIOSize = 65536;
|
static const size_t kOptimalIOSize = 65536;
|
||||||
|
|
||||||
extern fs_volume_ops gReiserFSVolumeOps;
|
extern fs_volume_ops gReiserFSVolumeOps;
|
||||||
@@ -56,6 +58,57 @@ inline static bool is_user_in_group(gid_t gid);
|
|||||||
// #pragma mark - FS
|
// #pragma mark - FS
|
||||||
|
|
||||||
|
|
||||||
|
// reiserfs_identify_partition
|
||||||
|
static float
|
||||||
|
reiserfs_identify_partition(int fd, partition_data *partition, void **cookie)
|
||||||
|
{
|
||||||
|
Volume* volume = new(nothrow) Volume();
|
||||||
|
if (volume == NULL)
|
||||||
|
return -1.0;
|
||||||
|
|
||||||
|
status_t status = volume->Identify(fd, partition);
|
||||||
|
if (status != B_OK) {
|
||||||
|
delete volume;
|
||||||
|
return -1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*cookie = (void*)volume;
|
||||||
|
return 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// reiserfs_scan_partition
|
||||||
|
static status_t
|
||||||
|
reiserfs_scan_partition(int fd, partition_data *partition, void *_cookie)
|
||||||
|
{
|
||||||
|
Volume* volume = (Volume*)_cookie;
|
||||||
|
|
||||||
|
partition->status = B_PARTITION_VALID;
|
||||||
|
partition->flags |= B_PARTITION_FILE_SYSTEM;
|
||||||
|
partition->content_size = volume->CountBlocks()
|
||||||
|
* volume->GetBlockSize();
|
||||||
|
partition->block_size = volume->GetBlockSize();
|
||||||
|
// TODO: Construct name from partition layout?
|
||||||
|
partition->content_name = strdup("Untitled ReiserFS");
|
||||||
|
if (partition->content_name == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// reiserfs_free_identify_partition_cookie
|
||||||
|
static void
|
||||||
|
reiserfs_free_identify_partition_cookie(partition_data* partition,
|
||||||
|
void* _cookie)
|
||||||
|
{
|
||||||
|
delete (Volume*)_cookie;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
// reiserfs_mount
|
// reiserfs_mount
|
||||||
static status_t
|
static status_t
|
||||||
reiserfs_mount(fs_volume *_volume, const char *device, uint32 flags,
|
reiserfs_mount(fs_volume *_volume, const char *device, uint32 flags,
|
||||||
@@ -663,9 +716,9 @@ static file_system_module_info sReiserFSModuleInfo = {
|
|||||||
|
|
||||||
|
|
||||||
// scanning
|
// scanning
|
||||||
NULL, // identify_partition()
|
&reiserfs_identify_partition,
|
||||||
NULL, // scan_partition()
|
&reiserfs_scan_partition,
|
||||||
NULL, // free_identify_partition_cookie()
|
&reiserfs_free_identify_partition_cookie,
|
||||||
NULL, // free_partition_content_cookie()
|
NULL, // free_partition_content_cookie()
|
||||||
|
|
||||||
&reiserfs_mount
|
&reiserfs_mount
|
||||||
|
|||||||
Reference in New Issue
Block a user