Debian Codegraph @

src/fs/qnx6.h

raw symbols SCIP
1 // Copyright (C) 2014 Sacha Refshauge
2
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 3.0.
6
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 3.0 for more details.
11
12 // A copy of the GPL 3.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
14
15 // Official GIT repository and contact information can be found at
16 // http://github.com/xsacha/Sachesi
17
18 #pragma once
19
20 #include <QPair>
21 #include <quazip/quazip.h>
22 #include <quazip/quazipfile.h>
23 #include "fs.h"
24
25 namespace FS {
26
27 struct qinode {
28 int size;
29 QList<int> sectors;
30 quint8 tiers;
31 int time;
32 quint16 perms;
33 };
34
35 class QNX6 : public QFileSystem
36 {
37 Q_OBJECT
38
39 public:
40 explicit QNX6(QString filename, QIODevice* file, qint64 offset, qint64 size, QString path)
41 : QFileSystem(filename, file, offset, size, path, ".qnx6")
42 , currentZip(nullptr) {}
43
44 inline qint64 findSector(qint64 sector) {
45 return _offset + ((sector - sectorOffset) * sectorSize);
46 }
47 inline qint64 findNode(int node) {
48 return _offset + (0x80 * (node - 1));
49 }
50 qint64 findIndexFromSig(unsigned char* signature, int startFrom, int distanceFrom, unsigned int maxBlocks = -1, int num = 4);
51 qinode createNode(int node);
52 // TODO: Read ./.rootfs.os.version or ./var/pps/system/installer/coreos/0
53 //QString generateName(QString imageExt = "");
54 void extractManifest(int nodenum);
55 void extractDir(int offset, QString basedir, int numNodes);
56
57 bool createContents();
58
59 // TODO: These need to have a better method of passing from Splitter
60 bool extractApps;
61
62 signals:
63 void currentNameChanged(QString name);
64
65 private:
66 QPair<int, QString> nodeInfo(QNXStream* stream, qint64 offset);
67 quint16 sectorSize;
68 quint16 sectorOffset;
69 QList<int> lfn;
70 QuaZip* currentZip;
71 QList<QString> manifestApps;
72
73 };
74
75 }