当前位置: 首页 > news >正文

设计师个人网站怎么做h5视频网站模板

设计师个人网站怎么做,h5视频网站模板,现在还有用dw做网站,会员管理系统app免费版文章目录 1. 设备管理模型2. 基本数据结构2.1 kobject2.2 kset 1. 设备管理模型 设备模型是内核提供的一个编写驱动的架构。 设备管理是设备-总线-驱动结构。 linux中的设备是由树状模型组织的#xff0c;从sysfs中可以查看树状结构。 他本身实现了#xff1a; 电源管理热… 文章目录 1. 设备管理模型2. 基本数据结构2.1 kobject2.2 kset 1. 设备管理模型 设备模型是内核提供的一个编写驱动的架构。 设备管理是设备-总线-驱动结构。 linux中的设备是由树状模型组织的从sysfs中可以查看树状结构。 他本身实现了 电源管理热插拔(hotplug)事件管理 2. 基本数据结构 kobject, kset, ueventdevice, device_driver, bus, class 2.1 kobject 许多内核对象都是由kobject作为基类派生的。相同类型的kobject通过其内嵌的list_head链成一个链表然后使用另外一个结构体kset(kobject的子类)来指向和管理这个列表。 struct kobject {const char *name;struct list_head entry;struct kobject *parent;struct kset *kset; /* 给相关的kobject分组是kobj的集合 */struct kobj_type *ktype; /* 抽象出了一些kobj和sysfs的通用接口描述kobj的行为 */struct kernfs_node *sd; /* sysfs 的文件节点 */struct kref kref; /* kobject的引用计数 */ #ifdef CONFIG_DEBUG_KOBJECT_RELEASEstruct delayed_work release; #endifunsigned int state_initialized:1;unsigned int state_in_sysfs:1;unsigned int state_add_uevent_sent:1;unsigned int state_remove_uevent_sent:1;unsigned int uevent_suppress:1; };一个新的kobject要加入到设备管理模型中需要使用函数 /* 创建新的kobj */ struct kobject * __must_check kobject_create_and_add(const char *name,struct kobject *parent); /* parent 在sysfs中的父目录如果为NULL则表示在/sys/目录下 *//* 添加已存在的的kobj */ int kobject_init_and_add(struct kobject *kobj,struct kobj_type *ktype, struct kobject *parent, const char *fmt, ...); /* fmt一般是name, 也是sysfs中kobject对应的目录名 */ 调用之前需要给kobj分配内存并初始化ktype用于这个kset中kobject的通用操作其中ktype如下 struct kobj_type {void (*release)(struct kobject *kobj); /* 必须 */const struct sysfs_ops *sysfs_ops; /* 内含show和store接口 */struct attribute **default_attrs; /* 每个属性都在sysfs中有对应的属性文件 */const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);const void *(*namespace)(struct kobject *kobj); };2.2 kset kset用于 作为一组kobject的容器是一个sysfs中的目录里面包含kset关联的kobjectkset可支持kobject的“热插拔”并影响uevent事件像用户空间的报告方式 /*** struct kset - 一个子系统中一系列kobject的集合** A kset defines a group of kobjects. They can be individually* different types but overall these kobjects all want to be grouped* together and operated on in the same manner. ksets are used to* define the attribute callbacks and other common events that happen to* a kobject.** list: the list of all kobjects for this kset* list_lock: a lock for iterating over the kobjects* kobj: the embedded kobject for this kset (recursion, isnt it fun...)* uevent_ops: the set of uevent operations for this kset. These are* called whenever a kobject has something happen to it so that the kset* can add new environment variables, or filter out the uevents if so* desired.*/ struct kset {struct list_head list;spinlock_t list_lock;struct kobject kobj;const struct kset_uevent_ops *uevent_ops; } __randomize_layout;一个组织多个kobject的kset例程节选linux/samples/kobject/kset-example.c #include linux/kobject.h #include linux/string.h #include linux/sysfs.h #include linux/slab.h #include linux/module.h #include linux/init.hMODULE_LICENSE(GPL);struct foo_obj {struct kobject kobj;int foo;int baz;int bar; }; /* 从类型为kobj的结构体成员的指针x获取该foo_obj类型结构体的指针 */ #define to_foo_obj(x) container_of(x, struct foo_obj, kobj)static void foo_release(struct kobject *kobj) {struct foo_obj *foo;foo to_foo_obj(kobj);kfree(foo); }/* 可以定义所属kset的kobject的一些行为到default_attrs和sysfs_ops属性中现在仅* 使用release */ static struct kobj_type foo_ktype {// .sysfs_ops foo_sysfs_ops,.release foo_release,// .default_attrs foo_default_attrs, };static struct kset *example_kset; static struct foo_obj *foo_obj; static struct foo_obj *bar_obj; static struct foo_obj *baz_obj; /* 创建kset下的kobject */ static struct foo_obj *create_foo_obj(const char *name) {struct foo_obj *foo;int retval;/* allocate the memory for the whole object */foo kzalloc(sizeof(*foo), GFP_KERNEL);if (!foo)return NULL;/* 初始化kobject之前先确定所属kset */foo-kobj.kset example_kset;/* 初始化kobject添加到kernel中并关联ktype会在sysfs中创建名为name的kobject文件夹* 第三个参数是父kobj由于已确定kset写为NULL */retval kobject_init_and_add(foo-kobj, foo_ktype, NULL, %s, name);if (retval) {kobject_put(foo-kobj);return NULL;}/* 通知用户空间有一个新的内核对象kobject已经被添加到 sysfs 中。* 这对于用户空间的监控和管理工具来说是很有用的 */kobject_uevent(foo-kobj, KOBJ_ADD);return foo; }static void destroy_foo_obj(struct foo_obj *foo) {kobject_put(foo-kobj); }static int __init example_init(void) {/* 创建一个名为 kset_example 的kset, 路径在/sys/kernel/ */example_kset kset_create_and_add(kset_example, NULL, kernel_kobj);if (!example_kset)return -ENOMEM;/* 在已定义的kset下新增kobject */foo_obj create_foo_obj(foo);if (!foo_obj)goto foo_error;bar_obj create_foo_obj(bar);if (!bar_obj)goto bar_error;baz_obj create_foo_obj(baz);if (!baz_obj)goto baz_error;return 0;baz_error:destroy_foo_obj(bar_obj); bar_error:destroy_foo_obj(foo_obj); foo_error:kset_unregister(example_kset);return -EINVAL; }static void __exit example_exit(void) {destroy_foo_obj(baz_obj);destroy_foo_obj(bar_obj);destroy_foo_obj(foo_obj);kset_unregister(example_kset); }MODULE_AUTHOR(LUKEKE); // 作者 MODULE_DESCRIPTION(kset test); // 描述 MODULE_ALIAS(kset Learn); // 别名module_init(example_init); module_exit(example_exit);运行结果 [rootqemu_imx6ul:/sys/kernel]# ls config irq rcu_expedited slab debug mm rcu_normal uevent_helper fscaps notes security uevent_seqnum [rootqemu_imx6ul:/sys/kernel]# insmod ~/hello.ko [rootqemu_imx6ul:/sys/kernel]# ls config irq notes security uevent_seqnum debug kset_example rcu_expedited slab fscaps mm rcu_normal uevent_helper [rootqemu_imx6ul:/sys/kernel]# cd kset_example/ [rootqemu_imx6ul:/sys/kernel/kset_example]# ls bar baz foo [rootqemu_imx6ul:/sys/kernel/kset_example]# ls bar/ [rootqemu_imx6ul:/sys/kernel/kset_example]# ls foo下一篇文sysfs
http://www.dnsts.com.cn/news/267579.html

相关文章:

  • 一下成都网站建设公司网站广告
  • 有没有a站可以打开网站建设深圳给原码
  • vs做的网站如何使用怎么注册公司名
  • 手机营销型网站制作小版本wordpress
  • 免费psd素材网站网站建设服务器租用
  • 献县城市住房建设局网站天津百度搜索排名优化
  • 找网络公司建网站的流程wordpress配置文件数据库
  • 做网站开发一般用什么语言c网站制作
  • 桂林网站建设培训网站建设总结体会
  • 汽车网站建设模板哪些网站可以做兼职设计师
  • 如何查询网站备案时间查询怎么知道一个网站的权重
  • 兴隆大院网站哪个公司做的企业网上登记注册
  • 学做网站要多久小程序开发流程步骤
  • 专门做会议的网站微信公众号推文制作软件
  • 免费印章logo在线制作360搜索优化
  • 网站备案信息登记表美食网站的设计与实现
  • 网站自己的做影视网站什么cms好用吗
  • 天津 网站设计制作公司app平台搭建需要多少钱
  • 网站备案提交网站建设的美图
  • 台州市城乡建设规划局网站it外包合同模板
  • 北京大型网站优化上海黄页固定电话查询
  • 怎么建设阿里巴巴国际网站首页网站做微信链接怎么做
  • 移动电商网站开发需求文档网站被墙 怎么做301
  • 宠物网站设计说明书顶尖的网站建设
  • 手机版网站优化外贸公司大全
  • 短视频分享网站开发网页怎么画
  • 长春学校网站建设方案咨询dw表格怎么做网站搜索
  • 盐城市城南新区建设局网站网站建设 福田
  • 网站建设属于无形资产哪一类河北省招标投标网官网
  • 地方网站类型灰色项目源码