* Added BDiskSystem::ShortName() and everything needed to get it there.

* Added BDiskDeviceRoster::GetDiskSystem() method, that can get a disk system
  by short/pretty/module name - since they should all be unique, I put them
  in a single namespace, please complain if you don't like that :-)
* Cleaned up DiskSystem.h and DiskDeviceRoster.h according to the updated
  header guidelines.
* Renamed ntfs pretty name from "ntfs File System" to "Windows NT File System".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25414 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-05-10 11:44:00 +00:00
parent 36e12bef8f
commit 1da9f5cea5
28 changed files with 243 additions and 141 deletions
+1
View File
@@ -232,6 +232,7 @@ struct fs_vnode_ops {
typedef struct file_system_module_info {
struct module_info info;
const char* short_name;
const char* pretty_name;
uint32 flags; // DDM flags
@@ -266,6 +266,7 @@ struct fssh_fs_vnode_ops {
typedef struct fssh_file_system_module_info {
struct fssh_module_info info;
const char* short_name;
const char* pretty_name;
uint32_t flags; // DDM flags
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2003-2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,6 +8,7 @@
#ifndef _K_DISK_DEVICE_SYSTEM_H
#define _K_DISK_DEVICE_SYSTEM_H
#include "disk_device_manager.h"
@@ -33,7 +34,8 @@ public:
disk_system_id ID() const;
const char* Name() const;
const char* PrettyName();
const char* ShortName() const;
const char* PrettyName() const;
uint32 Flags() const;
bool IsFileSystem() const;
@@ -97,6 +99,7 @@ protected:
virtual status_t LoadModule();
virtual void UnloadModule();
status_t SetShortName(const char* name);
status_t SetPrettyName(const char* name);
void SetFlags(uint32 flags);
@@ -105,6 +108,7 @@ protected:
private:
disk_system_id fID;
char* fName;
char* fShortName;
char* fPrettyName;
uint32 fFlags;
int32 fLoadCounter;
@@ -1,10 +1,12 @@
// ddm_modules.h
//
// Interface to be implemented by partitioning modules.
/*
* Copyright 2003-2008, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _K_DISK_DEVICE_MODULES_H
#define _K_DISK_DEVICE_MODULES_H
//! Interface to be implemented by partitioning modules.
#include <disk_device_manager.h>
#include <module.h>
#include <SupportDefs.h>
@@ -12,6 +14,7 @@
typedef struct partition_module_info {
module_info module;
const char* short_name;
const char* pretty_name;
uint32 flags;
@@ -1,5 +1,10 @@
// ddm_userland_interface.h
/*
* Copyright 2003-2008, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold, [email protected]
*/
#ifndef _DISK_DEVICE_MANAGER_USERLAND_INTERFACE_H
#define _DISK_DEVICE_MANAGER_USERLAND_INTERFACE_H
@@ -49,6 +54,7 @@ typedef struct user_disk_device_data {
typedef struct user_disk_system_info {
disk_system_id id;
char name[B_FILE_NAME_LENGTH]; // better B_PATH_NAME_LENGTH?
char short_name[B_OS_NAME_LENGTH];
char pretty_name[B_OS_NAME_LENGTH];
uint32 flags;
} user_disk_system_info;
+47 -41
View File
@@ -1,8 +1,7 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*
* Copyright 2003-2008, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _DISK_DEVICE_ROSTER_H
#define _DISK_DEVICE_ROSTER_H
@@ -85,44 +84,51 @@ enum {
class BDiskDeviceRoster {
public:
BDiskDeviceRoster();
~BDiskDeviceRoster();
status_t GetNextDevice(BDiskDevice *device);
status_t RewindDevices();
status_t GetNextDiskSystem(BDiskSystem *system);
status_t RewindDiskSystems();
BDiskDeviceRoster();
~BDiskDeviceRoster();
partition_id RegisterFileDevice(const char *filename);
// publishes: /dev/disk/virtual/files/<disk device ID>/raw
status_t UnregisterFileDevice(const char *filename);
status_t UnregisterFileDevice(partition_id device);
status_t GetNextDevice(BDiskDevice* device);
status_t RewindDevices();
bool VisitEachDevice(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL);
bool VisitEachPartition(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL,
BPartition **partition = NULL);
status_t GetNextDiskSystem(BDiskSystem* system);
status_t RewindDiskSystems();
bool VisitEachMountedPartition(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL,
BPartition **partition = NULL);
bool VisitEachMountablePartition(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL,
BPartition **partition = NULL);
status_t GetDeviceWithID(partition_id id, BDiskDevice *device) const;
status_t GetPartitionWithID(partition_id id, BDiskDevice *device,
BPartition **partition) const;
status_t GetDiskSystem(BDiskSystem* system, const char* name);
status_t GetDeviceForPath(const char *filename, BDiskDevice *device);
status_t GetPartitionForPath(const char *filename, BDiskDevice *device,
BPartition **partition);
partition_id RegisterFileDevice(const char* filename);
// publishes: /dev/disk/virtual/files/<disk device ID>/raw
status_t UnregisterFileDevice(const char* filename);
status_t UnregisterFileDevice(partition_id device);
status_t StartWatching(BMessenger target,
uint32 eventMask = B_DEVICE_REQUEST_ALL);
status_t StopWatching(BMessenger target);
bool VisitEachDevice(BDiskDeviceVisitor* visitor,
BDiskDevice* device = NULL);
bool VisitEachPartition(BDiskDeviceVisitor* visitor,
BDiskDevice* device = NULL,
BPartition** _partition = NULL);
bool VisitEachMountedPartition(
BDiskDeviceVisitor* visitor,
BDiskDevice* device = NULL,
BPartition** _partition = NULL);
bool VisitEachMountablePartition(
BDiskDeviceVisitor* visitor,
BDiskDevice* device = NULL,
BPartition** _partition = NULL);
status_t GetDeviceWithID(partition_id id,
BDiskDevice* device) const;
status_t GetPartitionWithID(partition_id id,
BDiskDevice* device,
BPartition** _partition) const;
status_t GetDeviceForPath(const char* filename,
BDiskDevice* device);
status_t GetPartitionForPath(const char* filename,
BDiskDevice* device, BPartition** _partition);
status_t StartWatching(BMessenger target,
uint32 eventMask = B_DEVICE_REQUEST_ALL);
status_t StopWatching(BMessenger target);
private:
#if 0
@@ -146,9 +152,9 @@ private:
BDiskScannerPartitionAddOn **addOn);
#endif // 0
private:
int32 fDeviceCookie;
int32 fDiskSystemCookie;
int32 fJobCookie;
int32 fDeviceCookie;
int32 fDiskSystemCookie;
int32 fJobCookie;
// BDirectory *fPartitionAddOnDir;
// BDirectory *fFSAddOnDir;
// int32 fPartitionAddOnDirIndex;
+45 -40
View File
@@ -1,15 +1,14 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*
* Copyright 2003-2008, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _DISK_SYSTEM_H
#define _DISK_SYSTEM_H
#include <DiskDeviceDefs.h>
#include <String.h>
class BPartition;
class BString;
struct user_disk_system_info;
@@ -17,52 +16,58 @@ struct user_disk_system_info;
class BDiskSystem {
public:
BDiskSystem();
BDiskSystem(const BDiskSystem& other);
~BDiskSystem();
BDiskSystem();
BDiskSystem(const BDiskSystem& other);
~BDiskSystem();
status_t InitCheck() const;
status_t InitCheck() const;
const char *Name() const;
const char *PrettyName() const;
const char* Name() const;
const char* ShortName() const;
const char* PrettyName() const;
bool SupportsDefragmenting(bool *whileMounted) const;
bool SupportsRepairing(bool checkOnly, bool *whileMounted) const;
bool SupportsResizing(bool *whileMounted) const;
bool SupportsResizingChild() const;
bool SupportsMoving(bool *whileMounted) const;
bool SupportsMovingChild() const;
bool SupportsName() const;
bool SupportsContentName() const;
bool SupportsSettingName() const;
bool SupportsSettingContentName(bool *whileMounted) const;
bool SupportsSettingType() const;
bool SupportsSettingParameters() const;
bool SupportsSettingContentParameters(bool *whileMounted) const;
bool SupportsCreatingChild() const;
bool SupportsDeletingChild() const;
bool SupportsInitializing() const;
bool SupportsDefragmenting(bool* whileMounted) const;
bool SupportsRepairing(bool checkOnly,
bool* whileMounted) const;
bool SupportsResizing(bool* whileMounted) const;
bool SupportsResizingChild() const;
bool SupportsMoving(bool* whileMounted) const;
bool SupportsMovingChild() const;
bool SupportsName() const;
bool SupportsContentName() const;
bool SupportsSettingName() const;
bool SupportsSettingContentName(
bool* whileMounted) const;
bool SupportsSettingType() const;
bool SupportsSettingParameters() const;
bool SupportsSettingContentParameters(
bool* whileMounted) const;
bool SupportsCreatingChild() const;
bool SupportsDeletingChild() const;
bool SupportsInitializing() const;
status_t GetTypeForContentType(const char *contentType,
BString* type) const;
status_t GetTypeForContentType(const char* contentType,
BString* type) const;
bool IsPartitioningSystem() const;
bool IsFileSystem() const;
bool IsPartitioningSystem() const;
bool IsFileSystem() const;
BDiskSystem& operator=(const BDiskSystem& other);
BDiskSystem& operator=(const BDiskSystem& other);
private:
status_t _SetTo(disk_system_id id);
status_t _SetTo(const user_disk_system_info *info);
void _Unset();
status_t _SetTo(disk_system_id id);
status_t _SetTo(const user_disk_system_info* info);
void _Unset();
private:
friend class BDiskDeviceRoster;
friend class BPartition;
disk_system_id fID;
BString fName;
BString fPrettyName;
uint32 fFlags;
disk_system_id fID;
BString fName;
BString fShortName;
BString fPrettyName;
uint32 fFlags;
};
#endif // _DISK_SYSTEM_H