xref: /haiku/headers/os/storage/DiskDeviceDefs.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 /*
2  * Copyright 2003-2008, 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 };
25 
26 // partition statuses
27 enum {
28 	B_PARTITION_VALID,
29 	B_PARTITION_CORRUPT,
30 	B_PARTITION_UNRECOGNIZED,
31 	B_PARTITION_UNINITIALIZED,	// Only when uninitialized manually.
32 								// When not recognized while scanning it's
33 								// B_PARTITION_UNRECOGNIZED.
34 };
35 
36 // partition change flags
37 enum {
38 	B_PARTITION_CHANGED_OFFSET				= 0x000001,
39 	B_PARTITION_CHANGED_SIZE				= 0x000002,
40 	B_PARTITION_CHANGED_CONTENT_SIZE		= 0x000004,
41 	B_PARTITION_CHANGED_BLOCK_SIZE			= 0x000008,
42 	B_PARTITION_CHANGED_STATUS				= 0x000010,
43 	B_PARTITION_CHANGED_FLAGS				= 0x000020,
44 	B_PARTITION_CHANGED_VOLUME				= 0x000040,
45 	B_PARTITION_CHANGED_NAME				= 0x000080,
46 	B_PARTITION_CHANGED_CONTENT_NAME		= 0x000100,
47 	B_PARTITION_CHANGED_TYPE				= 0x000200,
48 	B_PARTITION_CHANGED_CONTENT_TYPE		= 0x000400,
49 	B_PARTITION_CHANGED_PARAMETERS			= 0x000800,
50 	B_PARTITION_CHANGED_CONTENT_PARAMETERS	= 0x001000,
51 	B_PARTITION_CHANGED_CHILDREN			= 0x002000,
52 	B_PARTITION_CHANGED_DESCENDANTS			= 0x004000,
53 	B_PARTITION_CHANGED_DEFRAGMENTATION		= 0x008000,
54 	B_PARTITION_CHANGED_CHECK				= 0x010000,
55 	B_PARTITION_CHANGED_REPAIR				= 0x020000,
56 	B_PARTITION_CHANGED_INITIALIZATION		= 0x040000,
57 };
58 
59 // disk device flags
60 enum {
61 	B_DISK_DEVICE_REMOVABLE		= 0x01,
62 	B_DISK_DEVICE_HAS_MEDIA		= 0x02,
63 	B_DISK_DEVICE_READ_ONLY		= 0x04,
64 	B_DISK_DEVICE_WRITE_ONCE	= 0x08,
65 	B_DISK_DEVICE_IS_FILE		= 0x10,
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 	B_DISK_SYSTEM_SUPPORTS_WRITING								= 0x100000,
92 
93 	// partitioning system specific flags
94 	B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD						= 0x001000,
95 	B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD							= 0x002000,
96 	B_DISK_SYSTEM_SUPPORTS_SETTING_NAME							= 0x004000,
97 	B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE							= 0x008000,
98 	B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS					= 0x010000,
99 	B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD						= 0x020000,
100 	B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD						= 0x040000,
101 	B_DISK_SYSTEM_SUPPORTS_NAME									= 0x080000,
102 };
103 
104 // disk device job types
105 enum {
106 	B_DISK_DEVICE_JOB_BAD_TYPE,
107 	B_DISK_DEVICE_JOB_DEFRAGMENT,
108 	B_DISK_DEVICE_JOB_REPAIR,
109 	B_DISK_DEVICE_JOB_RESIZE,
110 	B_DISK_DEVICE_JOB_MOVE,
111 	B_DISK_DEVICE_JOB_SET_NAME,
112 	B_DISK_DEVICE_JOB_SET_CONTENT_NAME,
113 	B_DISK_DEVICE_JOB_SET_TYPE,
114 	B_DISK_DEVICE_JOB_SET_PARAMETERS,
115 	B_DISK_DEVICE_JOB_SET_CONTENT_PARAMETERS,
116 	B_DISK_DEVICE_JOB_INITIALIZE,
117 	B_DISK_DEVICE_JOB_UNINITIALIZE,
118 	B_DISK_DEVICE_JOB_CREATE,
119 	B_DISK_DEVICE_JOB_DELETE,
120 	B_DISK_DEVICE_JOB_SCAN,
121 };
122 
123 // disk device job statuses
124 enum {
125 	B_DISK_DEVICE_JOB_UNINITIALIZED,
126 	B_DISK_DEVICE_JOB_SCHEDULED,
127 	B_DISK_DEVICE_JOB_IN_PROGRESS,
128 	B_DISK_DEVICE_JOB_SUCCEEDED,
129 	B_DISK_DEVICE_JOB_FAILED,
130 	B_DISK_DEVICE_JOB_CANCELED,
131 };
132 
133 // disk device job progress info
134 typedef struct disk_device_job_progress_info {
135 	uint32	status;
136 	uint32	interrupt_properties;
137 	int32	task_count;
138 	int32	completed_tasks;
139 	float	current_task_progress;
140 	char	current_task_description[256];
141 } disk_device_job_progress_info;
142 
143 // disk device job interrupt properties
144 enum {
145 	B_DISK_DEVICE_JOB_CAN_CANCEL			= 0x01,
146 	B_DISK_DEVICE_JOB_STOP_ON_CANCEL		= 0x02,
147 	B_DISK_DEVICE_JOB_REVERSE_ON_CANCEL		= 0x04,
148 	B_DISK_DEVICE_JOB_CAN_PAUSE				= 0x08,
149 };
150 
151 enum B_PARAMETER_EDITOR_TYPE {
152 	B_CREATE_PARAMETER_EDITOR 				= 0x01,
153 	B_INITIALIZE_PARAMETER_EDITOR			= 0x04,
154 	B_DELETE_PARAMETER_EDITOR				= 0x08,
155 	B_PROPERTIES_PARAMETER_EDITOR			= 0x10
156 };
157 
158 // string length constants, all of which include the NULL terminator
159 #define B_DISK_DEVICE_TYPE_LENGTH B_FILE_NAME_LENGTH
160 #define B_DISK_DEVICE_NAME_LENGTH B_FILE_NAME_LENGTH
161 #define B_DISK_SYSTEM_NAME_LENGTH B_PATH_NAME_LENGTH
162 
163 // max size of parameter string buffers, including NULL terminator
164 #define B_DISK_DEVICE_MAX_PARAMETER_SIZE (32 * 1024)
165 
166 #endif	// _DISK_DEVICE_DEFS_H
167