]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:locking: add share_mode_lock_file_id()
authorStefan Metzmacher <metze@samba.org>
Fri, 26 Aug 2022 08:40:44 +0000 (10:40 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 20 Sep 2022 00:34:35 +0000 (00:34 +0000)
This will simplify some (mostly debug) code soon.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/share_mode_lock.c
source3/locking/share_mode_lock.h
source3/locking/share_mode_lock_private.h

index 4fd9d1b3b5015c940561947a4b898d6d4c2712aa..3d8bebda68d7b9589f5541b0aed5df926e40f10d 100644 (file)
@@ -839,6 +839,11 @@ static NTSTATUS get_static_share_mode_data(
        return NT_STATUS_OK;
 }
 
+struct file_id share_mode_lock_file_id(const struct share_mode_lock *lck)
+{
+       return lck->id;
+}
+
 NTSTATUS share_mode_lock_access_private_data(struct share_mode_lock *lck,
                                             struct share_mode_data **data)
 {
@@ -874,6 +879,7 @@ struct share_mode_lock *get_share_mode_lock(
                DEBUG(1, ("talloc failed\n"));
                return NULL;
        }
+       lck->id = id;
 
        if (static_share_mode_data != NULL) {
                if (!file_id_equal(&static_share_mode_data->id, &id)) {
@@ -1359,6 +1365,7 @@ static void fetch_share_mode_unlocked_parser(
                DEBUG(0, ("talloc failed\n"));
                return;
        }
+       state->lck->id = state->id;
 
        state->lck->data = parse_share_modes(
                state->lck,
@@ -1497,6 +1504,7 @@ static void fetch_share_mode_fn(
                state->status = NT_STATUS_NO_MEMORY;
                return;
        }
+       state->lck->id = state->id,
 
        state->lck->data = parse_share_modes(
                state->lck,
@@ -1679,6 +1687,7 @@ static int share_entry_traverse_fn(struct file_id fid,
 {
        struct share_entry_forall_state *state = private_data;
        struct share_mode_lock lck = {
+               .id = fid,
                .data = discard_const_p(struct share_mode_data, data)
        };
        bool ok;
index 199e500df238db5885bfeee646611beee4627f81..e6d7e5dc88f76d08db7dabb0812aa85d000d22a3 100644 (file)
@@ -32,6 +32,8 @@ bool locking_init(void);
 bool locking_init_readonly(void);
 bool locking_end(void);
 
+struct file_id share_mode_lock_file_id(const struct share_mode_lock *lck);
+
 struct share_mode_lock *get_share_mode_lock(
        TALLOC_CTX *mem_ctx,
        struct file_id id,
index 7e11d58fa7a190254747afe39809beeda1823124..ad1346db3c243570e04b764802e4334661e8bc18 100644 (file)
@@ -18,6 +18,7 @@
 
 struct share_mode_data;
 struct share_mode_lock {
+       struct file_id id;
        struct share_mode_data *data;
 };