Sorry, this is a bit of a mess yet and needs more refactoring...
* I've implemented my own copy engine which runs a separate writer thread. Especially when installing from one hard drive to another, it should speed things up. When installing from CD, the entire harddisk write time should at least disappear in the CD read time. When installing from/to the same drive, the new routine is as fast as the Tracker code that was used before. * When stopping/canceling the copy process, the copy engine will now actually block, instead of happily going on while the alert is showing. I've still implemented that to not leave incomplete files around, like before. * There is now a progress bar, based on data bytes in files to copy. Reason being that it's quite fast to collect this info versus also scanning all attributes. * The copy engine itself was used in another project before and was tested with SHA256 hashes of the original files and the copied files, so I think it can be trusted. * There is now a lot of code that can be removed or should be cleaned up. What was the "CopyEngine" should become the "WorkerThread" or something. * I still had a mental TODO about skipping the swap file (there is none on CDs, but when copying a harddisk installation there may be one), I just remembered this when typing this commit message... will fix that next. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30394 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,19 +4,27 @@
|
||||
*/
|
||||
|
||||
#include "CopyEngine.h"
|
||||
#include "InstallerWindow.h"
|
||||
#include "PartitionMenuItem.h"
|
||||
#include "FSUndoRedo.h"
|
||||
#include "FSUtils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <DiskDeviceVisitor.h>
|
||||
#include <DiskDeviceTypes.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Message.h>
|
||||
#include <Messenger.h>
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
#include <VolumeRoster.h>
|
||||
|
||||
#include "CopyEngine2.h"
|
||||
#include "InstallerWindow.h"
|
||||
#include "FSUndoRedo.h"
|
||||
#include "FSUtils.h"
|
||||
#include "PackageViews.h"
|
||||
#include "PartitionMenuItem.h"
|
||||
|
||||
|
||||
//#define COPY_TRACE
|
||||
#ifdef COPY_TRACE
|
||||
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
|
||||
@@ -130,6 +138,7 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
||||
status_t err = B_OK;
|
||||
int32 entries = 0;
|
||||
entry_ref testRef;
|
||||
bigtime_t now;
|
||||
|
||||
fControl->Reset();
|
||||
|
||||
@@ -276,8 +285,21 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
||||
// copy source volume
|
||||
targetDir.Rewind();
|
||||
srcDir.SetTo(srcDirectory.Path());
|
||||
now = system_time();
|
||||
#if 0
|
||||
err = CopyFolder(srcDir, targetDir);
|
||||
|
||||
#else
|
||||
{
|
||||
BMessenger messenger(fWindow);
|
||||
CopyEngine2 engine(messenger, new BMessage(STATUS_MESSAGE));
|
||||
err = engine.CopyFolder(srcDirectory.Path(), targetDirectory.Path(),
|
||||
fCancelLock);
|
||||
if (err != B_OK)
|
||||
printf("error: %s\n", strerror(err));
|
||||
}
|
||||
#endif
|
||||
printf("copy time: %.3fs\n", (system_time() - now) / 1000000.0);
|
||||
|
||||
if (err != B_OK || fControl->CheckUserCanceled())
|
||||
goto error;
|
||||
|
||||
@@ -347,6 +369,7 @@ CopyEngine::CopyFolder(BDirectory &srcDir, BDirectory &targetDir)
|
||||
void
|
||||
CopyEngine::ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu)
|
||||
{
|
||||
// NOTE: This is actually executed in the window thread.
|
||||
BDiskDevice device;
|
||||
BPartition *partition = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user