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

网站添加icp备案号做网站建设推荐

网站添加icp备案号,做网站建设推荐,网站建站工作室,网站代码开发定制前言今天在一个群里面看到的一个朋友提交#xff0c;说of_property_read_string 这个函数有两个定义#xff0c;到底是用了哪个呢#xff1f;所以这篇文章就说下这个函数。函数引用的头文件引用的头文件位置在kernel-4.4includelinuxof.h其中一个是extern int of_property_r…前言今天在一个群里面看到的一个朋友提交说of_property_read_string 这个函数有两个定义到底是用了哪个呢所以这篇文章就说下这个函数。函数引用的头文件引用的头文件位置在kernel-4.4includelinuxof.h其中一个是extern int of_property_read_string(struct device_node *np,const char *propname,const char **out_string);还有一个是static inline int of_property_read_string(struct device_node *np,const char *propname,const char **out_string) {return -ENOSYS; }但是并不是两个都用到他们用了一个宏 CONFIG_OF 来选择CONFIG_OF 宏有什么用这个宏的解释是Open Firmware. This was invented long time ago when Apple was producing laptops based on PowerPC CPUs. Openfirmware provides a good description of the devices connected to the platform. In Linux kernel the part that works with device data is called Device Tree (DT). More details in theUsage model.他的作用是Openfirmware provides a good description of the devices connected to the platform他提供了一种更好的方式来连接设备和驱动。他是名字是called Device Tree (DT)DTS那很明显了开了这个宏就表示使用了DTS设备树的方式来连接设备和驱动程序。of_property_read_string 函数本体函数位置./drivers/of/base.c函数原型/*** of_property_read_string - Find and read a string from a property* np: device node from which the property value is to be read.* propname: name of the property to be searched.* out_string: pointer to null terminated return string, modified only if* return value is 0.** Search for a property in a device tree node and retrieve a null* terminated string value (pointer to data, not a copy). Returns 0 on* success, -EINVAL if the property does not exist, -ENODATA if property* does not have a value, and -EILSEQ if the string is not null-terminated* within the length of the property data.** The out_string pointer is modified only if a valid string can be decoded.*/ int of_property_read_string(struct device_node *np, const char *propname,const char **out_string) {struct property *prop of_find_property(np, propname, NULL);if (!prop)return -EINVAL;if (!prop-value)return -ENODATA;if (strnlen(prop-value, prop-length) prop-length)return -EILSEQ;*out_string prop-value;return 0; } EXPORT_SYMBOL_GPL(of_property_read_string);函数的作用返回propname对应dts节点对应的值。使用方式传入np就是设备树的节点然后返回 clock-output-names 字符串对应的值存入clk_name 里面。of_property_read_string 函数剖析int of_property_read_string(struct device_node *np, const char *propname,const char **out_string) {struct property *prop of_find_property(np, propname, NULL);if (!prop)return -EINVAL;if (!prop-value)return -ENODATA;if (strnlen(prop-value, prop-length) prop-length)return -EILSEQ;*out_string prop-value;return 0; } EXPORT_SYMBOL_GPL(of_property_read_string);of_find_property 这个是找到这个dts节点怎么找可以再去这个函数分析一下。strnlen功能「获取字符串实际字符个数不包括结尾的0如果实际个数 第二个参数则返回字符串实际字符个数否则返回第二个参数。」prop-length 是之前预设的一个值strnlen正常情况返回的就是字符串的长度 减1「去掉n字符」。*out_string prop-value 这里就是二级指针起到作用了没有重新分配内存直接把指针指向字符串位置。我们再看看prop 的结构体就一目了然了。struct property {char *name;int length;void *value;struct property *next;unsigned long _flags;unsigned int unique_id;struct bin_attribute attr; };
http://www.sadfv.cn/news/265298/

相关文章:

  • 沈阳做网站优化西安比较好的网络公司
  • asp艺术学校网站源码中铁建设集团有限公司电话
  • 郴州网站制作公司招聘qq小程序下载
  • 淘宝网站开始怎么做深圳网站建设设计公司
  • python django 做 网站百度推广优化师是什么
  • 在哪个网站上做预收款报告专业免费网站建设一般多少钱
  • 做网站临沂网站建设属于技术服务吗
  • 高端家装修公司站内关键词自然排名优化
  • 域名企业备案对网站的好处襄阳网站seo诊断
  • 郑州网站网站建设百度seo排名优化系统
  • wordpress做过的大型网站wordpress seo 链接
  • 网站文件夹名称淘宝运营视频教程全集
  • 教育行业展示网站模板昆山规模的网站建设公司有哪些
  • 瓦房店网站制作网站维护得多久
  • 网站推广软件下拉管家吉林刷关键词排名优化软件
  • 爱站工具包企业运营的五大系统
  • 郑州网站建设郑州网络推广沈阳网页设计专业
  • 网站建设合同是否交纳印花税wordpress企业主题制作
  • 做seo排名好的网站wordpress登录原理
  • 别人在百度冒用公司旗号做网站网站seo分析常用的工具是
  • 北京西站出站口美团网站除佣金表格怎么做
  • 手机端h5网站模板下载营销咨询师招聘
  • 常州企业家坠楼公司发讣告后删除网站运营优化
  • 网站开发建设需多少钱英文版wordpress安装
  • 做产品网站淘宝百度宝安品牌网站建设
  • 珠宝首饰商城网站建设最好的国际贸易网站
  • 天保建设集团有限公司网站wordpress简繁转换
  • 《网站建设 补充合同中国建设银行上海分行信息网站
  • 怎么在网站后面制作官网俩个字wordpress 爆破
  • 网站用户建设的设计与实现成都白帽优化