|
Packit Service |
310c69 |
/*
|
|
Packit Service |
310c69 |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
310c69 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
310c69 |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
310c69 |
* of the License, or (at your option) any later version.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
310c69 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
310c69 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
310c69 |
* GNU General Public License for more details.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
310c69 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
310c69 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
310c69 |
* 02110-1301, USA.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* $Id: //eng/uds-releases/jasper/src/uds/config.c#2 $
|
|
Packit Service |
310c69 |
*/
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "config.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "logger.h"
|
|
Packit Service |
310c69 |
#include "memoryAlloc.h"
|
|
Packit Service |
310c69 |
#include "stringUtils.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**********************************************************************/
|
|
Packit Service |
310c69 |
void freeIndexLocation(IndexLocation *loc)
|
|
Packit Service |
310c69 |
{
|
|
Packit Service |
310c69 |
if (loc == NULL) {
|
|
Packit Service |
310c69 |
return;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
FREE(loc->host);
|
|
Packit Service |
310c69 |
FREE(loc->port);
|
|
Packit Service |
310c69 |
FREE(loc->directory);
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**********************************************************************/
|
|
Packit Service |
310c69 |
bool areUdsConfigurationsEqual(UdsConfiguration a, UdsConfiguration b)
|
|
Packit Service |
310c69 |
{
|
|
Packit Service |
310c69 |
bool result = true;
|
|
Packit Service |
310c69 |
if (a->recordPagesPerChapter != b->recordPagesPerChapter) {
|
|
Packit Service |
310c69 |
logError("Record pages per chapter (%u) does not match (%u)",
|
|
Packit Service |
310c69 |
a->recordPagesPerChapter, b->recordPagesPerChapter);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
if (a->chaptersPerVolume != b->chaptersPerVolume) {
|
|
Packit Service |
310c69 |
logError("Chapter count (%u) does not match (%u)",
|
|
Packit Service |
310c69 |
a->chaptersPerVolume, b->chaptersPerVolume);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
if (a->sparseChaptersPerVolume != b->sparseChaptersPerVolume) {
|
|
Packit Service |
310c69 |
logError("Sparse chapter count (%u) does not match (%u)",
|
|
Packit Service |
310c69 |
a->sparseChaptersPerVolume, b->sparseChaptersPerVolume);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
if (a->cacheChapters != b->cacheChapters) {
|
|
Packit Service |
310c69 |
logError("Cache size (%u) does not match (%u)",
|
|
Packit Service |
310c69 |
a->cacheChapters, b->cacheChapters);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
if (a->masterIndexMeanDelta != b->masterIndexMeanDelta) {
|
|
Packit Service |
310c69 |
logError("Master index mean delta (%u) does not match (%u)",
|
|
Packit Service |
310c69 |
a->masterIndexMeanDelta, b->masterIndexMeanDelta);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
if (a->bytesPerPage != b->bytesPerPage) {
|
|
Packit Service |
310c69 |
logError("Bytes per page value (%u) does not match (%u)",
|
|
Packit Service |
310c69 |
a->bytesPerPage, b->bytesPerPage);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
if (a->sparseSampleRate != b->sparseSampleRate) {
|
|
Packit Service |
310c69 |
logError("Sparse sample rate (%u) does not match (%u)",
|
|
Packit Service |
310c69 |
a->sparseSampleRate, b->sparseSampleRate);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
if (a->nonce != b->nonce) {
|
|
Packit Service |
310c69 |
logError("Nonce (%llu) does not match (%llu)",
|
|
Packit Service |
310c69 |
a->nonce, b->nonce);
|
|
Packit Service |
310c69 |
result = false;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
return result;
|
|
Packit Service |
310c69 |
}
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**********************************************************************/
|
|
Packit Service |
310c69 |
void logUdsConfiguration(UdsConfiguration conf)
|
|
Packit Service |
310c69 |
{
|
|
Packit Service |
310c69 |
logDebug("Configuration:");
|
|
Packit Service |
310c69 |
logDebug(" Record pages per chapter: %10u", conf->recordPagesPerChapter);
|
|
Packit Service |
310c69 |
logDebug(" Chapters per volume: %10u", conf->chaptersPerVolume);
|
|
Packit Service |
310c69 |
logDebug(" Sparse chapters per volume: %10u", conf->sparseChaptersPerVolume);
|
|
Packit Service |
310c69 |
logDebug(" Cache size (chapters): %10u", conf->cacheChapters);
|
|
Packit Service |
310c69 |
logDebug(" Master index mean delta: %10u", conf->masterIndexMeanDelta);
|
|
Packit Service |
310c69 |
logDebug(" Bytes per page: %10u", conf->bytesPerPage);
|
|
Packit Service |
310c69 |
logDebug(" Sparse sample rate: %10u", conf->sparseSampleRate);
|
|
Packit Service |
310c69 |
logDebug(" Nonce: %llu", conf->nonce);
|
|
Packit Service |
310c69 |
}
|