]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_btrfs: update s/btrfs_cc_state/btrfs_offload_write_state/ s/cc_state/state/
authorStefan Metzmacher <metze@samba.org>
Wed, 23 May 2018 10:40:21 +0000 (12:40 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Jun 2018 06:59:18 +0000 (08:59 +0200)
This matches our naming conventions used for tevent_req based functions.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_btrfs.c

index 4c07ebd36ecbfca5a4300c44a1f761e24366f6f2..cc082f7fbbf324df22ef39e0a3c14df99c1cc160 100644 (file)
@@ -196,7 +196,7 @@ static NTSTATUS btrfs_offload_read_recv(struct tevent_req *req,
        return NT_STATUS_OK;
 }
 
-struct btrfs_cc_state {
+struct btrfs_offload_write_state {
        struct vfs_handle_struct *handle;
        off_t copied;
        struct tevent_req *subreq;      /* non-null if passed to next VFS fn */
@@ -213,8 +213,8 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
                                                off_t dest_off,
                                                off_t num)
 {
-       struct tevent_req *req;
-       struct btrfs_cc_state *cc_state;
+       struct tevent_req *req = NULL;
+       struct btrfs_offload_write_state *state = NULL;
        struct btrfs_ioctl_clone_range_args cr_args;
        struct lock_struct src_lck;
        struct lock_struct dest_lck;
@@ -225,12 +225,13 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
        bool do_locking = false;
        NTSTATUS status;
 
-       req = tevent_req_create(mem_ctx, &cc_state, struct btrfs_cc_state);
+       req = tevent_req_create(mem_ctx, &state,
+                               struct btrfs_offload_write_state);
        if (req == NULL) {
                return NULL;
        }
 
-       cc_state->handle = handle;
+       state->handle = handle;
 
        status = vfs_offload_token_db_fetch_fsp(btrfs_offload_ctx,
                                                token, &src_fsp);
@@ -263,18 +264,19 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
        }
 
        if (!handle_offload_write) {
-               cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
-                                                               cc_state, ev,
+               state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
+                                                               state,
+                                                               ev,
                                                                fsctl,
                                                                token,
                                                                transfer_offset,
                                                                dest_fsp,
                                                                dest_off,
                                                                num);
-               if (tevent_req_nomem(cc_state->subreq, req)) {
+               if (tevent_req_nomem(state->subreq, req)) {
                        return tevent_req_post(req, ev);
                }
-               tevent_req_set_callback(cc_state->subreq,
+               tevent_req_set_callback(state->subreq,
                                        btrfs_offload_write_done,
                                        req);
                return req;
@@ -343,19 +345,20 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
                          (unsigned long long)cr_args.src_offset,
                          dest_fsp->fh->fd,
                          (unsigned long long)cr_args.dest_offset));
-               cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
-                                                               cc_state, ev,
+               state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
+                                                               state,
+                                                               ev,
                                                                fsctl,
                                                                token,
                                                                transfer_offset,
                                                                dest_fsp,
                                                                dest_off,
                                                                num);
-               if (tevent_req_nomem(cc_state->subreq, req)) {
+               if (tevent_req_nomem(state->subreq, req)) {
                        return tevent_req_post(req, ev);
                }
                /* wait for subreq completion */
-               tevent_req_set_callback(cc_state->subreq,
+               tevent_req_set_callback(state->subreq,
                                        btrfs_offload_write_done,
                                        req);
                return req;
@@ -363,7 +366,7 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
 
        DEBUG(5, ("BTRFS_IOC_CLONE_RANGE returned %d\n", ret));
        /* BTRFS_IOC_CLONE_RANGE is all or nothing */
-       cc_state->copied = num;
+       state->copied = num;
        tevent_req_done(req);
        return tevent_req_post(req, ev);
 }
@@ -371,15 +374,17 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
 /* only used if the request is passed through to next VFS module */
 static void btrfs_offload_write_done(struct tevent_req *subreq)
 {
-       struct tevent_req *req = tevent_req_callback_data(
-               subreq, struct tevent_req);
-       struct btrfs_cc_state *cc_state = tevent_req_data(req,
-                                                       struct btrfs_cc_state);
+       struct tevent_req *req =
+               tevent_req_callback_data(subreq,
+               struct tevent_req);
+       struct btrfs_offload_write_state *state =
+               tevent_req_data(req,
+               struct btrfs_offload_write_state);
        NTSTATUS status;
 
-       status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(cc_state->handle,
-                                             cc_state->subreq,
-                                             &cc_state->copied);
+       status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle,
+                                                state->subreq,
+                                                &state->copied);
        if (tevent_req_nterror(req, status)) {
                return;
        }
@@ -387,12 +392,13 @@ static void btrfs_offload_write_done(struct tevent_req *subreq)
 }
 
 static NTSTATUS btrfs_offload_write_recv(struct vfs_handle_struct *handle,
-                                     struct tevent_req *req,
-                                     off_t *copied)
+                                        struct tevent_req *req,
+                                        off_t *copied)
 {
+       struct btrfs_offload_write_state *state =
+               tevent_req_data(req,
+               struct btrfs_offload_write_state);
        NTSTATUS status;
-       struct btrfs_cc_state *cc_state = tevent_req_data(req,
-                                                       struct btrfs_cc_state);
 
        if (tevent_req_is_nterror(req, &status)) {
                DEBUG(4, ("server side copy chunk failed: %s\n",
@@ -402,8 +408,8 @@ static NTSTATUS btrfs_offload_write_recv(struct vfs_handle_struct *handle,
        }
 
        DEBUG(10, ("server side copy chunk copied %llu\n",
-                  (unsigned long long)cc_state->copied));
-       *copied = cc_state->copied;
+                  (unsigned long long)state->copied));
+       *copied = state->copied;
        tevent_req_received(req);
        return NT_STATUS_OK;
 }