日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

read函数头文件 window_of_property_read_string 剖析

發布時間:2025/3/15 windows 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 read函数头文件 window_of_property_read_string 剖析 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前言

今天在一個群里面看到的一個朋友提交,說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; };

總結

以上是生活随笔為你收集整理的read函数头文件 window_of_property_read_string 剖析的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 欧美韩国一区 | 亚洲激情视频网 | 国产精品一区二区性色av | 国产精品扒开腿做爽爽爽男男 | 免费a级 | 国产精品视频成人 | 久热久操 | 久久超碰av | 中文字幕永久在线视频 | 四虎免费观看 | www五月天com | 国产精品一区二区久久 | 人日人视频 | 欧美一级一区二区三区 | 一级毛毛片 | 成人欧美一区二区三区在线观看 | 欧洲精品一区二区 | 日本一级黄 | 美女视频久久久 | 播色屋| 浪潮av色| 最新地址在线观看 | 亚洲日本香蕉 | 久草热在线 | 胖女人毛片| 丝袜美腿av在线 | 国产成人精品一区二区三区在线观看 | 欧美aaa大片| 欧美丰满老妇熟乱xxxxyyy | ,国产精品国产三级国产 | 国产极品美女高潮无套在线观看 | 欧美刺激性大交 | 国产免费av一区二区 | 天堂一区在线 | 亚洲欧美日韩综合在线 | 精品久久综合 | 精品综合久久久久 | 亚洲h动漫 | 在线精品亚洲欧美日韩国产 | 污视频在线播放 | 性毛片| 中文字幕色哟哟 | 亚洲色图综合网 | 国产精品成人免费一区二区视频 | 国产大片一区二区 | 中文字幕日韩专区 | 中文在线永久免费观看 | 国产在线成人精品午夜 | 自拍偷拍第八页 | 一级片大片 | 国产亚洲黄色片 | 猫咪av网| 91在线免费看 | 中文字幕乱码人妻无码久久95 | 一级黄色片片 | 91av高清| 天天噜| 成人黄色激情小说 | 人人舔人人干 | 中国美女乱淫免费看视频 | 成人导航网站 | 成人日韩av| 天天摸夜夜添狠狠添婷婷 | 国产精品第12页 | 亚洲综合专区 | 久久男人的天堂 | 国产精品第六页 | 亚洲妇女av | 国产成人精品综合在线观看 | 亚洲天堂av网 | 国产超碰人人爽人人做人人爱 | 内射国产内射夫妻免费频道 | 日韩大片免费观看 | 亚洲欧洲中文 | 在线一区观看 | 国产精品主播 | 欧美日韩毛片 | 91免费小视频 | 男人天堂2020 | 97人妻人人揉人人躁人人 | 黄色网址在线免费看 | 18女人毛片 | 国产主播自拍av | 午夜在线一区二区 | 无码av免费精品一区二区三区 | 亚洲一区二区国产 | 国产白丝一区二区三区 | 在线麻豆 | 亚洲色图偷| 日韩欧美一区二区三区视频 | 午夜在线看片 | 好男人资源 | 色综合久久久久综合体桃花网 | 最新的黄色网址 | 毛片网止| 国产成人av一区二区三区不卡 | 久久男人 | 午夜精品久久久久久久99热黄桃 | 日本在线免费观看 |