blob: f24096e74cc25bd8cf9a73ac8fae0002dd7cbc68 [file] [log] [blame]
Alex Deymo2b19cfb2015-03-26 00:35:07 -07001// Copyright 2015 The Chromium OS 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#include "update_engine/payload_generator/raw_filesystem.h"
6
Alex Deymo1beda782015-06-07 23:01:25 +02007#include "update_engine/payload_generator/extent_ranges.h"
Alex Deymo2b19cfb2015-03-26 00:35:07 -07008#include "update_engine/update_metadata.pb.h"
9#include "update_engine/utils.h"
10
11using std::unique_ptr;
12
13namespace chromeos_update_engine {
14
15unique_ptr<RawFilesystem> RawFilesystem::Create(
16 const std::string& filename, uint64_t block_size, uint64_t block_count) {
17 unique_ptr<RawFilesystem> result(new RawFilesystem());
18 result->filename_ = filename;
19 result->block_size_ = block_size;
20 result->block_count_ = block_count;
21 return result;
22}
23
24size_t RawFilesystem::GetBlockSize() const {
25 return block_size_;
26}
27
28size_t RawFilesystem::GetBlockCount() const {
29 return block_count_;
30}
31
32bool RawFilesystem::GetFiles(std::vector<File>* files) const {
33 files->clear();
34 File file;
35 file.name = filename_;
36 file.extents = { ExtentForRange(0, block_count_) };
37 files->push_back(file);
38 return true;
39}
40
41} // namespace chromeos_update_engine