Warning, file /system/kpmcore/src/core/copytargetdevice.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org> 0004 SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com> 0005 SPDX-FileCopyrightText: 2017-2018 Andrius Štikonas <andrius@stikonas.eu> 0006 SPDX-FileCopyrightText: 2018 Huzaifa Faruqui <huzaifafaruqui@gmail.com> 0007 0008 SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 0011 #include "core/copytargetdevice.h" 0012 0013 #include "backend/corebackend.h" 0014 #include "backend/corebackendmanager.h" 0015 0016 #include "core/device.h" 0017 0018 /** Constructs a device to copy to. 0019 @param d the Device to copy to 0020 @param firstbyte the first byte on the Device to write to 0021 @param lastbyte the last byte on the Device to write to 0022 */ 0023 CopyTargetDevice::CopyTargetDevice(Device& d, qint64 firstbyte, qint64 lastbyte) : 0024 CopyTarget(), 0025 m_Device(d), 0026 m_BackendDevice(nullptr), 0027 m_FirstByte(firstbyte), 0028 m_LastByte(lastbyte) 0029 { 0030 } 0031 0032 /** Opens a CopyTargetDevice for writing to. 0033 @return true on success 0034 */ 0035 bool CopyTargetDevice::open() 0036 { 0037 m_BackendDevice = CoreBackendManager::self()->backend()->openDeviceExclusive(device()); 0038 return m_BackendDevice != nullptr; 0039 } 0040 0041 QString CopyTargetDevice::path() const 0042 { 0043 return m_Device.deviceNode(); 0044 }