cifsd: clean-up codes using chechpatch.pl --strict

Dan Carpenter suggested to run chechpatch.pl --strict on ksmbd to fix
check warnings. This patch does not fix all warnings but only things that
I can understand.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Namjae Jeon 2021-03-30 14:25:35 +09:00 committed by Steve French
parent 7cb82de3cd
commit 64b39f4a2f
31 changed files with 1008 additions and 1401 deletions

View File

@ -64,7 +64,6 @@ static char NEGOTIATE_GSS_HEADER[AUTH_GSS_LENGTH] = {
#endif
};
void ksmbd_copy_gss_neg_header(void *buf)
{
memcpy(buf, NEGOTIATE_GSS_HEADER, AUTH_GSS_LENGTH);
@ -107,9 +106,7 @@ smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
return 0;
}
static int ksmbd_enc_p24(unsigned char *p21,
const unsigned char *c8,
unsigned char *p24)
static int ksmbd_enc_p24(unsigned char *p21, const unsigned char *c8, unsigned char *p24)
{
int rc;
@ -124,8 +121,7 @@ static int ksmbd_enc_p24(unsigned char *p21,
}
/* produce a md4 message digest from data of length n bytes */
static int ksmbd_enc_md4(unsigned char *md4_hash,
unsigned char *link_str,
static int ksmbd_enc_md4(unsigned char *md4_hash, unsigned char *link_str,
int link_len)
{
int rc;
@ -157,10 +153,8 @@ static int ksmbd_enc_md4(unsigned char *md4_hash,
return rc;
}
static int ksmbd_enc_update_sess_key(unsigned char *md5_hash,
char *nonce,
char *server_challenge,
int len)
static int ksmbd_enc_update_sess_key(unsigned char *md5_hash, char *nonce,
char *server_challenge, int len)
{
int rc;
struct ksmbd_crypto_ctx *ctx;
@ -204,8 +198,7 @@ static int ksmbd_enc_update_sess_key(unsigned char *md5_hash,
* @hmac: source hmac value to be used for finding session key
*
*/
static int ksmbd_gen_sess_key(struct ksmbd_session *sess,
char *hash,
static int ksmbd_gen_sess_key(struct ksmbd_session *sess, char *hash,
char *hmac)
{
struct ksmbd_crypto_ctx *ctx;
@ -361,8 +354,9 @@ int ksmbd_auth_ntlm(struct ksmbd_session *sess, char *pw_buf)
if (strncmp(pw_buf, key, CIFS_AUTH_RESP_SIZE) != 0) {
ksmbd_debug(AUTH, "ntlmv1 authentication failed\n");
rc = -EINVAL;
} else
} else {
ksmbd_debug(AUTH, "ntlmv1 authentication pass\n");
}
return rc;
}
@ -376,10 +370,8 @@ int ksmbd_auth_ntlm(struct ksmbd_session *sess, char *pw_buf)
*
* Return: 0 on success, error number on error
*/
int ksmbd_auth_ntlmv2(struct ksmbd_session *sess,
struct ntlmv2_resp *ntlmv2,
int blen,
char *domain_name)
int ksmbd_auth_ntlmv2(struct ksmbd_session *sess, struct ntlmv2_resp *ntlmv2,
int blen, char *domain_name)
{
char ntlmv2_hash[CIFS_ENCPWD_SIZE];
char ntlmv2_rsp[CIFS_HMAC_MD5_HASH_SIZE];
@ -457,8 +449,7 @@ int ksmbd_auth_ntlmv2(struct ksmbd_session *sess,
*
* Return: 0 on success, error number on error
*/
static int __ksmbd_auth_ntlmv2(struct ksmbd_session *sess,
char *client_nonce,
static int __ksmbd_auth_ntlmv2(struct ksmbd_session *sess, char *client_nonce,
char *ntlm_resp)
{
char sess_key[CIFS_SMB1_SESSKEY_SIZE] = {0};
@ -497,8 +488,7 @@ static int __ksmbd_auth_ntlmv2(struct ksmbd_session *sess,
* Return: 0 on success, error number on error
*/
int ksmbd_decode_ntlmssp_auth_blob(struct authenticate_message *authblob,
int blob_len,
struct ksmbd_session *sess)
int blob_len, struct ksmbd_session *sess)
{
char *domain_name;
unsigned int lm_off, nt_off;
@ -523,8 +513,8 @@ int ksmbd_decode_ntlmssp_auth_blob(struct authenticate_message *authblob,
/* process NTLM authentication */
if (nt_len == CIFS_AUTH_RESP_SIZE) {
if (le32_to_cpu(authblob->NegotiateFlags)
& NTLMSSP_NEGOTIATE_EXTENDED_SEC)
if (le32_to_cpu(authblob->NegotiateFlags) &
NTLMSSP_NEGOTIATE_EXTENDED_SEC)
return __ksmbd_auth_ntlmv2(sess, (char *)authblob +
lm_off, (char *)authblob + nt_off);
else
@ -533,8 +523,7 @@ int ksmbd_decode_ntlmssp_auth_blob(struct authenticate_message *authblob,
}
/* TODO : use domain name that imported from configuration file */
domain_name = smb_strndup_from_utf16(
(const char *)authblob +
domain_name = smb_strndup_from_utf16((const char *)authblob +
le32_to_cpu(authblob->DomainName.BufferOffset),
le16_to_cpu(authblob->DomainName.Length), true,
sess->conn->local_nls);
@ -561,8 +550,7 @@ int ksmbd_decode_ntlmssp_auth_blob(struct authenticate_message *authblob,
*
*/
int ksmbd_decode_ntlmssp_neg_blob(struct negotiate_message *negblob,
int blob_len,
struct ksmbd_session *sess)
int blob_len, struct ksmbd_session *sess)
{
if (blob_len < sizeof(struct negotiate_message)) {
ksmbd_debug(AUTH, "negotiate blob len %d too small\n",
@ -675,9 +663,8 @@ ksmbd_build_ntlmssp_challenge_blob(struct challenge_message *chgblob,
}
#ifdef CONFIG_SMB_SERVER_KERBEROS5
int ksmbd_krb5_authenticate(struct ksmbd_session *sess,
char *in_blob, int in_len,
char *out_blob, int *out_len)
int ksmbd_krb5_authenticate(struct ksmbd_session *sess, char *in_blob,
int in_len, char *out_blob, int *out_len)
{
struct ksmbd_spnego_authen_response *resp;
struct ksmbd_user *user = NULL;
@ -726,9 +713,8 @@ int ksmbd_krb5_authenticate(struct ksmbd_session *sess,
return retval;
}
#else
int ksmbd_krb5_authenticate(struct ksmbd_session *sess,
char *in_blob, int in_len,
char *out_blob, int *out_len)
int ksmbd_krb5_authenticate(struct ksmbd_session *sess, char *in_blob,
int in_len, char *out_blob, int *out_len)
{
return -EOPNOTSUPP;
}
@ -743,11 +729,8 @@ int ksmbd_krb5_authenticate(struct ksmbd_session *sess,
* @sig: signature value generated for client request packet
*
*/
int ksmbd_sign_smb2_pdu(struct ksmbd_conn *conn,
char *key,
struct kvec *iov,
int n_vec,
char *sig)
int ksmbd_sign_smb2_pdu(struct ksmbd_conn *conn, char *key, struct kvec *iov,
int n_vec, char *sig)
{
struct ksmbd_crypto_ctx *ctx;
int rc = -EINVAL;
@ -798,11 +781,8 @@ int ksmbd_sign_smb2_pdu(struct ksmbd_conn *conn,
* @sig: signature value generated for client request packet
*
*/
int ksmbd_sign_smb3_pdu(struct ksmbd_conn *conn,
char *key,
struct kvec *iov,
int n_vec,
char *sig)
int ksmbd_sign_smb3_pdu(struct ksmbd_conn *conn, char *key, struct kvec *iov,
int n_vec, char *sig)
{
struct ksmbd_crypto_ctx *ctx;
int rc = -EINVAL;
@ -1062,8 +1042,7 @@ int ksmbd_gen_smb311_encryptionkey(struct ksmbd_session *sess)
return generate_smb3encryptionkey(sess, &twin);
}
int ksmbd_gen_preauth_integrity_hash(struct ksmbd_conn *conn,
char *buf,
int ksmbd_gen_preauth_integrity_hash(struct ksmbd_conn *conn, char *buf,
__u8 *pi_hash)
{
int rc = -1;
@ -1079,8 +1058,9 @@ int ksmbd_gen_preauth_integrity_hash(struct ksmbd_conn *conn,
ksmbd_debug(AUTH, "could not alloc sha512 rc %d\n", rc);
goto out;
}
} else
} else {
goto out;
}
rc = crypto_shash_init(CRYPTO_SHA512(ctx));
if (rc) {
@ -1144,10 +1124,8 @@ int ksmbd_gen_sd_hash(struct ksmbd_conn *conn, char *sd_buf, int len,
return rc;
}
static int ksmbd_get_encryption_key(struct ksmbd_conn *conn,
__u64 ses_id,
int enc,
u8 *key)
static int ksmbd_get_encryption_key(struct ksmbd_conn *conn, __u64 ses_id,
int enc, u8 *key)
{
struct ksmbd_session *sess;
u8 *ses_enc_key;
@ -1175,8 +1153,7 @@ static inline void smb2_sg_set_buf(struct scatterlist *sg, const void *buf,
sg_set_page(sg, addr, buflen, offset_in_page(buf));
}
static struct scatterlist *ksmbd_init_sg(struct kvec *iov,
unsigned int nvec,
static struct scatterlist *ksmbd_init_sg(struct kvec *iov, unsigned int nvec,
u8 *sign)
{
struct scatterlist *sg;
@ -1190,8 +1167,9 @@ static struct scatterlist *ksmbd_init_sg(struct kvec *iov,
nr_entries[i] = ((kaddr + iov[i + 1].iov_len +
PAGE_SIZE - 1) >> PAGE_SHIFT) -
(kaddr >> PAGE_SHIFT);
} else
} else {
nr_entries[i]++;
}
total_entries += nr_entries[i];
}
@ -1232,16 +1210,13 @@ static struct scatterlist *ksmbd_init_sg(struct kvec *iov,
sg_set_page(&sg[sg_idx++], virt_to_page(data), len,
offset_in_page(data));
}
}
smb2_sg_set_buf(&sg[sg_idx], sign, SMB2_SIGNATURE_SIZE);
return sg;
}
int ksmbd_crypt_message(struct ksmbd_conn *conn,
struct kvec *iov,
unsigned int nvec,
int enc)
int ksmbd_crypt_message(struct ksmbd_conn *conn, struct kvec *iov,
unsigned int nvec, int enc)
{
struct smb2_transform_hdr *tr_hdr =
(struct smb2_transform_hdr *)iov[0].iov_base;
@ -1319,9 +1294,9 @@ int ksmbd_crypt_message(struct ksmbd_conn *conn,
goto free_sg;
}
if (conn->cipher_type == SMB2_ENCRYPTION_AES128_GCM)
if (conn->cipher_type == SMB2_ENCRYPTION_AES128_GCM) {
memcpy(iv, (char *)tr_hdr->Nonce, SMB3_AES128GCM_NONCE);
else {
} else {
iv[0] = 3;
memcpy(iv + 1, (char *)tr_hdr->Nonce, SMB3_AES128CCM_NONCE);
}

View File

@ -278,8 +278,7 @@ int ksmbd_init_buffer_pools(void)
goto out;
filp_cache = kmem_cache_create("ksmbd_file_cache",
sizeof(struct ksmbd_file), 0,
SLAB_HWCACHE_ALIGN, NULL);
sizeof(struct ksmbd_file), 0, SLAB_HWCACHE_ALIGN, NULL);
if (!filp_cache)
goto out;

View File

@ -201,9 +201,8 @@ int ksmbd_conn_write(struct ksmbd_work *work)
return 0;
}
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn,
void *buf, unsigned int buflen,
u32 remote_key, u64 remote_offset,
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, void *buf,
unsigned int buflen, u32 remote_key, u64 remote_offset,
u32 remote_len)
{
int ret = -EINVAL;
@ -216,9 +215,8 @@ int ksmbd_conn_rdma_read(struct ksmbd_conn *conn,
return ret;
}
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn,
void *buf, unsigned int buflen,
u32 remote_key, u64 remote_offset,
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, void *buf,
unsigned int buflen, u32 remote_key, u64 remote_offset,
u32 remote_len)
{
int ret = -EINVAL;
@ -393,8 +391,7 @@ static void stop_sessions(void)
task = conn->transport->handler;
if (task)
ksmbd_debug(CONN, "Stop session handler %s/%d\n",
task->comm,
task_pid_nr(task));
task->comm, task_pid_nr(task));
conn->status = KSMBD_SESS_EXITING;
}
read_unlock(&conn_list_lock);

View File

@ -116,17 +116,15 @@ struct ksmbd_conn_ops {
struct ksmbd_transport_ops {
int (*prepare)(struct ksmbd_transport *t);
void (*disconnect)(struct ksmbd_transport *t);
int (*read)(struct ksmbd_transport *t,
char *buf, unsigned int size);
int (*writev)(struct ksmbd_transport *t,
struct kvec *iovs, int niov, int size,
bool need_invalidate_rkey, unsigned int remote_key);
int (*rdma_read)(struct ksmbd_transport *t,
void *buf, unsigned int len, u32 remote_key,
u64 remote_offset, u32 remote_len);
int (*rdma_write)(struct ksmbd_transport *t,
void *buf, unsigned int len, u32 remote_key,
u64 remote_offset, u32 remote_len);
int (*read)(struct ksmbd_transport *t, char *buf, unsigned int size);
int (*writev)(struct ksmbd_transport *t, struct kvec *iovs, int niov,
int size, bool need_invalidate_rkey,
unsigned int remote_key);
int (*rdma_read)(struct ksmbd_transport *t, void *buf, unsigned int len,
u32 remote_key, u64 remote_offset, u32 remote_len);
int (*rdma_write)(struct ksmbd_transport *t, void *buf,
unsigned int len, u32 remote_key, u64 remote_offset,
u32 remote_len);
};
struct ksmbd_transport {
@ -146,13 +144,11 @@ struct ksmbd_conn *ksmbd_conn_alloc(void);
void ksmbd_conn_free(struct ksmbd_conn *conn);
bool ksmbd_conn_lookup_dialect(struct ksmbd_conn *c);
int ksmbd_conn_write(struct ksmbd_work *work);
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn,
void *buf, unsigned int buflen,
u32 remote_key, u64 remote_offset,
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, void *buf,
unsigned int buflen, u32 remote_key, u64 remote_offset,
u32 remote_len);
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn,
void *buf, unsigned int buflen,
u32 remote_key, u64 remote_offset,
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, void *buf,
unsigned int buflen, u32 remote_key, u64 remote_offset,
u32 remote_len);
void ksmbd_conn_enqueue_request(struct ksmbd_work *work);

View File

@ -24,13 +24,13 @@ extern int ksmbd_caseless_search;
#define DATA_STREAM 1
#define DIR_STREAM 2
#define KSMBD_DEBUG_SMB (1 << 0)
#define KSMBD_DEBUG_AUTH (1 << 1)
#define KSMBD_DEBUG_VFS (1 << 2)
#define KSMBD_DEBUG_OPLOCK (1 << 3)
#define KSMBD_DEBUG_IPC (1 << 4)
#define KSMBD_DEBUG_CONN (1 << 5)
#define KSMBD_DEBUG_RDMA (1 << 6)
#define KSMBD_DEBUG_SMB BIT(0)
#define KSMBD_DEBUG_AUTH BIT(1)
#define KSMBD_DEBUG_VFS BIT(2)
#define KSMBD_DEBUG_OPLOCK BIT(3)
#define KSMBD_DEBUG_IPC BIT(4)
#define KSMBD_DEBUG_CONN BIT(5)
#define KSMBD_DEBUG_RDMA BIT(6)
#define KSMBD_DEBUG_ALL (KSMBD_DEBUG_SMB | KSMBD_DEBUG_AUTH | \
KSMBD_DEBUG_VFS | KSMBD_DEBUG_OPLOCK | \
KSMBD_DEBUG_IPC | KSMBD_DEBUG_CONN | \

View File

@ -29,11 +29,11 @@ struct ksmbd_heartbeat {
* Global config flags.
*/
#define KSMBD_GLOBAL_FLAG_INVALID (0)
#define KSMBD_GLOBAL_FLAG_SMB2_LEASES (1 << 0)
#define KSMBD_GLOBAL_FLAG_CACHE_TBUF (1 << 1)
#define KSMBD_GLOBAL_FLAG_CACHE_RBUF (1 << 2)
#define KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION (1 << 3)
#define KSMBD_GLOBAL_FLAG_DURABLE_HANDLE (1 << 4)
#define KSMBD_GLOBAL_FLAG_SMB2_LEASES BIT(0)
#define KSMBD_GLOBAL_FLAG_CACHE_TBUF BIT(1)
#define KSMBD_GLOBAL_FLAG_CACHE_RBUF BIT(2)
#define KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION BIT(3)
#define KSMBD_GLOBAL_FLAG_DURABLE_HANDLE BIT(4)
struct ksmbd_startup_request {
__u32 flags;
@ -204,66 +204,66 @@ enum KSMBD_TREE_CONN_STATUS {
* User config flags.
*/
#define KSMBD_USER_FLAG_INVALID (0)
#define KSMBD_USER_FLAG_OK (1 << 0)
#define KSMBD_USER_FLAG_BAD_PASSWORD (1 << 1)
#define KSMBD_USER_FLAG_BAD_UID (1 << 2)
#define KSMBD_USER_FLAG_BAD_USER (1 << 3)
#define KSMBD_USER_FLAG_GUEST_ACCOUNT (1 << 4)
#define KSMBD_USER_FLAG_OK BIT(0)
#define KSMBD_USER_FLAG_BAD_PASSWORD BIT(1)
#define KSMBD_USER_FLAG_BAD_UID BIT(2)
#define KSMBD_USER_FLAG_BAD_USER BIT(3)
#define KSMBD_USER_FLAG_GUEST_ACCOUNT BIT(4)
/*
* Share config flags.
*/
#define KSMBD_SHARE_FLAG_INVALID (0)
#define KSMBD_SHARE_FLAG_AVAILABLE (1 << 0)
#define KSMBD_SHARE_FLAG_BROWSEABLE (1 << 1)
#define KSMBD_SHARE_FLAG_WRITEABLE (1 << 2)
#define KSMBD_SHARE_FLAG_READONLY (1 << 3)
#define KSMBD_SHARE_FLAG_GUEST_OK (1 << 4)
#define KSMBD_SHARE_FLAG_GUEST_ONLY (1 << 5)
#define KSMBD_SHARE_FLAG_STORE_DOS_ATTRS (1 << 6)
#define KSMBD_SHARE_FLAG_OPLOCKS (1 << 7)
#define KSMBD_SHARE_FLAG_PIPE (1 << 8)
#define KSMBD_SHARE_FLAG_HIDE_DOT_FILES (1 << 9)
#define KSMBD_SHARE_FLAG_INHERIT_SMACK (1 << 10)
#define KSMBD_SHARE_FLAG_INHERIT_OWNER (1 << 11)
#define KSMBD_SHARE_FLAG_STREAMS (1 << 12)
#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS (1 << 13)
#define KSMBD_SHARE_FLAG_ACL_XATTR (1 << 14)
#define KSMBD_SHARE_FLAG_AVAILABLE BIT(0)
#define KSMBD_SHARE_FLAG_BROWSEABLE BIT(1)
#define KSMBD_SHARE_FLAG_WRITEABLE BIT(2)
#define KSMBD_SHARE_FLAG_READONLY BIT(3)
#define KSMBD_SHARE_FLAG_GUEST_OK BIT(4)
#define KSMBD_SHARE_FLAG_GUEST_ONLY BIT(5)
#define KSMBD_SHARE_FLAG_STORE_DOS_ATTRS BIT(6)
#define KSMBD_SHARE_FLAG_OPLOCKS BIT(7)
#define KSMBD_SHARE_FLAG_PIPE BIT(8)
#define KSMBD_SHARE_FLAG_HIDE_DOT_FILES BIT(9)
#define KSMBD_SHARE_FLAG_INHERIT_SMACK BIT(10)
#define KSMBD_SHARE_FLAG_INHERIT_OWNER BIT(11)
#define KSMBD_SHARE_FLAG_STREAMS BIT(12)
#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS BIT(13)
#define KSMBD_SHARE_FLAG_ACL_XATTR BIT(14)
/*
* Tree connect request flags.
*/
#define KSMBD_TREE_CONN_FLAG_REQUEST_SMB1 (0)
#define KSMBD_TREE_CONN_FLAG_REQUEST_IPV6 (1 << 0)
#define KSMBD_TREE_CONN_FLAG_REQUEST_SMB2 (1 << 1)
#define KSMBD_TREE_CONN_FLAG_REQUEST_IPV6 BIT(0)
#define KSMBD_TREE_CONN_FLAG_REQUEST_SMB2 BIT(1)
/*
* Tree connect flags.
*/
#define KSMBD_TREE_CONN_FLAG_GUEST_ACCOUNT (1 << 0)
#define KSMBD_TREE_CONN_FLAG_READ_ONLY (1 << 1)
#define KSMBD_TREE_CONN_FLAG_WRITABLE (1 << 2)
#define KSMBD_TREE_CONN_FLAG_ADMIN_ACCOUNT (1 << 3)
#define KSMBD_TREE_CONN_FLAG_GUEST_ACCOUNT BIT(0)
#define KSMBD_TREE_CONN_FLAG_READ_ONLY BIT(1)
#define KSMBD_TREE_CONN_FLAG_WRITABLE BIT(2)
#define KSMBD_TREE_CONN_FLAG_ADMIN_ACCOUNT BIT(3)
/*
* RPC over IPC.
*/
#define KSMBD_RPC_METHOD_RETURN (1 << 0)
#define KSMBD_RPC_SRVSVC_METHOD_INVOKE (1 << 1)
#define KSMBD_RPC_SRVSVC_METHOD_RETURN ((1 << 1) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_WKSSVC_METHOD_INVOKE (1 << 2)
#define KSMBD_RPC_WKSSVC_METHOD_RETURN ((1 << 2) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_IOCTL_METHOD ((1 << 3) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_OPEN_METHOD (1 << 4)
#define KSMBD_RPC_WRITE_METHOD (1 << 5)
#define KSMBD_RPC_READ_METHOD ((1 << 6) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_CLOSE_METHOD (1 << 7)
#define KSMBD_RPC_RAP_METHOD ((1 << 8) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_RESTRICTED_CONTEXT (1 << 9)
#define KSMBD_RPC_SAMR_METHOD_INVOKE (1 << 10)
#define KSMBD_RPC_SAMR_METHOD_RETURN ((1 << 10) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_LSARPC_METHOD_INVOKE (1 << 11)
#define KSMBD_RPC_LSARPC_METHOD_RETURN ((1 << 11) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_METHOD_RETURN BIT(0)
#define KSMBD_RPC_SRVSVC_METHOD_INVOKE BIT(1)
#define KSMBD_RPC_SRVSVC_METHOD_RETURN (KSMBD_RPC_SRVSVC_METHOD_INVOKE | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_WKSSVC_METHOD_INVOKE BIT(2)
#define KSMBD_RPC_WKSSVC_METHOD_RETURN (KSMBD_RPC_WKSSVC_METHOD_INVOKE | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_IOCTL_METHOD (BIT(3) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_OPEN_METHOD BIT(4)
#define KSMBD_RPC_WRITE_METHOD BIT(5)
#define KSMBD_RPC_READ_METHOD (BIT(6) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_CLOSE_METHOD BIT(7)
#define KSMBD_RPC_RAP_METHOD (BIT(8) | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_RESTRICTED_CONTEXT BIT(9)
#define KSMBD_RPC_SAMR_METHOD_INVOKE BIT(10)
#define KSMBD_RPC_SAMR_METHOD_RETURN (KSMBD_RPC_SAMR_METHOD_INVOKE | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_LSARPC_METHOD_INVOKE BIT(11)
#define KSMBD_RPC_LSARPC_METHOD_RETURN (KSMBD_RPC_LSARPC_METHOD_INVOKE | KSMBD_RPC_METHOD_RETURN)
#define KSMBD_RPC_OK 0
#define KSMBD_RPC_EBAD_FUNC 0x00000001

View File

@ -26,12 +26,12 @@ struct channel {
struct preauth_session {
__u8 Preauth_HashValue[PREAUTH_HASHVALUE_SIZE];
uint64_t sess_id;
u64 sess_id;
struct list_head list_entry;
};
struct ksmbd_session {
uint64_t id;
u64 id;
struct ksmbd_user *user;
struct ksmbd_conn *conn;

View File

@ -268,8 +268,7 @@ char *convert_to_unix_name(struct ksmbd_share_config *share, char *name)
}
char *ksmbd_convert_dir_info_name(struct ksmbd_dir_info *d_info,
const struct nls_table *local_nls,
int *conv_len)
const struct nls_table *local_nls, int *conv_len)
{
char *conv;
int sz = min(4 * d_info->name_len, PATH_MAX);

View File

@ -159,8 +159,9 @@ int ndr_encode_dos_attr(struct ndr *n, struct xattr_dos_attrib *da)
ndr_write_int32(n, da->ea_size);
ndr_write_int64(n, da->size);
ndr_write_int64(n, da->alloc_size);
} else
} else {
ndr_write_int64(n, da->itime);
}
ndr_write_int64(n, da->create_time);
if (da->version == 3)
ndr_write_int64(n, da->change_time);
@ -248,15 +249,17 @@ int ndr_encode_posix_acl(struct ndr *n, struct inode *inode,
/* ACL ACCESS */
ndr_write_int32(n, ref_id);
ref_id += 4;
} else
} else {
ndr_write_int32(n, 0);
}
if (def_acl) {
/* DEFAULT ACL ACCESS */
ndr_write_int32(n, ref_id);
ref_id += 4;
} else
} else {
ndr_write_int32(n, 0);
}
ndr_write_int64(n, from_kuid(&init_user_ns, inode->i_uid));
ndr_write_int64(n, from_kgid(&init_user_ns, inode->i_gid));

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* fs/ksmbd/netmisc.c
*
* Copyright (c) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
*

View File

@ -29,7 +29,7 @@ static DEFINE_RWLOCK(lease_list_lock);
* Return: allocated opinfo object on success, otherwise NULL
*/
static struct oplock_info *alloc_opinfo(struct ksmbd_work *work,
uint64_t id, __u16 Tid)
u64 id, __u16 Tid)
{
struct ksmbd_session *sess = work->sess;
struct oplock_info *opinfo;
@ -89,8 +89,7 @@ static void lb_add(struct lease_table *lb)
write_unlock(&lease_list_lock);
}
static int alloc_lease(struct oplock_info *opinfo,
struct lease_ctx_info *lctx)
static int alloc_lease(struct oplock_info *opinfo, struct lease_ctx_info *lctx)
{
struct lease *lease;
@ -227,8 +226,8 @@ int opinfo_write_to_read(struct oplock_info *opinfo)
{
struct lease *lease = opinfo->o_lease;
if (!((opinfo->level == SMB2_OPLOCK_LEVEL_BATCH) ||
(opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE))) {
if (!(opinfo->level == SMB2_OPLOCK_LEVEL_BATCH ||
opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE)) {
ksmbd_err("bad oplock(0x%x)\n", opinfo->level);
if (opinfo->is_lease)
ksmbd_err("lease state(0x%x)\n", lease->state);
@ -266,8 +265,8 @@ int opinfo_write_to_none(struct oplock_info *opinfo)
{
struct lease *lease = opinfo->o_lease;
if (!((opinfo->level == SMB2_OPLOCK_LEVEL_BATCH) ||
(opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE))) {
if (!(opinfo->level == SMB2_OPLOCK_LEVEL_BATCH ||
opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE)) {
ksmbd_err("bad oplock(0x%x)\n", opinfo->level);
if (opinfo->is_lease)
ksmbd_err("lease state(0x%x)\n",
@ -334,8 +333,7 @@ int lease_read_to_write(struct oplock_info *opinfo)
*
* Return: 0 on success, otherwise -EINVAL
*/
static int lease_none_upgrade(struct oplock_info *opinfo,
__le32 new_state)
static int lease_none_upgrade(struct oplock_info *opinfo, __le32 new_state)
{
struct lease *lease = opinfo->o_lease;
@ -649,7 +647,6 @@ static void __smb2_oplock_break_noti(struct work_struct *wk)
rsp_hdr->SessionId = 0;
memset(rsp_hdr->Signature, 0, 16);
rsp = work->response_buf;
rsp->StructureSize = cpu_to_le16(24);
@ -845,10 +842,8 @@ static void wait_lease_breaking(struct oplock_info *opinfo)
if (atomic_read(&opinfo->breaking_cnt)) {
int ret = 0;
ret = wait_event_interruptible_timeout(
opinfo->oplock_brk,
atomic_read(&opinfo->breaking_cnt) == 0,
HZ);
ret = wait_event_interruptible_timeout(opinfo->oplock_brk,
atomic_read(&opinfo->breaking_cnt) == 0, HZ);
if (!ret)
atomic_set(&opinfo->breaking_cnt, 0);
}
@ -1060,8 +1055,7 @@ static void set_oplock_level(struct oplock_info *opinfo, int level,
switch (level) {
case SMB2_OPLOCK_LEVEL_BATCH:
case SMB2_OPLOCK_LEVEL_EXCLUSIVE:
grant_write_oplock(opinfo,
level, lctx);
grant_write_oplock(opinfo, level, lctx);
break;
case SMB2_OPLOCK_LEVEL_II:
grant_read_oplock(opinfo, lctx);
@ -1084,12 +1078,8 @@ static void set_oplock_level(struct oplock_info *opinfo, int level,
*
* Return: 0 on success, otherwise error
*/
int smb_grant_oplock(struct ksmbd_work *work,
int req_op_level,
uint64_t pid,
struct ksmbd_file *fp,
__u16 tid,
struct lease_ctx_info *lctx,
int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,
struct ksmbd_file *fp, __u16 tid, struct lease_ctx_info *lctx,
int share_ret)
{
struct ksmbd_session *sess = work->sess;
@ -1150,14 +1140,14 @@ int smb_grant_oplock(struct ksmbd_work *work,
prev_op_state = prev_opinfo->o_lease->state;
if (share_ret < 0 &&
(prev_opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE)) {
prev_opinfo->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE) {
err = share_ret;
opinfo_put(prev_opinfo);
goto err_out;
}
if ((prev_opinfo->level != SMB2_OPLOCK_LEVEL_BATCH) &&
(prev_opinfo->level != SMB2_OPLOCK_LEVEL_EXCLUSIVE)) {
if (prev_opinfo->level != SMB2_OPLOCK_LEVEL_BATCH &&
prev_opinfo->level != SMB2_OPLOCK_LEVEL_EXCLUSIVE) {
opinfo_put(prev_opinfo);
goto op_break_not_needed;
}
@ -1244,17 +1234,16 @@ static void smb_break_all_write_oplock(struct ksmbd_work *work,
* @fp: ksmbd file pointer
* @is_trunc: truncate on open
*/
void smb_break_all_levII_oplock(struct ksmbd_work *work,
struct ksmbd_file *fp, int is_trunc)
void smb_break_all_levII_oplock(struct ksmbd_work *work, struct ksmbd_file *fp,
int is_trunc)
{
struct oplock_info *op, *brk_op;
struct ksmbd_inode *ci;
struct ksmbd_conn *conn = work->sess->conn;
if (!test_share_config_flag(work->tcon->share_conf,
KSMBD_SHARE_FLAG_OPLOCKS)) {
KSMBD_SHARE_FLAG_OPLOCKS))
return;
}
ci = fp->f_ci;
op = opinfo_get(fp);
@ -1283,12 +1272,10 @@ void smb_break_all_levII_oplock(struct ksmbd_work *work,
atomic_read(&brk_op->breaking_cnt))
goto next;
if (op && op->is_lease &&
brk_op->is_lease &&
if (op && op->is_lease && brk_op->is_lease &&
!memcmp(conn->ClientGUID, brk_op->conn->ClientGUID,
SMB2_CLIENT_GUID_SIZE) &&
!memcmp(op->o_lease->lease_key,
brk_op->o_lease->lease_key,
!memcmp(op->o_lease->lease_key, brk_op->o_lease->lease_key,
SMB2_LEASE_KEY_SIZE))
goto next;
brk_op->open_trunc = is_trunc;
@ -1327,14 +1314,16 @@ void smb_break_all_oplock(struct ksmbd_work *work, struct ksmbd_file *fp)
__u8 smb2_map_lease_to_oplock(__le32 lease_state)
{
if (lease_state == (SMB2_LEASE_HANDLE_CACHING_LE |
SMB2_LEASE_READ_CACHING_LE | SMB2_LEASE_WRITE_CACHING_LE))
SMB2_LEASE_READ_CACHING_LE |
SMB2_LEASE_WRITE_CACHING_LE)) {
return SMB2_OPLOCK_LEVEL_BATCH;
else if (lease_state != SMB2_LEASE_WRITE_CACHING_LE &&
} else if (lease_state != SMB2_LEASE_WRITE_CACHING_LE &&
lease_state & SMB2_LEASE_WRITE_CACHING_LE) {
if (!(lease_state & SMB2_LEASE_HANDLE_CACHING_LE))
return SMB2_OPLOCK_LEVEL_EXCLUSIVE;
} else if (lease_state & SMB2_LEASE_READ_CACHING_LE)
} else if (lease_state & SMB2_LEASE_READ_CACHING_LE) {
return SMB2_OPLOCK_LEVEL_II;
}
return 0;
}
@ -1625,8 +1614,7 @@ struct oplock_info *lookup_lease_in_table(struct ksmbd_conn *conn,
if (!atomic_inc_not_zero(&opinfo->refcount))
continue;
rcu_read_unlock();
if (!opinfo->op_state ||
opinfo->op_state == OPLOCK_CLOSING)
if (!opinfo->op_state || opinfo->op_state == OPLOCK_CLOSING)
goto op_next;
if (!(opinfo->o_lease->state &
(SMB2_LEASE_HANDLE_CACHING_LE |

View File

@ -68,7 +68,7 @@ struct oplock_info {
int level;
int op_state;
unsigned long pending_break;
uint64_t fid;
u64 fid;
atomic_t breaking_cnt;
atomic_t refcount;
__u16 Tid;
@ -95,10 +95,10 @@ struct oplock_break_info {
int fid;
};
extern int smb_grant_oplock(struct ksmbd_work *work, int req_op_level,
uint64_t pid, struct ksmbd_file *fp, __u16 tid,
int smb_grant_oplock(struct ksmbd_work *work, int req_op_level,
u64 pid, struct ksmbd_file *fp, __u16 tid,
struct lease_ctx_info *lctx, int share_ret);
extern void smb_break_all_levII_oplock(struct ksmbd_work *work,
void smb_break_all_levII_oplock(struct ksmbd_work *work,
struct ksmbd_file *fp, int is_trunc);
int opinfo_write_to_read(struct oplock_info *opinfo);
@ -124,9 +124,8 @@ void create_disk_id_rsp_buf(char *cc, __u64 file_id, __u64 vol_id);
void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp);
struct create_context *smb2_find_context_vals(void *open_req, const char *str);
int ksmbd_durable_verify_and_del_oplock(struct ksmbd_session *curr_sess,
struct ksmbd_session *prev_sess,
int fid, struct file **filp,
uint64_t sess_id);
struct ksmbd_session *prev_sess, int fid, struct file **filp,
u64 sess_id);
struct oplock_info *lookup_lease_in_table(struct ksmbd_conn *conn,
char *lease_key);
int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,
@ -134,5 +133,4 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,
void destroy_lease_table(struct ksmbd_conn *conn);
int smb2_check_durable_oplock(struct ksmbd_file *fp,
struct lease_ctx_info *lctx, char *name);
#endif /* __KSMBD_OPLOCK_H */

View File

@ -105,8 +105,7 @@ static inline int check_conn_state(struct ksmbd_work *work)
#define TCP_HANDLER_CONTINUE 0
#define TCP_HANDLER_ABORT 1
static int __process_request(struct ksmbd_work *work,
struct ksmbd_conn *conn,
static int __process_request(struct ksmbd_work *work, struct ksmbd_conn *conn,
uint16_t *cmd)
{
struct smb_version_cmds *cmds;
@ -162,7 +161,7 @@ static int __process_request(struct ksmbd_work *work,
static void __handle_ksmbd_work(struct ksmbd_work *work,
struct ksmbd_conn *conn)
{
uint16_t command = 0;
u16 command = 0;
int rc;
if (conn->ops->allocate_rsp_buf(work))
@ -416,8 +415,7 @@ int server_queue_ctrl_reset_work(void)
return __queue_ctrl_work(SERVER_CTRL_TYPE_RESET);
}
static ssize_t stats_show(struct class *class,
struct class_attribute *attr,
static ssize_t stats_show(struct class *class, struct class_attribute *attr,
char *buf)
{
/*
@ -443,8 +441,7 @@ static ssize_t stats_show(struct class *class,
}
static ssize_t kill_server_store(struct class *class,
struct class_attribute *attr,
const char *buf,
struct class_attribute *attr, const char *buf,
size_t len)
{
if (!sysfs_streq(buf, "hard"))
@ -464,8 +461,7 @@ static const char * const debug_type_strings[] = {"smb", "auth", "vfs",
"oplock", "ipc", "conn",
"rdma"};
static ssize_t debug_show(struct class *class,
struct class_attribute *attr,
static ssize_t debug_show(struct class *class, struct class_attribute *attr,
char *buf)
{
ssize_t sz = 0;
@ -484,16 +480,13 @@ static ssize_t debug_show(struct class *class,
debug_type_strings[i]);
}
sz += pos;
}
sz += scnprintf(buf + sz, PAGE_SIZE - sz, "\n");
return sz;
}
static ssize_t debug_store(struct class *class,
struct class_attribute *attr,
const char *buf,
size_t len)
static ssize_t debug_store(struct class *class, struct class_attribute *attr,
const char *buf, size_t len)
{
int i;

View File

@ -90,8 +90,7 @@ static char *smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
/* error reqeusts do not have data area */
if (hdr->Status && hdr->Status != STATUS_MORE_PROCESSING_REQUIRED &&
(((struct smb2_err_rsp *)hdr)->StructureSize) ==
SMB2_ERROR_STRUCTURE_SIZE2_LE)
(((struct smb2_err_rsp *)hdr)->StructureSize) == SMB2_ERROR_STRUCTURE_SIZE2_LE)
return NULL;
/*
@ -101,16 +100,12 @@ static char *smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
*/
switch (hdr->Command) {
case SMB2_SESSION_SETUP:
*off = le16_to_cpu(
((struct smb2_sess_setup_req *)hdr)->SecurityBufferOffset);
*len = le16_to_cpu(
((struct smb2_sess_setup_req *)hdr)->SecurityBufferLength);
*off = le16_to_cpu(((struct smb2_sess_setup_req *)hdr)->SecurityBufferOffset);
*len = le16_to_cpu(((struct smb2_sess_setup_req *)hdr)->SecurityBufferLength);
break;
case SMB2_TREE_CONNECT:
*off = le16_to_cpu(
((struct smb2_tree_connect_req *)hdr)->PathOffset);
*len = le16_to_cpu(
((struct smb2_tree_connect_req *)hdr)->PathLength);
*off = le16_to_cpu(((struct smb2_tree_connect_req *)hdr)->PathOffset);
*len = le16_to_cpu(((struct smb2_tree_connect_req *)hdr)->PathLength);
break;
case SMB2_CREATE:
{
@ -122,49 +117,35 @@ static char *smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
break;
}
*off = le16_to_cpu(
((struct smb2_create_req *)hdr)->NameOffset);
*len = le16_to_cpu(
((struct smb2_create_req *)hdr)->NameLength);
*off = le16_to_cpu(((struct smb2_create_req *)hdr)->NameOffset);
*len = le16_to_cpu(((struct smb2_create_req *)hdr)->NameLength);
break;
}
case SMB2_QUERY_INFO:
*off = le16_to_cpu(
((struct smb2_query_info_req *)hdr)->InputBufferOffset);
*len = le32_to_cpu(
((struct smb2_query_info_req *)hdr)->InputBufferLength);
*off = le16_to_cpu(((struct smb2_query_info_req *)hdr)->InputBufferOffset);
*len = le32_to_cpu(((struct smb2_query_info_req *)hdr)->InputBufferLength);
break;
case SMB2_SET_INFO:
*off = le16_to_cpu(
((struct smb2_set_info_req *)hdr)->BufferOffset);
*len = le32_to_cpu(
((struct smb2_set_info_req *)hdr)->BufferLength);
*off = le16_to_cpu(((struct smb2_set_info_req *)hdr)->BufferOffset);
*len = le32_to_cpu(((struct smb2_set_info_req *)hdr)->BufferLength);
break;
case SMB2_READ:
*off = le16_to_cpu(
((struct smb2_read_req *)hdr)->ReadChannelInfoOffset);
*len = le16_to_cpu(
((struct smb2_read_req *)hdr)->ReadChannelInfoLength);
*off = le16_to_cpu(((struct smb2_read_req *)hdr)->ReadChannelInfoOffset);
*len = le16_to_cpu(((struct smb2_read_req *)hdr)->ReadChannelInfoLength);
break;
case SMB2_WRITE:
if (((struct smb2_write_req *)hdr)->DataOffset) {
*off = le16_to_cpu(
((struct smb2_write_req *)hdr)->DataOffset);
*len = le32_to_cpu(
((struct smb2_write_req *)hdr)->Length);
*off = le16_to_cpu(((struct smb2_write_req *)hdr)->DataOffset);
*len = le32_to_cpu(((struct smb2_write_req *)hdr)->Length);
break;
}
*off = le16_to_cpu(
((struct smb2_write_req *)hdr)->WriteChannelInfoOffset);
*len = le16_to_cpu(
((struct smb2_write_req *)hdr)->WriteChannelInfoLength);
*off = le16_to_cpu(((struct smb2_write_req *)hdr)->WriteChannelInfoOffset);
*len = le16_to_cpu(((struct smb2_write_req *)hdr)->WriteChannelInfoLength);
break;
case SMB2_QUERY_DIRECTORY:
*off = le16_to_cpu(
((struct smb2_query_directory_req *)hdr)->FileNameOffset);
*len = le16_to_cpu(
((struct smb2_query_directory_req *)hdr)->FileNameLength);
*off = le16_to_cpu(((struct smb2_query_directory_req *)hdr)->FileNameOffset);
*len = le16_to_cpu(((struct smb2_query_directory_req *)hdr)->FileNameLength);
break;
case SMB2_LOCK:
{
@ -174,8 +155,7 @@ static char *smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
* smb2_lock request size is 48 included single
* smb2_lock_element structure size.
*/
lock_count = le16_to_cpu(
((struct smb2_lock_req *)hdr)->LockCount) - 1;
lock_count = le16_to_cpu(((struct smb2_lock_req *)hdr)->LockCount) - 1;
if (lock_count > 0) {
*off = __SMB2_HEADER_STRUCTURE_SIZE + 48;
*len = sizeof(struct smb2_lock_element) * lock_count;
@ -183,8 +163,7 @@ static char *smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
break;
}
case SMB2_IOCTL:
*off = le32_to_cpu(
((struct smb2_ioctl_req *)hdr)->InputOffset);
*off = le32_to_cpu(((struct smb2_ioctl_req *)hdr)->InputOffset);
*len = le32_to_cpu(((struct smb2_ioctl_req *)hdr)->InputCount);
break;
@ -366,9 +345,9 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
hdr = &pdu->hdr;
}
if (le32_to_cpu(hdr->NextCommand) > 0)
if (le32_to_cpu(hdr->NextCommand) > 0) {
len = le32_to_cpu(hdr->NextCommand);
else if (work->next_smb2_rcv_hdr_off) {
} else if (work->next_smb2_rcv_hdr_off) {
len -= work->next_smb2_rcv_hdr_off;
len = round_up(len, 8);
}
@ -389,19 +368,17 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
}
if (smb2_req_struct_sizes[command] != pdu->StructureSize2) {
if (command != SMB2_OPLOCK_BREAK_HE && (hdr->Status == 0 ||
pdu->StructureSize2 != SMB2_ERROR_STRUCTURE_SIZE2_LE)) {
if (command != SMB2_OPLOCK_BREAK_HE &&
(hdr->Status == 0 || pdu->StructureSize2 != SMB2_ERROR_STRUCTURE_SIZE2_LE)) {
/* error packets have 9 byte structure size */
ksmbd_debug(SMB,
"Illegal request size %u for command %d\n",
le16_to_cpu(pdu->StructureSize2), command);
return 1;
} else if (command == SMB2_OPLOCK_BREAK_HE
&& (hdr->Status == 0)
&& (le16_to_cpu(pdu->StructureSize2) !=
OP_BREAK_STRUCT_SIZE_20)
&& (le16_to_cpu(pdu->StructureSize2) !=
OP_BREAK_STRUCT_SIZE_21)) {
} else if (command == SMB2_OPLOCK_BREAK_HE &&
hdr->Status == 0 &&
le16_to_cpu(pdu->StructureSize2) != OP_BREAK_STRUCT_SIZE_20 &&
le16_to_cpu(pdu->StructureSize2) != OP_BREAK_STRUCT_SIZE_21) {
/* special case for SMB2.1 lease break message */
ksmbd_debug(SMB,
"Illegal request size %d for oplock break\n",

File diff suppressed because it is too large Load Diff

View File

@ -346,8 +346,8 @@ struct smb2_negotiate_rsp {
#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
#define SMB2_SESSION_EXPIRED (0)
#define SMB2_SESSION_IN_PROGRESS (1 << 0)
#define SMB2_SESSION_VALID (1 << 1)
#define SMB2_SESSION_IN_PROGRESS BIT(0)
#define SMB2_SESSION_VALID BIT(1)
/* Flags */
#define SMB2_SESSION_REQ_FLAG_BINDING 0x01
@ -1161,7 +1161,6 @@ struct smb2_set_info_rsp {
__le16 StructureSize; /* Must be 2 */
} __packed;
/* FILE Info response size */
#define FILE_DIRECTORY_INFORMATION_SIZE 1
#define FILE_FULL_DIRECTORY_INFORMATION_SIZE 2
@ -1199,7 +1198,6 @@ struct smb2_set_info_rsp {
#define FILE_NETWORK_OPEN_INFORMATION_SIZE 56
#define FILE_ATTRIBUTE_TAG_INFORMATION_SIZE 8
/* FS Info response size */
#define FS_DEVICE_INFORMATION_SIZE 8
#define FS_ATTRIBUTE_INFORMATION_SIZE 16
@ -1579,71 +1577,70 @@ struct smb2_posix_info {
} __packed;
/* functions */
int init_smb2_0_server(struct ksmbd_conn *conn);
void init_smb2_1_server(struct ksmbd_conn *conn);
void init_smb3_0_server(struct ksmbd_conn *conn);
void init_smb3_02_server(struct ksmbd_conn *conn);
int init_smb3_11_server(struct ksmbd_conn *conn);
extern int init_smb2_0_server(struct ksmbd_conn *conn);
extern void init_smb2_1_server(struct ksmbd_conn *conn);
extern void init_smb3_0_server(struct ksmbd_conn *conn);
extern void init_smb3_02_server(struct ksmbd_conn *conn);
extern int init_smb3_11_server(struct ksmbd_conn *conn);
void init_smb2_max_read_size(unsigned int sz);
void init_smb2_max_write_size(unsigned int sz);
void init_smb2_max_trans_size(unsigned int sz);
extern void init_smb2_max_read_size(unsigned int sz);
extern void init_smb2_max_write_size(unsigned int sz);
extern void init_smb2_max_trans_size(unsigned int sz);
int is_smb2_neg_cmd(struct ksmbd_work *work);
int is_smb2_rsp(struct ksmbd_work *work);
extern int is_smb2_neg_cmd(struct ksmbd_work *work);
extern int is_smb2_rsp(struct ksmbd_work *work);
extern uint16_t get_smb2_cmd_val(struct ksmbd_work *work);
extern void set_smb2_rsp_status(struct ksmbd_work *work, __le32 err);
extern int init_smb2_rsp_hdr(struct ksmbd_work *work);
extern int smb2_allocate_rsp_buf(struct ksmbd_work *work);
extern bool is_chained_smb2_message(struct ksmbd_work *work);
extern int init_smb2_neg_rsp(struct ksmbd_work *work);
extern void smb2_set_err_rsp(struct ksmbd_work *work);
extern int smb2_check_user_session(struct ksmbd_work *work);
extern int smb2_get_ksmbd_tcon(struct ksmbd_work *work);
extern bool smb2_is_sign_req(struct ksmbd_work *work, unsigned int command);
extern int smb2_check_sign_req(struct ksmbd_work *work);
extern void smb2_set_sign_rsp(struct ksmbd_work *work);
extern int smb3_check_sign_req(struct ksmbd_work *work);
extern void smb3_set_sign_rsp(struct ksmbd_work *work);
extern int find_matching_smb2_dialect(int start_index, __le16 *cli_dialects,
u16 get_smb2_cmd_val(struct ksmbd_work *work);
void set_smb2_rsp_status(struct ksmbd_work *work, __le32 err);
int init_smb2_rsp_hdr(struct ksmbd_work *work);
int smb2_allocate_rsp_buf(struct ksmbd_work *work);
bool is_chained_smb2_message(struct ksmbd_work *work);
int init_smb2_neg_rsp(struct ksmbd_work *work);
void smb2_set_err_rsp(struct ksmbd_work *work);
int smb2_check_user_session(struct ksmbd_work *work);
int smb2_get_ksmbd_tcon(struct ksmbd_work *work);
bool smb2_is_sign_req(struct ksmbd_work *work, unsigned int command);
int smb2_check_sign_req(struct ksmbd_work *work);
void smb2_set_sign_rsp(struct ksmbd_work *work);
int smb3_check_sign_req(struct ksmbd_work *work);
void smb3_set_sign_rsp(struct ksmbd_work *work);
int find_matching_smb2_dialect(int start_index, __le16 *cli_dialects,
__le16 dialects_count);
extern struct file_lock *smb_flock_init(struct file *f);
extern int setup_async_work(struct ksmbd_work *work, void (*fn)(void **),
struct file_lock *smb_flock_init(struct file *f);
int setup_async_work(struct ksmbd_work *work, void (*fn)(void **),
void **arg);
extern void smb2_send_interim_resp(struct ksmbd_work *work, __le32 status);
extern struct channel *lookup_chann_list(struct ksmbd_session *sess);
extern void smb3_preauth_hash_rsp(struct ksmbd_work *work);
extern int smb3_is_transform_hdr(void *buf);
extern int smb3_decrypt_req(struct ksmbd_work *work);
extern int smb3_encrypt_resp(struct ksmbd_work *work);
extern bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work);
extern int smb2_set_rsp_credits(struct ksmbd_work *work);
void smb2_send_interim_resp(struct ksmbd_work *work, __le32 status);
struct channel *lookup_chann_list(struct ksmbd_session *sess);
void smb3_preauth_hash_rsp(struct ksmbd_work *work);
int smb3_is_transform_hdr(void *buf);
int smb3_decrypt_req(struct ksmbd_work *work);
int smb3_encrypt_resp(struct ksmbd_work *work);
bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work);
int smb2_set_rsp_credits(struct ksmbd_work *work);
/* smb2 misc functions */
extern int ksmbd_smb2_check_message(struct ksmbd_work *work);
int ksmbd_smb2_check_message(struct ksmbd_work *work);
/* smb2 command handlers */
extern int smb2_handle_negotiate(struct ksmbd_work *work);
extern int smb2_negotiate_request(struct ksmbd_work *work);
extern int smb2_sess_setup(struct ksmbd_work *work);
extern int smb2_tree_connect(struct ksmbd_work *work);
extern int smb2_tree_disconnect(struct ksmbd_work *work);
extern int smb2_session_logoff(struct ksmbd_work *work);
extern int smb2_open(struct ksmbd_work *work);
extern int smb2_query_info(struct ksmbd_work *work);
extern int smb2_query_dir(struct ksmbd_work *work);
extern int smb2_close(struct ksmbd_work *work);
extern int smb2_echo(struct ksmbd_work *work);
extern int smb2_set_info(struct ksmbd_work *work);
extern int smb2_read(struct ksmbd_work *work);
extern int smb2_write(struct ksmbd_work *work);
extern int smb2_flush(struct ksmbd_work *work);
extern int smb2_cancel(struct ksmbd_work *work);
extern int smb2_lock(struct ksmbd_work *work);
extern int smb2_ioctl(struct ksmbd_work *work);
extern int smb2_oplock_break(struct ksmbd_work *work);
extern int smb2_notify(struct ksmbd_work *ksmbd_work);
int smb2_handle_negotiate(struct ksmbd_work *work);
int smb2_negotiate_request(struct ksmbd_work *work);
int smb2_sess_setup(struct ksmbd_work *work);
int smb2_tree_connect(struct ksmbd_work *work);
int smb2_tree_disconnect(struct ksmbd_work *work);
int smb2_session_logoff(struct ksmbd_work *work);
int smb2_open(struct ksmbd_work *work);
int smb2_query_info(struct ksmbd_work *work);
int smb2_query_dir(struct ksmbd_work *work);
int smb2_close(struct ksmbd_work *work);
int smb2_echo(struct ksmbd_work *work);
int smb2_set_info(struct ksmbd_work *work);
int smb2_read(struct ksmbd_work *work);
int smb2_write(struct ksmbd_work *work);
int smb2_flush(struct ksmbd_work *work);
int smb2_cancel(struct ksmbd_work *work);
int smb2_lock(struct ksmbd_work *work);
int smb2_ioctl(struct ksmbd_work *work);
int smb2_oplock_break(struct ksmbd_work *work);
int smb2_notify(struct ksmbd_work *ksmbd_work);
#endif /* _SMB2PDU_H */

View File

@ -268,15 +268,10 @@ bool ksmbd_pdu_size_has_room(unsigned int pdu)
return (pdu >= KSMBD_MIN_SUPPORTED_HEADER_SIZE - 4);
}
int ksmbd_populate_dot_dotdot_entries(struct ksmbd_work *work,
int info_level,
struct ksmbd_file *dir,
struct ksmbd_dir_info *d_info,
char *search_pattern,
int (*fn)(struct ksmbd_conn *,
int,
struct ksmbd_dir_info *,
struct ksmbd_kstat *))
int ksmbd_populate_dot_dotdot_entries(struct ksmbd_work *work, int info_level,
struct ksmbd_file *dir, struct ksmbd_dir_info *d_info,
char *search_pattern, int (*fn)(struct ksmbd_conn *, int,
struct ksmbd_dir_info *, struct ksmbd_kstat *))
{
int i, rc = 0;
struct ksmbd_conn *conn = work->conn;
@ -331,8 +326,7 @@ int ksmbd_populate_dot_dotdot_entries(struct ksmbd_work *work,
* TODO: Though this function comforms the restriction of 8.3 Filename spec,
* but the result is different with Windows 7's one. need to check.
*/
int ksmbd_extract_shortname(struct ksmbd_conn *conn,
const char *longname,
int ksmbd_extract_shortname(struct ksmbd_conn *conn, const char *longname,
char *shortname)
{
const char *p;
@ -354,7 +348,7 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn,
if (p == longname) { /*name starts with a dot*/
strscpy(extension, "___", strlen("___"));
} else {
if (p != NULL) {
if (p) {
p++;
while (*p && extlen < 3) {
if (*p != '.')
@ -362,9 +356,10 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn,
p++;
}
extension[extlen] = '\0';
} else
} else {
dot_present = false;
}
}
p = longname;
if (*p == '.') {
@ -471,8 +466,7 @@ static const char * const shared_mode_errors[] = {
"Desired access mode does not permit FILE_DELETE",
};
static void smb_shared_mode_error(int error,
struct ksmbd_file *prev_fp,
static void smb_shared_mode_error(int error, struct ksmbd_file *prev_fp,
struct ksmbd_file *curr_fp)
{
ksmbd_debug(SMB, "%s\n", shared_mode_errors[error]);
@ -528,8 +522,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
continue;
if (!(prev_fp->saccess & FILE_SHARE_READ_LE) &&
curr_fp->daccess & (FILE_EXECUTE_LE |
FILE_READ_DATA_LE)) {
curr_fp->daccess & (FILE_EXECUTE_LE | FILE_READ_DATA_LE)) {
smb_shared_mode_error(SHARE_READ_ERROR,
prev_fp,
curr_fp);
@ -538,8 +531,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
}
if (!(prev_fp->saccess & FILE_SHARE_WRITE_LE) &&
curr_fp->daccess & (FILE_WRITE_DATA_LE |
FILE_APPEND_DATA_LE)) {
curr_fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE)) {
smb_shared_mode_error(SHARE_WRITE_ERROR,
prev_fp,
curr_fp);
@ -547,8 +539,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
break;
}
if (prev_fp->daccess & (FILE_EXECUTE_LE |
FILE_READ_DATA_LE) &&
if (prev_fp->daccess & (FILE_EXECUTE_LE | FILE_READ_DATA_LE) &&
!(curr_fp->saccess & FILE_SHARE_READ_LE)) {
smb_shared_mode_error(FILE_READ_ERROR,
prev_fp,
@ -557,8 +548,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
break;
}
if (prev_fp->daccess & (FILE_WRITE_DATA_LE |
FILE_APPEND_DATA_LE) &&
if (prev_fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE) &&
!(curr_fp->saccess & FILE_SHARE_WRITE_LE)) {
smb_shared_mode_error(FILE_WRITE_ERROR,
prev_fp,
@ -620,7 +610,7 @@ int ksmbd_override_fsids(struct ksmbd_work *work)
if (!uid_eq(cred->fsuid, GLOBAL_ROOT_UID))
cred->cap_effective = cap_drop_fs_set(cred->cap_effective);
WARN_ON(work->saved_cred != NULL);
WARN_ON(work->saved_cred);
work->saved_cred = override_creds(cred);
if (!work->saved_cred) {
abort_creds(cred);
@ -633,7 +623,7 @@ void ksmbd_revert_fsids(struct ksmbd_work *work)
{
const struct cred *cred;
WARN_ON(work->saved_cred == NULL);
WARN_ON(!work->saved_cred);
cred = current_cred();
revert_creds(work->saved_cred);

View File

@ -490,8 +490,6 @@ struct smb_version_cmds {
int (*proc)(struct ksmbd_work *swork);
};
int ksmbd_min_protocol(void);
int ksmbd_max_protocol(void);

View File

@ -68,13 +68,12 @@ static const struct smb_sid sid_unix_NFS_mode = { 1, 2, {0, 0, 0, 0, 0, 5},
* if the two SIDs (roughly equivalent to a UUID for a user or group) are
* the same returns zero, if they do not match returns non-zero.
*/
int
compare_sids(const struct smb_sid *ctsid, const struct smb_sid *cwsid)
int compare_sids(const struct smb_sid *ctsid, const struct smb_sid *cwsid)
{
int i;
int num_subauth, num_sat, num_saw;
if ((!ctsid) || (!cwsid))
if (!ctsid || !cwsid)
return 1;
/* compare the revision */
@ -114,8 +113,7 @@ compare_sids(const struct smb_sid *ctsid, const struct smb_sid *cwsid)
return 0; /* sids compare/match */
}
static void
smb_copy_sid(struct smb_sid *dst, const struct smb_sid *src)
static void smb_copy_sid(struct smb_sid *dst, const struct smb_sid *src)
{
int i;
@ -144,21 +142,17 @@ static umode_t access_flags_to_mode(struct smb_fattr *fattr, __le32 ace_flags,
return mode;
}
if ((flags & GENERIC_READ) ||
(flags & FILE_READ_RIGHTS))
if ((flags & GENERIC_READ) || (flags & FILE_READ_RIGHTS))
mode = 0444;
if ((flags & GENERIC_WRITE) ||
(flags & FILE_WRITE_RIGHTS)) {
if ((flags & GENERIC_WRITE) || (flags & FILE_WRITE_RIGHTS)) {
mode |= 0222;
if (S_ISDIR(fattr->cf_mode))
mode |= 0111;
}
if ((flags & GENERIC_EXECUTE) ||
(flags & FILE_EXEC_RIGHTS))
if ((flags & GENERIC_EXECUTE) || (flags & FILE_EXEC_RIGHTS))
mode |= 0111;
if (type == ACCESS_DENIED_ACE_TYPE ||
type == ACCESS_DENIED_OBJECT_ACE_TYPE)
if (type == ACCESS_DENIED_ACE_TYPE || type == ACCESS_DENIED_OBJECT_ACE_TYPE)
mode = ~mode;
ksmbd_debug(SMB, "access flags 0x%x mode now %04o\n", flags, mode);
@ -282,8 +276,7 @@ static int sid_to_id(struct smb_sid *psid, uint sidtype,
id = le32_to_cpu(psid->sub_auth[psid->num_subauth - 1]);
if (id > 0) {
uid = make_kuid(&init_user_ns, id);
if (uid_valid(uid) &&
kuid_has_mapping(&init_user_ns, uid)) {
if (uid_valid(uid) && kuid_has_mapping(&init_user_ns, uid)) {
fattr->cf_uid = uid;
rc = 0;
}
@ -295,8 +288,7 @@ static int sid_to_id(struct smb_sid *psid, uint sidtype,
id = le32_to_cpu(psid->sub_auth[psid->num_subauth - 1]);
if (id > 0) {
gid = make_kgid(&init_user_ns, id);
if (gid_valid(gid) &&
kgid_has_mapping(&init_user_ns, gid)) {
if (gid_valid(gid) && kgid_has_mapping(&init_user_ns, gid)) {
fattr->cf_gid = gid;
rc = 0;
}
@ -435,11 +427,11 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
ppace[i]->access_req =
smb_map_generic_desired_access(ppace[i]->access_req);
if (!(compare_sids(&(ppace[i]->sid), &sid_unix_NFS_mode))) {
if (!(compare_sids(&ppace[i]->sid, &sid_unix_NFS_mode))) {
fattr->cf_mode =
le32_to_cpu(ppace[i]->sid.sub_auth[2]);
break;
} else if (!compare_sids(&(ppace[i]->sid), pownersid)) {
} else if (!compare_sids(&ppace[i]->sid, pownersid)) {
acl_mode = access_flags_to_mode(fattr,
ppace[i]->access_req, ppace[i]->type);
acl_mode &= 0700;
@ -449,7 +441,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
mode |= acl_mode;
}
owner_found = true;
} else if (!compare_sids(&(ppace[i]->sid), pgrpsid) ||
} else if (!compare_sids(&ppace[i]->sid, pgrpsid) ||
ppace[i]->sid.sub_auth[ppace[i]->sid.num_subauth - 1] ==
DOMAIN_USER_RID_LE) {
acl_mode = access_flags_to_mode(fattr,
@ -460,7 +452,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
mode |= acl_mode;
}
group_found = true;
} else if (!compare_sids(&(ppace[i]->sid), &sid_everyone)) {
} else if (!compare_sids(&ppace[i]->sid, &sid_everyone)) {
acl_mode = access_flags_to_mode(fattr,
ppace[i]->access_req, ppace[i]->type);
acl_mode &= 0007;
@ -469,13 +461,13 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
mode |= acl_mode;
}
others_found = true;
} else if (!compare_sids(&(ppace[i]->sid), &creator_owner))
} else if (!compare_sids(&ppace[i]->sid, &creator_owner)) {
continue;
else if (!compare_sids(&(ppace[i]->sid), &creator_group))
} else if (!compare_sids(&ppace[i]->sid, &creator_group)) {
continue;
else if (!compare_sids(&(ppace[i]->sid), &sid_authusers))
} else if (!compare_sids(&ppace[i]->sid, &sid_authusers)) {
continue;
else {
} else {
struct smb_fattr temp_fattr;
acl_mode = access_flags_to_mode(fattr, ppace[i]->access_req,
@ -786,7 +778,7 @@ int parse_sec_desc(struct smb_ntsd *pntsd, int acl_len,
__u32 dacloffset;
int pntsd_type;
if (pntsd == NULL)
if (!pntsd)
return -EIO;
owner_sid_ptr = (struct smb_sid *)((char *)pntsd +
@ -913,11 +905,11 @@ int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *ppntsd,
dacl_ptr->size = cpu_to_le16(sizeof(struct smb_acl));
dacl_ptr->num_aces = 0;
if (!ppntsd)
if (!ppntsd) {
set_mode_dacl(dacl_ptr, fattr);
else if (!ppntsd->dacloffset)
} else if (!ppntsd->dacloffset) {
goto out;
else {
} else {
struct smb_acl *ppdacl_ptr;
ppdacl_ptr = (struct smb_acl *)((char *)ppntsd +
@ -992,8 +984,9 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, struct dentry *dentry,
flags |= INHERIT_ONLY_ACE;
if (flags & NO_PROPAGATE_INHERIT_ACE)
flags = 0;
} else
} else {
flags = 0;
}
if (!compare_sids(&creator_owner, &parent_aces->sid)) {
creator = &creator_owner;
@ -1016,8 +1009,9 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, struct dentry *dentry,
aces = (struct smb_ace *)((char *)aces + le16_to_cpu(aces->size));
flags |= INHERIT_ONLY_ACE;
psid = creator;
} else if (is_dir && !(parent_aces->flags & NO_PROPAGATE_INHERIT_ACE))
} else if (is_dir && !(parent_aces->flags & NO_PROPAGATE_INHERIT_ACE)) {
psid = &parent_aces->sid;
}
smb_set_ace(aces, psid, parent_aces->type, flags | inherited_flags,
parent_aces->access_req);
@ -1229,9 +1223,9 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, struct dentry *dentry,
posix_acl_release(posix_acls);
if (!found) {
if (others_ace)
if (others_ace) {
ace = others_ace;
else {
} else {
ksmbd_debug(SMB, "Can't find corresponding sid\n");
rc = -EACCES;
goto err_out;
@ -1300,8 +1294,7 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
if (type_check && !(le16_to_cpu(pntsd->type) & DACL_PRESENT))
goto out;
if (test_share_config_flag(tcon->share_conf,
KSMBD_SHARE_FLAG_ACL_XATTR)) {
if (test_share_config_flag(tcon->share_conf, KSMBD_SHARE_FLAG_ACL_XATTR)) {
/* Update WinACL in xattr */
ksmbd_vfs_remove_sd_xattrs(dentry);
ksmbd_vfs_set_sd_xattr(conn, dentry, pntsd, ntsd_len);

View File

@ -75,8 +75,7 @@ struct ipc_msg_table_entry {
static struct delayed_work ipc_timer_work;
static int handle_startup_event(struct sk_buff *skb, struct genl_info *info);
static int handle_unsupported_event(struct sk_buff *skb,
struct genl_info *info);
static int handle_unsupported_event(struct sk_buff *skb, struct genl_info *info);
static int handle_generic_event(struct sk_buff *skb, struct genl_info *info);
static int ksmbd_ipc_heartbeat_request(void);
@ -385,8 +384,7 @@ static int handle_startup_event(struct sk_buff *skb, struct genl_info *info)
return ret;
}
static int handle_unsupported_event(struct sk_buff *skb,
struct genl_info *info)
static int handle_unsupported_event(struct sk_buff *skb, struct genl_info *info)
{
ksmbd_err("Unknown IPC event: %d, ignore.\n", info->genlhdr->cmd);
return -EINVAL;
@ -453,8 +451,7 @@ static int ipc_msg_send(struct ksmbd_ipc_msg *msg)
return ret;
}
static void *ipc_msg_send_request(struct ksmbd_ipc_msg *msg,
unsigned int handle)
static void *ipc_msg_send_request(struct ksmbd_ipc_msg *msg, unsigned int handle)
{
struct ipc_msg_table_entry entry;
int ret;
@ -658,8 +655,7 @@ ksmbd_ipc_share_config_request(const char *name)
return resp;
}
struct ksmbd_rpc_command *ksmbd_rpc_open(struct ksmbd_session *sess,
int handle)
struct ksmbd_rpc_command *ksmbd_rpc_open(struct ksmbd_session *sess, int handle)
{
struct ksmbd_ipc_msg *msg;
struct ksmbd_rpc_command *req;
@ -681,8 +677,7 @@ struct ksmbd_rpc_command *ksmbd_rpc_open(struct ksmbd_session *sess,
return resp;
}
struct ksmbd_rpc_command *ksmbd_rpc_close(struct ksmbd_session *sess,
int handle)
struct ksmbd_rpc_command *ksmbd_rpc_close(struct ksmbd_session *sess, int handle)
{
struct ksmbd_ipc_msg *msg;
struct ksmbd_rpc_command *req;
@ -704,10 +699,8 @@ struct ksmbd_rpc_command *ksmbd_rpc_close(struct ksmbd_session *sess,
return resp;
}
struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess,
int handle,
void *payload,
size_t payload_sz)
struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess, int handle,
void *payload, size_t payload_sz)
{
struct ksmbd_ipc_msg *msg;
struct ksmbd_rpc_command *req;
@ -731,8 +724,7 @@ struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess,
return resp;
}
struct ksmbd_rpc_command *ksmbd_rpc_read(struct ksmbd_session *sess,
int handle)
struct ksmbd_rpc_command *ksmbd_rpc_read(struct ksmbd_session *sess, int handle)
{
struct ksmbd_ipc_msg *msg;
struct ksmbd_rpc_command *req;
@ -755,10 +747,8 @@ struct ksmbd_rpc_command *ksmbd_rpc_read(struct ksmbd_session *sess,
return resp;
}
struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess,
int handle,
void *payload,
size_t payload_sz)
struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess, int handle,
void *payload, size_t payload_sz)
{
struct ksmbd_ipc_msg *msg;
struct ksmbd_rpc_command *req;
@ -782,8 +772,7 @@ struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess,
return resp;
}
struct ksmbd_rpc_command *ksmbd_rpc_rap(struct ksmbd_session *sess,
void *payload,
struct ksmbd_rpc_command *ksmbd_rpc_rap(struct ksmbd_session *sess, void *payload,
size_t payload_sz)
{
struct ksmbd_ipc_msg *msg;
@ -885,8 +874,7 @@ int ksmbd_ipc_init(void)
ret = genl_register_family(&ksmbd_genl_family);
if (ret) {
ksmbd_err("Failed to register KSMBD netlink interface %d\n",
ret);
ksmbd_err("Failed to register KSMBD netlink interface %d\n", ret);
goto cancel_work;
}

View File

@ -37,23 +37,15 @@ ksmbd_ipc_spnego_authen_request(const char *spnego_blob, int blob_len);
int ksmbd_ipc_id_alloc(void);
void ksmbd_rpc_id_free(int handle);
struct ksmbd_rpc_command *ksmbd_rpc_open(struct ksmbd_session *sess,
int handle);
struct ksmbd_rpc_command *ksmbd_rpc_close(struct ksmbd_session *sess,
int handle);
struct ksmbd_rpc_command *ksmbd_rpc_open(struct ksmbd_session *sess, int handle);
struct ksmbd_rpc_command *ksmbd_rpc_close(struct ksmbd_session *sess, int handle);
struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess,
int handle,
void *payload,
size_t payload_sz);
struct ksmbd_rpc_command *ksmbd_rpc_read(struct ksmbd_session *sess,
int handle);
struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess,
int handle,
void *payload,
size_t payload_sz);
struct ksmbd_rpc_command *ksmbd_rpc_rap(struct ksmbd_session *sess,
void *payload,
struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess, int handle,
void *payload, size_t payload_sz);
struct ksmbd_rpc_command *ksmbd_rpc_read(struct ksmbd_session *sess, int handle);
struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess, int handle,
void *payload, size_t payload_sz);
struct ksmbd_rpc_command *ksmbd_rpc_rap(struct ksmbd_session *sess, void *payload,
size_t payload_sz);
void ksmbd_ipc_release(void);

View File

@ -85,7 +85,6 @@ static struct smb_direct_listener {
struct rdma_cm_id *cm_id;
} smb_direct_listener;
static struct workqueue_struct *smb_direct_wq;
enum smb_direct_status {
@ -254,7 +253,6 @@ static void put_recvmsg(struct smb_direct_transport *t,
spin_lock(&t->recvmsg_queue_lock);
list_add(&recvmsg->list, &t->recvmsg_queue);
spin_unlock(&t->recvmsg_queue_lock);
}
static struct
@ -264,8 +262,7 @@ smb_direct_recvmsg *get_empty_recvmsg(struct smb_direct_transport *t)
spin_lock(&t->empty_recvmsg_queue_lock);
if (!list_empty(&t->empty_recvmsg_queue)) {
recvmsg = list_first_entry(
&t->empty_recvmsg_queue,
recvmsg = list_first_entry(&t->empty_recvmsg_queue,
struct smb_direct_recvmsg, list);
list_del(&recvmsg->list);
}
@ -285,8 +282,7 @@ static void put_empty_recvmsg(struct smb_direct_transport *t,
}
static void enqueue_reassembly(struct smb_direct_transport *t,
struct smb_direct_recvmsg *recvmsg,
int data_length)
struct smb_direct_recvmsg *recvmsg, int data_length)
{
spin_lock(&t->reassembly_queue_lock);
list_add_tail(&recvmsg->list, &t->reassembly_queue);
@ -300,11 +296,9 @@ static void enqueue_reassembly(struct smb_direct_transport *t,
virt_wmb();
t->reassembly_data_length += data_length;
spin_unlock(&t->reassembly_queue_lock);
}
static struct smb_direct_recvmsg *get_first_reassembly(
struct smb_direct_transport *t)
static struct smb_direct_recvmsg *get_first_reassembly(struct smb_direct_transport *t)
{
if (!list_empty(&t->reassembly_queue))
return list_first_entry(&t->reassembly_queue,
@ -423,11 +417,11 @@ static void free_transport(struct smb_direct_transport *t)
recvmsg = get_first_reassembly(t);
if (recvmsg) {
list_del(&recvmsg->list);
spin_unlock(
&t->reassembly_queue_lock);
put_recvmsg(t, recvmsg);
} else
spin_unlock(&t->reassembly_queue_lock);
put_recvmsg(t, recvmsg);
} else {
spin_unlock(&t->reassembly_queue_lock);
}
} while (recvmsg);
t->reassembly_data_length = 0;
@ -595,8 +589,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
if (atomic_read(&t->send_credits) > 0)
wake_up_interruptible(&t->wait_send_credits);
if (is_receive_credit_post_required(receive_credits,
avail_recvmsg_count))
if (is_receive_credit_post_required(receive_credits, avail_recvmsg_count))
mod_delayed_work(smb_direct_wq,
&t->post_recv_credits_work, 0);
break;
@ -681,8 +674,7 @@ static int smb_direct_read(struct ksmbd_transport *t, char *buf,
data_transfer = smb_direct_recvmsg_payload(recvmsg);
data_length = le32_to_cpu(data_transfer->data_length);
remaining_data_length =
le32_to_cpu(
data_transfer->remaining_data_length);
le32_to_cpu(data_transfer->remaining_data_length);
data_offset = le32_to_cpu(data_transfer->data_offset);
/*
@ -706,9 +698,7 @@ static int smb_direct_read(struct ksmbd_transport *t, char *buf,
}
to_copy = min_t(int, data_length - offset, to_read);
memcpy(
buf + data_read,
(char *)data_transfer + data_offset + offset,
memcpy(buf + data_read, (char *)data_transfer + data_offset + offset,
to_copy);
/* move on to the next buffer? */
@ -718,20 +708,19 @@ static int smb_direct_read(struct ksmbd_transport *t, char *buf,
* No need to lock if we are not at the
* end of the queue
*/
if (queue_length)
if (queue_length) {
list_del(&recvmsg->list);
else {
spin_lock_irq(
&st->reassembly_queue_lock);
} else {
spin_lock_irq(&st->reassembly_queue_lock);
list_del(&recvmsg->list);
spin_unlock_irq(
&st->reassembly_queue_lock);
spin_unlock_irq(&st->reassembly_queue_lock);
}
queue_removed++;
put_recvmsg(st, recvmsg);
offset = 0;
} else
} else {
offset += to_copy;
}
to_read -= to_copy;
data_read += to_copy;
@ -744,13 +733,13 @@ static int smb_direct_read(struct ksmbd_transport *t, char *buf,
spin_lock(&st->receive_credit_lock);
st->count_avail_recvmsg += queue_removed;
if (is_receive_credit_post_required(st->recv_credits,
st->count_avail_recvmsg)) {
if (is_receive_credit_post_required(st->recv_credits, st->count_avail_recvmsg)) {
spin_unlock(&st->receive_credit_lock);
mod_delayed_work(smb_direct_wq,
&st->post_recv_credits_work, 0);
} else
} else {
spin_unlock(&st->receive_credit_lock);
}
st->first_entry_offset = offset;
ksmbd_debug(RDMA,
@ -762,10 +751,8 @@ static int smb_direct_read(struct ksmbd_transport *t, char *buf,
}
ksmbd_debug(RDMA, "wait_event on more data\n");
rc = wait_event_interruptible(
st->wait_reassembly_queue,
st->reassembly_data_length >= size ||
st->status != SMB_DIRECT_CS_CONNECTED);
rc = wait_event_interruptible(st->wait_reassembly_queue,
st->reassembly_data_length >= size || st->status != SMB_DIRECT_CS_CONNECTED);
if (rc)
return -EINTR;
@ -795,9 +782,10 @@ static void smb_direct_post_recv_credits(struct work_struct *work)
if (use_free) {
use_free = 0;
continue;
} else
} else {
break;
}
}
recvmsg->type = SMB_DIRECT_MSG_DATA_TRANSFER;
recvmsg->first_segment = false;
@ -1048,8 +1036,7 @@ static int smb_direct_create_header(struct smb_direct_transport *t,
return 0;
}
static int get_sg_list(void *buf, int size,
struct scatterlist *sg_list, int nentries)
static int get_sg_list(void *buf, int size, struct scatterlist *sg_list, int nentries)
{
bool high = is_vmalloc_addr(buf);
struct page *page;
@ -1392,12 +1379,10 @@ static int smb_direct_rdma_xmit(struct smb_direct_transport *t, void *buf,
sg_free_table_chained(&msg->sgt, SG_CHUNK_SIZE);
kfree(msg);
return ret;
}
static int smb_direct_rdma_write(struct ksmbd_transport *t,
void *buf, unsigned int buflen,
u32 remote_key, u64 remote_offset,
static int smb_direct_rdma_write(struct ksmbd_transport *t, void *buf,
unsigned int buflen, u32 remote_key, u64 remote_offset,
u32 remote_len)
{
return smb_direct_rdma_xmit(SMB_DIRECT_TRANS(t), buf, buflen,
@ -1405,9 +1390,8 @@ static int smb_direct_rdma_write(struct ksmbd_transport *t,
remote_len, false);
}
static int smb_direct_rdma_read(struct ksmbd_transport *t,
void *buf, unsigned int buflen,
u32 remote_key, u64 remote_offset,
static int smb_direct_rdma_read(struct ksmbd_transport *t, void *buf,
unsigned int buflen, u32 remote_key, u64 remote_offset,
u32 remote_len)
{
return smb_direct_rdma_xmit(SMB_DIRECT_TRANS(t), buf, buflen,
@ -1505,8 +1489,7 @@ static int smb_direct_send_negotiate_response(struct smb_direct_transport *t,
resp->reserved = 0;
resp->credits_requested =
cpu_to_le16(t->send_credit_target);
resp->credits_granted = cpu_to_le16(
manage_credits_prior_sending(t));
resp->credits_granted = cpu_to_le16(manage_credits_prior_sending(t));
resp->max_readwrite_size = cpu_to_le32(t->max_rdma_rw_size);
resp->preferred_send_size = cpu_to_le32(t->max_send_size);
resp->max_receive_size = cpu_to_le32(t->max_recv_size);

View File

@ -13,8 +13,8 @@
#include "connection.h"
#include "transport_tcp.h"
#define IFACE_STATE_DOWN (1 << 0)
#define IFACE_STATE_CONFIGURED (1 << 1)
#define IFACE_STATE_DOWN BIT(0)
#define IFACE_STATE_CONFIGURED BIT(1)
struct interface {
struct task_struct *ksmbd_kthread;
@ -142,8 +142,7 @@ static unsigned int kvec_array_init(struct kvec *new, struct kvec *iov,
*
* Return: return existing or newly allocate iovec
*/
static struct kvec *get_conn_iovec(struct tcp_transport *t,
unsigned int nr_segs)
static struct kvec *get_conn_iovec(struct tcp_transport *t, unsigned int nr_segs)
{
struct kvec *new_iov;
@ -287,10 +286,8 @@ static int ksmbd_tcp_run_kthread(struct interface *iface)
* Return: on success return number of bytes read from socket,
* otherwise return error number
*/
static int ksmbd_tcp_readv(struct tcp_transport *t,
struct kvec *iov_orig,
unsigned int nr_segs,
unsigned int to_read)
static int ksmbd_tcp_readv(struct tcp_transport *t, struct kvec *iov_orig,
unsigned int nr_segs, unsigned int to_read)
{
int length = 0;
int total_read;
@ -345,9 +342,7 @@ static int ksmbd_tcp_readv(struct tcp_transport *t,
* Return: on success return number of bytes read from socket,
* otherwise return error number
*/
static int ksmbd_tcp_read(struct ksmbd_transport *t,
char *buf,
unsigned int to_read)
static int ksmbd_tcp_read(struct ksmbd_transport *t, char *buf, unsigned int to_read)
{
struct kvec iov;
@ -357,9 +352,8 @@ static int ksmbd_tcp_read(struct ksmbd_transport *t,
return ksmbd_tcp_readv(TCP_TRANS(t), &iov, 1, to_read);
}
static int ksmbd_tcp_writev(struct ksmbd_transport *t,
struct kvec *iov, int nvecs, int size,
bool need_invalidate, unsigned int remote_key)
static int ksmbd_tcp_writev(struct ksmbd_transport *t, struct kvec *iov,
int nvecs, int size, bool need_invalidate, unsigned int remote_key)
{
struct msghdr smb_msg = {.msg_flags = MSG_NOSIGNAL};
@ -523,7 +517,6 @@ static int ksmbd_netdev_event(struct notifier_block *nb, unsigned long event,
}
return NOTIFY_DONE;
}
static struct notifier_block ksmbd_netdev_notifier = {

View File

@ -26,8 +26,7 @@
*
* Return: string length after conversion
*/
static int smb_utf16_bytes(const __le16 *from,
int maxbytes,
static int smb_utf16_bytes(const __le16 *from, int maxbytes,
const struct nls_table *codepage)
{
int i;
@ -156,12 +155,8 @@ static inline int is_char_allowed(char *ch)
*
* Return: string length after conversion
*/
static int smb_from_utf16(char *to,
const __le16 *from,
int tolen,
int fromlen,
const struct nls_table *codepage,
bool mapchar)
static int smb_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
const struct nls_table *codepage, bool mapchar)
{
int i, charlen, safelen;
int outlen = 0;
@ -214,8 +209,7 @@ static int smb_from_utf16(char *to,
*
* Return: string length after conversion
*/
int
smb_strtoUTF16(__le16 *to, const char *from, int len,
int smb_strtoUTF16(__le16 *to, const char *from, int len,
const struct nls_table *codepage)
{
int charlen;
@ -272,8 +266,7 @@ smb_strtoUTF16(__le16 *to, const char *from, int len,
*
* Return: destination string buffer or error ptr
*/
char *
smb_strndup_from_utf16(const char *src, const int maxlen,
char *smb_strndup_from_utf16(const char *src, const int maxlen,
const bool is_unicode, const struct nls_table *codepage)
{
int len, ret;
@ -324,8 +317,7 @@ smb_strndup_from_utf16(const char *src, const int maxlen,
*
* Return: char length after conversion
*/
int
smbConvertToUTF16(__le16 *target, const char *source, int srclen,
int smbConvertToUTF16(__le16 *target, const char *source, int srclen,
const struct nls_table *cp, int mapchars)
{
int i, j, charlen;

View File

@ -65,11 +65,10 @@ extern const struct UniCaseRange CifsUniLowerRange[];
int smb_strtoUTF16(__le16 *to, const char *from, int len,
const struct nls_table *codepage);
char *smb_strndup_from_utf16(const char *src, const int maxlen,
const bool is_unicode,
const struct nls_table *codepage);
extern int smbConvertToUTF16(__le16 *target, const char *source, int srclen,
const bool is_unicode, const struct nls_table *codepage);
int smbConvertToUTF16(__le16 *target, const char *source, int srclen,
const struct nls_table *cp, int mapchars);
extern char *ksmbd_extract_sharename(char *treename);
char *ksmbd_extract_sharename(char *treename);
#endif
wchar_t cifs_toupper(wchar_t in);
@ -80,8 +79,7 @@ wchar_t cifs_toupper(wchar_t in);
* Returns:
* Address of the first string
*/
static inline wchar_t *
UniStrcat(wchar_t *ucs1, const wchar_t *ucs2)
static inline wchar_t *UniStrcat(wchar_t *ucs1, const wchar_t *ucs2)
{
wchar_t *anchor = ucs1; /* save a pointer to start of ucs1 */
@ -100,8 +98,7 @@ UniStrcat(wchar_t *ucs1, const wchar_t *ucs2)
* Address of first occurrence of character in string
* or NULL if the character is not in the string
*/
static inline wchar_t *
UniStrchr(const wchar_t *ucs, wchar_t uc)
static inline wchar_t *UniStrchr(const wchar_t *ucs, wchar_t uc)
{
while ((*ucs != uc) && *ucs)
ucs++;
@ -119,8 +116,7 @@ UniStrchr(const wchar_t *ucs, wchar_t uc)
* = 0: Strings are equal
* > 0: First string is greater than second
*/
static inline int
UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
static inline int UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
{
while ((*ucs1 == *ucs2) && *ucs1) {
ucs1++;
@ -132,8 +128,7 @@ UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
/*
* UniStrcpy: Copy a string
*/
static inline wchar_t *
UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
static inline wchar_t *UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
{
wchar_t *anchor = ucs1; /* save the start of result string */
@ -145,8 +140,7 @@ UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
/*
* UniStrlen: Return the length of a string (in 16 bit Unicode chars not bytes)
*/
static inline size_t
UniStrlen(const wchar_t *ucs1)
static inline size_t UniStrlen(const wchar_t *ucs1)
{
int i = 0;
@ -159,8 +153,7 @@ UniStrlen(const wchar_t *ucs1)
* UniStrnlen: Return the length (in 16 bit Unicode chars not bytes) of a
* string (length limited)
*/
static inline size_t
UniStrnlen(const wchar_t *ucs1, int maxlen)
static inline size_t UniStrnlen(const wchar_t *ucs1, int maxlen)
{
int i = 0;
@ -175,8 +168,7 @@ UniStrnlen(const wchar_t *ucs1, int maxlen)
/*
* UniStrncat: Concatenate length limited string
*/
static inline wchar_t *
UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
static inline wchar_t *UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
wchar_t *anchor = ucs1; /* save pointer to string 1 */
@ -194,8 +186,7 @@ UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
/*
* UniStrncmp: Compare length limited string
*/
static inline int
UniStrncmp(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
static inline int UniStrncmp(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
if (!n)
return 0; /* Null strings are equal */
@ -224,8 +215,7 @@ UniStrncmp_le(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
/*
* UniStrncpy: Copy length limited string with pad
*/
static inline wchar_t *
UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
static inline wchar_t *UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
wchar_t *anchor = ucs1;
@ -241,8 +231,7 @@ UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
/*
* UniStrncpy_le: Copy length limited string with pad to little-endian
*/
static inline wchar_t *
UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
static inline wchar_t *UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{
wchar_t *anchor = ucs1;
@ -262,8 +251,7 @@ UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
* Address of first match found
* NULL if no matching string is found
*/
static inline wchar_t *
UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
static inline wchar_t *UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
{
const wchar_t *anchor1 = ucs1;
const wchar_t *anchor2 = ucs2;
@ -290,8 +278,7 @@ UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
/*
* UniToupper: Convert a unicode character to upper case
*/
static inline wchar_t
UniToupper(register wchar_t uc)
static inline wchar_t UniToupper(register wchar_t uc)
{
register const struct UniCaseRange *rp;
@ -314,8 +301,7 @@ UniToupper(register wchar_t uc)
/*
* UniStrupr: Upper case a unicode string
*/
static inline __le16 *
UniStrupr(register __le16 *upin)
static inline __le16 *UniStrupr(register __le16 *upin)
{
register __le16 *up;
@ -332,8 +318,7 @@ UniStrupr(register __le16 *upin)
/*
* UniTolower: Convert a unicode character to lower case
*/
static inline wchar_t
UniTolower(register wchar_t uc)
static inline wchar_t UniTolower(register wchar_t uc)
{
register const struct UniCaseRange *rp;
@ -356,8 +341,7 @@ UniTolower(register wchar_t uc)
/*
* UniStrlwr: Lower case a unicode string
*/
static inline wchar_t *
UniStrlwr(register wchar_t *upin)
static inline wchar_t *UniStrlwr(register wchar_t *upin)
{
register wchar_t *up;

View File

@ -61,8 +61,7 @@ static void rollback_path_modification(char *filename)
}
static void ksmbd_vfs_inherit_owner(struct ksmbd_work *work,
struct inode *parent_inode,
struct inode *inode)
struct inode *parent_inode, struct inode *inode)
{
if (!test_share_config_flag(work->tcon->share_conf,
KSMBD_SHARE_FLAG_INHERIT_OWNER))
@ -72,8 +71,7 @@ static void ksmbd_vfs_inherit_owner(struct ksmbd_work *work,
}
static void ksmbd_vfs_inherit_smack(struct ksmbd_work *work,
struct dentry *dir_dentry,
struct dentry *dentry)
struct dentry *dir_dentry, struct dentry *dentry)
{
char *name, *xattr_list = NULL, *smack_buf;
int value_len, xattr_list_len;
@ -173,7 +171,6 @@ int ksmbd_vfs_query_maximal_access(struct dentry *dentry, __le32 *daccess)
return 0;
}
/**
* ksmbd_vfs_create() - vfs helper for smb create file
* @work: work
@ -182,9 +179,7 @@ int ksmbd_vfs_query_maximal_access(struct dentry *dentry, __le32 *daccess)
*
* Return: 0 on success, otherwise error
*/
int ksmbd_vfs_create(struct ksmbd_work *work,
const char *name,
umode_t mode)
int ksmbd_vfs_create(struct ksmbd_work *work, const char *name, umode_t mode)
{
struct path path;
struct dentry *dentry;
@ -220,9 +215,7 @@ int ksmbd_vfs_create(struct ksmbd_work *work,
*
* Return: 0 on success, otherwise error
*/
int ksmbd_vfs_mkdir(struct ksmbd_work *work,
const char *name,
umode_t mode)
int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode)
{
struct path path;
struct dentry *dentry;
@ -243,17 +236,16 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work,
ksmbd_vfs_inherit_owner(work, d_inode(path.dentry),
d_inode(dentry));
ksmbd_vfs_inherit_smack(work, path.dentry, dentry);
} else
} else {
ksmbd_err("mkdir(%s): creation failed (err:%d)\n", name, err);
}
done_path_create(&path, dentry);
return err;
}
static ssize_t ksmbd_vfs_getcasexattr(struct dentry *dentry,
char *attr_name,
int attr_name_len,
char **attr_value)
static ssize_t ksmbd_vfs_getcasexattr(struct dentry *dentry, char *attr_name,
int attr_name_len, char **attr_value)
{
char *name, *xattr_list = NULL;
ssize_t value_len = -ENOENT, xattr_list_len;
@ -314,9 +306,7 @@ static int ksmbd_vfs_stream_read(struct ksmbd_file *fp, char *buf, loff_t *pos,
*
* Return: 0 on success, otherwise error
*/
static int check_lock_range(struct file *filp,
loff_t start,
loff_t end,
static int check_lock_range(struct file *filp, loff_t start, loff_t end,
unsigned char type)
{
struct file_lock *flock;
@ -360,9 +350,7 @@ static int check_lock_range(struct file *filp,
*
* Return: number of read bytes on success, otherwise error
*/
int ksmbd_vfs_read(struct ksmbd_work *work,
struct ksmbd_file *fp,
size_t count,
int ksmbd_vfs_read(struct ksmbd_work *work, struct ksmbd_file *fp, size_t count,
loff_t *pos)
{
struct file *filp;
@ -483,7 +471,8 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos,
* Return: 0 on success, otherwise error
*/
int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,
char *buf, size_t count, loff_t *pos, bool sync, ssize_t *written)
char *buf, size_t count, loff_t *pos, bool sync,
ssize_t *written)
{
struct ksmbd_session *sess = work->sess;
struct file *filp;
@ -564,7 +553,7 @@ int ksmbd_vfs_getattr(struct path *path, struct kstat *stat)
*
* Return: 0 on success, otherwise error
*/
int ksmbd_vfs_fsync(struct ksmbd_work *work, uint64_t fid, uint64_t p_id)
int ksmbd_vfs_fsync(struct ksmbd_work *work, u64 fid, u64 p_id)
{
struct ksmbd_file *fp;
int err;
@ -656,8 +645,8 @@ int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name)
*
* Return: 0 on success, otherwise error
*/
int ksmbd_vfs_link(struct ksmbd_work *work,
const char *oldname, const char *newname)
int ksmbd_vfs_link(struct ksmbd_work *work, const char *oldname,
const char *newname)
{
struct path oldpath, newpath;
struct dentry *dentry;
@ -702,10 +691,8 @@ int ksmbd_vfs_link(struct ksmbd_work *work,
}
static int __ksmbd_vfs_rename(struct ksmbd_work *work,
struct dentry *src_dent_parent,
struct dentry *src_dent,
struct dentry *dst_dent_parent,
struct dentry *trap_dent,
struct dentry *src_dent_parent, struct dentry *src_dent,
struct dentry *dst_dent_parent, struct dentry *trap_dent,
char *dst_name)
{
struct dentry *dst_dent;
@ -906,8 +893,7 @@ ssize_t ksmbd_vfs_listxattr(struct dentry *dentry, char **list)
return size;
}
static ssize_t ksmbd_vfs_xattr_len(struct dentry *dentry,
char *xattr_name)
static ssize_t ksmbd_vfs_xattr_len(struct dentry *dentry, char *xattr_name)
{
return vfs_getxattr(&init_user_ns, dentry, xattr_name, NULL, 0);
}
@ -920,8 +906,7 @@ static ssize_t ksmbd_vfs_xattr_len(struct dentry *dentry,
*
* Return: read xattr value length on success, otherwise error
*/
ssize_t ksmbd_vfs_getxattr(struct dentry *dentry,
char *xattr_name,
ssize_t ksmbd_vfs_getxattr(struct dentry *dentry, char *xattr_name,
char **xattr_buf)
{
ssize_t xattr_len;
@ -955,11 +940,8 @@ ssize_t ksmbd_vfs_getxattr(struct dentry *dentry,
*
* Return: 0 on success, otherwise error
*/
int ksmbd_vfs_setxattr(struct dentry *dentry,
const char *attr_name,
const void *attr_value,
size_t attr_size,
int flags)
int ksmbd_vfs_setxattr(struct dentry *dentry, const char *attr_name,
const void *attr_value, size_t attr_size, int flags)
{
int err;
@ -987,9 +969,9 @@ void ksmbd_vfs_set_fadvise(struct file *filp, __le32 option)
if (!option || !mapping)
return;
if (option & FILE_WRITE_THROUGH_LE)
if (option & FILE_WRITE_THROUGH_LE) {
filp->f_flags |= O_SYNC;
else if (option & FILE_SEQUENTIAL_ONLY_LE) {
} else if (option & FILE_SEQUENTIAL_ONLY_LE) {
filp->f_ra.ra_pages = inode_to_bdi(mapping->host)->ra_pages * 2;
spin_lock(&filp->f_lock);
filp->f_mode &= ~FMODE_RANDOM;
@ -1021,18 +1003,15 @@ int ksmbd_vfs_readdir(struct file *file, struct ksmbd_readdir_data *rdata)
return iterate_dir(file, &rdata->ctx);
}
int ksmbd_vfs_alloc_size(struct ksmbd_work *work,
struct ksmbd_file *fp,
int ksmbd_vfs_alloc_size(struct ksmbd_work *work, struct ksmbd_file *fp,
loff_t len)
{
smb_break_all_levII_oplock(work, fp, 1);
return vfs_fallocate(fp->filp, FALLOC_FL_KEEP_SIZE, 0, len);
}
int ksmbd_vfs_zero_data(struct ksmbd_work *work,
struct ksmbd_file *fp,
loff_t off,
loff_t len)
int ksmbd_vfs_zero_data(struct ksmbd_work *work, struct ksmbd_file *fp,
loff_t off, loff_t len)
{
smb_break_all_levII_oplock(work, fp, 1);
if (fp->f_ci->m_fattr & ATTR_SPARSE_FILE_LE)
@ -1085,8 +1064,9 @@ int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,
if (extent_end != -ENXIO)
ret = (int)extent_end;
break;
} else if (extent_start >= extent_end)
} else if (extent_start >= extent_end) {
break;
}
ranges[*out_count].file_offset = cpu_to_le64(extent_start);
ranges[(*out_count)++].length =
@ -1186,12 +1166,8 @@ void ksmbd_vfs_smb2_sector_size(struct inode *inode,
}
}
static int __dir_empty(struct dir_context *ctx,
const char *name,
int namlen,
loff_t offset,
u64 ino,
unsigned int d_type)
static int __dir_empty(struct dir_context *ctx, const char *name, int namlen,
loff_t offset, u64 ino, unsigned int d_type)
{
struct ksmbd_readdir_data *buf;
@ -1227,12 +1203,8 @@ int ksmbd_vfs_empty_dir(struct ksmbd_file *fp)
return err;
}
static int __caseless_lookup(struct dir_context *ctx,
const char *name,
int namlen,
loff_t offset,
u64 ino,
unsigned int d_type)
static int __caseless_lookup(struct dir_context *ctx, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int d_type)
{
struct ksmbd_readdir_data *buf;
@ -1621,8 +1593,9 @@ int ksmbd_vfs_get_dos_attrib_xattr(struct dentry *dentry,
if (ndr_decode_dos_attr(&n, da))
err = -EINVAL;
ksmbd_free(n.data);
} else
} else {
ksmbd_debug(SMB, "failed to load dos attribute in xattr\n");
}
return err;
}
@ -1687,8 +1660,7 @@ void *ksmbd_vfs_init_kstat(char **p, struct ksmbd_kstat *ksmbd_kstat)
return info;
}
int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work,
struct dentry *dentry,
int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work, struct dentry *dentry,
struct ksmbd_kstat *ksmbd_kstat)
{
u64 time;
@ -1716,15 +1688,15 @@ int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work,
if (rc > 0) {
ksmbd_kstat->file_attributes = cpu_to_le32(da.attr);
ksmbd_kstat->create_time = da.create_time;
} else
} else {
ksmbd_debug(VFS, "fail to load dos attribute.\n");
}
}
return 0;
}
ssize_t ksmbd_vfs_casexattr_len(struct dentry *dentry,
char *attr_name,
ssize_t ksmbd_vfs_casexattr_len(struct dentry *dentry, char *attr_name,
int attr_name_len)
{
char *name, *xattr_list = NULL;
@ -1749,10 +1721,8 @@ ssize_t ksmbd_vfs_casexattr_len(struct dentry *dentry,
return value_len;
}
int ksmbd_vfs_xattr_stream_name(char *stream_name,
char **xattr_stream_name,
size_t *xattr_stream_name_size,
int s_type)
int ksmbd_vfs_xattr_stream_name(char *stream_name, char **xattr_stream_name,
size_t *xattr_stream_name_size, int s_type)
{
int stream_name_size;
char *xattr_stream_name_buf;
@ -1791,8 +1761,7 @@ int ksmbd_vfs_xattr_stream_name(char *stream_name,
}
static int ksmbd_vfs_copy_file_range(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
size_t len)
struct file *file_out, loff_t pos_out, size_t len)
{
struct inode *inode_in = file_inode(file_in);
struct inode *inode_out = file_inode(file_out);
@ -1838,13 +1807,10 @@ static int ksmbd_vfs_copy_file_range(struct file *file_in, loff_t pos_in,
}
int ksmbd_vfs_copy_file_ranges(struct ksmbd_work *work,
struct ksmbd_file *src_fp,
struct ksmbd_file *dst_fp,
struct srv_copychunk *chunks,
unsigned int chunk_count,
struct ksmbd_file *src_fp, struct ksmbd_file *dst_fp,
struct srv_copychunk *chunks, unsigned int chunk_count,
unsigned int *chunk_count_written,
unsigned int *chunk_size_written,
loff_t *total_size_written)
unsigned int *chunk_size_written, loff_t *total_size_written)
{
unsigned int i;
loff_t src_off, dst_off, src_file_size;

View File

@ -101,7 +101,6 @@ struct xattr_ntacl {
#define XATTR_NAME_SD_LEN \
(sizeof(XATTR_SECURITY_PREFIX SD_PREFIX) - 1)
/* CreateOptions */
/* Flag is set, it must not be a file , valid for directory only */
#define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001)
@ -199,8 +198,9 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode);
int ksmbd_vfs_read(struct ksmbd_work *work, struct ksmbd_file *fp,
size_t count, loff_t *pos);
int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,
char *buf, size_t count, loff_t *pos, bool sync, ssize_t *written);
int ksmbd_vfs_fsync(struct ksmbd_work *work, uint64_t fid, uint64_t p_id);
char *buf, size_t count, loff_t *pos, bool sync,
ssize_t *written);
int ksmbd_vfs_fsync(struct ksmbd_work *work, u64 fid, u64 p_id);
int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name);
int ksmbd_vfs_link(struct ksmbd_work *work,
const char *oldname, const char *newname);
@ -210,72 +210,39 @@ int ksmbd_vfs_readlink(struct path *path, char *buf, int lenp);
int ksmbd_vfs_fp_rename(struct ksmbd_work *work, struct ksmbd_file *fp,
char *newname);
int ksmbd_vfs_rename_slowpath(struct ksmbd_work *work,
char *oldname, char *newname);
int ksmbd_vfs_truncate(struct ksmbd_work *work, const char *name,
struct ksmbd_file *fp, loff_t size);
struct srv_copychunk;
int ksmbd_vfs_copy_file_ranges(struct ksmbd_work *work,
struct ksmbd_file *src_fp,
struct ksmbd_file *dst_fp,
struct srv_copychunk *chunks,
unsigned int chunk_count,
struct ksmbd_file *src_fp, struct ksmbd_file *dst_fp,
struct srv_copychunk *chunks, unsigned int chunk_count,
unsigned int *chunk_count_written,
unsigned int *chunk_size_written,
loff_t *total_size_written);
struct ksmbd_file *ksmbd_vfs_dentry_open(struct ksmbd_work *work,
const struct path *path,
int flags,
__le32 option,
int fexist);
unsigned int *chunk_size_written, loff_t *total_size_written);
ssize_t ksmbd_vfs_listxattr(struct dentry *dentry, char **list);
ssize_t ksmbd_vfs_getxattr(struct dentry *dentry,
char *xattr_name,
ssize_t ksmbd_vfs_getxattr(struct dentry *dentry, char *xattr_name,
char **xattr_buf);
ssize_t ksmbd_vfs_casexattr_len(struct dentry *dentry,
char *attr_name,
ssize_t ksmbd_vfs_casexattr_len(struct dentry *dentry, char *attr_name,
int attr_name_len);
int ksmbd_vfs_setxattr(struct dentry *dentry,
const char *attr_name,
const void *attr_value,
size_t attr_size,
int flags);
int ksmbd_vfs_fsetxattr(const char *filename,
const char *attr_name,
const void *attr_value,
size_t attr_size,
int flags);
int ksmbd_vfs_xattr_stream_name(char *stream_name,
char **xattr_stream_name,
size_t *xattr_stream_name_size,
int s_type);
int ksmbd_vfs_setxattr(struct dentry *dentry, const char *attr_name,
const void *attr_value, size_t attr_size, int flags);
int ksmbd_vfs_xattr_stream_name(char *stream_name, char **xattr_stream_name,
size_t *xattr_stream_name_size, int s_type);
int ksmbd_vfs_truncate_xattr(struct dentry *dentry, int wo_streams);
int ksmbd_vfs_remove_xattr(struct dentry *dentry, char *attr_name);
void ksmbd_vfs_xattr_free(char *xattr);
int ksmbd_vfs_kern_path(char *name, unsigned int flags, struct path *path,
bool caseless);
int ksmbd_vfs_empty_dir(struct ksmbd_file *fp);
void ksmbd_vfs_set_fadvise(struct file *filp, __le32 option);
int ksmbd_vfs_lock(struct file *filp, int cmd, struct file_lock *flock);
int ksmbd_vfs_readdir(struct file *file, struct ksmbd_readdir_data *rdata);
int ksmbd_vfs_alloc_size(struct ksmbd_work *work,
struct ksmbd_file *fp,
int ksmbd_vfs_alloc_size(struct ksmbd_work *work, struct ksmbd_file *fp,
loff_t len);
int ksmbd_vfs_zero_data(struct ksmbd_work *work,
struct ksmbd_file *fp,
loff_t off,
loff_t len);
int ksmbd_vfs_zero_data(struct ksmbd_work *work, struct ksmbd_file *fp,
loff_t off, loff_t len);
struct file_allocated_range_buffer;
int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,
struct file_allocated_range_buffer *ranges,
@ -285,15 +252,11 @@ unsigned short ksmbd_vfs_logical_sector_size(struct inode *inode);
void ksmbd_vfs_smb2_sector_size(struct inode *inode,
struct ksmbd_fs_sector_size *fs_ss);
void *ksmbd_vfs_init_kstat(char **p, struct ksmbd_kstat *ksmbd_kstat);
int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work,
struct dentry *dentry,
int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work, struct dentry *dentry,
struct ksmbd_kstat *ksmbd_kstat);
int ksmbd_vfs_posix_lock_wait(struct file_lock *flock);
int ksmbd_vfs_posix_lock_wait_timeout(struct file_lock *flock, long timeout);
void ksmbd_vfs_posix_lock_unblock(struct file_lock *flock);
int ksmbd_vfs_remove_acl_xattrs(struct dentry *dentry);
int ksmbd_vfs_remove_sd_xattrs(struct dentry *dentry);
int ksmbd_vfs_set_sd_xattr(struct ksmbd_conn *conn, struct dentry *dentry,

View File

@ -284,8 +284,7 @@ static void __ksmbd_remove_durable_fd(struct ksmbd_file *fp)
write_unlock(&global_ft.lock);
}
static void __ksmbd_remove_fd(struct ksmbd_file_table *ft,
struct ksmbd_file *fp)
static void __ksmbd_remove_fd(struct ksmbd_file_table *ft, struct ksmbd_file *fp)
{
if (!HAS_FILE_ID(fp->volatile_id))
return;
@ -299,8 +298,7 @@ static void __ksmbd_remove_fd(struct ksmbd_file_table *ft,
write_unlock(&ft->lock);
}
static void __ksmbd_close_fd(struct ksmbd_file_table *ft,
struct ksmbd_file *fp)
static void __ksmbd_close_fd(struct ksmbd_file_table *ft, struct ksmbd_file *fp)
{
struct file *filp;
@ -352,8 +350,7 @@ static struct ksmbd_file *__ksmbd_lookup_fd(struct ksmbd_file_table *ft,
return fp;
}
static void __put_fd_final(struct ksmbd_work *work,
struct ksmbd_file *fp)
static void __put_fd_final(struct ksmbd_work *work, struct ksmbd_file *fp)
{
__ksmbd_close_fd(&work->sess->file_table, fp);
atomic_dec(&work->conn->stats.open_files_count);
@ -399,8 +396,7 @@ int ksmbd_close_fd(struct ksmbd_work *work, unsigned int id)
return 0;
}
void ksmbd_fd_put(struct ksmbd_work *work,
struct ksmbd_file *fp)
void ksmbd_fd_put(struct ksmbd_work *work, struct ksmbd_file *fp)
{
if (!fp)
return;
@ -410,8 +406,7 @@ void ksmbd_fd_put(struct ksmbd_work *work,
__put_fd_final(work, fp);
}
static bool __sanity_check(struct ksmbd_tree_connect *tcon,
struct ksmbd_file *fp)
static bool __sanity_check(struct ksmbd_tree_connect *tcon, struct ksmbd_file *fp)
{
if (!fp)
return false;
@ -420,14 +415,12 @@ static bool __sanity_check(struct ksmbd_tree_connect *tcon,
return true;
}
struct ksmbd_file *ksmbd_lookup_foreign_fd(struct ksmbd_work *work,
unsigned int id)
struct ksmbd_file *ksmbd_lookup_foreign_fd(struct ksmbd_work *work, unsigned int id)
{
return __ksmbd_lookup_fd(&work->sess->file_table, id);
}
struct ksmbd_file *ksmbd_lookup_fd_fast(struct ksmbd_work *work,
unsigned int id)
struct ksmbd_file *ksmbd_lookup_fd_fast(struct ksmbd_work *work, unsigned int id)
{
struct ksmbd_file *fp = __ksmbd_lookup_fd(&work->sess->file_table, id);
@ -438,8 +431,7 @@ struct ksmbd_file *ksmbd_lookup_fd_fast(struct ksmbd_work *work,
return NULL;
}
struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work,
unsigned int id,
struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work, unsigned int id,
unsigned int pid)
{
struct ksmbd_file *fp;
@ -469,8 +461,7 @@ struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id)
return __ksmbd_lookup_fd(&global_ft, id);
}
int ksmbd_close_fd_app_id(struct ksmbd_work *work,
char *app_id)
int ksmbd_close_fd_app_id(struct ksmbd_work *work, char *app_id)
{
struct ksmbd_file *fp = NULL;
unsigned int id;
@ -513,8 +504,7 @@ struct ksmbd_file *ksmbd_lookup_fd_cguid(char *cguid)
return fp;
}
struct ksmbd_file *ksmbd_lookup_fd_filename(struct ksmbd_work *work,
char *filename)
struct ksmbd_file *ksmbd_lookup_fd_filename(struct ksmbd_work *work, char *filename)
{
struct ksmbd_file *fp = NULL;
unsigned int id;
@ -566,8 +556,7 @@ static void __open_id_set(struct ksmbd_file *fp, unsigned int id, int type)
fp->persistent_id = id;
}
static int __open_id(struct ksmbd_file_table *ft,
struct ksmbd_file *fp,
static int __open_id(struct ksmbd_file_table *ft, struct ksmbd_file *fp,
int type)
{
unsigned int id = 0;
@ -601,8 +590,7 @@ unsigned int ksmbd_open_durable_fd(struct ksmbd_file *fp)
return fp->persistent_id;
}
struct ksmbd_file *ksmbd_open_fd(struct ksmbd_work *work,
struct file *filp)
struct ksmbd_file *ksmbd_open_fd(struct ksmbd_work *work, struct file *filp)
{
struct ksmbd_file *fp;
int ret;
@ -668,10 +656,8 @@ static inline bool is_reconnectable(struct ksmbd_file *fp)
}
static int
__close_file_table_ids(struct ksmbd_file_table *ft,
struct ksmbd_tree_connect *tcon,
bool (*skip)(struct ksmbd_tree_connect *tcon,
struct ksmbd_file *fp))
__close_file_table_ids(struct ksmbd_file_table *ft, struct ksmbd_tree_connect *tcon,
bool (*skip)(struct ksmbd_tree_connect *tcon, struct ksmbd_file *fp))
{
unsigned int id;
struct ksmbd_file *fp;
@ -691,14 +677,12 @@ __close_file_table_ids(struct ksmbd_file_table *ft,
return num;
}
static bool tree_conn_fd_check(struct ksmbd_tree_connect *tcon,
struct ksmbd_file *fp)
static bool tree_conn_fd_check(struct ksmbd_tree_connect *tcon, struct ksmbd_file *fp)
{
return fp->tcon != tcon;
}
static bool session_fd_check(struct ksmbd_tree_connect *tcon,
struct ksmbd_file *fp)
static bool session_fd_check(struct ksmbd_tree_connect *tcon, struct ksmbd_file *fp)
{
if (!is_reconnectable(fp))
return false;
@ -745,8 +729,7 @@ void ksmbd_free_global_file_table(void)
ksmbd_destroy_file_table(&global_ft);
}
int ksmbd_reopen_durable_fd(struct ksmbd_work *work,
struct ksmbd_file *fp)
int ksmbd_reopen_durable_fd(struct ksmbd_work *work, struct ksmbd_file *fp)
{
if (!fp->is_durable || fp->conn || fp->tcon) {
ksmbd_err("Invalid durable fd [%p:%p]\n",

View File

@ -149,50 +149,31 @@ static inline bool ksmbd_stream_fd(struct ksmbd_file *fp)
int ksmbd_init_file_table(struct ksmbd_file_table *ft);
void ksmbd_destroy_file_table(struct ksmbd_file_table *ft);
int ksmbd_close_fd(struct ksmbd_work *work, unsigned int id);
struct ksmbd_file *ksmbd_lookup_fd_fast(struct ksmbd_work *work,
unsigned int id);
struct ksmbd_file *ksmbd_lookup_foreign_fd(struct ksmbd_work *work,
unsigned int id);
struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work,
unsigned int id,
struct ksmbd_file *ksmbd_lookup_fd_fast(struct ksmbd_work *work, unsigned int id);
struct ksmbd_file *ksmbd_lookup_foreign_fd(struct ksmbd_work *work, unsigned int id);
struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work, unsigned int id,
unsigned int pid);
void ksmbd_fd_put(struct ksmbd_work *work, struct ksmbd_file *fp);
int ksmbd_close_fd_app_id(struct ksmbd_work *work, char *app_id);
struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id);
struct ksmbd_file *ksmbd_lookup_fd_cguid(char *cguid);
struct ksmbd_file *ksmbd_lookup_fd_filename(struct ksmbd_work *work,
char *filename);
struct ksmbd_file *ksmbd_lookup_fd_filename(struct ksmbd_work *work, char *filename);
struct ksmbd_file *ksmbd_lookup_fd_inode(struct inode *inode);
unsigned int ksmbd_open_durable_fd(struct ksmbd_file *fp);
struct ksmbd_file *ksmbd_open_fd(struct ksmbd_work *work,
struct file *filp);
struct ksmbd_file *ksmbd_open_fd(struct ksmbd_work *work, struct file *filp);
void ksmbd_close_tree_conn_fds(struct ksmbd_work *work);
void ksmbd_close_session_fds(struct ksmbd_work *work);
int ksmbd_close_inode_fds(struct ksmbd_work *work, struct inode *inode);
int ksmbd_reopen_durable_fd(struct ksmbd_work *work,
struct ksmbd_file *fp);
int ksmbd_reopen_durable_fd(struct ksmbd_work *work, struct ksmbd_file *fp);
int ksmbd_init_global_file_table(void);
void ksmbd_free_global_file_table(void);
int ksmbd_file_table_flush(struct ksmbd_work *work);
void ksmbd_set_fd_limit(unsigned long limit);
/*
* INODE hash
*/
int __init ksmbd_inode_hash_init(void);
void ksmbd_release_inode_hash(void);
@ -203,11 +184,9 @@ enum KSMBD_INODE_STATUS {
};
int ksmbd_query_inode_status(struct inode *inode);
bool ksmbd_inode_pending_delete(struct ksmbd_file *fp);
void ksmbd_set_inode_pending_delete(struct ksmbd_file *fp);
void ksmbd_clear_inode_pending_delete(struct ksmbd_file *fp);
void ksmbd_fd_set_delete_on_close(struct ksmbd_file *fp,
int file_info);
#endif /* __VFS_CACHE_H__ */