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()
22	:
23	fRevokeCount(0)
24{
25}
26
27
28RevokeManager::~RevokeManager()
29{
30}
31
32
33status_t
34RevokeManager::ScanRevokeBlock(JournalRevokeHeader* revokeBlock, uint32 commitID)
35{
36	TRACE("RevokeManager::ScanRevokeBlock(): Commit ID: %lu\n", commitID);
37	int count = revokeBlock->NumBytes() / 4;
38
39	for (int i = 0; i < count; ++i) {
40		TRACE("RevokeManager::ScanRevokeBlock(): Found a revoked block: %lu\n",
41			revokeBlock->RevokeBlock(i));
42		status_t status = Insert(revokeBlock->RevokeBlock(i), commitID);
43
44		if (status != B_OK) {
45			TRACE("RevokeManager::ScanRevokeBlock(): Error inserting\n");
46			return status;
47		}
48	}
49
50	return B_OK;
51}
52
53