summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/daemon/daemonVolume.cpp12
-rw-r--r--netfs/daemon/daemonVolume.h1
-rw-r--r--netfs/fuse/fuse.h1
-rw-r--r--netfs/fuse/fuseMisc.cpp12
-rw-r--r--netfs/ice/volume.ice1
5 files changed, 27 insertions, 0 deletions
diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp
index c87b1b0..e21bdd0 100644
--- a/netfs/daemon/daemonVolume.cpp
+++ b/netfs/daemon/daemonVolume.cpp
@@ -73,6 +73,18 @@ VolumeServer::getattr(const NetFS::ReqEnv & re, const std::string & path, const
}
void
+VolumeServer::mknod(const NetFS::ReqEnv & re, const std::string & path, Ice::Int mode, Ice::Int dev, const Ice::Current&)
+{
+ TempPrivs tp(re, root);
+ errno = 0;
+ boost::filesystem::path p(resolvePath(path));
+ tp.AssertWrite(p.parent_path());
+ if (::mknod(p.string().c_str(), mode, dev) != 0) {
+ throw NetFS::SystemError(errno);
+ }
+}
+
+void
VolumeServer::symlink(const NetFS::ReqEnv & re, const std::string & path1, const std::string & path2, const Ice::Current &)
{
TempPrivs tp(re, root);
diff --git a/netfs/daemon/daemonVolume.h b/netfs/daemon/daemonVolume.h
index e3ca40c..8faa5ff 100644
--- a/netfs/daemon/daemonVolume.h
+++ b/netfs/daemon/daemonVolume.h
@@ -26,6 +26,7 @@ class VolumeServer : public NetFS::Volume {
virtual Ice::Int access(const NetFS::ReqEnv &, const std::string & path, Ice::Int mode, const Ice::Current&) override;
virtual NetFS::Attr getattr(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override;
+ virtual void mknod(const NetFS::ReqEnv &, const std::string & path, Ice::Int mode, Ice::Int dev, const Ice::Current&) override;
virtual void symlink(const NetFS::ReqEnv &, const std::string & path1, const std::string & path2, const Ice::Current&) override;
virtual void link(const NetFS::ReqEnv &, const std::string & path1, const std::string & path2, const Ice::Current&) override;
virtual void rename(const NetFS::ReqEnv &, const std::string & path1, const std::string & path2, const Ice::Current&) override;
diff --git a/netfs/fuse/fuse.h b/netfs/fuse/fuse.h
index 1f80686..3821285 100644
--- a/netfs/fuse/fuse.h
+++ b/netfs/fuse/fuse.h
@@ -58,6 +58,7 @@ namespace NetFS {
int symlink(const char *, const char *);
int unlink(const char *);
int utimens(const char *, const struct timespec tv[2]);
+ int mknod(const char *, mode_t, dev_t);
// dirs
int opendir(const char * p, struct fuse_file_info * fi);
int releasedir(const char *, struct fuse_file_info * fi);
diff --git a/netfs/fuse/fuseMisc.cpp b/netfs/fuse/fuseMisc.cpp
index d5064f3..0e366be 100644
--- a/netfs/fuse/fuseMisc.cpp
+++ b/netfs/fuse/fuseMisc.cpp
@@ -65,6 +65,18 @@ NetFS::FuseApp::link(const char * p1, const char * p2)
}
int
+NetFS::FuseApp::mknod(const char * p, mode_t mode, dev_t dev)
+{
+ try {
+ volume->mknod(reqEnv(), p, mode, dev);
+ return 0;
+ }
+ catch (NetFS::SystemError & e) {
+ return -e.syserrno;
+ }
+}
+
+int
NetFS::FuseApp::symlink(const char * p1, const char * p2)
{
try {
diff --git a/netfs/ice/volume.ice b/netfs/ice/volume.ice
index 7b0e3e0..34f46ba 100644
--- a/netfs/ice/volume.ice
+++ b/netfs/ice/volume.ice
@@ -29,6 +29,7 @@ module NetFS {
void mkdir(ReqEnv env, string path, int mode) throws AuthError, SystemError;
void rmdir(ReqEnv env, string path) throws AuthError, SystemError;
+ void mknod(ReqEnv env, string path, int mode, int dev) throws AuthError, SystemError;
void symlink(ReqEnv env, string path1, string path2) throws AuthError, SystemError;
void link(ReqEnv env, string path1, string path2) throws AuthError, SystemError;
void rename(ReqEnv env, string from, string to) throws AuthError, SystemError;