Linux模块编译:找不到struct evdev成员

时间:2011-04-01 06:24:45

标签: c linux drivers evdev

所以,我正在尝试修改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

3 个答案:

答案 0 :(得分:0)

struct evdev_client __rcu *grab;

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

似乎此声明正在使struct evdev的其余部分变为乱码。这可以解释编译器无法识别client_listclient_lock等。

答案 1 :(得分:0)

问题是我使用的是错误版本的内核源代码。 2.6.38而不是2.6.35因此标题和来源不能很好地混合。

答案 2 :(得分:0)

__ rcu在include / linux / compiler.h中定义为

# define __rcu          __attribute__((noderef, address_space(4)))