xref: /haiku/src/kits/storage/disk_device/jobs/RepairJob.cpp (revision 300868ce276e35845db32cb8344e662de0872af9)
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
14 RepairJob::RepairJob(PartitionReference* partition, bool checkOnly)
15 	: DiskDeviceJob(partition),
16 	  fCheckOnly(checkOnly)
17 {
18 }
19 
20 
21 // destructor
22 RepairJob::~RepairJob()
23 {
24 }
25 
26 
27 // Do
28 status_t
29 RepairJob::Do()
30 {
31 	int32 changeCounter = fPartition->ChangeCounter();
32 	status_t error = _kern_repair_partition(fPartition->PartitionID(),
33 		&changeCounter, fCheckOnly);
34 	if (error != B_OK)
35 		return error;
36 
37 	fPartition->SetChangeCounter(changeCounter);
38 
39 	return B_OK;
40 }
41 
42