dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
ddevicemanager.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DDEVICEMANAGER_H
6#define DDEVICEMANAGER_H
7
8#include <DtkMountGlobal>
9
10#include <QObject>
11#include <QVariantMap>
12
13#include <DExpected>
14
15DCORE_USE_NAMESPACE
16DMOUNT_BEGIN_NAMESPACE
17
18class DBlockDeviceMonitor;
19class DProtocolDeviceMonitor;
20class DBlockDevice;
21class DBlockPartition;
22class DDiskDrive;
23class DDiskJob;
24class DProtocolDevice;
25
26namespace DDeviceManager {
27DBlockDeviceMonitor *globalBlockDeviceMonitor();
29DExpected<QStringList> blockDevices(const QVariantMap &options = {});
30QStringList protocolDevices();
31QStringList diskDrives();
32
33[[nodiscard]] DExpected<DBlockDevice *> createBlockDevice(const QString &path, QObject *parent = nullptr);
34[[nodiscard]] DExpected<DBlockDevice *> createBlockDeviceByDevicePath(const QByteArray &path, QObject *parent = nullptr);
35[[nodiscard]] DExpected<DBlockPartition *> createBlockPartition(const QString &path, QObject *parent = nullptr);
36[[nodiscard]] DExpected<DBlockPartition *> createBlockPartitionByMountPoint(const QByteArray &path, QObject *parent = nullptr);
37[[nodiscard]] DExpected<DDiskDrive *> createDiskDrive(const QString &path, QObject *parent = nullptr);
38[[nodiscard]] DExpected<DDiskJob *> createDiskJob(const QString &path, QObject *parent = nullptr);
39[[nodiscard]] DExpected<DProtocolDevice *> createProtocolDevice(const QString &path, QObject *parent = nullptr);
40
43DExpected<QStringList> resolveDevice(QVariantMap devspec, QVariantMap options);
44DExpected<QStringList> resolveDeviceNode(QString devnode, QVariantMap options);
45DExpected<bool> canCheck(const QString &type, QString *requiredUtil = nullptr);
46DExpected<bool> canFormat(const QString &type, QString *requiredUtil = nullptr);
47DExpected<bool> canRepair(const QString &type, QString *requiredUtil = nullptr);
48DExpected<bool> canResize(const QString &type, QString *requiredUtil = nullptr);
49DExpected<QString> loopSetup(int fd, QVariantMap options);
50
51// TODO(zhangs): error handle
52
53} // namespace DDeviceManager
54
55DMOUNT_END_NAMESPACE
56
57#endif // DDEVICEMANAGER_H
提供对协议类设备的监听操作
Definition dprotocoldevicemonitor.h:21
DExpected< DBlockPartition * > createBlockPartition(const QString &path, QObject *parent)
用于创建设备分区对象
QStringList supportedEncryptionTypes()
获取当前系统所支持的加密类型列表
DExpected< DBlockPartition * > createBlockPartitionByMountPoint(const QByteArray &path, QObject *parent)
通过挂载点创建分区对象
QStringList protocolDevices()
获取当前系统中的协议设备列表
DBlockDeviceMonitor * globalBlockDeviceMonitor()
获取全局唯一块设备监视器,你可以使用该监视器监听块设备的变化
DExpected< DBlockDevice * > createBlockDevice(const QString &path, QObject *parent)
创建一个块设备对象
DExpected< QString > loopSetup(int fd, QVariantMap options)
创建一个由文件句柄 fd 指代的块设备
QStringList supportedFilesystems()
获取当前系统所支持的文件系统列表
DExpected< DProtocolDevice * > createProtocolDevice(const QString &path, QObject *parent=nullptr)
通过协议设备的 url 字符串,创建协议设备对象
DExpected< QStringList > resolveDevice(QVariantMap devspec, QVariantMap options)
根据所传入的设备描述,解析设备对象路径
DExpected< bool > canResize(const QString &type, QString *requiredUtil=nullptr)
测试一个文件系统能否支持修改大小的操作
DExpected< QStringList > blockDevices(const QVariantMap &options={})
获取当前系统中的块设备列表
DExpected< DBlockDevice * > createBlockDeviceByDevicePath(const QByteArray &path, QObject *parent)
通过设备路径创建块设备对象
QStringList diskDrives()
获取当前系统中所有设备驱动器列表
DExpected< bool > canFormat(const QString &type, QString *requiredUtil=nullptr)
测试能否创建所指类型的文件系统,并返回可供创建的二进制工具
DExpected< bool > canCheck(const QString &type, QString *requiredUtil=nullptr)
获取文件系统是否可执行检查操作
DExpected< DDiskDrive * > createDiskDrive(const QString &path, QObject *parent=nullptr)
通过驱动器路径创建驱动器对象
DProtocolDeviceMonitor * globalProtocolDeviceMonitor()
获取全局唯一协议设备监视器,你可以使用该监视器监听协议设备的变化
DExpected< bool > canRepair(const QString &type, QString *requiredUtil=nullptr)
测试一个文件系统是否支持修复操作
DExpected< QStringList > resolveDeviceNode(QString devnode, QVariantMap options)
根据所传入的设备节点,解析设备对象路径
DExpected< DDiskJob * > createDiskJob(const QString &path, QObject *parent=nullptr)
通过任务路径,创建任务类型对象