#include <linux/device.h>
#include <linux/enclosure.h>
#include <linux/err.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
static LIST_HEAD(container_list);
static DEFINE_MUTEX(container_list_lock);
static struct class enclosure_class;
struct enclosure_device *enclosure_find(struct device *dev,
struct enclosure_device *start)
{ … }
EXPORT_SYMBOL_GPL(…);
int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *),
void *data)
{ … }
EXPORT_SYMBOL_GPL(…);
struct enclosure_device *
enclosure_register(struct device *dev, const char *name, int components,
struct enclosure_component_callbacks *cb)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct enclosure_component_callbacks enclosure_null_callbacks;
void enclosure_unregister(struct enclosure_device *edev)
{ … }
EXPORT_SYMBOL_GPL(…);
#define ENCLOSURE_NAME_SIZE …
#define COMPONENT_NAME_SIZE …
static void enclosure_link_name(struct enclosure_component *cdev, char *name)
{ … }
static void enclosure_remove_links(struct enclosure_component *cdev)
{ … }
static int enclosure_add_links(struct enclosure_component *cdev)
{ … }
static void enclosure_release(struct device *cdev)
{ … }
static void enclosure_component_release(struct device *dev)
{ … }
static struct enclosure_component *
enclosure_component_find_by_name(struct enclosure_device *edev,
const char *name)
{ … }
static const struct attribute_group *enclosure_component_groups[];
struct enclosure_component *
enclosure_component_alloc(struct enclosure_device *edev,
unsigned int number,
enum enclosure_component_type type,
const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
int enclosure_component_register(struct enclosure_component *ecomp)
{ … }
EXPORT_SYMBOL_GPL(…);
int enclosure_add_device(struct enclosure_device *edev, int component,
struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
int enclosure_remove_device(struct enclosure_device *edev, struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
static ssize_t components_show(struct device *cdev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(components);
static ssize_t id_show(struct device *cdev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(id);
static struct attribute *enclosure_class_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static struct class enclosure_class = …;
static const char *const enclosure_status[] = …;
static const char *const enclosure_type[] = …;
static ssize_t get_component_fault(struct device *cdev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t set_component_fault(struct device *cdev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t get_component_status(struct device *cdev,
struct device_attribute *attr,char *buf)
{ … }
static ssize_t set_component_status(struct device *cdev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t get_component_active(struct device *cdev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t set_component_active(struct device *cdev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t get_component_locate(struct device *cdev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t set_component_locate(struct device *cdev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t get_component_power_status(struct device *cdev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t set_component_power_status(struct device *cdev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t get_component_type(struct device *cdev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t get_component_slot(struct device *cdev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault,
set_component_fault);
static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, get_component_status,
set_component_status);
static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active,
set_component_active);
static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate,
set_component_locate);
static DEVICE_ATTR(power_status, S_IRUGO | S_IWUSR, get_component_power_status,
set_component_power_status);
static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL);
static DEVICE_ATTR(slot, S_IRUGO, get_component_slot, NULL);
static struct attribute *enclosure_component_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int __init enclosure_init(void)
{ … }
static void __exit enclosure_exit(void)
{ … }
module_init(…) …;
module_exit(enclosure_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;