/* Use quite a big block size here, as ext4's fwrite() has quite a bit of overhead */
-static uint64_t const block_size = 4096 * 4096;
+uint64_t constexpr block_size = 4096 * 4096;
static
void
-count (boost::filesystem::path dir, uint64_t& total_bytes)
+count (std::vector<boost::filesystem::path> dirs, uint64_t& total_bytes)
{
- dir = dcp::fix_long_path (dir);
-
using namespace boost::filesystem;
- for (auto i: directory_iterator(dir)) {
- if (is_directory(i)) {
- count (i, total_bytes);
- } else {
- total_bytes += file_size (i);
+
+ for (auto dir: dirs) {
+ dir = dcp::fix_long_path(dir);
+ for (auto path: directory_iterator(dir)) {
+ if (is_directory(path)) {
+ count({path}, total_bytes);
+ } else {
+ total_bytes += file_size(path);
+ }
}
}
}
void
#ifdef DCPOMATIC_WINDOWS
-dcpomatic::write (boost::filesystem::path dcp_path, string device, string, Nanomsg* nanomsg)
+dcpomatic::write (vector<boost::filesystem::path> dcp_paths, string device, string, Nanomsg* nanomsg)
#else
-dcpomatic::write (boost::filesystem::path dcp_path, string device, string posix_partition, Nanomsg* nanomsg)
+dcpomatic::write (vector<boost::filesystem::path> dcp_paths, string device, string posix_partition, Nanomsg* nanomsg)
#endif
try
{
ext4_dmask_set (DEBUG_ALL);
- /* We rely on static initialization for these */
- static struct ext4_fs fs;
- static struct ext4_mkfs_info info;
+ struct ext4_fs fs;
+ fs.read_only = false;
+ fs.bdev = nullptr;
+ fs.last_inode_bg_id = 0;
+ fs.jbd_fs = nullptr;
+ fs.jbd_journal = nullptr;
+ fs.curr_trans = nullptr;
+ struct ext4_mkfs_info info;
+ info.len = 0;
info.block_size = 4096;
+ info.blocks_per_group = 0;
info.inode_size = 128;
+ info.inodes = 0;
+ info.journal_blocks = 0;
+ info.dsc_size = 0;
+ for (int i = 0; i < UUID_SIZE; ++i) {
+ info.uuid[i] = rand() & 0xff;
+ }
info.journal = false;
+ info.label = nullptr;
#ifdef WIN32
file_windows_name_set(device.c_str());
LOG_DISK_NC ("Mounted device");
uint64_t total_bytes = 0;
- count (dcp_path, total_bytes);
+ count (dcp_paths, total_bytes);
uint64_t total_remaining = total_bytes;
vector<CopiedFile> copied_files;
- copy (dcp_path, "/mp", total_remaining, total_bytes, copied_files, nanomsg);
+ for (auto dcp_path: dcp_paths) {
+ copy (dcp_path, "/mp", total_remaining, total_bytes, copied_files, nanomsg);
+ }
/* Unmount and re-mount to make sure the write has finished */
r = ext4_umount("/mp/");