66 lines
2.5 KiB
C++
66 lines
2.5 KiB
C++
/*************************************************************************
|
|
* Copyright (C) 2016 by Andrius Štikonas <andrius@stikonas.eu> *
|
|
* *
|
|
* 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 (at your option) 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/>.*
|
|
*************************************************************************/
|
|
|
|
#if !defined(SCAN__H)
|
|
|
|
#define SCAN__H
|
|
|
|
#include <KAuth>
|
|
#include <parted/parted.h>
|
|
|
|
using namespace KAuth;
|
|
|
|
class Scan : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public Q_SLOTS:
|
|
ActionReply scandevice(const QVariantMap& args);
|
|
ActionReply readsectorsused(const QVariantMap& args);
|
|
};
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// The following structs and the typedef come from libparted's internal gpt sources.
|
|
// It's very unfortunate there is no public API to get at the first and last usable
|
|
// sector for GPT a partition table, so this is the only (libparted) way to get that
|
|
// information (another way would be to read the GPT header and parse the
|
|
// information ourselves; if the libparted devs begin changing these internal
|
|
// structs for each point release and break our code, we'll have to do just that).
|
|
|
|
typedef struct {
|
|
uint32_t time_low;
|
|
uint16_t time_mid;
|
|
uint16_t time_hi_and_version;
|
|
uint8_t clock_seq_hi_and_reserved;
|
|
uint8_t clock_seq_low;
|
|
uint8_t node[6];
|
|
} /* __attribute__ ((packed)) */ efi_guid_t;
|
|
|
|
|
|
struct __attribute__((packed)) _GPTDiskData {
|
|
PedGeometry data_area;
|
|
int entry_count;
|
|
efi_guid_t uuid;
|
|
};
|
|
|
|
typedef struct _GPTDiskData GPTDiskData;
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
#endif
|