* 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 { typedef struct file_system_module_info {
struct module_info info; struct module_info info;
const char* short_name;
const char* pretty_name; const char* pretty_name;
uint32 flags; // DDM flags uint32 flags; // DDM flags
@@ -266,6 +266,7 @@ struct fssh_fs_vnode_ops {
typedef struct fssh_file_system_module_info { typedef struct fssh_file_system_module_info {
struct fssh_module_info info; struct fssh_module_info info;
const char* short_name;
const char* pretty_name; const char* pretty_name;
uint32_t flags; // DDM flags 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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -8,6 +8,7 @@
#ifndef _K_DISK_DEVICE_SYSTEM_H #ifndef _K_DISK_DEVICE_SYSTEM_H
#define _K_DISK_DEVICE_SYSTEM_H #define _K_DISK_DEVICE_SYSTEM_H
#include "disk_device_manager.h" #include "disk_device_manager.h"
@@ -33,7 +34,8 @@ public:
disk_system_id ID() const; disk_system_id ID() const;
const char* Name() const; const char* Name() const;
const char* PrettyName(); const char* ShortName() const;
const char* PrettyName() const;
uint32 Flags() const; uint32 Flags() const;
bool IsFileSystem() const; bool IsFileSystem() const;
@@ -97,6 +99,7 @@ protected:
virtual status_t LoadModule(); virtual status_t LoadModule();
virtual void UnloadModule(); virtual void UnloadModule();
status_t SetShortName(const char* name);
status_t SetPrettyName(const char* name); status_t SetPrettyName(const char* name);
void SetFlags(uint32 flags); void SetFlags(uint32 flags);
@@ -105,6 +108,7 @@ protected:
private: private:
disk_system_id fID; disk_system_id fID;
char* fName; char* fName;
char* fShortName;
char* fPrettyName; char* fPrettyName;
uint32 fFlags; uint32 fFlags;
int32 fLoadCounter; int32 fLoadCounter;
@@ -1,10 +1,12 @@
// ddm_modules.h /*
// * Copyright 2003-2008, Haiku Inc.
// Interface to be implemented by partitioning modules. * Distributed under the terms of the MIT License.
*/
#ifndef _K_DISK_DEVICE_MODULES_H #ifndef _K_DISK_DEVICE_MODULES_H
#define _K_DISK_DEVICE_MODULES_H #define _K_DISK_DEVICE_MODULES_H
//! Interface to be implemented by partitioning modules.
#include <disk_device_manager.h> #include <disk_device_manager.h>
#include <module.h> #include <module.h>
#include <SupportDefs.h> #include <SupportDefs.h>
@@ -12,6 +14,7 @@
typedef struct partition_module_info { typedef struct partition_module_info {
module_info module; module_info module;
const char* short_name;
const char* pretty_name; const char* pretty_name;
uint32 flags; 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 #ifndef _DISK_DEVICE_MANAGER_USERLAND_INTERFACE_H
#define _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 { typedef struct user_disk_system_info {
disk_system_id id; disk_system_id id;
char name[B_FILE_NAME_LENGTH]; // better B_PATH_NAME_LENGTH? 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]; char pretty_name[B_OS_NAME_LENGTH];
uint32 flags; uint32 flags;
} user_disk_system_info; } user_disk_system_info;
+47 -41
View File
@@ -1,8 +1,7 @@
//---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2003-2008, Haiku Inc.
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- */
#ifndef _DISK_DEVICE_ROSTER_H #ifndef _DISK_DEVICE_ROSTER_H
#define _DISK_DEVICE_ROSTER_H #define _DISK_DEVICE_ROSTER_H
@@ -85,44 +84,51 @@ enum {
class BDiskDeviceRoster { class BDiskDeviceRoster {
public: public:
BDiskDeviceRoster(); BDiskDeviceRoster();
~BDiskDeviceRoster(); ~BDiskDeviceRoster();
status_t GetNextDevice(BDiskDevice *device);
status_t RewindDevices();
status_t GetNextDiskSystem(BDiskSystem *system);
status_t RewindDiskSystems();
partition_id RegisterFileDevice(const char *filename); status_t GetNextDevice(BDiskDevice* device);
// publishes: /dev/disk/virtual/files/<disk device ID>/raw status_t RewindDevices();
status_t UnregisterFileDevice(const char *filename);
status_t UnregisterFileDevice(partition_id device);
bool VisitEachDevice(BDiskDeviceVisitor *visitor, status_t GetNextDiskSystem(BDiskSystem* system);
BDiskDevice *device = NULL); status_t RewindDiskSystems();
bool VisitEachPartition(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL,
BPartition **partition = NULL);
bool VisitEachMountedPartition(BDiskDeviceVisitor *visitor, status_t GetDiskSystem(BDiskSystem* system, const char* name);
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); partition_id RegisterFileDevice(const char* filename);
status_t GetPartitionForPath(const char *filename, BDiskDevice *device, // publishes: /dev/disk/virtual/files/<disk device ID>/raw
BPartition **partition); status_t UnregisterFileDevice(const char* filename);
status_t UnregisterFileDevice(partition_id device);
status_t StartWatching(BMessenger target, bool VisitEachDevice(BDiskDeviceVisitor* visitor,
uint32 eventMask = B_DEVICE_REQUEST_ALL); BDiskDevice* device = NULL);
status_t StopWatching(BMessenger target); 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: private:
#if 0 #if 0
@@ -146,9 +152,9 @@ private:
BDiskScannerPartitionAddOn **addOn); BDiskScannerPartitionAddOn **addOn);
#endif // 0 #endif // 0
private: private:
int32 fDeviceCookie; int32 fDeviceCookie;
int32 fDiskSystemCookie; int32 fDiskSystemCookie;
int32 fJobCookie; int32 fJobCookie;
// BDirectory *fPartitionAddOnDir; // BDirectory *fPartitionAddOnDir;
// BDirectory *fFSAddOnDir; // BDirectory *fFSAddOnDir;
// int32 fPartitionAddOnDirIndex; // int32 fPartitionAddOnDirIndex;
+45 -40
View File
@@ -1,15 +1,14 @@
//---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2003-2008, Haiku Inc.
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- */
#ifndef _DISK_SYSTEM_H #ifndef _DISK_SYSTEM_H
#define _DISK_SYSTEM_H #define _DISK_SYSTEM_H
#include <DiskDeviceDefs.h> #include <DiskDeviceDefs.h>
#include <String.h> #include <String.h>
class BPartition; class BPartition;
class BString; class BString;
struct user_disk_system_info; struct user_disk_system_info;
@@ -17,52 +16,58 @@ struct user_disk_system_info;
class BDiskSystem { class BDiskSystem {
public: public:
BDiskSystem(); BDiskSystem();
BDiskSystem(const BDiskSystem& other); BDiskSystem(const BDiskSystem& other);
~BDiskSystem(); ~BDiskSystem();
status_t InitCheck() const; status_t InitCheck() const;
const char *Name() const; const char* Name() const;
const char *PrettyName() const; const char* ShortName() const;
const char* PrettyName() const;
bool SupportsDefragmenting(bool *whileMounted) const; bool SupportsDefragmenting(bool* whileMounted) const;
bool SupportsRepairing(bool checkOnly, bool *whileMounted) const; bool SupportsRepairing(bool checkOnly,
bool SupportsResizing(bool *whileMounted) const; bool* whileMounted) const;
bool SupportsResizingChild() const; bool SupportsResizing(bool* whileMounted) const;
bool SupportsMoving(bool *whileMounted) const; bool SupportsResizingChild() const;
bool SupportsMovingChild() const; bool SupportsMoving(bool* whileMounted) const;
bool SupportsName() const; bool SupportsMovingChild() const;
bool SupportsContentName() const; bool SupportsName() const;
bool SupportsSettingName() const; bool SupportsContentName() const;
bool SupportsSettingContentName(bool *whileMounted) const; bool SupportsSettingName() const;
bool SupportsSettingType() const; bool SupportsSettingContentName(
bool SupportsSettingParameters() const; bool* whileMounted) const;
bool SupportsSettingContentParameters(bool *whileMounted) const; bool SupportsSettingType() const;
bool SupportsCreatingChild() const; bool SupportsSettingParameters() const;
bool SupportsDeletingChild() const; bool SupportsSettingContentParameters(
bool SupportsInitializing() const; bool* whileMounted) const;
bool SupportsCreatingChild() const;
bool SupportsDeletingChild() const;
bool SupportsInitializing() const;
status_t GetTypeForContentType(const char *contentType, status_t GetTypeForContentType(const char* contentType,
BString* type) const; BString* type) const;
bool IsPartitioningSystem() const; bool IsPartitioningSystem() const;
bool IsFileSystem() const; bool IsFileSystem() const;
BDiskSystem& operator=(const BDiskSystem& other); BDiskSystem& operator=(const BDiskSystem& other);
private: private:
status_t _SetTo(disk_system_id id); status_t _SetTo(disk_system_id id);
status_t _SetTo(const user_disk_system_info *info); status_t _SetTo(const user_disk_system_info* info);
void _Unset(); void _Unset();
private:
friend class BDiskDeviceRoster; friend class BDiskDeviceRoster;
friend class BPartition; friend class BPartition;
disk_system_id fID; disk_system_id fID;
BString fName; BString fName;
BString fPrettyName; BString fShortName;
uint32 fFlags; BString fPrettyName;
uint32 fFlags;
}; };
#endif // _DISK_SYSTEM_H #endif // _DISK_SYSTEM_H
@@ -2288,7 +2288,8 @@ static file_system_module_info sBeFileSystem = {
bfs_std_ops, bfs_std_ops,
}, },
"Be File System", "bfs", // short_name
"Be File System", // pretty_name
// DDM flags // DDM flags
0 0
@@ -2006,7 +2006,8 @@ static file_system_module_info sCDDAFileSystem = {
cdda_std_ops, cdda_std_ops,
}, },
"CDDA File System", "cdda", // short_name
"CDDA File System", // pretty_name
0, // DDM flags 0, // DDM flags
cdda_identify_partition, cdda_identify_partition,
+2 -1
View File
@@ -1313,7 +1313,8 @@ static file_system_module_info sFATFileSystem = {
dos_std_ops, dos_std_ops,
}, },
"FAT32 File System", "fat", // short_name
"FAT32 File System", // pretty_name
0, // DDM flags 0, // DDM flags
// scanning // scanning
@@ -1619,7 +1619,8 @@ static file_system_module_info sGoogleFSModule = {
googlefs_std_ops, googlefs_std_ops,
}, },
GOOGLEFS_PRETTY_NAME, "googlefs", // short_name
GOOGLEFS_PRETTY_NAME, // pretty_name
0, // DDM flags 0, // DDM flags
// scanning // scanning
@@ -745,8 +745,9 @@ static file_system_module_info sISO660FileSystem = {
iso_std_ops, iso_std_ops,
}, },
"ISO9660 File System", "iso9660", // short_name
0, // DDM flags "ISO9660 File System", // pretty_name
0, // DDM flags
// scanning // scanning
fs_identify_partition, fs_identify_partition,
@@ -84,8 +84,9 @@ static file_system_module_info sNTFSFileSystem = {
ntfs_std_ops, ntfs_std_ops,
}, },
"ntfs File System", "ntfs", // short_name
0, // DDM flags "Windows NT File System", // pretty_name
0, // DDM flags
// scanning // scanning
fs_identify_partition, fs_identify_partition,
@@ -2069,8 +2069,9 @@ static file_system_module_info sRamFSModuleInfo = {
ramfs_std_ops, ramfs_std_ops,
}, },
"RAM File System", "ramfs", // short_name
0, // DDM flags "RAM File System", // pretty_name
0, // DDM flags
// scanning // scanning
NULL, // identify_partition() NULL, // identify_partition()
@@ -649,8 +649,9 @@ static file_system_module_info sReiserFSModuleInfo = {
reiserfs_std_ops, reiserfs_std_ops,
}, },
"Reiser File System", "reiserfs", // short_name
0, // DDM flags "Reiser File System", // pretty_name
0, // DDM flags
// scanning // scanning
NULL, // identify_partition() NULL, // identify_partition()
@@ -218,6 +218,7 @@ partition_module_info gAmigaPartitionModule = {
0, 0,
amiga_rdb_std_ops amiga_rdb_std_ops
}, },
"amiga", // short_name
AMIGA_PARTITION_NAME, // pretty_name AMIGA_PARTITION_NAME, // pretty_name
0, // flags 0, // flags
@@ -203,6 +203,7 @@ partition_module_info gApplePartitionModule = {
0, 0,
apple_std_ops apple_std_ops
}, },
"apple", // short_name
APPLE_PARTITION_NAME, // pretty_name APPLE_PARTITION_NAME, // pretty_name
0, // flags 0, // flags
@@ -1,7 +1,7 @@
/* /*
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the Haiku License. * Distributed under the terms of the MIT License.
*/ */
#include "atari.h" #include "atari.h"
@@ -222,6 +222,7 @@ partition_module_info gAtariPartitionModule = {
0, 0,
atari_std_ops atari_std_ops
}, },
"atari", // short_name
ATARI_PARTITION_NAME, // pretty_name ATARI_PARTITION_NAME, // pretty_name
0, // flags 0, // flags
@@ -240,4 +241,3 @@ partition_module_info *modules[] = {
NULL NULL
}; };
#endif #endif
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2007-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -399,6 +399,7 @@ partition_module_info gEFIPartitionModule = {
0, 0,
efi_gpt_std_ops efi_gpt_std_ops
}, },
"efi", // short_name
EFI_PARTITION_NAME, // pretty_name EFI_PARTITION_NAME, // pretty_name
0, // flags 0, // 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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -427,6 +427,7 @@ static partition_module_info intel_partition_map_module =
0, 0,
pm_std_ops pm_std_ops
}, },
"intel", // short_name
INTEL_PARTITION_NAME, // pretty_name INTEL_PARTITION_NAME, // pretty_name
// flags // flags
@@ -513,6 +514,7 @@ static partition_module_info intel_extended_partition_module =
0, 0,
ep_std_ops ep_std_ops
}, },
"intel_extended", // short_name
INTEL_EXTENDED_PARTITION_NAME, // pretty_name INTEL_EXTENDED_PARTITION_NAME, // pretty_name
// flags // flags
@@ -114,6 +114,7 @@ static partition_module_info sSessionModule = {
0, 0,
standard_operations standard_operations
}, },
"session", // short_name
SESSION_PARTITION_NAME, // pretty_name SESSION_PARTITION_NAME, // pretty_name
0, // flags 0, // flags
@@ -1,7 +1,11 @@
//---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2003-2008, Haiku, Inc. All Rights Reserved.
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- *
* Authors:
* Ingo Weinhold, bonefish@cs.tu-berlin.de
* Axel Dörfler, axeld@pinc-software.de
*/
#include <new> #include <new>
@@ -82,7 +86,7 @@ BDiskDeviceRoster::GetNextDevice(BDiskDevice *device)
return B_BAD_VALUE; return B_BAD_VALUE;
size_t neededSize = 0; size_t neededSize = 0;
partition_id id = _kern_get_next_disk_device_id(&fDeviceCookie, partition_id id = _kern_get_next_disk_device_id(&fDeviceCookie,
&neededSize); &neededSize);
if (id < 0) if (id < 0)
return id; return id;
return device->_SetTo(id, true, neededSize); return device->_SetTo(id, true, neededSize);
@@ -99,21 +103,21 @@ BDiskDeviceRoster::RewindDevices()
return B_OK; return B_OK;
} }
// GetNextDiskSystem
status_t status_t
BDiskDeviceRoster::GetNextDiskSystem(BDiskSystem *system) BDiskDeviceRoster::GetNextDiskSystem(BDiskSystem* system)
{ {
if (!system) if (!system)
return B_BAD_VALUE; return B_BAD_VALUE;
user_disk_system_info info; user_disk_system_info info;
status_t error = _kern_get_next_disk_system_info(&fDiskSystemCookie, status_t error = _kern_get_next_disk_system_info(&fDiskSystemCookie,
&info); &info);
if (error == B_OK) if (error == B_OK)
error = system->_SetTo(&info); error = system->_SetTo(&info);
return error; return error;
} }
// RewindDiskSystems
status_t status_t
BDiskDeviceRoster::RewindDiskSystems() BDiskDeviceRoster::RewindDiskSystems()
{ {
@@ -122,7 +126,25 @@ BDiskDeviceRoster::RewindDiskSystems()
} }
// RegisterFileDevice status_t
BDiskDeviceRoster::GetDiskSystem(BDiskSystem* system, const char* name)
{
if (!system)
return B_BAD_VALUE;
int32 cookie = 0;
user_disk_system_info info;
while (_kern_get_next_disk_system_info(&fDiskSystemCookie, &info) == B_OK) {
if (!strcmp(name, info.name)
|| !strcmp(name, info.short_name)
|| !strcmp(name, info.pretty_name))
return system->_SetTo(&info);
}
return B_ENTRY_NOT_FOUND;
}
partition_id partition_id
BDiskDeviceRoster::RegisterFileDevice(const char *filename) BDiskDeviceRoster::RegisterFileDevice(const char *filename)
{ {
+24 -13
View File
@@ -16,20 +16,21 @@
// constructor // constructor
BDiskSystem::BDiskSystem() BDiskSystem::BDiskSystem()
: fID(B_NO_INIT), :
fName(), fID(B_NO_INIT),
fPrettyName(), fFlags(0)
fFlags(0)
{ {
} }
// copy constructor // copy constructor
BDiskSystem::BDiskSystem(const BDiskSystem& other) BDiskSystem::BDiskSystem(const BDiskSystem& other)
: fID(other.fID), :
fName(other.fName), fID(other.fID),
fPrettyName(other.fPrettyName), fName(other.fName),
fFlags(other.fFlags) fShortName(other.fShortName),
fPrettyName(other.fPrettyName),
fFlags(other.fFlags)
{ {
} }
@@ -44,7 +45,7 @@ BDiskSystem::~BDiskSystem()
status_t status_t
BDiskSystem::InitCheck() const BDiskSystem::InitCheck() const
{ {
return (fID > 0 ? B_OK : fID); return fID > 0 ? B_OK : fID;
} }
@@ -56,6 +57,14 @@ BDiskSystem::Name() const
} }
// ShortName
const char*
BDiskSystem::ShortName() const
{
return fShortName.String();
}
// PrettyName // PrettyName
const char* const char*
BDiskSystem::PrettyName() const BDiskSystem::PrettyName() const
@@ -76,8 +85,8 @@ BDiskSystem::SupportsDefragmenting(bool* whileMounted) const
} }
if (whileMounted) { if (whileMounted) {
*whileMounted = (IsFileSystem() *whileMounted = IsFileSystem() && (fFlags
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED)); & B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED) != 0;
} }
return true; return true;
@@ -310,7 +319,7 @@ BDiskSystem::GetTypeForContentType(const char* contentType, BString* type) const
bool bool
BDiskSystem::IsPartitioningSystem() const BDiskSystem::IsPartitioningSystem() const
{ {
return (InitCheck() == B_OK && !(fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM)); return InitCheck() == B_OK && !(fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
} }
@@ -318,7 +327,7 @@ BDiskSystem::IsPartitioningSystem() const
bool bool
BDiskSystem::IsFileSystem() const BDiskSystem::IsFileSystem() const
{ {
return (InitCheck() == B_OK && (fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM)); return InitCheck() == B_OK && (fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
} }
@@ -328,6 +337,7 @@ BDiskSystem::operator=(const BDiskSystem& other)
{ {
fID = other.fID; fID = other.fID;
fName = other.fName; fName = other.fName;
fShortName = other.fShortName;
fPrettyName = other.fPrettyName; fPrettyName = other.fPrettyName;
fFlags = other.fFlags; fFlags = other.fFlags;
@@ -364,6 +374,7 @@ BDiskSystem::_SetTo(const user_disk_system_info* info)
fID = info->id; fID = info->id;
fName = info->name; fName = info->name;
fShortName = info->short_name;
fPrettyName = info->pretty_name; fPrettyName = info->pretty_name;
fFlags = info->flags; fFlags = info->flags;
@@ -22,6 +22,7 @@
KDiskSystem::KDiskSystem(const char *name) KDiskSystem::KDiskSystem(const char *name)
: fID(_NextID()), : fID(_NextID()),
fName(NULL), fName(NULL),
fShortName(NULL),
fPrettyName(NULL), fPrettyName(NULL),
fLoadCounter(0) fLoadCounter(0)
{ {
@@ -33,6 +34,8 @@ KDiskSystem::KDiskSystem(const char *name)
KDiskSystem::~KDiskSystem() KDiskSystem::~KDiskSystem()
{ {
free(fName); free(fName);
free(fShortName);
free(fPrettyName);
} }
@@ -40,7 +43,7 @@ KDiskSystem::~KDiskSystem()
status_t status_t
KDiskSystem::Init() KDiskSystem::Init()
{ {
return (fName ? B_OK : B_NO_MEMORY); return fName ? B_OK : B_NO_MEMORY;
} }
@@ -68,9 +71,17 @@ KDiskSystem::Name() const
} }
// ShortName
const char *
KDiskSystem::ShortName() const
{
return fShortName;
}
// PrettyName // PrettyName
const char * const char *
KDiskSystem::PrettyName() KDiskSystem::PrettyName() const
{ {
return fPrettyName; return fPrettyName;
} }
@@ -106,9 +117,11 @@ KDiskSystem::GetInfo(user_disk_system_info *info)
{ {
if (!info) if (!info)
return; return;
info->id = ID(); info->id = ID();
strcpy(info->name, Name()); strlcpy(info->name, Name(), sizeof(info->name));
strcpy(info->pretty_name, PrettyName()); strlcpy(info->short_name, ShortName(), sizeof(info->short_name));
strlcpy(info->pretty_name, PrettyName(), sizeof(info->pretty_name));
info->flags = Flags(); info->flags = Flags();
} }
@@ -339,6 +352,14 @@ KDiskSystem::UnloadModule()
} }
// SetShortName
status_t
KDiskSystem::SetShortName(const char *name)
{
return set_string(fShortName, name);
}
// SetPrettyName // SetPrettyName
status_t status_t
KDiskSystem::SetPrettyName(const char *name) KDiskSystem::SetPrettyName(const char *name)
@@ -43,7 +43,10 @@ KFileSystem::Init()
error = Load(); error = Load();
if (error != B_OK) if (error != B_OK)
return error; return error;
error = SetPrettyName(fModule->pretty_name); error = SetShortName(fModule->short_name);
if (error == B_OK)
error = SetPrettyName(fModule->pretty_name);
SetFlags(fModule->flags | B_DISK_SYSTEM_IS_FILE_SYSTEM); SetFlags(fModule->flags | B_DISK_SYSTEM_IS_FILE_SYSTEM);
Unload(); Unload();
return error; return error;
@@ -49,7 +49,10 @@ KPartitioningSystem::Init()
error = Load(); error = Load();
if (error != B_OK) if (error != B_OK)
return error; return error;
error = SetPrettyName(fModule->pretty_name); error = SetShortName(fModule->short_name);
if (error == B_OK)
error = SetPrettyName(fModule->pretty_name);
SetFlags(fModule->flags & ~(uint32)B_DISK_SYSTEM_IS_FILE_SYSTEM); SetFlags(fModule->flags & ~(uint32)B_DISK_SYSTEM_IS_FILE_SYSTEM);
Unload(); Unload();
return error; return error;
+3 -2
View File
@@ -2655,8 +2655,9 @@ file_system_module_info gDeviceFileSystem = {
devfs_std_ops, devfs_std_ops,
}, },
"Device File System", "devfs", // short_name
0, // DDM flags "Device File System", // pretty_name
0, // DDM flags
NULL, // identify_partition() NULL, // identify_partition()
NULL, // scan_partition() NULL, // scan_partition()
+4 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -1216,8 +1216,9 @@ file_system_module_info gRootFileSystem = {
rootfs_std_ops, rootfs_std_ops,
}, },
"Root File System", "rootfs", // short_name
0, // DDM flags "Root File System", // pretty_name
0, // DDM flags
NULL, // identify_partition() NULL, // identify_partition()
NULL, // scan_partition() NULL, // scan_partition()