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