2020-09-29 23:55:11 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2020-09-29 23:55:11 +01:00
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2020-09-29 23:55:11 +01:00
|
|
|
#include "jobs/checkfilesystemjob.h"
|
2015-06-04 01:29:22 +01:00
|
|
|
#include "core/partition.h"
|
|
|
|
#include "fs/filesystem.h"
|
|
|
|
#include "util/report.h"
|
|
|
|
|
2017-10-30 15:44:31 +00:00
|
|
|
#include <QDebug>
|
|
|
|
|
2015-06-04 01:29:22 +01:00
|
|
|
#include <KLocalizedString>
|
|
|
|
|
|
|
|
/** Creates a new CheckFileSystemJob
|
2015-07-13 15:16:36 +01:00
|
|
|
@param p the Partition whose FileSystem is to be checked
|
2015-06-04 01:29:22 +01:00
|
|
|
*/
|
|
|
|
CheckFileSystemJob::CheckFileSystemJob(Partition& p) :
|
2015-07-13 15:16:36 +01:00
|
|
|
Job(),
|
|
|
|
m_Partition(p)
|
2015-06-04 01:29:22 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CheckFileSystemJob::run(Report& parent)
|
|
|
|
{
|
2015-07-13 15:16:36 +01:00
|
|
|
Report* report = jobStarted(parent);
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
// if we cannot check, assume everything is fine
|
|
|
|
bool rval = true;
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
if (partition().fileSystem().supportCheck() == FileSystem::cmdSupportFileSystem)
|
|
|
|
rval = partition().fileSystem().check(*report, partition().deviceNode());
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
jobFinished(*report, rval);
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
return rval;
|
2015-06-04 01:29:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString CheckFileSystemJob::description() const
|
|
|
|
{
|
2016-07-17 23:41:00 +01:00
|
|
|
return xi18nc("@info:progress", "Check file system on partition <filename>%1</filename>", partition().deviceNode());
|
2015-06-04 01:29:22 +01:00
|
|
|
}
|