smbd: Remove message_to_share_mode_entry and vice versa
authorVolker Lendecke <vl@samba.org>
Tue, 30 Apr 2024 08:37:06 +0000 (10:37 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 30 Apr 2024 22:44:32 +0000 (22:44 +0000)
Used only for closing files from rpc srvsvc these days

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/smb.h
source3/smbd/proto.h
source3/smbd/smb2_oplock.c

index 76291d93267660a7913d1aa0262cd8e003dc30ec..e47ccd6613366adacdcf9d208ca3907cd06ecbce 100644 (file)
@@ -172,46 +172,6 @@ struct interface {
 
 #include "librpc/gen_ndr/server_id.h"
 
-/* oplock break message definition - linearization of share_mode_entry.
-
-Offset  Data                   length.
-0      struct server_id pid    4
-4      uint16_t op_mid         8
-12     uint16_t op_type        2
-14     uint32_t access_mask    4
-18     uint32_t share_access   4
-22     uint32_t private_options        4
-26     uint32_t time sec               4
-30     uint32_t time usec      4
-34     uint64_t dev            8 bytes
-42     uint64_t inode          8 bytes
-50     uint64_t extid          8 bytes
-58     unsigned long file_id   4 bytes
-62     uint32_t uid            4 bytes
-66     uint16_t flags          2 bytes
-68     uint32_t name_hash      4 bytes
-72
-
-*/
-
-#define OP_BREAK_MSG_PID_OFFSET 0
-#define OP_BREAK_MSG_MID_OFFSET 4
-#define OP_BREAK_MSG_OP_TYPE_OFFSET 12
-#define OP_BREAK_MSG_ACCESS_MASK_OFFSET 14
-#define OP_BREAK_MSG_SHARE_ACCESS_OFFSET 18
-#define OP_BREAK_MSG_PRIV_OFFSET 22
-#define OP_BREAK_MSG_TIME_SEC_OFFSET 26
-#define OP_BREAK_MSG_TIME_USEC_OFFSET 30
-#define OP_BREAK_MSG_DEV_OFFSET 34
-#define OP_BREAK_MSG_INO_OFFSET 42
-#define OP_BREAK_MSG_EXTID_OFFSET 50
-#define OP_BREAK_MSG_FILE_ID_OFFSET 58
-#define OP_BREAK_MSG_UID_OFFSET 62
-#define OP_BREAK_MSG_FLAGS_OFFSET 66
-#define OP_BREAK_MSG_NAME_HASH_OFFSET 68
-
-#define OP_BREAK_MSG_VNN_OFFSET 72
-
 #define NT_HASH_LEN 16
 #define LM_HASH_LEN 16
 
index 7f8aee068bd6eb4aaefebdbd4e7aa784171f6eeb..ba7218f4d1cd065ced45d9b3e8c101e27e4062a5 100644 (file)
@@ -728,11 +728,6 @@ void smbd_contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type);
 void smbd_contend_level2_oplocks_end(files_struct *fsp,
                                enum level2_contention_type type);
-void share_mode_entry_to_message(char *msg, const struct file_id *id,
-                                const struct share_mode_entry *e);
-void message_to_share_mode_entry(struct file_id *id,
-                                struct share_mode_entry *e,
-                                const char *msg);
 bool init_oplocks(struct smbd_server_connection *sconn);
 void init_kernel_oplocks(struct smbd_server_connection *sconn);
 
index eec805f1b4658e4d6ac297650f4aeaf9bd94467c..1e27f9dafb1cd67a106a691b21b9c0c3dbb020a3 100644 (file)
@@ -1332,63 +1332,6 @@ void smbd_contend_level2_oplocks_end(files_struct *fsp,
        return;
 }
 
-/****************************************************************************
- Linearize a share mode entry struct to an internal oplock break message.
-****************************************************************************/
-
-void share_mode_entry_to_message(char *msg, const struct file_id *id,
-                                const struct share_mode_entry *e)
-{
-       SIVAL(msg,OP_BREAK_MSG_PID_OFFSET,(uint32_t)e->pid.pid);
-       SBVAL(msg,OP_BREAK_MSG_MID_OFFSET,e->op_mid);
-       SSVAL(msg,OP_BREAK_MSG_OP_TYPE_OFFSET,e->op_type);
-       SIVAL(msg,OP_BREAK_MSG_ACCESS_MASK_OFFSET,e->access_mask);
-       SIVAL(msg,OP_BREAK_MSG_SHARE_ACCESS_OFFSET,e->share_access);
-       SIVAL(msg,OP_BREAK_MSG_PRIV_OFFSET,e->private_options);
-       SIVAL(msg,OP_BREAK_MSG_TIME_SEC_OFFSET,(uint32_t)e->time.tv_sec);
-       SIVAL(msg,OP_BREAK_MSG_TIME_USEC_OFFSET,(uint32_t)e->time.tv_usec);
-       /*
-        * "id" used to be part of share_mode_entry, thus the strange
-        * place to put this. Feel free to move somewhere else :-)
-        */
-       push_file_id_24(msg+OP_BREAK_MSG_DEV_OFFSET, id);
-       SIVAL(msg,OP_BREAK_MSG_FILE_ID_OFFSET,e->share_file_id);
-       SIVAL(msg,OP_BREAK_MSG_UID_OFFSET,e->uid);
-       SSVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET,e->flags);
-       SIVAL(msg,OP_BREAK_MSG_NAME_HASH_OFFSET,e->name_hash);
-       SIVAL(msg,OP_BREAK_MSG_VNN_OFFSET,e->pid.vnn);
-}
-
-/****************************************************************************
- De-linearize an internal oplock break message to a share mode entry struct.
-****************************************************************************/
-
-void message_to_share_mode_entry(struct file_id *id,
-                                struct share_mode_entry *e,
-                                const char *msg)
-{
-       e->pid = (struct server_id){
-               .pid = (pid_t)IVAL(msg, OP_BREAK_MSG_PID_OFFSET),
-               .vnn = IVAL(msg, OP_BREAK_MSG_VNN_OFFSET),
-       };
-       e->op_mid = BVAL(msg,OP_BREAK_MSG_MID_OFFSET);
-       e->op_type = SVAL(msg,OP_BREAK_MSG_OP_TYPE_OFFSET);
-       e->access_mask = IVAL(msg,OP_BREAK_MSG_ACCESS_MASK_OFFSET);
-       e->share_access = IVAL(msg,OP_BREAK_MSG_SHARE_ACCESS_OFFSET);
-       e->private_options = IVAL(msg,OP_BREAK_MSG_PRIV_OFFSET);
-       e->time.tv_sec = (time_t)IVAL(msg,OP_BREAK_MSG_TIME_SEC_OFFSET);
-       e->time.tv_usec = (int)IVAL(msg,OP_BREAK_MSG_TIME_USEC_OFFSET);
-       /*
-        * "id" used to be part of share_mode_entry, thus the strange
-        * place to put this. Feel free to move somewhere else :-)
-        */
-       pull_file_id_24(msg+OP_BREAK_MSG_DEV_OFFSET, id);
-       e->share_file_id = (unsigned long)IVAL(msg,OP_BREAK_MSG_FILE_ID_OFFSET);
-       e->uid = (uint32_t)IVAL(msg,OP_BREAK_MSG_UID_OFFSET);
-       e->flags = (uint16_t)SVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET);
-       e->name_hash = IVAL(msg, OP_BREAK_MSG_NAME_HASH_OFFSET);
-}
-
 /****************************************************************************
  Setup oplocks for this process.
 ****************************************************************************/