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