Home | History | Annotate | Download | only in payload_generator
      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 
     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 
     25 #include <string>
     26 #include <vector>
     27 
     28 namespace chromeos_update_engine {
     29 
     30 class RawFilesystem : public FilesystemInterface {
     31  public:
     32   static std::unique_ptr<RawFilesystem> Create(
     33       const std::string& filename, uint64_t block_size, uint64_t block_count);
     34   virtual ~RawFilesystem() = default;
     35 
     36   // FilesystemInterface overrides.
     37   size_t GetBlockSize() const override;
     38   size_t GetBlockCount() const override;
     39 
     40   // GetFiles will return only one file with all the blocks of the filesystem
     41   // with the name passed during construction.
     42   bool GetFiles(std::vector<File>* files) const override;
     43 
     44   bool LoadSettings(brillo::KeyValueStore* store) const override {
     45     return false;
     46   }
     47 
     48  private:
     49   RawFilesystem() = default;
     50 
     51   std::string filename_;
     52   uint64_t block_count_;
     53   uint64_t block_size_;
     54 
     55   DISALLOW_COPY_AND_ASSIGN(RawFilesystem);
     56 };
     57 
     58 }  // namespace chromeos_update_engine
     59 
     60 #endif  // UPDATE_ENGINE_PAYLOAD_GENERATOR_RAW_FILESYSTEM_H_
     61