这个符号 defined/generated 在内核源代码中的什么地方?
Where is this symbol defined/generated in the kernel source?
在 drivers/base/firmware_class.c 中,这个结构中有一个对 dev_attr_loading
的引用:
static struct attribute *fw_dev_attrs[] = {
&dev_attr_loading.attr,
NULL
};
在哪里可以定义或生成该符号?它似乎不在源代码树或生成的文件中的任何位置。我似乎也找不到构建它的宏。我在想更多的地方或方式。
它实际上在同一个文件中。它是由宏创建的:
static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);
宏定义在include/linux/device.h:
#define DEVICE_ATTR(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
“_name”让我进入了搜索;我没有意识到下划线可以这样用在宏中。
在 drivers/base/firmware_class.c 中,这个结构中有一个对 dev_attr_loading
的引用:
static struct attribute *fw_dev_attrs[] = {
&dev_attr_loading.attr,
NULL
};
在哪里可以定义或生成该符号?它似乎不在源代码树或生成的文件中的任何位置。我似乎也找不到构建它的宏。我在想更多的地方或方式。
它实际上在同一个文件中。它是由宏创建的:
static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);
宏定义在include/linux/device.h:
#define DEVICE_ATTR(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
“_name”让我进入了搜索;我没有意识到下划线可以这样用在宏中。