提交 d8fb2998 编写于 作者: H Hyunchul Lee 提交者: Namjae Jeon

ksmbd: remove and replace macros with inline functions in smb_common.h

Remove and replace macros with inline functions
in smb_common.h
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NHyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: NNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: NSteve French <stfrench@microsoft.com>
上级 d4075abb
......@@ -154,11 +154,9 @@ void ksmbd_session_destroy(struct ksmbd_session *sess)
list_del(&sess->sessions_entry);
if (IS_SMB2(sess->conn)) {
down_write(&sessions_table_lock);
hash_del(&sess->hlist);
up_write(&sessions_table_lock);
}
down_write(&sessions_table_lock);
hash_del(&sess->hlist);
up_write(&sessions_table_lock);
if (sess->user)
ksmbd_free_user(sess->user);
......
......@@ -631,7 +631,8 @@ static void __smb2_oplock_break_noti(struct work_struct *wk)
rsp_hdr = work->response_buf;
memset(rsp_hdr, 0, sizeof(struct smb2_hdr) + 2);
rsp_hdr->smb2_buf_length = cpu_to_be32(HEADER_SIZE_NO_BUF_LEN(conn));
rsp_hdr->smb2_buf_length =
cpu_to_be32(smb2_hdr_size_no_buflen(conn->vals));
rsp_hdr->ProtocolId = SMB2_PROTO_NUMBER;
rsp_hdr->StructureSize = SMB2_HEADER_STRUCTURE_SIZE;
rsp_hdr->CreditRequest = cpu_to_le16(0);
......@@ -737,7 +738,8 @@ static void __smb2_lease_break_noti(struct work_struct *wk)
rsp_hdr = work->response_buf;
memset(rsp_hdr, 0, sizeof(struct smb2_hdr) + 2);
rsp_hdr->smb2_buf_length = cpu_to_be32(HEADER_SIZE_NO_BUF_LEN(conn));
rsp_hdr->smb2_buf_length =
cpu_to_be32(smb2_hdr_size_no_buflen(conn->vals));
rsp_hdr->ProtocolId = SMB2_PROTO_NUMBER;
rsp_hdr->StructureSize = SMB2_HEADER_STRUCTURE_SIZE;
rsp_hdr->CreditRequest = cpu_to_le16(0);
......
......@@ -243,7 +243,7 @@ int init_smb2_neg_rsp(struct ksmbd_work *work)
memset(rsp_hdr, 0, sizeof(struct smb2_hdr) + 2);
rsp_hdr->smb2_buf_length =
cpu_to_be32(HEADER_SIZE_NO_BUF_LEN(conn));
cpu_to_be32(smb2_hdr_size_no_buflen(conn->vals));
rsp_hdr->ProtocolId = SMB2_PROTO_NUMBER;
rsp_hdr->StructureSize = SMB2_HEADER_STRUCTURE_SIZE;
......@@ -497,7 +497,8 @@ int init_smb2_rsp_hdr(struct ksmbd_work *work)
struct ksmbd_conn *conn = work->conn;
memset(rsp_hdr, 0, sizeof(struct smb2_hdr) + 2);
rsp_hdr->smb2_buf_length = cpu_to_be32(HEADER_SIZE_NO_BUF_LEN(conn));
rsp_hdr->smb2_buf_length =
cpu_to_be32(smb2_hdr_size_no_buflen(conn->vals));
rsp_hdr->ProtocolId = rcv_hdr->ProtocolId;
rsp_hdr->StructureSize = SMB2_HEADER_STRUCTURE_SIZE;
rsp_hdr->Command = rcv_hdr->Command;
......
......@@ -50,12 +50,6 @@
extern struct list_head global_lock_list;
#define IS_SMB2(x) ((x)->vals->protocol_id != SMB10_PROT_ID)
#define HEADER_SIZE(conn) ((conn)->vals->header_size)
#define HEADER_SIZE_NO_BUF_LEN(conn) ((conn)->vals->header_size - 4)
#define MAX_HEADER_SIZE(conn) ((conn)->vals->max_header_size)
/* RFC 1002 session packet types */
#define RFC1002_SESSION_MESSAGE 0x00
#define RFC1002_SESSION_REQUEST 0x81
......@@ -490,6 +484,12 @@ struct smb_version_cmds {
int (*proc)(struct ksmbd_work *swork);
};
static inline size_t
smb2_hdr_size_no_buflen(struct smb_version_values *vals)
{
return vals->header_size - 4;
}
int ksmbd_min_protocol(void);
int ksmbd_max_protocol(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册