Linux模块编译:struct evdev没有找到成员
问题描述:
所以,我试图修改evdev.c,这是一个输入设备的事件处理程序驱动程序,如Linux上的鼠标。Linux模块编译:struct evdev没有找到成员
我遇到的问题是,当我尝试编译模块时,出现大量错误,指出找不到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
答
问题是,我使用的是错误版本的内核源代码。 2.6.38而不是2.6.35,所以标题和源文件混合不好。
答
struct evdev_client __rcu *grab;
这是声明是否有效? (看起来不像我,除非__rcu用于预处理器)。
似乎这个声明是渲染你的其余struct evdev
乱码。这可以解释编译器不识别client_list
,client_lock
等
哪一款是您的操作系统?如果是Ubuntu,你可以试试'apt-get build-dep',然后'apt-get source -b ',他们会照顾包编译所需的所有东西 –
sashoalm
2011-04-01 06:34:25
使用ubuntu,但不是在谈论软件包。我有我需要在/ usr/include/linux下编译的所有东西。问题是编译器似乎没有找到位于我希望编译的文件中的结构成员。 – user623879 2011-04-01 06:42:29
你是如何获得源代码的? – sashoalm 2011-04-01 07:03:44