]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Add flags to the beginning of share_mode_data
authorVolker Lendecke <vl@samba.org>
Fri, 28 Jun 2019 05:48:45 +0000 (07:48 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 4 Jul 2019 14:03:29 +0000 (14:03 +0000)
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>
source3/librpc/idl/open_files.idl
source3/locking/share_mode_lock.c

index 04305e241648ed0ebd6542a7cbd883d829de5829..bf832821b893d1da7d85faa1d998c0bf602b6389 100644 (file)
@@ -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;
index 456dea92229abac0b98397a82decfd370cea7b20..79a0580118f61a48499289a75a830ff77592a2f7 100644 (file)
@@ -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",