15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef NET_DISK_CACHE_FLASH_FORMAT_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define NET_DISK_CACHE_FLASH_FORMAT_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace disk_cache { 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Storage constants. 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const int32 kFlashPageSize = 8 * 1024; 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const int32 kFlashBlockSize = 512 * kFlashPageSize; 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Segment constants. 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const int32 kFlashSegmentSize = 4 * 1024 * 1024; 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const int32 kFlashSmallEntrySize = 4 * 1024; 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const size_t kFlashMaxEntryCount = kFlashSegmentSize / kFlashSmallEntrySize - 1; 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Segment summary consists of a fixed region at the end of the segment 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// containing a counter specifying the number of saved offsets followed by the 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// offsets. 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const int32 kFlashSummarySize = (1 + kFlashMaxEntryCount) * sizeof(int32); 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)const int32 kFlashSegmentFreeSpace = kFlashSegmentSize - kFlashSummarySize; 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// An entry consists of a fixed number of streams. 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)const int32 kFlashLogStoreEntryNumStreams = 4; 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)const int32 kFlashLogStoreEntryHeaderSize = 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) kFlashLogStoreEntryNumStreams * sizeof(int32); 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace disk_cache 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // NET_DISK_CACHE_FLASH_FORMAT_H_ 33