summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/locking/leases_util.c17
-rw-r--r--source3/locking/proto.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/source3/locking/leases_util.c b/source3/locking/leases_util.c
index 5d07ff9dd7b..af1e8374128 100644
--- a/source3/locking/leases_util.c
+++ b/source3/locking/leases_util.c
@@ -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);
+}
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 44ab315660b..5d2326a40aa 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -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_ */