Linux Device Model

to be continued ....

digraph Device_Model 
{
graph [rankdir = "LR", bgcolor = "white:lightblue", style="filled", gradientangle = 270];

node [fontsize = "16", shape = "ellipse", style="filled", gradientangle=90];

edge [];


/*
   The kobject introduces basic object properties.
   In sysfs, kobjects are the individual directories in the filesystem.
*/
"kobject" [
label = "<struct>struct kobject | 
    name | ... | 
    <entry>list_head entry |
    <parent>kobject *parent |
    <kset>kset *kset| 
    <ktype>kobj_type *ktype |
    <sd>sysfs_dirent *sd|
    <kref>kref kref | ... 
"
shape = "record"
gradientangle="90"
fillcolor = "yellow:green;0.1" 
];

"kobject2" [
label = "<struct>struct kobject | 
    name | ... | 
    <entry>list_head entry |
    <parent>kobject *parent |
    <kset>kset *kset| 
    <ktype>kobj_type *ktype |
    <sd>sysfs_dirent *sd|
    <kref>kref kref | ... 
"
shape = "record"
gradientangle="90"
fillcolor = "yellow:green;0.1" 
];

/*
  the building block of sysfs hierarchy. Each and every sysfs node is represented by single sysfs_dirent.
*/
"sysfs_dirent" [
label = "<struct>struct sysfs_dirent | 
    s_name |
    <s_parent>sysfs_dirent *s_parent | 
    <s_sibling>sysfs_dirent *s_sibling |
    { | {sysfs_elem_dir s_dir | sysfs_elem_symlink s_symlink | sysfs_elem_attr s_attr | sysfs_elem_bin_attr s_bin_attr }} |
    <s_flags>unsigned int s_flags| 
    <s_mode>unsigned short s_mode |
    <s_ino>ino_t s_ino|
    <s_iattr>sysfs_inode_attrs *s_iattr| ... 
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.08" 
];

/*
  kobj_type describes default behavior for a family of kobjects. Kobjects of the same "type" point at the same ktype structure, thus sharing the same behavior.
*/
"kobj_type" [
label = "<struct>struct kobj_type | 
    release() |
    <sysfs_ops>sysfs_ops *sysfs_ops | 
    <default_attrs>attribute **default_attrs
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.24" 
];

/*
  struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
  Ksets group related kernel objects together, whereas ktypes enable kernel objects(functionally related or not) to share common operations. The distinction is kept to allow kobjects of identical ktypes to be grouped into different ksets.
  kobj is a kobject representing the base classs for this set.
*/
"kset" [
label = "<struct>struct kset | 
    <list>list_head list |
    <list_lock>spinlock_t list_lock |
    <kobj>kobject kobj |
    <uevent_ops>kset_uevent_ops *uevent_ops
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.2" 
];


"sysfs_ops" [
label = "<struct>struct sysfs_ops | 
    show() |
    store()
"
shape = "record"
gradientangle="90"
fillcolor = "yellow:green;0.33" 
];

"attribute" [
label = "<struct>struct attribute | 
    name |
    module *owner |
    mode_t mode
"
shape = "record"
gradientangle="90"
fillcolor = "yellow:green;0.26" 
];

//"kobject" : parent -> "kobject" : struct[taillabel=parent, style=dashed]
"kobject" : parent -> "kset" : kobj[taillabel="parent\/sysfs", color=green]
"kobject" : sd -> "sysfs_dirent" : struct
"kobject" : ktype -> "kobj_type" : struct
"kobject" : kset -> "kset" : struct
"kobj_type" : sysfs_ops -> "sysfs_ops" : struct
"kobj_type" : default_attrs -> "attribute" : struct
"sysfs_dirent" : s_parent -> "sysfs_dirent" : struct [taillabel=parent, style=dashed]
"sysfs_dirent" : s_sibling -> "sysfs_dirent" : struct [taillabel=sibling, style=dashed]
//"kset" : list -> "kobject" : struct [style=dashed]
//"kset" : kobj -> "kobject" : struct [style=dashed]
"kset" : list -> "kobject" : entry [style=dashed, dir=both, color=red]
"kobject2" : entry -> "kobject" : entry [style=dashed, dir=both, color=red]
"kset" : list -> "kobject2" : entry [style=dashed, dir=both, color=red]
}


digraph Bus 
{
graph [rankdir = "LR", bgcolor = "white:lightblue", style="filled", gradientangle = 270];

node [fontsize = "16", shape = "ellipse", style="filled", gradientangle=90];

edge [];

"bus_type" [
label = "<struct>struct bus_type | 
    name |
    <bus_attrs>bus_attribute *bus_attrs |
    <dev_attrs>device_attribute *dev_attrs |
    <drv_attrs>driver_attribute *drv_attrs| 
    match() |
    uevent()|
    probe() | 
    remove() |
    shutdown() |
    suspend() |
    resume() |
    <pm>dev_pm_ops *pm |
    <p>bus_type_private *p 
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.07" 
];

"bus_type_private" [
label = "<struct>struct bus_type_private | 
    <subsys>kset subsys |
    <drivers_kset>kset *drivers_kset | 
    <devices_kset>kset *devices_kset |
    <klist_devices>klist klist_devices |
    <klist_drivers>klist klist_drivers |
    <bus_notifier>blocking_notifier_head bus_notifier |
    <drivers_autoprobe>drivers_autoprobe:1 |
    <bus>bus_type *bus 
"
shape = "record"
gradientangle="90"
fillcolor = "yellow:green;0.11" 
];

"kset" [
label = "<struct>struct kset | 
    <list>list_head list |
    <list_lock>spinlock_t list_lock |
    <kobj>kobject kobj |
    <uevent_ops>kset_uevent_ops *uevent_ops
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.2" 
];

"klist" [
label = "<struct>struct klist | 
    spinlock_t k_lock |
    <k_list>list_head k_list |
    get() |
    put()
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.2" 
];

"klist_node" [
label = "<struct>struct klist_node | 
    void *n_klist |
    <k_list>list_head k_list |
    list_head n_node |
    kref n_ref
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.2" 
];

"device" [
label = "<struct>struct device | 
    <parent>device *parent |
    <p>device_private *p |
    <kobj>kobject kobj |
    const char *init_name |
    <type>device_type *type |
    <bus>bus_type *bus |
    <driver>device_driver *driver | ...|
    <knode_class>klist_node knode_class |
    <class>class *class |
    release() | ...
"
shape = "record"
gradientangle="90"
fillcolor = "yellow:green;0.08" 
];

"device_private" [
label = "<struct>struct device_private | 
    <klist_children>klist klist_children |
    <knode_parent>klist_node knode_parent |
    <knode_driver>klist_node knode_driver |
    <knode_bus>klist_node knode_bus |
    void *driver_data |
    <device>device *device
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.14" 
];

"driver_private" [
label = "<struct>struct driver_private | 
    <kobj>kobject kobj |
    <klist_devices>klist klist_devices |
    <knode_bus>klist_node knode_bus |
    <mkobj>module_kobject *mkobj |
    <driver>device_driver *driver
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.16" 
];

"class_private" [
label = "<struct>struct class_private | 
    <class_subsys>kset class_subsys |
    <class_devices>klist class_devices |
    <class_interfaces>list_head class_interfaces |
    <class_dirs>kset class_dirs |
    <class_mutex>mutex class_mutex |
    <class>class *class
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.145" 
];

"class" [
label = "<struct>struct class | 
    const char *name |
    module *owner |
    <class_attrs>class_attribute *class_attrs |
    <dev_attrs>device_attribute *dev_attrs |
    <dev_kobj>kobject *dev_kobj |
    dev_uevent() |
    devnode() |
    class_release() |
    dev_release() |
    suspend() |
    resume() |    
    <pm>dev_pm_ops *pm |
    <p>class_private *p
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.07" 
];

"device_type" [
label = "<struct>struct device_type | 
    const char *name |
    <groups>attribute_group **groups |
    uevent() |
    devnode() |
    release() |
    <pm>dev_pm_ops *pm
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.14" 
];

"device_driver" [
label = "<struct>struct device_driver | 
    const char *name |
    <bus>bus_type *bus |
    module *owner |
    const char *mod_name |
    bool suppress_bind_attrs |
    probe() |
    remove() |
    shutdown() |
    suspend() |
    resume() |
    <groups>attribute_group **groups |
    <pm>dev_pm_ops *pm |
    <p>driver_private *p
"
shape = "record"
gradientangle="90"
fillcolor = "pink:green;0.07" 
];

"bus_type" : p -> "bus_type_private" : struct
"bus_type_private" : bus -> "bus_type" : struct
"bus_type_private" : subsys -> "kset" : struct
"bus_type_private" : drivers_kset -> "kset" : struct
"bus_type_private" : devices_kset -> "kset" : struct
"bus_type_private" : klist_devices -> "klist" : struct
"bus_type_private" : klist_drivers -> "klist" : struct

"device" : bus -> "bus_type" : struct
"device" : knode_class -> "klist_node" : struct [style=dashed]
"device" : parent -> "device" : struct [style=dashed]
"device" : p -> "device_private" : struct
"device" : type -> "device_type" : struct
"device" : driver -> "device_driver" : struct
"device" : class -> "class" : struct
"device_private" : device -> "device" : struct
"device_driver" : bus -> "bus_type" : struct
"device_driver" : p -> "driver_private" : struct
"device_driver" : knode_bus -> "klist_node" : struct [style=dashed]
"class" : p -> "class_private" : struct
"class_private" : class -> "class" : struct

} 




References:

http://www.cnblogs.com/xiaojiang1025/p/6193959.html





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值