raw_filesystem.cc revision 1beda780333ce51d7872603b70712772eb2383fb
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
7#include "update_engine/payload_generator/extent_ranges.h"
8#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
42