blob: efb944f021adc58b2cf0c60ba1771125e3f7a2c2 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2015 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Alex Deymo2b19cfb2015-03-26 00:35:07 -070016
17#include "update_engine/payload_generator/raw_filesystem.h"
18
Alex Deymo1beda782015-06-07 23:01:25 +020019#include "update_engine/payload_generator/extent_ranges.h"
Alex Deymo2b19cfb2015-03-26 00:35:07 -070020#include "update_engine/update_metadata.pb.h"
21#include "update_engine/utils.h"
22
23using std::unique_ptr;
24
25namespace chromeos_update_engine {
26
27unique_ptr<RawFilesystem> RawFilesystem::Create(
28 const std::string& filename, uint64_t block_size, uint64_t block_count) {
29 unique_ptr<RawFilesystem> result(new RawFilesystem());
30 result->filename_ = filename;
31 result->block_size_ = block_size;
32 result->block_count_ = block_count;
33 return result;
34}
35
36size_t RawFilesystem::GetBlockSize() const {
37 return block_size_;
38}
39
40size_t RawFilesystem::GetBlockCount() const {
41 return block_count_;
42}
43
44bool RawFilesystem::GetFiles(std::vector<File>* files) const {
45 files->clear();
46 File file;
47 file.name = filename_;
48 file.extents = { ExtentForRange(0, block_count_) };
49 files->push_back(file);
50 return true;
51}
52
53} // namespace chromeos_update_engine