xref: /haiku/headers/private/fs_shell/fssh_disk_device_defs.h (revision 1b8f7f13a3dc70e0e903cb94248220b40b732204)
1 /*
2  * Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _FSSH_DISK_DEVICE_DEFS_H
6 #define _FSSH_DISK_DEVICE_DEFS_H
7 
8 
9 #include "fssh_defs.h"
10 
11 
12 typedef int32_t fssh_partition_id;
13 typedef int32_t fssh_disk_system_id;
14 typedef int32_t fssh_disk_job_id;
15 
16 // partition flags
17 enum {
18 	FSSH_B_PARTITION_IS_DEVICE				= 0x01,
19 	FSSH_B_PARTITION_FILE_SYSTEM			= 0x02,
20 	FSSH_B_PARTITION_PARTITIONING_SYSTEM	= 0x04,
21 	FSSH_B_PARTITION_READ_ONLY				= 0x08,
22 	FSSH_B_PARTITION_MOUNTED				= 0x10,	// needed?
23 	FSSH_B_PARTITION_BUSY					= 0x20,
24 	FSSH_B_PARTITION_DESCENDANT_BUSY		= 0x40,
25 };
26 
27 // partition statuses
28 enum {
29 	FSSH_B_PARTITION_VALID,
30 	FSSH_B_PARTITION_CORRUPT,
31 	FSSH_B_PARTITION_UNRECOGNIZED,
32 	FSSH_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 	FSSH_B_PARTITION_CHANGED_OFFSET				= 0x000001,
40 	FSSH_B_PARTITION_CHANGED_SIZE				= 0x000002,
41 	FSSH_B_PARTITION_CHANGED_CONTENT_SIZE		= 0x000004,
42 	FSSH_B_PARTITION_CHANGED_BLOCK_SIZE			= 0x000008,
43 	FSSH_B_PARTITION_CHANGED_STATUS				= 0x000010,
44 	FSSH_B_PARTITION_CHANGED_FLAGS				= 0x000020,
45 	FSSH_B_PARTITION_CHANGED_VOLUME				= 0x000040,
46 	FSSH_B_PARTITION_CHANGED_NAME				= 0x000080,
47 	FSSH_B_PARTITION_CHANGED_CONTENT_NAME		= 0x000100,
48 	FSSH_B_PARTITION_CHANGED_TYPE				= 0x000200,
49 	FSSH_B_PARTITION_CHANGED_CONTENT_TYPE		= 0x000400,
50 	FSSH_B_PARTITION_CHANGED_PARAMETERS			= 0x000800,
51 	FSSH_B_PARTITION_CHANGED_CONTENT_PARAMETERS	= 0x001000,
52 	FSSH_B_PARTITION_CHANGED_CHILDREN			= 0x002000,
53 	FSSH_B_PARTITION_CHANGED_DESCENDANTS		= 0x004000,
54 	FSSH_B_PARTITION_CHANGED_DEFRAGMENTATION	= 0x008000,
55 	FSSH_B_PARTITION_CHANGED_CHECK				= 0x010000,
56 	FSSH_B_PARTITION_CHANGED_REPAIR				= 0x020000,
57 	FSSH_B_PARTITION_CHANGED_INITIALIZATION		= 0x040000,
58 };
59 
60 // disk device flags
61 enum {
62 	FSSH_B_DISK_DEVICE_REMOVABLE		= 0x01,
63 	FSSH_B_DISK_DEVICE_HAS_MEDIA		= 0x02,
64 	FSSH_B_DISK_DEVICE_READ_ONLY		= 0x04,
65 	FSSH_B_DISK_DEVICE_WRITE_ONCE	= 0x08,
66 };
67 
68 // disk system flags
69 enum {
70 	FSSH_B_DISK_SYSTEM_IS_FILE_SYSTEM								= 0x000001,
71 
72 	// flags common for both file and partitioning systems
73 	FSSH_B_DISK_SYSTEM_SUPPORTS_CHECKING							= 0x000002,
74 	FSSH_B_DISK_SYSTEM_SUPPORTS_REPAIRING							= 0x000004,
75 	FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING							= 0x000008,
76 	FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING								= 0x000010,
77 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME				= 0x000020,
78 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS			= 0x000040,
79 	FSSH_B_DISK_SYSTEM_SUPPORTS_INITIALIZING						= 0x000080,
80 	FSSH_B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME						= 0x000100,
81 
82 	// file system specific flags
83 	FSSH_B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING						= 0x001000,
84 	FSSH_B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED			= 0x002000,
85 	FSSH_B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED				= 0x004000,
86 	FSSH_B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED				= 0x008000,
87 	FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED				= 0x010000,
88 	FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED				= 0x020000,
89 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED	= 0x040000,
90 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED	= 0x080000,
91 
92 	// partitioning system specific flags
93 	FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD						= 0x001000,
94 	FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD						= 0x002000,
95 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_NAME						= 0x004000,
96 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE						= 0x008000,
97 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS					= 0x010000,
98 	FSSH_B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD						= 0x020000,
99 	FSSH_B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD						= 0x040000,
100 	FSSH_B_DISK_SYSTEM_SUPPORTS_NAME								= 0x080000,
101 };
102 
103 // disk device job types
104 enum {
105 	FSSH_B_DISK_DEVICE_JOB_BAD_TYPE,
106 	FSSH_B_DISK_DEVICE_JOB_DEFRAGMENT,
107 	FSSH_B_DISK_DEVICE_JOB_REPAIR,
108 	FSSH_B_DISK_DEVICE_JOB_RESIZE,
109 	FSSH_B_DISK_DEVICE_JOB_MOVE,
110 	FSSH_B_DISK_DEVICE_JOB_SET_NAME,
111 	FSSH_B_DISK_DEVICE_JOB_SET_CONTENT_NAME,
112 	FSSH_B_DISK_DEVICE_JOB_SET_TYPE,
113 	FSSH_B_DISK_DEVICE_JOB_SET_PARMETERS,
114 	FSSH_B_DISK_DEVICE_JOB_SET_CONTENT_PARMETERS,
115 	FSSH_B_DISK_DEVICE_JOB_INITIALIZE,
116 	FSSH_B_DISK_DEVICE_JOB_UNINITIALIZE,
117 	FSSH_B_DISK_DEVICE_JOB_CREATE,
118 	FSSH_B_DISK_DEVICE_JOB_DELETE,
119 	FSSH_B_DISK_DEVICE_JOB_SCAN,
120 };
121 
122 // disk device job statuses
123 enum {
124 	FSSH_B_DISK_DEVICE_JOB_UNINITIALIZED,
125 	FSSH_B_DISK_DEVICE_JOB_SCHEDULED,
126 	FSSH_B_DISK_DEVICE_JOB_IN_PROGRESS,
127 	FSSH_B_DISK_DEVICE_JOB_SUCCEEDED,
128 	FSSH_B_DISK_DEVICE_JOB_FAILED,
129 	FSSH_B_DISK_DEVICE_JOB_CANCELED,
130 };
131 
132 // disk device job progress info
133 typedef struct fssh_disk_device_job_progress_info {
134 	uint32_t	status;
135 	uint32_t	interrupt_properties;
136 	int32_t		task_count;
137 	int32_t		completed_tasks;
138 	float		current_task_progress;
139 	char		current_task_description[256];
140 } fssh_disk_device_job_progress_info;
141 
142 // disk device job interrupt properties
143 enum {
144 	FSSH_B_DISK_DEVICE_JOB_CAN_CANCEL			= 0x01,
145 	FSSH_B_DISK_DEVICE_JOB_STOP_ON_CANCEL		= 0x02,
146 	FSSH_B_DISK_DEVICE_JOB_REVERSE_ON_CANCEL		= 0x04,
147 	FSSH_B_DISK_DEVICE_JOB_CAN_PAUSE				= 0x08,
148 };
149 
150 // string length constants, all of which include the NULL terminator
151 #define FSSH_B_DISK_DEVICE_TYPE_LENGTH FSSH_B_FILE_NAME_LENGTH
152 #define FSSH_B_DISK_DEVICE_NAME_LENGTH FSSH_B_FILE_NAME_LENGTH
153 #define FSSH_B_DISK_SYSTEM_NAME_LENGTH FSSH_B_PATH_NAME_LENGTH
154 
155 // max size of parameter string buffers, including NULL terminator
156 #define FSSH_B_DISK_DEVICE_MAX_PARAMETER_SIZE (32 * 1024)
157 
158 #endif	// _FSSH_DISK_DEVICE_DEFS_H
159