【发布时间】:2020-12-10 19:13:07
【问题描述】:
在linux/fs.h我发现了奇怪的结构file_operations:
struct file_operations fops = {
read: device_read,
write: device_write,
open: device_open,
release: device_release
};
我的问题是这种给予价值的名称是什么?
【问题讨论】:
-
请假设我正在使用屏幕阅读器并尝试回答您的问题。你能看出问题吗?
-
请不要用图片,写代码。顺便说一句,你在哪里找到它?因为github.com/torvalds/linux/blob/master/include/linux/fs.h#L3397
-
这是一个初始化,结构体字段是指向函数的指针,形式是它们的初始化
-
而那些奇怪的东西被称为函数指针。
-
这能回答你的问题吗? ":" (colon) in C struct - what does it mean?。其中一个answers 描述了完全您的示例。