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 | #ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_RAW_FILESYSTEM_H_ |
| 6 | #define UPDATE_ENGINE_PAYLOAD_GENERATOR_RAW_FILESYSTEM_H_ |
| 7 | |
| 8 | // A simple filesystem interface implementation used for unknown filesystem |
| 9 | // format such as the kernel. |
| 10 | |
| 11 | #include "update_engine/payload_generator/filesystem_interface.h" |
| 12 | |
| 13 | #include <string> |
| 14 | #include <vector> |
| 15 | |
| 16 | namespace chromeos_update_engine { |
| 17 | |
| 18 | class RawFilesystem : public FilesystemInterface { |
| 19 | public: |
| 20 | static std::unique_ptr<RawFilesystem> Create( |
| 21 | const std::string& filename, uint64_t block_size, uint64_t block_count); |
| 22 | virtual ~RawFilesystem() = default; |
| 23 | |
| 24 | // FilesystemInterface overrides. |
| 25 | size_t GetBlockSize() const override; |
| 26 | size_t GetBlockCount() const override; |
| 27 | |
| 28 | // GetFiles will return only one file with all the blocks of the filesystem |
| 29 | // with the name passed during construction. |
| 30 | bool GetFiles(std::vector<File>* files) const override; |
| 31 | |
| 32 | private: |
| 33 | RawFilesystem() = default; |
| 34 | |
| 35 | std::string filename_; |
| 36 | uint64_t block_count_; |
| 37 | uint64_t block_size_; |
| 38 | |
| 39 | DISALLOW_COPY_AND_ASSIGN(RawFilesystem); |
| 40 | }; |
| 41 | |
| 42 | } // namespace chromeos_update_engine |
| 43 | |
| 44 | #endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_RAW_FILESYSTEM_H_ |