use the correct targets to build the drivers so they can be disabled as appropriate.
[AROS.git] / rom / filesys / afs / validator.h
blob3712f0269651dde9e5004e8ae0658f4e583a92f3
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*
7 * -date------ -name------------------- -description-----------------------------
8 * 02-jan-2008 [Tomasz Wiszkowski] created disk validation procedures
9 * 04-jan-2008 [Tomasz Wiszkowski] corrected tabulation
10 * 07-jan-2008 [Tomasz Wiszkowski] partitioned procedures to prepare non-recursive scan
13 #ifndef VALIDATOR_H
14 #define VALIDATOR_H
16 #include "os.h"
19 * call this function to initiate validation
21 LONG launchValidator(struct AFSBase *afsbase, struct Volume *volume);
22 LONG checkValid(struct AFSBase *afs, struct Volume *vol);
24 #ifdef __AROS__
26 /********************************************************
27 * structures
28 ********************************************************/
29 typedef struct
31 struct AFSBase *afs;
32 struct Volume *vol;
33 void* bitmap;
34 LONG flags;
35 ULONG *bm_blocks;
36 LONG bm_lastblk;
37 ULONG *bme_blocks;
38 LONG bme_lastblk;
40 /* elements regarding to currently validated file */
41 ULONG max_file_len;
42 ULONG file_blocks;
43 } DiskStructure;
46 /********************************************************
47 * enums
48 ********************************************************/
49 typedef enum
51 vr_OK,
52 vr_NoAccess,
53 vr_ReadError,
54 vr_UnknownDiskType,
55 vr_InvalidChksum,
56 vr_StructureDamaged,
57 vr_OutOfMemory,
58 vr_BlockUsedTwice,
59 vr_Aborted,
60 vr_BlockOutsideDisk,
61 } ValidationResult;
63 typedef enum
65 st_OK,
66 st_AlreadyInUse,
67 st_OutOfRange
68 } BitmapResult;
70 typedef enum
72 ValFlg_DisableReq_MaybeNotAFS = 1, /* consider these FLAGS */
73 ValFlg_DisableReq_DataLossImminent = 2, /* next value = 4 */
74 } ValidationFlags;
77 * validation entry point for new process
79 LONG validate(struct AFSBase*, struct Volume*);
82 * initiate validation once structures are initially ready.
83 * walks through all structures and collects used blocks
85 ValidationResult start_superblock(DiskStructure *ds);
88 * verifies checksum.
89 * returns 0 if checksum is ok, otherwise a new checksum.
90 * a new checksum is recorded to the structure automatically,
91 * just not recorded
93 ULONG verify_checksum(DiskStructure *ds, ULONG* block);
94 ULONG verify_bm_checksum(DiskStructure *ds, ULONG* block);
97 * various per-block operations:
98 * - check_block does the most generic checks (checksum, block type, range and stuff like that)
99 * - collect_bitmap is called with root block where we begin root block acquisition - nonrecursive
101 ValidationResult check_block(DiskStructure* ds, struct BlockCache* block);
102 ValidationResult collect_bitmap(DiskStructure* ds, struct BlockCache* block);
103 ValidationResult collect_file_extensions(DiskStructure* ds, struct BlockCache* block);
106 * collect all bitmap blocks, starting with first extension block
107 * all root blocks are already collected
109 ValidationResult collect_directory_blocks(DiskStructure *ds, ULONG ext);
112 * record bitmap back to disk
114 void record_bitmap(DiskStructure* ds);
117 * call to allocate bitmap in disk structure.
118 * returns 0 if all went ok, otherwise other value
119 * (just in case someone needed error handling here)
121 LONG bm_allocate_bitmap(DiskStructure *ds);
122 void bm_free_bitmap(DiskStructure *ds);
125 * bitmap operations ;]
127 BitmapResult bm_mark_block(DiskStructure *ds, ULONG block);
132 void bm_add_bitmap_block(DiskStructure *ds, ULONG blk);
133 void bm_add_bitmap_extension_block(DiskStructure *ds, ULONG blk);
135 #endif /* __AROS__ */
136 #endif /* VALIDATOR_H */