missing __KERNEL__ ifdef in include/linux/device.h]
PATCH 1/1 missing __KERNEL__ ifdef in include/linux/device.h]
Hello
device.h should be protected with __KERNEL__ because it uses __KERNEL__ protected structures. Userspace applications including if_arp.h such as iproute2 will fail because it finally includes device.h as well.
- thomas
Index: include/linux/device.h
===================================================================
RCS file: /cvs/tgr/linux-25/include/linux/device.h,v retrieving revision 1.1.1.2
linux/device.h +1 -1
@@ -8,7 +8,7 @@* See Documentation/driver-model/ for more information. */ -#ifndef _DEVICE_H_ +#if defined __KERNEL__ && !defined _DEVICE_H_#define _DEVICE_H_#include <linux/config.h>
Quoted 11 lines · Jeff Garzik
Date: Sun, 20 Jul 2003 04:55:29 +0200
From: Thomas Graf <[email protected]>
Subject: [PATCH] missing__KERNEL__ifdef ininclude/linux/device.h
To: [email protected]Hello
device.hshould be protected with__KERNEL__because it uses__KERNEL__protected structures. Userspace applications includingif_arp.hsuch as iproute2 will fail because it finally includesdevice.has well.
This is b0rked. People shouldn't include kernel headers from userspace for one thing, and if you want to share a single copy of a header for userspace and kernelspace you have to take of the ifdefs yourself if including kernel-only headers such as device.h
Quoted 1 line · Jeff Garzik
Subject: [PATCH] missing
__KERNEL__ifdef ininclude/linux/device.h
Ick, I don't want to see the "No kernel headers in userspace programs" thread again.
So don't do it, device.h doesn't need to be changed.
thanks,
greg k-h