retro-imager/src/devicewrapperpartition.h
Floris Bos 142ddfc037 Add classes for mounting FAT16/32 without help from OS
Minimal implementation for reading/writing files in the root
directory of a FAT16/FAT32 file system.

Can read/write from raw disk devices, and no longer relies on
operating system support for mounting the file system.

Currently assumes Imager will always be run on 'little endian'
architectures such as Intel and ARM (at least under Linux).
If there is a use-case for big-endian (anybody still using Sparc?)
this may be revisited later.
2022-11-14 21:41:20 +01:00

32 lines
699 B
C++

#ifndef DEVICEWRAPPERPARTITION_H
#define DEVICEWRAPPERPARTITION_H
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2022 Raspberry Pi Ltd
*/
#include <QObject>
class DeviceWrapper;
class DeviceWrapperPartition : public QObject
{
Q_OBJECT
public:
explicit DeviceWrapperPartition(DeviceWrapper *dw, quint64 partStart, quint64 partLen, QObject *parent = nullptr);
virtual ~DeviceWrapperPartition();
void read(char *data, qint64 size);
void seek(qint64 pos);
qint64 pos() const;
void write(const char *data, qint64 size);
protected:
DeviceWrapper *_dw;
quint64 _partStart, _partLen, _partEnd, _offset;
signals:
};
#endif // DEVICEWRAPPERPARTITION_H