diff --git a/headers/os/drivers/fs_interface.h b/headers/os/drivers/fs_interface.h index 59be62ff73..299e779231 100644 --- a/headers/os/drivers/fs_interface.h +++ b/headers/os/drivers/fs_interface.h @@ -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 diff --git a/headers/private/fs_shell/fssh_fs_interface.h b/headers/private/fs_shell/fssh_fs_interface.h index c514bcdf06..b7bb50fa5f 100644 --- a/headers/private/fs_shell/fssh_fs_interface.h +++ b/headers/private/fs_shell/fssh_fs_interface.h @@ -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 diff --git a/headers/private/kernel/disk_device_manager/KDiskSystem.h b/headers/private/kernel/disk_device_manager/KDiskSystem.h index 5a74e265b6..3e55a58cd9 100644 --- a/headers/private/kernel/disk_device_manager/KDiskSystem.h +++ b/headers/private/kernel/disk_device_manager/KDiskSystem.h @@ -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; diff --git a/headers/private/kernel/disk_device_manager/ddm_modules.h b/headers/private/kernel/disk_device_manager/ddm_modules.h index d13781ef8f..9a173ad4d9 100644 --- a/headers/private/kernel/disk_device_manager/ddm_modules.h +++ b/headers/private/kernel/disk_device_manager/ddm_modules.h @@ -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 #include #include @@ -12,6 +14,7 @@ typedef struct partition_module_info { module_info module; + const char* short_name; const char* pretty_name; uint32 flags; diff --git a/headers/private/kernel/disk_device_manager/ddm_userland_interface.h b/headers/private/kernel/disk_device_manager/ddm_userland_interface.h index 2ce287e43b..e4f90dd349 100644 --- a/headers/private/kernel/disk_device_manager/ddm_userland_interface.h +++ b/headers/private/kernel/disk_device_manager/ddm_userland_interface.h @@ -1,5 +1,10 @@ -// ddm_userland_interface.h - +/* + * Copyright 2003-2008, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ingo Weinhold, bonefish@users.sf.net + */ #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; diff --git a/headers/private/storage/DiskDeviceRoster.h b/headers/private/storage/DiskDeviceRoster.h index 31ff52001d..2fce72e5c9 100644 --- a/headers/private/storage/DiskDeviceRoster.h +++ b/headers/private/storage/DiskDeviceRoster.h @@ -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//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//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; diff --git a/headers/private/storage/DiskSystem.h b/headers/private/storage/DiskSystem.h index d03dee219c..0f9c6d7f5e 100644 --- a/headers/private/storage/DiskSystem.h +++ b/headers/private/storage/DiskSystem.h @@ -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 #include - 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 diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index 70c1a5c843..fd4ea37e97 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -2288,7 +2288,8 @@ static file_system_module_info sBeFileSystem = { bfs_std_ops, }, - "Be File System", + "bfs", // short_name + "Be File System", // pretty_name // DDM flags 0 diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp index b17f0b640b..d1a6f4bd06 100644 --- a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp @@ -2006,7 +2006,8 @@ static file_system_module_info sCDDAFileSystem = { cdda_std_ops, }, - "CDDA File System", + "cdda", // short_name + "CDDA File System", // pretty_name 0, // DDM flags cdda_identify_partition, diff --git a/src/add-ons/kernel/file_systems/fat/dosfs.c b/src/add-ons/kernel/file_systems/fat/dosfs.c index 50721fe8c8..724f801ff4 100644 --- a/src/add-ons/kernel/file_systems/fat/dosfs.c +++ b/src/add-ons/kernel/file_systems/fat/dosfs.c @@ -1313,7 +1313,8 @@ static file_system_module_info sFATFileSystem = { dos_std_ops, }, - "FAT32 File System", + "fat", // short_name + "FAT32 File System", // pretty_name 0, // DDM flags // scanning diff --git a/src/add-ons/kernel/file_systems/googlefs/googlefs.c b/src/add-ons/kernel/file_systems/googlefs/googlefs.c index 0df865d613..a33db9878e 100644 --- a/src/add-ons/kernel/file_systems/googlefs/googlefs.c +++ b/src/add-ons/kernel/file_systems/googlefs/googlefs.c @@ -1619,7 +1619,8 @@ static file_system_module_info sGoogleFSModule = { googlefs_std_ops, }, - GOOGLEFS_PRETTY_NAME, + "googlefs", // short_name + GOOGLEFS_PRETTY_NAME, // pretty_name 0, // DDM flags // scanning diff --git a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp index 7dc458e2a0..fb5bb6a03b 100644 --- a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp @@ -745,8 +745,9 @@ static file_system_module_info sISO660FileSystem = { iso_std_ops, }, - "ISO9660 File System", - 0, // DDM flags + "iso9660", // short_name + "ISO9660 File System", // pretty_name + 0, // DDM flags // scanning fs_identify_partition, diff --git a/src/add-ons/kernel/file_systems/ntfs/kernel_interface.c b/src/add-ons/kernel/file_systems/ntfs/kernel_interface.c index 638086b704..5e111bb002 100644 --- a/src/add-ons/kernel/file_systems/ntfs/kernel_interface.c +++ b/src/add-ons/kernel/file_systems/ntfs/kernel_interface.c @@ -84,8 +84,9 @@ static file_system_module_info sNTFSFileSystem = { ntfs_std_ops, }, - "ntfs File System", - 0, // DDM flags + "ntfs", // short_name + "Windows NT File System", // pretty_name + 0, // DDM flags // scanning fs_identify_partition, diff --git a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp index d8e2ede867..94d0cdb4ce 100644 --- a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp @@ -2069,8 +2069,9 @@ static file_system_module_info sRamFSModuleInfo = { ramfs_std_ops, }, - "RAM File System", - 0, // DDM flags + "ramfs", // short_name + "RAM File System", // pretty_name + 0, // DDM flags // scanning NULL, // identify_partition() diff --git a/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp index 55b0b74c7d..e6ded84658 100644 --- a/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp @@ -649,8 +649,9 @@ static file_system_module_info sReiserFSModuleInfo = { reiserfs_std_ops, }, - "Reiser File System", - 0, // DDM flags + "reiserfs", // short_name + "Reiser File System", // pretty_name + 0, // DDM flags // scanning NULL, // identify_partition() diff --git a/src/add-ons/kernel/partitioning_systems/amiga/amiga_rdb.cpp b/src/add-ons/kernel/partitioning_systems/amiga/amiga_rdb.cpp index a8e73f8c97..f342e28d9b 100644 --- a/src/add-ons/kernel/partitioning_systems/amiga/amiga_rdb.cpp +++ b/src/add-ons/kernel/partitioning_systems/amiga/amiga_rdb.cpp @@ -218,6 +218,7 @@ partition_module_info gAmigaPartitionModule = { 0, amiga_rdb_std_ops }, + "amiga", // short_name AMIGA_PARTITION_NAME, // pretty_name 0, // flags diff --git a/src/add-ons/kernel/partitioning_systems/apple/apple.cpp b/src/add-ons/kernel/partitioning_systems/apple/apple.cpp index 4c2203e22d..1586a69384 100644 --- a/src/add-ons/kernel/partitioning_systems/apple/apple.cpp +++ b/src/add-ons/kernel/partitioning_systems/apple/apple.cpp @@ -203,6 +203,7 @@ partition_module_info gApplePartitionModule = { 0, apple_std_ops }, + "apple", // short_name APPLE_PARTITION_NAME, // pretty_name 0, // flags diff --git a/src/add-ons/kernel/partitioning_systems/atari/atari.cpp b/src/add-ons/kernel/partitioning_systems/atari/atari.cpp index 47d6edb1e8..637042414a 100644 --- a/src/add-ons/kernel/partitioning_systems/atari/atari.cpp +++ b/src/add-ons/kernel/partitioning_systems/atari/atari.cpp @@ -1,7 +1,7 @@ /* -** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include "atari.h" @@ -222,6 +222,7 @@ partition_module_info gAtariPartitionModule = { 0, atari_std_ops }, + "atari", // short_name ATARI_PARTITION_NAME, // pretty_name 0, // flags @@ -240,4 +241,3 @@ partition_module_info *modules[] = { NULL }; #endif - diff --git a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp b/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp index f2a1460382..2b2987d9e8 100644 --- a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp +++ b/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp @@ -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. */ @@ -399,6 +399,7 @@ partition_module_info gEFIPartitionModule = { 0, efi_gpt_std_ops }, + "efi", // short_name EFI_PARTITION_NAME, // pretty_name 0, // flags diff --git a/src/add-ons/kernel/partitioning_systems/intel/intel.cpp b/src/add-ons/kernel/partitioning_systems/intel/intel.cpp index 941cff73ee..3628ca41a6 100644 --- a/src/add-ons/kernel/partitioning_systems/intel/intel.cpp +++ b/src/add-ons/kernel/partitioning_systems/intel/intel.cpp @@ -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: @@ -427,6 +427,7 @@ static partition_module_info intel_partition_map_module = 0, pm_std_ops }, + "intel", // short_name INTEL_PARTITION_NAME, // pretty_name // flags @@ -513,6 +514,7 @@ static partition_module_info intel_extended_partition_module = 0, ep_std_ops }, + "intel_extended", // short_name INTEL_EXTENDED_PARTITION_NAME, // pretty_name // flags diff --git a/src/add-ons/kernel/partitioning_systems/session/session.cpp b/src/add-ons/kernel/partitioning_systems/session/session.cpp index c0bff8b796..b59ad9a17b 100644 --- a/src/add-ons/kernel/partitioning_systems/session/session.cpp +++ b/src/add-ons/kernel/partitioning_systems/session/session.cpp @@ -114,6 +114,7 @@ static partition_module_info sSessionModule = { 0, standard_operations }, + "session", // short_name SESSION_PARTITION_NAME, // pretty_name 0, // flags diff --git a/src/kits/storage/disk_device/DiskDeviceRoster.cpp b/src/kits/storage/disk_device/DiskDeviceRoster.cpp index bde877d8a1..757be2b0eb 100644 --- a/src/kits/storage/disk_device/DiskDeviceRoster.cpp +++ b/src/kits/storage/disk_device/DiskDeviceRoster.cpp @@ -1,7 +1,11 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- +/* + * Copyright 2003-2008, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ingo Weinhold, bonefish@cs.tu-berlin.de + * Axel Dörfler, axeld@pinc-software.de + */ #include @@ -82,7 +86,7 @@ BDiskDeviceRoster::GetNextDevice(BDiskDevice *device) return B_BAD_VALUE; size_t neededSize = 0; partition_id id = _kern_get_next_disk_device_id(&fDeviceCookie, - &neededSize); + &neededSize); if (id < 0) return id; return device->_SetTo(id, true, neededSize); @@ -99,21 +103,21 @@ BDiskDeviceRoster::RewindDevices() return B_OK; } -// GetNextDiskSystem + status_t -BDiskDeviceRoster::GetNextDiskSystem(BDiskSystem *system) +BDiskDeviceRoster::GetNextDiskSystem(BDiskSystem* system) { if (!system) return B_BAD_VALUE; user_disk_system_info info; status_t error = _kern_get_next_disk_system_info(&fDiskSystemCookie, - &info); + &info); if (error == B_OK) error = system->_SetTo(&info); return error; } -// RewindDiskSystems + status_t 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 BDiskDeviceRoster::RegisterFileDevice(const char *filename) { diff --git a/src/kits/storage/disk_device/DiskSystem.cpp b/src/kits/storage/disk_device/DiskSystem.cpp index a4c8c34207..ad61749fe5 100644 --- a/src/kits/storage/disk_device/DiskSystem.cpp +++ b/src/kits/storage/disk_device/DiskSystem.cpp @@ -16,20 +16,21 @@ // constructor BDiskSystem::BDiskSystem() - : fID(B_NO_INIT), - fName(), - fPrettyName(), - fFlags(0) + : + fID(B_NO_INIT), + fFlags(0) { } // copy constructor BDiskSystem::BDiskSystem(const BDiskSystem& other) - : fID(other.fID), - fName(other.fName), - fPrettyName(other.fPrettyName), - fFlags(other.fFlags) + : + fID(other.fID), + fName(other.fName), + fShortName(other.fShortName), + fPrettyName(other.fPrettyName), + fFlags(other.fFlags) { } @@ -44,7 +45,7 @@ BDiskSystem::~BDiskSystem() status_t 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 const char* BDiskSystem::PrettyName() const @@ -76,8 +85,8 @@ BDiskSystem::SupportsDefragmenting(bool* whileMounted) const } if (whileMounted) { - *whileMounted = (IsFileSystem() - && (fFlags & B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED)); + *whileMounted = IsFileSystem() && (fFlags + & B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED) != 0; } return true; @@ -310,7 +319,7 @@ BDiskSystem::GetTypeForContentType(const char* contentType, BString* type) const bool 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 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; fName = other.fName; + fShortName = other.fShortName; fPrettyName = other.fPrettyName; fFlags = other.fFlags; @@ -364,6 +374,7 @@ BDiskSystem::_SetTo(const user_disk_system_info* info) fID = info->id; fName = info->name; + fShortName = info->short_name; fPrettyName = info->pretty_name; fFlags = info->flags; diff --git a/src/system/kernel/disk_device_manager/KDiskSystem.cpp b/src/system/kernel/disk_device_manager/KDiskSystem.cpp index 906cdccfe0..1851c9eeb6 100644 --- a/src/system/kernel/disk_device_manager/KDiskSystem.cpp +++ b/src/system/kernel/disk_device_manager/KDiskSystem.cpp @@ -22,6 +22,7 @@ KDiskSystem::KDiskSystem(const char *name) : fID(_NextID()), fName(NULL), + fShortName(NULL), fPrettyName(NULL), fLoadCounter(0) { @@ -33,6 +34,8 @@ KDiskSystem::KDiskSystem(const char *name) KDiskSystem::~KDiskSystem() { free(fName); + free(fShortName); + free(fPrettyName); } @@ -40,7 +43,7 @@ KDiskSystem::~KDiskSystem() status_t 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 const char * -KDiskSystem::PrettyName() +KDiskSystem::PrettyName() const { return fPrettyName; } @@ -106,9 +117,11 @@ KDiskSystem::GetInfo(user_disk_system_info *info) { if (!info) return; + info->id = ID(); - strcpy(info->name, Name()); - strcpy(info->pretty_name, PrettyName()); + strlcpy(info->name, Name(), sizeof(info->name)); + strlcpy(info->short_name, ShortName(), sizeof(info->short_name)); + strlcpy(info->pretty_name, PrettyName(), sizeof(info->pretty_name)); info->flags = Flags(); } @@ -339,6 +352,14 @@ KDiskSystem::UnloadModule() } +// SetShortName +status_t +KDiskSystem::SetShortName(const char *name) +{ + return set_string(fShortName, name); +} + + // SetPrettyName status_t KDiskSystem::SetPrettyName(const char *name) diff --git a/src/system/kernel/disk_device_manager/KFileSystem.cpp b/src/system/kernel/disk_device_manager/KFileSystem.cpp index 44c40379bb..669a1b8ae2 100644 --- a/src/system/kernel/disk_device_manager/KFileSystem.cpp +++ b/src/system/kernel/disk_device_manager/KFileSystem.cpp @@ -43,7 +43,10 @@ KFileSystem::Init() error = Load(); if (error != B_OK) 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); Unload(); return error; diff --git a/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp b/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp index 09e6002eab..761ab9e9f4 100644 --- a/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp +++ b/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp @@ -49,7 +49,10 @@ KPartitioningSystem::Init() error = Load(); if (error != B_OK) 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); Unload(); return error; diff --git a/src/system/kernel/fs/devfs.cpp b/src/system/kernel/fs/devfs.cpp index 1e0d5790e0..bc9cbbf163 100644 --- a/src/system/kernel/fs/devfs.cpp +++ b/src/system/kernel/fs/devfs.cpp @@ -2655,8 +2655,9 @@ file_system_module_info gDeviceFileSystem = { devfs_std_ops, }, - "Device File System", - 0, // DDM flags + "devfs", // short_name + "Device File System", // pretty_name + 0, // DDM flags NULL, // identify_partition() NULL, // scan_partition() diff --git a/src/system/kernel/fs/rootfs.cpp b/src/system/kernel/fs/rootfs.cpp index e9de8ec64a..6e8b9c1d26 100644 --- a/src/system/kernel/fs/rootfs.cpp +++ b/src/system/kernel/fs/rootfs.cpp @@ -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. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -1216,8 +1216,9 @@ file_system_module_info gRootFileSystem = { rootfs_std_ops, }, - "Root File System", - 0, // DDM flags + "rootfs", // short_name + "Root File System", // pretty_name + 0, // DDM flags NULL, // identify_partition() NULL, // scan_partition()