blob: 0ecbc9cfd32974b1123a7bd1e49625d6f9ef321f [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#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_RAW_FILESYSTEM_H_
18#define UPDATE_ENGINE_PAYLOAD_GENERATOR_RAW_FILESYSTEM_H_
19
20// A simple filesystem interface implementation used for unknown filesystem
21// format such as the kernel.
22
23#include "update_engine/payload_generator/filesystem_interface.h"
24
Amin Hassani232f8f92019-01-14 16:15:31 -080025#include <memory>
Alex Deymo2b19cfb2015-03-26 00:35:07 -070026#include <string>
27#include <vector>
28
29namespace chromeos_update_engine {
30
31class RawFilesystem : public FilesystemInterface {
32 public:
Amin Hassani232f8f92019-01-14 16:15:31 -080033 static std::unique_ptr<RawFilesystem> Create(const std::string& filename,
34 uint64_t block_size,
35 uint64_t block_count);
Alex Deymo2b19cfb2015-03-26 00:35:07 -070036 virtual ~RawFilesystem() = default;
37
38 // FilesystemInterface overrides.
39 size_t GetBlockSize() const override;
40 size_t GetBlockCount() const override;
41
42 // GetFiles will return only one file with all the blocks of the filesystem
43 // with the name passed during construction.
44 bool GetFiles(std::vector<File>* files) const override;
45
Alex Vakulenko3f39d5c2015-10-13 09:27:13 -070046 bool LoadSettings(brillo::KeyValueStore* store) const override {
Alex Deymo2e9533b2015-06-26 20:57:06 -070047 return false;
48 }
49
Alex Deymo2b19cfb2015-03-26 00:35:07 -070050 private:
51 RawFilesystem() = default;
52
53 std::string filename_;
54 uint64_t block_count_;
55 uint64_t block_size_;
56
57 DISALLOW_COPY_AND_ASSIGN(RawFilesystem);
58};
59
60} // namespace chromeos_update_engine
61
62#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_RAW_FILESYSTEM_H_