From e6119065337a8341955a38239d16267dc75c46c4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 3 Jan 2025 01:24:50 +0100 Subject: Fix failure to unmount drives when one of their partitions is mounted (#2927). --- src/lib/cross.h | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/lib/cross.h') diff --git a/src/lib/cross.h b/src/lib/cross.h index 551895754..bb1cc91db 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -93,9 +93,19 @@ private: #endif }; + class Drive { public: +#ifdef DCPOMATIC_OSX + Drive(std::string device, bool mounted, uint64_t size, boost::optional vendor, boost::optional model) + : _device(device) + , _mounted(mounted) + , _size(size) + , _vendor(vendor) + , _model(model) + {} +#else Drive (std::string device, std::vector mount_points, uint64_t size, boost::optional vendor, boost::optional model) : _device(device) , _mount_points(mount_points) @@ -103,6 +113,7 @@ public: , _vendor(vendor) , _model(model) {} +#endif explicit Drive (std::string); @@ -115,7 +126,11 @@ public: } bool mounted () const { +#ifdef DCPOMATIC_OSX + return _mounted; +#else return !_mount_points.empty(); +#endif } std::string log_summary () const; @@ -125,23 +140,28 @@ public: */ bool unmount (); +#ifdef DCPOMATIC_OSX + void set_mounted() { + _mounted = true; + } +#endif + static std::vector get (); private: std::string _device; - /** Descriptions of how this drive is mounted. This is interpreted differently - * on different platforms. - * - * On macOS it's a list of device nodes e.g. /dev/disk8, /dev/disk8s2, /dev/disk7s5 or - * filesystem mount points (the contents are not important, just if any exist). - */ +#ifdef DCPOMATIC_OSX + bool _mounted; +#else std::vector _mount_points; +#endif /** size in bytes */ uint64_t _size; boost::optional _vendor; boost::optional _model; }; + void disk_write_finished (); -- cgit v1.2.3