summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-07-10 14:50:37 -0700
committerTim Prouty <tprouty@samba.org>2009-07-20 17:26:56 -0700
commit5a8d70d465f28ae02f4df7a3c2905e028c2e3142 (patch)
tree12db4653c1e4c2ef23d1368553561d580f832337 /source3/locking
parent635e5e7ff038378d28c52bd5f81d24db99a77a76 (diff)
downloadsamba-5a8d70d465f28ae02f4df7a3c2905e028c2e3142.tar.gz
samba-5a8d70d465f28ae02f4df7a3c2905e028c2e3142.tar.bz2
samba-5a8d70d465f28ae02f4df7a3c2905e028c2e3142.zip
s3: Change fsp->fsp_name to be an smb_filename struct!
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/brlock.c4
-rw-r--r--source3/locking/locking.c29
-rw-r--r--source3/locking/posix.c37
3 files changed, 41 insertions, 29 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index be2948c531..e238ec959b 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1196,7 +1196,7 @@ bool brl_locktest(struct byte_range_lock *br_lck,
DEBUG(10,("brl_locktest: posix start=%.0f len=%.0f %s for fnum %d file %s\n",
(double)start, (double)size, ret ? "locked" : "unlocked",
- fsp->fnum, fsp->fsp_name ));
+ fsp->fnum, fsp_str_dbg(fsp)));
/* We need to return the inverse of is_posix_locked. */
ret = !ret;
@@ -1262,7 +1262,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
DEBUG(10,("brl_lockquery: posix start=%.0f len=%.0f %s for fnum %d file %s\n",
(double)*pstart, (double)*psize, ret ? "locked" : "unlocked",
- fsp->fnum, fsp->fsp_name ));
+ fsp->fnum, fsp_str_dbg(fsp)));
if (ret) {
/* Hmmm. No clue what to set smbpid to - use -1. */
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 91fe137fdc..fba871c704 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -109,11 +109,11 @@ 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->fsp_name ));
+ 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->fsp_name ));
+ 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 = brl_get_locks_readonly(talloc_tos(), fsp);
@@ -149,7 +149,7 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
lock_flav_name(plock->lock_flav),
(double)plock->start, (double)plock->size,
ret ? "unlocked" : "locked",
- plock->fnum, fsp->fsp_name ));
+ plock->fnum, fsp_str_dbg(fsp)));
return ret;
}
@@ -259,7 +259,7 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
"blocking_lock=%s requested for fnum %d file %s\n",
lock_flav_name(lock_flav), lock_type_name(lock_type),
(double)offset, (double)count, blocking_lock ? "true" :
- "false", fsp->fnum, fsp->fsp_name));
+ "false", fsp->fnum, fsp_str_dbg(fsp)));
br_lck = brl_get_locks(talloc_tos(), fsp);
if (!br_lck) {
@@ -308,7 +308,8 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
}
DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for fnum %d file %s\n",
- (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
+ (double)offset, (double)count, fsp->fnum,
+ fsp_str_dbg(fsp)));
br_lck = brl_get_locks(talloc_tos(), fsp);
if (!br_lck) {
@@ -358,7 +359,8 @@ NTSTATUS do_lock_cancel(files_struct *fsp,
}
DEBUG(10,("do_lock_cancel: cancel start=%.0f len=%.0f requested for fnum %d file %s\n",
- (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
+ (double)offset, (double)count, fsp->fnum,
+ fsp_str_dbg(fsp)));
br_lck = brl_get_locks(talloc_tos(), fsp);
if (!br_lck) {
@@ -1311,7 +1313,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, bool delete_on_close,
!lp_delete_readonly(SNUM(fsp->conn))) {
DEBUG(10,("can_set_delete_on_close: file %s delete on close "
"flag set but file attribute is readonly.\n",
- fsp->fsp_name ));
+ fsp_str_dbg(fsp)));
return NT_STATUS_CANNOT_DELETE;
}
@@ -1322,7 +1324,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, bool delete_on_close,
if (!CAN_WRITE(fsp->conn)) {
DEBUG(10,("can_set_delete_on_close: file %s delete on "
"close flag set but write access denied on share.\n",
- fsp->fsp_name ));
+ fsp_str_dbg(fsp)));
return NT_STATUS_ACCESS_DENIED;
}
@@ -1334,13 +1336,15 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, bool delete_on_close,
if (!(fsp->access_mask & DELETE_ACCESS)) {
DEBUG(10,("can_set_delete_on_close: file %s delete on "
"close flag set but delete access denied.\n",
- fsp->fsp_name ));
+ fsp_str_dbg(fsp)));
return NT_STATUS_ACCESS_DENIED;
}
/* Don't allow delete on close for non-empty directories. */
if (fsp->is_directory) {
- return can_delete_directory(fsp->conn, fsp->fsp_name);
+ SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
+ return can_delete_directory(fsp->conn,
+ fsp->fsp_name->base_name);
}
return NT_STATUS_OK;
@@ -1422,7 +1426,7 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const UNIX_USE
DEBUG(10,("set_delete_on_close: %s delete on close flag for "
"fnum = %d, file %s\n",
delete_on_close ? "Adding" : "Removing", fsp->fnum,
- fsp->fsp_name ));
+ fsp_str_dbg(fsp)));
lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL,
NULL);
@@ -1443,7 +1447,8 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const UNIX_USE
set_delete_on_close_lck(lck, delete_on_close, tok);
if (fsp->is_directory) {
- send_stat_cache_delete_message(fsp->fsp_name);
+ SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
+ send_stat_cache_delete_message(fsp->fsp_name->base_name);
}
TALLOC_FREE(lck);
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 9b51c3aa6a..33ffaf95ca 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -280,8 +280,9 @@ bool is_posix_locked(files_struct *fsp,
SMB_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->fsp_name, (double)*pu_offset, (double)*pu_count, posix_lock_type_name(*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)));
/*
* If the requested lock won't fit in the POSIX range, we will
@@ -424,7 +425,7 @@ static void increment_windows_lock_ref_count(files_struct *fsp)
TALLOC_FREE(rec);
DEBUG(10,("increment_windows_lock_ref_count for file now %s = %d\n",
- fsp->fsp_name, lock_ref_count ));
+ fsp_str_dbg(fsp), lock_ref_count));
}
/****************************************************************************
@@ -460,7 +461,7 @@ void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount)
TALLOC_FREE(rec);
DEBUG(10,("reduce_windows_lock_ref_count for file now %s = %d\n",
- fsp->fsp_name, lock_ref_count ));
+ fsp_str_dbg(fsp), lock_ref_count));
}
static void decrement_windows_lock_ref_count(files_struct *fsp)
@@ -492,7 +493,7 @@ static int get_windows_lock_ref_count(files_struct *fsp)
}
DEBUG(10,("get_windows_lock_count for file %s = %d\n",
- fsp->fsp_name, lock_ref_count ));
+ fsp_str_dbg(fsp), lock_ref_count));
return lock_ref_count;
}
@@ -518,7 +519,7 @@ static void delete_windows_lock_ref_count(files_struct *fsp)
TALLOC_FREE(rec);
DEBUG(10,("delete_windows_lock_ref_count for file %s\n",
- fsp->fsp_name));
+ fsp_str_dbg(fsp)));
}
/****************************************************************************
@@ -555,7 +556,7 @@ static void add_fd_to_close_entry(files_struct *fsp)
TALLOC_FREE(rec);
DEBUG(10,("add_fd_to_close_entry: added fd %d file %s\n",
- fsp->fh->fd, fsp->fsp_name ));
+ fsp->fh->fd, fsp_str_dbg(fsp)));
}
/****************************************************************************
@@ -945,8 +946,10 @@ bool set_posix_lock_windows_flavour(files_struct *fsp,
struct lock_list *llist = NULL;
struct lock_list *ll = NULL;
- DEBUG(5,("set_posix_lock_windows_flavour: File %s, offset = %.0f, count = %.0f, type = %s\n",
- fsp->fsp_name, (double)u_offset, (double)u_count, posix_lock_type_name(lock_type) ));
+ DEBUG(5,("set_posix_lock_windows_flavour: File %s, offset = %.0f, "
+ "count = %.0f, type = %s\n", fsp_str_dbg(fsp),
+ (double)u_offset, (double)u_count,
+ posix_lock_type_name(lock_type)));
/*
* If the requested lock won't fit in the POSIX range, we will
@@ -1079,8 +1082,9 @@ bool release_posix_lock_windows_flavour(files_struct *fsp,
struct lock_list *ulist = NULL;
struct lock_list *ul = NULL;
- DEBUG(5,("release_posix_lock_windows_flavour: File %s, offset = %.0f, count = %.0f\n",
- fsp->fsp_name, (double)u_offset, (double)u_count ));
+ DEBUG(5,("release_posix_lock_windows_flavour: File %s, offset = %.0f, "
+ "count = %.0f\n", fsp_str_dbg(fsp),
+ (double)u_offset, (double)u_count));
/* Remember the number of Windows locks we have on this dev/ino pair. */
decrement_windows_lock_ref_count(fsp);
@@ -1197,8 +1201,10 @@ bool set_posix_lock_posix_flavour(files_struct *fsp,
SMB_OFF_T count;
int posix_lock_type = map_posix_lock_type(fsp,lock_type);
- DEBUG(5,("set_posix_lock_posix_flavour: File %s, offset = %.0f, count = %.0f, type = %s\n",
- fsp->fsp_name, (double)u_offset, (double)u_count, posix_lock_type_name(lock_type) ));
+ DEBUG(5,("set_posix_lock_posix_flavour: File %s, offset = %.0f, count "
+ "= %.0f, type = %s\n", fsp_str_dbg(fsp),
+ (double)u_offset, (double)u_count,
+ posix_lock_type_name(lock_type)));
/*
* If the requested lock won't fit in the POSIX range, we will
@@ -1241,8 +1247,9 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
struct lock_list *ulist = NULL;
struct lock_list *ul = NULL;
- DEBUG(5,("release_posix_lock_posix_flavour: File %s, offset = %.0f, count = %.0f\n",
- fsp->fsp_name, (double)u_offset, (double)u_count ));
+ DEBUG(5,("release_posix_lock_posix_flavour: File %s, offset = %.0f, "
+ "count = %.0f\n", fsp_str_dbg(fsp),
+ (double)u_offset, (double)u_count));
/*
* If the requested lock won't fit in the POSIX range, we will