summaryrefslogtreecommitdiff
path: root/src/system.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/system.hpp')
-rw-r--r--src/system.hpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/system.hpp b/src/system.hpp
index cd16802..22f9717 100644
--- a/src/system.hpp
+++ b/src/system.hpp
@@ -476,9 +476,9 @@ class Process : public std::enable_shared_from_this<Process>
const NBDDevice& dev;
};
-struct UsbGadget
+class FsHelper
{
- private:
+ protected:
static bool echoToFile(const fs::path& fname, const std::string& content)
{
std::ofstream fileWriter;
@@ -489,7 +489,11 @@ struct UsbGadget
LogMsg(Logger::Debug, "echo ", content, " > ", fname);
return true;
}
+};
+struct UsbGadget : private FsHelper
+{
+ private:
static const std::string getGadgetDirPrefix()
{
const std::string gadgetDirPrefix =
@@ -627,3 +631,23 @@ struct UsbGadget
return true;
}
};
+
+class UdevGadget : private FsHelper
+{
+ public:
+ // Workaround for HSD18020136609: Can not mount image using Virtual media
+ // and CIFS protocol
+ // This force-triggers udev change events for nbd[0-3] devices, which
+ // prevents from disconnection on first mount event after reboot. The actual
+ // rootcause is related with kernel changes that occured between 5.10.67 and
+ // 5.14.11. This lead will continue to be investigated in order to provide
+ // proper fix.
+ static void forceUdevChange()
+ {
+ std::string changeStr = "change";
+ echoToFile("/sys/block/nbd0/uevent", changeStr);
+ echoToFile("/sys/block/nbd1/uevent", changeStr);
+ echoToFile("/sys/block/nbd2/uevent", changeStr);
+ echoToFile("/sys/block/nbd3/uevent", changeStr);
+ }
+};