Commit eda6ae79 authored by Victor Kotlyar's avatar Victor Kotlyar
Browse files

Removed unused and duplicated castor::utils

parent 9c0250b2
......@@ -660,5 +660,22 @@ void setDumpableProcessAttribute(const bool dumpable) {
}
}
//-----------------------------------------------------------------------------
// hexDump
//-----------------------------------------------------------------------------
std::string hexDump(const void * mem, unsigned int n ){
std::ostringstream out;
const unsigned char * p = reinterpret_cast< const unsigned char *>( mem );
for ( unsigned int i = 0; i < n; i++ ) {
if (0 != i) {
out << " ";
}
out << std::uppercase << std::hex << std::setw(2) <<
std::setfill( out.widen('0') ) << int(p[i]);
}
return out.str();
}
} // namespace utils
} // namespace cta
......@@ -139,6 +139,16 @@ namespace utils {
return oss.str();
}
/**
* Creates and returns an std::string which is the result of replacing each
* occurance of whitespace (a collection of on or more space and tab
* characters) with a single space character.
*
* @param str The original string.
* @return The newly created string with single spaces.
*/
std::string singleSpaceString(const std::string &str) throw();
/**
* C++ wrapper around the setxtarr() function.
*
......@@ -259,6 +269,15 @@ namespace utils {
* @param dumpable true if the current program should be dumpable.
*/
void setDumpableProcessAttribute(const bool dumpable);
/**
* Returns the hexadecimal dump of the specified memory.
*
* @param mem Pointer to the memory to be dumped.
* @param n The length of the memory to be dumped.
* @return The hexadecimal dump.
*/
std::string hexDump(const void *mem, unsigned int n);
} // namespace utils
......
......@@ -25,8 +25,9 @@
#include "common/exception/NoEntry.hpp"
#include "common/log/Logger.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include "common/exception/Exception.hpp"
#include "common/exception/InvalidConfigEntry.hpp"
#include <string>
#include <map>
......@@ -153,7 +154,7 @@ namespace castor {
return defaultValue;
}
if (!castor::utils::isValidUInt(strValue.c_str())) {
if (!cta::utils::isValidUInt(strValue.c_str())) {
cta::exception::InvalidConfigEntry ex(category.c_str(),
key.c_str(), strValue.c_str());
ex.getMessage() << "Failed to get configuration entry " << category <<
......@@ -195,7 +196,7 @@ namespace castor {
const std::string &key, cta::log::Logger *const log = NULL) {
const std::string strValue = getConfEntString(category, key);
if (!castor::utils::isValidUInt(strValue.c_str())) {
if (!cta::utils::isValidUInt(strValue.c_str())) {
cta::exception::InvalidConfigEntry ex(category.c_str(),
key.c_str(), strValue.c_str());
ex.getMessage() << "Failed to get configuration entry " << category <<
......
......@@ -161,7 +161,7 @@ int castor::io::createListenerSock(
for(unsigned short port=lowPort; port<=highPort; ++port) {
// Try to bind the socket to the port
utils::setBytes(address, '\0');
memset(&address, '\0', sizeof(address));
address.sin_family = AF_INET;
address.sin_addr = addr;
address.sin_port = htons(port);
......
......@@ -126,7 +126,7 @@ static void *instantiateZmqContext(const int sizeOfIOThreadPoolForZMQ) {
using namespace castor;
void *const zmqContext = zmq_init(sizeOfIOThreadPoolForZMQ);
if(NULL == zmqContext) {
const std::string message = utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to instantiate ZMQ context: " << message;
throw ex;
......
......@@ -25,7 +25,7 @@
#include "castor/mediachanger/LibrarySlotParser.hpp"
#include "castor/mediachanger/ManualLibrarySlot.hpp"
#include "castor/mediachanger/ScsiLibrarySlot.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include <sstream>
#include <vector>
......@@ -116,7 +116,7 @@ castor::mediachanger::AcsLibrarySlot *castor::mediachanger::LibrarySlotParser::
parseAcsLibrarySlot(const std::string &str) {
const std::string errMsg("Failed to construct AcsLibrarySlot");
std::vector<std::string> components;
castor::utils::splitString(str, ',', components);
cta::utils::splitString(str, ',', components);
if(4 != components.size()) {
cta::exception::InvalidArgument ex;
ex.getMessage() << errMsg << ": Invalid number of components"
......@@ -165,25 +165,25 @@ castor::mediachanger::AcsLibrarySlot *castor::mediachanger::LibrarySlotParser::
throw ex;
}
if(!utils::isValidUInt(acsStr)) {
if(!cta::utils::isValidUInt(acsStr)) {
cta::exception::InvalidArgument ex;
ex.getMessage() << errMsg << ": ACS_NUMBER must be an unsigned integer:"
" value=" << acsStr;
throw ex;
}
if(!utils::isValidUInt(lsmStr)) {
if(!cta::utils::isValidUInt(lsmStr)) {
cta::exception::InvalidArgument ex;
ex.getMessage() << errMsg << ": LSM_NUMBER must be an unsigned integer:"
" value=" << lsmStr;
throw ex;
}
if(!utils::isValidUInt(panStr)) {
if(!cta::utils::isValidUInt(panStr)) {
cta::exception::InvalidArgument ex;
ex.getMessage() << errMsg << ": PANEL_NUMBER must be an unsigned integer:"
" value=" << panStr;
throw ex;
}
if(!utils::isValidUInt(drvStr)) {
if(!cta::utils::isValidUInt(drvStr)) {
cta::exception::InvalidArgument ex;
ex.getMessage() << errMsg << ": TRANSPORT_NUMBER must be an unsigned"
" integer: value=" << drvStr;
......@@ -226,7 +226,7 @@ castor::mediachanger::ScsiLibrarySlot *castor::mediachanger::
throw ex;
}
if(!utils::isValidUInt(drvOrdStr)) {
if(!cta::utils::isValidUInt(drvOrdStr)) {
cta::exception::Exception ex;
ex.getMessage() << "Failed to construct ScsiLibrarySlot: Drive ordinal " <<
drvOrdStr << " is not a valid unsigned integer: slot=" << str;
......
......@@ -124,7 +124,7 @@ static void *instantiateZmqContext(const int sizeOfIOThreadPoolForZMQ) {
using namespace castor;
void *const zmqContext = zmq_init(sizeOfIOThreadPoolForZMQ);
if(NULL == zmqContext) {
const std::string message = utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to instantiate ZMQ context: " << message;
throw ex;
......
......@@ -100,7 +100,7 @@ void castor::messages::Frame::serializeProtocolBufferIntoBody(
} catch(cta::exception::Exception &ne) {
cta::exception::Exception ex;
ex.getMessage() << "Frame failed to serialize protocol buffer " <<
castor::utils::demangledNameOf(protocolBuffer) << " into frame body: "
demangledNameOf(protocolBuffer) << " into frame body: "
<< ne.getMessage().str();
throw ex;
}
......@@ -115,7 +115,7 @@ void castor::messages::Frame::parseBodyIntoProtocolBuffer(
cta::exception::Exception ex;
ex.getMessage() << "Frame failed to parse contents of enclosed ZMQ"
" message into protocol buffer " <<
castor::utils::demangledNameOf(protocolBuffer)
demangledNameOf(protocolBuffer)
<< ": ParseFromString() returned false";
throw ex;
}
......
......@@ -29,6 +29,7 @@
#include <google/protobuf/message.h>
#include <string>
#include <cxxabi.h>
namespace castor {
namespace messages {
......@@ -92,8 +93,26 @@ private:
* Calculates the hash value of the frame body and records the result in the
* frame header.
*/
void calcAndSetHashValueOfBody();
void calcAndSetHashValueOfBody();
}; // struct Frame
/**
* Determines the demangled type name of the specified object.
*
* @param t The object.
* @return The demangled type name.
*/
template <class T>std::string demangledNameOf(const T&t){
std::string responseType = typeid(t).name();
int status = -1;
char * demangled = abi::__cxa_demangle(responseType.c_str(), NULL, NULL, &status);
if (!status) {
responseType = demangled;
}
free(demangled);
return responseType;
}
} // namespace messages
} // namespace castor
......@@ -23,7 +23,7 @@
*****************************************************************************/
#include "tapeserver/castor/messages/SmartZmqContext.hpp"
#include "tapeserver/castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include "common/log/Logger.hpp"
#include <errno.h>
......@@ -116,7 +116,7 @@ void *castor::messages::SmartZmqContext::release() {
void* castor::messages::SmartZmqContext::instantiateZmqContext(const int sizeOfIOThreadPoolForZMQ, cta::log::Logger& log) {
void *const zmqContext = zmq_init(sizeOfIOThreadPoolForZMQ);
if(NULL == zmqContext) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Child of ProcessForker failed to instantiate ZMQ"
" context: " << message;
......
......@@ -22,7 +22,7 @@
*****************************************************************************/
#include "castor/messages/messages.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include "common/utils/strerror_r_wrapper.hpp"
#include "castor/legacymsg/TapeConstants.h"
......@@ -108,7 +108,7 @@ castor::messages::Frame castor::messages::recvFrame(ZmqSocket &socket) {
void castor::messages::connectZmqSocketToLocalhost(ZmqSocket &socket,
const int port) {
std::string bindingAdress("tcp://127.0.0.1:");
bindingAdress += castor::utils::toString(port);
bindingAdress += cta::utils::toString(port);
socket.connect(bindingAdress.c_str());
}
......
......@@ -21,7 +21,7 @@
#include "castor/tape/reactor/ZMQReactor.hpp"
#include "castor/tape/reactor/ZMQPollEventHandler.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include <algorithm>
......@@ -113,7 +113,7 @@ void castor::tape::reactor::ZMQReactor::handleEvents(const int timeout) {
}
}
} else if(0 > pollRc) {
const std::string message = utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
std::list<cta::log::Param> params = {cta::log::Param("message", message)};
m_log(cta::log::ERR, "Failed to handle I/O event: zmq_poll() failed", params);
}
......
......@@ -24,6 +24,7 @@
#include "castor/tape/tapeserver/daemon/CatalogueDrive.hpp"
#include "castor/tape/tapeserver/daemon/Constants.hpp"
#include "castor/tape/tapeserver/daemon/EmptyDriveProbe.hpp"
#include "common/utils/utils.hpp"
#include "castor/utils/utils.hpp"
#include "common/exception/Exception.hpp"
#include "rmc_constants.h"
......@@ -930,7 +931,7 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::shutdown() {
// Kill the non-cleaner session
if(kill(sessionPid, SIGKILL)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
params.push_back(cta::log::Param("message", message));
m_log(cta::log::ERR, "Failed to kill non-cleaner session whilst shutting"
" down", params);
......@@ -969,7 +970,7 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::killSession() {
params.push_back(cta::log::Param("TPVID", m_session->getVid()));
if(kill(sessionPid, SIGKILL)) {
const std::string errorStr = castor::utils::errnoToString(errno);
const std::string errorStr = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "CatalogueDrive failed to kill session: sessionPid=" <<
sessionPid << " sessionType=" << sessionTypeStr << ": " << errorStr;
......
......@@ -140,7 +140,7 @@ void castor::tape::tapeserver::daemon::CatalogueTransferSession::idempotentKill(
// If the kill failed for a reason other than the fact the process was already
// dead
if(killRc && ESRCH != errno) {
const std::string errnoStr = castor::utils::errnoToString(errno);
const std::string errnoStr = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to kill process"
": pid=" << pid << " signal=" << signal << ": " << errnoStr;
......
......@@ -45,7 +45,7 @@
#include "castor/tape/tapeserver/daemon/ProcessForker.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerUtils.hpp"
#include "common/SmartArrayPtr.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include "catalogue/CatalogueFactory.hpp"
#include "common/exception/Exception.hpp"
#include "rdbms/Sqlite.hpp"
......@@ -100,7 +100,7 @@ void castor::tape::tapeserver::daemon::ProcessForker::closeCmdReceiverSocket()
std::list<cta::log::Param> params;
params.push_back(cta::log::Param("cmdSocket", m_cmdSocket));
if(-1 == close(m_cmdSocket)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
params.push_back(cta::log::Param("message", message));
m_log(cta::log::ERR, "Failed to close command receiver socket",
params);
......@@ -172,7 +172,7 @@ bool castor::tape::tapeserver::daemon::ProcessForker::thereIsAPendingMsg() {
return false;
case -1: // Error
{
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
std::list<cta::log::Param> params = {cta::log::Param("message", message)};
m_log(cta::log::ERR,
"Error detected when checking for a pending ProcessForker message",
......
......@@ -26,7 +26,7 @@
#include "castor/messages/StopProcessForker.pb.h"
#include "castor/tape/tapeserver/daemon/ProcessForkerProxySocket.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerUtils.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include <errno.h>
#include <unistd.h>
......@@ -45,7 +45,7 @@ castor::tape::tapeserver::daemon::ProcessForkerProxySocket::
castor::tape::tapeserver::daemon::ProcessForkerProxySocket::
~ProcessForkerProxySocket() throw() {
if(-1 == close(m_socketFd)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
std::list<cta::log::Param> params = {cta::log::Param("socketFd", m_socketFd),
cta::log::Param("message", message)};
m_log(cta::log::ERR,
......
......@@ -24,7 +24,7 @@
#include "castor/io/io.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerUtils.hpp"
#include "common/SmartArrayPtr.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include "common/exception/Exception.hpp"
#include <errno.h>
......@@ -288,7 +288,7 @@ void castor::tape::tapeserver::daemon::ProcessForkerUtils::
const ssize_t writeRc = write(fd, &value, sizeof(value));
if(-1 == writeRc) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to write uint32_t: " << message;
throw ex;
......@@ -370,7 +370,7 @@ void castor::tape::tapeserver::daemon::ProcessForkerUtils::
const ssize_t writeRc = write(fd, str.c_str(), str.length());
if(-1 == writeRc) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to write string: " << message;
throw ex;
......
......@@ -39,7 +39,7 @@
#include "castor/tape/tapeserver/daemon/TapeMessageHandler.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include "castor/tape/tapeserver/TapeBridgeConstants.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include "common/SmartFd.hpp"
#include "rmc_constants.h"
......@@ -104,7 +104,7 @@ const char *castor::tape::tapeserver::daemon::TapeDaemon::stateToStr(
std::string castor::tape::tapeserver::daemon::TapeDaemon::getHostName() const {
char nameBuf[81];
if(gethostname(nameBuf, sizeof(nameBuf))) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to get host name: " << message;
throw ex;
......@@ -137,7 +137,7 @@ castor::tape::tapeserver::daemon::TapeDaemon::~TapeDaemon() throw() {
void castor::tape::tapeserver::daemon::TapeDaemon::destroyZmqContext() throw() {
if(NULL != m_zmqContext) {
if(zmq_term(m_zmqContext)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
std::list<cta::log::Param> params = {cta::log::Param("message", message)};
m_log(cta::log::ERR, "Failed to destroy ZMQ context", params);
} else {
......@@ -218,8 +218,8 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
// setDumpable
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeDaemon::setDumpable() {
castor::utils::setDumpableProcessAttribute(true);
const bool dumpable = castor::utils::getDumpableProcessAttribute();
cta::utils::setDumpableProcessAttribute(true);
const bool dumpable = cta::utils::getDumpableProcessAttribute();
std::list<cta::log::Param> params = {
cta::log::Param("dumpable", dumpable ? "true" : "false")};
m_log(cta::log::INFO, "Got dumpable attribute of process", params);
......@@ -259,7 +259,7 @@ pid_t castor::tape::tapeserver::daemon::TapeDaemon::forkProcessForker(
// If fork failed
if(0 > forkRc) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
closeForkerCmdPair(cmdPair);
closeForkerReaperPair(reaperPair);
......@@ -373,7 +373,7 @@ std::pair<int, int>
void castor::tape::tapeserver::daemon::TapeDaemon::closeForkerCmdPair(
const ForkerCmdPair &cmdPair) const {
if(close(cmdPair.tapeDaemon)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to close TapeDaemon side of cmdPair"
": cmdPair.tapeDaemon=" << cmdPair.tapeDaemon << ": " << message;
......@@ -381,7 +381,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::closeForkerCmdPair(
}
if(close(cmdPair.processForker)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to close ProcessForker side of cmdPair"
": cmdPair.processForker=" << cmdPair.processForker << ": " << message;
......@@ -395,7 +395,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::closeForkerCmdPair(
void castor::tape::tapeserver::daemon::TapeDaemon::closeForkerReaperPair(
const ForkerReaperPair &reaperPair) const {
if(close(reaperPair.tapeDaemon)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to close TapeDaemon side of reaperPair"
": reaperPair.tapeDaemon=" << reaperPair.tapeDaemon << ": " << message;
......@@ -403,7 +403,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::closeForkerReaperPair(
}
if(close(reaperPair.processForker)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to close ProcessForker side of reaperPair"
": reaperPair.processForker=" << reaperPair.processForker << ": " <<
......@@ -418,7 +418,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::closeForkerReaperPair(
void castor::tape::tapeserver::daemon::TapeDaemon::
closeProcessForkerSideOfCmdPair(const ForkerCmdPair &cmdPair) const {
if(close(cmdPair.processForker)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "TapeDaemon parent process failed to close"
" ProcessForker side of cmdPair: cmdPair.processForker=" <<
......@@ -434,7 +434,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::
closeProcessForkerSideOfReaperPair(const ForkerReaperPair &reaperPair)
const {
if(close(reaperPair.processForker)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "TapeDaemon parent process failed to close"
" ProcessForker side of reaperPair: reaperPair.processForker=" <<
......@@ -449,7 +449,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::
void castor::tape::tapeserver::daemon::TapeDaemon::
closeTapeDaemonSideOfCmdPair(const ForkerCmdPair &cmdPair) const {
if(close(cmdPair.tapeDaemon)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "ProcessForker process failed to close"
" TapeDaemon side of cmdPair: cmdPair.tapeDaemon=" << cmdPair.tapeDaemon
......@@ -464,7 +464,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::
void castor::tape::tapeserver::daemon::TapeDaemon::
closeTapeDaemonSideOfReaperPair(const ForkerReaperPair &reaperPair) const {
if(close(reaperPair.tapeDaemon)) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "ProcessForker process failed to close"
" TapeDaemon side of reaperPair: reaperPair.tapeDaemon=" <<
......@@ -528,7 +528,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::initZmqContext() {
const int sizeOfIOThreadPoolForZMQ = 1;
m_zmqContext = zmq_init(sizeOfIOThreadPoolForZMQ);
if(NULL == m_zmqContext) {
const std::string message = castor::utils::errnoToString(errno);
const std::string message = cta::utils::errnoToString(errno);
cta::exception::Exception ex;
ex.getMessage() << "Failed to instantiate ZMQ context: " << message;
throw ex;
......
......@@ -37,7 +37,7 @@
#include "castor/messages/TapeUnmountStarted.pb.h"
#include "castor/tape/tapeserver/daemon/Constants.hpp"
#include "castor/tape/tapeserver/daemon/TapeMessageHandler.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include <sstream>
#include <iomanip>
......@@ -129,7 +129,7 @@ bool castor::tape::tapeserver::daemon::TapeMessageHandler::handleEvent(
}
std::list<cta::log::Param> params = {
cta::log::Param("sender identity",
castor::utils::hexDump(adress.getData(),adress.size()))
cta::utils::hexDump(adress.getData(),adress.size()))
};
m_log(cta::log::DEBUG, "handling event in TapeMessageHandler", params);
......
......@@ -24,7 +24,8 @@
#include "castor/tape/tapeserver/daemon/TpconfigLines.hpp"
#include "common/SmartFILEPtr.hpp"
#include "castor/utils/utils.hpp"
#include "common/utils/utils.hpp"
#include "common/exception/InvalidArgument.hpp"
#include "h/Castor_limits.h"
#include <errno.h>
......@@ -49,7 +50,7 @@ castor::tape::tapeserver::daemon::TpconfigLines castor::tape::tapeserver::
"Failed to parse TPCONFIG file"
": Failed to open file"
": filename='" << filename << "'"
": " << castor::utils::errnoToString(savedErrno);
": " << cta::utils::errnoToString(savedErrno);
throw ex;
}
......@@ -85,17 +86,17 @@ castor::tape::tapeserver::daemon::TpconfigLines castor::tape::tapeserver::
}
// Left and right trim the line of whitespace
line = castor::utils::trimString(std::string(line));
line = cta::utils::trimString(std::string(line));
// If the line is not empty
if(line != "") {
// Replace each occurance of whitespace with a single space
line = castor::utils::singleSpaceString(line);
line = cta::utils::singleSpaceString(line);
// Split the line into its component data-columns
std::vector<std::string> columns;
castor::utils::splitString(line, ' ', columns);
cta::utils::splitString(line, ' ', columns);
// The expected number of data-columns in a TPCONFIG data-line is 4:
// unitName dgn devFilename librarySlot
......@@ -161,7 +162,7 @@ castor::tape::tapeserver::daemon::TpconfigLines castor::tape::tapeserver::
"Failed to parse TPCONFIG file"
": Failed to read file"
": filename='" << filename << "'"
": " << castor::utils::errnoToString(fgetsErrno);
": " << cta::utils::errnoToString(fgetsErrno);
throw ex;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment