Catalog symlink(), unlink(), mkdir(), rename((), removeDir() implementations.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 9 Oct 2013 12:05:57 +0000 (14:05 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 9 Oct 2013 12:05:57 +0000 (14:05 +0200)
src/VfsNs.cpp

index b1787ac..50106c9 100644 (file)
@@ -1,6 +1,7 @@
 /// @file   VfsNs.cpp
 /// @brief  VFS namespace.
 /// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <utime.h>
 #include <cstdio>
@@ -162,7 +163,7 @@ std::vector<Replica> VfsCatalog::getReplicas(const std::string& path) throw (DmE
 
 void VfsCatalog::symlink(const std::string& oldpath, const std::string& newpath) throw (DmException)
 {
-  throw DmException(EACCES, "Write mode not supported");
+  wrapCall(::symlink(oldpath.c_str(), newpath.c_str()));
 }
 
 
@@ -178,7 +179,7 @@ std::string VfsCatalog::readLink(const std::string& path) throw (DmException)
 
 void VfsCatalog::unlink(const std::string& path) throw (DmException)
 {
-  throw DmException(EACCES, "Write mode not supported");
+  wrapCall(::unlink(path.c_str()));
 }
 
 
@@ -351,21 +352,21 @@ ExtendedStat* VfsCatalog::readDirx(Directory* dir) throw (DmException)
 
 void VfsCatalog::makeDir(const std::string& path, mode_t mode) throw (DmException)
 {
-  throw DmException(EACCES, "Write mode not supported");
+  wrapCall(mkdir(path.c_str(), mode));
 }
 
 
 
 void VfsCatalog::rename(const std::string& oldPath, const std::string& newPath) throw (DmException)
 {
-  throw DmException(EACCES, "Write mode not supported");
+  wrapCall(::rename(oldPath.c_str(), newPath.c_str()));
 }
 
 
 
 void VfsCatalog::removeDir(const std::string& path) throw (DmException)
 {
-  throw DmException(EACCES, "Write mode not supported");
+  wrapCall(rmdir(path.c_str()));
 }