From: Volker Lendecke Date: Fri, 28 Jun 2019 05:48:45 +0000 (+0200) Subject: smbd: Add flags to the beginning of share_mode_data X-Git-Tag: samba-4.11.0rc1~102 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=01428c55dd0440976a0a319823cf7bc6113f508a;p=thirdparty%2Fsamba.git 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 Reviewed-by: Ralph Boehme --- 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",