raw_filesystem.h 1.9 KB

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