bool is_locked(files_struct *fsp,
uint32 smbpid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_type lock_type)
{
int strict_locking = lp_strict_locking(fsp->conn->params);
NTSTATUS query_lock(files_struct *fsp,
uint32 *psmbpid,
- SMB_BIG_UINT *pcount,
- SMB_BIG_UINT *poffset,
+ uint64_t *pcount,
+ uint64_t *poffset,
enum brl_type *plock_type,
enum brl_flavour lock_flav)
{
struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_type lock_type,
enum brl_flavour lock_flav,
bool blocking_lock,
NTSTATUS do_unlock(struct messaging_context *msg_ctx,
files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_flavour lock_flav)
{
bool ok = False;
NTSTATUS do_lock_cancel(files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_flavour lock_flav)
{
bool ok = False;
}
void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
- uid_t uid, uint16 mid, uint16 op_type, bool initial_delete_on_close_allowed)
+ uid_t uid, uint16 mid, uint16 op_type)
{
struct share_mode_entry entry;
fill_share_mode_entry(&entry, fsp, uid, mid, op_type);
- if (initial_delete_on_close_allowed) {
- entry.flags |= SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE;
- }
add_share_mode_entry(lck, &entry);
}
return NT_STATUS_OK;
}
-/****************************************************************************
- Do we have an open file handle that created this entry ?
-****************************************************************************/
-
-bool can_set_initial_delete_on_close(const struct share_mode_lock *lck)
-{
- int i;
-
- for (i=0; i<lck->num_share_modes; i++) {
- if (lck->share_modes[i].flags & SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE) {
- return True;
- }
- }
- return False;
-}
-
/*************************************************************************
Return a talloced copy of a UNIX_USER_TOKEN. NULL on fail.
(Should this be in locking.c.... ?).
return True;
}
-/****************************************************************************
- Sets the allow initial delete on close flag for this share mode.
-****************************************************************************/
-
-bool set_allow_initial_delete_on_close(struct share_mode_lock *lck, files_struct *fsp, bool delete_on_close)
+bool set_sticky_write_time(struct file_id fileid, struct timespec write_time)
{
- struct share_mode_entry entry, *e;
+ struct share_mode_lock *lck;
- /* Don't care about the pid owner being correct here - just a search. */
- fill_share_mode_entry(&entry, fsp, (uid_t)-1, 0, NO_OPLOCK);
+ DEBUG(5,("set_sticky_write_time: %s id=%s\n",
+ timestring(debug_ctx(),
+ convert_timespec_to_time_t(write_time)),
+ file_id_string_tos(&fileid)));
- e = find_share_mode_entry(lck, &entry);
- if (e == NULL) {
+ lck = get_share_mode_lock(NULL, fileid, NULL, NULL, NULL);
+ if (lck == NULL) {
return False;
}
- if (delete_on_close) {
- e->flags |= SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE;
- } else {
- e->flags &= ~SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE;
+ if (timespec_compare(&lck->changed_write_time, &write_time) != 0) {
+ lck->modified = True;
+ lck->changed_write_time = write_time;
}
- lck->modified = True;
+
+ TALLOC_FREE(lck);
return True;
}
-bool set_write_time(struct file_id fileid, struct timespec write_time,
- bool overwrite)
+bool set_write_time(struct file_id fileid, struct timespec write_time)
{
struct share_mode_lock *lck;
- DEBUG(5,("set_write_time: %s overwrite=%d id=%s\n",
+ DEBUG(5,("set_write_time: %s id=%s\n",
timestring(debug_ctx(),
convert_timespec_to_time_t(write_time)),
- overwrite, file_id_string_tos(&fileid)));
+ file_id_string_tos(&fileid)));
lck = get_share_mode_lock(NULL, fileid, NULL, NULL, NULL);
if (lck == NULL) {
return False;
}
- if (overwrite || null_timespec(lck->changed_write_time)) {
+ if (timespec_compare(&lck->old_write_time, &write_time) != 0) {
lck->modified = True;
- lck->changed_write_time = write_time;
+ lck->old_write_time = write_time;
}
TALLOC_FREE(lck);
return True;
}
+
struct forall_state {
void (*fn)(const struct share_mode_entry *entry,
const char *sharepath,