리눅스 디바이스 드라이버 (유영창 저, 한빛미디어)에서 sysfs 예제 소스 빌드 에러

글쓴이: 익명 사용자 / 작성시간: 수, 2011/05/11 - 9:31오후
리눅스 디바이스 드라이버(유영창 저, 한빛미디어)
25장. 시스템 파일 시스템에서 (860페이지)
sysfs 예제 소스를 모듈로 빌드해보면 다음과 같은 에러가 발생합니다.
sysfs.c:41: warning: implicit declaration of function 'class_simple_create' sysfs.c:42: warning: implicit declaration of function 'class_simple_device_add' sysfs.c:56: warning: implicit declaration of function 'class_simple_device_remove' sysfs.c:57: warning: implicit declaration of function 'class_simple_destroy'
위의 함수들은 본문에서 다음과 같이 프로토타입을 정의하고 있는데
struct class_simple *class_simple_create(struct module *owner, char *name); void class_simple_destroy(struct class_simple *cs); struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...); void class_simple_device_remove(dev_t dev);
이 함수들은 책에서 정의해주지도 않았고 커널 소스에서도 찾아볼 수 없습니다.
게다가 책에 있는 예제 소스에서는 헤더파일만 인클루드시키고 있는데
#include <linux/device.h>
아래와 같이 모듈 관련 헤더파일을 추가해도 마찬가지 입니다.
#include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/device.h>
어떤 헤더 파일들을 더 추가시켜야 할까요?
Forums:
커널 2.6.13부터는 class_create,
커널 2.6.13부터는 class_create, class_destroy, class_device_create, class_device_destroy를 사용해야 합니다. 패러미터형은 조금 다릅니다. 2.6.20인가 넘어가면 class_device_create,class_device_destroy대신 device_create, device_destroy사용해야 하고요. 아주 최근건 어떤 변화가 있는지 잘 모르겠어요. 책은 예전것이고 작업하신 커널이 최신이면 그런 문제가 발생하겠죠.
댓글 달기