1/*
2 * Copyright 2001-2010, Haiku Inc. All rights reserved.
3 * This file may be used under the terms of the MIT License.
4 *
5 * Authors:
6 *		Janito V. Ferreira Filho
7 */
8
9
10#include "RevokeManager.h"
11
12
13//#define TRACE_EXT2
14#ifdef TRACE_EXT2
15#	define TRACE(x...) dprintf("\33[34mext2:\33[0m " x)
16#else
17#	define TRACE(x...) ;
18#endif
19
20
21RevokeManager::RevokeManager(bool has64bits)
22	:
23	fRevokeCount(0),
24	fHas64bits(has64bits)
25{
26}
27
28
29RevokeManager::~RevokeManager()
30{
31}
32
33
34status_t
35RevokeManager::ScanRevokeBlock(JournalRevokeHeader* revokeBlock,
36	uint32 commitID)
37{
38	TRACE("RevokeManager::ScanRevokeBlock(): Commit ID: %" B_PRIu32 "\n",
39		commitID);
40	int count = revokeBlock->NumBytes() / 4;
41
42	for (int i = 0; i < count; ++i) {
43		TRACE("RevokeManager::ScanRevokeBlock(): Found a revoked block: %"
44			B_PRIu32 "\n", revokeBlock->RevokeBlock(i));
45		status_t status = Insert(revokeBlock->RevokeBlock(i), commitID);
46
47		if (status != B_OK) {
48			TRACE("RevokeManager::ScanRevokeBlock(): Error inserting\n");
49			return status;
50		}
51	}
52
53	return B_OK;
54}
55
56