开发者

Linux module compiling: struct evdev member not found

So, I am trying to modify evdev.c, which is an event handler driver for input devices like mouse on linux.

The problem I am having is that when I try to compile the module, I get a ton of errors saying the members of evdev cannot be found.

/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’

This is only a small portion of the errors.

The struct for evdev is clearly present in the mousedev_dbl.c files I am compiling.

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;
};

As an example, here is how it is used on line 215.

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

What would cause these errors?? The entire file can be found here: http://lxr.free-electrons.com/sourc开发者_如何学Pythone/drivers/input/evdev.c


struct evdev_client __rcu *grab;

Is this declaration valid? (Doesn't look like to me, unless __rcu is for the preprocessor).

Seems this declaration is rendering the rest of your struct evdev garbled. Which could explain the compiler not identifying the client_list, client_lock etc.


The problem was that I was using the kernel source from the wrong version. 2.6.38 rather than 2.6.35 so the headers and the source were not mixing well.


__rcu is defined in include/linux/compiler.h as

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜