summaryrefslogtreecommitdiff
path: root/netfs/fuse.h
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2009-10-23 19:17:14 +0000
committerrandomdan <randomdan@localhost>2009-10-23 19:17:14 +0000
commit212a4763b7f5236e05b38f6ab5190678e1926c0a (patch)
treeecd19468f47e1993a6e669b826a00c2f09d43337 /netfs/fuse.h
parentAll messages coded, change to ensure msg IDs are unique at compile time (diff)
downloadnetfs-212a4763b7f5236e05b38f6ab5190678e1926c0a.tar.bz2
netfs-212a4763b7f5236e05b38f6ab5190678e1926c0a.tar.xz
netfs-212a4763b7f5236e05b38f6ab5190678e1926c0a.zip
All basic funcs implemented, not tested
Diffstat (limited to 'netfs/fuse.h')
-rw-r--r--netfs/fuse.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/netfs/fuse.h b/netfs/fuse.h
new file mode 100644
index 0000000..dc0a124
--- /dev/null
+++ b/netfs/fuse.h
@@ -0,0 +1,60 @@
+#ifndef FUSE_H
+#define FUSE_H
+
+#include "fuseapp.h"
+#include "comms.h"
+
+class NetFS : public FuseAppBase
+{
+ // misc
+ int access(const char * p, int a);
+ int getattr(const char * p, struct stat * s);
+ int fgetattr(const char *, struct stat *, struct fuse_file_info *);
+ int chmod(const char *, mode_t);
+ int chown(const char *, uid_t, gid_t);
+ int link(const char *, const char *);
+ int readlink(const char *, char *, size_t);
+ int rename(const char *, const char *);
+ int symlink(const char *, const char *);
+ int unlink(const char *);
+ // dirs
+ int opendir(const char * p, struct fuse_file_info * fi);
+ int releasedir(const char *, struct fuse_file_info * fi);
+ int readdir(const char *, void * buf, fuse_fill_dir_t filler, off_t, struct fuse_file_info * fi);
+ int mkdir(const char *, mode_t);
+ int rmdir(const char *);
+ // files
+ int open(const char * p, struct fuse_file_info * fi);
+ int create(const char *, mode_t, struct fuse_file_info *);
+ int release(const char *, struct fuse_file_info * fi);
+ int read(const char *, char * buf, size_t s, off_t o, struct fuse_file_info * fi);
+ int write(const char *, const char * buf, size_t s, off_t o, struct fuse_file_info * fi);
+ int truncate(const char *, off_t);
+ int ftruncate(const char *, off_t, struct fuse_file_info *);
+ // fs
+ int statfs(const char *, struct statvfs *);
+ // stuff
+ public:
+ NetFS();
+ ~NetFS();
+ DataPayloadPtr exchange(DataPayloadPtr dp);
+ void send(DataPayloadPtr dp);
+ DataPayloadPtr recv();
+ template <typename Type>
+ SmartPointer<TypedPayload<Type> > recvType()
+ {
+ DataPayloadPtr p = this->recv();
+ return p.as<TypedPayload<Type> >();
+ }
+ private:
+ FILE * f;
+};
+
+// this needs to go here to avoid circular includes regarding the net->exchange call
+template<class X>
+SmartPointer<TypedPayload<typename X::Reply> > TypedPayloadReq<X>::exchange(NetFS * net)
+{
+ DataPayloadPtr p = net->exchange(this);
+ return p.as<TypedPayload<typename X::Reply> >();
+}
+#endif