1 /* 2 * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "ResizeJob.h" 7 8 #include <syscalls.h> 9 10 #include "DiskDeviceUtils.h" 11 #include "PartitionReference.h" 12 13 14 // constructor 15 ResizeJob::ResizeJob(PartitionReference* partition, PartitionReference* child, 16 off_t size, off_t contentSize) 17 : DiskDeviceJob(partition, child), 18 fSize(size), 19 fContentSize(contentSize) 20 { 21 } 22 23 24 // destructor 25 ResizeJob::~ResizeJob() 26 { 27 } 28 29 30 // Do 31 status_t 32 ResizeJob::Do() 33 { 34 int32 changeCounter = fPartition->ChangeCounter(); 35 int32 childChangeCounter = fChild->ChangeCounter(); 36 status_t error = _kern_resize_partition(fPartition->PartitionID(), 37 &changeCounter, fChild->PartitionID(), &childChangeCounter, fSize, 38 fContentSize); 39 if (error != B_OK) 40 return error; 41 42 fPartition->SetChangeCounter(changeCounter); 43 fChild->SetChangeCounter(childChangeCounter); 44 45 return B_OK; 46 } 47 48