summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-06-28 07:48:45 +0200
committerRalph Boehme <slow@samba.org>2019-07-04 14:03:29 +0000
commit01428c55dd0440976a0a319823cf7bc6113f508a (patch)
tree7e5af6eea9432b804e0c0e6f7a755710f75cc344
parentc5659f7b05289d23efe0288702157c6b5442ed3d (diff)
downloadsamba-01428c55dd0440976a0a319823cf7bc6113f508a.tar.gz
smbd: Add flags to the beginning of share_mode_data
They are put at the beginning for easy parsing without reading the full struct. First step to remove the number of read oplocks/leases from brlock.tdb, where it does not belong. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r--source3/librpc/idl/open_files.idl5
-rw-r--r--source3/locking/share_mode_lock.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index 04305e24164..bf832821b89 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -40,8 +40,13 @@ interface open_files
security_unix_token *delete_token;
} delete_token;
+ typedef [public,bitmap8bit] bitmap {
+ SHARE_MODE_HAS_READ_LEASE = 0x01
+ } share_mode_flags;
+
typedef [public] struct {
hyper sequence_number;
+ share_mode_flags flags;
[string,charset(UTF8)] char *servicepath;
[string,charset(UTF8)] char *base_name;
[string,charset(UTF8)] char *stream_name;
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 456dea92229..79a0580118f 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -179,14 +179,15 @@ static void share_mode_memcache_store(struct share_mode_data *d)
* NB. We use ndr_pull_hyper on a stack-created
* struct ndr_pull with no talloc allowed, as we
* need this to be really fast as an ndr-peek into
- * the first 8 bytes of the blob.
+ * the first 9 bytes of the blob.
*/
-static enum ndr_err_code get_blob_sequence_number(DATA_BLOB *blob,
- uint64_t *pseq)
+static enum ndr_err_code get_share_mode_blob_header(
+ DATA_BLOB *blob, uint64_t *pseq, uint8_t *pflags)
{
struct ndr_pull ndr = {.data = blob->data, .data_size = blob->length};
NDR_CHECK(ndr_pull_hyper(&ndr, NDR_SCALARS, pseq));
+ NDR_CHECK(ndr_pull_uint8(&ndr, NDR_SCALARS, pflags));
return NDR_ERR_SUCCESS;
}
@@ -202,6 +203,7 @@ static struct share_mode_data *share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
enum ndr_err_code ndr_err;
struct share_mode_data *d;
uint64_t sequence_number;
+ uint8_t flags;
void *ptr;
struct file_id id;
DATA_BLOB key;
@@ -223,7 +225,7 @@ static struct share_mode_data *share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
return NULL;
}
/* sequence number key is at start of blob. */
- ndr_err = get_blob_sequence_number(blob, &sequence_number);
+ ndr_err = get_share_mode_blob_header(blob, &sequence_number, &flags);
if (ndr_err != NDR_ERR_SUCCESS) {
/* Bad blob. Remove entry. */
DEBUG(10,("bad blob %u key %s\n",