1 /* 2 * Copyright 2001-2009, 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 #ifdef BFS_SHELL 12 # include "system_dependencies.h" 13 #else 14 # include <SupportDefs.h> 15 #endif 16 17 18 /* ioctl to check the version of BFS used - parameter is a uint32 * 19 * where the number is stored 20 */ 21 #define BFS_IOCTL_VERSION 14200 22 23 #define BFS_IOCTL_UPDATE_BOOT_BLOCK 14204 24 25 struct update_boot_block { 26 uint32 offset; 27 const uint8* data; 28 uint32 length; 29 }; 30 31 /* ioctls to use the "chkbfs" feature from the outside 32 * all calls use a struct check_result as single parameter 33 */ 34 #define BFS_IOCTL_START_CHECKING 14201 35 #define BFS_IOCTL_STOP_CHECKING 14202 36 #define BFS_IOCTL_CHECK_NEXT_NODE 14203 37 38 /* all fields except "flags", and "name" must be set to zero before 39 * BFS_IOCTL_START_CHECKING is called 40 */ 41 struct check_control { 42 uint32 magic; 43 uint32 flags; 44 char name[B_FILE_NAME_LENGTH]; 45 ino_t inode; 46 uint32 mode; 47 uint32 errors; 48 struct { 49 uint64 missing; 50 uint64 already_set; 51 uint64 freed; 52 } stats; 53 status_t status; 54 void* cookie; 55 }; 56 57 /* values for the flags field */ 58 #define BFS_FIX_BITMAP_ERRORS 1 59 #define BFS_REMOVE_WRONG_TYPES 2 60 /* files that shouldn't be part of its parent will be removed 61 * (i.e. a directory contains an attribute, ...) 62 * Works only if B_FIX_BITMAP_ERRORS is set, too 63 */ 64 #define BFS_REMOVE_INVALID 4 65 /* removes nodes that couldn't be opened at all from its parent 66 * directory. 67 * Also requires the B_FIX_BITMAP_ERRORS to be set. 68 */ 69 #define BFS_FIX_NAME_MISMATCHES 8 70 71 /* values for the errors field */ 72 #define BFS_MISSING_BLOCKS 1 73 #define BFS_BLOCKS_ALREADY_SET 2 74 #define BFS_INVALID_BLOCK_RUN 4 75 #define BFS_COULD_NOT_OPEN 8 76 #define BFS_WRONG_TYPE 16 77 #define BFS_NAMES_DONT_MATCH 32 78 79 /* check control magic value */ 80 #define BFS_IOCTL_CHECK_MAGIC 'BChk' 81 82 #endif /* BFS_CONTROL_H */ 83