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 = 0x0001, 71 72 // flags common for both file and partitioning systems 73 B_DISK_SYSTEM_SUPPORTS_CHECKING = 0x0002, 74 B_DISK_SYSTEM_SUPPORTS_REPAIRING = 0x0004, 75 B_DISK_SYSTEM_SUPPORTS_RESIZING = 0x0008, 76 B_DISK_SYSTEM_SUPPORTS_MOVING = 0x0010, 77 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME = 0x0020, 78 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS = 0x0040, 79 80 // file system specific flags 81 B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING = 0x0100, 82 B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED = 0x0200, 83 B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED = 0x0400, 84 B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED = 0x0800, 85 B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED = 0x1000, 86 B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED = 0x2000, 87 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED = 0x4000, 88 B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED = 0x8000, 89 90 // partitioning system specific flags 91 B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD = 0x0100, 92 B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD = 0x0200, 93 B_DISK_SYSTEM_SUPPORTS_SETTING_NAME = 0x0400, 94 B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE = 0x0800, 95 B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS = 0x1000, 96 B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD = 0x2000, 97 B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD = 0x4000, 98 B_DISK_SYSTEM_SUPPORTS_INITIALIZING = 0x8000, 99 }; 100 101 // disk device job types 102 enum { 103 B_DISK_DEVICE_JOB_BAD_TYPE, 104 B_DISK_DEVICE_JOB_DEFRAGMENT, 105 B_DISK_DEVICE_JOB_REPAIR, 106 B_DISK_DEVICE_JOB_RESIZE, 107 B_DISK_DEVICE_JOB_MOVE, 108 B_DISK_DEVICE_JOB_SET_NAME, 109 B_DISK_DEVICE_JOB_SET_CONTENT_NAME, 110 B_DISK_DEVICE_JOB_SET_TYPE, 111 B_DISK_DEVICE_JOB_SET_PARMETERS, 112 B_DISK_DEVICE_JOB_SET_CONTENT_PARMETERS, 113 B_DISK_DEVICE_JOB_INITIALIZE, 114 B_DISK_DEVICE_JOB_UNINITIALIZE, 115 B_DISK_DEVICE_JOB_CREATE, 116 B_DISK_DEVICE_JOB_DELETE, 117 B_DISK_DEVICE_JOB_SCAN, 118 }; 119 120 // disk device job statuses 121 enum { 122 B_DISK_DEVICE_JOB_UNINITIALIZED, 123 B_DISK_DEVICE_JOB_SCHEDULED, 124 B_DISK_DEVICE_JOB_IN_PROGRESS, 125 B_DISK_DEVICE_JOB_SUCCEEDED, 126 B_DISK_DEVICE_JOB_FAILED, 127 B_DISK_DEVICE_JOB_CANCELED, 128 }; 129 130 // disk device job progress info 131 typedef struct disk_device_job_progress_info { 132 uint32 status; 133 uint32 interrupt_properties; 134 int32 task_count; 135 int32 completed_tasks; 136 float current_task_progress; 137 char current_task_description[256]; 138 } disk_device_job_progress_info; 139 140 // disk device job interrupt properties 141 enum { 142 B_DISK_DEVICE_JOB_CAN_CANCEL = 0x01, 143 B_DISK_DEVICE_JOB_STOP_ON_CANCEL = 0x02, 144 B_DISK_DEVICE_JOB_REVERSE_ON_CANCEL = 0x04, 145 B_DISK_DEVICE_JOB_CAN_PAUSE = 0x08, 146 }; 147 148 // string length constants, all of which include the NULL terminator 149 #define B_DISK_DEVICE_TYPE_LENGTH B_FILE_NAME_LENGTH 150 #define B_DISK_DEVICE_NAME_LENGTH B_FILE_NAME_LENGTH 151 #define B_DISK_SYSTEM_NAME_LENGTH B_PATH_NAME_LENGTH 152 153 // max size of parameter string buffers, including NULL terminator 154 #define B_DISK_DEVICE_MAX_PARAMETER_SIZE (32 * 1024) 155 156 #endif // _DISK_DEVICE_DEFS_H 157