#include <linux/completion.h>
#include <linux/device.h>
#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/refcount.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include "netdevsim.h"
static DEFINE_IDA(nsim_bus_dev_ids);
static LIST_HEAD(nsim_bus_dev_list);
static DEFINE_MUTEX(nsim_bus_dev_list_lock);
static bool nsim_bus_enable;
static refcount_t nsim_bus_devs;
static DECLARE_COMPLETION(nsim_bus_devs_released);
static struct nsim_bus_dev *to_nsim_bus_dev(struct device *dev)
{ … }
static ssize_t
nsim_bus_dev_numvfs_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t
nsim_bus_dev_numvfs_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static struct device_attribute nsim_bus_dev_numvfs_attr = …;
static ssize_t
new_port_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static struct device_attribute nsim_bus_dev_new_port_attr = …;
static ssize_t
del_port_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static struct device_attribute nsim_bus_dev_del_port_attr = …;
static struct attribute *nsim_bus_dev_attrs[] = …;
static const struct attribute_group nsim_bus_dev_attr_group = …;
static const struct attribute_group *nsim_bus_dev_attr_groups[] = …;
static void nsim_bus_dev_release(struct device *dev)
{ … }
static const struct device_type nsim_bus_dev_type = …;
static struct nsim_bus_dev *
nsim_bus_dev_new(unsigned int id, unsigned int port_count, unsigned int num_queues);
static ssize_t
new_device_store(const struct bus_type *bus, const char *buf, size_t count)
{ … }
static BUS_ATTR_WO(new_device);
static void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev);
static ssize_t
del_device_store(const struct bus_type *bus, const char *buf, size_t count)
{ … }
static BUS_ATTR_WO(del_device);
static ssize_t link_device_store(const struct bus_type *bus, const char *buf, size_t count)
{ … }
static BUS_ATTR_WO(link_device);
static ssize_t unlink_device_store(const struct bus_type *bus, const char *buf, size_t count)
{ … }
static BUS_ATTR_WO(unlink_device);
static struct attribute *nsim_bus_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int nsim_bus_probe(struct device *dev)
{ … }
static void nsim_bus_remove(struct device *dev)
{ … }
static int nsim_num_vf(struct device *dev)
{ … }
static const struct bus_type nsim_bus = …;
#define NSIM_BUS_DEV_MAX_VFS …
static struct nsim_bus_dev *
nsim_bus_dev_new(unsigned int id, unsigned int port_count, unsigned int num_queues)
{ … }
static void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev)
{ … }
static struct device_driver nsim_driver = …;
int nsim_bus_init(void)
{ … }
void nsim_bus_exit(void)
{ … }