1// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef NET_DISK_CACHE_FLASH_FORMAT_H_
6#define NET_DISK_CACHE_FLASH_FORMAT_H_
7
8namespace disk_cache {
9
10// Storage constants.
11const int32 kFlashPageSize = 8 * 1024;
12const int32 kFlashBlockSize = 512 * kFlashPageSize;
13
14// Segment constants.
15const int32 kFlashSegmentSize = 4 * 1024 * 1024;
16const int32 kFlashSmallEntrySize = 4 * 1024;
17const size_t kFlashMaxEntryCount = kFlashSegmentSize / kFlashSmallEntrySize - 1;
18
19// Segment summary consists of a fixed region at the end of the segment
20// containing a counter specifying the number of saved offsets followed by the
21// offsets.
22const int32 kFlashSummarySize = (1 + kFlashMaxEntryCount) * sizeof(int32);
23const int32 kFlashSegmentFreeSpace = kFlashSegmentSize - kFlashSummarySize;
24
25// An entry consists of a fixed number of streams.
26const int32 kFlashLogStoreEntryNumStreams = 4;
27const int32 kFlashLogStoreEntryHeaderSize =
28    kFlashLogStoreEntryNumStreams * sizeof(int32);
29
30}  // namespace disk_cache
31
32#endif  // NET_DISK_CACHE_FLASH_FORMAT_H_
33