blob: f13adbdf37a96d84152ed2f0f77f15fa41cbc2a1 [file] [log] [blame]
bigbiff bigbiff9c754052013-01-09 09:09:08 -05001/*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
4
5 This program can be distributed under the terms of the GNU LGPLv2.
6 See the file COPYING.LIB.
7*/
8
9/* these definitions provide source compatibility to prior versions.
10 Do not include this file directly! */
11
Matt Mower523a0592015-12-13 11:31:00 -060012#include "fuse_common.h"
13
bigbiff bigbiff9c754052013-01-09 09:09:08 -050014struct fuse_lowlevel_ops_compat25 {
15 void (*init) (void *userdata);
16 void (*destroy) (void *userdata);
17 void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
18 void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
19 void (*getattr) (fuse_req_t req, fuse_ino_t ino,
20 struct fuse_file_info *fi);
21 void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
22 int to_set, struct fuse_file_info *fi);
23 void (*readlink) (fuse_req_t req, fuse_ino_t ino);
24 void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
25 mode_t mode, dev_t rdev);
26 void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
27 mode_t mode);
28 void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
29 void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
30 void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
31 const char *name);
32 void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
33 fuse_ino_t newparent, const char *newname);
34 void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
35 const char *newname);
36 void (*open) (fuse_req_t req, fuse_ino_t ino,
37 struct fuse_file_info *fi);
Matt Mower523a0592015-12-13 11:31:00 -060038 void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, loff_t off,
bigbiff bigbiff9c754052013-01-09 09:09:08 -050039 struct fuse_file_info *fi);
40 void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
Matt Mower523a0592015-12-13 11:31:00 -060041 size_t size, loff_t off, struct fuse_file_info *fi);
bigbiff bigbiff9c754052013-01-09 09:09:08 -050042 void (*flush) (fuse_req_t req, fuse_ino_t ino,
43 struct fuse_file_info *fi);
44 void (*release) (fuse_req_t req, fuse_ino_t ino,
45 struct fuse_file_info *fi);
46 void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
47 struct fuse_file_info *fi);
48 void (*opendir) (fuse_req_t req, fuse_ino_t ino,
49 struct fuse_file_info *fi);
Matt Mower523a0592015-12-13 11:31:00 -060050 void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, loff_t off,
bigbiff bigbiff9c754052013-01-09 09:09:08 -050051 struct fuse_file_info *fi);
52 void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
53 struct fuse_file_info *fi);
54 void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
55 struct fuse_file_info *fi);
56 void (*statfs) (fuse_req_t req);
57 void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
58 const char *value, size_t size, int flags);
59 void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
60 size_t size);
61 void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size);
62 void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name);
63 void (*access) (fuse_req_t req, fuse_ino_t ino, int mask);
64 void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name,
65 mode_t mode, struct fuse_file_info *fi);
66};
67
68struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args,
69 const struct fuse_lowlevel_ops_compat25 *op,
70 size_t op_size, void *userdata);
71
72size_t fuse_dirent_size(size_t namelen);
73
74char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf,
Matt Mower523a0592015-12-13 11:31:00 -060075 loff_t off);
bigbiff bigbiff9c754052013-01-09 09:09:08 -050076
Dees_Troye34c1332013-02-06 19:13:00 +000077#if !defined(__FreeBSD__) && !defined(__NetBSD__)
bigbiff bigbiff9c754052013-01-09 09:09:08 -050078
79#include <sys/statfs.h>
80
81struct fuse_lowlevel_ops_compat {
82 void (*init) (void *userdata);
83 void (*destroy) (void *userdata);
84 void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
85 void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
86 void (*getattr) (fuse_req_t req, fuse_ino_t ino,
87 struct fuse_file_info_compat *fi);
88 void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
89 int to_set, struct fuse_file_info_compat *fi);
90 void (*readlink) (fuse_req_t req, fuse_ino_t ino);
91 void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
92 mode_t mode, dev_t rdev);
93 void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
94 mode_t mode);
95 void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
96 void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
97 void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
98 const char *name);
99 void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
100 fuse_ino_t newparent, const char *newname);
101 void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
102 const char *newname);
103 void (*open) (fuse_req_t req, fuse_ino_t ino,
104 struct fuse_file_info_compat *fi);
Matt Mower523a0592015-12-13 11:31:00 -0600105 void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, loff_t off,
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500106 struct fuse_file_info_compat *fi);
107 void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
Matt Mower523a0592015-12-13 11:31:00 -0600108 size_t size, loff_t off, struct fuse_file_info_compat *fi);
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500109 void (*flush) (fuse_req_t req, fuse_ino_t ino,
110 struct fuse_file_info_compat *fi);
111 void (*release) (fuse_req_t req, fuse_ino_t ino,
112 struct fuse_file_info_compat *fi);
113 void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
114 struct fuse_file_info_compat *fi);
115 void (*opendir) (fuse_req_t req, fuse_ino_t ino,
116 struct fuse_file_info_compat *fi);
Matt Mower523a0592015-12-13 11:31:00 -0600117 void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, loff_t off,
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500118 struct fuse_file_info_compat *fi);
119 void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
120 struct fuse_file_info_compat *fi);
121 void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
122 struct fuse_file_info_compat *fi);
123 void (*statfs) (fuse_req_t req);
124 void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
125 const char *value, size_t size, int flags);
126 void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
127 size_t size);
128 void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size);
129 void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name);
130 void (*access) (fuse_req_t req, fuse_ino_t ino, int mask);
131 void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name,
132 mode_t mode, struct fuse_file_info_compat *fi);
133};
134
135int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf);
136
137int fuse_reply_open_compat(fuse_req_t req,
138 const struct fuse_file_info_compat *fi);
139
140struct fuse_session *fuse_lowlevel_new_compat(const char *opts,
141 const struct fuse_lowlevel_ops_compat *op,
142 size_t op_size, void *userdata);
143
Dees_Troye34c1332013-02-06 19:13:00 +0000144#endif /* __FreeBSD__ || __NetBSD__ */
bigbiff bigbiff9c754052013-01-09 09:09:08 -0500145
146struct fuse_chan_ops_compat24 {
147 int (*receive)(struct fuse_chan *ch, char *buf, size_t size);
148 int (*send)(struct fuse_chan *ch, const struct iovec iov[],
149 size_t count);
150 void (*destroy)(struct fuse_chan *ch);
151};
152
153struct fuse_chan *fuse_chan_new_compat24(struct fuse_chan_ops_compat24 *op,
154 int fd, size_t bufsize, void *data);
155
156int fuse_chan_receive(struct fuse_chan *ch, char *buf, size_t size);
157struct fuse_chan *fuse_kern_chan_new(int fd);