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