因此,我正在尝试修改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’这只是错误的一小部分。
我正在编译的mousedev_dbl.c文件中清楚地显示了evdev的结构。
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
发布于 2011-04-03 04:46:14
问题是我使用了错误版本的内核源代码。2.6.38而不是2.6.35,因此头文件和源文件不能很好地混合。
发布于 2011-04-01 20:02:19
struct evdev_client __rcu *grab;这个声明有效吗?(在我看来不像,除非__rcu是用于预处理器的)。
看起来这个声明让你剩下的struct evdev变得乱码了。这可以解释编译器没有识别client_list、client_lock等。
发布于 2018-09-28 16:49:21
在include/linux/ __rcu中,编译器被定义为
# define __rcu __attribute__((noderef, address_space(4)))https://stackoverflow.com/questions/5509863
复制相似问题