linux scsi子系统 ----相关数据结构在内存中的联系

简单记录,不是标准类图,只是为了将相关数据结构联系起来

首先是基本的设备——总线——驱动模型
bus_subsys_private和class_subsys_private指的都是内核中的subsys_private,但为了区分所以分开表示

device
p
class
p
knode_class/klist_devices
knode_bus/klist_devices
driver
p
knode_bus/klist_drivers
driver
knode_driver/klist_devices
p
bus
class
device
struct device *parent;
struct device_private *p;
struct kobject kobj;
const char *init_name;
const struct device_type *type;
struct bus_type *bus;
struct device_driver *driver;
struct klist_node knode_class;
struct class *class;
device_private
struct klist klist_children;
struct klist_node knode_parent;
struct klist_node knode_driver;
struct klist_node knode_bus;
struct list_head deferred_probe;
struct device *device;
u8 dead:1;
bus_type
const char *name;
struct subsys_private *p;
Class
const char *name;
struct subsys_private *p;
bus_subsys_private
struct bus_type *bus;
struct klist klist_devices;
struct klist klist_drivers;
struct class *class;
class_subsys_private
struct bus_type *bus;
struct klist klist_devices;
struct klist klist_drivers;
struct class *class;
device_driver
struct bus_type *bus;
struct driver_private *p;
driver_private
struct klist klist_devices;
struct klist_node knode_bus;
struct device_driver *driver;

下图截取自《存储技术原理》
在这里插入图片描述

接下来是scsi相关数据结构的关系

device_type
class
bus
hostt
shost_gendev
shost_dev
parent
sdev_gendev
sdev_dev
dev
silbings/__targets
silbings/__devices
same_target_siblings/devices
parent
bus
bus
parent
parent
device
driver
disk
parent
dev
device0
device1
device2
device3
device4
device5
scsi_bus_type
.name = "scsi",
.match = scsi_bus_match,
shost_class
.name = "scsi_host",
.dev_release = scsi_host_cls_release,
scsi_host_type
.name = "scsi_host",
.release = scsi_host_dev_release,
scsi_host_template
Scsi_Host
struct list_head __devices;
struct list_head __targets;
struct scsi_host_template *hostt;
unsigned int host_no;
struct device shost_gendev;
struct device shost_dev;
unsigned long hostdata[0];
scsi_device
struct Scsi_Host *host;
struct list_head siblings;
struct list_head same_target_siblings;
void *hostdata;
struct device sdev_gendev,
struct device sdev_dev;
scsi_target
struct list_head siblings;
struct list_head devices;
struct device dev;
void *hostdata;
scsi_disk
struct scsi_driver *driver;
struct scsi_device *device;
struct device dev;
struct gendisk *disk;
g_sd_template
gendisk

下图截取自《存储技术原理》
在这里插入图片描述

  • 8
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值