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

Renamed castor::exception::Errnum to

cta::exception::Errnum
parent 4eef892e
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "castor/exception/Errnum.hpp"
#include "common/utils/utils.hpp"
#include <errno.h>
#include <string.h>
using namespace castor::exception;
Errnum::Errnum(std::string what):Exception("") {
m_errnum = errno;
ErrnumConstructorBottomHalf(what);
}
Errnum::Errnum(int err, std::string what):Exception("") {
m_errnum = err;
ErrnumConstructorBottomHalf(what);
}
void Errnum::ErrnumConstructorBottomHalf(const std::string & what) {
m_strerror = cta::utils::errnoToString(m_errnum);
std::stringstream w2;
if (what.size())
w2 << what << " ";
w2 << "Errno=" << m_errnum << ": " << m_strerror;
getMessage().str(w2.str());
}
void Errnum::throwOnReturnedErrno (int err, std::string context) {
if (err) throw Errnum(err, context);
}
void Errnum::throwOnNonZero(int status, std::string context) {
if (status) throw Errnum(context);
}
void Errnum::throwOnZero(int status, std::string context) {
if (!status) throw Errnum(context);
}
void Errnum::throwOnNull(void * f, std::string context) {
if (NULL == f) throw Errnum(context);
}
void Errnum::throwOnNegative(int ret, std::string context) {
if (ret < 0) throw Errnum(context);
}
void Errnum::throwOnMinusOne(int ret, std::string context) {
if (-1 == ret) throw Errnum(context);
}
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include "common/exception/Exception.hpp"
namespace castor {
namespace exception {
class Errnum: public cta::exception::Exception {
public:
Errnum(std::string what = "");
Errnum (int err, std::string what = "");
virtual ~Errnum() throw() {};
int errorNumber() const { return m_errnum; }
std::string strError() const { return m_strerror; }
static void throwOnReturnedErrno(int err, std::string context = "");
static void throwOnNonZero(int status, std::string context = "");
static void throwOnZero(int status, std::string context = "");
static void throwOnNull(void * f, std::string context = "");
static void throwOnNegative(int ret, std::string context = "");
static void throwOnMinusOne(int ret, std::string context = "");
protected:
void ErrnumConstructorBottomHalf(const std::string & what);
int m_errnum;
std::string m_strerror;
};
}
}
......@@ -22,7 +22,7 @@
*****************************************************************************/
#include "common/exception/Exception.hpp"
#include "Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include <errno.h>
#include <gtest/gtest.h>
......@@ -75,51 +75,51 @@ namespace unitTests {
}
}
TEST(castor_exceptions, errnum_throwing) {
TEST(cta_exceptions, errnum_throwing) {
/* Mickey Mouse test as we had trouble which throwing Errnum (with errno=ENOENT)*/
errno = ENOENT;
try {
throw castor::exception::Errnum("Test ENOENT");
throw cta::exception::Errnum("Test ENOENT");
} catch (std::exception & e) {
std::string temp = e.what();
temp += " ";
}
}
TEST(castor_exceptions, Errnum_throwers) {
TEST(cta_exceptions, Errnum_throwers) {
/* throwOnReturnedErrno */
ASSERT_NO_THROW(castor::exception::Errnum::throwOnReturnedErrno(0, "Context"));
ASSERT_THROW(castor::exception::Errnum::throwOnReturnedErrno(ENOSPC, "Context"),
castor::exception::Errnum);
ASSERT_NO_THROW(cta::exception::Errnum::throwOnReturnedErrno(0, "Context"));
ASSERT_THROW(cta::exception::Errnum::throwOnReturnedErrno(ENOSPC, "Context"),
cta::exception::Errnum);
/* throwOnNonZero */
errno = ENOENT;
ASSERT_NO_THROW(castor::exception::Errnum::throwOnNonZero(0, "Context"));
ASSERT_THROW(castor::exception::Errnum::throwOnNonZero(-1, "Context"),
castor::exception::Errnum);
ASSERT_NO_THROW(cta::exception::Errnum::throwOnNonZero(0, "Context"));
ASSERT_THROW(cta::exception::Errnum::throwOnNonZero(-1, "Context"),
cta::exception::Errnum);
/* throwOnMinusOne */
errno = ENOENT;
ASSERT_NO_THROW(castor::exception::Errnum::throwOnMinusOne(0, "Context"));
ASSERT_THROW(castor::exception::Errnum::throwOnMinusOne(-1, "Context"),
castor::exception::Errnum);
ASSERT_NO_THROW(cta::exception::Errnum::throwOnMinusOne(0, "Context"));
ASSERT_THROW(cta::exception::Errnum::throwOnMinusOne(-1, "Context"),
cta::exception::Errnum);
/* throwOnNegative */
errno = ENOENT;
ASSERT_NO_THROW(castor::exception::Errnum::throwOnNegative(0, "Context"));
ASSERT_THROW(castor::exception::Errnum::throwOnNegative(-1, "Context"),
castor::exception::Errnum);
ASSERT_NO_THROW(cta::exception::Errnum::throwOnNegative(0, "Context"));
ASSERT_THROW(cta::exception::Errnum::throwOnNegative(-1, "Context"),
cta::exception::Errnum);
/* throwOnNull */
errno = ENOENT;
ASSERT_NO_THROW(castor::exception::Errnum::throwOnNull(this, "Context"));
ASSERT_THROW(castor::exception::Errnum::throwOnNull(NULL, "Context"),
castor::exception::Errnum);
ASSERT_NO_THROW(cta::exception::Errnum::throwOnNull(this, "Context"));
ASSERT_THROW(cta::exception::Errnum::throwOnNull(NULL, "Context"),
cta::exception::Errnum);
/* throwOnZero */
errno = ENOENT;
ASSERT_NO_THROW(castor::exception::Errnum::throwOnZero(1, "Context"));
ASSERT_THROW(castor::exception::Errnum::throwOnZero(0, "Context"),
castor::exception::Errnum);
ASSERT_NO_THROW(cta::exception::Errnum::throwOnZero(1, "Context"));
ASSERT_THROW(cta::exception::Errnum::throwOnZero(0, "Context"),
cta::exception::Errnum);
}
}
......@@ -24,7 +24,7 @@
#include "castor/io/io.hpp"
#include "castor/utils/SmartFd.hpp"
#include "castor/io/marshall.h"
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include <fcntl.h>
#include <gtest/gtest.h>
......@@ -82,7 +82,7 @@ protected:
strncpy(listenAddr.sun_path, listenSockPath,
sizeof(listenAddr.sun_path) - 1);
castor::exception::Errnum::throwOnNonZero(
cta::exception::Errnum::throwOnNonZero(
bind(smartListenSock.get(), (const struct sockaddr *)&listenAddr,
sizeof(listenAddr)), "Call to bind() failed: ");
}
......
#include "castor/messages/Mutex.hpp"
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
......@@ -7,17 +7,17 @@
//------------------------------------------------------------------------------
castor::messages::Mutex::Mutex() {
pthread_mutexattr_t attr;
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutexattr_init(&attr),
"Error from pthread_mutexattr_init in castor::messages::Mutex::Mutex()");
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK),
"Error from pthread_mutexattr_settype in castor::messages::Mutex::Mutex()");
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_init(&m_mutex, &attr),
"Error from pthread_mutex_init in castor::messages::Mutex::Mutex()");
try {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutexattr_destroy(&attr),
"Error from pthread_mutexattr_destroy in"
" castor::messages::Mutex::Mutex()");
......@@ -38,7 +38,7 @@ castor::messages::Mutex::~Mutex() throw() {
// lock
//------------------------------------------------------------------------------
void castor::messages::Mutex::lock() {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_lock(&m_mutex),
"Error from pthread_mutex_lock in castor::messages::Mutex::lock()");
}
......@@ -47,7 +47,7 @@ void castor::messages::Mutex::lock() {
// unlock
//------------------------------------------------------------------------------
void castor::messages::Mutex::unlock() {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_unlock(&m_mutex),
"Error from pthread_mutex_unlock in castor::messages::Mutex::unlock()");
}
......@@ -21,7 +21,7 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "castor/messages/MutexLocker.hpp"
#include <gtest/gtest.h>
......@@ -46,7 +46,7 @@ TEST(castor_messages_MutexLockerTest,
{
MutexLocker ml(&m);
// This is a different flavour of duplicate locking
ASSERT_THROW(m.lock(),castor::exception::Errnum);
ASSERT_THROW(m.lock(),cta::exception::Errnum);
ASSERT_NO_THROW(m.unlock());
ASSERT_NO_THROW(m.lock());
}
......
......@@ -21,7 +21,7 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "castor/messages/Mutex.hpp"
#include <gtest/gtest.h>
......@@ -46,11 +46,11 @@ TEST(castor_messages_MutexTest, Mutex_properly_throws_exceptions) {
ASSERT_NO_THROW(m.lock());
// Duplicate lock
ASSERT_THROW(m.lock(),castor::exception::Errnum);
ASSERT_THROW(m.lock(),cta::exception::Errnum);
ASSERT_NO_THROW(m.unlock());
// Duplicate release
ASSERT_THROW(m.unlock(),castor::exception::Errnum);
ASSERT_THROW(m.unlock(),cta::exception::Errnum);
}
} // namespace unitTests
......@@ -22,7 +22,7 @@
*****************************************************************************/
#pragma once
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "common/exception/Exception.hpp"
#include <unistd.h>
......
......@@ -19,7 +19,7 @@
* @author Castor Dev team, castor-dev@cern.ch
******************************************************************************/
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "castor/server/Daemon.hpp"
#include "castor/server/ThreadNotification.hpp"
#include "castor/System.hpp"
......@@ -163,7 +163,7 @@ void castor::server::Daemon::daemonizeIfNotRunInForeground(
{
pid_t pid = 0;
castor::exception::Errnum::throwOnNegative(pid = fork(),
cta::exception::Errnum::throwOnNegative(pid = fork(),
"Failed to daemonize: Failed to fork");
// If we got a good PID, then we can exit the parent process
if (0 < pid) {
......@@ -179,17 +179,17 @@ void castor::server::Daemon::daemonizeIfNotRunInForeground(
umask(0);
// Run the daemon in a new session
castor::exception::Errnum::throwOnNegative(setsid(),
cta::exception::Errnum::throwOnNegative(setsid(),
"Failed to daemonize: Failed to run daemon is a new session");
// Redirect standard files to /dev/null
castor::exception::Errnum::throwOnNull(
cta::exception::Errnum::throwOnNull(
freopen("/dev/null", "r", stdin),
"Failed to daemonize: Falied to freopen stdin");
castor::exception::Errnum::throwOnNull(
cta::exception::Errnum::throwOnNull(
freopen("/dev/null", "w", stdout),
"Failed to daemonize: Failed to freopen stdout");
castor::exception::Errnum::throwOnNull(
cta::exception::Errnum::throwOnNull(
freopen("/dev/null", "w", stderr),
"Failed to daemonize: Failed to freopen stderr");
} // if (!m_foreground)
......
#include "castor/server/Mutex.hpp"
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
......@@ -7,17 +7,17 @@
//------------------------------------------------------------------------------
castor::server::Mutex::Mutex() {
pthread_mutexattr_t attr;
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutexattr_init(&attr),
"Error from pthread_mutexattr_init in castor::server::Mutex::Mutex()");
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK),
"Error from pthread_mutexattr_settype in castor::server::Mutex::Mutex()");
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_init(&m_mutex, &attr),
"Error from pthread_mutex_init in castor::server::Mutex::Mutex()");
try {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutexattr_destroy(&attr),
"Error from pthread_mutexattr_destroy in castor::server::Mutex::Mutex()");
} catch (...) {
......@@ -35,7 +35,7 @@ castor::server::Mutex::~Mutex() {
//lock
//------------------------------------------------------------------------------
void castor::server::Mutex::lock() {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_lock(&m_mutex),
"Error from pthread_mutex_lock in castor::server::Mutex::lock()");
}
......@@ -43,7 +43,7 @@ void castor::server::Mutex::lock() {
//unlock
//------------------------------------------------------------------------------
void castor::server::Mutex::unlock() {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_unlock(&m_mutex),
"Error from pthread_mutex_unlock in castor::server::Mutex::unlock()");
}
#include "castor/server/MutexLocker.hpp"
#include "castor/server/Semaphores.hpp"
#include "castor/server/Threading.hpp"
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "common/exception/Exception.hpp"
#include <errno.h>
#include <sys/time.h>
......@@ -11,7 +11,7 @@
//------------------------------------------------------------------------------
castor::server::PosixSemaphore::PosixSemaphore(int initial)
{
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
sem_init(&m_sem, 0, initial),
"Error from sem_init in castor::server::PosixSemaphore::PosixSemaphore()");
}
......@@ -34,7 +34,7 @@ void castor::server::PosixSemaphore::acquire()
/* If we receive EINTR, we should just keep trying (signal interruption) */
while((ret = sem_wait(&m_sem)) && EINTR == errno) {}
/* If it was not EINTR, it's a failure */
castor::exception::Errnum::throwOnNonZero(ret,
cta::exception::Errnum::throwOnNonZero(ret,
"Error from sem_wait in castor::server::PosixSemaphore::acquire()");
}
//------------------------------------------------------------------------------
......@@ -57,7 +57,7 @@ void castor::server::PosixSemaphore::acquireWithTimeout(uint64_t timeout_us)
/* If we got a timeout, throw a special exception */
if (ret && ETIMEDOUT == errno) { throw Timeout(); }
/* If it was not EINTR, it's a failure */
castor::exception::Errnum::throwOnNonZero(ret,
cta::exception::Errnum::throwOnNonZero(ret,
"Error from sem_wait in castor::server::PosixSemaphore::acquireWithTimeout()");
}
......@@ -69,7 +69,7 @@ bool castor::server::PosixSemaphore::tryAcquire()
int ret = sem_trywait(&m_sem);
if (!ret) return true;
if (ret && EAGAIN == errno) return false;
castor::exception::Errnum::throwOnNonZero(ret,
cta::exception::Errnum::throwOnNonZero(ret,
"Error from sem_trywait in castor::server::PosixSemaphore::tryAcquire()");
/* unreacheable, just for compiler happiness */
return false;
......@@ -81,7 +81,7 @@ void castor::server::PosixSemaphore::release(int n)
{
for (int i=0; i<n; i++) {
MutexLocker ml(&m_mutexPosterProtection);
castor::exception::Errnum::throwOnNonZero(sem_post(&m_sem),
cta::exception::Errnum::throwOnNonZero(sem_post(&m_sem),
"Error from sem_post in castor::server::PosixSemaphore::release()");
}
}
......@@ -90,10 +90,10 @@ void castor::server::PosixSemaphore::release(int n)
//------------------------------------------------------------------------------
castor::server::CondVarSemaphore::CondVarSemaphore(int initial)
:m_value(initial) {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_cond_init(&m_cond, NULL),
"Error from pthread_cond_init in castor::server::CondVarSemaphore::CondVarSemaphore()");
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_init(&m_mutex, NULL),
"Error from pthread_mutex_init in castor::server::CondVarSemaphore::CondVarSemaphore()");
}
......@@ -115,16 +115,16 @@ castor::server::CondVarSemaphore::~CondVarSemaphore() {
//------------------------------------------------------------------------------
void castor::server::CondVarSemaphore::acquire()
{
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_lock(&m_mutex),
"Error from pthread_mutex_lock in castor::server::CondVarSemaphore::acquire()");
while (m_value <= 0) {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_cond_wait(&m_cond, &m_mutex),
"Error from pthread_cond_wait in castor::server::CondVarSemaphore::acquire()");
}
m_value--;
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_unlock(&m_mutex),
"Error from pthread_mutex_unlock in castor::server::CondVarSemaphore::acquire()");
}
......@@ -134,7 +134,7 @@ void castor::server::CondVarSemaphore::acquire()
bool castor::server::CondVarSemaphore::tryAcquire()
{
bool ret;
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_lock(&m_mutex),
"Error from pthread_mutex_lock in castor::server::CondVarSemaphore::tryAcquire()");
if (m_value > 0) {
......@@ -143,7 +143,7 @@ bool castor::server::CondVarSemaphore::tryAcquire()
} else {
ret = false;
}
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_unlock(&m_mutex),
"Error from pthread_mutex_unlock in castor::server::CondVarSemaphore::tryAcquire()");
return ret;
......@@ -154,14 +154,14 @@ bool castor::server::CondVarSemaphore::tryAcquire()
void castor::server::CondVarSemaphore::release(int n)
{
for (int i=0; i<n; i++) {
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_lock(&m_mutex),
"Error from pthread_mutex_unlock in castor::server::CondVarSemaphore::release()");
m_value++;
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_cond_signal(&m_cond),
"Error from pthread_cond_signal in castor::server::CondVarSemaphore::release()");
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_mutex_unlock(&m_mutex),
"Error from pthread_mutex_unlock in castor::server::CondVarSemaphore::release()");
}
......
......@@ -34,7 +34,7 @@
//------------------------------------------------------------------------------
void castor::server::Thread::start()
{
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_create(&m_thread, NULL, pthread_runner, this),
"Error from pthread_create in castor::server::Thread::start()");
}
......@@ -43,7 +43,7 @@ void castor::server::Thread::start()
//------------------------------------------------------------------------------
void castor::server::Thread::wait()
{
castor::exception::Errnum::throwOnReturnedErrno(
cta::exception::Errnum::throwOnReturnedErrno(
pthread_join(m_thread, NULL),
"Error from pthread_join in castor::server::Thread::wait()");
if (m_hadException) {
......
......@@ -25,7 +25,7 @@
#include <pthread.h>
#include <semaphore.h>
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
#include "castor/server/Mutex.hpp"
#include "common/exception/Exception.hpp"
......
......@@ -39,10 +39,10 @@ namespace unitTests {
castor::server::Mutex m;
ASSERT_NO_THROW(m.lock());
/* Duplicate lock */
ASSERT_THROW(m.lock(),castor::exception::Errnum);
ASSERT_THROW(m.lock(),cta::exception::Errnum);
ASSERT_NO_THROW(m.unlock());
/* Duplicate release */
ASSERT_THROW(m.unlock(),castor::exception::Errnum);
ASSERT_THROW(m.unlock(),cta::exception::Errnum);
}
TEST(castor_tape_threading, MutexLocker_locks_and_properly_throws_exceptions) {
......@@ -50,7 +50,7 @@ namespace unitTests {
{
castor::server::MutexLocker ml(&m);
/* This is a different flavourr of duplicate locking */
ASSERT_THROW(m.lock(),castor::exception::Errnum);
ASSERT_THROW(m.lock(),cta::exception::Errnum);
ASSERT_NO_THROW(m.unlock());
ASSERT_NO_THROW(m.lock());
}
......
......@@ -25,7 +25,7 @@
#include <scsi/sg.h>
#include "Device.hpp"
#include "castor/exception/Errnum.hpp"
#include "common/exception/Errnum.hpp"
using namespace castor::tape;
......@@ -40,7 +40,7 @@ SCSI::DeviceVector::DeviceVector(System::virtualWrapper& sysWrapper) : m_sysWrap
utils::Regex ifFirstCharIsDigit("^[[:digit:]]");
std::vector<std::string> checkResult;
DIR* dirp;
castor::exception::Errnum::throwOnNull(
cta::exception::Errnum::throwOnNull(
dirp = m_sysWrapper.opendir(sysDevsPath.c_str()),
"Error opening sysfs scsi devs");
while (struct dirent * dent = m_sysWrapper.readdir(dirp)) {
......@@ -51,7 +51,7 @@ SCSI::DeviceVector::DeviceVector(System::virtualWrapper& sysWrapper) : m_sysWrap
std::string fullpath = sysDevsPath + "/" + std::string(dent->d_name);
/* We expect only symbolic links in this directory, */
char rp[PATH_MAX];
castor::exception::Errnum::throwOnNull(
cta::exception::Errnum::throwOnNull(