Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e61b7f

Browse files
Tell Cython that callbacks may raise exceptions, fixes python-llfuse#90
1 parent 84ebfa1 commit 1e61b7f

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

Include/fuse_lowlevel.pxd

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -54,66 +54,69 @@ cdef extern from "<fuse_lowlevel.h>" nogil:
5454
int FUSE_SET_ATTR_ATIME_NOW
5555
int FUSE_SET_ATTR_MTIME_NOW
5656

57+
# Request handlers
58+
# We allow these functions to raise exceptions because we will catch them
59+
# when checking exception status on return from fuse_session_process_buf().
5760
struct fuse_lowlevel_ops:
58-
void (*init) (void *userdata, fuse_conn_info *conn)
59-
void (*destroy) (void *userdata)
60-
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const_char *name)
61-
void (*forget) (fuse_req_t req, fuse_ino_t ino, ulong_t nlookup)
61+
void (*init) (void *userdata, fuse_conn_info *conn) except *
62+
void (*destroy) (void *userdata) except *
63+
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const_char *name) except *
64+
void (*forget) (fuse_req_t req, fuse_ino_t ino, ulong_t nlookup) except *
6265
void (*getattr) (fuse_req_t req, fuse_ino_t ino,
63-
fuse_file_info *fi)
66+
fuse_file_info *fi) except *
6467
void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct_stat *attr,
65-
int to_set, fuse_file_info *fi)
66-
void (*readlink) (fuse_req_t req, fuse_ino_t ino)
68+
int to_set, fuse_file_info *fi) except *
69+
void (*readlink) (fuse_req_t req, fuse_ino_t ino) except *
6770
void (*mknod) (fuse_req_t req, fuse_ino_t parent, const_char *name,
68-
mode_t mode, dev_t rdev)
71+
mode_t mode, dev_t rdev) except *
6972
void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const_char *name,
70-
mode_t mode)
71-
void (*unlink) (fuse_req_t req, fuse_ino_t parent, const_char *name)
72-
void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const_char *name)
73+
mode_t mode) except *
74+
void (*unlink) (fuse_req_t req, fuse_ino_t parent, const_char *name) except *
75+
void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const_char *name) except *
7376
void (*symlink) (fuse_req_t req, const_char *link, fuse_ino_t parent,
74-
const_char *name)
77+
const_char *name) except *
7578
void (*rename) (fuse_req_t req, fuse_ino_t parent, const_char *name,
76-
fuse_ino_t newparent, const_char *newname)
79+
fuse_ino_t newparent, const_char *newname) except *
7780
void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
78-
const_char *newname)
81+
const_char *newname) except *
7982
void (*open) (fuse_req_t req, fuse_ino_t ino,
80-
fuse_file_info *fi)
83+
fuse_file_info *fi) except *
8184
void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
82-
fuse_file_info *fi)
85+
fuse_file_info *fi) except *
8386
void (*write) (fuse_req_t req, fuse_ino_t ino, const_char *buf,
84-
size_t size, off_t off, fuse_file_info *fi)
87+
size_t size, off_t off, fuse_file_info *fi) except *
8588
void (*flush) (fuse_req_t req, fuse_ino_t ino,
86-
fuse_file_info *fi)
89+
fuse_file_info *fi) except *
8790
void (*release) (fuse_req_t req, fuse_ino_t ino,
88-
fuse_file_info *fi)
91+
fuse_file_info *fi) except *
8992
void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
90-
fuse_file_info *fi)
93+
fuse_file_info *fi) except *
9194
void (*opendir) (fuse_req_t req, fuse_ino_t ino,
92-
fuse_file_info *fi)
95+
fuse_file_info *fi) except *
9396
void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
94-
fuse_file_info *fi)
97+
fuse_file_info *fi) except *
9598
void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
96-
fuse_file_info *fi)
99+
fuse_file_info *fi) except *
97100
void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
98-
fuse_file_info *fi)
99-
void (*statfs) (fuse_req_t req, fuse_ino_t ino)
101+
fuse_file_info *fi) except *
102+
void (*statfs) (fuse_req_t req, fuse_ino_t ino) except *
100103
void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const_char *name,
101-
const_char *value, size_t size, int flags)
104+
const_char *value, size_t size, int flags) except *
102105
void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const_char *name,
103-
size_t size)
104-
void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size)
105-
void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const_char *name)
106-
void (*access) (fuse_req_t req, fuse_ino_t ino, int mask)
106+
size_t size) except *
107+
void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size) except *
108+
void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const_char *name) except *
109+
void (*access) (fuse_req_t req, fuse_ino_t ino, int mask) except *
107110
void (*create) (fuse_req_t req, fuse_ino_t parent, const_char *name,
108-
mode_t mode, fuse_file_info *fi)
111+
mode_t mode, fuse_file_info *fi) except *
109112
void (*write_buf) (fuse_req_t req, fuse_ino_t ino, fuse_bufvec *bufv,
110-
off_t off, fuse_file_info *fi)
113+
off_t off, fuse_file_info *fi) except *
111114
void (*retrieve_reply) (fuse_req_t req, void *cookie, fuse_ino_t ino,
112-
off_t offset, fuse_bufvec *bufv)
115+
off_t offset, fuse_bufvec *bufv) except *
113116
void (*forget_multi) (fuse_req_t req, size_t count,
114-
fuse_forget_data *forgets)
117+
fuse_forget_data *forgets) except *
115118
void (*fallocate) (fuse_req_t req, fuse_ino_t ino, int mode,
116-
off_t offset, off_t length, fuse_file_info *fi)
119+
off_t offset, off_t length, fuse_file_info *fi) except *
117120

118121
int fuse_reply_err(fuse_req_t req, int err)
119122
void fuse_reply_none(fuse_req_t req)
@@ -164,7 +167,7 @@ cdef extern from "<fuse_lowlevel.h>" nogil:
164167
int fuse_session_receive_buf(fuse_session *se, fuse_buf *buf,
165168
fuse_chan **chp)
166169
void fuse_session_process_buf(fuse_session *se,
167-
fuse_buf *buf, fuse_chan *ch)
170+
fuse_buf *buf, fuse_chan *ch) except *
168171
void fuse_session_remove_chan(fuse_chan *ch)
169172
void fuse_session_reset(fuse_session *se)
170173
void fuse_session_exit(fuse_session *se)

0 commit comments

Comments
 (0)