1 // 2 // Copyright (C) 2023 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 #pragma once 17 18 #include <string> 19 #include <unordered_set> 20 #include <utility> 21 #include <vector> 22 23 #include <fruit/fruit.h> 24 25 #include "common/libs/utils/files.h" 26 #include "common/libs/utils/result.h" 27 #include "host/commands/run_cvd/launch/log_tee_creator.h" 28 #include "host/libs/config/command_source.h" 29 #include "host/libs/config/cuttlefish_config.h" 30 #include "host/libs/vm_manager/vm_manager.h" 31 32 namespace cuttlefish { 33 34 class VhostDeviceVsock : public vm_manager::VmmDependencyCommand { 35 public: 36 INJECT(VhostDeviceVsock(LogTeeCreator& log_tee, 37 const CuttlefishConfig::InstanceSpecific& instance, 38 const CuttlefishConfig& cfconfig)); 39 40 // CommandSource 41 Result<std::vector<MonitorCommand>> Commands() override; 42 43 // SetupFeature 44 std::string Name() const override; 45 bool Enabled() const override; 46 47 Result<void> WaitForAvailability() const override; 48 49 private: Dependencies()50 std::unordered_set<SetupFeature*> Dependencies() const override { return {}; } ResultSetup()51 Result<void> ResultSetup() override { return {}; } 52 53 LogTeeCreator& log_tee_; 54 const CuttlefishConfig::InstanceSpecific& instance_; 55 const CuttlefishConfig& cfconfig_; 56 }; 57 58 } // namespace cuttlefish 59