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 15ResizeJob::ResizeJob(PartitionReference* partition, PartitionReference* child, 16 off_t size, off_t contentSize) 17 : 18 DiskDeviceJob(partition, child), 19 fSize(size), 20 fContentSize(contentSize) 21{ 22} 23 24 25// destructor 26ResizeJob::~ResizeJob() 27{ 28} 29 30 31// Do 32status_t 33ResizeJob::Do() 34{ 35 int32 changeCounter = fPartition->ChangeCounter(); 36 int32 childChangeCounter = fChild->ChangeCounter(); 37 status_t error = _kern_resize_partition(fPartition->PartitionID(), 38 &changeCounter, fChild->PartitionID(), &childChangeCounter, fSize, 39 fContentSize); 40 if (error != B_OK) 41 return error; 42 43 fPartition->SetChangeCounter(changeCounter); 44 fChild->SetChangeCounter(childChangeCounter); 45 46 return B_OK; 47} 48 49