1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3:locking: add share_mode_set_{changed,old}_write_time() helpers

These will be used in future to call them unter an existing share mode
lock...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2022-08-30 05:55:03 +00:00 committed by Jeremy Allison
parent c5c7a377c3
commit 432272a7c8
2 changed files with 39 additions and 0 deletions

View File

@ -36,6 +36,7 @@
*/
#include "includes.h"
#include "lib/util/time_basic.h"
#include "system/filesys.h"
#include "lib/util/server_id.h"
#include "share_mode_lock.h"
@ -1168,6 +1169,42 @@ NTTIME share_mode_changed_write_time(struct share_mode_lock *lck)
return d->changed_write_time;
}
void share_mode_set_changed_write_time(struct share_mode_lock *lck, struct timespec write_time)
{
struct file_id fileid = share_mode_lock_file_id(lck);
struct share_mode_data *d = share_mode_lock_assert_private_data(lck);
struct file_id_buf ftmp;
struct timeval_buf tbuf;
NTTIME nt = full_timespec_to_nt_time(&write_time);
DBG_INFO("%s id=%s\n",
timespec_string_buf(&write_time, true, &tbuf),
file_id_str_buf(fileid, &ftmp));
if (d->changed_write_time != nt) {
d->modified = true;
d->changed_write_time = nt;
}
}
void share_mode_set_old_write_time(struct share_mode_lock *lck, struct timespec write_time)
{
struct file_id fileid = share_mode_lock_file_id(lck);
struct share_mode_data *d = share_mode_lock_assert_private_data(lck);
struct file_id_buf ftmp;
struct timeval_buf tbuf;
NTTIME nt = full_timespec_to_nt_time(&write_time);
DBG_INFO("%s id=%s\n",
timespec_string_buf(&write_time, true, &tbuf),
file_id_str_buf(fileid, &ftmp));
if (d->changed_write_time != nt) {
d->modified = true;
d->old_write_time = nt;
}
}
const char *share_mode_servicepath(struct share_mode_lock *lck)
{
struct share_mode_data *d = share_mode_lock_assert_private_data(lck);

View File

@ -106,6 +106,8 @@ bool share_mode_forall_entries(
void *private_data);
NTTIME share_mode_changed_write_time(struct share_mode_lock *lck);
void share_mode_set_changed_write_time(struct share_mode_lock *lck, struct timespec write_time);
void share_mode_set_old_write_time(struct share_mode_lock *lck, struct timespec write_time);
const char *share_mode_servicepath(struct share_mode_lock *lck);
char *share_mode_filename(TALLOC_CTX *mem_ctx, struct share_mode_lock *lck);
char *share_mode_data_dump(