File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,35 +13,22 @@ Module Name:
1313--*/
1414
1515#include " precomp.h"
16- #include " ExecutionContext.h"
1716#include " HcsVirtualMachineBackend.h"
1817#include " WslCoreNetworkEndpointSettings.h"
1918#include " hvsocket.hpp"
2019
2120using wsl::windows::common::Context;
22- using wsl::windows::common::ExecutionContext;
21+ using wsl::windows::common::vm::c_maximumDisks;
22+ using wsl::windows::common::vm::c_mib;
23+ using wsl::windows::common::vm::c_notSupported;
24+ using wsl::windows::common::vm::CreateExecutionContext;
2325
2426namespace validation = wsl::windows::common::vm::validation;
2527
2628namespace {
2729
2830namespace schema = wsl::windows::common::hcs;
2931
30- constexpr UINT64 c_mib = 1024 * 1024 ;
31- constexpr UINT32 c_maximumDisks = 254 ;
32- constexpr HRESULT c_notSupported = HRESULT_FROM_WIN32 (ERROR_NOT_SUPPORTED );
33-
34- std::unique_ptr<ExecutionContext> CreateExecutionContext (Context Context)
35- {
36- const auto * current = ExecutionContext::Current ();
37- if (current != nullptr && current->CurrentContext () >= static_cast <ULONGLONG >(Context))
38- {
39- return {};
40- }
41-
42- return std::make_unique<ExecutionContext>(Context);
43- }
44-
4532template <typename ... Visitors>
4633struct Overloaded : Visitors...
4734{
Original file line number Diff line number Diff line change @@ -33,8 +33,19 @@ Module Name:
3333#include < variant>
3434#include < vector>
3535#include " defs.h"
36+ #include " ExecutionContext.h"
3637#include " stringshared.h"
3738
39+ namespace wsl ::windows::common::vm {
40+
41+ inline constexpr UINT64 c_mib = 1024 * 1024 ;
42+ inline constexpr UINT32 c_maximumDisks = 254 ;
43+ inline constexpr HRESULT c_notSupported = HRESULT_FROM_WIN32 (ERROR_NOT_SUPPORTED );
44+
45+ std::unique_ptr<ExecutionContext> CreateExecutionContext (Context Context);
46+
47+ } // namespace wsl::windows::common::vm
48+
3849enum class BackendKind
3950{
4051 Hcs,
Original file line number Diff line number Diff line change @@ -22,31 +22,21 @@ Module Name:
2222
2323using wsl::windows::common::Context;
2424using wsl::windows::common::ExecutionContext;
25+ using wsl::windows::common::vm::c_maximumDisks;
26+ using wsl::windows::common::vm::c_mib;
27+ using wsl::windows::common::vm::c_notSupported;
28+ using wsl::windows::common::vm::CreateExecutionContext;
2529
2630namespace validation = wsl::windows::common::vm::validation;
2731
2832namespace {
2933
30- constexpr UINT64 c_mib = 1024 * 1024 ;
31- constexpr UINT32 c_maximumDisks = 254 ;
3234constexpr UINT32 c_rpcTimeoutMs = 30000 ;
33- constexpr HRESULT c_notSupported = HRESULT_FROM_WIN32 (ERROR_NOT_SUPPORTED );
3435// Hybrid vsock embeds the AF_VSOCK port in the first field of this AF_HYPERV service ID.
3536constexpr std::wstring_view c_vsockServiceIdSuffix = L" -facb-11e6-bd58-64006a7986d3" ;
3637
3738using validation::ValidateResourceId;
3839
39- std::unique_ptr<ExecutionContext> CreateExecutionContext (Context Context)
40- {
41- const auto * current = ExecutionContext::Current ();
42- if (current != nullptr && current->CurrentContext () >= static_cast <ULONGLONG >(Context))
43- {
44- return {};
45- }
46-
47- return std::make_unique<ExecutionContext>(Context);
48- }
49-
5040void DestroyConfig (WslOpenVmmConfig* Config) noexcept
5141{
5242 WslOpenVmmDestroyConfig (&Config);
Original file line number Diff line number Diff line change @@ -19,12 +19,19 @@ Module Name:
1919#include " IVirtualMachineBackend.h"
2020#include " OpenVmmVirtualMachineBackend.h"
2121
22- namespace {
22+ using wsl::windows::common::Context;
23+ using wsl::windows::common::ExecutionContext;
2324
24- constexpr HRESULT c_notSupported = HRESULT_FROM_WIN32 (ERROR_NOT_SUPPORTED );
25- constexpr UINT32 c_maximumDisks = 254 ;
25+ std::unique_ptr<ExecutionContext> wsl::windows::common::vm::CreateExecutionContext (Context Context)
26+ {
27+ const auto * current = ExecutionContext::Current ();
28+ if (current != nullptr && current->CurrentContext () >= static_cast <ULONGLONG >(Context))
29+ {
30+ return {};
31+ }
2632
27- } // namespace
33+ return std::make_unique<ExecutionContext>(Context);
34+ }
2835
2936wsl::shared::string::MacAddress VmUserModeNatNetwork::ClientMacAddress () const
3037{
You can’t perform that action at this time.
0 commit comments