libevfibers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eio.h
Go to the documentation of this file.
1 /********************************************************************
2 
3  Copyright 2013 Konstantin Olkhovskiy <lupus@oxnull.net>
4 
5  Licensed under the Apache License, Version 2.0 (the "License");
6  you may not use this file except in compliance with the License.
7  You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16 
17  ********************************************************************/
18 
19 #ifndef _FBR_EIO_H_
20 #define _FBR_EIO_H_
21 
32 #include <evfibers/config.h>
33 #ifndef FBR_EIO_ENABLED
34 # error "This build of libevfibers lacks support for libeio"
35 #endif
36 #include <sys/types.h>
37 #include <sys/stat.h>
38 #include <fcntl.h>
39 #include <sys/statvfs.h>
40 #include <eio.h>
41 #include <evfibers/fiber.h>
42 
46 typedef eio_ssize_t (*fbr_eio_custom_func_t)(void *data);
47 
55 struct fbr_ev_eio {
56  eio_req *req;
57  fbr_eio_custom_func_t custom_func;
58  void *custom_arg;
59  struct fbr_ev_base ev_base;
60 };
61 
70 void fbr_ev_eio_init(FBR_P_ struct fbr_ev_eio *ev, eio_req *req);
71 
83 void fbr_eio_init();
84 
85 int fbr_eio_open(FBR_P_ const char *path, int flags, mode_t mode, int pri);
86 int fbr_eio_truncate(FBR_P_ const char *path, off_t offset, int pri);
87 int fbr_eio_chown(FBR_P_ const char *path, uid_t uid, gid_t gid, int pri);
88 int fbr_eio_chmod(FBR_P_ const char *path, mode_t mode, int pri);
89 int fbr_eio_mkdir(FBR_P_ const char *path, mode_t mode, int pri);
90 int fbr_eio_rmdir(FBR_P_ const char *path, int pri);
91 int fbr_eio_unlink(FBR_P_ const char *path, int pri);
92 int fbr_eio_utime(FBR_P_ const char *path, eio_tstamp atime, eio_tstamp mtime,
93  int pri);
94 int fbr_eio_mknod(FBR_P_ const char *path, mode_t mode, dev_t dev, int pri);
95 int fbr_eio_link(FBR_P_ const char *path, const char *new_path, int pri);
96 int fbr_eio_symlink(FBR_P_ const char *path, const char *new_path, int pri);
97 int fbr_eio_rename(FBR_P_ const char *path, const char *new_path, int pri);
98 int fbr_eio_mlock(FBR_P_ void *addr, size_t length, int pri);
99 int fbr_eio_close(FBR_P_ int fd, int pri);
100 int fbr_eio_sync(FBR_P_ int pri);
101 int fbr_eio_fsync(FBR_P_ int fd, int pri);
102 int fbr_eio_fdatasync(FBR_P_ int fd, int pri);
103 int fbr_eio_futime(FBR_P_ int fd, eio_tstamp atime, eio_tstamp mtime, int pri);
104 int fbr_eio_ftruncate(FBR_P_ int fd, off_t offset, int pri);
105 int fbr_eio_fchmod(FBR_P_ int fd, mode_t mode, int pri);
106 int fbr_eio_fchown(FBR_P_ int fd, uid_t uid, gid_t gid, int pri);
107 int fbr_eio_dup2(FBR_P_ int fd, int fd2, int pri);
108 ssize_t fbr_eio_seek(FBR_P_ int fd, off_t offset, int whence, int pri);
109 ssize_t fbr_eio_read(FBR_P_ int fd, void *buf, size_t length, off_t offset,
110  int pri);
111 ssize_t fbr_eio_write(FBR_P_ int fd, void *buf, size_t length, off_t offset,
112  int pri);
113 int fbr_eio_mlockall(FBR_P_ int flags, int pri);
114 int fbr_eio_msync(FBR_P_ void *addr, size_t length, int flags, int pri);
115 int fbr_eio_readlink(FBR_P_ const char *path, char *buf, size_t size, int pri);
116 int fbr_eio_realpath(FBR_P_ const char *path, char *buf, size_t size, int pri);
117 int fbr_eio_stat(FBR_P_ const char *path, EIO_STRUCT_STAT *statdata, int pri);
118 int fbr_eio_lstat(FBR_P_ const char *path, EIO_STRUCT_STAT *statdata, int pri);
119 int fbr_eio_fstat(FBR_P_ int fd, EIO_STRUCT_STAT *statdata, int pri);
120 int fbr_eio_statvfs(FBR_P_ const char *path, EIO_STRUCT_STATVFS *statdata,
121  int pri);
122 int fbr_eio_fstatvfs(FBR_P_ int fd, EIO_STRUCT_STATVFS *statdata, int pri);
123 int fbr_eio_readahead(FBR_P_ int fd, off_t offset, size_t length, int pri);
124 int fbr_eio_sendfile(FBR_P_ int out_fd, int in_fd, off_t in_offset,
125  size_t length, int pri);
126 int fbr_eio_readahead(FBR_P_ int fd, off_t offset, size_t length, int pri);
127 int fbr_eio_syncfs(FBR_P_ int fd, int pri);
128 int fbr_eio_sync_file_range(FBR_P_ int fd, off_t offset, size_t nbytes,
129  unsigned int flags, int pri);
130 int fbr_eio_fallocate(FBR_P_ int fd, int mode, off_t offset, off_t len,
131  int pri);
132 eio_ssize_t fbr_eio_custom(FBR_P_ fbr_eio_custom_func_t func, void *data,
133  int pri);
134 
135 #endif