summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-01-03 01:23:32 +0100
committerCarl Hetherington <cth@carlh.net>2025-01-07 00:41:32 +0100
commit97254129aa39e8d06b0ff482e2b78c7ce33fa81b (patch)
tree1a8f900f8fec3aa0b65c46c2ab63bb637446b1b6 /src
parent2ef21914513ea6d4d62682cc4ec74b4c3809fc01 (diff)
Store bsd_name in the OSXDisk struct.
Diffstat (limited to 'src')
-rw-r--r--src/lib/cross.h1
-rw-r--r--src/lib/cross_osx.cc7
2 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/cross.h b/src/lib/cross.h
index 78a73b13e..10b0b113f 100644
--- a/src/lib/cross.h
+++ b/src/lib/cross.h
@@ -141,6 +141,7 @@ void disk_write_finished ();
struct OSXDisk
{
+ std::string bsd_name;
std::string device;
boost::optional<std::string> vendor;
boost::optional<std::string> model;
diff --git a/src/lib/cross_osx.cc b/src/lib/cross_osx.cc
index a201cc5f9..ae5ec85c4 100644
--- a/src/lib/cross_osx.cc
+++ b/src/lib/cross_osx.cc
@@ -281,8 +281,9 @@ disk_appeared (DADiskRef disk, void* context)
LOG_DISK("%1 appeared", bsd_name);
OSXDisk this_disk;
+ this_disk.bsd_name = bsd_name;
- this_disk.device = string("/dev/") + bsd_name;
+ this_disk.device = string("/dev/") + this_disk.bsd_name;
LOG_DISK("Device is %1", this_disk.device);
CFDictionaryRef description = DADiskCopyDescription (disk);
@@ -304,11 +305,11 @@ disk_appeared (DADiskRef disk, void* context)
this_disk.system = get_bool(description, kDADiskDescriptionDeviceInternalKey) && !get_bool(description, kDADiskDescriptionMediaRemovableKey);
this_disk.writeable = get_bool(description, kDADiskDescriptionMediaWritableKey);
- this_disk.partition = string(bsd_name).find("s", 5) != std::string::npos;
+ this_disk.partition = string(this_disk.bsd_name).find("s", 5) != std::string::npos;
LOG_DISK(
"%1 %2 %3 %4 mounted at %5",
- bsd_name,
+ this_disk.bsd_name,
this_disk.system ? "system" : "non-system",
this_disk.writeable ? "writeable" : "read-only",
this_disk.partition ? "partition" : "drive",