return -1;
// root
- r = hw_umount(prefix, NULL);
+ if(dest->filesystem == HW_FS_BTRFS) {
+ r = hw_umount_btrfs_layout();
+ } else {
+ r = hw_umount(prefix, NULL);
+ }
+
if (r)
return -1;
return 0;
}
+int hw_umount_btrfs_layout() {
+ char path[STRING_SIZE];
+ int r;
+
+ // Reverse loop through the array of known subvolumes.
+ for ( int i = LEN(btrfs_subvolumes); i >= 0; i-- ) {
+ snprintf(path, sizeof(path), "%s%s", DESTINATION_MOUNT_PATH, btrfs_subvolumes[i][1]);
+
+ // umount the subvolume.
+ r = hw_umount(path, NULL);
+
+ if (r)
+ return r;
+ }
+
+ return 0;
+}
+
int hw_destroy_raid_superblocks(const struct hw_destination* dest, const char* output) {
char cmd[STRING_SIZE];