diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-03-08 22:25:47 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-03-12 23:28:27 +0100 |
| commit | 7981eefcfebb563ccf5627f132abdfdef22e0c23 (patch) | |
| tree | 62c0302b8b4d65de4343877b8975fd3407a11bad /src/lib/ext.cc | |
| parent | 3de828ef40c7b7c94c050bec4db57e6151787019 (diff) | |
Get progress during formatting.
Diffstat (limited to 'src/lib/ext.cc')
| -rw-r--r-- | src/lib/ext.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/ext.cc b/src/lib/ext.cc index 086afd91e..b88a88726 100644 --- a/src/lib/ext.cc +++ b/src/lib/ext.cc @@ -255,6 +255,16 @@ verify (vector<CopiedFile> const& copied_files, uint64_t total, Nanomsg* nanomsg } +static +void +format_progress (void* context, float progress) +{ + if (context) { + reinterpret_cast<Nanomsg*>(context)->send(String::compose(DISK_WRITER_FORMAT_PROGRESS "\n%1\n", progress), SHORT_TIMEOUT); + } +} + + void #ifdef DCPOMATIC_WINDOWS dcpomatic::write (boost::filesystem::path dcp_path, string device, string, Nanomsg* nanomsg) @@ -329,11 +339,7 @@ try } LOG_DISK_NC ("Opened partition"); - if (nanomsg) { - nanomsg->send(DISK_WRITER_FORMATTING "\n", SHORT_TIMEOUT); - } - - r = ext4_mkfs(&fs, bd, &info, F_SET_EXT2); + r = ext4_mkfs(&fs, bd, &info, F_SET_EXT2, format_progress, nanomsg); if (r != EOK) { throw CopyError ("Failed to make filesystem", r); } |
