File indexing completed on 2024-04-28 05:45:54

0001 /*
0002     SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2016 Andrius Štikonas <andrius@stikonas.eu>
0004 
0005     SPDX-License-Identifier: GPL-3.0-or-later
0006 */
0007 
0008 #ifndef KPMCORE_RESIZEFILESYSTEMJOB_H
0009 #define KPMCORE_RESIZEFILESYSTEMJOB_H
0010 
0011 #include "jobs/job.h"
0012 
0013 class Partition;
0014 class Device;
0015 class Report;
0016 
0017 class QString;
0018 
0019 /** Resize a FileSystem.
0020 
0021     Resizes a FileSystem on a given Device and Partition to a new length. If the new length is -1, the
0022     FileSystem is maximized to fill the entire Partition.
0023 
0024     @author Volker Lanz <vl@fidra.de>
0025 */
0026 class ResizeFileSystemJob : public Job
0027 {
0028 public:
0029     ResizeFileSystemJob(Device& d, Partition& p, qint64 newlength = -1);
0030 
0031 public:
0032     bool run(Report& parent) override;
0033     qint32 numSteps() const override;
0034     QString description() const override;
0035 
0036 protected:
0037     bool resizeFileSystemBackend(Report& report);
0038 
0039     Partition& partition() {
0040         return m_Partition;
0041     }
0042     const Partition& partition() const {
0043         return m_Partition;
0044     }
0045 
0046     Device& device() {
0047         return m_Device;
0048     }
0049     const Device& device() const {
0050         return m_Device;
0051     }
0052 
0053     qint64 newLength() const {
0054         return m_NewLength;
0055     }
0056 
0057     bool isMaximizing() const {
0058         return m_Maximize;
0059     }
0060 
0061 private:
0062     Device& m_Device;
0063     Partition& m_Partition;
0064     bool m_Maximize;
0065     qint64 m_NewLength;
0066 };
0067 
0068 #endif