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