xref: /haiku/headers/private/fs_shell/fssh_disk_device_defs.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
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 	FSSH_B_DISK_SYSTEM_SUPPORTS_WRITING								= 0x100000,
92 
93 	// partitioning system specific flags
94 	FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD						= 0x001000,
95 	FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD						= 0x002000,
96 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_NAME						= 0x004000,
97 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE						= 0x008000,
98 	FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS					= 0x010000,
99 	FSSH_B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD						= 0x020000,
100 	FSSH_B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD						= 0x040000,
101 	FSSH_B_DISK_SYSTEM_SUPPORTS_NAME								= 0x080000,
102 };
103 
104 // disk device job types
105 enum {
106 	FSSH_B_DISK_DEVICE_JOB_BAD_TYPE,
107 	FSSH_B_DISK_DEVICE_JOB_DEFRAGMENT,
108 	FSSH_B_DISK_DEVICE_JOB_REPAIR,
109 	FSSH_B_DISK_DEVICE_JOB_RESIZE,
110 	FSSH_B_DISK_DEVICE_JOB_MOVE,
111 	FSSH_B_DISK_DEVICE_JOB_SET_NAME,
112 	FSSH_B_DISK_DEVICE_JOB_SET_CONTENT_NAME,
113 	FSSH_B_DISK_DEVICE_JOB_SET_TYPE,
114 	FSSH_B_DISK_DEVICE_JOB_SET_PARMETERS,
115 	FSSH_B_DISK_DEVICE_JOB_SET_CONTENT_PARMETERS,
116 	FSSH_B_DISK_DEVICE_JOB_INITIALIZE,
117 	FSSH_B_DISK_DEVICE_JOB_UNINITIALIZE,
118 	FSSH_B_DISK_DEVICE_JOB_CREATE,
119 	FSSH_B_DISK_DEVICE_JOB_DELETE,
120 	FSSH_B_DISK_DEVICE_JOB_SCAN,
121 };
122 
123 // disk device job statuses
124 enum {
125 	FSSH_B_DISK_DEVICE_JOB_UNINITIALIZED,
126 	FSSH_B_DISK_DEVICE_JOB_SCHEDULED,
127 	FSSH_B_DISK_DEVICE_JOB_IN_PROGRESS,
128 	FSSH_B_DISK_DEVICE_JOB_SUCCEEDED,
129 	FSSH_B_DISK_DEVICE_JOB_FAILED,
130 	FSSH_B_DISK_DEVICE_JOB_CANCELED,
131 };
132 
133 // disk device job progress info
134 typedef struct fssh_disk_device_job_progress_info {
135 	uint32_t	status;
136 	uint32_t	interrupt_properties;
137 	int32_t		task_count;
138 	int32_t		completed_tasks;
139 	float		current_task_progress;
140 	char		current_task_description[256];
141 } fssh_disk_device_job_progress_info;
142 
143 // disk device job interrupt properties
144 enum {
145 	FSSH_B_DISK_DEVICE_JOB_CAN_CANCEL			= 0x01,
146 	FSSH_B_DISK_DEVICE_JOB_STOP_ON_CANCEL		= 0x02,
147 	FSSH_B_DISK_DEVICE_JOB_REVERSE_ON_CANCEL		= 0x04,
148 	FSSH_B_DISK_DEVICE_JOB_CAN_PAUSE				= 0x08,
149 };
150 
151 // string length constants, all of which include the NULL terminator
152 #define FSSH_B_DISK_DEVICE_TYPE_LENGTH FSSH_B_FILE_NAME_LENGTH
153 #define FSSH_B_DISK_DEVICE_NAME_LENGTH FSSH_B_FILE_NAME_LENGTH
154 #define FSSH_B_DISK_SYSTEM_NAME_LENGTH FSSH_B_PATH_NAME_LENGTH
155 
156 // max size of parameter string buffers, including NULL terminator
157 #define FSSH_B_DISK_DEVICE_MAX_PARAMETER_SIZE (32 * 1024)
158 
159 #endif	// _FSSH_DISK_DEVICE_DEFS_H
160