[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Tue Jul 22 09:58:03 MDT 2014
The branch, master has been updated
via 2f86c7d smbd: Fix a typo
via 67fb294 smbd: ?True:False is pretty pointless :-)
via c6ec923 smbd: Add missing {}
via 7dee885 smbd: Remove superfluous ()
via d27f3ef smbd: Fix a typo
via 188017e smbd: Simplify brl_locktest
via 50b74cc smbd: Restructure brl_conflict_other
via a48c0a4 smbd: Fix indentation, {} and line length in brl_conflict_other
via 2d8576e smbd: Rename lck2->rw_probe in brl_conflict_other
via e75e4b2e smbd: Rename lck1->lock in brl_conflict_other
via 432130c smbd: Use a struct initializer brl_lock
via 164e0cb smbd: Simplify strict_lock_default with early returns
via ff9a0a8 smbd: Use %ju/uintmax_t in source3/locking
via 823215b smbd: "err" is no longer set in get_lock_offset
via bd787be smbd: Add comments
via b3d1d56 smbd/nmbd: Remove HAVE_LONGLONG
via f77caa3 smbd: Simplify unpack_nt_owners
via ff53cde lib: Fix a valgrind error
from a017280 messaging4: Fix a just-introduced error memleak
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 2f86c7d3f8231410709be78a04f1f589c2c08ac0
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 15 14:49:25 2014 +0000
smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue Jul 22 17:57:56 CEST 2014 on sn-devel-104
commit 67fb294e64da9a3f1ab23838fd5bccde9cd9ccc7
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 14 15:22:01 2014 +0000
smbd: ?True:False is pretty pointless :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit c6ec923dce22770e54cd7f58937fbf2b75c28190
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 14 15:20:57 2014 +0000
smbd: Add missing {}
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 7dee885cc6c4ab04e9f719c6cbb449594af45f87
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 14 15:19:53 2014 +0000
smbd: Remove superfluous ()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit d27f3ef318820d18214b91a6d33cfa537a6f41d7
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 14 15:10:53 2014 +0000
smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 188017ea324e7c6b7aba7f51a9baa490c0690a01
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jul 11 15:35:45 2014 +0200
smbd: Simplify brl_locktest
Pass "struct lock_struct" as a parameter. This had to be destructured
before the call and re-constructed inside brl_locktest.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 50b74ccb6ae37f193f1f109a04a9a15ed48dfae5
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jul 11 13:27:39 2014 +0200
smbd: Restructure brl_conflict_other
It took me really long to grasp what's going on in this routine. I hope
its logic is easier to understand now
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit a48c0a42ce44bffc6132ce19555aa8f168c8957a
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jul 11 13:21:20 2014 +0200
smbd: Fix indentation, {} and line length in brl_conflict_other
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 2d8576ea7cdf50c53ea7be68134918aacfbaf5b5
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jul 11 13:20:10 2014 +0200
smbd: Rename lck2->rw_probe in brl_conflict_other
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit e75e4b2ed8eddf43d4752dae2dc571fc02e0137d
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jul 11 13:19:36 2014 +0200
smbd: Rename lck1->lock in brl_conflict_other
lck1 and lck2 are treated differently. They should carry more descriptive
names.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 432130c57248b7f8085f7978053d1f6cdfb02b4a
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jul 11 12:41:54 2014 +0200
smbd: Use a struct initializer brl_lock
Avoids a #ifdef DEVELOPER and saves a few bytes .text
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 164e0cb23cd2e30d4cd2cb4ca2bad32e885bb754
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jul 10 22:23:37 2014 +0200
smbd: Simplify strict_lock_default with early returns
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit ff9a0a8993bdb3bd18b246a890b76d005ce0bb63
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jul 11 12:52:06 2014 +0200
smbd: Use %ju/uintmax_t in source3/locking
Avoid going through (double) and %.0f
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 823215bf98754c5438c055475a56afec2bddcf22
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 15 09:52:07 2014 +0000
smbd: "err" is no longer set in get_lock_offset
This was only referenced in the !HAVE_LONGLONG section
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit bd787beee9666443bf44a6625800534e97ed0bfc
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 15 10:55:21 2014 +0000
smbd: Add comments
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit b3d1d56b5e41435b25eafad2b21b867192cbaecd
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 15 09:48:16 2014 +0000
smbd/nmbd: Remove HAVE_LONGLONG
We always have 64-bit variables available by now
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit f77caa3325570514dda20474b910218fd44d10a1
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jul 10 10:36:02 2014 +0000
smbd: Simplify unpack_nt_owners
The separate variables are not really required
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit ff53cde795f160e0ee86ad17f09750c2ee2085f1
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jul 9 13:51:06 2014 +0000
lib: Fix a valgrind error
See the comment inside
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
buildtools/wafsamba/samba_patterns.py | 2 -
source3/lib/background.c | 13 +++-
source3/locking/brlock.c | 146 +++++++++++++++++++-------------
source3/locking/locking.c | 76 +++++++----------
source3/locking/posix.c | 149 +++++++++++++++++++++------------
source3/locking/proto.h | 9 +--
source3/nmbd/nmbd_winsserver.c | 6 --
source3/smbd/blocking.c | 6 +-
source3/smbd/posix_acls.c | 14 +---
source3/smbd/proto.h | 2 +-
source3/smbd/reply.c | 125 +++------------------------
source3/smbd/smb2_lock.c | 2 +-
source3/smbd/trans2.c | 15 ----
source3/wscript | 3 -
14 files changed, 245 insertions(+), 323 deletions(-)
Changeset truncated at 500 lines:
diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
index 1e2df90..9c0f653 100644
--- a/buildtools/wafsamba/samba_patterns.py
+++ b/buildtools/wafsamba/samba_patterns.py
@@ -139,9 +139,7 @@ def write_build_options_footer(fp):
fp.write(" output(screen, \" sizeof(char): %lu\\n\",(unsigned long)sizeof(char));\n")
fp.write(" output(screen, \" sizeof(int): %lu\\n\",(unsigned long)sizeof(int));\n")
fp.write(" output(screen, \" sizeof(long): %lu\\n\",(unsigned long)sizeof(long));\n")
- fp.write("#if HAVE_LONGLONG\n")
fp.write(" output(screen, \" sizeof(long long): %lu\\n\",(unsigned long)sizeof(long long));\n")
- fp.write("#endif\n")
fp.write(" output(screen, \" sizeof(uint8): %lu\\n\",(unsigned long)sizeof(uint8));\n")
fp.write(" output(screen, \" sizeof(uint16): %lu\\n\",(unsigned long)sizeof(uint16));\n")
fp.write(" output(screen, \" sizeof(uint32): %lu\\n\",(unsigned long)sizeof(uint32));\n")
diff --git a/source3/lib/background.c b/source3/lib/background.c
index a9fd04f..869f2ef 100644
--- a/source3/lib/background.c
+++ b/source3/lib/background.c
@@ -181,7 +181,18 @@ static void background_job_waited(struct tevent_req *subreq)
if (written == -1) {
_exit(1);
}
- TALLOC_FREE(state->msg);
+
+ /*
+ * No TALLOC_FREE here, messaging_parent_dgm_cleanup_init for
+ * example calls background_job_send with "messaging_context"
+ * as talloc parent. Thus "state" will be freed with the
+ * following talloc_free will have removed "state" when it
+ * returns. TALLOC_FREE will then write a NULL into free'ed
+ * memory. talloc_free() is required although we immediately
+ * exit, the messaging_context's destructor will want to clean
+ * up.
+ */
+ talloc_free(state->msg);
_exit(0);
}
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index be90b2b..84849e6 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -64,12 +64,12 @@ static void print_lock_struct(unsigned int i, const struct lock_struct *pls)
(unsigned int)pls->context.tid,
server_id_str(talloc_tos(), &pls->context.pid) ));
- DEBUG(10,("start = %.0f, size = %.0f, fnum = %llu, %s %s\n",
- (double)pls->start,
- (double)pls->size,
- (unsigned long long)pls->fnum,
- lock_type_name(pls->lock_type),
- lock_flav_name(pls->lock_flav) ));
+ DEBUG(10, ("start = %ju, size = %ju, fnum = %ju, %s %s\n",
+ (uintmax_t)pls->start,
+ (uintmax_t)pls->size,
+ (uintmax_t)pls->fnum,
+ lock_type_name(pls->lock_type),
+ lock_flav_name(pls->lock_flav)));
}
unsigned int brl_num_locks(const struct byte_range_lock *brl)
@@ -227,32 +227,65 @@ static bool brl_conflict1(const struct lock_struct *lck1,
This is never used in the POSIX lock case.
****************************************************************************/
-static bool brl_conflict_other(const struct lock_struct *lck1, const struct lock_struct *lck2)
+static bool brl_conflict_other(const struct lock_struct *lock,
+ const struct lock_struct *rw_probe)
{
- if (IS_PENDING_LOCK(lck1->lock_type) || IS_PENDING_LOCK(lck2->lock_type))
+ if (IS_PENDING_LOCK(lock->lock_type) ||
+ IS_PENDING_LOCK(rw_probe->lock_type)) {
return False;
+ }
- if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK)
+ if (lock->lock_type == READ_LOCK && rw_probe->lock_type == READ_LOCK) {
return False;
+ }
- /* POSIX flavour locks never conflict here - this is only called
- in the read/write path. */
-
- if (lck1->lock_flav == POSIX_LOCK && lck2->lock_flav == POSIX_LOCK)
+ if (lock->lock_flav == POSIX_LOCK &&
+ rw_probe->lock_flav == POSIX_LOCK) {
+ /*
+ * POSIX flavour locks never conflict here - this is only called
+ * in the read/write path.
+ */
return False;
+ }
- /*
- * Incoming WRITE locks conflict with existing READ locks even
- * if the context is the same. JRA. See LOCKTEST7 in smbtorture.
- */
+ if (!brl_overlap(lock, rw_probe)) {
+ /*
+ * I/O can only conflict when overlapping a lock, thus let it
+ * pass
+ */
+ return false;
+ }
- if (!(lck2->lock_type == WRITE_LOCK && lck1->lock_type == READ_LOCK)) {
- if (brl_same_context(&lck1->context, &lck2->context) &&
- lck1->fnum == lck2->fnum)
- return False;
+ if (!brl_same_context(&lock->context, &rw_probe->context)) {
+ /*
+ * Different process, conflict
+ */
+ return true;
}
- return brl_overlap(lck1, lck2);
+ if (lock->fnum != rw_probe->fnum) {
+ /*
+ * Different file handle, conflict
+ */
+ return true;
+ }
+
+ if ((lock->lock_type == READ_LOCK) &&
+ (rw_probe->lock_type == WRITE_LOCK)) {
+ /*
+ * Incoming WRITE locks conflict with existing READ locks even
+ * if the context is the same. JRA. See LOCKTEST7 in
+ * smbtorture.
+ */
+ return true;
+ }
+
+ /*
+ * I/O request compatible with existing lock, let it pass without
+ * conflict
+ */
+
+ return false;
}
/****************************************************************************
@@ -964,19 +997,16 @@ NTSTATUS brl_lock(struct messaging_context *msg_ctx,
}
#endif
-#ifdef DEVELOPER
- /* Quieten valgrind on test. */
- ZERO_STRUCT(lock);
-#endif
-
- lock.context.smblctx = smblctx;
- lock.context.pid = pid;
- lock.context.tid = br_lck->fsp->conn->cnum;
- lock.start = start;
- lock.size = size;
- lock.fnum = br_lck->fsp->fnum;
- lock.lock_type = lock_type;
- lock.lock_flav = lock_flav;
+ lock = (struct lock_struct) {
+ .context.smblctx = smblctx,
+ .context.pid = pid,
+ .context.tid = br_lck->fsp->conn->cnum,
+ .start = start,
+ .size = size,
+ .fnum = br_lck->fsp->fnum,
+ .lock_type = lock_type,
+ .lock_flav = lock_flav
+ };
if (lock_flav == WINDOWS_LOCK) {
ret = SMB_VFS_BRL_LOCK_WINDOWS(br_lck->fsp->conn, br_lck,
@@ -1315,35 +1345,20 @@ bool brl_unlock(struct messaging_context *msg_ctx,
Returns True if the region required is currently unlocked, False if locked.
****************************************************************************/
-bool brl_locktest(struct byte_range_lock *br_lck,
- uint64_t smblctx,
- struct server_id pid,
- br_off start,
- br_off size,
- enum brl_type lock_type,
- enum brl_flavour lock_flav)
+bool brl_locktest(const struct byte_range_lock *br_lck,
+ const struct lock_struct *rw_probe)
{
bool ret = True;
unsigned int i;
- struct lock_struct lock;
const struct lock_struct *locks = br_lck->lock_data;
files_struct *fsp = br_lck->fsp;
- lock.context.smblctx = smblctx;
- lock.context.pid = pid;
- lock.context.tid = br_lck->fsp->conn->cnum;
- lock.start = start;
- lock.size = size;
- lock.fnum = fsp->fnum;
- lock.lock_type = lock_type;
- lock.lock_flav = lock_flav;
-
/* Make sure existing locks don't conflict */
for (i=0; i < br_lck->num_locks; i++) {
/*
* Our own locks don't conflict.
*/
- if (brl_conflict_other(&locks[i], &lock)) {
+ if (brl_conflict_other(&locks[i], rw_probe)) {
return False;
}
}
@@ -1354,12 +1369,22 @@ bool brl_locktest(struct byte_range_lock *br_lck,
* This only conflicts with Windows locks, not POSIX locks.
*/
- if(lp_posix_locking(fsp->conn->params) && (lock_flav == WINDOWS_LOCK)) {
+ if(lp_posix_locking(fsp->conn->params) &&
+ (rw_probe->lock_flav == WINDOWS_LOCK)) {
+ /*
+ * Make copies -- is_posix_locked might modify the values
+ */
+
+ br_off start = rw_probe->start;
+ br_off size = rw_probe->size;
+ enum brl_type lock_type = rw_probe->lock_type;
+
ret = is_posix_locked(fsp, &start, &size, &lock_type, WINDOWS_LOCK);
- DEBUG(10,("brl_locktest: posix start=%.0f len=%.0f %s for %s file %s\n",
- (double)start, (double)size, ret ? "locked" : "unlocked",
- fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
+ DEBUG(10, ("brl_locktest: posix start=%ju len=%ju %s for %s "
+ "file %s\n", (uintmax_t)start, (uintmax_t)size,
+ ret ? "locked" : "unlocked",
+ fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
/* We need to return the inverse of is_posix_locked. */
ret = !ret;
@@ -1423,9 +1448,10 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
if(lp_posix_locking(fsp->conn->params)) {
bool ret = is_posix_locked(fsp, pstart, psize, plock_type, POSIX_LOCK);
- DEBUG(10,("brl_lockquery: posix start=%.0f len=%.0f %s for %s file %s\n",
- (double)*pstart, (double)*psize, ret ? "locked" : "unlocked",
- fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
+ DEBUG(10, ("brl_lockquery: posix start=%ju len=%ju %s for %s "
+ "file %s\n", (uintmax_t)*pstart,
+ (uintmax_t)*psize, ret ? "locked" : "unlocked",
+ fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
if (ret) {
/* Hmmm. No clue what to set smblctx to - use -1. */
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 02c8815..0a99449 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -103,6 +103,7 @@ void init_strict_lock_struct(files_struct *fsp,
bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
{
+ struct byte_range_lock *br_lck;
int strict_locking = lp_strict_locking(fsp->conn->params);
bool ret = False;
@@ -115,50 +116,33 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
}
if (strict_locking == Auto) {
- if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) && (plock->lock_type == READ_LOCK || plock->lock_type == WRITE_LOCK)) {
- DEBUG(10,("is_locked: optimisation - exclusive oplock on file %s\n", fsp_str_dbg(fsp)));
- ret = True;
- } else if ((fsp->oplock_type == LEVEL_II_OPLOCK) &&
- (plock->lock_type == READ_LOCK)) {
- DEBUG(10,("is_locked: optimisation - level II oplock on file %s\n", fsp_str_dbg(fsp)));
- ret = True;
- } else {
- struct byte_range_lock *br_lck;
-
- br_lck = brl_get_locks_readonly(fsp);
- if (!br_lck) {
- return True;
- }
- ret = brl_locktest(br_lck,
- plock->context.smblctx,
- plock->context.pid,
- plock->start,
- plock->size,
- plock->lock_type,
- plock->lock_flav);
+ if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) &&
+ (plock->lock_type == READ_LOCK ||
+ plock->lock_type == WRITE_LOCK)) {
+ DEBUG(10, ("is_locked: optimisation - exclusive oplock "
+ "on file %s\n", fsp_str_dbg(fsp)));
+ return true;
}
- } else {
- struct byte_range_lock *br_lck;
-
- br_lck = brl_get_locks_readonly(fsp);
- if (!br_lck) {
- return True;
+ if ((fsp->oplock_type == LEVEL_II_OPLOCK) &&
+ (plock->lock_type == READ_LOCK)) {
+ DEBUG(10, ("is_locked: optimisation - level II oplock "
+ "on file %s\n", fsp_str_dbg(fsp)));
+ return true;
}
- ret = brl_locktest(br_lck,
- plock->context.smblctx,
- plock->context.pid,
- plock->start,
- plock->size,
- plock->lock_type,
- plock->lock_flav);
- }
-
- DEBUG(10,("strict_lock_default: flavour = %s brl start=%.0f "
- "len=%.0f %s for fnum %llu file %s\n",
- lock_flav_name(plock->lock_flav),
- (double)plock->start, (double)plock->size,
- ret ? "unlocked" : "locked",
- (unsigned long long)plock->fnum, fsp_str_dbg(fsp)));
+ }
+
+ br_lck = brl_get_locks_readonly(fsp);
+ if (!br_lck) {
+ return true;
+ }
+ ret = brl_locktest(br_lck, plock);
+
+ DEBUG(10, ("strict_lock_default: flavour = %s brl start=%ju "
+ "len=%ju %s for fnum %ju file %s\n",
+ lock_flav_name(plock->lock_flav),
+ (uintmax_t)plock->start, (uintmax_t)plock->size,
+ ret ? "unlocked" : "locked",
+ (uintmax_t)plock->fnum, fsp_str_dbg(fsp)));
return ret;
}
@@ -316,9 +300,9 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
return NT_STATUS_OK;
}
- DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for %s file %s\n",
- (double)offset, (double)count, fsp_fnum_dbg(fsp),
- fsp_str_dbg(fsp)));
+ DEBUG(10, ("do_unlock: unlock start=%ju len=%ju requested for %s file "
+ "%s\n", (uintmax_t)offset, (uintmax_t)count,
+ fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
br_lck = brl_get_locks(talloc_tos(), fsp);
if (!br_lck) {
@@ -366,9 +350,9 @@ NTSTATUS do_lock_cancel(files_struct *fsp,
return NT_STATUS_DOS(ERRDOS, ERRcancelviolation);
}
- DEBUG(10,("do_lock_cancel: cancel start=%.0f len=%.0f requested for %s file %s\n",
- (double)offset, (double)count, fsp_fnum_dbg(fsp),
- fsp_str_dbg(fsp)));
+ DEBUG(10, ("do_lock_cancel: cancel start=%ju len=%ju requested for "
+ "%s file %s\n", (uintmax_t)offset, (uintmax_t)count,
+ fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
br_lck = brl_get_locks(talloc_tos(), fsp);
if (!br_lck) {
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 908cd57..9ee59be 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -125,8 +125,10 @@ static bool posix_lock_in_range(off_t *offset_out, off_t *count_out,
*/
if (u_offset & ~((uint64_t)max_positive_lock_offset)) {
- DEBUG(10,("posix_lock_in_range: (offset = %.0f) offset > %.0f and we cannot handle this. Ignoring lock.\n",
- (double)u_offset, (double)((uint64_t)max_positive_lock_offset) ));
+ DEBUG(10, ("posix_lock_in_range: (offset = %ju) offset > %ju "
+ "and we cannot handle this. Ignoring lock.\n",
+ (uintmax_t)u_offset,
+ (uintmax_t)max_positive_lock_offset));
return False;
}
@@ -151,8 +153,10 @@ static bool posix_lock_in_range(off_t *offset_out, off_t *count_out,
*/
if (count == 0) {
- DEBUG(10,("posix_lock_in_range: Count = 0. Ignoring lock u_offset = %.0f, u_count = %.0f\n",
- (double)u_offset, (double)u_count ));
+ DEBUG(10, ("posix_lock_in_range: Count = 0. Ignoring lock "
+ "u_offset = %ju, u_count = %ju\n",
+ (uintmax_t)u_offset,
+ (uintmax_t)u_count));
return False;
}
@@ -160,8 +164,9 @@ static bool posix_lock_in_range(off_t *offset_out, off_t *count_out,
* The mapping was successful.
*/
- DEBUG(10,("posix_lock_in_range: offset_out = %.0f, count_out = %.0f\n",
- (double)offset, (double)count ));
+ DEBUG(10, ("posix_lock_in_range: offset_out = %ju, "
+ "count_out = %ju\n",
+ (uintmax_t)offset, (uintmax_t)count));
*offset_out = offset;
*count_out = count;
@@ -193,10 +198,12 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, off_t offset, off_t coun
if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno == EINVAL))) {
- DEBUG(0,("posix_fcntl_lock: WARNING: lock request at offset %.0f, length %.0f returned\n",
- (double)offset,(double)count));
- DEBUGADD(0,("an %s error. This can happen when using 64 bit lock offsets\n", strerror(errno)));
- DEBUGADD(0,("on 32 bit NFS mounted file systems.\n"));
+ DEBUG(0, ("posix_fcntl_lock: WARNING: lock request at offset "
+ "%ju, length %ju returned\n",
+ (uintmax_t)offset, (uintmax_t)count));
+ DEBUGADD(0, ("an %s error. This can happen when using 64 bit "
+ "lock offsets\n", strerror(errno)));
+ DEBUGADD(0, ("on 32 bit NFS mounted file systems.\n"));
/*
* If the offset is > 0x7FFFFFFF then this will cause problems on
@@ -240,17 +247,20 @@ static bool posix_fcntl_getlock(files_struct *fsp, off_t *poffset, off_t *pcount
pid_t pid;
bool ret;
- DEBUG(8,("posix_fcntl_getlock %d %.0f %.0f %d\n",
- fsp->fh->fd,(double)*poffset,(double)*pcount,*ptype));
+ DEBUG(8, ("posix_fcntl_getlock %d %ju %ju %d\n",
+ fsp->fh->fd, (uintmax_t)*poffset, (uintmax_t)*pcount,
+ *ptype));
ret = SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, &pid);
if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno == EINVAL))) {
- DEBUG(0,("posix_fcntl_getlock: WARNING: lock request at offset %.0f, length %.0f returned\n",
- (double)*poffset,(double)*pcount));
- DEBUGADD(0,("an %s error. This can happen when using 64 bit lock offsets\n", strerror(errno)));
- DEBUGADD(0,("on 32 bit NFS mounted file systems.\n"));
+ DEBUG(0, ("posix_fcntl_getlock: WARNING: lock request at "
+ "offset %ju, length %ju returned\n",
+ (uintmax_t)*poffset, (uintmax_t)*pcount));
+ DEBUGADD(0, ("an %s error. This can happen when using 64 bit "
+ "lock offsets\n", strerror(errno)));
+ DEBUGADD(0, ("on 32 bit NFS mounted file systems.\n"));
/*
* If the offset is > 0x7FFFFFFF then this will cause problems on
@@ -290,9 +300,9 @@ bool is_posix_locked(files_struct *fsp,
off_t count;
int posix_lock_type = map_posix_lock_type(fsp,*plock_type);
- DEBUG(10,("is_posix_locked: File %s, offset = %.0f, count = %.0f, "
- "type = %s\n", fsp_str_dbg(fsp), (double)*pu_offset,
- (double)*pu_count, posix_lock_type_name(*plock_type)));
+ DEBUG(10, ("is_posix_locked: File %s, offset = %ju, count = %ju, "
+ "type = %s\n", fsp_str_dbg(fsp), (uintmax_t)*pu_offset,
+ (uintmax_t)*pu_count, posix_lock_type_name(*plock_type)));
/*
* If the requested lock won't fit in the POSIX range, we will
@@ -687,8 +697,8 @@ static struct lock_list *posix_lock_list(TALLOC_CTX *ctx,
* Quit if the list is deleted.
*/
- DEBUG(10,("posix_lock_list: curr: start=%.0f,size=%.0f\n",
- (double)lhead->start, (double)lhead->size ));
+ DEBUG(10, ("posix_lock_list: curr: start=%ju,size=%ju\n",
+ (uintmax_t)lhead->start, (uintmax_t)lhead->size ));
for (i=0; i<num_locks && lhead; i++) {
const struct lock_struct *lock = &plocks[i];
@@ -712,9 +722,12 @@ static struct lock_list *posix_lock_list(TALLOC_CTX *ctx,
for (l_curr = lhead; l_curr;) {
- DEBUG(10,("posix_lock_list: lock: fnum=%llu: start=%.0f,size=%.0f:type=%s",
- (unsigned long long)lock->fnum,
- (double)lock->start, (double)lock->size, posix_lock_type_name(lock->lock_type) ));
+ DEBUG(10, ("posix_lock_list: lock: fnum=%ju: "
+ "start=%ju,size=%ju:type=%s",
+ (uintmax_t)lock->fnum,
+ (uintmax_t)lock->start,
+ (uintmax_t)lock->size,
+ posix_lock_type_name(lock->lock_type) ));
if ( (l_curr->start >= (lock->start + lock->size)) ||
(lock->start >= (l_curr->start + l_curr->size))) {
@@ -788,8 +801,10 @@ BECOMES....
l_curr->size = (l_curr->start + l_curr->size) - (lock->start + lock->size);
l_curr->start = lock->start + lock->size;
- DEBUG(10,(" truncate high case: start=%.0f,size=%.0f\n",
- (double)l_curr->start, (double)l_curr->size ));
+ DEBUG(10, (" truncate high case: start=%ju,"
--
Samba Shared Repository
More information about the samba-cvs
mailing list