blob: 295d1853736f2a06ada92543638dc3183a18b675 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#pragma once
#include "basic_state.hpp"
struct ActivatingState : public BasicStateT<ActivatingState>
{
static std::string_view stateName()
{
return "ActivatingState";
}
ActivatingState(interfaces::MountPointStateMachine& machine);
std::unique_ptr<BasicState> onEnter() override;
std::unique_ptr<BasicState> handleEvent(UdevStateChangeEvent event);
std::unique_ptr<BasicState> handleEvent(SubprocessStoppedEvent event);
template <class AnyEvent>
[[noreturn]] std::unique_ptr<BasicState> handleEvent(AnyEvent event) {
LogMsg(Logger::Error, "Invalid event: ", event.eventName);
throw sdbusplus::exception::SdBusError(EBUSY, "Resource is busy");
}
private : std::unique_ptr<BasicState> activateProxyMode();
std::unique_ptr<BasicState> activateLegacyMode();
std::unique_ptr<BasicState> mountSmbShare();
std::unique_ptr<BasicState> mountHttpsShare();
static std::unique_ptr<resource::Process>
spawnNbdKit(interfaces::MountPointStateMachine& machine,
std::unique_ptr<utils::VolatileFile>&& secret,
const std::vector<std::string>& params);
static std::unique_ptr<resource::Process>
spawnNbdKit(interfaces::MountPointStateMachine& machine,
const fs::path& file);
static std::unique_ptr<resource::Process>
spawnNbdKit(interfaces::MountPointStateMachine& machine,
const std::string& url);
static bool checkUrl(const std::string& urlScheme,
const std::string& imageUrl);
static bool getImagePathFromUrl(const std::string& urlScheme,
const std::string& imageUrl,
std::string* imagePath);
static bool isHttpsUrl(const std::string& imageUrl);
static bool getImagePathFromHttpsUrl(const std::string& imageUrl,
std::string* imagePath);
static bool isCifsUrl(const std::string& imageUrl);
static bool getImagePathFromCifsUrl(const std::string& imageUrl,
std::string* imagePath);
static fs::path getImagePath(const std::string& imageUrl);
std::unique_ptr<resource::Process> process;
std::unique_ptr<resource::Gadget> gadget;
};
|