gpt4 book ai didi

c - Linux模块编译: struct evdev member not found

转载 作者:行者123 更新时间:2023-11-30 18:06:27 26 4
gpt4 key购买 nike

所以,我正在尝试修改 evdev.c,它是 Linux 上鼠标等输入设备的事件处理程序驱动程序。

我遇到的问题是,当我尝试编译模块时,出现大量错误,提示无法找到 evdev 的成员。

/home/mousedev_dbl.c:215: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c:216: error: ‘struct evdev’ has no member named ‘client_list’
/hom/mousedev_dbl.c:217: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c: In function ‘evdev_detach_client’:
/home/mousedev_dbl.c:224: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c:226: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c: In function ‘evdev_open_device’:
/home/mousedev_dbl.c:234: error: ‘struct evdev’ has no member named ‘mutex’
/home/mousedev_dbl.c:238: error: ‘struct evdev’ has no member named ‘exist’

这只是错误的一小部分。

evdev 的结构清楚地存在于我正在编译的 mousedev_dbl.c 文件中。

struct evdev {
int open;
int minor;
struct input_handle handle;
wait_queue_head_t wait;
struct evdev_client __rcu *grab;
struct list_head client_list;
spinlock_t client_lock; /* protects client_list */
struct mutex mutex;
struct device dev;
bool exist;
};

作为示例,以下是第 215 行的使用方式。

spin_lock(&evdev->client_lock);
list_add_tail_rcu(&client->node, &evdev->client_list);
spin_unlock(&evdev->client_lock);
synchronize_rcu();

什么会导致这些错误?整个文件可以在这里找到: http://lxr.free-electrons.com/source/drivers/input/evdev.c

最佳答案

struct evdev_client __rcu *grab;

此声明有效吗? (对我来说看起来不像,除非 __rcu 用于预处理器)。

似乎这个声明使 struct evdev 的其余部分呈现乱码。这可以解释编译器没有识别 client_listclient_lock 等。

关于c - Linux模块编译: struct evdev member not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5509863/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com