* Made the use of file devices more convenient and complete by adding

the methods IsFile() and GetFilePath() to BDiskDevice, and
  BDiskDeviceRoster::GetFileDeviceForPath().
* Added new syscalls to implement this functionality.
* Added new flag B_DISK_DEVICE_IS_FILE.
* Fixed wrong operator precedence assumption in the BDiskDevice class at
  several places.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28052 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-13 21:51:43 +00:00
parent 42d02ade26
commit 38bbc95758
9 changed files with 147 additions and 22 deletions
+1
View File
@@ -62,6 +62,7 @@ enum {
B_DISK_DEVICE_HAS_MEDIA = 0x02,
B_DISK_DEVICE_READ_ONLY = 0x04,
B_DISK_DEVICE_WRITE_ONCE = 0x08,
B_DISK_DEVICE_IS_FILE = 0x10,
};
// disk system flags
@@ -26,21 +26,25 @@ extern "C" {
partition_id _user_get_next_disk_device_id(int32 *cookie, size_t *neededSize);
partition_id _user_find_disk_device(const char *filename, size_t *neededSize);
partition_id _user_find_partition(const char *filename, size_t *neededSize);
partition_id _user_find_file_disk_device(const char *filename,
size_t *neededSize);
status_t _user_get_disk_device_data(partition_id deviceID, bool deviceOnly,
user_disk_device_data *buffer, size_t bufferSize,
size_t *neededSize);
partition_id _user_register_file_device(const char *filename);
status_t _user_unregister_file_device(partition_id deviceID,
const char *filename);
const char *filename);
// Only a valid deviceID or filename need to be passed. The other one
// is -1/NULL. If both is given only filename is ignored.
status_t _user_get_file_disk_device_path(partition_id id, char* buffer,
size_t bufferSize);
// disk systems
status_t _user_get_disk_system_info(disk_system_id id,
user_disk_system_info *info);
user_disk_system_info *info);
status_t _user_get_next_disk_system_info(int32 *cookie,
user_disk_system_info *info);
user_disk_system_info *info);
status_t _user_find_disk_system(const char *name, user_disk_system_info *info);
// disk device modification
+3
View File
@@ -37,6 +37,9 @@ public:
bool receiveCompleteProgressUpdates = true);
status_t CancelModifications();
bool IsFile() const;
status_t GetFilePath(BPath* path) const;
private:
friend class BDiskDeviceList;
friend class BDiskDeviceRoster;
+3 -1
View File
@@ -28,7 +28,7 @@ enum {
// Basic masks
B_DEVICE_REQUEST_MOUNT_POINT = 0x0001, // mount point changes
B_DEVICE_REQUEST_MOUNTING = 0x0002, // mounting/unmounting
B_DEVICE_REQUEST_PARTITION = 0x0004, // partition changes
B_DEVICE_REQUEST_PARTITION = 0x0004, // partition changes
B_DEVICE_REQUEST_DEVICE = 0x0008, // device changes (media changes)
B_DEVICE_REQUEST_DEVICE_LIST = 0x0010, // device additions/removals
B_DEVICE_REQUEST_JOB_LIST = 0x0020, // job addition/initiation/cancellation/completion
@@ -125,6 +125,8 @@ public:
BDiskDevice* device);
status_t GetPartitionForPath(const char* filename,
BDiskDevice* device, BPartition** _partition);
status_t GetFileDeviceForPath(const char* filename,
BDiskDevice* device);
status_t StartWatching(BMessenger target,
uint32 eventMask = B_DEVICE_REQUEST_ALL);
+10 -3
View File
@@ -441,9 +441,14 @@ extern status_t _kern_get_cpuid(cpuid_info *info, uint32 eax, uint32 cpu);
/* Disk Device Manager syscalls */
// iterating, retrieving device/partition data
extern partition_id _kern_get_next_disk_device_id(int32 *cookie, size_t *neededSize);
extern partition_id _kern_find_disk_device(const char *filename, size_t *neededSize);
extern partition_id _kern_find_partition(const char *filename, size_t *neededSize);
extern partition_id _kern_get_next_disk_device_id(int32 *cookie,
size_t *neededSize);
extern partition_id _kern_find_disk_device(const char *filename,
size_t *neededSize);
extern partition_id _kern_find_partition(const char *filename,
size_t *neededSize);
extern partition_id _kern_find_file_disk_device(const char *filename,
size_t *neededSize);
extern status_t _kern_get_disk_device_data(partition_id deviceID,
bool deviceOnly, struct user_disk_device_data *buffer,
size_t bufferSize, size_t *neededSize);
@@ -452,6 +457,8 @@ extern status_t _kern_unregister_file_device(partition_id deviceID,
const char *filename);
// Only a valid deviceID or filename need to be passed. The other one
// is -1/NULL. If both is given only filename is ignored.
extern status_t _kern_get_file_disk_device_path(partition_id id,
char* buffer, size_t bufferSize);
// disk systems
extern status_t _kern_get_disk_system_info(disk_system_id id,