summaryrefslogtreecommitdiffstats
path: root/include/scsi
ModeNameSize
d---------fc219logstatsplain
-rw-r--r--fc_encode.h22155logstatsplain
-rw-r--r--fc_frame.h7063logstatsplain
-rw-r--r--fcoe_sysfs.h3843logstatsplain
-rw-r--r--iscsi_if.h26697logstatsplain
-rw-r--r--iscsi_proto.h16448logstatsplain
-rw-r--r--iser.h2397logstatsplain
-rw-r--r--libfc.h32476logstatsplain
-rw-r--r--libfcoe.h14284logstatsplain
-rw-r--r--libiscsi.h14624logstatsplain
-rw-r--r--libiscsi_tcp.h4426logstatsplain
-rw-r--r--libsas.h18784logstatsplain
-rw-r--r--osd_attributes.h15411logstatsplain
-rw-r--r--osd_protocol.h17989logstatsplain
-rw-r--r--osd_sec.h1520logstatsplain
-rw-r--r--osd_sense.h10126logstatsplain
-rw-r--r--osd_types.h1020logstatsplain
-rw-r--r--sas.h13533logstatsplain
-rw-r--r--sas_ata.h2800logstatsplain
-rw-r--r--scsi.h8840logstatsplain
-rw-r--r--scsi_bsg_iscsi.h2894logstatsplain
-rw-r--r--scsi_cmnd.h9158logstatsplain
-rw-r--r--scsi_common.h2160logstatsplain
-rw-r--r--scsi_dbg.h2162logstatsplain
-rw-r--r--scsi_device.h21453logstatsplain
-rw-r--r--scsi_devinfo.h3783logstatsplain
-rw-r--r--scsi_dh.h3241logstatsplain
-rw-r--r--scsi_driver.h897logstatsplain
-rw-r--r--scsi_eh.h1631logstatsplain
-rw-r--r--scsi_host.h26492logstatsplain
-rw-r--r--scsi_ioctl.h1285logstatsplain
-rw-r--r--scsi_proto.h10960logstatsplain
-rw-r--r--scsi_request.h667logstatsplain
-rw-r--r--scsi_tcq.h961logstatsplain
-rw-r--r--scsi_transport.h3298logstatsplain
-rw-r--r--scsi_transport_fc.h27104logstatsplain
-rw-r--r--scsi_transport_iscsi.h17547logstatsplain
-rw-r--r--scsi_transport_sas.h6950logstatsplain
-rw-r--r--scsi_transport_spi.h7369logstatsplain
-rw-r--r--scsi_transport_srp.h4883logstatsplain
-rw-r--r--scsicam.h713logstatsplain
-rw-r--r--sg.h12420logstatsplain
-rw-r--r--srp.h7226logstatsplain
-rw-r--r--viosrp.h6212logstatsplain
/span>BroadcastProfilePtr defaultProfile( new BroadcastProfile(kDefaultProfile)); // Upgrade from mixxx.cfg format to XML (if required) loadLegacySettings(defaultProfile); addProfile(defaultProfile); saveProfile(defaultProfile); } } bool BroadcastSettings::addProfile(BroadcastProfilePtr profile) { if (!profile) return false; if (m_profiles.size() >= BROADCAST_MAX_CONNECTIONS) { kLogger.warning() << "addProfile: connection limit reached." << "can't add more than" << QString::number(BROADCAST_MAX_CONNECTIONS) << "connections."; return false; } // It is best to avoid using QSharedPointer::data(), especially when // passing it to another function, as it puts the associated pointer // at risk of being manually deleted. // However it's fine with Qt's connect because it can be trusted that // it won't delete the pointer. connect(profile.data(), SIGNAL(profileNameChanged(QString, QString)), this, SLOT(onProfileNameChanged(QString,QString))); connect(profile.data(), SIGNAL(connectionStatusChanged(int)), this, SLOT(onConnectionStatusChanged(int))); m_profiles.insert(profile->getProfileName(), BroadcastProfilePtr(profile)); emit profileAdded(profile); return true; } bool BroadcastSettings::saveProfile(BroadcastProfilePtr profile) { if (!profile) return false; QString filename = profile->getLastFilename(); if (filename.isEmpty()) { // there was no previous filename, find an unused filename for (int index = 0;; ++index) { if (index > 0) { // add an index to the file name to make it unique filename = filePathForProfile(profile->getProfileName() + QString::number(index)); } else { filename = filePathForProfile(profile->getProfileName()); } QFileInfo fileInfo(filename); if (!fileInfo.exists()) { break; } } } return profile->save(filename); } QString BroadcastSettings::filePathForProfile(const QString& profileName) { QString filename = profileName + ".bcp.xml"; filename = BroadcastProfile::stripForbiddenChars(filename); return QDir(getProfilesFolder()).absoluteFilePath(filename); } QString BroadcastSettings::filePathForProfile(BroadcastProfilePtr profile) { if (!profile) return QString(); return filePathForProfile(profile->getProfileName()); } bool BroadcastSettings::deleteFileForProfile(BroadcastProfilePtr profile) { if (!profile) return false; QString filename = profile->getLastFilename(); if (filename.isEmpty()) { // no file was saved, there is no file to delete return false; } QFileInfo xmlFile(filename); if (xmlFile.exists()) { return QFile::remove(xmlFile.absoluteFilePath()); } return false; } QString BroadcastSettings::getProfilesFolder() { QString profilesPath(m_pConfig->getSettingsPath()); profilesPath.append(QDir::separator() + QString(kProfilesSubfolder)); return profilesPath; } void BroadcastSettings::saveAll() { for (const auto& kv : m_profiles) { saveProfile(kv); } emit profilesChanged(); } void BroadcastSettings::onProfileNameChanged(QString oldName, QString newName) { if (!m_profiles.contains(oldName)) return; BroadcastProfilePtr profile = m_profiles.take(oldName); if (profile) { m_profiles.insert(newName, profile); emit profileRenamed(oldName, profile); deleteFileForProfile(profile); saveProfile(profile); } } void BroadcastSettings::onConnectionStatusChanged(int newStatus) { Q_UNUSED(newStatus); } BroadcastProfilePtr BroadcastSettings::profileAt(int index) { auto it = m_profiles.begin() + index; return it != m_profiles.end() ? it.value() : BroadcastProfilePtr(nullptr); } QList<BroadcastProfilePtr> BroadcastSettings::profiles() { return m_profiles.values(); } void BroadcastSettings::applyModel(BroadcastSettingsModel* pModel) { if (!pModel) { return; } // TODO(Palakis): lock both lists against modifications while syncing // Step 1: find profiles to delete from the settings for (auto profileIter = m_profiles.begin(); profileIter != m_profiles.end();) { QString profileName = (*profileIter)->getProfileName(); if (!pModel->getProfileByName(profileName)) { // If profile exists in settings but not in the model, // remove the profile from the settings const auto removedProfile = *profileIter; deleteFileForProfile(removedProfile); profileIter = m_profiles.erase(profileIter); emit profileRemoved(removedProfile); } else { ++profileIter; } } // Step 2: add new profiles for(BroadcastProfilePtr profileCopy : pModel->profiles()) { // Check if profile already exists in settings BroadcastProfilePtr existingProfile = m_profiles.value(profileCopy->getProfileName()); if (!existingProfile) { // If no profile with the same name exists, add the new // profile to the settings. // The BroadcastProfile instance is a copy to separate it // from its existence in the model addProfile(profileCopy->valuesCopy()); } } // Step 3: update existing profiles for(BroadcastProfilePtr profileCopy : pModel->profiles()) { BroadcastProfilePtr actualProfile = m_profiles.value(profileCopy->getProfileName()); if (actualProfile) { profileCopy->copyValuesTo(actualProfile); } } saveAll(); }