#include <linux/module.h>
#include <linux/string.h>
#include <linux/raid_class.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
struct raid_function_template *f;
struct device_attribute private_attrs[RAID_NUM_ATTRS];
struct device_attribute *attrs[RAID_NUM_ATTRS + 1];
#define to_raid_internal(tmpl) container_of(tmpl, struct raid_internal, r)
#define tc_to_raid_internal(tcont) ({ \
struct raid_template *r = \
container_of(tcont, struct raid_template, raid_attrs); \
#define ac_to_raid_internal(acont) ({ \
struct transport_container *tc = \
container_of(acont, struct transport_container, ac); \
tc_to_raid_internal(tc); \
#define device_to_raid_internal(dev) ({ \
struct attribute_container *ac = \
attribute_container_classdev_to_container(dev); \
ac_to_raid_internal(ac); \
static int raid_match(struct attribute_container *cont, struct device *dev)
struct raid_internal *i = ac_to_raid_internal(cont);
if (IS_ENABLED(CONFIG_SCSI) && scsi_is_sdev_device(dev)) {
struct scsi_device *sdev = to_scsi_device(dev);
if (i->f->cookie != sdev->host->hostt)
return i->f->is_raid(dev);
static int raid_setup(struct transport_container *tc, struct device *dev,
BUG_ON(dev_get_drvdata(cdev));
rd = kzalloc(sizeof(*rd), GFP_KERNEL);
INIT_LIST_HEAD(&rd->component_list);
dev_set_drvdata(cdev, rd);