summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-04-01 11:40:23 +0200
committerStefan Metzmacher <metze@samba.org>2008-04-07 12:29:29 +0200
commit851cadba51b00b326c5f040f23f95932aec53105 (patch)
tree9f89c0c7616a455e81064cb23cdcb9f35392162b /source3/locking
parent406da3a9628f7e631ad17ec3c37c841359d0ccbf (diff)
downloadsamba-851cadba51b00b326c5f040f23f95932aec53105.tar.gz
samba-851cadba51b00b326c5f040f23f95932aec53105.tar.bz2
samba-851cadba51b00b326c5f040f23f95932aec53105.zip
locking: combine get_delete_on_close_flag() and get_write_time() into get_file_infos()
This means we need to fetch the record only once. metze (This used to be commit 4130b873291d39e363184fe4e38dc1f24ebe5056)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 8d8c0347a5..5faebef1fe 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -940,37 +940,40 @@ bool rename_share_filename(struct messaging_context *msg_ctx,
return True;
}
-struct timespec get_write_time(struct file_id id)
+void get_file_infos(struct file_id id,
+ bool *delete_on_close,
+ struct timespec *write_time)
{
- struct timespec result;
struct share_mode_lock *lck;
- ZERO_STRUCT(result);
+ if (delete_on_close) {
+ *delete_on_close = false;
+ }
+
+ if (write_time) {
+ ZERO_STRUCTP(write_time);
+ }
if (!(lck = fetch_share_mode_unlocked(talloc_tos(), id, NULL, NULL))) {
- return result;
+ return;
}
- result = lck->changed_write_time;
- if (null_timespec(result)) {
- result = lck->old_write_time;
+ if (delete_on_close) {
+ *delete_on_close = lck->delete_on_close;
}
- TALLOC_FREE(lck);
- return result;
-}
+ if (write_time) {
+ struct timespec wt;
-bool get_delete_on_close_flag(struct file_id id)
-{
- bool result;
- struct share_mode_lock *lck;
-
- if (!(lck = fetch_share_mode_unlocked(talloc_tos(), id, NULL, NULL))) {
- return False;
+ wt = lck->changed_write_time;
+ if (null_timespec(wt)) {
+ wt = lck->old_write_time;
+ }
+
+ *write_time = wt;
}
- result = lck->delete_on_close;
+
TALLOC_FREE(lck);
- return result;
}
bool is_valid_share_mode_entry(const struct share_mode_entry *e)