1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +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:
Ralph Boehme 2017-05-04 11:50:56 +02:00
parent 952701dce0
commit f631e95e2d
2 changed files with 19 additions and 0 deletions

View File

@ -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);
}

View File

@ -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_ */