Skip to content

Commit ddc8776

Browse files
Merge pull request #86 from libfuse/error_handling
Tell Cython that callbacks may raise exceptions.
2 parents 942278d + 7fb1621 commit ddc8776

2 files changed

Lines changed: 72 additions & 70 deletions

File tree

Include/fuse_lowlevel.pxd

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -55,68 +55,70 @@ cdef extern from "<fuse_lowlevel.h>" nogil:
5555
int FUSE_SET_ATTR_CTIME
5656

5757
# 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().
5860
struct fuse_lowlevel_ops:
59-
void (*init) (void *userdata, fuse_conn_info *conn)
60-
void (*destroy) (void *userdata)
61-
void (*lookup) (fuse_req_t req, fuse_ino_t parent, const_char *name)
62-
void (*forget) (fuse_req_t req, fuse_ino_t ino, uint64_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, uint64_t nlookup) except *
6365
void (*getattr) (fuse_req_t req, fuse_ino_t ino,
64-
fuse_file_info *fi)
66+
fuse_file_info *fi) except *
6567
void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct_stat *attr,
66-
int to_set, fuse_file_info *fi)
67-
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 *
6870
void (*mknod) (fuse_req_t req, fuse_ino_t parent, const_char *name,
69-
mode_t mode, dev_t rdev)
71+
mode_t mode, dev_t rdev) except *
7072
void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const_char *name,
71-
mode_t mode)
72-
void (*unlink) (fuse_req_t req, fuse_ino_t parent, const_char *name)
73-
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 *
7476
void (*symlink) (fuse_req_t req, const_char *link, fuse_ino_t parent,
75-
const_char *name)
77+
const_char *name) except *
7678
void (*rename) (fuse_req_t req, fuse_ino_t parent, const_char *name,
77-
fuse_ino_t newparent, const_char *newname, unsigned flags)
79+
fuse_ino_t newparent, const_char *newname, unsigned flags) except *
7880
void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
79-
const_char *newname)
81+
const_char *newname) except *
8082
void (*open) (fuse_req_t req, fuse_ino_t ino,
81-
fuse_file_info *fi)
83+
fuse_file_info *fi) except *
8284
void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
83-
fuse_file_info *fi)
85+
fuse_file_info *fi) except *
8486
void (*write) (fuse_req_t req, fuse_ino_t ino, const_char *buf,
85-
size_t size, off_t off, fuse_file_info *fi)
87+
size_t size, off_t off, fuse_file_info *fi) except *
8688
void (*flush) (fuse_req_t req, fuse_ino_t ino,
87-
fuse_file_info *fi)
89+
fuse_file_info *fi) except *
8890
void (*release) (fuse_req_t req, fuse_ino_t ino,
89-
fuse_file_info *fi)
91+
fuse_file_info *fi) except *
9092
void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
91-
fuse_file_info *fi)
93+
fuse_file_info *fi) except *
9294
void (*opendir) (fuse_req_t req, fuse_ino_t ino,
93-
fuse_file_info *fi)
95+
fuse_file_info *fi) except *
9496
void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
95-
fuse_file_info *fi)
97+
fuse_file_info *fi) except *
9698
void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
97-
fuse_file_info *fi)
99+
fuse_file_info *fi) except *
98100
void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
99-
fuse_file_info *fi)
100-
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 *
101103
void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const_char *name,
102-
const_char *value, size_t size, int flags)
104+
const_char *value, size_t size, int flags) except *
103105
void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const_char *name,
104-
size_t size)
105-
void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size)
106-
void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const_char *name)
107-
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 *
108110
void (*create) (fuse_req_t req, fuse_ino_t parent, const_char *name,
109-
mode_t mode, fuse_file_info *fi)
111+
mode_t mode, fuse_file_info *fi) except *
110112
void (*write_buf) (fuse_req_t req, fuse_ino_t ino, fuse_bufvec *bufv,
111-
off_t off, fuse_file_info *fi)
113+
off_t off, fuse_file_info *fi) except *
112114
void (*retrieve_reply) (fuse_req_t req, void *cookie, fuse_ino_t ino,
113-
off_t offset, fuse_bufvec *bufv)
115+
off_t offset, fuse_bufvec *bufv) except *
114116
void (*forget_multi) (fuse_req_t req, size_t count,
115-
fuse_forget_data *forgets)
117+
fuse_forget_data *forgets) except *
116118
void (*fallocate) (fuse_req_t req, fuse_ino_t ino, int mode,
117-
off_t offset, off_t length, fuse_file_info *fi)
119+
off_t offset, off_t length, fuse_file_info *fi) except *
118120
void (*readdirplus) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
119-
fuse_file_info *fi)
121+
fuse_file_info *fi) except *
120122

121123

122124
# Reply functions
@@ -181,4 +183,4 @@ cdef extern from "<fuse_lowlevel.h>" nogil:
181183
# Custom event loop support
182184
int fuse_session_fd(fuse_session *se)
183185
int fuse_session_receive_buf(fuse_session *se, fuse_buf *buf)
184-
void fuse_session_process_buf(fuse_session *se, fuse_buf *buf)
186+
void fuse_session_process_buf(fuse_session *se, fuse_buf *buf) except *

0 commit comments

Comments
 (0)