1 /* 2 * Copyright 2003-2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _DISK_DEVICE_DEFS_H 6 #define _DISK_DEVICE_DEFS_H 7 8 9 #include <SupportDefs.h> 10 11 12 typedef int32 partition_id; 13 typedef int32 disk_system_id; 14 typedef int32 disk_job_id; 15 16 // partition flags 17 enum { 18 B_PARTITION_IS_DEVICE = 0x01, 19 B_PARTITION_FILE_SYSTEM = 0x02, 20 B_PARTITION_PARTITIONING_SYSTEM = 0x04, 21 B_PARTITION_READ_ONLY = 0x08, 22 B_PARTITION_MOUNTED = 0x10, // needed? 23 B_PARTITION_BUSY = 0x20, 24 B_PARTITION_DESCENDANT_BUSY = 0x40, 25 }; 26 27 // partition statuses 28 enum { 29 B_PARTITION_VALID, 30 B_PARTITION_CORRUPT, 31 B_PARTITION_UNRECOGNIZED, 32 B_PARTITION_UNINITIALIZED, // Only when uninitialized manually. 33 // When not recognized while scanning it's 34 // B_PARTITION_UNRECOGNIZED. 35 }; 36 37 // partition change flags 38 enum { 39 B_PARTITION_CHANGED_OFFSET = 0x000001, 40 B_PARTITION_CHANGED_SIZE = 0x000002, 41 B_PARTITION_CHANGED_CONTENT_SIZE = 0x000004, 42 B_PARTITION_CHANGED_BLOCK_SIZE = 0x000008, 43 B_PARTITION_CHANGED_STATUS = 0x000010, 44 B_PARTITION_CHANGED_FLAGS = 0x000020, 45 B_PARTITION_CHANGED_VOLUME = 0x000040, 46 B_PARTITION_CHANGED_NAME = 0x000080, 47 B_PARTITION_CHANGED_CONTENT_NAME = 0x000100, 48 B_PARTITION_CHANGED_TYPE = 0x000200, 49 B_PARTITION_CHANGED_CONTENT_TYPE = 0x000400, 50 B_PARTITION_CHANGED_PARAMETERS = 0x000800, 51 B_PARTITION_CHANGED_CONTENT_PARAMETERS = 0x001000, 52 B_PARTITION_CHANGED_CHILDREN = 0x002000, 53 B_PARTITION_CHANGED_DESCENDANTS = 0x004000, 54 B_PARTITION_CHANGED_DEFRAGMENTATION = 0x008000, 55 B_PARTITION_CHANGED_CHECK = 0x010000, 56 B_PARTITION_CHANGED_REPAIR = 0x020000, 57 B_PARTITION_CHANGED_INITIALIZATION = 0x040000, 58 }; 59 60 // disk device flags 61 enum { 62 B_DISK_DEVICE_REMOVABLE = 0x01, 63 B_DISK_DEVICE_HAS_MEDIA = 0x02, 64 B_DISK_DEVICE_READ_ONLY = 0x04, 65 B_DISK_DEVICE_WRITE_ONCE = 0x08, 66 }; 67 68 // disk system flags 69 enum { 70 B_DISK_SYSTEM_IS_FILE_SYSTEM = 0x000001, 71 72 // flags common for both file and partitioning systems 73 B_DISK_SYSTEM_SUPPORTS_CHECKING = 0x000002, 74 B_DISK_SYSTEM_SUPPORTS_REPAIRING = 0x000004, 75 B_DISK_SYSTEM_SUPPORTS_RESIZING = 0x000008, 76 B_DISK_SYSTEM_SUPPORTS_MOVING = 0x000010, 77 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME = 0x000020, 78 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS = 0x000040, 79 B_DISK_SYSTEM_SUPPORTS_INITIALIZING = 0x000080, 80 B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME = 0x000100, 81 82 // file system specific flags 83 B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING = 0x001000, 84 B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED = 0x002000, 85 B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED = 0x004000, 86 B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED = 0x008000, 87 B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED = 0x010000, 88 B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED = 0x020000, 89 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED = 0x040000, 90 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED = 0x080000, 91 92 // partitioning system specific flags 93 B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD = 0x001000, 94 B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD = 0x002000, 95 B_DISK_SYSTEM_SUPPORTS_SETTING_NAME = 0x004000, 96 B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE = 0x008000, 97 B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS = 0x010000, 98 B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD = 0x020000, 99 B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD = 0x040000, 100 B_DISK_SYSTEM_SUPPORTS_NAME = 0x080000, 101 }; 102 103 // disk device job types 104 enum { 105 B_DISK_DEVICE_JOB_BAD_TYPE, 106 B_DISK_DEVICE_JOB_DEFRAGMENT, 107 B_DISK_DEVICE_JOB_REPAIR, 108 B_DISK_DEVICE_JOB_RESIZE, 109 B_DISK_DEVICE_JOB_MOVE, 110 B_DISK_DEVICE_JOB_SET_NAME, 111 B_DISK_DEVICE_JOB_SET_CONTENT_NAME, 112 B_DISK_DEVICE_JOB_SET_TYPE, 113 B_DISK_DEVICE_JOB_SET_PARMETERS, 114 B_DISK_DEVICE_JOB_SET_CONTENT_PARMETERS, 115 B_DISK_DEVICE_JOB_INITIALIZE, 116 B_DISK_DEVICE_JOB_UNINITIALIZE, 117 B_DISK_DEVICE_JOB_CREATE, 118 B_DISK_DEVICE_JOB_DELETE, 119 B_DISK_DEVICE_JOB_SCAN, 120 }; 121 122 // disk device job statuses 123 enum { 124 B_DISK_DEVICE_JOB_UNINITIALIZED, 125 B_DISK_DEVICE_JOB_SCHEDULED, 126 B_DISK_DEVICE_JOB_IN_PROGRESS, 127 B_DISK_DEVICE_JOB_SUCCEEDED, 128 B_DISK_DEVICE_JOB_FAILED, 129 B_DISK_DEVICE_JOB_CANCELED, 130 }; 131 132 // disk device job progress info 133 typedef struct disk_device_job_progress_info { 134 uint32 status; 135 uint32 interrupt_properties; 136 int32 task_count; 137 int32 completed_tasks; 138 float current_task_progress; 139 char current_task_description[256]; 140 } disk_device_job_progress_info; 141 142 // disk device job interrupt properties 143 enum { 144 B_DISK_DEVICE_JOB_CAN_CANCEL = 0x01, 145 B_DISK_DEVICE_JOB_STOP_ON_CANCEL = 0x02, 146 B_DISK_DEVICE_JOB_REVERSE_ON_CANCEL = 0x04, 147 B_DISK_DEVICE_JOB_CAN_PAUSE = 0x08, 148 }; 149 150 // string length constants, all of which include the NULL terminator 151 #define B_DISK_DEVICE_TYPE_LENGTH B_FILE_NAME_LENGTH 152 #define B_DISK_DEVICE_NAME_LENGTH B_FILE_NAME_LENGTH 153 #define B_DISK_SYSTEM_NAME_LENGTH B_PATH_NAME_LENGTH 154 155 // max size of parameter string buffers, including NULL terminator 156 #define B_DISK_DEVICE_MAX_PARAMETER_SIZE (32 * 1024) 157 158 #endif // _DISK_DEVICE_DEFS_H 159