smbd: Pass "struct file_id" to get_lease_type()
authorVolker Lendecke <vl@samba.org>
Tue, 10 Sep 2019 19:00:29 +0000 (21:00 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 17 Sep 2019 22:49:37 +0000 (22:49 +0000)
It does not have to depend on the whole struct share_mode_data.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/proto.h
source3/smbd/smb2_setinfo.c

index da273fa89384d5c1c8928f5347c3aeaf2a634b05..f714ccd29bd7c891563472939226b91af87a4723 100644 (file)
@@ -2204,7 +2204,7 @@ static NTSTATUS delay_for_oplock(files_struct *fsp,
        for (i=0; i<d->num_share_modes; i++) {
                struct share_mode_entry *e = &d->share_modes[i];
                bool e_is_lease = (e->op_type == LEASE_OPLOCK);
-               uint32_t e_lease_type = get_lease_type(d, e);
+               uint32_t e_lease_type = get_lease_type(e, d->id);
                uint32_t break_to;
                bool lease_is_breaking = false;
 
@@ -4976,7 +4976,7 @@ static NTSTATUS lease_match(connection_struct *conn,
                d = lck->data;
                for (j=0; j<d->num_share_modes; j++) {
                        struct share_mode_entry *e = &d->share_modes[j];
-                       uint32_t e_lease_type = get_lease_type(d, e);
+                       uint32_t e_lease_type = get_lease_type(e, d->id);
 
                        if (share_mode_stale_pid(d, j)) {
                                continue;
index 4461761ee48bcfb051833dbaeeba17d1e20ac101..3c57e0a99f296d8b96dcd9f44ec477f367557b2e 100644 (file)
@@ -174,8 +174,7 @@ static void downgrade_file_oplock(files_struct *fsp)
        TALLOC_FREE(fsp->oplock_timeout);
 }
 
-uint32_t get_lease_type(const struct share_mode_data *d,
-                       const struct share_mode_entry *e)
+uint32_t get_lease_type(const struct share_mode_entry *e, struct file_id id)
 {
        if (e->op_type == LEASE_OPLOCK) {
                NTSTATUS status;
@@ -184,7 +183,7 @@ uint32_t get_lease_type(const struct share_mode_data *d,
                status = leases_db_get(
                        &e->client_guid,
                        &e->lease_key,
-                       &d->id,
+                       &id,
                        &current_state,
                        NULL,   /* breaking */
                        NULL,   /* breaking_to_requested */
index f1c374f652bc0fc8894dab51dc2858c98cbe277c..11c9dc0f8b17e9c8872386fb236477bc9ef6f8d3 100644 (file)
@@ -710,8 +710,7 @@ NTSTATUS create_file_default(connection_struct *conn,
 
 /* The following definitions come from smbd/oplock.c  */
 
-uint32_t get_lease_type(const struct share_mode_data *d,
-                       const struct share_mode_entry *e);
+uint32_t get_lease_type(const struct share_mode_entry *e, struct file_id id);
 
 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
 NTSTATUS set_file_oplock(files_struct *fsp);
index 49b921cd0920e2dbef68a55bb3bbeb34c712f135..47ac774f6596d7d554a08aa07634607a55a14aef 100644 (file)
@@ -209,7 +209,7 @@ static struct tevent_req *delay_rename_for_lease_break(struct tevent_req *req,
                        continue;
                }
 
-               e_lease_type = get_lease_type(d, e);
+               e_lease_type = get_lease_type(e, d->id);
 
                if (!(e_lease_type & SMB2_LEASE_HANDLE)) {
                        continue;