aboutsummaryrefslogtreecommitdiffstats
path: root/fuse.h
blob: 04faf9d7deb30c2de93bbe3ca97421db62a012e0 (plain) (blame)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
    FUSE: Filesystem in Userspace
    Copyright (C) 2001  Miklos Szeredi (mszeredi@inf.bme.hu)

    This program can be distributed under the terms of the GNU GPL.
    See the file COPYING.
*/

#include <linux/limits.h>

#define FUSE_MOUNT_VERSION 1

struct fuse_mount_data {
	int version;
	int fd;
};

#define FUSE_ROOT_INO 1

struct fuse_attr {
	unsigned short mode;
	unsigned short nlink;
	unsigned short uid;
	unsigned short gid;
	unsigned short rdev;
	unsigned long  size;
	unsigned long  blksize;
	unsigned long  blocks;
	unsigned long  atime;
	unsigned long  mtime;
	unsigned long  ctime;
};

enum fuse_opcode {
	FUSE_LOOKUP,
	FUSE_GETATTR,
	FUSE_READLINK,
	FUSE_OPEN,
	FUSE_RELEASE,
};

/* Conservative buffer size for the client */
#define FUSE_MAX_IN 8192

struct fuse_in_open {
	int flag;
};

struct fuse_out_open {
	int fd;
};

struct fuse_in_lookup {
	char name[NAME_MAX + 1];
};

struct fuse_out_lookup {
	unsigned long ino;
	struct fuse_attr attr;
};

struct fuse_out_getattr {
	struct fuse_attr attr;
};

struct fuse_out_readlink {
	char link[PATH_MAX + 1];
};

struct fuse_in_common {
	int unique;
	enum fuse_opcode opcode;
	unsigned long ino;	
};

struct fuse_out_common {
	int unique;
	int result;
};

struct fuse_in {
	struct fuse_in_common c;
	size_t argsize;
	void *arg;
};

struct fuse_out {
	struct fuse_out_common c;
	size_t argsize;
	void *arg;
};

struct fuse_dirent {
	unsigned long ino;
	unsigned short namelen;
	unsigned char type;
	char name[NAME_MAX + 1];
};

#define FUSE_NAME_OFFSET ((size_t) ((struct fuse_dirent *) 0)->name)
#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(long) - 1) & ~(sizeof(long) - 1))
#define FUSE_DIRENT_SIZE(d) \
	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)

/* 
 * Local Variables:
 * indent-tabs-mode: t
 * c-basic-offset: 8
 * End:
 */