summaryrefslogtreecommitdiff
path: root/netfs/fuse.h
blob: a4e63358b3edbb0a8ecd24e484a62aadbe2365b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef FUSE_H
#define FUSE_H

#include <Ice/Ice.h>
#include "netfsComms.h"
#include "fuseapp.h"
#include "fuseConfig.h"

class NetFS : public FuseAppBase 
{
	public:
		class ReqEnv : public NetFSComms::ReqEnv {
			public:
				ReqEnv(Ice::Long at);
			private:
				static std::map<uid_t, std::string> uidcache;
				static std::map<gid_t, std::string> gidcache;
				static void makeugidCache();
		};
		NetFS(int & argc, char ** argv);
		~NetFS();
	private:
		void * init (struct fuse_conn_info * info);
		int opt_parse(void *, const char * arg, int key, struct fuse_args *);
		// 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

		ReqEnv reqEnv();

		int & _argc;
		char ** _argv;
		Ice::CommunicatorPtr ic;
		FuseConfigPtr fc;

		NetFSComms::FilesPrx files;
		NetFSComms::DirsPrx dirs;
		NetFSComms::MiscPrx misc;
		NetFSComms::SystemPrx system;
		NetFSComms::ServicePrx service;

		Ice::Long authtok;

		std::string mountPoint;
		std::string exportName;
		std::string configPath;
};

#endif