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

0001 /*
0002     SPDX-FileCopyrightText: 2017 Pali Rohár <pali.rohar@gmail.com>
0003     SPDX-FileCopyrightText: 2017 Andrius Štikonas <andrius@stikonas.eu>
0004     SPDX-FileCopyrightText: 2020 Arnaud Ferraris <arnaud.ferraris@collabora.com>
0005     SPDX-FileCopyrightText: 2020 Gaël PORTAY <gael.portay@collabora.com>
0006 
0007     SPDX-License-Identifier: GPL-3.0-or-later
0008 */
0009 
0010 #ifndef KPMCORE_UDF_H
0011 #define KPMCORE_UDF_H
0012 
0013 #include "util/libpartitionmanagerexport.h"
0014 
0015 #include "fs/filesystem.h"
0016 
0017 #include <QtGlobal>
0018 
0019 class Report;
0020 
0021 class QString;
0022 
0023 namespace FS
0024 {
0025 /** A udf file system.
0026     @author Pali Rohár <pali.rohar@gmail.com>
0027  */
0028 class LIBKPMCORE_EXPORT udf : public FileSystem
0029 {
0030 public:
0031     udf(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QVariantMap& features = {});
0032 
0033 public:
0034     void init() override;
0035 
0036     qint64 readUsedCapacity(const QString& deviceNode) const override;
0037     bool create(Report& report, const QString& deviceNode) override;
0038     bool createWithLabel(Report& report, const QString& deviceNode, const QString& label) override;
0039     bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override;
0040     bool updateUUID(Report& report, const QString& deviceNode) const override;
0041     QString posixPermissions() const override { return implPosixPermissions();  };
0042     void setPosixPermissions(const QString& permissions) override { implSetPosixPermissions(permissions); };
0043 
0044     CommandSupportType supportGetUsed() const override {
0045         return m_GetUsed;
0046     }
0047     CommandSupportType supportGetLabel() const override {
0048         return cmdSupportCore;
0049     }
0050     CommandSupportType supportCreate() const override {
0051         return m_Create;
0052     }
0053     CommandSupportType supportCreateWithLabel() const override {
0054         return m_Create;
0055     }
0056     CommandSupportType supportMove() const override {
0057         return cmdSupportCore;
0058     }
0059     CommandSupportType supportCopy() const override {
0060         return cmdSupportCore;
0061     }
0062     CommandSupportType supportBackup() const override {
0063         return cmdSupportCore;
0064     }
0065     CommandSupportType supportSetLabel() const override {
0066         return m_SetLabel;
0067     }
0068     CommandSupportType supportUpdateUUID() const override {
0069         return m_UpdateUUID;
0070     }
0071     CommandSupportType supportGetUUID() const override {
0072         return cmdSupportCore;
0073     }
0074 
0075     qint64 minCapacity() const override;
0076     qint64 maxCapacity() const override;
0077     int maxLabelLength() const override;
0078     QValidator* labelValidator(QObject *parent = nullptr) const override;
0079     SupportTool supportToolName() const override;
0080     bool supportToolFound() const override;
0081 
0082 public:
0083     static CommandSupportType m_GetUsed;
0084     static CommandSupportType m_SetLabel;
0085     static CommandSupportType m_UpdateUUID;
0086     static CommandSupportType m_Create;
0087 
0088 private:
0089     static bool oldMkudffsVersion;
0090 };
0091 }
0092 
0093 #endif