#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/errno.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/ipmi.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/compat.h>
struct ipmi_file_private
{ … };
static void file_receive_handler(struct ipmi_recv_msg *msg,
void *handler_data)
{ … }
static __poll_t ipmi_poll(struct file *file, poll_table *wait)
{ … }
static int ipmi_fasync(int fd, struct file *file, int on)
{ … }
static const struct ipmi_user_hndl ipmi_hndlrs = …;
static int ipmi_open(struct inode *inode, struct file *file)
{ … }
static int ipmi_release(struct inode *inode, struct file *file)
{ … }
static int handle_send_req(struct ipmi_user *user,
struct ipmi_req *req,
int retries,
unsigned int retry_time_ms)
{ … }
static int handle_recv(struct ipmi_file_private *priv,
bool trunc, struct ipmi_recv *rsp,
int (*copyout)(struct ipmi_recv *, void __user *),
void __user *to)
{ … }
static int copyout_recv(struct ipmi_recv *rsp, void __user *to)
{ … }
static long ipmi_ioctl(struct file *file,
unsigned int cmd,
unsigned long data)
{ … }
#ifdef CONFIG_COMPAT
#define COMPAT_IPMICTL_SEND_COMMAND …
#define COMPAT_IPMICTL_SEND_COMMAND_SETTIME …
#define COMPAT_IPMICTL_RECEIVE_MSG …
#define COMPAT_IPMICTL_RECEIVE_MSG_TRUNC …
struct compat_ipmi_msg { … };
struct compat_ipmi_req { … };
struct compat_ipmi_recv { … };
struct compat_ipmi_req_settime { … };
static void get_compat_ipmi_msg(struct ipmi_msg *p64,
struct compat_ipmi_msg *p32)
{ … }
static void get_compat_ipmi_req(struct ipmi_req *p64,
struct compat_ipmi_req *p32)
{ … }
static void get_compat_ipmi_req_settime(struct ipmi_req_settime *p64,
struct compat_ipmi_req_settime *p32)
{ … }
static void get_compat_ipmi_recv(struct ipmi_recv *p64,
struct compat_ipmi_recv *p32)
{ … }
static int copyout_recv32(struct ipmi_recv *p64, void __user *to)
{ … }
static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
unsigned long arg)
{ … }
#endif
static const struct file_operations ipmi_fops = …;
#define DEVICE_NAME …
static int ipmi_major;
module_param(ipmi_major, int, 0);
MODULE_PARM_DESC(…) …;
struct ipmi_reg_list { … };
static LIST_HEAD(reg_list);
static DEFINE_MUTEX(reg_list_mutex);
static const struct class ipmi_class = …;
static void ipmi_new_smi(int if_num, struct device *device)
{ … }
static void ipmi_smi_gone(int if_num)
{ … }
static struct ipmi_smi_watcher smi_watcher = …;
static int __init init_ipmi_devintf(void)
{ … }
module_init(…) …;
static void __exit cleanup_ipmi(void)
{ … }
module_exit(cleanup_ipmi);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;