r15613: the snum doesn't identify the tcon, but the brl_context pointer does
authorStefan Metzmacher <metze@samba.org>
Mon, 15 May 2006 11:43:25 +0000 (11:43 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:07:00 +0000 (14:07 -0500)
metze
(This used to be commit 5e256f4b78441269de2e53c9582f3237e4220f6c)

source4/ntvfs/common/brlock.c
source4/ntvfs/posix/vfs_posix.c

index 80c4350eacb833685120f331407007ff4dbebfbc..07f1593c2e538c4bb485c7278b44b747af564e33 100644 (file)
@@ -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 */
index 2d40ceb85df1edc82c04dfe77fd9cabf56e8690c..eeee00313bdb4c1c911e741da8b4a4665744ee18 100644 (file)
@@ -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;