File indexing completed on 2024-05-05 05:48:43

0001 /*
0002     SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2008-2010 Laurent Montel <montel@kde.org>
0004     SPDX-FileCopyrightText: 2012-2018 Andrius Štikonas <andrius@stikonas.eu>
0005     SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk>
0006     SPDX-FileCopyrightText: 2020 Arnaud Ferraris <arnaud.ferraris@collabora.com>
0007     SPDX-FileCopyrightText: 2020 Gaël PORTAY <gael.portay@collabora.com>
0008 
0009     SPDX-License-Identifier: GPL-3.0-or-later
0010 */
0011 
0012 #ifndef KPMCORE_EXT2_H
0013 #define KPMCORE_EXT2_H
0014 
0015 #include "util/libpartitionmanagerexport.h"
0016 
0017 #include "fs/filesystem.h"
0018 
0019 #include <QtGlobal>
0020 
0021 class Report;
0022 
0023 class QString;
0024 
0025 namespace FS
0026 {
0027 /** An ext2 file system.
0028     @author Volker Lanz <vl@fidra.de>
0029 */
0030 class LIBKPMCORE_EXPORT ext2 : public FileSystem
0031 {
0032 public:
0033     ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QVariantMap& features = {}, FileSystem::Type t = FileSystem::Type::Ext2);
0034 
0035 public:
0036     void init() override;
0037 
0038     qint64 readUsedCapacity(const QString& deviceNode) const override;
0039     bool check(Report& report, const QString& deviceNode) const override;
0040     bool create(Report& report, const QString& deviceNode) override;
0041     bool resize(Report& report, const QString& deviceNode, qint64 length) const override;
0042     bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override;
0043     bool writeLabelOnline(Report& report, const QString& deviceNode, const QString& mountPoint, const QString& newLabel) override;
0044     bool updateUUID(Report& report, const QString& deviceNode) const override;
0045 
0046     CommandSupportType supportGetUsed() const override {
0047         return m_GetUsed;
0048     }
0049     CommandSupportType supportGetLabel() const override {
0050         return m_GetLabel;
0051     }
0052     CommandSupportType supportCreate() const override {
0053         return m_Create;
0054     }
0055     CommandSupportType supportCreateWithFeatures() const override {
0056         return m_Create;
0057     }
0058     CommandSupportType supportGrow() const override {
0059         return m_Grow;
0060     }
0061     CommandSupportType supportShrink() const override {
0062         return m_Shrink;
0063     }
0064     CommandSupportType supportMove() const override {
0065         return m_Move;
0066     }
0067     CommandSupportType supportCheck() const override {
0068         return m_Check;
0069     }
0070     CommandSupportType supportCopy() const override {
0071         return m_Copy;
0072     }
0073     CommandSupportType supportBackup() const override {
0074         return m_Backup;
0075     }
0076     CommandSupportType supportSetLabel() const override {
0077         return m_SetLabel;
0078     }
0079     CommandSupportType supportSetLabelOnline() const override {
0080         return m_SetLabel;
0081     }
0082     CommandSupportType supportUpdateUUID() const override {
0083         return m_UpdateUUID;
0084     }
0085     CommandSupportType supportGetUUID() const override {
0086         return m_GetUUID;
0087     }
0088 
0089     qint64 maxCapacity() const override;
0090     int maxLabelLength() const override;
0091     SupportTool supportToolName() const override;
0092     bool supportToolFound() const override;
0093 
0094     QString posixPermissions() const override { return implPosixPermissions();  };
0095     void setPosixPermissions(const QString& permissions) override { implSetPosixPermissions(permissions); };
0096 
0097 public:
0098     static CommandSupportType m_GetUsed;
0099     static CommandSupportType m_GetLabel;
0100     static CommandSupportType m_Create;
0101     static CommandSupportType m_Grow;
0102     static CommandSupportType m_Shrink;
0103     static CommandSupportType m_Move;
0104     static CommandSupportType m_Check;
0105     static CommandSupportType m_Copy;
0106     static CommandSupportType m_Backup;
0107     static CommandSupportType m_SetLabel;
0108     static CommandSupportType m_UpdateUUID;
0109     static CommandSupportType m_GetUUID;
0110 };
0111 }
0112 
0113 #endif