summaryrefslogtreecommitdiff
path: root/src/system.hpp
AgeCommit message (Collapse)AuthorFilesLines
2022-05-04Include fstream (#7)jmbills1-0/+1
Missing the fstream include is causing build errors that block the upstream sync, so adding it to fix the build. Tested: Confirmed that it builds. Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2022-02-14Switch the build system to mesonPrzemyslaw Czarnowski1-1/+1
Due to requirements from community, new projects have to be built with meson. To unify with other projects some additional warnings has been enabled, so appropriate code updates has been implemented. This commit makes both meson and CMake available to simplyfy transition in openbmc. CMake support will be removed after switching to meson in openbmc will be accepted. Tested: Compiled and smoke tested. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
2022-02-07Force udev change event on init (#6)Michal Orzel1-2/+26
* Force udev change event on init This change provides temporary workaround for HSD HSD18020136609 ("Can not mount image using Virtual media and CIFS protocol"). When in initial state, additional udev change event is triggered for all NBD devices, which prevents from disconnection on first mount attempt after reboot. The actual issue is a regression, introduced after kernel update from 5.10.67 to 5.14.11. The exact source in kernel is yet to be located; after that an actual fix shall be provided and this change will be reverted. Abstracts echoToFile to a separate class, that may be used by other classes through inheritance. This way, writing to udev files can be handled by different object than UsbGadget. Tested: Successful mounts after reboot for all supported methods (Proxy, Legacy HTTPS, Legacy CIFS). Change-Id: I2ceb826c73b6e46938397060877d35a9fa1c0e03 Signed-off-by: MichalX Orzel <michalx.orzel@intel.com>
2021-10-28Cleanup mounted resources after application crash.Krzysztof Richert1-5/+22
On initial state application cleans mounted resources which were allocated by user befor application crashed. Without that busy slot is not avaialble anymore for user. Tested: 1. Mount CIFS share. 2. Send terminate signal to virtual-media (kill -9). 3. Mount CIFS share on the same slot as during step 1. Change-Id: I7088e94832fb7bec171a56f73bd66cd29e9b246f Signed-off-by: Krzysztof Richert <krzysztof.richert@intel.com>
2021-05-06Change log level to InfoCzarnowski, Przemyslaw1-5/+5
Due to security reasons "user/username" has to be removed from the information that is logged by application. Sensitive data has been moved to "Debug"" level (lowest one) and default one has moved one level up to "Info". Also some important information allowing to catch basic errors has been upgraded to "Info". Tested: Manually, mounting both Legacy mode remote types (HTTPs and CIFS) and checking if journal for VirtualMedia service does not contain sensitive information. Change-Id: Ie6c3a79c94637e3632af76daf957e986b2dd3b6d Signed-off-by: Czarnowski, Przemyslaw <przemyslaw.hawrylewicz.czarnowski@intel.com>
2020-07-17Fixing multiple problems with state machine in virtual mediaKrzysztof Grobelny1-52/+55
- Previously machine did not handle AnyEvent correctly, implementation in BaseState was always run - Changing from ActiveState to ReadyState was bugged, previously only one of event SubprocessStopped or UdevNotification caused state change when it is required to wait for both - Introduced longer timer when waiting for ReadyState during Eject and ActiveState during Inject, because ndbkit can timeout during Eject and it is required to complete before next inject can success. - Added event notification when process is terminated - Added resourcess classes to handle deletion and notifications Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> Change-Id: Ie914e650c2f15bd73cdc87582ea77a94997a3472 Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
2020-06-30Fix stopping usbgadgetKarol Wachowski1-1/+2
Changed recursive removal (std::filesystem::remove_all) of all files in /sys/kernel/config/usb_gadget/ to rmdir operation (std::filesystem::remove). configfs does not allow recursive file removal and returns operation not permitted on such operations. It is required to execute rmmdir. Tested: verified that VirtualMedia drives can be restarted properly (stopped and started again) Change-Id: Ib0c66723b451e29f28c9c90029365385a41dc558 Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
2020-02-06Integration with NBDKit for Legacy modeAgata Olender1-8/+14
This change introduces integration of virtual-media application with NBDKit. NBDKit is used here to connect to externally provided image on web and expose NBD device internally in BMC for NBD subsystem (already implemented in Proxy mode) to use. 'Mount' D-Bus call accepts 's imgUrl' and 'b rw'. Based on 's imgUrl' prefix (https:// or smb://) proper mount type is attempted. 'b rw' determines Read-Only mode for both USB Gadget and NBD stack. When 'Mount' is called, virtual-media parses arguments, determines mounting options and attempts to mount external share. For SMB protocol native CIFS Linux module is used: 1) mount(8) call is used to mound provided CIFS share 2) NBDKit loads file on mounted filesystem and exposes NBD Server on internal unix socket 3) Pre-existing code takes care of mouting gadget automatically (connecting socket to /dev/nbdX and then /dev/nbdX to USB Gadget) For HTTPS protocol provisioning is performed by NBDKit: 1) NBDKit connects to provided resource and exposes NBD Server on internal unix socket 2) Pre-existing code takes care of mouting gadget automatically (connecting socket to /dev/nbdX and then /dev/nbdX to USB Gadget) Tested: Manual and automated tests on WilsonCity platform: - mounting and unmounting images over CIFS and HTTPS (single, multiple at the same time etc) - positive and negative tests for D-Bus calls - ensuring proper information is exposed on D-Bus Change-Id: Ia2b6e8c13603521063f5c94cdfdb06f2e872e9e7 Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com> Signed-off-by: Agata Olender <agata.olender@intel.com>
2020-01-29Gadget inactivity timeoutAgata Olender1-0/+17
MountPoints being inactive for time defined by InactivityTimeout will be unmounted. Inacitivity is measured based on USB gadget R/W statitics. InactivityTimeout must be set in json configuration and is common for all MountPoints. Remaining time to unmount inactive media is exposed per MountPoint on dbus using RemainingInactivityTimeout property. Change-Id: Ieb80e67dae6c3b4cb0482d801b5b4208884b0809 Signed-off-by: Agata Olender <agata.olender@intel.com>
2020-01-17Add Process and DeviceMonitor class with dependenciesCzarnowski, Przemyslaw1-0/+585
Added DeviceMonitor which watches for ndb device changes. Contains: - Udev library wrappers. - NBDevice object to manage nbd devices in errorless manner. - Process library, which manages process spawning. Change-Id: Iaf3caec56cd6084f1c17ccc5657b9b14c8e82d33 Signed-off-by: Rapkiewicz, Pawel <pawel.rapkiewicz@intel.com> Signed-off-by: Czarnowski, Przemyslaw <przemyslaw.hawrylewicz.czarnowski@intel.com>