125ab0d1aSIngo Weinhold /* 225ab0d1aSIngo Weinhold * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de. 325ab0d1aSIngo Weinhold * Distributed under the terms of the MIT License. 425ab0d1aSIngo Weinhold */ 525ab0d1aSIngo Weinhold 625ab0d1aSIngo Weinhold #include "UninitializeJob.h" 725ab0d1aSIngo Weinhold 8300868ceSIngo Weinhold #include <syscalls.h> 9300868ceSIngo Weinhold 1025ab0d1aSIngo Weinhold #include "PartitionReference.h" 1125ab0d1aSIngo Weinhold 1225ab0d1aSIngo Weinhold 1325ab0d1aSIngo Weinhold // constructor UninitializeJob(PartitionReference * partition,PartitionReference * parent)14*4419d699SJessica HamiltonUninitializeJob::UninitializeJob(PartitionReference* partition, 15*4419d699SJessica Hamilton PartitionReference* parent) 16*4419d699SJessica Hamilton : DiskDeviceJob(parent, partition) 1725ab0d1aSIngo Weinhold { 1825ab0d1aSIngo Weinhold } 1925ab0d1aSIngo Weinhold 2025ab0d1aSIngo Weinhold 2125ab0d1aSIngo Weinhold // destructor ~UninitializeJob()2225ab0d1aSIngo WeinholdUninitializeJob::~UninitializeJob() 2325ab0d1aSIngo Weinhold { 2425ab0d1aSIngo Weinhold } 2525ab0d1aSIngo Weinhold 2625ab0d1aSIngo Weinhold 2725ab0d1aSIngo Weinhold // Do 2825ab0d1aSIngo Weinhold status_t Do()2925ab0d1aSIngo WeinholdUninitializeJob::Do() 3025ab0d1aSIngo Weinhold { 31*4419d699SJessica Hamilton bool haveParent = fPartition != NULL; 32*4419d699SJessica Hamilton int32 changeCounter = fChild->ChangeCounter(); 33*4419d699SJessica Hamilton int32 parentChangeCounter = haveParent ? fPartition->ChangeCounter() : 0; 34*4419d699SJessica Hamilton partition_id parentID = haveParent ? fPartition->PartitionID() : -1; 35*4419d699SJessica Hamilton 36*4419d699SJessica Hamilton status_t error = _kern_uninitialize_partition(fChild->PartitionID(), 37*4419d699SJessica Hamilton &changeCounter, parentID, &parentChangeCounter); 38300868ceSIngo Weinhold 39300868ceSIngo Weinhold if (error != B_OK) 40300868ceSIngo Weinhold return error; 41300868ceSIngo Weinhold 42*4419d699SJessica Hamilton fChild->SetChangeCounter(changeCounter); 43*4419d699SJessica Hamilton if (haveParent) 44*4419d699SJessica Hamilton fPartition->SetChangeCounter(parentChangeCounter); 45300868ceSIngo Weinhold 46300868ceSIngo Weinhold return B_OK; 4725ab0d1aSIngo Weinhold } 4825ab0d1aSIngo Weinhold 49