]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Avoid a reference to share_mode_data->num_share_modes
authorVolker Lendecke <vl@samba.org>
Tue, 10 Dec 2019 13:41:57 +0000 (14:41 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 17 Dec 2019 22:40:32 +0000 (22:40 +0000)
share_mode_data->num_share_modes will go away soon, count the values
directly while walking the array.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/share_mode_lock.c

index 58c7c8d30382598a6b39d81d14c66c89aa139c7c..842d7d5df0c060d9ea7978d90c9064cf78036137 100644 (file)
@@ -1197,6 +1197,7 @@ int share_entry_forall(int (*fn)(struct file_id fid,
 struct cleanup_disconnected_state {
        struct share_mode_lock *lck;
        uint64_t open_persistent_id;
+       size_t num_disconnected;
        bool found_connected;
 };
 
@@ -1265,6 +1266,8 @@ static bool share_mode_find_connected_fn(
                return true;
        }
 
+       state->num_disconnected += 1;
+
        return false;
 }
 
@@ -1334,11 +1337,11 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                goto done;
        }
 
-       DBG_DEBUG("cleaning up %u entries for file "
+       DBG_DEBUG("cleaning up %zu entries for file "
                  "(file-id='%s', servicepath='%s', "
                  "base_name='%s%s%s') "
                  "from open_persistent_id %"PRIu64"\n",
-                 data->num_share_modes,
+                 state.num_disconnected,
                  file_id_str_buf(fid, &idbuf),
                  data->servicepath,
                  data->base_name,