OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LIBRARIES_NACL_IO_FUSE_H_ | 5 #ifndef LIBRARIES_NACL_IO_FUSE_H_ |
6 #define LIBRARIES_NACL_IO_FUSE_H_ | 6 #define LIBRARIES_NACL_IO_FUSE_H_ |
7 | 7 |
8 #include "osinttypes.h" | 8 #include "osinttypes.h" |
9 #include "ostypes.h" | 9 #include "ostypes.h" |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // is non-NULL. | 112 // is non-NULL. |
113 int (*mknod)(const char* path, mode_t, dev_t); | 113 int (*mknod)(const char* path, mode_t, dev_t); |
114 // Called by open() | 114 // Called by open() |
115 int (*open)(const char* path, struct fuse_file_info*); | 115 int (*open)(const char* path, struct fuse_file_info*); |
116 // Called by getdents(), which is called by the more standard functions | 116 // Called by getdents(), which is called by the more standard functions |
117 // opendir()/readdir(). | 117 // opendir()/readdir(). |
118 int (*opendir)(const char* path, struct fuse_file_info*); | 118 int (*opendir)(const char* path, struct fuse_file_info*); |
119 // Called by read(). Note that FUSE specifies that all reads will fill the | 119 // Called by read(). Note that FUSE specifies that all reads will fill the |
120 // entire requested buffer. If this function returns less than that, the | 120 // entire requested buffer. If this function returns less than that, the |
121 // remainder of the buffer is zeroed. | 121 // remainder of the buffer is zeroed. |
122 int (*read)(const char* path, char* buf, size_t count, off_t, | 122 int (*read)(const char* path, |
| 123 char* buf, |
| 124 size_t count, |
| 125 off_t, |
123 struct fuse_file_info*); | 126 struct fuse_file_info*); |
124 // Called by getdents(), which is called by the more standard function | 127 // Called by getdents(), which is called by the more standard function |
125 // readdir(). | 128 // readdir(). |
126 // | 129 // |
127 // NOTE: it is the responsibility of this function to add the "." and ".." | 130 // NOTE: it is the responsibility of this function to add the "." and ".." |
128 // entries. | 131 // entries. |
129 // | 132 // |
130 // This function can be implemented one of two ways: | 133 // This function can be implemented one of two ways: |
131 // 1) Ignore the offset, and always write every entry in a given directory. | 134 // 1) Ignore the offset, and always write every entry in a given directory. |
132 // In this case, you should always call filler() with an offset of 0. You | 135 // In this case, you should always call filler() with an offset of 0. You |
(...skipping 27 matching lines...) Expand all Loading... |
160 // return 0; | 163 // return 0; |
161 // } | 164 // } |
162 // offset += sizeof(dirent); | 165 // offset += sizeof(dirent); |
163 // entry_index++; | 166 // entry_index++; |
164 // } | 167 // } |
165 // | 168 // |
166 // // No more entries, we're done. | 169 // // No more entries, we're done. |
167 // return 0; | 170 // return 0; |
168 // } | 171 // } |
169 // | 172 // |
170 int (*readdir)(const char* path, void* buf, fuse_fill_dir_t filldir, off_t, | 173 int (*readdir)(const char* path, |
| 174 void* buf, |
| 175 fuse_fill_dir_t filldir, |
| 176 off_t, |
171 struct fuse_file_info*); | 177 struct fuse_file_info*); |
172 // Called when the last reference to this node is released. This is only | 178 // Called when the last reference to this node is released. This is only |
173 // called for regular files. For directories, fuse_operations.releasedir is | 179 // called for regular files. For directories, fuse_operations.releasedir is |
174 // called instead. | 180 // called instead. |
175 int (*release)(const char* path, struct fuse_file_info*); | 181 int (*release)(const char* path, struct fuse_file_info*); |
176 // Called when the last reference to this node is released. This is only | 182 // Called when the last reference to this node is released. This is only |
177 // called for directories. For regular files, fuse_operations.release is | 183 // called for directories. For regular files, fuse_operations.release is |
178 // called instead. | 184 // called instead. |
179 int (*releasedir)(const char* path, struct fuse_file_info*); | 185 int (*releasedir)(const char* path, struct fuse_file_info*); |
180 // Called by rename() | 186 // Called by rename() |
181 int (*rename)(const char* path, const char* new_path); | 187 int (*rename)(const char* path, const char* new_path); |
182 // Called by rmdir() | 188 // Called by rmdir() |
183 int (*rmdir)(const char* path); | 189 int (*rmdir)(const char* path); |
184 // Called by truncate(), as well as open() when O_TRUNC is passed. | 190 // Called by truncate(), as well as open() when O_TRUNC is passed. |
185 int (*truncate)(const char* path, off_t); | 191 int (*truncate)(const char* path, off_t); |
186 // Called by unlink() | 192 // Called by unlink() |
187 int (*unlink)(const char* path); | 193 int (*unlink)(const char* path); |
188 // Called by write(). Note that FUSE specifies that a write should always | 194 // Called by write(). Note that FUSE specifies that a write should always |
189 // return the full count, unless an error occurs. | 195 // return the full count, unless an error occurs. |
190 int (*write)(const char* path, const char* buf, size_t count, off_t, | 196 int (*write)(const char* path, |
| 197 const char* buf, |
| 198 size_t count, |
| 199 off_t, |
191 struct fuse_file_info*); | 200 struct fuse_file_info*); |
192 | 201 |
193 // The following functions are not currently called by the nacl_io | 202 // The following functions are not currently called by the nacl_io |
194 // implementation of FUSE. | 203 // implementation of FUSE. |
195 int (*bmap)(const char*, size_t blocksize, uint64_t* idx); | 204 int (*bmap)(const char*, size_t blocksize, uint64_t* idx); |
196 int (*chmod)(const char*, mode_t); | 205 int (*chmod)(const char*, mode_t); |
197 int (*chown)(const char*, uid_t, gid_t); | 206 int (*chown)(const char*, uid_t, gid_t); |
198 int (*fallocate)(const char*, int, off_t, off_t, struct fuse_file_info*); | 207 int (*fallocate)(const char*, int, off_t, off_t, struct fuse_file_info*); |
199 int (*flock)(const char*, struct fuse_file_info*, int op); | 208 int (*flock)(const char*, struct fuse_file_info*, int op); |
200 int (*flush)(const char*, struct fuse_file_info*); | 209 int (*flush)(const char*, struct fuse_file_info*); |
201 int (*fsyncdir)(const char*, int, struct fuse_file_info*); | 210 int (*fsyncdir)(const char*, int, struct fuse_file_info*); |
202 int (*getxattr)(const char*, const char*, char*, size_t); | 211 int (*getxattr)(const char*, const char*, char*, size_t); |
203 int (*ioctl)(const char*, int cmd, void* arg, struct fuse_file_info*, | 212 int (*ioctl)(const char*, |
204 unsigned int flags, void* data); | 213 int cmd, |
| 214 void* arg, |
| 215 struct fuse_file_info*, |
| 216 unsigned int flags, |
| 217 void* data); |
205 int (*link)(const char*, const char*); | 218 int (*link)(const char*, const char*); |
206 int (*listxattr)(const char*, char*, size_t); | 219 int (*listxattr)(const char*, char*, size_t); |
207 int (*lock)(const char*, struct fuse_file_info*, int cmd, struct flock*); | 220 int (*lock)(const char*, struct fuse_file_info*, int cmd, struct flock*); |
208 int (*poll)(const char*, struct fuse_file_info*, struct fuse_pollhandle* ph, | 221 int (*poll)(const char*, |
| 222 struct fuse_file_info*, |
| 223 struct fuse_pollhandle* ph, |
209 unsigned* reventsp); | 224 unsigned* reventsp); |
210 int (*read_buf)(const char*, struct fuse_bufvec** bufp, size_t size, | 225 int (*read_buf)(const char*, |
211 off_t off, struct fuse_file_info*); | 226 struct fuse_bufvec** bufp, |
| 227 size_t size, |
| 228 off_t off, |
| 229 struct fuse_file_info*); |
212 int (*readlink)(const char*, char*, size_t); | 230 int (*readlink)(const char*, char*, size_t); |
213 int (*removexattr)(const char*, const char*); | 231 int (*removexattr)(const char*, const char*); |
214 int (*setxattr)(const char*, const char*, const char*, size_t, int); | 232 int (*setxattr)(const char*, const char*, const char*, size_t, int); |
215 int (*statfs)(const char*, struct statvfs*); | 233 int (*statfs)(const char*, struct statvfs*); |
216 int (*symlink)(const char*, const char*); | 234 int (*symlink)(const char*, const char*); |
217 int (*utimens)(const char*, const struct timespec tv[2]); | 235 int (*utimens)(const char*, const struct timespec tv[2]); |
218 int (*write_buf)(const char*, struct fuse_bufvec* buf, off_t off, | 236 int (*write_buf)(const char*, |
| 237 struct fuse_bufvec* buf, |
| 238 off_t off, |
219 struct fuse_file_info*); | 239 struct fuse_file_info*); |
220 }; | 240 }; |
221 | 241 |
222 #endif // LIBRARIES_NACL_IO_FUSE_H_ | 242 #endif // LIBRARIES_NACL_IO_FUSE_H_ |
OLD | NEW |