#define pr_fmt(fmt) …
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/console.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/netpoll.h>
#include <linux/inet.h>
#include <linux/configfs.h>
#include <linux/etherdevice.h>
#include <linux/utsname.h>
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#define MAX_PARAM_LENGTH …
#define MAX_USERDATA_ENTRY_LENGTH …
#define MAX_USERDATA_VALUE_LENGTH …
#define MAX_USERDATA_NAME_LENGTH …
#define MAX_USERDATA_ITEMS …
#define MAX_PRINT_CHUNK …
static char config[MAX_PARAM_LENGTH];
module_param_string(…);
MODULE_PARM_DESC(…) …;
static bool oops_only;
module_param(oops_only, bool, 0600);
MODULE_PARM_DESC(…) …;
#define NETCONSOLE_PARAM_TARGET_PREFIX …
#ifndef MODULE
static int __init option_setup(char *opt)
{ … }
__setup(…);
#endif
static LIST_HEAD(target_list);
static DEFINE_SPINLOCK(target_list_lock);
static struct console netconsole_ext;
struct netconsole_target { … };
#ifdef CONFIG_NETCONSOLE_DYNAMIC
static struct configfs_subsystem netconsole_subsys;
static DEFINE_MUTEX(dynamic_netconsole_mutex);
static int __init dynamic_netconsole_init(void)
{ … }
static void __exit dynamic_netconsole_exit(void)
{ … }
static void netconsole_target_get(struct netconsole_target *nt)
{ … }
static void netconsole_target_put(struct netconsole_target *nt)
{ … }
#else
static int __init dynamic_netconsole_init(void)
{
return 0;
}
static void __exit dynamic_netconsole_exit(void)
{
}
static void netconsole_target_get(struct netconsole_target *nt)
{
}
static void netconsole_target_put(struct netconsole_target *nt)
{
}
static void populate_configfs_item(struct netconsole_target *nt,
int cmdline_count)
{
}
#endif
static struct netconsole_target *alloc_and_init(void)
{ … }
#ifdef CONFIG_NETCONSOLE_DYNAMIC
static struct netconsole_target *to_target(struct config_item *item)
{ … }
static void trim_newline(char *s, size_t maxlen)
{ … }
static ssize_t enabled_show(struct config_item *item, char *buf)
{ … }
static ssize_t extended_show(struct config_item *item, char *buf)
{ … }
static ssize_t release_show(struct config_item *item, char *buf)
{ … }
static ssize_t dev_name_show(struct config_item *item, char *buf)
{ … }
static ssize_t local_port_show(struct config_item *item, char *buf)
{ … }
static ssize_t remote_port_show(struct config_item *item, char *buf)
{ … }
static ssize_t local_ip_show(struct config_item *item, char *buf)
{ … }
static ssize_t remote_ip_show(struct config_item *item, char *buf)
{ … }
static ssize_t local_mac_show(struct config_item *item, char *buf)
{ … }
static ssize_t remote_mac_show(struct config_item *item, char *buf)
{ … }
static ssize_t enabled_store(struct config_item *item,
const char *buf, size_t count)
{ … }
static ssize_t release_store(struct config_item *item, const char *buf,
size_t count)
{ … }
static ssize_t extended_store(struct config_item *item, const char *buf,
size_t count)
{ … }
static ssize_t dev_name_store(struct config_item *item, const char *buf,
size_t count)
{ … }
static ssize_t local_port_store(struct config_item *item, const char *buf,
size_t count)
{ … }
static ssize_t remote_port_store(struct config_item *item,
const char *buf, size_t count)
{ … }
static ssize_t local_ip_store(struct config_item *item, const char *buf,
size_t count)
{ … }
static ssize_t remote_ip_store(struct config_item *item, const char *buf,
size_t count)
{ … }
static ssize_t remote_mac_store(struct config_item *item, const char *buf,
size_t count)
{ … }
struct userdatum { … };
static struct userdatum *to_userdatum(struct config_item *item)
{ … }
struct userdata { … };
static struct userdata *to_userdata(struct config_item *item)
{ … }
static struct netconsole_target *userdata_to_target(struct userdata *ud)
{ … }
static ssize_t userdatum_value_show(struct config_item *item, char *buf)
{ … }
static void update_userdata(struct netconsole_target *nt)
{ … }
static ssize_t userdatum_value_store(struct config_item *item, const char *buf,
size_t count)
{ … }
CONFIGFS_ATTR(…);
static struct configfs_attribute *userdatum_attrs[] = …;
static void userdatum_release(struct config_item *item)
{ … }
static struct configfs_item_operations userdatum_ops = …;
static const struct config_item_type userdatum_type = …;
static struct config_item *userdatum_make_item(struct config_group *group,
const char *name)
{ … }
static void userdatum_drop(struct config_group *group, struct config_item *item)
{ … }
static struct configfs_attribute *userdata_attrs[] = …;
static struct configfs_group_operations userdata_ops = …;
static struct config_item_type userdata_type = …;
CONFIGFS_ATTR(…);
CONFIGFS_ATTR(…);
CONFIGFS_ATTR(…);
CONFIGFS_ATTR(…);
CONFIGFS_ATTR(…);
CONFIGFS_ATTR(…);
CONFIGFS_ATTR(…);
CONFIGFS_ATTR_RO(…);
CONFIGFS_ATTR(…);
CONFIGFS_ATTR(…);
static struct configfs_attribute *netconsole_target_attrs[] = …;
static void netconsole_target_release(struct config_item *item)
{ … }
static struct configfs_item_operations netconsole_target_item_ops = …;
static const struct config_item_type netconsole_target_type = …;
static void init_target_config_group(struct netconsole_target *nt,
const char *name)
{ … }
static struct netconsole_target *find_cmdline_target(const char *name)
{ … }
static struct config_group *make_netconsole_target(struct config_group *group,
const char *name)
{ … }
static void drop_netconsole_target(struct config_group *group,
struct config_item *item)
{ … }
static struct configfs_group_operations netconsole_subsys_group_ops = …;
static const struct config_item_type netconsole_subsys_type = …;
static struct configfs_subsystem netconsole_subsys = …;
static void populate_configfs_item(struct netconsole_target *nt,
int cmdline_count)
{ … }
#endif
static int netconsole_netdev_event(struct notifier_block *this,
unsigned long event, void *ptr)
{ … }
static struct notifier_block netconsole_netdev_notifier = …;
static void send_ext_msg_udp(struct netconsole_target *nt, const char *msg,
int msg_len)
{ … }
static void write_ext_msg(struct console *con, const char *msg,
unsigned int len)
{ … }
static void write_msg(struct console *con, const char *msg, unsigned int len)
{ … }
static struct netconsole_target *alloc_param_target(char *target_config,
int cmdline_count)
{ … }
static void free_param_target(struct netconsole_target *nt)
{ … }
static struct console netconsole_ext = …;
static struct console netconsole = …;
static int __init init_netconsole(void)
{ … }
static void __exit cleanup_netconsole(void)
{ … }
late_initcall(init_netconsole);
module_exit(cleanup_netconsole);