* Renamed ddm_user_interface.cpp to ddm_userland_interface.cpp which
matches the name of the header much better. :-) * Implemented the syscalls for iterating through and finding disk systems. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3902 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
621e29d0b5
commit
995d5c53be
@ -76,8 +76,8 @@ public:
|
||||
// Disk Systems
|
||||
|
||||
// manager must be locked
|
||||
KDiskSystem *DiskSystemWithName(const char *name);
|
||||
KDiskSystem *DiskSystemWithID(disk_system_id id);
|
||||
KDiskSystem *FindDiskSystem(const char *name);
|
||||
KDiskSystem *FindDiskSystem(disk_system_id id);
|
||||
int32 CountDiskSystems();
|
||||
KDiskSystem *NextDiskSystem(int32 *cookie);
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "disk_device_manager.h"
|
||||
|
||||
struct user_disk_system_info;
|
||||
|
||||
namespace BPrivate {
|
||||
namespace DiskDevice {
|
||||
|
||||
@ -26,6 +28,8 @@ public:
|
||||
virtual bool IsFileSystem() const;
|
||||
bool IsPartitioningSystem() const;
|
||||
|
||||
void GetInfo(user_disk_system_info *info);
|
||||
|
||||
// manager will be locked
|
||||
status_t Load(); // load/unload -- can be nested
|
||||
void Unload(); //
|
||||
|
@ -11,7 +11,7 @@ UsePrivateHeaders storage ;
|
||||
UseHeaders [ FDirName $(OBOS_TOP) src tests kits storage virtualdrive ] ;
|
||||
|
||||
SharedLibrary disk_device_manager :
|
||||
ddm_user_interface.cpp
|
||||
ddm_userland_interface.cpp
|
||||
disk_device_manager.cpp
|
||||
KDiskDevice.cpp
|
||||
KDiskDeviceJob.cpp
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ddm_userland_interface.h"
|
||||
#include "KDiskDeviceManager.h"
|
||||
#include "KDiskDeviceUtils.h"
|
||||
#include "KDiskSystem.h"
|
||||
@ -78,6 +79,18 @@ KDiskSystem::IsPartitioningSystem() const
|
||||
return !IsFileSystem();
|
||||
}
|
||||
|
||||
// GetInfo
|
||||
void
|
||||
KDiskSystem::GetInfo(user_disk_system_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return;
|
||||
info->id = ID();
|
||||
strcpy(info->name, Name());
|
||||
strcpy(info->pretty_name, PrettyName());
|
||||
info->file_system = IsFileSystem();
|
||||
}
|
||||
|
||||
// Load
|
||||
status_t
|
||||
KDiskSystem::Load()
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <KDiskDevice.h>
|
||||
#include <KDiskDeviceManager.h>
|
||||
#include <KDiskDeviceUtils.h>
|
||||
#include <KDiskSystem.h>
|
||||
|
||||
#include "ddm_userland_interface.h"
|
||||
#include "UserDataWriter.h"
|
||||
@ -53,3 +54,54 @@ _kern_get_disk_device_data(partition_id deviceID, bool shadow,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
// _kern_get_disk_system_info
|
||||
status_t
|
||||
_kern_get_disk_system_info(disk_system_id id, user_disk_system_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return B_BAD_VALUE;
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
if (ManagerLocker locker = manager) {
|
||||
if (KDiskSystem *diskSystem = manager->FindDiskSystem(id)) {
|
||||
DiskSystemLoader _(diskSystem, true);
|
||||
diskSystem->GetInfo(info);
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
// _kern_get_next_disk_system_info
|
||||
status_t
|
||||
_kern_get_next_disk_system_info(int32 *cookie, user_disk_system_info *info)
|
||||
{
|
||||
if (!cookie || !info)
|
||||
return B_BAD_VALUE;
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
if (ManagerLocker locker = manager) {
|
||||
if (KDiskSystem *diskSystem = manager->NextDiskSystem(cookie)) {
|
||||
DiskSystemLoader _(diskSystem, true);
|
||||
diskSystem->GetInfo(info);
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
// _kern_find_disk_system
|
||||
status_t
|
||||
_kern_find_disk_system(const char *name, user_disk_system_info *info)
|
||||
{
|
||||
if (!name || !info)
|
||||
return B_BAD_VALUE;
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
if (ManagerLocker locker = manager) {
|
||||
if (KDiskSystem *diskSystem = manager->FindDiskSystem(name)) {
|
||||
DiskSystemLoader _(diskSystem, true);
|
||||
diskSystem->GetInfo(info);
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user