diff options
Diffstat (limited to 'source4/ntvfs')
-rw-r--r-- | source4/ntvfs/common/brlock.c | 19 | ||||
-rw-r--r-- | source4/ntvfs/posix/vfs_posix.c | 3 |
2 files changed, 10 insertions, 12 deletions
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; i<count; i++) { struct lock_struct *lock = &locks[i]; - if (lock->context.snum == brl->snum && + if (lock->context.ctx == brl && lock->context.server == brl->server && lock->fnum == fnum) { /* found it - delete it */ diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 2d40ceb85d..eeee00313b 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -171,8 +171,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs, ntvfs->private_data = pvfs; pvfs->brl_context = brl_init(pvfs, - pvfs->ntvfs->ctx->server_id, - pvfs->ntvfs->ctx->config.snum, + pvfs->ntvfs->ctx->server_id, pvfs->ntvfs->ctx->msg_ctx); if (pvfs->brl_context == NULL) { return NT_STATUS_INTERNAL_DB_CORRUPTION; |