diff options
author | Ralph Boehme <slow@samba.org> | 2016-02-26 10:54:01 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-03-02 01:22:13 +0100 |
commit | 3884a66e174020b009ee8302d21b18d2bceb99c9 (patch) | |
tree | e03d88aab98bdbd2757592b1b49d93a222a16c59 /examples | |
parent | 6af7ebf3364f274e3ae7d4cd818e51424100b6d4 (diff) | |
download | samba-3884a66e174020b009ee8302d21b18d2bceb99c9.tar.gz |
s3/vfs: wrap async io function args inside struct vfs_aio_state
Subsequent commits that are going to track aio request duration in the
aio backends will use this.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/VFS/skel_opaque.c | 15 | ||||
-rw-r--r-- | examples/VFS/skel_transparent.c | 33 |
2 files changed, 27 insertions, 21 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index ae165a6f5ab..4ffdacc90cf 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -243,9 +243,10 @@ static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle, return NULL; } -static ssize_t skel_pread_recv(struct tevent_req *req, int *err) +static ssize_t skel_pread_recv(struct tevent_req *req, + struct vfs_aio_state *vfs_aio_state) { - *err = ENOSYS; + vfs_aio_state->error = ENOSYS; return -1; } @@ -273,9 +274,10 @@ static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle, return NULL; } -static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err) +static ssize_t skel_pwrite_recv(struct tevent_req *req, + struct vfs_aio_state *vfs_aio_state) { - *err = ENOSYS; + vfs_aio_state->error = ENOSYS; return -1; } @@ -323,9 +325,10 @@ static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle, return NULL; } -static int skel_fsync_recv(struct tevent_req *req, int *err) +static int skel_fsync_recv(struct tevent_req *req, + struct vfs_aio_state *vfs_aio_state) { - *err = ENOSYS; + vfs_aio_state->error = ENOSYS; return -1; } diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 549d7d8d845..5d3ffb73391 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -243,7 +243,7 @@ static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, struct skel_pread_state { ssize_t ret; - int err; + struct vfs_aio_state vfs_aio_state; }; static void skel_pread_done(struct tevent_req *subreq); @@ -277,20 +277,21 @@ static void skel_pread_done(struct tevent_req *subreq) struct skel_pread_state *state = tevent_req_data(req, struct skel_pread_state); - state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err); + state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state); TALLOC_FREE(subreq); tevent_req_done(req); } -static ssize_t skel_pread_recv(struct tevent_req *req, int *err) +static ssize_t skel_pread_recv(struct tevent_req *req, + struct vfs_aio_state *vfs_aio_state) { struct skel_pread_state *state = tevent_req_data(req, struct skel_pread_state); - if (tevent_req_is_unix_error(req, err)) { + if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { return -1; } - *err = state->err; + *vfs_aio_state = state->vfs_aio_state; return state->ret; } @@ -308,7 +309,7 @@ static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, struct skel_pwrite_state { ssize_t ret; - int err; + struct vfs_aio_state vfs_aio_state; }; static void skel_pwrite_done(struct tevent_req *subreq); @@ -343,20 +344,21 @@ static void skel_pwrite_done(struct tevent_req *subreq) struct skel_pwrite_state *state = tevent_req_data(req, struct skel_pwrite_state); - state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err); + state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state); TALLOC_FREE(subreq); tevent_req_done(req); } -static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err) +static ssize_t skel_pwrite_recv(struct tevent_req *req, + struct vfs_aio_state *vfs_aio_state) { struct skel_pwrite_state *state = tevent_req_data(req, struct skel_pwrite_state); - if (tevent_req_is_unix_error(req, err)) { + if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { return -1; } - *err = state->err; + *vfs_aio_state = state->vfs_aio_state; return state->ret; } @@ -393,7 +395,7 @@ static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp) struct skel_fsync_state { int ret; - int err; + struct vfs_aio_state vfs_aio_state; }; static void skel_fsync_done(struct tevent_req *subreq); @@ -425,20 +427,21 @@ static void skel_fsync_done(struct tevent_req *subreq) struct skel_fsync_state *state = tevent_req_data(req, struct skel_fsync_state); - state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err); + state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state); TALLOC_FREE(subreq); tevent_req_done(req); } -static int skel_fsync_recv(struct tevent_req *req, int *err) +static int skel_fsync_recv(struct tevent_req *req, + struct vfs_aio_state *vfs_aio_state) { struct skel_fsync_state *state = tevent_req_data(req, struct skel_fsync_state); - if (tevent_req_is_unix_error(req, err)) { + if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { return -1; } - *err = state->err; + *vfs_aio_state = state->vfs_aio_state; return state->ret; } |