smbd: Factor out get_share_mode_write_time of get_file_infos
authorVolker Lendecke <vl@samba.org>
Fri, 22 Nov 2013 14:36:49 +0000 (14:36 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 22 Nov 2013 21:30:27 +0000 (13:30 -0800)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/locking.c
source3/locking/proto.h

index b5d4f24f346d7de6fcd9c7035643ef392d465d4e..54c92b1470825da3922a496ed6f140f028c372c2 100644 (file)
@@ -600,14 +600,7 @@ void get_file_infos(struct file_id id,
        }
 
        if (write_time) {
-               struct timespec wt;
-
-               wt = lck->data->changed_write_time;
-               if (null_timespec(wt)) {
-                       wt = lck->data->old_write_time;
-               }
-
-               *write_time = wt;
+               *write_time = get_share_mode_write_time(lck);
        }
 
        TALLOC_FREE(lck);
@@ -1088,3 +1081,13 @@ bool set_write_time(struct file_id fileid, struct timespec write_time)
        TALLOC_FREE(lck);
        return True;
 }
+
+struct timespec get_share_mode_write_time(struct share_mode_lock *lck)
+{
+       struct share_mode_data *d = lck->data;
+
+       if (!null_timespec(d->changed_write_time)) {
+               return d->changed_write_time;
+       }
+       return d->old_write_time;
+}
index 2c9654ce28b8a8528c818aa4b7a88b6721bfb1e1..a897feacf3af31b88513fa718a10de458357294a 100644 (file)
@@ -197,6 +197,7 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close,
 bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
 bool set_write_time(struct file_id fileid, struct timespec write_time);
+struct timespec get_share_mode_write_time(struct share_mode_lock *lck);
 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
                                 const char *, void *),
                      void *private_data);