diff options
author | Jeremy Allison <jra@samba.org> | 2010-05-07 06:20:50 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-05-07 06:20:50 -0700 |
commit | adf4833792f36653bc8a854aeff47598a046dad6 (patch) | |
tree | 5b7855392d7204218df45563e09486957a3f6d9e /source3/locking | |
parent | 6fd4861d9def34c4dccce214c78bfbcc0fa291fd (diff) | |
download | samba-adf4833792f36653bc8a854aeff47598a046dad6.tar.gz samba-adf4833792f36653bc8a854aeff47598a046dad6.tar.bz2 samba-adf4833792f36653bc8a854aeff47598a046dad6.zip |
This patch looks bigger than it is. It does 2 things. 1). Renames smbpid -> smblctx in our locking code. 2). Widens smblctx to 64-bits internally. Preparing to use the SMB2 handle as the locking context.
Jeremy.
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/brlock.c | 52 | ||||
-rw-r--r-- | source3/locking/locking.c | 30 |
2 files changed, 41 insertions, 41 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index c46221731d..985b98a468 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -42,9 +42,9 @@ static struct db_context *brlock_db; static void print_lock_struct(unsigned int i, struct lock_struct *pls) { - DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %s, ", + DEBUG(10,("[%u]: smblctx = %llu, tid = %u, pid = %s, ", i, - (unsigned int)pls->context.smbpid, + (unsigned long long)pls->context.smblctx, (unsigned int)pls->context.tid, procid_str(talloc_tos(), &pls->context.pid) )); @@ -64,7 +64,7 @@ bool brl_same_context(const struct lock_context *ctx1, const struct lock_context *ctx2) { return (procid_equal(&ctx1->pid, &ctx2->pid) && - (ctx1->smbpid == ctx2->smbpid) && + (ctx1->smblctx == ctx2->smblctx) && (ctx1->tid == ctx2->tid)); } @@ -342,7 +342,7 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck, /* Do any Windows or POSIX locks conflict ? */ if (brl_conflict(&locks[i], plock)) { /* Remember who blocked us. */ - plock->context.smbpid = locks[i].context.smbpid; + plock->context.smblctx = locks[i].context.smblctx; return brl_lock_failed(fsp,plock,blocking_lock); } #if ZERO_ZERO @@ -373,7 +373,7 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck, &errno_ret)) { /* We don't know who blocked us. */ - plock->context.smbpid = 0xFFFFFFFF; + plock->context.smblctx = 0xFFFFFFFFFFFFFFFFLL; if (errno_ret == EACCES || errno_ret == EAGAIN) { status = NT_STATUS_FILE_LOCK_CONFLICT; @@ -747,7 +747,7 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx, /* No games with error messages. */ SAFE_FREE(tp); /* Remember who blocked us. */ - plock->context.smbpid = curr_lock->context.smbpid; + plock->context.smblctx = curr_lock->context.smblctx; return NT_STATUS_FILE_LOCK_CONFLICT; } /* Just copy the Windows lock into the new array. */ @@ -762,7 +762,7 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx, /* No games with error messages. */ SAFE_FREE(tp); /* Remember who blocked us. */ - plock->context.smbpid = curr_lock->context.smbpid; + plock->context.smblctx = curr_lock->context.smblctx; return NT_STATUS_FILE_LOCK_CONFLICT; } @@ -822,7 +822,7 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx, &errno_ret)) { /* We don't know who blocked us. */ - plock->context.smbpid = 0xFFFFFFFF; + plock->context.smblctx = 0xFFFFFFFFFFFFFFFFLL; if (errno_ret == EACCES || errno_ret == EAGAIN) { SAFE_FREE(tp); @@ -902,14 +902,14 @@ NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle, NTSTATUS brl_lock(struct messaging_context *msg_ctx, struct byte_range_lock *br_lck, - uint32 smbpid, + uint64_t smblctx, struct server_id pid, br_off start, br_off size, enum brl_type lock_type, enum brl_flavour lock_flav, bool blocking_lock, - uint32 *psmbpid, + uint64_t *psmblctx, struct blocking_lock_record *blr) { NTSTATUS ret; @@ -926,7 +926,7 @@ NTSTATUS brl_lock(struct messaging_context *msg_ctx, memset(&lock, '\0', sizeof(lock)); #endif - lock.context.smbpid = smbpid; + lock.context.smblctx = smblctx; lock.context.pid = pid; lock.context.tid = br_lck->fsp->conn->cnum; lock.start = start; @@ -948,8 +948,8 @@ NTSTATUS brl_lock(struct messaging_context *msg_ctx, #endif /* If we're returning an error, return who blocked us. */ - if (!NT_STATUS_IS_OK(ret) && psmbpid) { - *psmbpid = lock.context.smbpid; + if (!NT_STATUS_IS_OK(ret) && psmblctx) { + *psmblctx = lock.context.smblctx; } return ret; } @@ -1235,7 +1235,7 @@ bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle, bool brl_unlock(struct messaging_context *msg_ctx, struct byte_range_lock *br_lck, - uint32 smbpid, + uint64_t smblctx, struct server_id pid, br_off start, br_off size, @@ -1243,7 +1243,7 @@ bool brl_unlock(struct messaging_context *msg_ctx, { struct lock_struct lock; - lock.context.smbpid = smbpid; + lock.context.smblctx = smblctx; lock.context.pid = pid; lock.context.tid = br_lck->fsp->conn->cnum; lock.start = start; @@ -1266,7 +1266,7 @@ bool brl_unlock(struct messaging_context *msg_ctx, ****************************************************************************/ bool brl_locktest(struct byte_range_lock *br_lck, - uint32 smbpid, + uint64_t smblctx, struct server_id pid, br_off start, br_off size, @@ -1279,7 +1279,7 @@ bool brl_locktest(struct byte_range_lock *br_lck, const struct lock_struct *locks = br_lck->lock_data; files_struct *fsp = br_lck->fsp; - lock.context.smbpid = smbpid; + lock.context.smblctx = smblctx; lock.context.pid = pid; lock.context.tid = br_lck->fsp->conn->cnum; lock.start = start; @@ -1324,7 +1324,7 @@ bool brl_locktest(struct byte_range_lock *br_lck, ****************************************************************************/ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck, - uint32 *psmbpid, + uint64_t *psmblctx, struct server_id pid, br_off *pstart, br_off *psize, @@ -1336,7 +1336,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck, const struct lock_struct *locks = br_lck->lock_data; files_struct *fsp = br_lck->fsp; - lock.context.smbpid = *psmbpid; + lock.context.smblctx = *psmblctx; lock.context.pid = pid; lock.context.tid = br_lck->fsp->conn->cnum; lock.start = *pstart; @@ -1357,7 +1357,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck, } if (conflict) { - *psmbpid = exlock->context.smbpid; + *psmblctx = exlock->context.smblctx; *pstart = exlock->start; *psize = exlock->size; *plock_type = exlock->lock_type; @@ -1378,8 +1378,8 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck, fsp->fnum, fsp_str_dbg(fsp))); if (ret) { - /* Hmmm. No clue what to set smbpid to - use -1. */ - *psmbpid = 0xFFFF; + /* Hmmm. No clue what to set smblctx to - use -1. */ + *psmblctx = 0xFFFFFFFFFFFFFFFFLL; return NT_STATUS_LOCK_NOT_GRANTED; } } @@ -1401,7 +1401,7 @@ bool smb_vfs_call_brl_cancel_windows(struct vfs_handle_struct *handle, Remove a particular pending lock. ****************************************************************************/ bool brl_lock_cancel(struct byte_range_lock *br_lck, - uint32 smbpid, + uint64_t smblctx, struct server_id pid, br_off start, br_off size, @@ -1411,7 +1411,7 @@ bool brl_lock_cancel(struct byte_range_lock *br_lck, bool ret; struct lock_struct lock; - lock.context.smbpid = smbpid; + lock.context.smblctx = smblctx; lock.context.pid = pid; lock.context.tid = br_lck->fsp->conn->cnum; lock.start = start; @@ -1533,7 +1533,7 @@ void brl_close_fnum(struct messaging_context *msg_ctx, (lock->fnum == fnum)) { brl_unlock(msg_ctx, br_lck, - lock->context.smbpid, + lock->context.smblctx, pid, lock->start, lock->size, @@ -1646,7 +1646,7 @@ static bool validate_lock_entries(unsigned int *pnum_entries, struct lock_struct num_valid_entries = 0; for (i = 0; i < *pnum_entries; i++) { struct lock_struct *lock_data = &locks[i]; - if (lock_data->context.smbpid && + if (lock_data->context.smblctx && lock_data->context.tid) { /* Valid (nonzero) entry - copy it. */ memcpy(&new_lock_data[num_valid_entries], diff --git a/source3/locking/locking.c b/source3/locking/locking.c index dc43f9e182..917b436e18 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -77,7 +77,7 @@ const char *lock_flav_name(enum brl_flavour lock_flav) ****************************************************************************/ void init_strict_lock_struct(files_struct *fsp, - uint32 smbpid, + uint64_t smblctx, br_off start, br_off size, enum brl_type lock_type, @@ -85,7 +85,7 @@ void init_strict_lock_struct(files_struct *fsp, { SMB_ASSERT(lock_type == READ_LOCK || lock_type == WRITE_LOCK); - plock->context.smbpid = smbpid; + plock->context.smblctx = smblctx; plock->context.tid = fsp->conn->cnum; plock->context.pid = procid_self(); plock->start = start; @@ -124,7 +124,7 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock) return True; } ret = brl_locktest(br_lck, - plock->context.smbpid, + plock->context.smblctx, plock->context.pid, plock->start, plock->size, @@ -139,7 +139,7 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock) return True; } ret = brl_locktest(br_lck, - plock->context.smbpid, + plock->context.smblctx, plock->context.pid, plock->start, plock->size, @@ -166,7 +166,7 @@ void strict_unlock_default(files_struct *fsp, struct lock_struct *plock) ****************************************************************************/ NTSTATUS query_lock(files_struct *fsp, - uint32 *psmbpid, + uint64_t *psmblctx, uint64_t *pcount, uint64_t *poffset, enum brl_type *plock_type, @@ -188,7 +188,7 @@ NTSTATUS query_lock(files_struct *fsp, } return brl_lockquery(br_lck, - psmbpid, + psmblctx, procid_self(), poffset, pcount, @@ -230,14 +230,14 @@ static void decrement_current_lock_count(files_struct *fsp, struct byte_range_lock *do_lock(struct messaging_context *msg_ctx, files_struct *fsp, - uint32 lock_pid, + uint64_t smblctx, uint64_t count, uint64_t offset, enum brl_type lock_type, enum brl_flavour lock_flav, bool blocking_lock, NTSTATUS *perr, - uint32 *plock_pid, + uint64_t *psmblctx, struct blocking_lock_record *blr) { struct byte_range_lock *br_lck = NULL; @@ -274,14 +274,14 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx, *perr = brl_lock(msg_ctx, br_lck, - lock_pid, + smblctx, procid_self(), offset, - count, + count, lock_type, lock_flav, blocking_lock, - plock_pid, + psmblctx, blr); DEBUG(10, ("do_lock: returning status=%s\n", nt_errstr(*perr))); @@ -296,7 +296,7 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx, NTSTATUS do_unlock(struct messaging_context *msg_ctx, files_struct *fsp, - uint32 lock_pid, + uint64_t smblctx, uint64_t count, uint64_t offset, enum brl_flavour lock_flav) @@ -323,7 +323,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx, ok = brl_unlock(msg_ctx, br_lck, - lock_pid, + smblctx, procid_self(), offset, count, @@ -345,7 +345,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx, ****************************************************************************/ NTSTATUS do_lock_cancel(files_struct *fsp, - uint32 lock_pid, + uint64 smblctx, uint64_t count, uint64_t offset, enum brl_flavour lock_flav, @@ -373,7 +373,7 @@ NTSTATUS do_lock_cancel(files_struct *fsp, } ok = brl_lock_cancel(br_lck, - lock_pid, + smblctx, procid_self(), offset, count, |