xref: /haiku/src/add-ons/kernel/file_systems/bfs/bfs_control.h (revision a381c8a06378de22ff08adf4282b4e3f7e50d250)
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 #define BFS_IOCTL_UPDATE_BOOT_BLOCK	14204
20 
21 /* ioctls to use the "chkbfs" feature from the outside
22  * all calls use a struct check_result as single parameter
23  */
24 #define	BFS_IOCTL_START_CHECKING	14201
25 #define BFS_IOCTL_STOP_CHECKING		14202
26 #define BFS_IOCTL_CHECK_NEXT_NODE	14203
27 
28 /* all fields except "flags", and "name" must be set to zero before
29  * BFS_IOCTL_START_CHECKING is called
30  */
31 struct check_control {
32 	uint32		magic;
33 	uint32		flags;
34 	char		name[B_FILE_NAME_LENGTH];
35 	ino_t		inode;
36 	uint32		mode;
37 	uint32		errors;
38 	struct {
39 		uint64	missing;
40 		uint64	already_set;
41 		uint64	freed;
42 	} stats;
43 	status_t	status;
44 	void		*cookie;
45 };
46 
47 /* values for the flags field */
48 #define BFS_FIX_BITMAP_ERRORS	1
49 #define BFS_REMOVE_WRONG_TYPES	2
50 	/* files that shouldn't be part of its parent will be removed
51 	 * (i.e. a directory contains an attribute, ...)
52 	 * Works only if B_FIX_BITMAP_ERRORS is set, too
53 	 */
54 #define BFS_REMOVE_INVALID		4
55 	/* removes nodes that couldn't be opened at all from its parent
56 	 * directory.
57 	 * Also requires the B_FIX_BITMAP_ERRORS to be set.
58 	 */
59 
60 /* values for the errors field */
61 #define BFS_MISSING_BLOCKS		1
62 #define BFS_BLOCKS_ALREADY_SET	2
63 #define BFS_INVALID_BLOCK_RUN	4
64 #define	BFS_COULD_NOT_OPEN		8
65 #define BFS_WRONG_TYPE			16
66 #define BFS_NAMES_DONT_MATCH	32
67 
68 /* check control magic value */
69 #define BFS_IOCTL_CHECK_MAGIC	'BChk'
70 
71 #endif	/* BFS_CONTROL_H */
72