File indexing completed on 2024-05-05 05:48:43
0001 /* 0002 SPDX-FileCopyrightText: 2008-2011 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2013-2018 Andrius Štikonas <andrius@stikonas.eu> 0004 SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org> 0005 SPDX-FileCopyrightText: 2020 Arnaud Ferraris <arnaud.ferraris@collabora.com> 0006 SPDX-FileCopyrightText: 2020 Gaël PORTAY <gael.portay@collabora.com> 0007 0008 SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 0011 #ifndef KPMCORE_FAT12_H 0012 #define KPMCORE_FAT12_H 0013 0014 #include "util/libpartitionmanagerexport.h" 0015 0016 #include "fs/filesystem.h" 0017 0018 #include <QtGlobal> 0019 0020 class Report; 0021 0022 class QString; 0023 0024 namespace FS 0025 { 0026 /** A fat12 file system. 0027 @author Andrius Štikonas <vl@fidra.de> 0028 */ 0029 class LIBKPMCORE_EXPORT fat12 : public FileSystem 0030 { 0031 public: 0032 fat12(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QVariantMap& features = {}, FileSystem::Type t = FileSystem::Type::Fat12); 0033 0034 public: 0035 void init() override; 0036 0037 qint64 readUsedCapacity(const QString& deviceNode) const override; 0038 bool check(Report& report, const QString& deviceNode) const override; 0039 bool create(Report& report, const QString& deviceNode) override; 0040 bool updateUUID(Report& report, const QString& deviceNode) const override; 0041 bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override; 0042 0043 CommandSupportType supportGetUsed() const override { 0044 return m_GetUsed; 0045 } 0046 CommandSupportType supportGetLabel() const override { 0047 return m_GetLabel; 0048 } 0049 CommandSupportType supportSetLabel() const override { 0050 return m_SetLabel; 0051 } 0052 CommandSupportType supportCreate() const override { 0053 return m_Create; 0054 } 0055 CommandSupportType supportGrow() const override { 0056 return cmdSupportNone; 0057 } 0058 CommandSupportType supportShrink() const override { 0059 return cmdSupportNone; 0060 } 0061 CommandSupportType supportMove() const override { 0062 return m_Move; 0063 } 0064 CommandSupportType supportCheck() const override { 0065 return m_Check; 0066 } 0067 CommandSupportType supportCopy() const override { 0068 return m_Copy; 0069 } 0070 CommandSupportType supportBackup() const override { 0071 return m_Backup; 0072 } 0073 CommandSupportType supportUpdateUUID() const override { 0074 return m_UpdateUUID; 0075 } 0076 CommandSupportType supportGetUUID() const override { 0077 return m_GetUUID; 0078 } 0079 0080 qint64 minCapacity() const override; 0081 qint64 maxCapacity() const override; 0082 int maxLabelLength() const override; 0083 QValidator* labelValidator(QObject *parent) const override; 0084 SupportTool supportToolName() const override; 0085 bool supportToolFound() const override; 0086 0087 protected: 0088 bool createWithFatSize(Report &report, const QString& deviceNode, int fatSize); 0089 0090 public: 0091 static CommandSupportType m_GetUsed; 0092 static CommandSupportType m_GetLabel; 0093 static CommandSupportType m_SetLabel; 0094 static CommandSupportType m_Create; 0095 static CommandSupportType m_Grow; 0096 static CommandSupportType m_Shrink; 0097 static CommandSupportType m_Move; 0098 static CommandSupportType m_Check; 0099 static CommandSupportType m_Copy; 0100 static CommandSupportType m_Backup; 0101 static CommandSupportType m_UpdateUUID; 0102 static CommandSupportType m_GetUUID; 0103 }; 0104 } 0105 0106 #endif