2015-04-23 09:18:30 +02:00
|
|
|
#include "CrySymlink.h"
|
|
|
|
|
|
|
|
#include "messmer/fspp/fuse/FuseErrnoException.h"
|
|
|
|
#include "CryDevice.h"
|
|
|
|
#include "CrySymlink.h"
|
2015-10-04 17:20:14 +02:00
|
|
|
#include "parallelaccessfsblobstore/SymlinkBlobRef.h"
|
2015-04-23 09:18:30 +02:00
|
|
|
|
|
|
|
//TODO Get rid of this in favor of exception hierarchy
|
|
|
|
using fspp::fuse::CHECK_RETVAL;
|
|
|
|
using fspp::fuse::FuseErrnoException;
|
|
|
|
|
|
|
|
namespace bf = boost::filesystem;
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
using blockstore::Key;
|
2015-06-18 12:47:08 +02:00
|
|
|
using boost::none;
|
2015-06-18 13:45:08 +02:00
|
|
|
using boost::optional;
|
2015-06-18 13:14:43 +02:00
|
|
|
using cpputils::unique_ref;
|
2015-06-18 13:45:08 +02:00
|
|
|
using cpputils::make_unique_ref;
|
2015-09-30 13:21:07 +02:00
|
|
|
using cpputils::dynamic_pointer_move;
|
2015-10-04 17:20:14 +02:00
|
|
|
using cryfs::parallelaccessfsblobstore::SymlinkBlobRef;
|
|
|
|
using cryfs::parallelaccessfsblobstore::DirBlobRef;
|
2015-04-23 09:18:30 +02:00
|
|
|
|
|
|
|
namespace cryfs {
|
|
|
|
|
2015-10-04 17:20:14 +02:00
|
|
|
CrySymlink::CrySymlink(CryDevice *device, unique_ref<DirBlobRef> parent, const Key &key)
|
2015-04-23 09:18:30 +02:00
|
|
|
: CryNode(device, std::move(parent), key) {
|
|
|
|
}
|
|
|
|
|
|
|
|
CrySymlink::~CrySymlink() {
|
|
|
|
}
|
|
|
|
|
2015-10-04 17:20:14 +02:00
|
|
|
unique_ref<SymlinkBlobRef> CrySymlink::LoadBlob() const {
|
2015-06-18 12:47:08 +02:00
|
|
|
auto blob = CryNode::LoadBlob();
|
2015-10-04 17:20:14 +02:00
|
|
|
auto symlink_blob = dynamic_pointer_move<SymlinkBlobRef>(blob);
|
2015-09-30 13:21:07 +02:00
|
|
|
ASSERT(symlink_blob != none, "Blob does not store a symlink");
|
|
|
|
return std::move(*symlink_blob);
|
2015-04-23 09:18:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fspp::Dir::EntryType CrySymlink::getType() const {
|
|
|
|
return fspp::Dir::EntryType::SYMLINK;
|
|
|
|
}
|
|
|
|
|
|
|
|
bf::path CrySymlink::target() const {
|
2015-06-18 13:45:08 +02:00
|
|
|
auto blob = LoadBlob();
|
2015-09-30 13:21:07 +02:00
|
|
|
return blob->target();
|
2015-04-23 09:18:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|