Projects
Eulaceura:Factory
udisks2-qt5
_service:obs_scm:udisks2-qt5-1680576428.4c9f926...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:udisks2-qt5-1680576428.4c9f926.obscpio of Package udisks2-qt5
07070100000000000081A4000000000000000000000001642B8FAC00000334000000000000000000000000000000000000002C00000000udisks2-qt5-1680576428.4c9f926/README.en.md# udisks2-qt5 #### Description udisks2-qt5 #### Software Architecture Software architecture description #### Installation 1. xxxx 2. xxxx 3. xxxx #### Instructions 1. xxxx 2. xxxx 3. xxxx #### Contribution 1. Fork the repository 2. Create Feat_xxx branch 3. Commit your code 4. Create Pull Request #### Gitee Feature 1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md 2. Gitee blog [blog.gitee.com](https://blog.gitee.com) 3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) 4. The most valuable open source project [GVP](https://gitee.com/gvp) 5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) 07070100000001000081A4000000000000000000000001642B8FAC00000396000000000000000000000000000000000000002900000000udisks2-qt5-1680576428.4c9f926/README.md# udisks2-qt5 #### 介绍 udisks2-qt5 #### 软件架构 软件架构说明 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) 07070100000002000081A4000000000000000000000001642B8FAC0000055B000000000000000000000000000000000000003000000000udisks2-qt5-1680576428.4c9f926/udisks2-qt5.spec%bcond_with check %global with_debug 1 %if 0%{?with_debug} %global debug_package %{nil} %endif Name: udisks2-qt5 Version: 5.0.6 Release: 1 Summary: Qt platform theme integration plugins for DDE License: GPLv3+ Source0: %{name}_%{version}.tar.gz BuildRequires: qt5-qtbase-devel %description Qt platform theme integration plugins for DDE Multiple Qt plugins to provide better Qt5 integration for DDE is included. %package devel Summary: %{summary} Requires: %{name} = %{version} %description devel %{summary}. %prep %autosetup %build mkdir build && cd build %{_libdir}/qt5/bin/qmake .. %{__make} %install pushd %{_builddir}/%{name}-%{version}/build %make_install INSTALL_ROOT=%{buildroot} popd mkdir -p %{?buildroot}%{_libdir}/ && mv %{?buildroot}/usr/lib/* %{?buildroot}%{_libdir}/ %files %{_libdir}/libudisks2-qt5.so.0 %{_libdir}/libudisks2-qt5.so.0.0 %{_libdir}/libudisks2-qt5.so.0.0.1 %license LICENSE %files devel %{_includedir}/udisks2-qt5 %{_libdir}/libudisks2-qt5.so %{_libdir}/pkgconfig/udisks2-qt5.pc %license LICENSE %changelog * Wed Mar 29 2023 liweiganga <liweiganga@uniontech.com> - 5.0.6-1 - update: update to 5.0.6 * Mon Aug 17 2020 chenbo pan <panchenbo@uniontech.com> - 5.0.3-2 - fix spec name * Thu Jul 30 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.0.3-1 - Package init 07070100000003000081A4000000000000000000000001642B8FAC00000056000000000000000000000000000000000000003000000000udisks2-qt5-1680576428.4c9f926/udisks2-qt5.yamlversion_control: github src_repo: linuxdeepin/udisks2-qt5 tag_prefix: ^v seperator: . 07070100000004000081A4000000000000000000000001642B8FAC00046000000000000000000000000000000000000000003800000000udisks2-qt5-1680576428.4c9f926/udisks2-qt5_5.0.6.tar.gzudisks2-qt5-5.0.6/0000755000175100017510000000000014051331364013561 5ustar shuttleshuttleudisks2-qt5-5.0.6/.clog.toml0000644000175100017510000000016314051331364015460 0ustar shuttleshuttle[clog] repository = "https://github.com/linuxdeepin/udisks2-qt5" changelog = "CHANGELOG.md" from-latest-tag = true udisks2-qt5-5.0.6/org.freedesktop.UDisks2.ObjectManager.xml0000644000175100017510000000202614051331364023367 0ustar shuttleshuttle<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <!-- GDBus 2.53.4 --> <node> <interface name="org.freedesktop.DBus.ObjectManager"> <method name="GetManagedObjects"> <arg type="a{oa{sa{sv}}}" name="object_paths_interfaces_and_properties" direction="out"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QMap<QDBusObjectPath, QMap<QString, QVariantMap>>"/> </method> <signal name="InterfacesAdded"> <arg type="o" name="object_path"/> <arg type="a{sa{sv}}" name="interfaces_and_properties"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QMap<QString, QVariantMap>"/> </signal> <signal name="InterfacesRemoved"> <arg type="o" name="object_path"/> <arg type="as" name="interfaces"/> </signal> </interface> <node name="Manager"/> <node name="drives"/> <node name="block_devices"/> </node> udisks2-qt5-5.0.6/.gitignore0000644000175100017510000000005114051331364015545 0ustar shuttleshuttle# IDE related *.user # Misc .directory udisks2-qt5-5.0.6/LICENSE0000644000175100017510000001674414051331364014602 0ustar shuttleshuttle GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. udisks2-qt5-5.0.6/dblockpartition.h0000644000175100017510000002236514051331364017132 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBLOCKPARTITION_H #define DBLOCKPARTITION_H #include <dblockdevice.h> class DBlockPartitionPrivate; class DBlockPartition : public DBlockDevice { Q_OBJECT Q_DECLARE_PRIVATE(DBlockPartition) Q_PROPERTY(qulonglong flags READ flags NOTIFY flagsChanged) Q_PROPERTY(bool isContained READ isContained NOTIFY isContainedChanged) Q_PROPERTY(bool isContainer READ isContainer NOTIFY isContainerChanged) Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(uint number READ number NOTIFY numberChanged) Q_PROPERTY(qulonglong offset READ offset NOTIFY offsetChanged) Q_PROPERTY(qulonglong size READ size NOTIFY sizeChanged) Q_PROPERTY(QString table READ table) Q_PROPERTY(QString type READ type NOTIFY typeChanged) // MBR Partition Type Q_PROPERTY(Type eType READ eType NOTIFY eTypeChanged) // GPT Partition Type Q_PROPERTY(GUIDType guidType READ guidType NOTIFY guidTypeChanged) Q_PROPERTY(QString UUID READ UUID NOTIFY UUIDChanged) public: enum Type { Empty = 0x0, FAT12Type = 0x1, XENIX_root = 0x2, XENIX_usr = 0x3, FAT16_Less_32M = 0x4, Extended = 0x5, FAT16Type = 0x6, HPFS_NTFS = 0x7, AIX = 0x8, AIX_bootable = 0x9, OS2_Boot_Manager = 0xa, Win95_FAT32 = 0xb, Win95_FAT32_LBA = 0xc, Win95_FAT16_LBA = 0xe, Win95_Extended_LBA = 0xf, OPUS = 0x10, Hidden_FAT12 = 0x11, Compaq_diagnostics = 0x12, Hidden_FAT16_Less_32M = 0x14, Hidden_FAT16 = 0x16, Hidden_HPFS_or_NTFS = 0x17, AST_SmartSleep = 0x18, Hidden_Win95_FAT32 = 0x1b, Hidden_Win95_FAT32_LBA = 0x1c, Hidden_Win95_FAT16_LBA = 0x1e, NEC_DOS = 0x24, Plan9 = 0x39, PartitionMagic_recovery = 0x3c, Venix_80286 = 0x40, PPC_PReP_Boot = 0x41, SFS = 0x42, QNX4_dot_x = 0x4d, QNX4_dot_x_2nd_part = 0x4e, QNX4_dot_x_3rd_part = 0x4f, OnTrack_DM = 0x50, OnTrack_DM6_Aux1 = 0x51, CP_M = 0x52, OnTrack_DM6_Aux3 = 0x53, OnTrackDM6 = 0x54, EZ_Drive = 0x55, Golden_Bow = 0x56, Priam_Edisk = 0x5c, SpeedStor = 0x61, GNU_HURD_or_SysV = 0x63, Novell_Netware_286 = 0x64, Novell_Netware_386 = 0x65, DiskSecure_Multi_Boot = 0x70, PC_IX = 0x75, Old_Minix = 0x80, Minix_old_Linux = 0x81, Linux_swap = 0x82, Linux = 0x83, OS2_hidden_C_drive = 0x84, Linux_extended = 0x85, NTFS_volume_set_1 = 0x86, NTFS_volume_set_2 = 0x87, Linux_LVM = 0x8e, Amoeba = 0x93, Amoeba_BBT = 0x94, BSD_OS = 0x9f, IBM_Thinkpad_hibernation = 0xa0, FreeBSD = 0xa5, OpenBSD = 0xa6, NeXTSTEP = 0xa7, NetBSD = 0xa8, BSDI_fs = 0xa9, BSDI_swap = 0xb7, Boot_Wizard_hidden = 0xb8, DRDOS_sec_FAT12 = 0xbb, DRDOS_sec_FAT16_Less_32M = 0xc1, DRDOS_sec_FAT16 = 0xc4, DRDOS_sec_extend = 0xc5, Syrinx = 0xc6, Non_FS_data = 0xc7, Multiuser_DOS_extend = 0xd5, CP_M_CTOS_dot_dot_dot = 0xda, Dell_Utility = 0xdb, BootIt = 0xde, DOS_access = 0xdf, DOS_R_O = 0xe1, SpeedStor_1 = 0xe3, BeOS_fs = 0xe4, EFI_GPT = 0xeb, EFI_FAT12_16_32 = 0xee, Linux_PA_RISC_boot = 0xef, SpeedStor_2 = 0xf0, SeppdStor_3 = 0xf4, DOS_secondary = 0xf2, Linux_raid_autodetect = 0xfd, LANstep = 0xfe, BBT = 0xff, Unknow }; Q_ENUM(Type) enum GUIDType { InvalidUUID = 0, GUIDTypeBegin = 1, // None Unused_None = GUIDTypeBegin, MBR_PS_None = 2, EFI_SP_None = 3, BIOS_BP_None = 4, iFFS_None = 5, Sony_BP_None = 6, Lenove_BP_None = 7, // Windows MSR_Win = 8, BasicData_Win = 9, LDM_Win = 10, LDM_DP_Win = 11, WRE_Win = 12, IBM_GPFS_Win = 13, SSP_Win = 14, // HP-UX DP_HPUX = 15, SP_HPUX = 16, // Linux LFD_Linux = 17, RAID_P_Linux = 18, RP_x86_Linux = 19, RP_x86_64_Linux = 20, RP_32bit_ARM_Linux = 21, RP_64bit_ARM_Linux = 22, SP_Linux = 23, LVM_P_Linux = 24, Home_P_Linux = 25, Srv_P_Linux = 26, Plain_DC_P_Linux = 27, LUKS_P_Linux = 28, Reserved_Linux = 29, // FreeBSD BP_FreeBSD = 30, DP_FreeBSD = 31, SP_FreeBSD = 32, UFS_P_FreeBSD = 33, VVM_P_FreeBSD = 34, ZFS_P_FreeBSD = 35, // macOS Darwin HFS_PLUS_P_Mac = 36, UFS_Mac = 37, ZFS_Mac = 38, RAID_P_Mac = 39, RAID_P_Offline_Mac = 40, BP_Mac = 41, Label_Mac = 42, TV_RP_Mac = 43, CS_P_Mac = 44, SoftRAID_Status_Mac = 45, SoftRAID_Scratch_Mac = 46, SoftRAID_Volume_Mac = 47, SoftRAID_Cache_Mac = 48, // Solaris illumos BP_Solaris = 49, RP_Solaris = 50, SP_Solaris = 51, Backup_P_Solaris = 52, Usr_P_Solaris = ZFS_Mac, Var_P_Solaris = 53, Home_P_Solaris = 54, AS_Solaris = 55, Reserved_Solaris = 56, // NetBSD SP_NetBSD = 57, FFS_P_NetBSD = 58, LFS_P_NetBSD = 59, RAID_P_NetBSD = 60, CP_NetBSD = 61, EP_NetBSD = 62, // ChromeOS Kernel_ChromeOS = 63, Rootfs_ChromeOS = 64, FU_ChromeOS = 65, // Haiku BFS_Haiku = 66, // MidnightBSD BP_MidnightBSD = 67, DP_MidnightBSD = 68, SP_MidnightBSD = 69, UFS_P_MidnightBSD = 70, VVM_P_MidnightBSD = 71, ZFS_P_MidnightBSD = 72, // Ceph Journal_Ceph = 73, DC_EJ_Ceph = 74, OSD_Ceph = 75, DC_OSD_Ceph = 76, DIC_Ceph = 77, DC_DIC_Ceph = 78, // OpenBSD DP_OpenBSD = 79, // QNX PAFS_QNX = 80, // Plan9 Partition_Plan9 = 81, // VMware ESX Vmkcore_VMware = 82, VMFS_VMware = 83, Reserved_VMware = 84, // Android-IA Bootloader_Android = 85, Bottloader2_Android = 86, Boot_Android = 87, Recovery_Android = 88, Misc_Android = 89, Metadata_Android = 90, System_Android = 91, Cache_Android = 92, Data_Android = 93, Persistent_Android = 94, Factory_Android = 95, Fastboot_Android = 96, OEM_Android = 97, // Open Network Install Environment (ONIE) Boot_ONIE = 98, Config_ONIE = 99, // PowerPC Boot_PowerPC = 100, // freedesktop.org OSes (Linux, etc.) SBLC_OSes = 101, // Atari TOS BD_P_Atari = 102, GUIDTypeEnd, UnknowUUID }; Q_ENUM(GUIDType) qulonglong flags() const; bool isContained() const; bool isContainer() const; QString name() const; uint number() const; qulonglong offset() const; qulonglong size() const; QString table() const; QString type() const; Type eType() const; GUIDType guidType() const; QString UUID() const; static QString typeDescription(Type type); static QString guidTypeDescription(GUIDType type); public Q_SLOTS: // METHODS void deletePartition(const QVariantMap &options); void resize(qulonglong size, const QVariantMap &options); void setFlags(qulonglong flags, const QVariantMap &options); void setName(const QString &name, const QVariantMap &options); void setType(const QString &type, const QVariantMap &options); void setType(Type type, const QVariantMap &options); Q_SIGNALS: void flagsChanged(qulonglong flags); void isContainedChanged(bool isContained); void isContainerChanged(bool isContainer); void nameChanged(const QString &name); void numberChanged(uint number); void offsetChanged(qulonglong offset); void sizeChanged(qulonglong size); void typeChanged(const QString &type); void eTypeChanged(); void UUIDChanged(const QString &UUID); void guidTypeChanged(); private: explicit DBlockPartition(const QString &path, QObject *parent = nullptr); friend class DDiskManager; }; #endif // DBLOCKPARTITION_H udisks2-qt5-5.0.6/dblockdevice.cpp0000644000175100017510000004302614051331364016710 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "dblockdevice.h" #include "private/dblockdevice_p.h" #include "udisks2_interface.h" #include "objectmanager_interface.h" DBlockDevicePrivate::DBlockDevicePrivate(DBlockDevice *qq) : q_ptr(qq) { } void DBlockDevice::onInterfacesAdded(const QDBusObjectPath &object_path, const QMap<QString, QVariantMap> &interfaces_and_properties) { Q_D(DBlockDevice); const QString &path = object_path.path(); if (path != d->dbus->path()) return; if (interfaces_and_properties.contains(QStringLiteral(UDISKS2_SERVICE ".Filesystem"))) { Q_EMIT hasFileSystemChanged(true); } if (interfaces_and_properties.contains(QStringLiteral(UDISKS2_SERVICE ".Partition"))) { Q_EMIT hasPartitionChanged(true); } if (interfaces_and_properties.contains(QStringLiteral(UDISKS2_SERVICE ".Encrypted"))) { Q_EMIT isEncryptedChanged(true); } } void DBlockDevice::onInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces) { Q_D(DBlockDevice); const QString &path = object_path.path(); if (path != d->dbus->path()) return; for (const QString &i : interfaces) { if (i == QStringLiteral(UDISKS2_SERVICE ".Filesystem")) { Q_EMIT hasFileSystemChanged(false); } else if (i == QStringLiteral(UDISKS2_SERVICE ".Partition")) { Q_EMIT hasPartitionChanged(false); } else if (i == QStringLiteral(UDISKS2_SERVICE ".Encrypted")) { Q_EMIT isEncryptedChanged(false); } } } void DBlockDevice::onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties) { if (interface.endsWith(".PartitionTable")) { auto begin = changed_properties.begin(); while (begin != changed_properties.constEnd()) { if (begin.key() == "Type") { Q_EMIT ptTypeChanged(); break; } ++begin; } } else { auto begin = changed_properties.begin(); for (; begin != changed_properties.constEnd(); ++begin) { QString property_name = begin.key(); int pindex = this->metaObject()->indexOfProperty(property_name.toLatin1().constData()); if (pindex < 0) { property_name[0] = property_name.at(0).toLower(); pindex = this->metaObject()->indexOfProperty(property_name.toLatin1().constData()); } if (pindex < 0) continue; const QMetaProperty &mp = this->metaObject()->property(pindex); if (!mp.hasNotifySignal()) continue; mp.notifySignal().invoke(this, QGenericArgument(begin.value().typeName(), begin.value().constData())); } } } DBlockDevice::~DBlockDevice() { } bool DBlockDevice::isValid() const { Q_D(const DBlockDevice); return d->dbus->isValid(); } bool DBlockDevice::watchChanges() const { Q_D(const DBlockDevice); return d->watchChanges; } /*! * \brief Get the block device (patition) DBus path. * * \return the DBus path */ QString DBlockDevice::path() const { Q_D(const DBlockDevice); return d->dbus->path(); } QList<QPair<QString, QVariantMap> > DBlockDevice::configuration() const { Q_D(const DBlockDevice); return d->dbus->configuration(); } QString DBlockDevice::cryptoBackingDevice() const { Q_D(const DBlockDevice); return d->dbus->cryptoBackingDevice().path(); } /*! * \brief Get the device path, like `/dev/sda1` * * \return Device path in QByteArray. */ QByteArray DBlockDevice::device() const { Q_D(const DBlockDevice); return d->dbus->device(); } qulonglong DBlockDevice::deviceNumber() const { Q_D(const DBlockDevice); return d->dbus->deviceNumber(); } /*! * \brief Get the disk device dbus path * * \return a dbus path in QString */ QString DBlockDevice::drive() const { Q_D(const DBlockDevice); return d->dbus->drive().path(); } bool DBlockDevice::hintAuto() const { Q_D(const DBlockDevice); return d->dbus->hintAuto(); } QString DBlockDevice::hintIconName() const { Q_D(const DBlockDevice); return d->dbus->hintIconName(); } bool DBlockDevice::hintIgnore() const { Q_D(const DBlockDevice); return d->dbus->hintIgnore(); } QString DBlockDevice::hintName() const { Q_D(const DBlockDevice); return d->dbus->hintName(); } bool DBlockDevice::hintPartitionable() const { Q_D(const DBlockDevice); return d->dbus->hintPartitionable(); } QString DBlockDevice::hintSymbolicIconName() const { Q_D(const DBlockDevice); return d->dbus->hintSymbolicIconName(); } bool DBlockDevice::hintSystem() const { Q_D(const DBlockDevice); return d->dbus->hintSystem(); } QString DBlockDevice::id() const { Q_D(const DBlockDevice); return d->dbus->id(); } QString DBlockDevice::idLabel() const { Q_D(const DBlockDevice); return d->dbus->idLabel(); } QString DBlockDevice::idType() const { Q_D(const DBlockDevice); return d->dbus->idType(); } DBlockDevice::FSType DBlockDevice::fsType() const { const QString &fs_type = idType(); if (fs_type.isEmpty()) return InvalidFS; if (fs_type == "hfs+") return hfs_plus; bool ok = false; const QMetaEnum me = QMetaEnum::fromType<FSType>(); int value = me.keyToValue(fs_type.toLatin1().constData(), &ok); if (!ok) { return UnknowFS; } return static_cast<FSType>(value); } QString DBlockDevice::idUUID() const { Q_D(const DBlockDevice); return d->dbus->idUUID(); } QString DBlockDevice::idUsage() const { Q_D(const DBlockDevice); return d->dbus->idUsage(); } QString DBlockDevice::idVersion() const { Q_D(const DBlockDevice); return d->dbus->idVersion(); } QString DBlockDevice::mDRaid() const { Q_D(const DBlockDevice); return d->dbus->mDRaid().path(); } QString DBlockDevice::mDRaidMember() const { Q_D(const DBlockDevice); return d->dbus->mDRaidMember().path(); } QByteArray DBlockDevice::preferredDevice() const { Q_D(const DBlockDevice); return d->dbus->preferredDevice(); } bool DBlockDevice::readOnly() const { Q_D(const DBlockDevice); return d->dbus->readOnly(); } qulonglong DBlockDevice::size() const { Q_D(const DBlockDevice); return d->dbus->size(); } QByteArrayList DBlockDevice::symlinks() const { Q_D(const DBlockDevice); return d->dbus->symlinks(); } QStringList DBlockDevice::userspaceMountOptions() const { Q_D(const DBlockDevice); return d->dbus->userspaceMountOptions(); } bool DBlockDevice::hasFileSystem() const { Q_D(const DBlockDevice); return hasFileSystem(d->dbus->path()); } bool DBlockDevice::hasPartitionTable() const { Q_D(const DBlockDevice); return hasPartitionTable(d->dbus->path()); } bool DBlockDevice::hasPartition() const { Q_D(const DBlockDevice); return hasPartition(d->dbus->path()); } bool DBlockDevice::isEncrypted() const { Q_D(const DBlockDevice); return isEncrypted(d->dbus->path()); } bool DBlockDevice::isLoopDevice() const { Q_D(const DBlockDevice); return UDisks2::interfaceExists(d->dbus->path(), UDISKS2_SERVICE ".Loop"); } bool DBlockDevice::hasFileSystem(const QString &path) { return UDisks2::interfaceExists(path, UDISKS2_SERVICE ".Filesystem"); } bool DBlockDevice::hasPartitionTable(const QString &path) { return UDisks2::interfaceExists(path, UDISKS2_SERVICE ".PartitionTable"); } bool DBlockDevice::hasPartition(const QString &path) { return UDisks2::interfaceExists(path, UDISKS2_SERVICE ".Partition"); } bool DBlockDevice::isEncrypted(const QString &path) { return UDisks2::interfaceExists(path, UDISKS2_SERVICE ".Encrypted"); } QByteArrayList DBlockDevice::mountPoints() const { if (!hasFileSystem()) return QByteArrayList(); Q_D(const DBlockDevice); OrgFreedesktopUDisks2FilesystemInterface fsif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); return fsif.mountPoints(); } DBlockDevice::PTType DBlockDevice::ptType() const { Q_D(const DBlockDevice); if (!UDisks2::interfaceExists(d->dbus->path(), UDISKS2_SERVICE ".PartitionTable")) { return InvalidPT; } OrgFreedesktopUDisks2PartitionTableInterface ptif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); const QString &type = ptif.type(); if (type.isEmpty()) { return InvalidPT; } if (type == "dos") { return MBR; } if (type == "gpt") { return GPT; } return UnknowPT; } QList<QPair<QString, QVariantMap> > DBlockDevice::childConfiguration() const { Q_D(const DBlockDevice); if (!isEncrypted()) { return QList<QPair<QString, QVariantMap>>(); } OrgFreedesktopUDisks2EncryptedInterface eif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); return eif.childConfiguration(); } QDBusError DBlockDevice::lastError() const { Q_D(const DBlockDevice); return d->err; } void DBlockDevice::setWatchChanges(bool watchChanges) { Q_D(DBlockDevice); if (d->watchChanges == watchChanges) return; d->watchChanges = watchChanges; OrgFreedesktopDBusObjectManagerInterface *object_manager = UDisks2::objectManager(); auto sb = QDBusConnection::systemBus(); if (watchChanges) { connect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesAdded, this, &DBlockDevice::onInterfacesAdded); connect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesRemoved, this, &DBlockDevice::onInterfacesRemoved); sb.connect(UDISKS2_SERVICE, d->dbus->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(onPropertiesChanged(const QString &, const QVariantMap &))); } else { disconnect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesAdded, this, &DBlockDevice::onInterfacesAdded); disconnect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesRemoved, this, &DBlockDevice::onInterfacesRemoved); sb.disconnect(UDISKS2_SERVICE, d->dbus->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(onPropertiesChanged(const QString &, const QVariantMap &))); } } void DBlockDevice::addConfigurationItem(const QPair<QString, QVariantMap> &item, const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->AddConfigurationItem(item, options); r.waitForFinished(); d->err = r.error(); } void DBlockDevice::format(const QString &type, const QVariantMap &options) { Q_D(DBlockDevice); d->dbus->setTimeout(INT_MAX); auto r = d->dbus->Format(type, options); r.waitForFinished(); d->err = r.error(); d->dbus->setTimeout(-1); } void DBlockDevice::format(const DBlockDevice::FSType &type, const QVariantMap &options) { if (type < ext2) return; format(QString::fromLatin1(QMetaEnum::fromType<FSType>().valueToKey(type)), options); } QList<QPair<QString, QVariantMap> > DBlockDevice::getSecretConfiguration(const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->GetSecretConfiguration(options); r.waitForFinished(); d->err = r.error(); return r.value(); } QDBusUnixFileDescriptor DBlockDevice::openDevice(const QString &mode, const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->OpenDevice(mode, options); r.waitForFinished(); d->err = r.error(); return r.value(); } QDBusUnixFileDescriptor DBlockDevice::openForBackup(const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->OpenForBackup(options); r.waitForFinished(); d->err = r.error(); return r.value(); } QDBusUnixFileDescriptor DBlockDevice::openForBenchmark(const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->OpenForBenchmark(options); r.waitForFinished(); d->err = r.error(); return r.value(); } QDBusUnixFileDescriptor DBlockDevice::openForRestore(const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->OpenForRestore(options); r.waitForFinished(); d->err = r.error(); return r.value(); } void DBlockDevice::removeConfigurationItem(const QPair<QString, QVariantMap> &item, const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->RemoveConfigurationItem(item, options); r.waitForFinished(); d->err = r.error(); } void DBlockDevice::rescan(const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->Rescan(options); r.waitForFinished(); d->err = r.error(); } void DBlockDevice::updateConfigurationItem(const QPair<QString, QVariantMap> &old_item, const QPair<QString, QVariantMap> &new_item, const QVariantMap &options) { Q_D(DBlockDevice); auto r = d->dbus->UpdateConfigurationItem(old_item, new_item, options); r.waitForFinished(); d->err = r.error(); } /*! * \brief Mount the block device. * * \param options please refer to \l {http://storaged.org/doc/udisks2-api/latest/gdbus-org.freedesktop.UDisks2.Filesystem.html#gdbus-method-org-freedesktop-UDisks2-Filesystem.Mount} {UDisks2.Filesystem Mount()} * * \return the mount point path. * * \sa unmount() */ QString DBlockDevice::mount(const QVariantMap &options) { if (!hasFileSystem()) { return QString(); } Q_D(DBlockDevice); OrgFreedesktopUDisks2FilesystemInterface fsif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); auto r = fsif.Mount(options); r.waitForFinished(); d->err = r.error(); return r.value(); } void DBlockDevice::unmount(const QVariantMap &options) { if (!hasFileSystem()) { return; } Q_D(DBlockDevice); OrgFreedesktopUDisks2FilesystemInterface fsif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); auto r = fsif.Unmount(options); r.waitForFinished(); d->err = r.error(); } /*! * \brief Check if we can set the filesystem label. * * \return */ bool DBlockDevice::canSetLabel() const { if (!hasFileSystem()) { return false; } // blumia: Since gvfs can't correctly mount a label-renamed patition // we simply disable rename support if we don't unmount the // patition. Will be add back when we switch to udisks2. if (/*fsType() == ntfs && */!mountPoints().isEmpty()) { return false; } return true; } /*! * \brief Sets the filesystem label. * * \param options Options (currently unused except for standard options). */ void DBlockDevice::setLabel(const QString &label, const QVariantMap &options) { if (!hasFileSystem()) { return; } Q_D(DBlockDevice); OrgFreedesktopUDisks2FilesystemInterface fsif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); auto r = fsif.SetLabel(label, options); r.waitForFinished(); d->err = r.error(); } void DBlockDevice::changePassphrase(const QString &passphrase, const QString &new_passphrase, const QVariantMap &options) { if (!isEncrypted()) { return; } Q_D(DBlockDevice); OrgFreedesktopUDisks2EncryptedInterface eif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); auto r = eif.ChangePassphrase(passphrase, new_passphrase, options); r.waitForFinished(); d->err = r.error(); } void DBlockDevice::lock(const QVariantMap &options) { if (!isEncrypted()) { return; } Q_D(DBlockDevice); OrgFreedesktopUDisks2EncryptedInterface eif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); QDBusPendingReply<void> r = eif.Lock(options); r.waitForFinished(); d->err = r.error(); } QString DBlockDevice::unlock(const QString &passphrase, const QVariantMap &options) { if (!isEncrypted()) { return QString(); } Q_D(DBlockDevice); OrgFreedesktopUDisks2EncryptedInterface eif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); auto r = eif.Unlock(passphrase, options); r.waitForFinished(); d->err = r.error(); return r.value().path(); } QString DBlockDevice::cleartextDevice() { if (!isEncrypted()) { return QString(); } Q_D(const DBlockDevice); OrgFreedesktopUDisks2EncryptedInterface eif(UDISKS2_SERVICE, d->dbus->path(), QDBusConnection::systemBus()); return eif.cleartextDevice().path(); } DBlockDevice::DBlockDevice(const QString &path, QObject *parent) : DBlockDevice(*new DBlockDevicePrivate(this), path, parent) { } DBlockDevice::DBlockDevice(DBlockDevicePrivate &dd, const QString &path, QObject *parent) : QObject(parent) , d_ptr(&dd) { dd.dbus = new OrgFreedesktopUDisks2BlockInterface(UDISKS2_SERVICE, path, QDBusConnection::systemBus(), this); connect(this, &DBlockDevice::idTypeChanged, this, &DBlockDevice::fsTypeChanged); } udisks2-qt5-5.0.6/dblockpartition.cpp0000644000175100017510000005616514051331364017472 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "dblockpartition.h" #include "private/dblockdevice_p.h" #include "udisks2_interface.h" class DBlockPartitionPrivate : public DBlockDevicePrivate { public: DBlockPartitionPrivate(DBlockPartition *qq); OrgFreedesktopUDisks2PartitionInterface *dbus; }; DBlockPartitionPrivate::DBlockPartitionPrivate(DBlockPartition *qq) : DBlockDevicePrivate(qq) { } qulonglong DBlockPartition::flags() const { Q_D(const DBlockPartition); return d->dbus->flags(); } bool DBlockPartition::isContained() const { Q_D(const DBlockPartition); return d->dbus->isContained(); } bool DBlockPartition::isContainer() const { Q_D(const DBlockPartition); return d->dbus->isContainer(); } QString DBlockPartition::name() const { Q_D(const DBlockPartition); return d->dbus->name(); } uint DBlockPartition::number() const { Q_D(const DBlockPartition); return d->dbus->number(); } qulonglong DBlockPartition::offset() const { Q_D(const DBlockPartition); return d->dbus->offset(); } qulonglong DBlockPartition::size() const { Q_D(const DBlockPartition); return d->dbus->size(); } QString DBlockPartition::table() const { Q_D(const DBlockPartition); return d->dbus->table().path(); } QString DBlockPartition::type() const { Q_D(const DBlockPartition); return d->dbus->type(); } DBlockPartition::Type DBlockPartition::eType() const { const QString &type = this->type(); if (type.isEmpty()) return Empty; bool ok = false; int value = type.toInt(&ok, 16); if (!ok) { return Unknow; } return static_cast<Type>(value); } QString DBlockPartition::UUID() const { Q_D(const DBlockPartition); return d->dbus->uUID(); } DBlockPartition::GUIDType DBlockPartition::guidType() const { static QByteArrayList list; if (list.isEmpty()) { // None list << "00000000-0000-0000-0000-000000000000" << "024DEE41-33E7-11D3-9D69-0008C781F39F" << "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" << "21686148-6449-6E6F-744E-656564454649" << "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593" << "F4019732-066E-4E12-8273-346C5641494F" << "BFBFAFE7-A34F-448A-9A5B-6213EB736C22" // Windows << "E3C9E316-0B5C-4DB8-817D-F92DF00215AE" << "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" << "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3" << "AF9B60A0-1431-4F62-BC68-3311714A69AD" << "DE94BBA4-06D1-4D40-A16A-BFD50179D6AC" << "37AFFC90-EF7D-4e96-91C3-2D7AE055B174" << "E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D" // HP-UX << "75894C1E-3AEB-11D3-B7C1-7B03A0000000" << "E2A1E728-32E3-11D6-A682-7B03A0000000" // Linux << "0FC63DAF-8483-4772-8E79-3D69D8477DE4" << "A19D880F-05FC-4D3B-A006-743F0F84911E" << "44479540-F297-41B2-9AF7-D131D5F0458A" << "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709" << "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3" << "B921B045-1DF0-41C3-AF44-4C6F280D3FAE" << "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F" << "E6D6D379-F507-44C2-A23C-238F2A3DF928" << "933AC7E1-2EB4-4F13-B844-0E14E2AEF915" << "3B8F8425-20E0-4F3B-907F-1A25A76F98E8" << "7FFEC5C9-2D00-49B7-8941-3EA10A5586B7" << "CA7D7CCB-63ED-4C53-861C-1742536059CC" << "8DA63339-0007-60C0-C436-083AC8230908" // FreeBSD << "83BD6B9D-7F41-11DC-BE0B-001560B84F0F" << "516E7CB4-6ECF-11D6-8FF8-00022D09712B" << "516E7CB5-6ECF-11D6-8FF8-00022D09712B" << "516E7CB6-6ECF-11D6-8FF8-00022D09712B" << "516E7CB8-6ECF-11D6-8FF8-00022D09712B" << "516E7CBA-6ECF-11D6-8FF8-00022D09712B" // macOS Darwin << "48465300-0000-11AA-AA11-00306543ECAC" << "55465300-0000-11AA-AA11-00306543ECAC" << "6A898CC3-1DD2-11B2-99A6-080020736631" << "52414944-0000-11AA-AA11-00306543ECAC" << "52414944-5F4F-11AA-AA11-00306543ECAC" << "426F6F74-0000-11AA-AA11-00306543ECAC" << "4C616265-6C00-11AA-AA11-00306543ECAC" << "5265636F-7665-11AA-AA11-00306543ECAC" << "53746F72-6167-11AA-AA11-00306543ECAC" << "B6FA30DA-92D2-4A9A-96F1-871EC6486200" << "2E313465-19B9-463F-8126-8A7993773801" << "FA709C7E-65B1-4593-BFD5-E71D61DE9B02" << "BBBA6DF5-F46F-4A89-8F59-8765B2727503" // Solaris illumos << "6A82CB45-1DD2-11B2-99A6-080020736631" << "6A85CF4D-1DD2-11B2-99A6-080020736631" << "6A87C46F-1DD2-11B2-99A6-080020736631" << "6A8B642B-1DD2-11B2-99A6-080020736631" // << "6A898CC3-1DD2-11B2-99A6-080020736631" << "6A8EF2E9-1DD2-11B2-99A6-080020736631" << "6A90BA39-1DD2-11B2-99A6-080020736631" << "6A9283A5-1DD2-11B2-99A6-080020736631" // reserved partition << "6A945A3B-1DD2-11B2-99A6-080020736631" << "6A9630D1-1DD2-11B2-99A6-080020736631" << "6A980767-1DD2-11B2-99A6-080020736631" << "6A96237F-1DD2-11B2-99A6-080020736631" << "6A8D2AC7-1DD2-11B2-99A6-080020736631" // NetBSD << "49F48D32-B10E-11DC-B99B-0019D1879648" << "49F48D5A-B10E-11DC-B99B-0019D1879648" << "49F48D82-B10E-11DC-B99B-0019D1879648" << "49F48DAA-B10E-11DC-B99B-0019D1879648" << "2DB519C4-B10F-11DC-B99B-0019D1879648" << "2DB519EC-B10F-11DC-B99B-0019D1879648" // ChromeOS << "FE3A2A5D-4F32-41A7-B725-ACCC3285A309" << "3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC" << "2E0A753D-9E48-43B0-8337-B15192CB1B5E" // HaiKu << "42465331-3BA3-10F1-802A-4861696B7521" // MidnightBSD << "85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7" << "85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7" << "85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7" << "0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7" << "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7" << "85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7" // Ceph << "45B0969E-9B03-4F30-B4C6-B4B80CEFF106" << "45B0969E-9B03-4F30-B4C6-5EC00CEFF106" << "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" << "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D" << "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE" << "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE" // OpenBSD << "824CC7A0-36A8-11E3-890A-952519AD3F61" // QNX << "CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1" // Plan 9 << "C91818F9-8025-47AF-89D2-F030D7000C2C" // VMware ESX << "9D275380-40AD-11DB-BF97-000C2911D1B8" << "AA31E02A-400F-11DB-9590-000C2911D1B8" << "9198EFFC-31C0-11DB-8F78-000C2911D1B8" // Android-IA << "2568845D-2332-4675-BC39-8FA5A4748D15" << "114EAFFE-1552-4022-B26E-9B053604CF84" << "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599" << "4177C722-9E92-4AAB-8644-43502BFD5506" << "EF32A33B-A409-486C-9141-9FFB711F6266" << "20AC26BE-20B7-11E3-84C5-6CFDB94711E9" << "38F428E6-D326-425D-9140-6E0EA133647C" << "A893EF21-E428-470A-9E55-0668FD91A2D9" << "DC76DDA9-5AC1-491C-AF42-A82591580C0D" << "EBC597D0-2053-4B15-8B64-E0AAC75F4DB1" << "8F68CC74-C5E5-48DA-BE91-A0C8C15E9C80" << "767941D0-2085-11E3-AD3B-6CFDB94711E9" << "AC6D7924-EB71-4DF8-B48D-E267B27148FF" // Open Network Install Environment (ONIE) << "7412F7D5-A156-4B13-81DC-867174929325" << "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149" // PowerPC << "9E1A2D38-C612-4316-AA26-8B49521E5A8B" // freedesktop.org OSes (Linux, etc.) << "BC13C2FF-59E6-4262-A352-B275FD6F7172" // Atari IOS << "734E5AFE-F61A-11E6-BC64-92361F002671"; } const QString &guid = this->type(); if (guid.isEmpty()) return InvalidUUID; int index = list.indexOf(guid.toLatin1()); if (index < 0) return UnknowUUID; return static_cast<GUIDType>((index + GUIDTypeBegin)); } QString DBlockPartition::typeDescription(DBlockPartition::Type type) { switch (type) { case Empty: return "Empty"; case FAT12Type: return "FAT12"; case XENIX_root: return "XENIX root"; case XENIX_usr: return "XENIX usr"; case FAT16_Less_32M: return "FAT16 <32M"; case Extended: return "Extended"; case FAT16Type: return "FAT16"; case HPFS_NTFS: return "HPFS/NTFS"; case AIX: return "AIX"; case AIX_bootable: return "AIX bootable"; case OS2_Boot_Manager: return "OS2 Boot Manager"; case Win95_FAT32: return "Win95 FAT32"; case Win95_FAT32_LBA: return "Win95 FAT32 (LBA)"; case Win95_FAT16_LBA: return "Win95 FAT16 (LBA)"; case Win95_Extended_LBA: return "Win95 Ext'd (LBA)"; case OPUS: return "OPUS"; case Hidden_FAT12: return "Hidden FAT12"; case Compaq_diagnostics: return "Compaq diagnostics"; case Hidden_FAT16_Less_32M: return "Hidden FAT16 <32M"; case Hidden_FAT16: return "Hidden FAT16"; case Hidden_HPFS_or_NTFS: return "Hidden HPFS/NTFS"; case AST_SmartSleep: return "AST SmartSleep"; case Hidden_Win95_FAT32: return "Hidden Win95 FAT32"; case Hidden_Win95_FAT32_LBA: return "Hidden Win95 FAT32 (LBA)"; case Hidden_Win95_FAT16_LBA: return "Hidden Win95 FAT16"; case NEC_DOS: return "NEC DOS"; case Plan9: return "Plan 9"; case PartitionMagic_recovery: return "PartitionMagic recovery"; case Venix_80286: return "Venix 80286"; case PPC_PReP_Boot: return "PPC PReP Boot"; case SFS: return "SFS"; case QNX4_dot_x: return "QNX4.x"; case QNX4_dot_x_2nd_part: return "QNX4.x.2nd part"; case QNX4_dot_x_3rd_part: return "QNX4.x 3rd part"; case OnTrack_DM: return "OnTrack DM"; case OnTrack_DM6_Aux1: return "OnTrack DM6 Aux1"; case CP_M: return "CP/M"; case OnTrack_DM6_Aux3: return "OnTrack DM6 Aux3"; case OnTrackDM6: return "OnTrackDM6"; case EZ_Drive: return "EZ-Drive"; case Golden_Bow: return "Golden Bow"; case Priam_Edisk: return "Priam Edisk"; case SpeedStor: return "SpeedStor"; case GNU_HURD_or_SysV: return "GNU HURD or SysV"; case Novell_Netware_286: return "Novell Netware 286"; case Novell_Netware_386: return "Novell Netware 386"; case DiskSecure_Multi_Boot: return "DiskSecure Multi-Boot"; case PC_IX: return "PC/IX"; case Old_Minix: return "Old Minix"; case Minix_old_Linux: return "Minix / old Linux"; case Linux_swap: return "Linux swap"; case Linux: return "Linux"; case OS2_hidden_C_drive: return "OS/2 hidden C: drive"; case Linux_extended: return "Linux extended"; case NTFS_volume_set_1: return "NTFS volume set"; case NTFS_volume_set_2: return "NTFS volume set"; case Linux_LVM: return "Linux LVM"; case Amoeba: return "Amoeba"; case Amoeba_BBT: return "Amoeba BBT"; case BSD_OS: return "BSD/OS"; case IBM_Thinkpad_hibernation: return "IBM Thinkpad hibernation"; case FreeBSD: return "FreeBSD"; case OpenBSD: return "OpenBSD"; case NeXTSTEP: return "NeXTSTEP"; case NetBSD: return "NetBSD"; case BSDI_fs: return "BSDI fs"; case BSDI_swap: return "BSDI swap"; case Boot_Wizard_hidden: return "Boot Wizard hidden"; case DRDOS_sec_FAT12: return "DRDOS/sec (FAT-12)"; case DRDOS_sec_FAT16_Less_32M: return "DRDOS/sec (FAT-16 < 32M)"; case DRDOS_sec_FAT16: return "DRDOS/sec (FAT-16)"; case Syrinx: return "Syrinx"; case Non_FS_data: return "Non-FS data"; case CP_M_CTOS_dot_dot_dot: return "CP/M / CTOS / ..."; case Dell_Utility: return "Dell Utility"; case BootIt: return "BootIt"; case DOS_access: return "DOS access"; case DOS_R_O: return "DOS R/O"; case SpeedStor_1: return "SpeedStor"; case BeOS_fs: return "BeOS fs"; case EFI_GPT: return "EFI GPT"; case EFI_FAT12_16_32: return "EFI (FAT-12/16/32)"; case Linux_PA_RISC_boot: return "Linux/PA-RISC boot"; case SpeedStor_2: return "SpeedStor"; case SeppdStor_3: return "SpeedStor"; case DOS_secondary: return "DOS secondary"; case Linux_raid_autodetect: return "Linux raid autodetect"; case LANstep: return "LANstep"; case BBT: return "BBT"; default: break; } return QString(); } QString DBlockPartition::guidTypeDescription(GUIDType type) { switch ((int)type) { case Unused_None: return "Unused entry"; case MBR_PS_None: return "MBR partition scheme"; case EFI_SP_None: return "EFI System partition"; case BIOS_BP_None: return "BIOS boot partition"; case iFFS_None: return "Intel Fast Flash (iFFS) partition (for Intel Rapid Start technology)"; case Sony_BP_None: return "Sony boot partition"; case Lenove_BP_None: return "Lenovo boot partition"; // Windows case MSR_Win: return "Microsoft Reserved Partition (MSR)"; case BasicData_Win: return "Basic data partition of Windows"; case LDM_Win: return "Logical Disk Manager (LDM) metadata partition of Windows"; case LDM_DP_Win: return "Logical Disk Manager data partition of Windows"; case WRE_Win: return "Windows Recovery Environment"; case IBM_GPFS_Win: return "IBM General Parallel File System (GPFS) partition of Windows"; case SSP_Win: return "Storage Spaces partition of Windows"; // HP-UX case DP_HPUX: return "Data partition of HP-UX"; case SP_HPUX: return "Service Partition of HP-UX"; // Linux case LFD_Linux: return "Linux filesystem data"; case RAID_P_Linux: return "RAID partition of Linux"; case RP_x86_Linux: return "Root partition (x86) of Linux"; case RP_x86_64_Linux: return "Root partition (x86-64) of Linux"; case RP_32bit_ARM_Linux: return "Root partition (32-bit ARM) of Linux"; case RP_64bit_ARM_Linux: return "Root partition (64-bit ARM/AArch64) of Linux"; case SP_Linux: return "Swap partition of Linux"; case LVM_P_Linux: return "Logical Volume Manager (LVM) partition of Linux"; case Home_P_Linux: return "/home partition of Linux"; case Srv_P_Linux: return "/srv (server data) partition of Linux"; case Plain_DC_P_Linux: return "Plain dm-crypt partition of Linux"; case LUKS_P_Linux: return "LUKS partition of Linux"; case Reserved_Linux: return "Reserved of Linux"; // FreeBSD case BP_FreeBSD: return "Boot partition of FreeBSD"; case DP_FreeBSD: return "Data partition of FreeBSD"; case SP_FreeBSD: return "Swap partition of FreeBSD"; case UFS_P_FreeBSD: return "Unix File System (UFS) partition of FreeBSD"; case VVM_P_FreeBSD: return "Vinum volume manager partition of FreeBSD"; case ZFS_P_FreeBSD: return "ZFS partition of FreeBSD"; // macOS Darwin case HFS_PLUS_P_Mac: return "Hierarchical File System Plus (HFS+) partition of macOS"; case UFS_Mac: return "Apple UFS"; case ZFS_Mac: return "ZFS of macOS(Or /usr partition of Solaris illumos)"; case RAID_P_Mac: return "Apple RAID partition"; case RAID_P_Offline_Mac: return "Apple RAID partition, offline"; case BP_Mac: return "Apple Boot partition (Recovery HD)"; case Label_Mac: return "Apple Label"; case TV_RP_Mac: return "Apple TV Recovery partition"; case CS_P_Mac: return "Apple Core Storage (i.e. Lion FileVault) partition"; case SoftRAID_Status_Mac: return "SoftRAID_Status of macOS"; case SoftRAID_Scratch_Mac: return "SoftRAID_Scratch of macOS"; case SoftRAID_Volume_Mac: return "SoftRAID_Volume of macOS"; case SoftRAID_Cache_Mac: return "SoftRAID_Cache of macOS"; // Solaris illumos case BP_Solaris: return "Boot partition of Solaris illumos"; case RP_Solaris: return "Root partition of Solaris illumos"; case SP_Solaris: return "Swap partition of Solaris illumos"; case Backup_P_Solaris: return "Backup partition of Solaris illumos"; case Var_P_Solaris: return "/var partition of Solaris illumos"; case Home_P_Solaris: return "/home partition of Solaris illumos"; case AS_Solaris: return "Alternate sector os Solaris illumos"; case Reserved_Solaris: return "Reserved partition os Solaris illumos"; // NetBSD case SP_NetBSD: return "Swap partition of NetBSD"; case FFS_P_NetBSD: return "FFS partition of NetBSD"; case LFS_P_NetBSD: return "LFS partition of NetBSD"; case RAID_P_NetBSD: return "RAID partition of NetBSD"; case CP_NetBSD: return "Concatenated partition of NetBSD"; case EP_NetBSD: return "Encrypted partition of NetBSD"; // ChromeOS case Kernel_ChromeOS: return "ChromeOS kernel"; case Rootfs_ChromeOS: return "ChromeOS rootfs"; case FU_ChromeOS: return "ChromeOS future use"; // Haiku case BFS_Haiku: return "Haiku BFS"; // MidnightBSD case BP_MidnightBSD: return "Boot partition of MidnightBSD"; case DP_MidnightBSD: return "Data partition of MidnightBSD"; case SP_MidnightBSD: return "Swap partition of MidnightBSD"; case UFS_P_MidnightBSD: return "Unix File System (UFS) partition of MidnightBSD"; case VVM_P_MidnightBSD: return "Vinum volume manager partition of MidnightBSD"; case ZFS_P_MidnightBSD: return "ZFS partition of MidnightBSD"; // Ceph case Journal_Ceph: return "Ceph Journal"; case DC_EJ_Ceph: return "Ceph dm-crypt Encrypted Journal"; case OSD_Ceph: return "Ceph OSD"; case DC_OSD_Ceph: return "Ceph dm-crypt OSD"; case DIC_Ceph: return "Ceph disk in creation"; case DC_DIC_Ceph: return "Ceph dm-crypt disk in creation"; // OpenBSD case DP_OpenBSD: return "Data partition of OpenBSD"; // QNX case PAFS_QNX: return "Power-safe (QNX6) file system of QNX"; // Plan9 case Partition_Plan9: return "Plan 9 partition of Plan9"; // VMware ESX case Vmkcore_VMware: return "vmkcore (coredump partition)"; case VMFS_VMware: return "VMFS filesystem partition"; case Reserved_VMware: return "VMware Reserved"; // Android-IA case Bootloader_Android: return "Android Bootloader"; case Bottloader2_Android: return "Android Bootloader2"; case Boot_Android: return "Android Boot"; case Recovery_Android: return "Android Recovery"; case Misc_Android: return "Android Misc"; case Metadata_Android: return "Android Metadata"; case System_Android: return "Android System"; case Cache_Android: return "Android Cache"; case Data_Android: return "Android Data"; case Persistent_Android: return "Android Persistent"; case Factory_Android: return "Android Factory"; case Fastboot_Android: return "Android Fastboot"; case OEM_Android: return "Android OEM"; // Open Network Install Environment (ONIE) case Boot_ONIE: return "Open Network Install Environment Boot"; case Config_ONIE: return "Open Network Install Environment Config"; // PowerPC case Boot_PowerPC: return "PowerPC PReP boot"; // freedesktop.org OSes (Linux, etc.) case SBLC_OSes: return "Shared boot loader configuration of freedesktop.org OSes (Linux, etc.)"; // Atari TOS case BD_P_Atari: return "Basic data partition (GEM, BGM, F32) of Atari TOS"; case UnknowUUID: return "Unknow GUID"; } return "Invalid GUID type"; } void DBlockPartition::deletePartition(const QVariantMap &options) { Q_D(DBlockPartition); d->dbus->Delete(options); } void DBlockPartition::resize(qulonglong size, const QVariantMap &options) { Q_D(DBlockPartition); d->dbus->Resize(size, options); } void DBlockPartition::setFlags(qulonglong flags, const QVariantMap &options) { Q_D(DBlockPartition); d->dbus->SetFlags(flags, options); } void DBlockPartition::setName(const QString &name, const QVariantMap &options) { Q_D(DBlockPartition); d->dbus->SetName(name, options); } void DBlockPartition::setType(const QString &type, const QVariantMap &options) { Q_D(DBlockPartition); d->dbus->SetType(type, options); } void DBlockPartition::setType(DBlockPartition::Type type, const QVariantMap &options) { if (type == Unknow) return; QString type_string = QString::asprintf("0x%.2s", QByteArray::number(type, 16).constData()); type_string.replace(" ", "0"); setType(type_string, options); } /*! * \class DBlockPartition * \inmodule dde-file-manager-lib * * \brief DBlockPartition class comment goes here * * \sa DDiskManager::createBlockPartition */ DBlockPartition::DBlockPartition(const QString &path, QObject *parent) : DBlockDevice(*new DBlockPartitionPrivate(this), path, parent) { d_func()->dbus = new OrgFreedesktopUDisks2PartitionInterface(UDISKS2_SERVICE, path, QDBusConnection::systemBus(), this); connect(this, &DBlockPartition::typeChanged, this, &DBlockPartition::eTypeChanged); connect(this, &DBlockPartition::UUIDChanged, this, &DBlockPartition::guidTypeChanged); } udisks2-qt5-5.0.6/dudisksjob.cpp0000644000175100017510000000762514051331364016440 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "dudisksjob.h" #include "udisks2_interface.h" #include <QDBusConnection> class DUDisksJobPrivate { DUDisksJobPrivate(DUDisksJob *) { } DUDisksJob *q_ptr; OrgFreedesktopUDisks2JobInterface *dbusif; Q_DECLARE_PUBLIC(DUDisksJob) }; DUDisksJob::~DUDisksJob() { } QString DUDisksJob::path() const { Q_D(const DUDisksJob); return d->dbusif->path(); } QStringList DUDisksJob::objects() const { Q_D(const DUDisksJob); QStringList ret; for (auto &o : d->dbusif->objects()) { ret.push_back(o.path()); } return ret; } bool DUDisksJob::cancelable() const { Q_D(const DUDisksJob); return d->dbusif->cancelable(); } bool DUDisksJob::progressValid() const { Q_D(const DUDisksJob); return d->dbusif->progressValid(); } double DUDisksJob::progress() const { Q_D(const DUDisksJob); return d->dbusif->progress(); } QString DUDisksJob::operation() const { Q_D(const DUDisksJob); return d->dbusif->operation(); } quint32 DUDisksJob::startedByUid() const { Q_D(const DUDisksJob); return d->dbusif->startedByUID(); } quint64 DUDisksJob::bytes() const { Q_D(const DUDisksJob); return d->dbusif->bytes(); } quint64 DUDisksJob::expectedEndTime() const { Q_D(const DUDisksJob); return d->dbusif->expectedEndTime(); } quint64 DUDisksJob::rate() const { Q_D(const DUDisksJob); return d->dbusif->rate(); } quint64 DUDisksJob::startTime() const { Q_D(const DUDisksJob); return d->dbusif->startTime(); } void DUDisksJob::cancel(const QVariantMap &options) { Q_D(DUDisksJob); d->dbusif->Cancel(options).waitForFinished(); } DUDisksJob::DUDisksJob(QString path, QObject *parent) : QObject(parent) , d_ptr(new DUDisksJobPrivate(this)) { Q_D(DUDisksJob); d->dbusif = new OrgFreedesktopUDisks2JobInterface(UDISKS2_SERVICE, path, QDBusConnection::systemBus()); QDBusConnection::systemBus().connect(UDISKS2_SERVICE, d->dbusif->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(onPropertiesChanged(const QString &, const QVariantMap &))); connect(d->dbusif, &OrgFreedesktopUDisks2JobInterface::Completed, this, &DUDisksJob::completed); } void DUDisksJob::onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties) { Q_UNUSED(interface) auto begin = changed_properties.begin(); for (; begin != changed_properties.constEnd(); ++begin) { QString property_name = begin.key(); int pindex = this->metaObject()->indexOfProperty(property_name.toLatin1().constData()); if (pindex < 0) { property_name[0] = property_name.at(0).toLower(); pindex = this->metaObject()->indexOfProperty(property_name.toLatin1().constData()); } if (pindex < 0) continue; const QMetaProperty &mp = this->metaObject()->property(pindex); if (!mp.hasNotifySignal()) continue; mp.notifySignal().invoke(this, QGenericArgument(begin.value().typeName(), begin.value().constData())); } } udisks2-qt5-5.0.6/dblockdevice.h0000644000175100017510000002263114051331364016354 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBLOCKDEVICE_H #define DBLOCKDEVICE_H #include <QObject> #include <QVariantMap> #include <QDBusUnixFileDescriptor> #include <QDBusError> class QDBusObjectPath; class DBlockDevicePrivate; class DBlockDevice : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(DBlockDevice) Q_PROPERTY(QString path READ path CONSTANT FINAL) Q_PROPERTY(bool watchChanges READ watchChanges WRITE setWatchChanges) Q_PROPERTY(bool hasFileSystem READ hasFileSystem NOTIFY hasFileSystemChanged) Q_PROPERTY(bool hasPartition READ hasPartition NOTIFY hasPartitionChanged) Q_PROPERTY(bool isEncrypted READ isEncrypted NOTIFY isEncryptedChanged) Q_PROPERTY(bool isLoopDevice READ isLoopDevice) Q_PROPERTY(QList<QPair<QString, QVariantMap>> configuration READ configuration NOTIFY configurationChanged) Q_PROPERTY(QString cryptoBackingDevice READ cryptoBackingDevice NOTIFY cryptoBackingDeviceChanged) Q_PROPERTY(QByteArray device READ device) Q_PROPERTY(qulonglong deviceNumber READ deviceNumber) Q_PROPERTY(QString drive READ drive) Q_PROPERTY(bool hintAuto READ hintAuto NOTIFY hintAutoChanged) Q_PROPERTY(QString hintIconName READ hintIconName NOTIFY hintIconNameChanged) Q_PROPERTY(bool hintIgnore READ hintIgnore NOTIFY hintIgnoreChanged) Q_PROPERTY(QString hintName READ hintName NOTIFY hintNameChanged) Q_PROPERTY(bool hintPartitionable READ hintPartitionable NOTIFY hintPartitionableChanged) Q_PROPERTY(QString hintSymbolicIconName READ hintSymbolicIconName NOTIFY hintSymbolicIconNameChanged) Q_PROPERTY(bool hintSystem READ hintSystem) Q_PROPERTY(QString id READ id) Q_PROPERTY(QString idLabel READ idLabel NOTIFY idLabelChanged) Q_PROPERTY(QString idType READ idType NOTIFY idTypeChanged) Q_PROPERTY(FSType fsType READ fsType NOTIFY fsTypeChanged) Q_PROPERTY(QString idUUID READ idUUID NOTIFY idUUIDChanged) Q_PROPERTY(QString idUsage READ idUsage NOTIFY idUsageChanged) Q_PROPERTY(QString idVersion READ idVersion NOTIFY idVersionChanged) Q_PROPERTY(QString mDRaid READ mDRaid NOTIFY mDRaidChanged) Q_PROPERTY(QString mDRaidMember READ mDRaidMember NOTIFY mDRaidMemberChanged) Q_PROPERTY(QByteArray preferredDevice READ preferredDevice NOTIFY preferredDeviceChanged) Q_PROPERTY(bool readOnly READ readOnly NOTIFY readOnlyChanged) Q_PROPERTY(qulonglong size READ size NOTIFY sizeChanged) Q_PROPERTY(QByteArrayList symlinks READ symlinks NOTIFY symlinksChanged) Q_PROPERTY(QStringList userspaceMountOptions READ userspaceMountOptions NOTIFY userspaceMountOptionsChanged) // of FileSystem Q_PROPERTY(QByteArrayList mountPoints READ mountPoints NOTIFY mountPointsChanged) // of ParitionTable Q_PROPERTY(PTType ptType READ ptType NOTIFY ptTypeChanged) // of Encrypted Q_PROPERTY(QList<QPair<QString, QVariantMap>> childConfiguration READ childConfiguration NOTIFY childConfigurationChanged) Q_PROPERTY(QString cleartextDevice READ cleartextDevice NOTIFY cleartextDeviceChanged) public: // partition table type enum PTType { InvalidPT, MBR, GPT, UnknowPT }; Q_ENUM(PTType) enum FSType { InvalidFS, UnknowFS, ext2, ext3, ext4, fat12, fat16, fat32, btrfs, f2fs, hfs_plus, minix, nilfs2, ntfs, reiser4, vfat, iso9660, jfs, xfs, swap, LVM2_member, crypto_LUKS }; Q_ENUM(FSType) ~DBlockDevice(); bool isValid() const; bool watchChanges() const; QString path() const; QList<QPair<QString, QVariantMap>> configuration() const; QString cryptoBackingDevice() const; QByteArray device() const; qulonglong deviceNumber() const; QString drive() const; bool hintAuto() const; QString hintIconName() const; bool hintIgnore() const; QString hintName() const; bool hintPartitionable() const; QString hintSymbolicIconName() const; bool hintSystem() const; QString id() const; QString idLabel() const; QString idType() const; FSType fsType() const; QString idUUID() const; QString idUsage() const; QString idVersion() const; QString mDRaid() const; QString mDRaidMember() const; QByteArray preferredDevice() const; bool readOnly() const; qulonglong size() const; QByteArrayList symlinks() const; QStringList userspaceMountOptions() const; bool hasFileSystem() const; bool hasPartitionTable() const; bool hasPartition() const; bool isEncrypted() const; bool isLoopDevice() const; static bool hasFileSystem(const QString &path); static bool hasPartitionTable(const QString &path); static bool hasPartition(const QString &path); static bool isEncrypted(const QString &path); QByteArrayList mountPoints() const; PTType ptType() const; QList<QPair<QString, QVariantMap>> childConfiguration() const; QDBusError lastError() const; public Q_SLOTS: void setWatchChanges(bool watchChanges); void addConfigurationItem(const QPair<QString, QVariantMap> &item, const QVariantMap &options); void format(const QString &type, const QVariantMap &options); void format(const FSType &type, const QVariantMap &options); QList<QPair<QString, QVariantMap>> getSecretConfiguration(const QVariantMap &options); QDBusUnixFileDescriptor openDevice(const QString &mode, const QVariantMap &options); QDBusUnixFileDescriptor openForBackup(const QVariantMap &options); QDBusUnixFileDescriptor openForBenchmark(const QVariantMap &options); QDBusUnixFileDescriptor openForRestore(const QVariantMap &options); void removeConfigurationItem(const QPair<QString, QVariantMap> &item, const QVariantMap &options); void rescan(const QVariantMap &options); void updateConfigurationItem(const QPair<QString, QVariantMap> &old_item, const QPair<QString, QVariantMap> &new_item, const QVariantMap &options); // of Filesystem QString mount(const QVariantMap &options); void unmount(const QVariantMap &options); bool canSetLabel() const; void setLabel(const QString &label, const QVariantMap &options); // of Encrypted void changePassphrase(const QString &passphrase, const QString &new_passphrase, const QVariantMap &options); void lock(const QVariantMap &options); QString unlock(const QString &passphrase, const QVariantMap &options); QString cleartextDevice(); Q_SIGNALS: void hasFileSystemChanged(bool hasFileSystem); void hasPartitionChanged(bool hasPartition); void isEncryptedChanged(bool isEncrypted); void configurationChanged(QList<QPair<QString, QVariantMap>> configuration); void cryptoBackingDeviceChanged(QString cryptoBackingDevice); void hintAutoChanged(bool hintAuto); void hintIconNameChanged(QString hintIconName); void hintIgnoreChanged(bool hintIgnore); void hintNameChanged(QString hintName); void hintPartitionableChanged(bool hintPartitionable); void hintSymbolicIconNameChanged(QString hintSymbolicIconName); void idLabelChanged(QString idLabel); void idTypeChanged(QString idType); void fsTypeChanged(); void idUUIDChanged(QString idUUID); void idUsageChanged(QString idUsage); void idVersionChanged(QString idVersion); void mDRaidChanged(QString mDRaid); void mDRaidMemberChanged(QString mDRaidMember); void preferredDeviceChanged(QByteArray preferredDevice); void readOnlyChanged(bool readOnly); void sizeChanged(qulonglong size); void symlinksChanged(QByteArrayList symlinks); void userspaceMountOptionsChanged(QStringList userspaceMountOptions); void ptTypeChanged(); void mountPointsChanged(const QByteArrayList &mountPoints); void childConfigurationChanged(QList<QPair<QString, QVariantMap>> childConfiguration); void cleartextDeviceChanged(const QString &cleartextDevice); protected: explicit DBlockDevice(const QString &path, QObject *parent = nullptr); explicit DBlockDevice(DBlockDevicePrivate &dd, const QString &path, QObject *parent = nullptr); QScopedPointer<DBlockDevicePrivate> d_ptr; private Q_SLOTS: void onInterfacesAdded(const QDBusObjectPath &object_path, const QMap<QString, QVariantMap> &interfaces_and_properties); void onInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces); void onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties); // Q_PRIVATE_SLOT(d_ptr, void _q_onPropertiesChanged(const QString &, const QVariantMap &)) friend class DDiskManager; }; #endif // DBLOCKDEVICE_H udisks2-qt5-5.0.6/org.freedesktop.UDisks2.xml0000644000175100017510000037002614051331364020677 0ustar shuttleshuttle <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> <!-- Copyright (C) 2011 David Zeuthen <zeuthen@gmail.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. --> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Manager: @short_description: Manager singleton Interface for top-level manager singleton object located at the object path <literal>/org/freedesktop/UDisks2/Manager</literal>. --> <interface name="org.freedesktop.UDisks2.Manager"> <!-- Version: The version of the daemon currently running --> <property name="Version" type="s" access="read"/> <!-- SupportedFilesystems: List of supported filesystem by UDisks2 --> <property name="SupportedFilesystems" type="as" access="read"/> <!-- SupportedEncryptionTypes: List of supported encryption types by UDisks2 --> <property name="SupportedEncryptionTypes" type="as" access="read"/> <property name="DefaultEncryptionType" type="s" access="read"/> <!-- CanFormat: @type: The filesystem type to be tested for formatting availability. @available: Formatting availability and the required binary name if missing (i.e. no error and returns FALSE). @since: 2.7.2 Tests for availability to create the given filesystem. See the #org.freedesktop.UDisks2.Manager:SupportedFilesystems property for a list of known types. Unknown or unsupported filesystems result in an error. --> <method name="CanFormat"> <arg name="type" direction="in" type="s"/> <arg name="available" direction="out" type="(bs)"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QPair<bool, QString>"/> </method> <!-- CanResize: @type: The filesystem type to be tested for resize availability. @available: Resizing availability, flags for allowed resizing (i.e. growing/shrinking support for online/offline) and the required binary name if missing (i.e. no error and returns FALSE). @since: 2.7.2 Tests for availability to resize the given filesystem. The mode flags indicate if growing and/or shriking resize is available if mounted/unmounted. The mode corresponds to bitwise-OR combined BDFsResizeFlags of the libblockdev FS plugin: BD_FS_OFFLINE_SHRINK = 2, shrinking resize allowed when unmounted BD_FS_OFFLINE_GROW = 4, growing resize allowed when unmounted BD_FS_ONLINE_SHRINK = 8, shrinking resize allowed when mounted BD_FS_ONLINE_GROW = 16, growing resize allowed when mounted Unknown filesystems or filesystems which do not support resizing result in errors. --> <method name="CanResize"> <arg name="type" direction="in" type="s"/> <arg name="available" direction="out" type="(bts)"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QPair<bool, QPair<quint64, QString>>"/> </method> <!-- CanCheck: @type: The filesystem type to be tested for consistency check availability. @available: Checking availability and the required binary name if missing (i.e. no error and returns FALSE). @since: 2.7.2 Tests for availability to check the given filesystem. Unsupported filesystems or filesystems which do not support checking result in errors. --> <method name="CanCheck"> <arg name="type" direction="in" type="s"/> <arg name="available" direction="out" type="(bs)"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QPair<bool, QString>"/> </method> <!-- CanRepair: @type: The filesystem type to be tested for repair availability. @available: Repair availability and the required binary name if missing (i.e. no error and returns FALSE). @since: 2.7.2 Tests for availability repair the given filesystem. Unsupported filesystems or filesystems which do not support repairing result in errors. --> <method name="CanRepair"> <arg name="type" direction="in" type="s"/> <arg name="available" direction="out" type="(bs)"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QPair<bool, QString>"/> </method> <!-- LoopSetup: @fd: An index for the file descriptor to use. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>offset</parameter> (of type 't'), <parameter>size</parameter> (of type 't'), <parameter>read-only</parameter> (of type 'b') and <parameter>no-part-scan</parameter> (of type 'b'). @resulting_device: An object path to the object implementing the #org.freedesktop.UDisks2.Block interface. Creates a block device for the file represented by @fd. --> <method name="LoopSetup"> <annotation name="org.gtk.GDBus.C.UnixFD" value="1"/> <arg name="fd" direction="in" type="h"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="resulting_device" direction="out" type="o"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- MDRaidCreate: @blocks: An array of object paths to objects implementing the #org.freedesktop.UDisks2.Block interface. @level: The RAID level for the array. @name: The name for the array. @chunk: The chunk size (in bytes) or 0 if @level is <quote>raid1</quote>. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @resulting_array: An object path to the object implementing the #org.freedesktop.UDisks2.MDRaid interface. @since: 2.0.0 Creates a new RAID array on the block devices specified by @blocks. Each element in this array must be an object path to an object implementing the #org.freedesktop.UDisks2.Block interface. Known and supported values for @level include <quote>raid0</quote>, <quote>raid1</quote>, <quote>raid4</quote>, <quote>raid5</quote>, <quote>raid6</quote> and <quote>raid10</quote>. Before the array is created, all devices in @blocks are erased. Once created (but before the method returns), the RAID array will be erased. --> <method name="MDRaidCreate"> <arg name="blocks" direction="in" type="ao"/> <arg name="level" direction="in" type="s"/> <arg name="name" direction="in" type="s"/> <arg name="chunk" direction="in" type="t"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="resulting_array" direction="out" type="o"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QVariantMap"/> </method> <!-- EnableModules: @enable: A boolean value indicating whether modules should be enabled. Currently only the %TRUE value is permitted. Loads and activates modules. This action also causes all objects to receive "add" uevent that triggers additional module interfaces activation. Modules cannot be deactivated for the moment. Any consecutive calls with modules already enabled equals to noop. --> <method name="EnableModules"> <arg name="enable" direction="in" type="b"/> </method> <!-- GetBlockDevices: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @since: 2.7.2 Get list of all block devices (object paths of objects implementing the #org.freedesktop.UDisks2.Block interface) known to UDisks. --> <method name="GetBlockDevices"> <arg name="options" direction="in" type="a{sv}"/> <arg name="block_objects" direction="out" type="ao"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- ResolveDevice: @devspec: Dictionary with specification of a device. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @devices: List of object paths of all devices matching @devspec. @since: 2.7.3 Get device(s) matching specification given in @devspec. Currently supported keys for @devspec include: <variablelist> <varlistentry> <term>path (type <literal>'s'</literal>)</term> <listitem><para> Device path (e.g. <quote>/dev/sda</quote>). This also includes symlinks in <quote>/dev</quote> (both #org.freedesktop.UDisks2.Block:Device and #org.freedesktop.UDisks2.Block:Symlinks are used). </para></listitem> </varlistentry> <varlistentry> <term>label (type <literal>'s'</literal>)</term> <listitem><para> Filesystem label. #org.freedesktop.UDisks2.Block:IdLabel is used. </para></listitem> </varlistentry> <varlistentry> <term>uuid (type <literal>'s'</literal>)</term> <listitem><para> Filesystem UUID. #org.freedesktop.UDisks2.Block:IdUUID is used. </para></listitem> </varlistentry> </variablelist> It is possbile to specify multiple keys. In this case, only devices matching all values will be returned. --> <method name="ResolveDevice"> <arg name="devspec" direction="in" type="a{sv}"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="devices" direction="out" type="ao"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> </interface> <!-- org.freedesktop.UDisks2.Drive: @short_description: Disk drives This interface is used to represent both hard disks and disk drives (with or without removable media). This interface should not to be confused with the #org.freedesktop.UDisks2.Block interface that is used for low-level block devices the OS knows about. For example, if <filename>/dev/sda</filename> and <filename>/dev/sdb</filename> are block devices for two paths to the same drive, there will be only one #org.freedesktop.UDisks2.Drive object but two #org.freedesktop.UDisks2.Block objects. --> <interface name="org.freedesktop.UDisks2.Drive"> <!-- Vendor: A name for the vendor of the drive or blank if unknown. --> <property name="Vendor" type="s" access="read"/> <!-- Model: A name for the model of the drive or blank if unknown. --> <property name="Model" type="s" access="read"/> <!-- Revision: Firmware Revision or blank if unknown. --> <property name="Revision" type="s" access="read"/> <!-- Serial: Serial number of the drive or blank if unknown. --> <property name="Serial" type="s" access="read"/> <!-- WWN: The <ulink url="http://en.wikipedia.org/wiki/World_Wide_Name">World Wide Name</ulink> of the drive or blank if unknown. --> <property name="WWN" type="s" access="read"/> <!-- Id: A unique and persistent identifier for the device or blank if no such identifier is available. This identifier is guaranteed to not include the slash character '/' (U+002F SOLIDUS) which means it can be used as a filename. Examples: <quote>ST32000542AS-6XW00W51</quote>, <quote>HITACHI-HTS723232A7A364-E3834563KRG2HN</quote>, <quote>INTEL-SSDSA2MH080G1GC-CVEM842101HD080DGN</quote>. --> <property name="Id" type="s" access="read"/> <!-- Configuration: A set of configuration directives that are applied to the drive when it is connected (e.g. at start-up, hotplug or resume). This is an dict of items with the following known keys: <variablelist> <varlistentry> <term>ata-pm-standby (type <literal>'i'</literal>)</term> <listitem><para> The spindown timeout for ATA drives (See ATA command <quote>STANDBY</quote>). </para></listitem> </varlistentry> <varlistentry> <term>ata-apm-level (type <literal>'i'</literal>)</term> <listitem><para> The APM level for ATA drives (See ATA command <quote>SET FEATURES</quote>, sub-commands 0x05 and 0x85). </para></listitem> </varlistentry> <varlistentry> <term>ata-aam-level (type <literal>'i'</literal>)</term> <listitem><para> The AAM level for ATA drives (See ATA command <quote>SET FEATURES</quote>, sub-commands 0x42 and 0xc2). </para></listitem> </varlistentry> <varlistentry> <term>ata-write-cache-enabled (type <literal>'b'</literal>)</term> <listitem><para> Whether the write-cache is enabled (See ATA command <quote>SET FEATURES</quote>, sub-commands 0x82 and 0x02). Since 2.1. </para></listitem> </varlistentry> <varlistentry> <term>ata-read-lookahead-enabled (type <literal>'b'</literal>)</term> <listitem><para> Whether the read look-ahead is enabled (See ATA command <quote>SET FEATURES</quote>, sub-commands 0x55 and 0xaa). Since 2.1.7. </para></listitem> </varlistentry> </variablelist> The contents of this property is read from the configuration file <filename>/etc/udisks2/IDENTIFIER.conf</filename> where <emphasis>IDENTIFIER</emphasis> is the value of the #org.freedesktop.UDisks2.Drive:Id property. See <xref linkend="udisks.8"/> for the file format of this file. Use the org.freedesktop.UDisks2.Drive.SetConfiguration() method to change the value of this property. --> <property name="Configuration" type="a{sv}" access="read"> <annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/> </property> <!-- Media: The kind of media currently in the drive or blank if unknown. See the #org.freedesktop.UDisks2.Drive:MediaCompatibility property for known values. --> <property name="Media" type="s" access="read"/> <!-- MediaCompatibility: The physical kind of media the drive uses or the type of the drive or blank if unknown. Known values include <variablelist> <varlistentry><term>thumb</term><listitem><para>The device is a thumb-drive with non-removable media (e.g. a USB stick)</para></listitem></varlistentry> <varlistentry><term>flash</term><listitem><para>Flash Card</para></listitem></varlistentry> <varlistentry><term>flash_cf</term><listitem><para>CompactFlash</para></listitem></varlistentry> <varlistentry><term>flash_ms</term><listitem><para>MemoryStick</para></listitem></varlistentry> <varlistentry><term>flash_sm</term><listitem><para>SmartMedia</para></listitem></varlistentry> <varlistentry><term>flash_sd</term><listitem><para>Secure Digital</para></listitem></varlistentry> <varlistentry><term>flash_sdhc</term><listitem><para>Secure Digital High Capacity</para></listitem></varlistentry> <varlistentry><term>flash_sdxc</term><listitem><para>Secure Digital eXtended Capacity</para></listitem></varlistentry> <varlistentry><term>flash_mmc</term><listitem><para>MultiMediaCard</para></listitem></varlistentry> <varlistentry><term>floppy</term><listitem><para>Floppy Disk</para></listitem></varlistentry> <varlistentry><term>floppy_zip</term><listitem><para>Zip Disk</para></listitem></varlistentry> <varlistentry><term>floppy_jaz</term><listitem><para>Jaz Disk</para></listitem></varlistentry> <varlistentry><term>optical</term><listitem><para>Optical Disc</para></listitem></varlistentry> <varlistentry><term>optical_cd</term><listitem><para>Compact Disc</para></listitem></varlistentry> <varlistentry><term>optical_cd_r</term><listitem><para>Compact Disc Recordable</para></listitem></varlistentry> <varlistentry><term>optical_cd_rw</term><listitem><para>Compact Disc Rewritable</para></listitem></varlistentry> <varlistentry><term>optical_dvd</term><listitem><para>Digital Versatile Disc</para></listitem></varlistentry> <varlistentry><term>optical_dvd_r</term><listitem><para>DVD-R</para></listitem></varlistentry> <varlistentry><term>optical_dvd_rw</term><listitem><para>DVD-RW</para></listitem></varlistentry> <varlistentry><term>optical_dvd_ram</term><listitem><para>DVD-RAM</para></listitem></varlistentry> <varlistentry><term>optical_dvd_plus_r</term><listitem><para>DVD+R</para></listitem></varlistentry> <varlistentry><term>optical_dvd_plus_rw</term><listitem><para>DVD+RW</para></listitem></varlistentry> <varlistentry><term>optical_dvd_plus_r_dl</term><listitem><para>DVD+R Dual Layer</para></listitem></varlistentry> <varlistentry><term>optical_dvd_plus_rw_dl</term><listitem><para>DVD+RW Dual Layer</para></listitem></varlistentry> <varlistentry><term>optical_bd</term><listitem><para>Blu-ray Disc</para></listitem></varlistentry> <varlistentry><term>optical_bd_r</term><listitem><para>Blu-ray Recordable</para></listitem></varlistentry> <varlistentry><term>optical_bd_re</term><listitem><para>Blu-ray Rewritable</para></listitem></varlistentry> <varlistentry><term>optical_hddvd</term><listitem><para>HD-DVD</para></listitem></varlistentry> <varlistentry><term>optical_hddvd_r</term><listitem><para>HD-DVD Recordable</para></listitem></varlistentry> <varlistentry><term>optical_hddvd_rw</term><listitem><para>HD-DVD Rewritable</para></listitem></varlistentry> <varlistentry><term>optical_mo</term><listitem><para>Magneto Optical</para></listitem></varlistentry> <varlistentry><term>optical_mrw</term><listitem><para>Can read Mount Rainer media</para></listitem></varlistentry> <varlistentry><term>optical_mrw_w</term><listitem><para>Can write Mount Rainer media</para></listitem></varlistentry> </variablelist> --> <property name="MediaCompatibility" type="as" access="read"/> <!-- MediaRemovable: Whether the media can be removed from the drive. Note that this may be overridden from what the hardware reports - for example, USB thumb drives often report that they are using removable media while in fact the media is not removable. --> <property name="MediaRemovable" type="b" access="read"/> <!-- MediaAvailable: Set to %FALSE if no medium is available. This is always %TRUE if #org.freedesktop.UDisks2.Drive:MediaChangeDetected is %FALSE. --> <property name="MediaAvailable" type="b" access="read"/> <!-- MediaChangeDetected: Set to %TRUE only if media changes are detected. Media changes are detected on all modern disk drives through either polling or an asynchronous notification mechanism. The only known disk drives that cannot report media changes are PC floppy drives. --> <property name="MediaChangeDetected" type="b" access="read"/> <!-- Size: The size of the drive (or the media currently in the drive). This is always 0 if #org.freedesktop.UDisks2.Drive:MediaChangeDetected is %FALSE. --> <property name="Size" type="t" access="read"/> <!-- TimeDetected: The time the drive was first detected. This is expressed in micro-seconds since the Epoch Jan 1, 1970 0:00 UTC. --> <property name="TimeDetected" type="t" access="read"/> <!-- TimeMediaDetected: The earliest time media was last detected or 0 if media is not available. This is expressed in micro-seconds since the Epoch Jan 1, 1970 0:00 UTC. --> <property name="TimeMediaDetected" type="t" access="read"/> <!-- Optical: %TRUE if the drive contains an optical disc. --> <property name="Optical" type="b" access="read"/> <!-- OpticalBlank: %TRUE if the disc is blank. This is only valid if the property #org.freedesktop.UDisks2.Drive:Optical is %TRUE. --> <property name="OpticalBlank" type="b" access="read"/> <!-- OpticalNumTracks: The number of tracks. This is only valid if the property #org.freedesktop.UDisks2.Drive:Optical is %TRUE. --> <property name="OpticalNumTracks" type="u" access="read"/> <!-- OpticalNumAudioTracks: The number of audio tracks. This is only valid if the property #org.freedesktop.UDisks2.Drive:Optical is %TRUE. --> <property name="OpticalNumAudioTracks" type="u" access="read"/> <!-- OpticalNumDataTracks: The number of data tracks. This is only valid if the property #org.freedesktop.UDisks2.Drive:Optical is %TRUE. --> <property name="OpticalNumDataTracks" type="u" access="read"/> <!-- OpticalNumSessions: The number of sessions. This is only valid if the property #org.freedesktop.UDisks2.Drive:Optical is %TRUE. --> <property name="OpticalNumSessions" type="u" access="read"/> <!-- RotationRate: The rotational rate of the drive. <itemizedlist> <listitem><para>-1 if known to be rotating media but rotation rate isn't known</para></listitem> <listitem><para>0 if known to be non-rotating media</para></listitem> <listitem><para>the rotation rate in rounds per minute otherwise</para></listitem> </itemizedlist> --> <property name="RotationRate" type="i" access="read"/> <!-- ConnectionBus: The physical connection bus used for the drive as seen by the user. This is typically used to draw a USB or Firewire emblem on top of an icon in an user interface. Note that this property has <emphasis>nothing</emphasis> to do with the low-level command-set used (such as ATA-8) or what low-level connection bus (such as SATA, eSATA, PATA, SAS2 etc) is used. Known values include: <variablelist> <varlistentry><term>usb</term><listitem><para>Connected via <ulink url="http://en.wikipedia.org/wiki/USB">USB</ulink></para></listitem></varlistentry> <varlistentry><term>sdio</term><listitem><para>Connected via <ulink url="http://en.wikipedia.org/wiki/Secure_Digital#SDIO">SDIO</ulink></para></listitem></varlistentry> <varlistentry><term>ieee1394</term><listitem><para>Connected via <ulink url="http://en.wikipedia.org/wiki/Firewire">Firewire</ulink></para></listitem></varlistentry> </variablelist> --> <property name="ConnectionBus" type="s" access="read"/> <!-- Seat: A string identifying what seat the drive is plugged into, if any. --> <property name="Seat" type="s" access="read"/> <!-- Removable: A hint whether the drive and/or its media is considered <emphasis>removable</emphasis> by the user. This includes drives with removable media (cf. the #org.freedesktop.UDisks2.Drive:MediaRemovable property), Flash media such as SD cards and drives on hotpluggable buses such as USB or Firewire (cf. the #org.freedesktop.UDisks2.Drive:ConnectionBus property). Note that this is only a <emphasis>guess</emphasis>. --> <property name="Removable" type="b" access="read"/> <!-- Ejectable: Whether the media can be ejected from the drive or the drive accepts an eject command to switch its state so it displays e.g. a "Safe To Remove" message to the user. Note that this is only a <emphasis>guess</emphasis>. --> <property name="Ejectable" type="b" access="read"/> <!-- SortKey: A string that can be used for sorting drive objects. --> <property name="SortKey" type="s" access="read"/> <!-- Eject: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Ejects media from the drive. This is only meaningful to do on drives with removable media. There are not a lot of guarantees associated with this method so it should only be called in response to an user action. On some hardware the media may be physically ejected while on other hardware may simply eject the disc. On some hardware it may not do anything physical but it may cause e.g. a display on the hardware to show e.g. <quote>It is now safe to remove the device</quote>. --> <method name="Eject"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- SetConfiguration: @value: The configuration value to set. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Sets the configuration for the drive. This will store the configuration in the file-system and also apply it to the drive. See the #org.freedesktop.UDisks2.Drive:Configuration property for details about valid values and the location of the configuration file that @value will be written to. --> <method name="SetConfiguration"> <arg name="value" direction="in" type="a{sv}"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- PowerOff: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @since: 2.0.0 Arranges for the drive to be safely removed and powered off. On the OS side this includes ensuring that no process is using the drive, then requesting that in-flight buffers and caches are committed to stable storage. The exact steps for powering off the drive depends on the drive itself and the interconnect used. For drives connected through USB, the effect is that the USB device will be deconfigured followed by disabling the upstream hub port it is connected to. Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. Applications can examine the #org.freedesktop.UDisks2.Drive:SiblingId property to determine such relationships. There are not a lot of guarantees associated with this method so it should only be called in response to an user action. Usually the effect is that the drive disappears as if it was unplugged. This method only works if the #org.freedesktop.UDisks2.Drive:CanPowerOff property is set to %TRUE. --> <method name="PowerOff"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- CanPowerOff: @since: 2.0.0 Whether the drive can be safely removed / powered off. See the org.freedesktop.UDisks2.Drive.PowerOff() method for more information. See <xref linkend="udisks.8"/> for how to influence the value of this property. --> <property name="CanPowerOff" type="b" access="read"/> <!-- SiblingId: @since: 2.0.0 An opaque token that, if non-blank, is used to group drives that are part of the same physical device. --> <property name="SiblingId" type="s" access="read"/> </interface> <!-- org.freedesktop.UDisks2.Drive.Ata: @short_description: Disk drives using the ATA command-set Objects implementing this interface also implement the #org.freedesktop.UDisks2.Drive interface. --> <interface name="org.freedesktop.UDisks2.Drive.Ata"> <!-- SmartSupported: Whether the drive supports SMART. --> <property name="SmartSupported" type="b" access="read"/> <!-- SmartEnabled: Whether SMART is enabled. --> <property name="SmartEnabled" type="b" access="read"/> <!-- SmartUpdated: The point in time (seconds since the <ulink url="http://en.wikipedia.org/wiki/Unix_epoch">Unix Epoch</ulink>) that the SMART status was updated or 0 if never updated. The value of the other properties related to SMART are not meaningful if this proeprty is 0. --> <property name="SmartUpdated" type="t" access="read"/> <!-- SmartFailing: Set to %TRUE if disk is about to fail. This value is read from the disk itself and does not include any interpretation. --> <property name="SmartFailing" type="b" access="read"/> <!-- SmartPowerOnSeconds: The amount of time the disk has been powered on (according to SMART data) or 0 if unknown. --> <property name="SmartPowerOnSeconds" type="t" access="read"/> <!-- SmartTemperature: The temperature (in Kelvin) of the disk according to SMART data or 0 if unknown. --> <property name="SmartTemperature" type="d" access="read"/> <!-- SmartNumAttributesFailing: The number of attributes failing right now or -1 if unknown. --> <property name="SmartNumAttributesFailing" type="i" access="read"/> <!-- SmartNumAttributesFailedInThePast: The number of attributes that have failed in the past or -1 if unknown. --> <property name="SmartNumAttributesFailedInThePast" type="i" access="read"/> <!-- SmartNumBadSectors: The number of bad sectors (ie. pending and reallocated) or -1 if unknown. --> <property name="SmartNumBadSectors" type="x" access="read"/> <!-- SmartSelftestStatus: The status of the last self-test. Known values include <variablelist> <varlistentry><term>success</term> <listitem><para>Last self-test was a success (or never ran).</para></listitem></varlistentry> <varlistentry><term>aborted</term> <listitem><para>Last self-test was aborted.</para></listitem></varlistentry> <varlistentry><term>interrupted</term> <listitem><para>Last self-test was interrupted.</para></listitem></varlistentry> <varlistentry><term>fatal</term> <listitem><para>Last self-test did not complete.</para></listitem></varlistentry> <varlistentry><term>error_unknown</term> <listitem><para>Last self-test failed (Unknown).</para></listitem></varlistentry> <varlistentry><term>error_electrical</term> <listitem><para>Last self-test failed (Electrical).</para></listitem></varlistentry> <varlistentry><term>error_servo</term> <listitem><para>Last self-test failed (Servo).</para></listitem></varlistentry> <varlistentry><term>error_read</term> <listitem><para>Last self-test failed (Read).</para></listitem></varlistentry> <varlistentry><term>error_handling</term> <listitem><para>Last self-test failed (Damage).</para></listitem></varlistentry> <varlistentry><term>inprogress</term> <listitem><para>Self-test is currently in progress.</para></listitem></varlistentry> </variablelist> --> <property name="SmartSelftestStatus" type="s" access="read"/> <!-- SmartSelftestPercentRemaining: The percent remaining or -1 if unknown. --> <property name="SmartSelftestPercentRemaining" type="i" access="read"/> <!-- SmartUpdate: @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>nowakeup</parameter> (of type 'b'). Reads SMART data from the drive and update relevant properties. If the option @nowakeup is given and the disk is in a sleeping state, the error <literal>org.freedesktop.UDisks2.Error.WouldWakeup</literal> is returned. The option @atasmart_blob can be used to inject libatasmart compatible blobs for testing how clients react to different kinds of SMART data. This option may be removed in the future without it being considered an ABI break. --> <method name="SmartUpdate"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- SmartGetAttributes: @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>nowakeup</parameter> (of type 'b'). @attributes: The SMART attributes. Get the SMART attributes. Each attribute is a struct with the following members: <variablelist> <varlistentry><term>id (type 'y')</term> <listitem><para>Attribute Identifier</para></listitem></varlistentry> <varlistentry><term>name (type 's')</term> <listitem><para>The identifier as a string.</para></listitem></varlistentry> <varlistentry><term>flags (type 'q')</term> <listitem><para>16-bit attribute flags (bit 0 is prefail/oldage, bit 1 is online/offline).</para></listitem></varlistentry> <varlistentry><term>value (type 'i')</term> <listitem><para>The current value or -1 if unknown.</para></listitem></varlistentry> <varlistentry><term>worst (type 'i')</term> <listitem><para>The worst value of -1 if unknown.</para></listitem></varlistentry> <varlistentry><term>threshold (type 'i')</term> <listitem><para>The threshold or -1 if unknown.</para></listitem></varlistentry> <varlistentry><term>pretty (type 'x')</term> <listitem><para>An interpretation of the value - must be ignored if @pretty_unit is 0.</para></listitem></varlistentry> <varlistentry><term>pretty_unit (type 'i')</term> <listitem><para>The unit of the @pretty value - the following units are known: 0 (unknown), 1 (dimensionless), 2 (milliseconds), 3 (sectors), 4 (millikelvin).</para></listitem></varlistentry> <varlistentry><term>expansion (type 'a{sv}')</term> <listitem><para>Currently unused. Intended for future expansion.</para></listitem></varlistentry> </variablelist> The @name parameter should be used as the authoritative identifier for the attribute since it is derived from the numerical @id and the disk's <literal>IDENTIFY</literal> data and thus handles ID collisions between drives of different make and model. --> <method name="SmartGetAttributes"> <arg name="options" direction="in" type="a{sv}"/> <arg name="attributes" direction="out" type="a(ysqiiixia{sv})"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<UDisks2::SmartAttribute>"/> </method> <!-- SmartSelftestStart: @type: The type test to run. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Starts a SMART selftest. The @type parameter is for the type of test to start - valid values are <literal>short</literal>, <literal>extended</literal> and <literal>conveyance</literal>. Note that the method returns immediately after the test has been started successfully. --> <method name="SmartSelftestStart"> <arg name="type" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- SmartSelftestAbort: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Aborts a running SMART selftest. --> <method name="SmartSelftestAbort"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- SmartSetEnabled: @value: %TRUE to enable SMART, %FALSE to disable SMART. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @since: 2.0.0 Sets whether SMART is enabled for the drive. This setting is stored in the non-volatile memory in the drive itself and does not need to be refreshed every time the drive is powered on or connected. Since this may require authentication and thus may fail, it is implemented this way instead of the #org.freedesktop.UDisks2.Drive.Ata:SmartEnabled property being writable. --> <method name="SmartSetEnabled"> <arg name="value" direction="in" type="b"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- PmSupported: Whether the drive supports power management. --> <property name="PmSupported" type="b" access="read"/> <!-- PmEnabled: Whether power management is enabled. --> <property name="PmEnabled" type="b" access="read"/> <!-- ApmSupported: Whether the drive supports Advanced Power Management (APM). --> <property name="ApmSupported" type="b" access="read"/> <!-- ApmEnabled: Whether Advanced Power Management (APM) is enabled. --> <property name="ApmEnabled" type="b" access="read"/> <!-- AamSupported: Whether the drive supports Automatic Acoustic Management (AAM). --> <property name="AamSupported" type="b" access="read"/> <!-- AamEnabled: Whether Automatic Acoustic Management (AAM) is enabled. --> <property name="AamEnabled" type="b" access="read"/> <!-- AamVendorRecommendedValue: The vendor-recommended AAM value (or 0 if AAM is not supported). --> <property name="AamVendorRecommendedValue" type="i" access="read"/> <!-- WriteCacheSupported: @since: 2.0.0 Whether the drive supports configuring the write cache. --> <property name="WriteCacheSupported" type="b" access="read"/> <!-- WriteCacheEnabled: @since: 2.0.0 Whether the write-cache is enabled (or %FALSE if not supported). --> <property name="WriteCacheEnabled" type="b" access="read"/> <!-- ReadLookaheadSupported: @since: 2.1.7 Whether the drive supports configuring the read look-ahead. --> <property name="ReadLookaheadSupported" type="b" access="read"/> <!-- ReadLookaheadEnabled: @since: 2.1.7 Whether the read look-ahead is enabled (or %FALSE if not supported). --> <property name="ReadLookaheadEnabled" type="b" access="read"/> <!-- PmGetState: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @state: The current power state. Get the current power mode status. This is implemented as a method call as it involves sending a command from the host to the drive and no change notification is available. The format of @state is the result obtained from sending the ATA command <quote>CHECK POWER MODE</quote> to the drive. Known values include <variablelist> <varlistentry><term>0x00</term><listitem><para>Standby</para></listitem></varlistentry> <varlistentry><term>0x80</term><listitem><para>Idle</para></listitem></varlistentry> <varlistentry><term>0xff</term><listitem><para>Active/Idle</para></listitem></varlistentry> </variablelist> Typically user interfaces will report "Drive is spun down" if @state is 0x00 and "Drive is spun up" otherwise. --> <method name="PmGetState"> <arg name="options" direction="in" type="a{sv}"/> <arg name="state" direction="out" type="y"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- PmStandby: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Force the drive to immediately enter the low power consumption <emphasis>standby</emphasis> mode, usually causing it to spin down. This is done by sending the ATA command <quote>STANDBY IMMEDIATE</quote> to the drive. --> <method name="PmStandby"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- PmWakeup: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Force the drive to immediately wake up (exiting the low power consumption <emphasis>standby</emphasis> mode), usually causing it to spin up. This is done by reading data from the disk. --> <method name="PmWakeup"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- SecurityEraseUnitMinutes: The estimated amount of minutes it takes to complete the <quote>SECURITY ERASE UNIT</quote> command or 0 if this command is not available. If set to 510 it means that it takes at least 508 minutes to complete the operation. --> <property name="SecurityEraseUnitMinutes" type="i" access="read"/> <!-- SecurityEnhancedEraseUnitMinutes: The estimated amount of minutes it takes to complete the <quote>SECURITY ERASE UNIT</quote> command with enhanced mode specified or 0 if enhanced erase is not available. If set to 510 it means that it takes at least 508 minutes to complete the operation. --> <property name="SecurityEnhancedEraseUnitMinutes" type="i" access="read"/> <!-- SecurityFrozen: If set to %TRUE the unit is frozen. --> <property name="SecurityFrozen" type="b" access="read"/> <!-- SecurityEraseUnit: @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>enhanced</parameter> (of type 'b'). Does all the necessary checks and preparations and then sends the <quote>SECURITY ERASE UNIT</quote> command to the drive. If the option @enhanced is set to %TRUE an <emphasis>enhanced secure erase</emphasis> is requested. All data on the drive will be irrevocably erased. This operation takes either #org.freedesktop.UDisks2.Drive.Ata:SecurityEraseUnitMinutes or #org.freedesktop.UDisks2.Drive.Ata:SecurityEnhancedEraseUnitMinutes minutes to complete depending on whether the @enhanced option is %TRUE. --> <method name="SecurityEraseUnit"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Block: @short_description: Block device This interface represents a block device. This should not be confused with the #org.freedesktop.UDisks2.Drive interface that is used to represent disk drives. For example, the #org.freedesktop.UDisks2.Block interface is also used for block devices that do not correspond to drives at all (e.g. <ulink url="http://en.wikipedia.org/wiki/Loop_device">Loop Devices</ulink>). --> <interface name="org.freedesktop.UDisks2.Block"> <!-- Device: The special device file for the block device e.g. <filename>/dev/sda2</filename>. --> <property name="Device" type="ay" access="read"/> <!-- PreferredDevice: The special device file to present in the UI instead of the value of the #org.freedesktop.UDisks2.Block:Device property. For example this could be e.g. <filename>/dev/mapper/mpathk</filename> for a multipath device with special device file <filename>/dev/dm-9</filename>. --> <property name="PreferredDevice" type="ay" access="read"/> <!-- Symlinks: Known symlinks in <filename>/dev</filename> that points to the device file in the #org.freedesktop.UDisks2.Block:Device property. For example, this array could include symlinks such as <filename>/dev/disk/by-id/ata-INTEL_SSDSA2MH080G1GC_CVEM842101HD080DGN</filename> and <filename>/dev/disk/by-id/wwn-0x5001517387d61905</filename>. --> <property name="Symlinks" type="aay" access="read"> <annotation name="org.qtproject.QtDBus.QtTypeName" value="QByteArrayList"/> </property> <!-- DeviceNumber: The dev_t of the block device. --> <property name="DeviceNumber" type="t" access="read"/> <!-- Id: @since: 2.0.0 A unique and persistent identifier for the device or blank if no such identifier is available. For devices with fixed media, this identifier is derived from vital product data / UUIDs / serial numbers of the drive or construct (e.g. LVM or MD-RAID) the block device is part of. For devices with removable media, this identifier is derived from the medium currently inserted. This identifier is guaranteed to not include the slash character '/' (U+002F SOLIDUS) which means it can be used as a filename. Examples: <quote>by-id-ata-INTEL_SSDSA2MH080G1GC_CVEM842101HD080DGN</quote>, <quote>by-id-ata-ST1000LM024_HN-M101MBB_S2TBJA0C230233-part3</quote>, <quote>by-id-usb-Kingston_DataTraveler_2.0_0013729940C4F9A166250D3E-0:0</quote>, <quote>by-id-dm-name-luks-6d81fe85-26b1-4f8b-b834-405454c1cd46</quote>, <quote>by-id-dm-name-vg_thinkpad-lv_swap</quote>, <quote>by-label-HARRY_POTTER_SORCERERS_STONE-</quote>, <quote>by-uuid-D22D-08B8</quote>. --> <property name="Id" type="s" access="read"/> <!-- Size: The size of the block device. --> <property name="Size" type="t" access="read"/> <!-- ReadOnly: If %TRUE, the device can not be written to, only read from. --> <property name="ReadOnly" type="b" access="read"/> <!-- Drive: The #org.freedesktop.UDisks2.Drive object that the block device belongs to, or '/' if no such object exists. --> <property name="Drive" type="o" access="read"/> <!-- MDRaid: @since: 2.0.0 If the block device is a running MD-RAID array, this is set to the #org.freedesktop.UDisks2.MDRaid object that it correspond to. Is '/' if no such object exists. --> <property name="MDRaid" type="o" access="read"/> <!-- MDRaidMember: @since: 2.0.0 If the block device is a member of a MD-RAID array, this is set to the #org.freedesktop.UDisks2.MDRaid object that it correspond to. Is '/' if no such object exists. --> <property name="MDRaidMember" type="o" access="read"/> <!-- IdUsage: A result of probing for signatures on the block device. Known values include: <variablelist> <varlistentry> <term>filesystem</term> <listitem><para>Used for mountable filesystems</para></listitem> </varlistentry> <varlistentry> <term>crypto</term> <listitem><para>Used for e.g. LUKS devices</para></listitem> </varlistentry> <varlistentry> <term>raid</term> <listitem><para>Used for e.g. RAID members and LVM PVs</para></listitem> </varlistentry> <varlistentry> <term>other</term> <listitem><para>Something else was detected.</para></listitem> </varlistentry> </variablelist> If blank, no known signature was detected. This doesn't necessarily mean the device contains no structured data; it only means that no signature known to the probing code was detected. Applications should not rely on the value in this or the #org.freedesktop.UDisks2.Block:IdType property - instead, applications should check for whether the object in question implements interfaces such as e.g. #org.freedesktop.UDisks2.Filesystem, #org.freedesktop.UDisks2.Swapspace or #org.freedesktop.UDisks2.Encrypted. --> <property name="IdUsage" type="s" access="read"/> <!-- IdType: This property contains more information about the result of probing the block device. Its value depends of the value the #org.freedesktop.UDisks2.Block:IdUsage property: <variablelist> <varlistentry><term>filesystem</term> <listitem><para>The mountable file system that was detected (e.g. <literal>vfat</literal>).</para></listitem> </varlistentry> <varlistentry><term>crypto</term> <listitem><para>Encrypted data. Known values include <literal>crypto_LUKS</literal>.</para></listitem> </varlistentry> <varlistentry><term>raid</term> <listitem><para><ulink url="http://en.wikipedia.org/wiki/RAID">RAID</ulink> or similar. Known values include <literal>LVM2_member</literal> (for LVM2 components), <literal>linux_raid_member</literal> (for MD-RAID components.)</para></listitem> </varlistentry> <varlistentry><term>other</term> <listitem><para>Something else. Known values include <literal>swap</literal> (for swap space), <literal>suspend</literal> (data used when resuming from suspend-to-disk.</para></listitem> </varlistentry> </variablelist> See the note for the #org.freedesktop.UDisks2.Block:IdUsage property about usage. --> <property name="IdType" type="s" access="read"/> <!-- IdVersion: The version of the filesystem or other structured data on the block device. Do not make any assumptions about the format. This property is blank if there is no version or the version is unknown. --> <property name="IdVersion" type="s" access="read"/> <!-- IdLabel: The label of the filesystem or other structured data on the block device. This property is blank if there is no label or the label is unknown. --> <property name="IdLabel" type="s" access="read"/> <!-- IdUUID: The <ulink url="http://en.wikipedia.org/wiki/UUID">UUID</ulink> of the filesystem or other structured data on the block device. Do not make any assumptions about the UUID as its format depends on what kind of data is on the device. This property is blank if there is no UUID or the UUID is unknown. --> <property name="IdUUID" type="s" access="read"/> <!-- Configuration: The configuration for the device. This is an array of pairs of (@type, @details) where @type is a string identifying the configuration source (e.g. <literal>fstab</literal>) and @details contains the actual configuration data. Use the org.freedesktop.UDisks2.Block.AddConfigurationItem(), org.freedesktop.UDisks2.Block.RemoveConfigurationItem() and org.freedesktop.UDisks2.Block.UpdateConfigurationItem() methods to add, remove and update configuration items. Use org.freedesktop.UDisks2.Block.GetSecretConfiguration() to get the secrets (e.g. passphrases) that may be part of the configuration but isn't exported in this property for security reasons. For entries of type <literal>fstab</literal>, it means that the block device is referenced in the system-wide <filename>/etc/fstab</filename> file. Known configuration items for type <literal>fstab</literal> are <variablelist> <varlistentry> <term>fsname (type <literal>'ay'</literal>)</term> <listitem><para>The special device</para></listitem> </varlistentry> <varlistentry> <term>dir (type <literal>'ay'</literal>)</term> <listitem><para>The mount point</para></listitem> </varlistentry> <varlistentry> <term>type (type <literal>'ay'</literal>)</term> <listitem><para>The filesystem type</para></listitem> </varlistentry> <varlistentry> <term>opts (type <literal>'ay'</literal>)</term> <listitem><para>Options</para></listitem> </varlistentry> <varlistentry> <term>freq (type <literal>'i'</literal>)</term> <listitem><para>Dump frequency in days</para></listitem> </varlistentry> <varlistentry> <term>passno (type <literal>'i'</literal>)</term> <listitem><para>Pass number of parallel fsck</para></listitem> </varlistentry> </variablelist> For entries of type <literal>crypttab</literal>, it means that the block device is referenced in the system-wide <filename>/etc/crypttab</filename> file. Known configuration items for type <literal>crypttab</literal> are <variablelist> <varlistentry> <term>name (type <literal>'ay'</literal>)</term> <listitem><para>The name to set the device up as</para></listitem> </varlistentry> <varlistentry> <term>device (type <literal>'ay'</literal>)</term> <listitem><para>The special device</para></listitem> </varlistentry> <varlistentry> <term>passphrase-path (type <literal>'ay'</literal>)</term> <listitem><para>Either empty to specify that no password is set, otherwise a path to a file containing the encryption password. This may also point to a special device file in <filename>/dev</filename> such as <literal>/dev/random</literal>. </para></listitem> </varlistentry> <varlistentry> <term>passphrase-contents (type <literal>'ay'</literal>)</term> <listitem><para>The contents of the file containing the encryption password, if applicable. This is only available via the org.freedesktop.UDisks2.Block.GetSecretConfiguration() method.</para></listitem> </varlistentry> <varlistentry> <term>opts (type <literal>'ay'</literal>)</term> <listitem><para>Options</para></listitem> </varlistentry> </variablelist> For security reasons, when creating a new <literal>crypttab</literal> entry (via the org.freedesktop.UDisks2.Block.AddConfigurationItem() method), then the <option>passphrase-path</option> must reference an unexisting file in the <filename>/etc/luks-keys</filename> directory. --> <property name="Configuration" type="a(sa{sv})" access="read"> <annotation name="org.qtproject.QtDBus.QtTypeName" value="QList<QPair<QString, QVariantMap>>"/> </property> <!-- CryptoBackingDevice: The #org.freedesktop.UDisks2.Block object that is backing the device or <literal>/</literal> if unknown or if the block device is not the cleartext device for an encrypted device. --> <property name="CryptoBackingDevice" type="o" access="read"/> <!-- HintPartitionable: If %TRUE, the device is normally expected to be partitionable. Devices for which this is not the case include floppy drives, optical drives and LVM logical volumes. --> <property name="HintPartitionable" type="b" access="read"/> <!-- HintSystem: If %TRUE, the device is considered a <emphasis>system device</emphasis>. System devices are devices that require additional permissions to access. See <xref linkend="udisks.8"/> for how to influence the value of this property. --> <property name="HintSystem" type="b" access="read"/> <!-- HintIgnore: If %TRUE, the device should be hidden from users. See <xref linkend="udisks.8"/> for how to influence the value of this property. --> <property name="HintIgnore" type="b" access="read"/> <!-- HintAuto: If %TRUE, the device should be automatically started (e.g. mounted, unlocked etc.). See <xref linkend="udisks.8"/> for how to influence the value of this property. --> <property name="HintAuto" type="b" access="read"/> <!-- HintName: If not blank, the name to use when presenting the device. See <xref linkend="udisks.8"/> for how to influence the value of this property. --> <property name="HintName" type="s" access="read"/> <!-- HintIconName: If not blank, the icon name to use when presenting the device. The name must adhere to the <ulink url="http://www.freedesktop.org/wiki/Specifications/icon-theme-spec">freedesktop.org icon theme specification</ulink>. See <xref linkend="udisks.8"/> for how to influence the value of this property. --> <property name="HintIconName" type="s" access="read"/> <!-- HintSymbolicIconName: @since: 2.0.0 If not blank, the icon name to use when presenting the device using a symbolic icon. The name must adhere to the <ulink url="http://www.freedesktop.org/wiki/Specifications/icon-theme-spec">freedesktop.org icon theme specification</ulink>. See <xref linkend="udisks.8"/> for how to influence the value of this property. --> <property name="HintSymbolicIconName" type="s" access="read"/> <!-- UserspaceMountOptions: List of userspace mount options. --> <property name="UserspaceMountOptions" type="as" access="read"/> <!-- AddConfigurationItem: @item: The configuration item to add. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Adds a new configuration item. See the #org.freedesktop.UDisks2.Block:Configuration property for details about valid configuration items. Some fields can be omitted and will then receive default values. This is useful when passing configuration items to Format, for example, because the proper values are not known before the formatting is done. If 'fsname' is omitted in a 'fstab' entry, or 'device' is omitted in a 'crypttab' entry, it defaults to "UUID=..." when the block device has a filesystem UUID, or to the name of the device in the filesystem.. If 'name' is omitted in a 'crypttab' entry, it defaults to "luks-<UUID>". If 'passphrase-path' is omitted, it defaults to "/etc/luks-keys/<NAME>". If 'track-parents' is set to true in @item, then the 'opts' and 'options' fields will be augmented with "x-parent" elements, as appropriate. This will make @item appear in the ChildConfiguration properties, and will allow the 'tear-down' option of Format, DeletePartition, and other methods to remove this item reliably. --> <method name="AddConfigurationItem"> <arg name="item" direction="in" type="(sa{sv})"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QPair<QString, QVariantMap>"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- RemoveConfigurationItem: @item: The configuration item to remove. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Removes an existing configuration item. See the #org.freedesktop.UDisks2.Block:Configuration property for details about valid configuration items. --> <method name="RemoveConfigurationItem"> <arg name="item" direction="in" type="(sa{sv})"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QPair<QString, QVariantMap>"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- UpdateConfigurationItem: @old_item: The configuration item to remove. @new_item: The configuration item to add. Must be of the same type as @old_item. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Removes a configuration item and adds a new one. This is equivalent to calling org.freedesktop.UDisks2.Block.RemoveConfigurationItem() followed by org.freedesktop.UDisks2.Block.AddConfigurationItem() with the change that only one PolicyKit check is made and that @new_item can be validated against @old_item. See the #org.freedesktop.UDisks2.Block:Configuration property for details about valid configuration items. --> <method name="UpdateConfigurationItem"> <arg name="old_item" direction="in" type="(sa{sv})"/> <arg name="new_item" direction="in" type="(sa{sv})"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QPair<QString, QVariantMap>"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QPair<QString, QVariantMap>"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/> </method> <!-- GetSecretConfiguration: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @configuration: The resulting configuration. Returns the same value as in the #org.freedesktop.UDisks2.Block:Configuration property but without secret information filtered out. --> <method name="GetSecretConfiguration"> <arg name="options" direction="in" type="a{sv}"/> <arg name="configuration" direction="out" type="a(sa{sv})"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<QPair<QString, QVariantMap>>"/> </method> <!-- Format: @type: The type of file system, partition table or other content to format the device with. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>label</parameter> (of type 's'), <parameter>take-ownership</parameter> (of type 'b'), <parameter>encrypt.passphrase</parameter> (of type 's' or 'ay'), <parameter>encrypt.type</parameter> (of type 's'), <parameter>erase</parameter> (of type 's'), <parameter>no-block</parameter> (of type 'b') and <parameter>update-partition-type</parameter> (of type 'b'). Formats the device with a file system, partition table or other well-known content. Known values for @type includes <constant>empty</constant> (to just zero out areas of the device known to host file system signatures) and <constant>swap</constant> (Linux swap space) and most file systems supported by the <citerefentry><refentrytitle>mkfs</refentrytitle><manvolnum>8</manvolnum></citerefentry> program through its <option>-t</option> option. Known partition table formats includes <constant>dos</constant> and <constant>gpt</constant>. If @type supports it, you can specify a label with the <parameter>label</parameter> option in the @options parameter; however, note that this may not be supported on all file systems and, if supported, the maximum allowed length may vary. If the file system in question supports owners and the option <parameter>take-ownership</parameter> is set to %TRUE then the root directory of the created file system will be owned by the caller of this method. If the option <parameter>encrypt.passphrase</parameter> is given then a LUKS device is created with the given passphrase and the file system is created on the unlocked device. The unlocked device will be left open. This parameter can be used to supply the binary contents of an arbitrary keyfile by passing a value of type <quote>ay</quote>. Option <parameter>encrypt.type</parameter> can be used to specify encryption "technology" that will be used. Currently only <quote>luks1</quote> and <quote>luks2</quote> are supported. If the option <parameter>erase</parameter> is used then the underlying device will be erased. Valid values include <quote>zero</quote> to write zeroes over the entire device before formatting, <quote>ata-secure-erase</quote> to perform a secure erase or <quote>ata-secure-erase-enhanced</quote> to perform an enhanced secure erase. If the option <parameter>update-partition-type</parameter> is set to %TRUE and the object in question is a partition, then its type (cf. the #org.freedesktop.UDisks2.Partition:Type property) will be set to the <emphasis>natural</emphasis> partition type matching @type, if any. For example, if formatting a GPT partition with a FAT filesystem, the <quote>Microsoft Basic Data</quote> partition type will be chosen; similar, if formatting a DOS partition with a Ext4 filesystem then partition type 0x83 is chosen. If the option <parameter>no-block</parameter> is set to %TRUE then the method returns just before the actual formatting takes place but after authorization and other checks are done. This is useful for applications that want to format several devices in parallel. If the option <parameter>dry-run-first</parameter> is set to %TRUE then a dry run of the formatting command is performed first, if Udisks knows how to do that. The idea is that this allows a deeper check of the parameters even when <parameter>no-block</parameter> is %TRUE. If the option <parameter>no-discard</parameter> is set to %TRUE then Udisks tells the formatting utility not to issue BLKDISCARD ioctls. If the option <parameter>config-items</parameter> is set, it should be an array of configuration items suitable for org.freedesktop.UDisks2.Block.AddConfigurationItem. They will all be added after the formatting is done. If the option <parameter>tear-down</parameter> is set to %TRUE, then the block device and all its children will be cleaned up before formatting. This cleanup consists of removing entries from /etc/fstab and /etc/crypttab, and locking of encrypted block devices. Entries in /etc/fstab and /etc/crypttab that have been created with the 'track-parents' options to AddConfigurationItem will be removed even if their block device is currently unavailable. --> <method name="Format"> <arg name="type" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- OpenForBackup: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @fd: An index for the returned file descriptor. Gets a read-only file descriptor for the device intended for a byte-by-byte imaging of the device. This can only be done if the device is not already in use. <emphasis>This method is deprecated since 2.7.3.</emphasis> Use org.freedesktop.UDisks2.Block.OpenDevice() with <literal>O_EXCL</literal> and <literal>O_CLOEXEC</literal> flags instead. --> <method name="OpenForBackup"> <annotation name="org.gtk.GDBus.C.UnixFD" value="1"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="fd" direction="out" type="h"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- OpenForRestore: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @fd: An index for the returned file descriptor. Gets a writable file descriptor for the device intended for a byte-by-byte restore of a disk image onto the device. This can only be done if the device is not already in use. <emphasis>This method is deprecated since 2.7.3.</emphasis> Use org.freedesktop.UDisks2.Block.OpenDevice() with <literal>O_EXCL</literal>, <literal>O_SYNC</literal> and <literal>O_CLOEXEC</literal> flags instead. --> <method name="OpenForRestore"> <annotation name="org.gtk.GDBus.C.UnixFD" value="1"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="fd" direction="out" type="h"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- OpenForBenchmark: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @fd: An index for the returned file descriptor. Gets a file descriptor for the device that is suitable to be used for benchmarking the device (transfer rate, access time etc.). Note that the file descriptor may be opened with the <literal>O_DIRECT</literal> and <literal>O_SYNC</literal> flags so care must be taken to only perform block-aligned I/O. If the <parameter>writable</parameter> in @options is %TRUE then the returned file descriptor will be writable. This only works if the device is not already in use. <emphasis>This method is deprecated since 2.7.3.</emphasis> Use org.freedesktop.UDisks2.Block.OpenDevice() with <literal>O_DIRECT</literal>, <literal>O_SYNC</literal> and <literal>O_CLOEXEC</literal> flags instead. --> <method name="OpenForBenchmark"> <annotation name="org.gtk.GDBus.C.UnixFD" value="1"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="fd" direction="out" type="h"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- OpenDevice: @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>flags</parameter> (of type 'i') @mode: Mode: "r" for read-only, "w" for write-only or "rw" for read-write @fd: An index for the returned file descriptor. @since: 2.7.3 Option <parameter>flags</parameter> can be used to specify additional flags. See <literal>man 2 open</literal> for list of supported flags. <literal>O_RDONLY</literal>, <literal>O_WRONLY</literal> and <literal>O_RDWR</literal> are not allowed, use @mode instead. Gets a file descriptor for the device. --> <method name="OpenDevice"> <annotation name="org.gtk.GDBus.C.UnixFD" value="1"/> <arg name="mode" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="fd" direction="out" type="h"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- Rescan: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Request that the kernel and core OS rescans the contents of the device and update their state to reflect this (including things such as the <filename>/dev/disk/</filename> hierarchy of symlinks). This includes requesting that the kernel re-reads the partition table, if appropriate. This is usually not needed since the OS automatically does this when the last process with a writable file descriptor for the device closes it. --> <method name="Rescan"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.PartitionTable: @short_description: Block device containing a partition table This interface is used for #org.freedesktop.UDisks2.Block devices that contain a partition table. --> <interface name="org.freedesktop.UDisks2.PartitionTable"> <!-- prereq: org.freedesktop.UDisks2.Block --> <!-- Partitions: List of object paths of the #org.freedesktop.UDisks2.Partition objects that belongs to this partition table. @since: 2.7.2 --> <property name="Partitions" type="ao" access="read"/> <!-- Type: The type of partition table detected. Known values include: <variablelist> <varlistentry><term>dos</term><listitem><para><ulink url="http://en.wikipedia.org/wiki/Master_Boot_Record">Master Boot Record</ulink></para></listitem></varlistentry> <varlistentry><term>gpt</term><listitem><para><ulink url="http://en.wikipedia.org/wiki/GUID_Partition_Table">GUID Partition Table</ulink></para></listitem></varlistentry> </variablelist> If blank it means that a partition table was detected but its scheme is unknown. --> <property name="Type" type="s" access="read"/> <!-- CreatePartition: @offset: The desired offset where the partition should be created, in bytes. @size: The desired size of the partition, in bytes (0 for maximal size). @type: The type of partition to create (cf. the #org.freedesktop.UDisks2.Partition:Type property) or blank to use the default for the partition table type and OS. @name: The name for the new partition or blank if the partition table do not support names. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) include <parameter>partition-type</parameter> (of type 's'). @created_partition: An object path to the created block device object implementing the #org.freedesktop.UDisks2.Partition interface. Creates a new partition. Note that the created partition won't necessarily be created at the exact @offset but slightly behind due to disk geometry and other alignment constraints (e.g. 1MiB alignment). The newly created partition may also end up being slightly larger than the requested @size bytes for the same reasons. The maximal size can be automatically set by using 0 as size. For <literal>dos</literal> partition tables, the partition type can be set with the @partition-type option. Possible values are: "primary", "extended" or "logical". The newly created partition will be wiped of known filesystem signatures using the <citerefentry><refentrytitle>wipefs</refentrytitle><manvolnum>8</manvolnum></citerefentry> command. --> <method name="CreatePartition"> <arg name="offset" direction="in" type="t"/> <arg name="size" direction="in" type="t"/> <arg name="type" direction="in" type="s"/> <arg name="name" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="created_partition" direction="out" type="o"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QVariantMap"/> </method> <!-- CreatePartitionAndFormat: @offset: The desired offset where the partition should be created, in bytes. @size: The desired size of the partition, in bytes (0 for maximal size). @type: The type of partition to create (cf. the #org.freedesktop.UDisks2.Partition:Type property) or blank to use the default for the partition table type and OS. @name: The name for the new partition or blank if the partition table do not support names. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) include <parameter>partition-type</parameter> (of type 's'). @created_partition: An object path to the created block device object implementing the #org.freedesktop.UDisks2.Partition interface. @format_type: The type to use for Format. @format_options: Options for Format. This is a combination of #org.freedesktop.UDisks2.PartitionTable:CreatePartition and #org.freedesktop.UDisks2.Block:Format. After creating the partition, the resulting block device is formatted. --> <method name="CreatePartitionAndFormat"> <arg name="offset" direction="in" type="t"/> <arg name="size" direction="in" type="t"/> <arg name="type" direction="in" type="s"/> <arg name="name" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="format_type" direction="in" type="s"/> <arg name="format_options" direction="in" type="a{sv}"/> <arg name="created_partition" direction="out" type="o"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QVariantMap"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In6" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Partition: @short_description: Block device representing a partition This interface is used for #org.freedesktop.UDisks2.Block devices that represent entries in a partition table. --> <interface name="org.freedesktop.UDisks2.Partition"> <!-- prereq: org.freedesktop.UDisks2.Block --> <!-- Number: The number of the partition in the partition table. --> <property name="Number" type="u" access="read"/> <!-- Type: The type of the partition. For <literal>dos</literal> partition tables, this string is a hexadecimal number e.g. <literal>0x83</literal> or <literal>0xfd</literal>. For <literal>gpt</literal> partition tables this is the UUID e.g. <literal>ebd0a0a2-b9e5-4433-87c0-68b6b72699c7</literal>. --> <property name="Type" type="s" access="read"/> <!-- Flags: Flags describing the partition. Known flags for <literal>dos</literal> partitions include: <variablelist> <varlistentry><term>Bit 7</term><listitem><para>The partition is marked as bootable</para></listitem></varlistentry> </variablelist> Known flags for <literal>gpt</literal> partitions include: <variablelist> <varlistentry><term>Bit 0</term><listitem><para>System partition</para></listitem></varlistentry> <varlistentry><term>Bit 2</term><listitem><para>Legacy BIOS Bootable</para></listitem></varlistentry> <varlistentry><term>Bit 60</term><listitem><para>Read-only</para></listitem></varlistentry> <varlistentry><term>Bit 62</term><listitem><para>Hidden</para></listitem></varlistentry> <varlistentry><term>Bit 63</term><listitem><para>Do not automount</para></listitem></varlistentry> </variablelist> --> <property name="Flags" type="t" access="read"/> <!-- Offset: Offset of partition, in bytes. --> <property name="Offset" type="t" access="read"/> <!-- Size: Size of partition, in bytes. --> <property name="Size" type="t" access="read"/> <!-- Name: Label of partition or blank if not supported or unknown. --> <property name="Name" type="s" access="read"/> <!-- UUID: The UUID of the partition or blank if not supported or unknown. --> <property name="UUID" type="s" access="read"/> <!-- Table: The object path of the #org.freedesktop.UDisks2.PartitionTable object that the partition entry belongs to. --> <property name="Table" type="o" access="read"/> <!-- IsContainer: Set to %TRUE if the partition itself is a container for other partitions. For example, for <literal>dos</literal> partition tables, this applies to socalled <emphasis>extended partition</emphasis> (partitions of type <constant>0x05</constant>, <constant>0x0f</constant> or <constant>0x85</constant>) containing socalled <emphasis>logical partitions</emphasis>. --> <property name="IsContainer" type="b" access="read"/> <!-- IsContained: Set to %TRUE of the partition is contained in another partition. See the #org.freedesktop.UDisks2.Partition:IsContainer property for more information. --> <property name="IsContained" type="b" access="read"/> <!-- SetType: @type: New type to set. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Sets the partition type. See the #org.freedesktop.UDisks2.Partition:Type property for a description of known partition types. --> <method name="SetType"> <arg name="type" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- SetName: @name: New name to set. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Sets the partition name. --> <method name="SetName"> <arg name="name" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- SetFlags: @flags: New flags to set. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Sets the partition flags. See the #org.freedesktop.UDisks2.Partition:Flags property for a description of known flags. --> <method name="SetFlags"> <arg name="flags" direction="in" type="t"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- Resize: @size: New partition size in bytes, 0 for maximal size. @options: Options. @since 2.7.2 Resizes the partition. The partiton will not change its position but might be slightly bigger than requested due to sector counts and alignment (e.g. 1MiB). If the requested size can't be allocated it results in an error. The maximal size can automatically be set by using 0 as size. --> <method name="Resize"> <arg name="size" direction="in" type="t"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- Delete: @options: Options. Deletes the partition. If the option <parameter>tear-down</parameter> is set to %TRUE, then the block device and all its children will be cleaned up before formatting. This cleanup consists of removing entries from /etc/fstab and /etc/crypttab, and locking of encrypted block devices. Entries in /etc/fstab and /etc/crypttab that have been created with the 'track-parents' options to AddConfigurationItem will be removed even if their block device is currently unavailable. --> <method name="Delete"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Filesystem: @short_description: Block device containing a mountable filesystem This interface is used for #org.freedesktop.UDisks2.Block devices that contain a mountable filesystem. --> <interface name="org.freedesktop.UDisks2.Filesystem"> <!-- prereq: org.freedesktop.UDisks2.Block --> <!-- SetLabel: @label: The label to set. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Sets the filesystem label. --> <method name="SetLabel"> <arg name="label" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- MountPoints: An array of filesystems paths for where the file system on the device is mounted. If the device is not mounted, this array is empty. --> <property name="MountPoints" type="aay" access="read"> <annotation name="org.qtproject.QtDBus.QtTypeName" value="QByteArrayList"/> </property> <!-- Mount: @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>fstype</parameter> (of type 's') and <parameter>options</parameter> (of type 's'). @mount_path: The filesystem path where the device was mounted. Mounts the filesystem. The directory the filesystem will be mounted in is determined by looking at data related to the device or filesystem (such the filesystem UUID and label) and will be created automatically except if the device the filesystem resides on is referenced in the <filename>/etc/fstab</filename> file, see below. In either case, the directory the filesystem is mounted in, is returned in @mount_path on success - it is usually a sub-directory of <filename class='directory'>/run/media/$USER</filename> but note that any directory may be returned. The filesystem type to use can be overridden with the @fstype option and mount options (a comma-separated string) can be given in @options option. Note that both the mount options and filesystem types are validated against a (small) whitelist to avoid unexpected privilege escalation If the device in question is referenced in the <filename>/etc/fstab</filename> file, the <command>mount</command> command is called directly (as root) and the given options or filesystem type given in @options are ignored. If <literal>x-udisks-auth</literal> is specified as an option for the device in the <filename>/etc/fstab</filename> file, then the <command>mount</command> command is run as the calling user, without performing any authorization check mentioned above. If this fails because of insufficient permissions, an authorization check is performed (which typically results in the user having to authenticate as an administrator). If authorized, the <command>mount</command> command is then run as root. The filesystem should be unmounted using the org.freedesktop.UDisks2.Filesystem.Unmount() method. If the device is removed without being unmounted (e.g. the user yanking the device or pulling the media out) or unmounted in a way that bypasses the org.freedesktop.UDisks2.Filesystem.Unmount() method (e.g. unmounted by the super-user by using the <citerefentry><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry> command directly), the device will be unmounted (if needed) and/or the mount point will be cleaned up. --> <method name="Mount"> <arg name="options" direction="in" type="a{sv}"/> <arg name="mount_path" direction="out" type="s"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- Unmount: @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>force</parameter> (of type 'b'). Unmount a mounted device. If the device in question was mounted by the calling user via the org.freedesktop.UDisks2.Filesystem.Mount() method the filesystem is unmounted without any authorization checks. Otherwise, an authorization check is performed (which typically results in the user having to authenticate as an administrator). If authorized, the filesystem is unmounted. If the mountpoint was previously created by udisks it is guaranteed it will be removed upon returning from this method call. If the filesystem is busy, this operation fails with the error <link linkend="UDISKS-ERROR-DEVICE-BUSY:CAPS"><constant>org.freedesktop.UDisks2.Error.DeviceBusy</constant></link> unless the @force option is used. --> <method name="Unmount"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- Size: The size of the filesystem. This is the amount of bytes used on the block device. If this is smaller than org.freedesktop.Udisks2.Block.Size, then the filesystem can be made larger with Resize. If the size is unknown, the property is zero. --> <property name="Size" type="t" access="read"/> <!-- Resize: @size: The target size in bytes, 0 for maximum. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @since: 2.7.2 Resizes the filesystem. Shrinking operations need to move data which causes this action to be slow. The filesystem-resize job for the object might expose progress. --> <method name="Resize"> <arg name="size" direction="in" type="t"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- Check: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @consistent: Whether the filesystem is undamaged. @since: 2.7.2 Checks the filesystem for consistency. Unsupported filesystems result in an error. --> <method name="Check"> <arg name="options" direction="in" type="a{sv}"/> <arg name="consistent" direction="out" type="b"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- Repair: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). @repaired: Whether the filesystem could be successfully repaired. @since: 2.7.2 Tries to repair the filesystem. Unsupported filesystems result in an error. --> <method name="Repair"> <arg name="options" direction="in" type="a{sv}"/> <arg name="repaired" direction="out" type="b"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- TakeOwnership: @options: Options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>recursive</parameter> (of type 'b'). @since: 2.7.2 Changes ownership of the filesystem to the UID and GID of the calling user. Filesystems that don't support ownership result in an error. --> <method name="TakeOwnership"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Swapspace: @short_description: Block device containing swap data This interface is used for #org.freedesktop.UDisks2.Block devices that contain swap space. --> <interface name="org.freedesktop.UDisks2.Swapspace"> <!-- prereq: org.freedesktop.UDisks2.Block --> <!-- Active: Set to %TRUE if the device is currently in use by the OS. --> <property name="Active" type="b" access="read"/> <!-- Start: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Activates the swap device. --> <method name="Start"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- Stop: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Deactivates the swap device. --> <method name="Stop"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- SetLabel: @label: The label to set. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Set label for the swap device. --> <method name="SetLabel"> <arg name="label" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Encrypted: @short_description: Block device containing encrypted data This interface is used for #org.freedesktop.UDisks2.Block devices that contain encrypted data. --> <interface name="org.freedesktop.UDisks2.Encrypted"> <!-- prereq: org.freedesktop.UDisks2.Block --> <!-- ChildConfiguration: Configuration items belonging to the clear text device of this encrypted block device and its children. This is also valid when this block device is currently locked and there is no clear text device for it. It works via the 'track-parents' options of org.freedesktop.UDisks2.Block.AddConfigurationItem(), which see. --> <property name="ChildConfiguration" type="a(sa{sv})" access="read"> <annotation name="org.qtproject.QtDBus.QtTypeName" value="QList<QPair<QString, QVariantMap>>"/> </property> <!-- HintEncryptionType: If not blank, the type of the encryption used to encrypt this device. This is set during successful unlocking of an encrypted device. It is required for encryption types which can only be determined by decrypting the device (for example TCRYPT), but is used for all encryption types for consistency reasons. --> <property name="HintEncryptionType" type="s" access="read"/> <!-- MetadataSize: Size of the metadata on the encrypted device in bytes --> <property name="MetadataSize" type="t" access="read"/> <!-- CleartextDevice: For an unlocked device, the object path of its cleartext device. --> <property name="CleartextDevice" type="o" access="read"/> <!-- Unlock: @passphrase: The passphrase to use. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>keyfile_contents</parameter> (of type 'ay') which is preferred over @passphrase if specified. @cleartext_device: An object path to the unlocked object implementing the #org.freedesktop.UDisks2.Block interface. Tries to unlock the encrypted device using @passphrase. If the device in question is referenced in a system-wide configuration file (such as the <filename>/etc/crypttab</filename> file), then name, options and passphrase (if available) is used from that file after requesting additional authorization. If an empty passphrase should be used to unlock the device, it has to be passed using the @keyfile_contents parameter. Empty string passed as @passphrase means "Use the passphrase from the configuration file". If the device is removed without being locked (e.g. the user yanking the device or pulling the media out) the cleartext device will be cleaned up. --> <method name="Unlock"> <arg name="passphrase" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <arg name="cleartext_device" direction="out" type="o"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- Lock: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Locks the encrypted device. --> <method name="Lock"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- ChangePassphrase: @passphrase: The existing passphrase. @new_passphrase: The new passphrase to use. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>old_keyfile_contents</parameter> and <parameter>new_keyfile_contents</parameter> (of type 's' or 'ay'). Changes the passphrase to @new_passphrase. An existing passphrase is required. If <parameter>old_keyfile_contents</parameter> or <parameter>new_keyfile_contents</parameter> are given, they take precedence over the corresponding passphrase parameters individually. If the device in question is referenced in a system-wide configuration file (such as the <filename>/etc/crypttab</filename> file) and this configuration references the passphrase, it is not automatically updated. --> <method name="ChangePassphrase"> <arg name="passphrase" direction="in" type="s"/> <arg name="new_passphrase" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/> </method> <!-- Resize: @size: The target cleartext size in bytes, 0 for maximum. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>passphrase</parameter> (of type 's') and <parameter>keyfile_contents</parameter> (of type 'ay') which is preferred over @passphrase if specified. @since: 2.8.0 Resizes the encrypted device. The device must be unlocked. The given size is the target size for the cleartext device. You need to specify either @passphrase or @keyfile_contents for LUKS 2 devices that don't have verified key loaded in kernel keyring. --> <method name="Resize"> <arg name="size" direction="in" type="t"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Loop: @short_description: Block device backed by a file This interface is used for #org.freedesktop.UDisks2.Block devices that are loop devices. --> <interface name="org.freedesktop.UDisks2.Loop"> <!-- prereq: org.freedesktop.UDisks2.Block --> <!-- Delete: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Deletes the loop device. --> <method name="Delete"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- BackingFile: A path to the file that is backing the block device or blank if unknown. --> <property name="BackingFile" type="ay" access="read"/> <!-- Autoclear: If %TRUE, the kernel will automatically clear the loop device when the last closer closes the device. This typically happens when the loop device is unmounted. --> <property name="Autoclear" type="b" access="read"/> <!-- SetupByUID: The id of the user who set up the loop device or 0 if set up by root or not through udisks. --> <property name="SetupByUID" type="u" access="read"/> <!-- SetAutoclear: @value: The new value of autoclear. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Setter for the #org.freedesktop.UDisks2.Loop:Autoclear property. Since this may require authentication and thus may fail, it is implemented this way instead of the property being writable. --> <method name="SetAutoclear"> <arg name="value" direction="in" type="b"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.MDRaid: @short_description: Linux Software RAID @since: 2.0.0 Objects implementing this interface represent <ulink url="https://raid.wiki.kernel.org/index.php/Linux_Raid">Linux Software RAID arrays</ulink> detected on the system. Both running and not-running arrays are represented. Block devices point to objects implementing this interface, see the #org.freedesktop.UDisks2.Block:MDRaid and #org.freedesktop.UDisks2.Block:MDRaidMember properties on the #org.freedesktop.UDisks2.Block D-Bus interface. --> <interface name="org.freedesktop.UDisks2.MDRaid"> <!-- UUID: The UUID of the array. --> <property name="UUID" type="s" access="read"/> <!-- Name: The name of the array (TODO: homehost etc). --> <property name="Name" type="s" access="read"/> <!-- Level: The RAID level. Known values include <literal>raid0</literal>, <literal>raid1</literal>, <literal>raid4</literal>, <literal>raid5</literal>, <literal>raid6</literal> and <literal>raid10</literal>. --> <property name="Level" type="s" access="read"/> <!-- NumDevices: Number of devices that are part of the array. --> <property name="NumDevices" type="u" access="read"/> <!-- Size: The size of the array or 0 if unknown. This is the usable size, e.g. for a RAID-5 array backed by 4 1TB disks, this will be approximately 3 TB. --> <property name="Size" type="t" access="read"/> <!-- SyncAction: The current state of the array or empty if the array is not running or if the array does not have any redundancy (e.g. RAID-0 or linear). Use the org.freedesktop.UDisks2.MDRaid.RequestSyncAction() method to change this. This property corresponds to the <literal>sync_action</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="SyncAction" type="s" access="read"/> <!-- SyncCompleted: The fraction or sectors completed (always between <constant>0.0</constant> and <constant>1.0</constant>) in the sync operation or 0.0 if no operation is in progress. This property corresponds to the <literal>sync_completed</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="SyncCompleted" type="d" access="read"/> <!-- SyncRate: The rate (or speed) at which the sync operation takes place. It is averaged over the last 30 seconds and measured in bytes per second. If the rate is unknown or no operation is in progress, the value of this property is 0. This property corresponds to the <literal>sync_speed</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="SyncRate" type="t" access="read"/> <!-- SyncRemainingTime: The estimated number of micro-seconds until the operation is finished If the amount of remaining time is unknown or no operation is in progress, the value of this property is 0. This property is based on the value of the <literal>sync_speed</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="SyncRemainingTime" type="t" access="read"/> <!-- Degraded: Number of devices by which the array is degraded (0 if not degraded or not running). This property corresponds to the <literal>degraded</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="Degraded" type="u" access="read"/> <!-- BitmapLocation: The location of a write-intent bitmap (empty if the array is not running), if any. If the RAID array does not suppor write-intent bitmaps (for example RAID-0 arrays), this is empty. This property corresponds to the <literal>bitmap/location</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="BitmapLocation" type="ay" access="read"/> <!-- ChunkSize: The chunk size (0 if the array is not running or not using striping). This property corresponds to the <literal>chunk_size</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="ChunkSize" type="t" access="read"/> <!-- ActiveDevices: This property is an array with block devices that are currently associated with the with the array. It is empty if the array is not running. Each element of the array is a struct with the following members: <variablelist> <varlistentry><term>block (type 'o')</term> <listitem><para>The object path for the underlying block device (guaranteed to implement the #org.freedesktop.UDisks2.Block interface)</para></listitem></varlistentry> <varlistentry><term>slot (type 'i')</term> <listitem><para>-1 if the device is not currently part of the array (ie. <literal>spare</literal> or <literal>faulty</literal>), otherwise the slot number the device currently fills (between 0 and #org.freedesktop.UDisks2.MDRaid:NumDevices)</para></listitem></varlistentry> <varlistentry><term>state (type 'as')</term> <listitem><para>The state of the device - known elements include <literal>faulty</literal>, <literal>in_sync</literal>, <literal>write_mostly</literal>, <literal>blocked</literal> and <literal>spare</literal></para></listitem></varlistentry> <varlistentry><term>num_read_errors (type 't')</term> <listitem><para>An ongoing count of read errors that have been detected on this device but have not caused the device to be evicted from the array</para></listitem></varlistentry> <varlistentry><term>expansion (type 'a{sv}')</term> <listitem><para>Currently unused. Intended for future expansion.</para></listitem></varlistentry> </variablelist> This property correspond to the <filename>/sys/block/mdN/md/dev-*</filename> directories in sysfs and the sysfs files in each directory. See the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <property name="ActiveDevices" type="a(oiasta{sv})" access="read"> <annotation name="org.qtproject.QtDBus.QtTypeName" value="QList<UDisks2::ActiveDeviceInfo>"/> </property> <!-- ChildConfiguration: Configuration items belonging to the block devices of this array (recursively). This is also valid when the array is stopped and there are no actual block devices for it. It works via the 'track-parents' options of org.freedesktop.UDisks2.Block.AddConfigurationItem(), which see. --> <property name="ChildConfiguration" type="a(sa{sv})" access="read"> <annotation name="org.qtproject.QtDBus.QtTypeName" value="QList<QPair<QString, QVariantMap>>"/> </property> <!-- Running: Whether or not the array is considered running. It is an error to call Start on a running array, and Stop on a non-running array, for example. --> <property name="Running" type="b" access="read"/> <!-- Start: @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>start-degraded</parameter> (of type 'b'). Starts the RAID array. If the @option parameter contains the key @start-degraded with the value %TRUE, the array will be started even if some members are missing. --> <method name="Start"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- Stop: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Stops the RAID array. --> <method name="Stop"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- RemoveDevice: @device: An object path to an object implementing the #org.freedesktop.UDisks2.Block interface. @options: Options - known options (in addition to <link linkend="udisks-std-options">standard options</link>) includes <parameter>wipe</parameter> (of type 'b'). Removes @device from the array. For this to work @device must already be associated with the array, e.g. referenced in the #org.freedesktop.UDisks2.MDRaid:ActiveDevices property. If the @option parameter contains the key @wipe with the value %TRUE, all known filesystem signatures will be erased from the @device after removal. --> <method name="RemoveDevice"> <arg name="device" direction="in" type="o"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- AddDevice: @device: An object path to an object implementing the #org.freedesktop.UDisks2.Block interface. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Adds @device to the array. --> <method name="AddDevice"> <arg name="device" direction="in" type="o"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- SetBitmapLocation: @value: The value for the bitmap, currently only the values 'none' and 'internal' are supported. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Sets whether the array has a write-intent bitmap. --> <method name="SetBitmapLocation"> <arg name="value" direction="in" type="ay"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- RequestSyncAction: @sync_action: The action to request. @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). This method call can be used to trigger and cancel data redundancy checks and repairs. Currently only the values <literal>check</literal>, <literal>repair</literal> and <literal>idle</literal> can be used for @sync_action. See also the property #org.freedesktop.UDisks2.MDRaid:SyncAction. This method call is similar to writing to the <literal>sync_action</literal> sysfs file, see the <filename><ulink url="https://www.kernel.org/doc/Documentation/admin-guide/md.rst">Documentation/admin-guide/md.rst</ulink></filename> file shipped with the kernel sources. --> <method name="RequestSyncAction"> <arg name="sync_action" direction="in" type="s"/> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> </method> <!-- Delete: @options: Options. Stops the RAID array and destroys all RAID metadata on member devices. If the option <parameter>tear-down</parameter> is set to %TRUE, then the RAID array block device and all its children will be cleaned up before stopping. This cleanup consists of removing entries from /etc/fstab and /etc/crypttab, and locking of encrypted block devices. Entries in /etc/fstab and /etc/crypttab that have been created with the 'track-parents' options to AddConfigurationItem will be removed even if their block device is currently unavailable. --> <method name="Delete"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> </interface> <!-- ********************************************************************** --> <!-- org.freedesktop.UDisks2.Job: @short_description: Long-running tasks Some operations may take a long time (hours) to complete, that is, to actually send the D-Bus reply message back. One example of such an operation is the org.freedesktop.UDisks2.Block.Format() method that is used to format a block device. When such operations are initated, a job object implementing this interface may be created so the progress can be tracked by the caller (and also other observers). The object(s) that a job affects (such as block devices or drives) can be determined by looking at the #org.freedesktop.UDisks2.Job:Objects property. Among other things, this can be used to draw a spinner in the user interface next to e.g. an icon for the drive or device in question. The #org.freedesktop.UDisks2.Job:Operation property is used to convey the type of job currently in progress. The user id of the user who started the job is set in the #org.freedesktop.UDisks2.Job:StartedByUID property. A job <emphasis>may</emphasis> convey how much progress has been made, see the #org.freedesktop.UDisks2.Job:Progress and #org.freedesktop.UDisks2.Job:ProgressValid properties. When a job completes, the #org.freedesktop.UDisks2.Job::Completed signal is emitted. A job may or may not be cancelable, see the #org.freedesktop.UDisks2.Job:Cancelable property. To cancel a job use the org.freedesktop.UDisks2.Job.Cancel() method. This will cause the job to complete (with @success set to %FALSE) and the D-Bus method used to initiate the operation to return, usually returning the <literal>org.freedesktop.UDisks2.Error.Cancelled</literal> error. Once cancellation is requested it may take some time before the job is actually completed as there might be ongoing I/O. --> <interface name="org.freedesktop.UDisks2.Job"> <!-- Operation: The type of the operation that the job represents. Known job operation types include: <variablelist> <varlistentry><term>ata-smart-selftest</term> <listitem><para>SMART self-test operation.</para></listitem></varlistentry> <varlistentry><term>drive-eject</term> <listitem><para>Ejecting the medium from a drive.</para></listitem></varlistentry> <varlistentry><term>encrypted-unlock</term> <listitem><para>Unlocking encrypted device.</para></listitem></varlistentry> <varlistentry><term>encrypted-lock</term> <listitem><para>Locking encrypted device.</para></listitem></varlistentry> <varlistentry><term>encrypted-modify</term> <listitem><para>Modifying encrypted device.</para></listitem></varlistentry> <varlistentry><term>encrypted-resize</term> <listitem><para>Resizing encrypted device.</para></listitem></varlistentry> <varlistentry><term>swapspace-start</term> <listitem><para>Starting swapspace.</para></listitem></varlistentry> <varlistentry><term>swapspace-stop</term> <listitem><para>Stopping swapspace.</para></listitem></varlistentry> <varlistentry><term>swapspace-modify</term> <listitem><para>Modifying swapspace.</para></listitem></varlistentry> <varlistentry><term>filesystem-mount</term> <listitem><para>Mounting a filesystem.</para></listitem></varlistentry> <varlistentry><term>filesystem-unmount</term> <listitem><para>Unmounting a filesystem.</para></listitem></varlistentry> <varlistentry><term>filesystem-modify</term> <listitem><para>Modifying a filesystem.</para></listitem></varlistentry> <varlistentry><term>filesystem-resize</term> <listitem><para>Resizing a filesystem.</para></listitem></varlistentry> <varlistentry><term>format-erase</term> <listitem><para>Erasing a device.</para></listitem></varlistentry> <varlistentry><term>format-mkfs</term> <listitem><para>Creating a filesystem.</para></listitem></varlistentry> <varlistentry><term>loop-setup</term> <listitem><para>Setting up a loop device.</para></listitem></varlistentry> <varlistentry><term>partition-modify</term> <listitem><para>Modifying a partition.</para></listitem></varlistentry> <varlistentry><term>partition-delete</term> <listitem><para>Deleting a partition.</para></listitem></varlistentry> <varlistentry><term>partition-create</term> <listitem><para>Creating a partition.</para></listitem></varlistentry> <varlistentry><term>cleanup</term> <listitem><para>Cleaning up devices that were removed without being properly unmounted or shut down.</para></listitem></varlistentry> <varlistentry><term>ata-secure-erase</term> <listitem><para>ATA Secure Erase.</para></listitem></varlistentry> <varlistentry><term>ata-enhanced-secure-erase</term> <listitem><para>ATA Enhanced Secure Erase.</para></listitem></varlistentry> <varlistentry><term>md-raid-stop</term> <listitem><para>Stopping a RAID Array.</para></listitem></varlistentry> <varlistentry><term>md-raid-start</term> <listitem><para>Starting a RAID Array.</para></listitem></varlistentry> <varlistentry><term>md-raid-fault-device</term> <listitem><para>Marking device in RAID Array as faulty.</para></listitem></varlistentry> <varlistentry><term>md-raid-remove-device</term> <listitem><para>Removing device from RAID Array.</para></listitem></varlistentry> <varlistentry><term>md-raid-create</term> <listitem><para>Create a RAID Array.</para></listitem></varlistentry> </variablelist> The <link linkend="udisks-client-get-job-description">udisks_client_get_job_description()</link> function can be used to get a localized human readable description. --> <property name="Operation" type="s" access="read"/> <!-- Progress: How much progress has been made. Values are in the range 0 to 1. Do not use unless #org.freedesktop.UDisks2.Job:ProgressValid is %TRUE. --> <property name="Progress" type="d" access="read"/> <!-- ProgressValid: Set to %TRUE if the #org.freedesktop.UDisks2.Job:Progress is valid. --> <property name="ProgressValid" type="b" access="read"/> <!-- Bytes: @since: 2.0.0 If the job involves processing a known number of bytes (for example, erasing a disk), this property contains the total number of bytes to process. If not, the value of this property is zero. The intent of this property is for user interfaces to convey information such as <quote>123 GB of 1.0 TB completed</quote>. --> <property name="Bytes" type="t" access="read"/> <!-- Rate: @since: 2.0.0 If the job involves processing a number of bytes (for example, erasing) and the rate at which the processing takes place is known, this property contains the rate (measured in bytes per second). Otherwise the value of this property is zero. The intent of this property is for user interfaces to convey information such as <quote>110 MB/sec</quote>. --> <property name="Rate" type="t" access="read"/> <!-- StartTime: The point in time (micro-seconds since the <ulink url="http://en.wikipedia.org/wiki/Unix_epoch">Unix Epoch</ulink>) that the job was started. --> <property name="StartTime" type="t" access="read"/> <!-- ExpectedEndTime: The expected point in time (micro-seconds since the <ulink url="http://en.wikipedia.org/wiki/Unix_epoch">Unix Epoch</ulink>) that the job will complete or 0 if unknown. --> <property name="ExpectedEndTime" type="t" access="read"/> <!-- Objects: The objects that the job is related to, if any. --> <property name="Objects" type="ao" access="read"/> <!-- StartedByUID: The id of the user who started the job or 0 if started by root or not through udisks. --> <property name="StartedByUID" type="u" access="read"/> <!-- Cancel: @options: Options (currently unused except for <link linkend="udisks-std-options">standard options</link>). Cancels the job. Fails with the <literal>org.freedesktop.UDisks2.Error.Failed</literal> error if #org.freedesktop.UDisks2.Job:Cancelable is %FALSE. --> <method name="Cancel"> <arg name="options" direction="in" type="a{sv}"/> <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> </method> <!-- Cancelable: Whether the job can be canceled. --> <property name="Cancelable" type="b" access="read"/> <!-- Completed: @success: If %TRUE, the job completed successfully. @message: A message describing the completion of the job, e.g. an error message. Emitted when a job completes. --> <signal name="Completed"> <arg name="success" type="b"/> <arg name="message" type="s"/> </signal> </interface> <!-- ********************************************************************** --> </node> udisks2-qt5-5.0.6/debian/0000755000175100017510000000000014051331364015003 5ustar shuttleshuttleudisks2-qt5-5.0.6/debian/copyright0000644000175100017510000000174714051331364016747 0ustar shuttleshuttleFormat: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: deepin-anything Source: http://github.com/linuxdeepin/deepin-anything Files: * Copyright: 2018 Deepin.Inc License: LGPL-3+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/> . On Debian systems, the complete text of the GNU General Public License version 3 can be found in "/usr/share/common-licenses/LGPL-3". udisks2-qt5-5.0.6/debian/source/0000755000175100017510000000000014051331364016303 5ustar shuttleshuttleudisks2-qt5-5.0.6/debian/source/format0000644000175100017510000000001514051331364017512 0ustar shuttleshuttle3.0 (native) udisks2-qt5-5.0.6/debian/compat0000644000175100017510000000000214051331364016201 0ustar shuttleshuttle9 udisks2-qt5-5.0.6/debian/control0000644000175100017510000000116314051331364016407 0ustar shuttleshuttleSource: udisks2-qt5 Section: admin Priority: optional Maintainer: Deepin Package Builder <packages@deepin.com> Build-Depends: debhelper (>= 9), qtbase5-dev, pkg-config Standards-Version: 3.9.8 Homepage: http://github.com/linuxdeepin/udisks2-qt5 Package: libudisks2-qt5 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: UDisks2 library with Qt5 UDisks2 DBus interfaces binding of Qt5. Package: libudisks2-qt5-dev Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libudisks2-qt5( =${binary:Version}) Description: libudisks2-qt5 developer package UDisks2 DBus interfaces binding of Qt5. udisks2-qt5-5.0.6/debian/rules0000755000175100017510000000032414051331364016062 0ustar shuttleshuttle#!/usr/bin/make -f export QT_SELECT=5 %: dh $@ override_dh_installinit: true override_dh_auto_configure: dh_auto_configure -- VERSION=$(DEB_VERSION_UPSTREAM) LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) udisks2-qt5-5.0.6/debian/libudisks2-qt5.install0000644000175100017510000000002114051331364021146 0ustar shuttleshuttleusr/lib/*/*.so.* udisks2-qt5-5.0.6/debian/changelog0000644000175100017510000000022614051331364016655 0ustar shuttleshuttleudisks2-qt5 (0.0.1) unstable; urgency=medium * Initial release. -- Deepin Package Builder <packages@deepin.com> Tue, 26 Feb 2019 11:46:47 +0800 udisks2-qt5-5.0.6/debian/libudisks2-qt5-dev.install0000644000175100017510000000006314051331364021730 0ustar shuttleshuttleusr/include/* usr/lib/*/*.so usr/lib/*/pkgconfig/* udisks2-qt5-5.0.6/ddiskmanager.h0000644000175100017510000001034314051331364016364 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DDISKMANAGER_H #define DDISKMANAGER_H #include <QObject> #include <QMap> #include <QDBusError> QT_BEGIN_NAMESPACE class QDBusObjectPath; class QStorageInfo; QT_END_NAMESPACE class DBlockDevice; class DBlockPartition; class DDiskDevice; class DUDisksJob; class DDiskManagerPrivate; class DDiskManager : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(DDiskManager) Q_PROPERTY(bool watchChanges READ watchChanges WRITE setWatchChanges) public: explicit DDiskManager(QObject *parent = nullptr); ~DDiskManager(); Q_DECL_DEPRECATED_X("Use the static variant instead") QStringList blockDevices() const; QStringList diskDevices() const; static QStringList blockDevices(QVariantMap options); bool watchChanges() const; static QString objectPrintable(const QObject *object); static DBlockDevice *createBlockDevice(const QString &path, QObject *parent = nullptr); // device 路径以 '\0' 结尾 DBlockDevice *createBlockDeviceByDevicePath(const QByteArray &path, QObject *parent = nullptr) const; static DBlockPartition *createBlockPartition(const QString &path, QObject *parent = nullptr); // 挂载点以 '\0' 结尾 DBlockPartition *createBlockPartitionByMountPoint(const QByteArray &path, QObject *parent = nullptr) const; DBlockPartition *createBlockPartition(const QStorageInfo &info, QObject *parent = nullptr) const; static DDiskDevice *createDiskDevice(const QString &path, QObject *parent = nullptr); static DUDisksJob *createJob(const QString &path, QObject *parent = nullptr); static QStringList supportedFilesystems(); static QStringList supportedEncryptionTypes(); static QStringList resolveDevice(QVariantMap devspec, QVariantMap options); static QStringList resolveDeviceNode(QString devnode, QVariantMap options); static bool canCheck(const QString &type, QString *requiredUtil = nullptr); static bool canFormat(const QString &type, QString *requiredUtil = nullptr); static bool canRepair(const QString &type, QString *requiredUtil = nullptr); static bool canResize(const QString &type, QString *requiredUtil = nullptr); static QString loopSetup(int fd, QVariantMap options); static QDBusError lastError(); public Q_SLOTS: void setWatchChanges(bool watchChanges); Q_SIGNALS: void blockDeviceAdded(const QString &path); void blockDeviceRemoved(const QString &path); void diskDeviceAdded(const QString &path); void diskDeviceRemoved(const QString &path); void fileSystemAdded(const QString &blockDevicePath); void fileSystemRemoved(const QString &blockDevicePath); void mountAdded(const QString &blockDevicePath, const QByteArray &mountPoint); void mountRemoved(const QString &blockDevicePath, const QByteArray &mountPoint); void mountPointsChanged(const QString &blockDevicePath, const QByteArrayList &oldMountPoints, const QByteArrayList &newMountPoints); void jobAdded(const QString &jobPath); void opticalChanged(const QString &path); private: QScopedPointer<DDiskManagerPrivate> d_ptr; private Q_SLOTS: void onInterfacesAdded(const QDBusObjectPath &, const QMap<QString, QVariantMap> &); void onInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces); void onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties, const QDBusMessage &message); }; #endif // DDISKMANAGER_H udisks2-qt5-5.0.6/ddiskmanager.cpp0000644000175100017510000004004114051331364016715 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ddiskmanager.h" #include "udisks2_dbus_common.h" #include "udisks2_interface.h" #include "objectmanager_interface.h" #include "dblockdevice.h" #include "dblockpartition.h" #include "ddiskdevice.h" #include "dudisksjob.h" #include <QDBusInterface> #include <QDBusReply> #include <QXmlStreamReader> #include <QDBusMetaType> #include <QScopedPointer> #include <QDebug> const QString ManagerPath = "/org/freedesktop/UDisks2/Manager"; static int udisks2VersionCompare(const QString &version) { const QStringList &version_list = UDisks2::version().split("."); const QStringList &v_v_list = version.split("."); for (int i = 0; i < version_list.count(); ++i) { if (v_v_list.count() <= i) return -1; int number_v = version_list[i].toInt(); int number_v_v = v_v_list[i].toInt(); if (number_v == number_v_v) continue; return number_v_v > number_v ? 1 : -1; } return v_v_list.count() > version_list.count() ? 1 : 0; } // 2.1.7版本的UDisks2在U盘插入时没有drive device added的信号 // 当收到block device added信号后,通过diskDeviceAddSignalFlag // 判断此块设备对应的磁盘设备信号是否已发送,未发送时补发信号 // 风险:如果 diskDeviceAddSignalFlag 的值删除的不及时 // 会导致设备再插入时不会再有信号发出 static bool fixUDisks2DiskAddSignal() { static bool fix = udisks2VersionCompare("2.1.7.1") > 0; return fix; } class DDiskManagerPrivate { public: DDiskManagerPrivate(DDiskManager *qq); void updateBlockDeviceMountPointsMap(); bool watchChanges = false; QMap<QString, QByteArrayList> blockDeviceMountPointsMap; QSet<QString> diskDeviceAddSignalFlag; DDiskManager *q_ptr; }; DDiskManagerPrivate::DDiskManagerPrivate(DDiskManager *qq) : q_ptr(qq) { } void DDiskManagerPrivate::updateBlockDeviceMountPointsMap() { blockDeviceMountPointsMap.clear(); auto om = UDisks2::objectManager(); const QMap<QDBusObjectPath, QMap<QString, QVariantMap>> &objects = om->GetManagedObjects().value(); auto begin = objects.constBegin(); while (begin != objects.constEnd()) { const QString path = begin.key().path(); const QMap<QString, QVariantMap> object = begin.value(); ++begin; if (!path.startsWith(QStringLiteral("/org/freedesktop/UDisks2/block_devices/"))) { continue; } const QVariantMap &filesystem = object.value(QStringLiteral(UDISKS2_SERVICE ".Filesystem")); if (filesystem.isEmpty()) { continue; } blockDeviceMountPointsMap[path] = qdbus_cast<QByteArrayList>(filesystem.value("MountPoints")); } } void DDiskManager::onInterfacesAdded(const QDBusObjectPath &object_path, const QMap<QString, QVariantMap> &interfaces_and_properties) { const QString &path = object_path.path(); const QString &path_drive = QStringLiteral("/org/freedesktop/UDisks2/drives/"); const QString &path_device = QStringLiteral("/org/freedesktop/UDisks2/block_devices/"); const QString &path_job = QStringLiteral("/org/freedesktop/UDisks2/jobs/"); Q_D(DDiskManager); if (path.startsWith(path_drive)) { if (interfaces_and_properties.contains(QStringLiteral(UDISKS2_SERVICE ".Drive"))) { if (fixUDisks2DiskAddSignal()) { if (!d->diskDeviceAddSignalFlag.contains(path)) { d->diskDeviceAddSignalFlag.insert(path); // 防止flag未清除导致再也收不到此设备的信号 QTimer::singleShot(1000, this, [d, path] { d->diskDeviceAddSignalFlag.remove(path); }); Q_EMIT diskDeviceAdded(path); } } else { Q_EMIT diskDeviceAdded(path); } } } else if (path.startsWith(path_device)) { if (interfaces_and_properties.contains(QStringLiteral(UDISKS2_SERVICE ".Block"))) { if (fixUDisks2DiskAddSignal()) { QScopedPointer<DBlockDevice> bd(createBlockDevice(path)); const QString &drive = bd->drive(); if (!d->diskDeviceAddSignalFlag.contains(drive)) { d->diskDeviceAddSignalFlag.insert(drive); // 防止flag未清除导致再也收不到此设备的信号 QTimer::singleShot(1000, this, [d, drive] { d->diskDeviceAddSignalFlag.remove(drive); }); Q_EMIT diskDeviceAdded(drive); } } Q_EMIT blockDeviceAdded(path); } if (interfaces_and_properties.contains(QStringLiteral(UDISKS2_SERVICE ".Filesystem"))) { Q_D(DDiskManager); d->blockDeviceMountPointsMap.remove(object_path.path()); Q_EMIT fileSystemAdded(path); } } else if (path.startsWith(path_job)) { if (interfaces_and_properties.contains(QStringLiteral(UDISKS2_SERVICE ".Job"))) { Q_EMIT jobAdded(path); } } } void DDiskManager::onInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces) { const QString &path = object_path.path(); Q_D(DDiskManager); for (const QString &i : interfaces) { if (i == QStringLiteral(UDISKS2_SERVICE ".Drive")) { d->diskDeviceAddSignalFlag.remove(path); Q_EMIT diskDeviceRemoved(path); } else if (i == QStringLiteral(UDISKS2_SERVICE ".Filesystem")) { d->blockDeviceMountPointsMap.remove(object_path.path()); Q_EMIT fileSystemRemoved(path); } else if (i == QStringLiteral(UDISKS2_SERVICE ".Block")) { Q_EMIT blockDeviceRemoved(path); } } } void DDiskManager::onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties, const QDBusMessage &message) { Q_D(DDiskManager); const QString &path = message.path(); if (changed_properties.contains("Optical")) { Q_EMIT opticalChanged(path); } if (interface != UDISKS2_SERVICE ".Filesystem") { return; } if (!changed_properties.contains("MountPoints")) { return; } const QByteArrayList old_mount_points = d->blockDeviceMountPointsMap.value(path); const QByteArrayList &new_mount_points = qdbus_cast<QByteArrayList>(changed_properties.value("MountPoints")); d->blockDeviceMountPointsMap[path] = new_mount_points; Q_EMIT mountPointsChanged(path, old_mount_points, new_mount_points); if (old_mount_points.isEmpty()) { if (!new_mount_points.isEmpty()) { Q_EMIT mountAdded(path, new_mount_points.first()); } } else if (new_mount_points.isEmpty()) { Q_EMIT mountRemoved(path, old_mount_points.first()); } } /*! * \class DDiskManager * \inmodule dde-file-manager-lib * * \brief DDiskManager provide severial ways to manage devices and partitions. * * \sa DBlockPartition, DBlockDevice, UDiskDeviceInfo */ DDiskManager::DDiskManager(QObject *parent) : QObject(parent) , d_ptr(new DDiskManagerPrivate(this)) { } DDiskManager::~DDiskManager() { } static QStringList getDBusNodeNameList(const QString &service, const QString &path, const QDBusConnection &connection) { QDBusInterface ud2(service, path, "org.freedesktop.DBus.Introspectable", connection); QDBusReply<QString> reply = ud2.call("Introspect"); QXmlStreamReader xml_parser(reply.value()); QStringList nodeList; while (!xml_parser.atEnd()) { xml_parser.readNext(); if (xml_parser.tokenType() == QXmlStreamReader::StartElement && xml_parser.name().toString() == "node") { const QString &name = xml_parser.attributes().value("name").toString(); if (!name.isEmpty()) { nodeList << path + "/" + name; } } } return nodeList; } QStringList DDiskManager::blockDevices() const { return getDBusNodeNameList(UDISKS2_SERVICE, "/org/freedesktop/UDisks2/block_devices", QDBusConnection::systemBus()); } QStringList DDiskManager::diskDevices() const { return getDBusNodeNameList(UDISKS2_SERVICE, "/org/freedesktop/UDisks2/drives", QDBusConnection::systemBus()); } QStringList DDiskManager::blockDevices(QVariantMap options) { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); auto reply = udisksmgr.GetBlockDevices(options); reply.waitForFinished(); QList<QDBusObjectPath> resultList = reply.value(); QStringList dbusPaths; for (const QDBusObjectPath &singleResult : resultList) { dbusPaths << singleResult.path(); } return dbusPaths; } bool DDiskManager::watchChanges() const { Q_D(const DDiskManager); return d->watchChanges; } QString DDiskManager::objectPrintable(const QObject *object) { QString string; QDebug debug(&string); const QMetaObject *mo = object->metaObject(); debug << object; int property_count = mo->propertyCount(); int base_property_count = QObject::staticMetaObject.propertyCount(); debug << "\n"; for (int i = base_property_count; i < property_count; ++i) { const QMetaProperty &mp = mo->property(i); debug.nospace() << mp.name() << ": " << mp.read(object); debug << "\n"; } return string; } DBlockDevice *DDiskManager::createBlockDevice(const QString &path, QObject *parent) { return new DBlockDevice(path, parent); } DBlockDevice *DDiskManager::createBlockDeviceByDevicePath(const QByteArray &path, QObject *parent) const { for (const QString &block : blockDevices()) { DBlockDevice *device = new DBlockDevice(block, parent); if (device->device() == path) { return device; } device->deleteLater(); } return nullptr; } DBlockPartition *DDiskManager::createBlockPartition(const QString &path, QObject *parent) { return new DBlockPartition(path, parent); } DBlockPartition *DDiskManager::createBlockPartitionByMountPoint(const QByteArray &path, QObject *parent) const { for (const QString &block : blockDevices()) { DBlockPartition *device = new DBlockPartition(block, parent); if (device->mountPoints().contains(path)) { return device; } device->deleteLater(); } return nullptr; } DBlockPartition *DDiskManager::createBlockPartition(const QStorageInfo &info, QObject *parent) const { return createBlockPartitionByMountPoint(info.rootPath().toLocal8Bit() + '\0', parent); } DDiskDevice *DDiskManager::createDiskDevice(const QString &path, QObject *parent) { return new DDiskDevice(path, parent); } DUDisksJob *DDiskManager::createJob(const QString &path, QObject *parent) { return new DUDisksJob(path, parent); } QStringList DDiskManager::supportedFilesystems() { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); return udisksmgr.supportedFilesystems(); } QStringList DDiskManager::supportedEncryptionTypes() { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); return udisksmgr.supportedEncryptionTypes(); } QStringList DDiskManager::resolveDevice(QVariantMap devspec, QVariantMap options) { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); QStringList ret; auto devices = udisksmgr.ResolveDevice(devspec, options); devices.waitForFinished(); if (!devices.isError()) { for (auto &d : devices.value()) { ret.push_back(d.path()); } } return ret; } QStringList DDiskManager::resolveDeviceNode(QString devnode, QVariantMap options) { return resolveDevice({{"path", QVariant(devnode)}}, options); } bool DDiskManager::canCheck(const QString &type, QString *requiredUtil) { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); auto r = udisksmgr.CanCheck(type); r.waitForFinished(); if (r.isError()) { return false; } if (requiredUtil) { *requiredUtil = r.value().second; } return r.value().first; } bool DDiskManager::canFormat(const QString &type, QString *requiredUtil) { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); auto r = udisksmgr.CanFormat(type); r.waitForFinished(); if (r.isError()) { return false; } if (requiredUtil) { *requiredUtil = r.value().second; } return r.value().first; } bool DDiskManager::canRepair(const QString &type, QString *requiredUtil) { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); auto r = udisksmgr.CanRepair(type); r.waitForFinished(); if (r.isError()) { return false; } if (requiredUtil) { *requiredUtil = r.value().second; } return r.value().first; } bool DDiskManager::canResize(const QString &type, QString *requiredUtil) { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); auto r = udisksmgr.CanRepair(type); r.waitForFinished(); if (r.isError()) { return false; } if (requiredUtil) { *requiredUtil = r.value().second; } return r.value().first; } QString DDiskManager::loopSetup(int fd, QVariantMap options) { OrgFreedesktopUDisks2ManagerInterface udisksmgr(UDISKS2_SERVICE, ManagerPath, QDBusConnection::systemBus()); QDBusUnixFileDescriptor dbusfd; dbusfd.setFileDescriptor(fd); auto r = udisksmgr.LoopSetup(dbusfd, options); r.waitForFinished(); return r.value().path(); } QDBusError DDiskManager::lastError() { return QDBusConnection::systemBus().lastError(); } void DDiskManager::setWatchChanges(bool watchChanges) { Q_D(DDiskManager); if (d->watchChanges == watchChanges) return; OrgFreedesktopDBusObjectManagerInterface *object_manager = UDisks2::objectManager(); auto sc = QDBusConnection::systemBus(); if (watchChanges) { connect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesAdded, this, &DDiskManager::onInterfacesAdded); connect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesRemoved, this, &DDiskManager::onInterfacesRemoved); d->updateBlockDeviceMountPointsMap(); sc.connect(UDISKS2_SERVICE, QString(), "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(onPropertiesChanged(const QString &, const QVariantMap &, const QDBusMessage&))); } else { disconnect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesAdded, this, &DDiskManager::onInterfacesAdded); disconnect(object_manager, &OrgFreedesktopDBusObjectManagerInterface::InterfacesRemoved, this, &DDiskManager::onInterfacesRemoved); d->blockDeviceMountPointsMap.clear(); sc.disconnect(UDISKS2_SERVICE, QString(), "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(onPropertiesChanged(const QString &, const QVariantMap &, const QDBusMessage&))); } } udisks2-qt5-5.0.6/rpm/0000755000175100017510000000000014142116220014350 5ustar shuttleshuttleudisks2-qt5-5.0.6/rpm/udisks2-qt5.spec0000755000175100017510000000312114142116220017317 0ustar shuttleshuttleName: udisks2-qt5 Version: 5.0.6 Release: 3%{?dist} Summary: Qt5 binding for udisks2 License: GPLv3+ URL: https://github.com/linuxdeepin/udisks2-qt5 Source0: %{name}_%{version}.tar.gz BuildRequires: gcc-c++ BuildRequires: pkgconfig(Qt5Core) %description This package provides a Qt5 binding for udisks2. %package devel Summary: Development package for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: qt5-qtbase-devel%{?isa} %description devel Header files and libraries for %{name}. %prep %setup -q sed -i 's|/lib|/%{_lib}|' udisks2.pro %build # help find (and prefer) qt5 utilities, e.g. qmake, lrelease export PATH=%{_qt5_bindir}:$PATH %qmake_qt5 PREFIX=%{_prefix} %make_build %install %make_install INSTALL_ROOT=%{buildroot} %files %doc CHANGELOG.md %{_libdir}/lib%{name}.so.0* %files devel %{_includedir}/%{name} %{_libdir}/lib%{name}.so %{_libdir}/pkgconfig/%{name}.pc %changelog * Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild * Mon Aug 05 2019 Robin Lee <cheeselee@fedoraproject.org> - 5.0.6-1 - Release 5.0.6 * Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Thu Apr 4 2019 Robin Lee <cheeselee@fedoraproject.org> - 0.0.1-1 - Initial packaging udisks2-qt5-5.0.6/dudisksjob.h0000644000175100017510000000521114051331364016072 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DUDISKSJOB_H #define DUDISKSJOB_H #include <QObject> class DUDisksJobPrivate; class DUDisksJob : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(DUDisksJob) Q_PROPERTY(QString path READ path CONSTANT FINAL) Q_PROPERTY(QStringList objects READ objects CONSTANT FINAL) Q_PROPERTY(bool cancelable READ cancelable CONSTANT FINAL) Q_PROPERTY(bool progressValid READ progressValid CONSTANT FINAL) Q_PROPERTY(double progress READ progress NOTIFY progressChanged FINAL) Q_PROPERTY(QString operation READ operation CONSTANT FINAL) Q_PROPERTY(quint32 startedByUid READ startedByUid CONSTANT FINAL) Q_PROPERTY(quint64 bytes READ bytes CONSTANT FINAL) Q_PROPERTY(quint64 expectedEndTime READ expectedEndTime NOTIFY expectedEndTimeChanged FINAL) Q_PROPERTY(quint64 rate READ rate NOTIFY rateChanged FINAL) Q_PROPERTY(quint64 startTime READ startTime CONSTANT FINAL) public: ~DUDisksJob(); QString path() const; QStringList objects() const; bool cancelable() const; bool progressValid() const; double progress() const; QString operation() const; quint32 startedByUid() const; quint64 bytes() const; quint64 expectedEndTime() const; quint64 rate() const; quint64 startTime() const; public Q_SLOTS: void cancel(const QVariantMap &options); Q_SIGNALS: void completed(bool success, QString message); void progressChanged(double progress); void rateChanged(quint64 rate); void expectedEndTimeChanged(quint64 expectedEndTime); private: QScopedPointer<DUDisksJobPrivate> d_ptr; explicit DUDisksJob(QString path, QObject *parent = nullptr); private Q_SLOTS: void onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties); friend class DDiskManager; }; #endif udisks2-qt5-5.0.6/udisks2_dbus_common.h0000644000175100017510000000765414051331364017717 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UDISK2_DBUS_COMMON_H #define UDISK2_DBUS_COMMON_H #include <QDBusObjectPath> #include <QString> #include <QVariantMap> QT_BEGIN_NAMESPACE class QDBusArgument; QT_END_NAMESPACE class OrgFreedesktopDBusObjectManagerInterface; #define UDISKS2_SERVICE "org.freedesktop.UDisks2" namespace UDisks2 { /// by: http://storaged.org/doc/udisks2-api/2.7.2/gdbus-org.freedesktop.UDisks2.Drive.Ata.html#gdbus-method-org-freedesktop-UDisks2-Drive-Ata.SmartGetAttributes struct SmartAttribute { uchar id; // Attribute Identifier QString name; // The identifier as a string. quint16 flags; // 16-bit attribute flags (bit 0 is prefail/oldage, bit 1 is online/offline). qint32 value; // The current value or -1 if unknown. qint32 worst; // The worst value of -1 if unknown. qint32 threshold; // The threshold or -1 if unknown. qint64 pretty; // An interpretation of the value - must be ignored if pretty_unit is 0. qint32 pretty_unit; // The unit of the pretty value - the following units are known: 0 (unknown), 1 (dimensionless), 2 (milliseconds), 3 (sectors), 4 (millikelvin). QVariantMap expansion; // Currently unused. Intended for future expansion. }; /// by: http://storaged.org/doc/udisks2-api/2.7.2/gdbus-org.freedesktop.UDisks2.MDRaid.html#gdbus-property-org-freedesktop-UDisks2-MDRaid.ActiveDevices struct ActiveDeviceInfo { QDBusObjectPath block; // The object path for the underlying block device (guaranteed to implement the org.freedesktop.UDisks2.Block interface) qint32 slot; // -1 if the device is not currently part of the array (ie. spare or faulty), otherwise the slot number the device currently fills (between 0 and "NumDevices") QStringList state; // The state of the device - known elements include faulty, in_sync, write_mostly, blocked and spare quint64 num_read_errors; // An ongoing count of read errors that have been detected on this device but have not caused the device to be evicted from the array QVariantMap expansion; // Currently unused. Intended for future expansion. }; /// by: http://storaged.org/doc/udisks2-api/2.7.2/udisks-std-options.html // default options // Many method calls take a parameter of type 'a{sv}' that is normally called options. The following table lists well-known options: // "auth.no_user_interaction" bool // If set to TRUE, then no user interaction will happen when checking if the method call is authorized. bool interfaceExists(const QString &path, const QString &interface); OrgFreedesktopDBusObjectManagerInterface *objectManager(); QStringList supportedFilesystems(); QString version(); } Q_DECLARE_METATYPE(UDisks2::SmartAttribute) QDBusArgument &operator<<(QDBusArgument &argument, const UDisks2::SmartAttribute &mystruct); const QDBusArgument &operator>>(const QDBusArgument &argument, UDisks2::SmartAttribute &mystruct); Q_DECLARE_METATYPE(UDisks2::ActiveDeviceInfo) QDBusArgument &operator<<(QDBusArgument &argument, const UDisks2::ActiveDeviceInfo &mystruct); const QDBusArgument &operator>>(const QDBusArgument &argument, UDisks2::ActiveDeviceInfo &mystruct); #endif // UDISK2_DBUS_COMMON_H udisks2-qt5-5.0.6/ddiskdevice.h0000644000175100017510000001063414051331364016214 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DDISKDEVICE_H #define DDISKDEVICE_H #include <QObject> #include <QVariantMap> #include <QDBusError> class DDiskDevicePrivate; class DDiskDevice : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(DDiskDevice) Q_PROPERTY(QString path READ path CONSTANT FINAL) Q_PROPERTY(bool canPowerOff READ canPowerOff CONSTANT FINAL) Q_PROPERTY(QVariantMap configuration READ configuration CONSTANT FINAL) Q_PROPERTY(QString connectionBus READ connectionBus CONSTANT FINAL) Q_PROPERTY(bool ejectable READ ejectable CONSTANT FINAL) Q_PROPERTY(QString id READ id CONSTANT FINAL) Q_PROPERTY(QString media READ media CONSTANT FINAL) Q_PROPERTY(bool mediaAvailable READ mediaAvailable CONSTANT FINAL) Q_PROPERTY(bool mediaChangeDetected READ mediaChangeDetected CONSTANT FINAL) Q_PROPERTY(QStringList mediaCompatibility READ mediaCompatibility CONSTANT FINAL) Q_PROPERTY(bool mediaRemovable READ mediaRemovable CONSTANT FINAL) Q_PROPERTY(QString model READ model CONSTANT FINAL) Q_PROPERTY(bool optical READ optical CONSTANT FINAL) Q_PROPERTY(bool opticalBlank READ opticalBlank CONSTANT FINAL) Q_PROPERTY(uint opticalNumAudioTracks READ opticalNumAudioTracks CONSTANT FINAL) Q_PROPERTY(uint opticalNumDataTracks READ opticalNumDataTracks CONSTANT FINAL) Q_PROPERTY(uint opticalNumSessions READ opticalNumSessions CONSTANT FINAL) Q_PROPERTY(uint opticalNumTracks READ opticalNumTracks CONSTANT FINAL) Q_PROPERTY(bool removable READ removable CONSTANT FINAL) Q_PROPERTY(QString revision READ revision CONSTANT FINAL) Q_PROPERTY(int rotationRate READ rotationRate CONSTANT FINAL) Q_PROPERTY(QString seat READ seat CONSTANT FINAL) Q_PROPERTY(QString serial READ serial CONSTANT FINAL) Q_PROPERTY(QString siblingId READ siblingId CONSTANT FINAL) Q_PROPERTY(qulonglong size READ size CONSTANT FINAL) Q_PROPERTY(QString sortKey READ sortKey CONSTANT FINAL) Q_PROPERTY(qulonglong timeDetected READ timeDetected CONSTANT FINAL) Q_PROPERTY(qulonglong timeMediaDetected READ timeMediaDetected CONSTANT FINAL) Q_PROPERTY(QString vendor READ vendor CONSTANT FINAL) Q_PROPERTY(QString WWN READ WWN CONSTANT FINAL) public: ~DDiskDevice(); QString path() const; bool canPowerOff() const; QVariantMap configuration() const; QString connectionBus() const; bool ejectable() const; QString id() const; QString media() const; bool mediaAvailable() const; bool mediaChangeDetected() const; QStringList mediaCompatibility() const; bool mediaRemovable() const; QString model() const; bool optical() const; bool opticalBlank() const; uint opticalNumAudioTracks() const; uint opticalNumDataTracks() const; uint opticalNumSessions() const; uint opticalNumTracks() const; bool removable() const; QString revision() const; int rotationRate() const; QString seat() const; QString serial() const; QString siblingId() const; qulonglong size() const; QString sortKey() const; qulonglong timeDetected() const; qulonglong timeMediaDetected() const; QString vendor() const; QString WWN() const; QDBusError lastError() const; public Q_SLOTS: // METHODS void eject(const QVariantMap &options); void powerOff(const QVariantMap &options); void setConfiguration(const QVariantMap &value, const QVariantMap &options); private: explicit DDiskDevice(const QString &path, QObject *parent = nullptr); QScopedPointer<DDiskDevicePrivate> d_ptr; friend class DDiskManager; }; #endif // DDISKDEVICE_H udisks2-qt5-5.0.6/private/0000755000175100017510000000000014051331364015233 5ustar shuttleshuttleudisks2-qt5-5.0.6/private/private.pri0000644000175100017510000000005014051331364017414 0ustar shuttleshuttleHEADERS += \ $$PWD/dblockdevice_p.h udisks2-qt5-5.0.6/private/dblockdevice_p.h0000644000175100017510000000320714051331364020343 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBLOCKDEVICE_P_H #define DBLOCKDEVICE_P_H #include "dblockdevice.h" QT_BEGIN_NAMESPACE class QDBusObjectPath; QT_END_NAMESPACE class OrgFreedesktopUDisks2BlockInterface; class DBlockDevicePrivate { public: explicit DBlockDevicePrivate(DBlockDevice *qq); OrgFreedesktopUDisks2BlockInterface *dbus; bool watchChanges = false; DBlockDevice *q_ptr; QDBusError err; void _q_onInterfacesAdded(const QDBusObjectPath &object_path, const QMap<QString, QVariantMap> &interfaces_and_properties); void _q_onInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces); void _q_onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties); Q_DECLARE_PUBLIC(DBlockDevice) }; #endif // DBLOCKDEVICE_P_H udisks2-qt5-5.0.6/CHANGELOG.md0000644000175100017510000000027314051331364015374 0ustar shuttleshuttle<a name="0.0.1"></a> ## 0.0.1 (2019-03-26) #### Features * add interfaces ([6668fc33](https://github.com/linuxdeepin/udisks2-qt5/commit/6668fc33c0ffe46b87c69e0f6315fcc3b698dac7)) udisks2-qt5-5.0.6/udisks2.pro0000644000175100017510000000266514051331364015700 0ustar shuttleshuttleTARGET = udisks2-qt5 QT += core dbus QT -= gui TEMPLATE = lib isEmpty(VERSION): VERSION = 0.0.1 SOURCES += \ $$PWD/ddiskdevice.cpp \ $$PWD/ddiskmanager.cpp \ $$PWD/udisks2_dbus_common.cpp \ $$PWD/dblockdevice.cpp \ $$PWD/dblockpartition.cpp \ $$PWD/dudisksjob.cpp udisk2.files = $$PWD/org.freedesktop.UDisks2.xml udisk2.header_flags = -i $$PWD/udisks2_dbus_common.h -N DBUS_INTERFACES += udisk2 $$PWD/org.freedesktop.UDisks2.ObjectManager.xml HEADERS += \ $$PWD/ddiskdevice.h \ $$PWD/udisks2_dbus_common.h \ $$PWD/ddiskmanager.h \ $$PWD/dblockdevice.h \ $$PWD/dblockpartition.h \ $$PWD/dudisksjob.h include($$PWD/private/private.pri) INCLUDEPATH += $$PWD OTHER_FILES += $$PWD/*.xml isEmpty(PREFIX): PREFIX = /usr isEmpty(LIB_INSTALL_DIR) { target.path = $$PREFIX/lib } else { target.path = $$LIB_INSTALL_DIR } isEmpty(INCLUDE_INSTALL_DIR) { includes.path = $$PREFIX/include/$$TARGET } else { includes.path = $$INCLUDE_INSTALL_DIR } includes.files += $$PWD/*.h includes_private.path = $$includes.path/private includes_private.files += $$PWD/private/*.h INSTALLS += includes includes_private target CONFIG += create_pc create_prl no_install_prl QMAKE_PKGCONFIG_LIBDIR = $$target.path QMAKE_PKGCONFIG_VERSION = $$VERSION QMAKE_PKGCONFIG_DESTDIR = pkgconfig QMAKE_PKGCONFIG_NAME = $$TARGET QMAKE_PKGCONFIG_DESCRIPTION = UDisks2 Library with Qt5 QMAKE_PKGCONFIG_INCDIR = $$includes.path udisks2-qt5-5.0.6/udisks2_dbus_common.cpp0000644000175100017510000001055214051331364020241 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "udisks2_dbus_common.h" #include "objectmanager_interface.h" #include "udisks2_interface.h" #include <QDBusArgument> #include <QDBusInterface> #include <QDBusConnection> #include <QDBusReply> #include <QXmlStreamReader> namespace UDisks2 { Q_GLOBAL_STATIC_WITH_ARGS(OrgFreedesktopDBusObjectManagerInterface, omGlobal, (UDISKS2_SERVICE, "/org/freedesktop/UDisks2", QDBusConnection::systemBus())) Q_GLOBAL_STATIC_WITH_ARGS(OrgFreedesktopUDisks2ManagerInterface, umGlobal, (UDISKS2_SERVICE, "/org/freedesktop/UDisks2/Manager", QDBusConnection::systemBus())) bool interfaceExists(const QString &path, const QString &interface) { QDBusInterface ud2(UDISKS2_SERVICE, path, "org.freedesktop.DBus.Introspectable", QDBusConnection::systemBus()); QDBusReply<QString> reply = ud2.call("Introspect"); QXmlStreamReader xml_parser(reply.value()); while (!xml_parser.atEnd()) { xml_parser.readNext(); if (xml_parser.tokenType() == QXmlStreamReader::StartElement && xml_parser.name().toString() == "interface") { const QString &name = xml_parser.attributes().value("name").toString(); if (name == interface) { return true; } } } return false; } OrgFreedesktopDBusObjectManagerInterface *objectManager() { if (!omGlobal.exists()) { qDBusRegisterMetaType<QMap<QString, QVariantMap>>(); qDBusRegisterMetaType<QList<QPair<QString, QVariantMap>>>(); qDBusRegisterMetaType<QByteArrayList>(); qDBusRegisterMetaType<QPair<QString,QVariantMap>>(); qDBusRegisterMetaType<QMap<QDBusObjectPath,QMap<QString,QVariantMap>>>(); QMetaType::registerDebugStreamOperator<QList<QPair<QString, QVariantMap>>>(); } return omGlobal; } QString version() { return umGlobal->version(); } QStringList supportedFilesystems() { return umGlobal->supportedFilesystems(); } } QDBusArgument &operator<<(QDBusArgument &argument, const UDisks2::SmartAttribute &mystruct) { argument.beginStructure(); argument << mystruct.id << mystruct.name << mystruct.flags << mystruct.value << mystruct.worst << mystruct.threshold << mystruct.pretty << mystruct.pretty_unit << mystruct.expansion; argument.endStructure(); return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, UDisks2::SmartAttribute &mystruct) { argument.beginStructure(); argument >> mystruct.id >> mystruct.name >> mystruct.flags >> mystruct.value >> mystruct.worst >> mystruct.threshold >> mystruct.pretty >> mystruct.pretty_unit >> mystruct.expansion; argument.endStructure(); return argument; } QDBusArgument &operator<<(QDBusArgument &argument, const UDisks2::ActiveDeviceInfo &mystruct) { argument.beginStructure(); argument << mystruct.block << mystruct.slot << mystruct.state << mystruct.num_read_errors << mystruct.expansion; argument.endStructure(); return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, UDisks2::ActiveDeviceInfo &mystruct) { argument.beginStructure(); argument >> mystruct.block >> mystruct.slot >> mystruct.state >> mystruct.num_read_errors >> mystruct.expansion; argument.endStructure(); return argument; } udisks2-qt5-5.0.6/ddiskdevice.cpp0000644000175100017510000001066314051331364016551 0ustar shuttleshuttle/* * Copyright (C) 2020 UOS Technology Co., Ltd. * * Author: zccrs <zhangjide@deepin.com> * * Maintainer: xushitong<xushitong@uniontech.com> * max-lv<lvwujun@uniontech.com> * zhangsheng<zhangsheng@uniontech.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ddiskdevice.h" #include "udisks2_interface.h" class DDiskDevicePrivate { public: OrgFreedesktopUDisks2DriveInterface *dbus = nullptr; QDBusError err; }; DDiskDevice::DDiskDevice(const QString &path, QObject *parent) : QObject(parent) , d_ptr(new DDiskDevicePrivate()) { d_ptr->dbus = new OrgFreedesktopUDisks2DriveInterface(UDISKS2_SERVICE, path, QDBusConnection::systemBus(), this); } DDiskDevice::~DDiskDevice() { } QString DDiskDevice::path() const { Q_D(const DDiskDevice); return d->dbus->path(); } bool DDiskDevice::canPowerOff() const { return d_ptr->dbus->canPowerOff(); } QVariantMap DDiskDevice::configuration() const { return d_ptr->dbus->configuration(); } QString DDiskDevice::connectionBus() const { return d_ptr->dbus->connectionBus(); } bool DDiskDevice::ejectable() const { return d_ptr->dbus->ejectable(); } QString DDiskDevice::id() const { return d_ptr->dbus->id(); } QString DDiskDevice::media() const { return d_ptr->dbus->media(); } bool DDiskDevice::mediaAvailable() const { return d_ptr->dbus->mediaAvailable(); } bool DDiskDevice::mediaChangeDetected() const { return d_ptr->dbus->mediaChangeDetected(); } QStringList DDiskDevice::mediaCompatibility() const { return d_ptr->dbus->mediaCompatibility(); } bool DDiskDevice::mediaRemovable() const { return d_ptr->dbus->mediaRemovable(); } QString DDiskDevice::model() const { return d_ptr->dbus->model(); } bool DDiskDevice::optical() const { return d_ptr->dbus->optical(); } bool DDiskDevice::opticalBlank() const { return d_ptr->dbus->opticalBlank(); } uint DDiskDevice::opticalNumAudioTracks() const { return d_ptr->dbus->opticalNumAudioTracks(); } uint DDiskDevice::opticalNumDataTracks() const { return d_ptr->dbus->opticalNumDataTracks(); } uint DDiskDevice::opticalNumSessions() const { return d_ptr->dbus->opticalNumSessions(); } uint DDiskDevice::opticalNumTracks() const { return d_ptr->dbus->opticalNumTracks(); } bool DDiskDevice::removable() const { return d_ptr->dbus->removable(); } QString DDiskDevice::revision() const { return d_ptr->dbus->revision(); } int DDiskDevice::rotationRate() const { return d_ptr->dbus->rotationRate(); } QString DDiskDevice::seat() const { return d_ptr->dbus->seat(); } QString DDiskDevice::serial() const { return d_ptr->dbus->serial(); } QString DDiskDevice::siblingId() const { return d_ptr->dbus->siblingId(); } qulonglong DDiskDevice::size() const { return d_ptr->dbus->size(); } QString DDiskDevice::sortKey() const { return d_ptr->dbus->sortKey(); } qulonglong DDiskDevice::timeDetected() const { return d_ptr->dbus->timeDetected(); } qulonglong DDiskDevice::timeMediaDetected() const { return d_ptr->dbus->timeMediaDetected(); } QString DDiskDevice::vendor() const { return d_ptr->dbus->vendor(); } QString DDiskDevice::WWN() const { return d_ptr->dbus->wWN(); } QDBusError DDiskDevice::lastError() const { Q_D(const DDiskDevice); return d->err; } void DDiskDevice::eject(const QVariantMap &options) { Q_D(DDiskDevice); auto r = d_ptr->dbus->Eject(options); r.waitForFinished(); d->err = r.error(); } void DDiskDevice::powerOff(const QVariantMap &options) { Q_D(DDiskDevice); auto r = d_ptr->dbus->PowerOff(options); r.waitForFinished(); d->err = r.error(); } void DDiskDevice::setConfiguration(const QVariantMap &value, const QVariantMap &options) { Q_D(DDiskDevice); auto r = d_ptr->dbus->SetConfiguration(value, options); r.waitForFinished(); d->err = r.error(); } 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!569 blocks
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2