Alex Deymo | 2b19cfb | 2015-03-26 00:35:07 -0700 | [diff] [blame] | 1 | // 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 Deymo | 1beda78 | 2015-06-07 23:01:25 +0200 | [diff] [blame] | 7 | #include "update_engine/payload_generator/extent_ranges.h" |
Alex Deymo | 2b19cfb | 2015-03-26 00:35:07 -0700 | [diff] [blame] | 8 | #include "update_engine/update_metadata.pb.h" |
| 9 | #include "update_engine/utils.h" |
| 10 | |
| 11 | using std::unique_ptr; |
| 12 | |
| 13 | namespace chromeos_update_engine { |
| 14 | |
| 15 | unique_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 | |
| 24 | size_t RawFilesystem::GetBlockSize() const { |
| 25 | return block_size_; |
| 26 | } |
| 27 | |
| 28 | size_t RawFilesystem::GetBlockCount() const { |
| 29 | return block_count_; |
| 30 | } |
| 31 | |
| 32 | bool 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 |