mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3/locking: helper functions for lease types
Add some helper functions that will be used to update a bunch of checks for exclusive oplocks to the lease area. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12766 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
952701dce0
commit
f631e95e2d
@ -53,3 +53,20 @@ uint32_t fsp_lease_type(const struct files_struct *fsp)
|
||||
}
|
||||
return map_oplock_to_lease_type(fsp->oplock_type);
|
||||
}
|
||||
|
||||
uint32_t lease_type_is_exclusive(uint32_t lease_type)
|
||||
{
|
||||
if ((lease_type & (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) ==
|
||||
(SMB2_LEASE_READ | SMB2_LEASE_WRITE)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fsp_lease_type_is_exclusive(const struct files_struct *fsp)
|
||||
{
|
||||
uint32_t lease_type = fsp_lease_type(fsp);
|
||||
|
||||
return lease_type_is_exclusive(lease_type);
|
||||
}
|
||||
|
@ -258,5 +258,7 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
|
||||
/* The following definitions come from locking/leases_util.c */
|
||||
uint32_t map_oplock_to_lease_type(uint16_t op_type);
|
||||
uint32_t fsp_lease_type(const struct files_struct *fsp);
|
||||
uint32_t lease_type_is_exclusive(uint32_t lease_type);
|
||||
bool fsp_lease_type_is_exclusive(const struct files_struct *fsp);
|
||||
|
||||
#endif /* _LOCKING_PROTO_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user