From be0bd9fa336464e7c1fa2ab7cc5cd34075d595ce Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 15 May 2006 11:43:25 +0000 Subject: r15613: the snum doesn't identify the tcon, but the brl_context pointer does metze (This used to be commit 5e256f4b78441269de2e53c9582f3237e4220f6c) --- source4/ntvfs/common/brlock.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'source4/ntvfs/common') diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index 80c4350eac..07f1593c2e 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -41,6 +41,7 @@ as it is applied consistently. */ +struct brl_context; /* the lock context contains the elements that define whether one lock is the same as another lock @@ -48,7 +49,7 @@ struct lock_context { uint32_t server; uint16_t smbpid; - int snum; + struct brl_context *ctx; }; /* The data in brlock records is an unsorted linear array of these @@ -66,7 +67,6 @@ struct lock_struct { struct brl_context { struct tdb_wrap *w; uint32_t server; - int snum; struct messaging_context *messaging_ctx; struct lock_struct last_lock; }; @@ -77,7 +77,7 @@ struct brl_context { talloc_free(). We need the messaging_ctx to allow for pending lock notifications. */ -struct brl_context *brl_init(TALLOC_CTX *mem_ctx, uint32_t server, int snum, +struct brl_context *brl_init(TALLOC_CTX *mem_ctx, uint32_t server, struct messaging_context *messaging_ctx) { char *path; @@ -98,7 +98,6 @@ struct brl_context *brl_init(TALLOC_CTX *mem_ctx, uint32_t server, int snum, } brl->server = server; - brl->snum = snum; brl->messaging_ctx = messaging_ctx; ZERO_STRUCT(brl->last_lock); @@ -113,7 +112,7 @@ static BOOL brl_same_context(struct lock_context *ctx1, struct lock_context *ctx { return (ctx1->server == ctx2->server && ctx1->smbpid == ctx2->smbpid && - ctx1->snum == ctx2->snum); + ctx1->ctx == ctx2->ctx); } /* @@ -200,7 +199,7 @@ static BOOL brl_conflict_other(struct lock_struct *lck1, struct lock_struct *lck static NTSTATUS brl_lock_failed(struct brl_context *brl, struct lock_struct *lock) { if (lock->context.server == brl->last_lock.context.server && - lock->context.snum == brl->last_lock.context.snum && + lock->context.ctx == brl->last_lock.context.ctx && lock->fnum == brl->last_lock.fnum && lock->start == brl->last_lock.start && lock->size == brl->last_lock.size) { @@ -263,7 +262,7 @@ NTSTATUS brl_lock(struct brl_context *brl, lock.context.smbpid = smbpid; lock.context.server = brl->server; - lock.context.snum = brl->snum; + lock.context.ctx = brl; lock.start = start; lock.size = size; lock.fnum = fnum; @@ -398,7 +397,7 @@ NTSTATUS brl_unlock(struct brl_context *brl, context.smbpid = smbpid; context.server = brl->server; - context.snum = brl->snum; + context.ctx = brl; /* there are existing locks - find a match */ locks = (struct lock_struct *)dbuf.dptr; @@ -549,7 +548,7 @@ NTSTATUS brl_locktest(struct brl_context *brl, lock.context.smbpid = smbpid; lock.context.server = brl->server; - lock.context.snum = brl->snum; + lock.context.ctx = brl; lock.start = start; lock.size = size; lock.fnum = fnum; @@ -602,7 +601,7 @@ NTSTATUS brl_close(struct brl_context *brl, for (i=0; icontext.snum == brl->snum && + if (lock->context.ctx == brl && lock->context.server == brl->server && lock->fnum == fnum) { /* found it - delete it */ -- cgit