xref: /haiku/src/add-ons/kernel/file_systems/bfs/bfs_control.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 #ifndef BFS_CONTROL_H
2 #define BFS_CONTROL_H
3 /* bfs_control - additional functionality exported via ioctl()
4 **
5 ** Initial version by Axel Dörfler, axeld@pinc-software.de
6 ** This file may be used under the terms of the OpenBeOS License.
7 */
8 
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include "fsproto.h"
15 
16 #ifdef __cplusplus
17 }
18 #endif
19 
20 
21 /* ioctl to check the version of BFS used - parameter is a uint32 *
22  * where the number is stored
23  */
24 #define BFS_IOCTL_VERSION			14200
25 
26 /* ioctls to use the "chkbfs" feature from the outside
27  * all calls use a struct check_result as single parameter
28  */
29 #define	BFS_IOCTL_START_CHECKING	14201
30 #define BFS_IOCTL_STOP_CHECKING		14202
31 #define BFS_IOCTL_CHECK_NEXT_NODE	14203
32 
33 /* all fields except "flags", and "name" must be set to zero before
34  * BFS_IOCTL_START_CHECKING is called
35  */
36 struct check_control {
37 	uint32		magic;
38 	uint32		flags;
39 	char		name[B_FILE_NAME_LENGTH];
40 	vnode_id	inode;
41 	uint32		mode;
42 	uint32		errors;
43 	struct {
44 		uint64	missing;
45 		uint64	already_set;
46 		uint64	freed;
47 	} stats;
48 	status_t	status;
49 	void		*cookie;
50 };
51 
52 /* values for the flags field */
53 #define BFS_FIX_BITMAP_ERRORS	1
54 #define BFS_REMOVE_WRONG_TYPES	2
55 	/* files that shouldn't be part of its parent will be removed
56 	 * (i.e. a directory contains an attribute, ...)
57 	 * Works only if B_FIX_BITMAP_ERRORS is set, too
58 	 */
59 #define BFS_REMOVE_INVALID		4
60 	/* removes nodes that couldn't be opened at all from its parent
61 	 * directory.
62 	 * Also requires the B_FIX_BITMAP_ERRORS to be set.
63 	 */
64 
65 /* values for the errors field */
66 #define BFS_MISSING_BLOCKS		1
67 #define BFS_BLOCKS_ALREADY_SET	2
68 #define BFS_INVALID_BLOCK_RUN	4
69 #define	BFS_COULD_NOT_OPEN		8
70 #define BFS_WRONG_TYPE			16
71 #define BFS_NAMES_DONT_MATCH	32
72 
73 /* check control magic value */
74 #define BFS_IOCTL_CHECK_MAGIC	'BChk'
75 
76 #endif	/* BFS_CONTROL_H */
77