1 // Copyright 2018 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 LIBBRILLO_BRILLO_BLKDEV_UTILS_LOOP_DEVICE_FAKE_H_ 6 #define LIBBRILLO_BRILLO_BLKDEV_UTILS_LOOP_DEVICE_FAKE_H_ 7 8 #include <memory> 9 #include <vector> 10 11 #include <brillo/blkdev_utils/loop_device.h> 12 13 namespace brillo { 14 namespace fake { 15 16 struct LoopDev { 17 bool valid; 18 base::FilePath backing_file; 19 struct loop_info64 info; 20 }; 21 22 class BRILLO_EXPORT FakeLoopDeviceManager : public brillo::LoopDeviceManager { 23 public: 24 FakeLoopDeviceManager(); 25 ~FakeLoopDeviceManager() override = default; 26 std::unique_ptr<LoopDevice> AttachDeviceToFile( 27 const base::FilePath& backing_file) override; 28 29 private: 30 std::vector<std::unique_ptr<LoopDevice>> SearchLoopDevicePaths( 31 int device_number = -1) override; 32 }; 33 34 } // namespace fake 35 } // namespace brillo 36 37 #endif // LIBBRILLO_BRILLO_BLKDEV_UTILS_LOOP_DEVICE_FAKE_H_ 38