#include <linux/jhash.h>
#include <linux/slab.h>
#include <linux/rwsem.h>
#include <linux/mutex.h>
#include <linux/wait.h>
#include <linux/hashtable.h>
#include <net/net_namespace.h>
#include <net/genetlink.h>
#include <linux/socket.h>
#include <linux/workqueue.h>
#include "vfs_cache.h"
#include "transport_ipc.h"
#include "server.h"
#include "smb_common.h"
#include "mgmt/user_config.h"
#include "mgmt/share_config.h"
#include "mgmt/user_session.h"
#include "mgmt/tree_connect.h"
#include "mgmt/ksmbd_ida.h"
#include "connection.h"
#include "transport_tcp.h"
#include "transport_rdma.h"
#define IPC_WAIT_TIMEOUT …
#define IPC_MSG_HASH_BITS …
static DEFINE_HASHTABLE(ipc_msg_table, IPC_MSG_HASH_BITS);
static DECLARE_RWSEM(ipc_msg_table_lock);
static DEFINE_MUTEX(startup_lock);
static DEFINE_IDA(ipc_ida);
static unsigned int ksmbd_tools_pid;
static bool ksmbd_ipc_validate_version(struct genl_info *m)
{ … }
struct ksmbd_ipc_msg { … };
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_generic_event(struct sk_buff *skb, struct genl_info *info);
static int ksmbd_ipc_heartbeat_request(void);
static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX + 1] = …;
static struct genl_ops ksmbd_genl_ops[] = …;
static struct genl_family ksmbd_genl_family = …;
static void ksmbd_nl_init_fixup(void)
{ … }
static int rpc_context_flags(struct ksmbd_session *sess)
{ … }
static void ipc_update_last_active(void)
{ … }
static struct ksmbd_ipc_msg *ipc_msg_alloc(size_t sz)
{ … }
static void ipc_msg_free(struct ksmbd_ipc_msg *msg)
{ … }
static void ipc_msg_handle_free(int handle)
{ … }
static int handle_response(int type, void *payload, size_t sz)
{ … }
static int ipc_server_config_on_startup(struct ksmbd_startup_request *req)
{ … }
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_generic_event(struct sk_buff *skb, struct genl_info *info)
{ … }
static int ipc_msg_send(struct ksmbd_ipc_msg *msg)
{ … }
static int ipc_validate_msg(struct ipc_msg_table_entry *entry)
{ … }
static void *ipc_msg_send_request(struct ksmbd_ipc_msg *msg, unsigned int handle)
{ … }
static int ksmbd_ipc_heartbeat_request(void)
{ … }
struct ksmbd_login_response *ksmbd_ipc_login_request(const char *account)
{ … }
struct ksmbd_spnego_authen_response *
ksmbd_ipc_spnego_authen_request(const char *spnego_blob, int blob_len)
{ … }
struct ksmbd_tree_connect_response *
ksmbd_ipc_tree_connect_request(struct ksmbd_session *sess,
struct ksmbd_share_config *share,
struct ksmbd_tree_connect *tree_conn,
struct sockaddr *peer_addr)
{ … }
int ksmbd_ipc_tree_disconnect_request(unsigned long long session_id,
unsigned long long connect_id)
{ … }
int ksmbd_ipc_logout_request(const char *account, int flags)
{ … }
struct ksmbd_share_config_response *
ksmbd_ipc_share_config_request(const char *name)
{ … }
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,
size_t payload_sz)
{ … }
static int __ipc_heartbeat(void)
{ … }
static void ipc_timer_heartbeat(struct work_struct *w)
{ … }
int ksmbd_ipc_id_alloc(void)
{ … }
void ksmbd_rpc_id_free(int handle)
{ … }
void ksmbd_ipc_release(void)
{ … }
void ksmbd_ipc_soft_reset(void)
{ … }
int ksmbd_ipc_init(void)
{ … }