const Extensible& extras) throw (DmException)
{
if (!extras.hasField("token"))
- throw DmException(DM_FORBIDDEN, "Missing token");
+ throw DmException(EACCES, "Missing token");
std::string userId;
if (this->useIp_)
userId,
pfn, this->passwd_,
openmode != O_RDONLY) != kTokenOK)
- throw DmException(DM_FORBIDDEN, "Token does not validate (using %s)",
+ throw DmException(EACCES, "Token does not validate (using %s)",
this->useIp_?"IP":"DN");
// Create
void VfsIODriver::doneWriting(const std::string& pfn,
const Extensible& params) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
std::string real;
if (path.compare(0, 5, "/vfs/") != 0)
- throw DmException(DM_NO_SUCH_FILE, "File not on the /vfs/ namespace");
+ throw DmException(EINVAL, "File not on the /vfs/ namespace");
real = path.substr(4);
this->fd_ = ::open(real.c_str(), openmode, 0644);
if (this->fd_ == -1)
- throw DmException(DM_NO_SUCH_FILE, "Could not open %s (%d)", path.c_str(), errno);
+ throw DmException(errno, "Could not open %s", path.c_str());
}
void VfsIOHandler::seek(off_t offset, Whence whence) throw (DmException)
{
if ((pos_ = ::lseek(this->fd_, offset, whence)) == ((off_t) - 1))
- throw DmException(DM_INTERNAL_ERROR, "Could not seek (%d)", errno);
+ throw DmException(errno, "Could not seek (%d)", errno);
}
void VfsCatalog::addReplica(const Replica& replica) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::deleteReplica(const Replica& replica) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::symlink(const std::string& oldpath, const std::string& newpath) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::unlink(const std::string& path) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::create(const std::string& path, mode_t mode) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::setMode(const std::string& path, mode_t mode) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::setOwner(const std::string& path, uid_t newUid, gid_t newGid, bool followSymLink) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::setSize(const std::string& path, size_t newSize) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
const std::string& csumtype,
const std::string& csumvalue) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");;
+ throw DmException(EACCES, "Write mode not supported");;
}
void VfsCatalog::setAcl(const std::string& path, const Acl& acl) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::utime(const std::string& path, const struct utimbuf* buf) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
std::string VfsCatalog::getComment(const std::string& path) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED, "VfsCatalog does not implement comments");
+ throw DmException(DMLITE_SYSERR(ENOSYS),
+ "VfsCatalog does not implement comments");
}
void VfsCatalog::setComment(const std::string& path, const std::string& comment) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED, "VfsCatalog does not implement comments");
+ throw DmException(DMLITE_SYSERR(ENOSYS),
+ "VfsCatalog does not implement comments");
}
void VfsCatalog::setGuid(const std::string&, const std::string&) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED, "VfsCatalog does not support setting the GUID");
+ throw DmException(DMLITE_SYSERR(ENOSYS),
+ "VfsCatalog does not support setting the GUID");
}
void VfsCatalog::updateExtendedAttributes(const std::string& path,
const Extensible& attr) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED, "VfsCatalog does not support extended attributes");
+ throw DmException(DMLITE_SYSERR(ENOSYS),
+ "VfsCatalog does not support extended attributes");
}
PrivateDir *privateDir = dynamic_cast<PrivateDir*>(dir);
if (privateDir == NULL)
- throw DmException(DM_NULL_POINTER, "Tried to close a null directory");
+ throw DmException(DMLITE_SYSERR(EFAULT),
+ "Tried to close a null directory");
r = closedir(privateDir->dir);
delete privateDir;
PrivateDir *privateDir = dynamic_cast<PrivateDir*>(dir);
if (privateDir == NULL)
- throw DmException(DM_NULL_POINTER, "Tried to read a null directory");
+ throw DmException(DMLITE_SYSERR(EFAULT),
+ "Tried to read a null directory");
return static_cast<struct dirent*>(wrapCall(readdir(privateDir->dir)));
}
ExtendedStat* VfsCatalog::readDirx(Directory* dir) throw (DmException)
{
- PrivateDir *privateDir = static_cast<PrivateDir*>(dir);
+ PrivateDir *privateDir = static_cast<PrivateDir*>(dir);
struct dirent *ent = this->readDir(dir);
if (ent == NULL) return NULL;
void VfsCatalog::makeDir(const std::string& path, mode_t mode) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::rename(const std::string& oldPath, const std::string& newPath) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::removeDir(const std::string& path) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
void VfsCatalog::updateReplica(const Replica& replica) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}
Pool VfsPoolManager::getPool(const std::string& poolname) throw (DmException)
{
if (poolname != "vfs")
- throw DmException(DM_NO_SUCH_POOL, "Pool " + poolname + " not found");
+ throw DmException(DMLITE_NO_SUCH_POOL, "Pool " + poolname + " not found");
Pool pool;
void VfsPoolManager::newPool(const Pool&) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED,
+ throw DmException(DMLITE_SYSERR(ENOSYS),
"VfsPoolManager::newPool not implemented");
}
void VfsPoolManager::updatePool(const Pool&) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED,
+ throw DmException(DMLITE_SYSERR(ENOSYS),
"VfsPoolManager::updatePool not implemented");
}
void VfsPoolManager::deletePool(const Pool&) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED,
+ throw DmException(DMLITE_SYSERR(ENOSYS),
"VfsPoolManager::deletePool not implemented");
}
Location VfsPoolManager::whereToRead(ino_t) throw (DmException)
{
- throw DmException(DM_NOT_IMPLEMENTED, "VfsPoolManager: Access by inode not supported");
+ throw DmException(DMLITE_SYSERR(ENOSYS), "VfsPoolManager: Access by inode not supported");
}
Location VfsPoolManager::whereToWrite(const std::string& path) throw (DmException)
{
- throw DmException(DM_FORBIDDEN, "Write mode not supported");
+ throw DmException(EACCES, "Write mode not supported");
}