From 403272766af81b724e53c835565ba43694fd9814 Mon Sep 17 00:00:00 2001 From: Robert Love Date: Thu, 26 Jan 2006 21:55:11 +0000 Subject: [PATCH] 2006-01-26 Robert Love * src/Makefile.am, src/kernel-types.h: Now that two different source files are feeling the crack-addled leakage of kernel types such as u32 and s8 -- superior to __u64 and __u8, to be sure, but not valid types in user-space -- define a header and include it as needed. * src/nm-device-802-3-ethernet.c: Include kernel-types.h * src/nm-device-802-3-ethernet.h: Remove defines. * src/wpa.c: Remove defines and include kernel-types.h. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1393 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 14 ++++++++++++-- src/Makefile.am | 1 + src/kernel-types.h | 18 ++++++++++++++++++ src/nm-device-802-3-ethernet.c | 1 + src/nm-device-802-3-ethernet.h | 12 ------------ src/wpa.c | 11 +---------- 6 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 src/kernel-types.h diff --git a/ChangeLog b/ChangeLog index 52b71a98c8..497b40b6c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-01-26 Robert Love + + * src/Makefile.am, src/kernel-types.h: Now that two different source + files are feeling the crack-addled leakage of kernel types such as + u32 and s8 -- superior to __u64 and __u8, to be sure, but not valid + types in user-space -- define a header and include it as needed. + * src/nm-device-802-3-ethernet.c: Include kernel-types.h + * src/nm-device-802-3-ethernet.h: Remove defines. + * src/wpa.c: Remove defines and include kernel-types.h. + 2006-01-26 Robert Love * TODO: Update. WPA support is in the bag and HAL restarts (should) @@ -524,7 +534,7 @@ - (nmu_create_dbus_error_message): rename parameter 'namespace' to 'exception_namespace' (:namespace is a keyword in C++) - + 2006-01-09 Dan Williams * src/NetworkManagerPolicy.c @@ -1422,7 +1432,7 @@ * configure.in, initscript/SUSE/.cvsignore, initscript/SUSE/Makefile.am: support new networkmanager-dispatcher initscript. - + 2005-12-08 Robert Love * initscript/SUSE/networkmanager.in: Do not start 'networking' service. diff --git a/src/Makefile.am b/src/Makefile.am index ad7293a426..51bf2770e2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -58,6 +58,7 @@ NetworkManager_SOURCES = \ nm-ap-security-wep.h \ nm-ap-security-wpa-psk.c \ nm-ap-security-wpa-psk.h \ + kernel-types.h \ wpa.c \ wpa.h \ wpa_ctrl.c \ diff --git a/src/kernel-types.h b/src/kernel-types.h new file mode 100644 index 0000000000..e4faa66f2a --- /dev/null +++ b/src/kernel-types.h @@ -0,0 +1,18 @@ +#ifndef _KERNEL_TYPES_H +#define _KERNEL_TYPES_H + +/* + * Various headers leak the kernel-only types u16, u32, et al. User-space + * does not supply these types, so we define them here. + */ + +typedef __u64 u64; +typedef __u32 u32; +typedef __u16 u16; +typedef __u8 u8; +typedef __s64 s64; +typedef __s32 s32; +typedef __s16 s16; +typedef __s8 s8; + +#endif /* _KERNEL_TYPES_H */ diff --git a/src/nm-device-802-3-ethernet.c b/src/nm-device-802-3-ethernet.c index 614f6d7011..f91373d096 100644 --- a/src/nm-device-802-3-ethernet.c +++ b/src/nm-device-802-3-ethernet.c @@ -33,6 +33,7 @@ #include "nm-activation-request.h" #include "NetworkManagerUtils.h" #include "nm-utils.h" +#include "kernel-types.h" #define NM_DEVICE_802_3_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_802_3_ETHERNET, NMDevice8023EthernetPrivate)) diff --git a/src/nm-device-802-3-ethernet.h b/src/nm-device-802-3-ethernet.h index 308a38eb56..da098c2809 100644 --- a/src/nm-device-802-3-ethernet.h +++ b/src/nm-device-802-3-ethernet.h @@ -28,18 +28,6 @@ #include "nm-device.h" -/* - * The kernel headers and leak the kernel-only - * types u16, u32, et al. User-space does not supply these types, so we define - * them here. - */ -#ifndef u64 -# define u64 __u64 -# define u32 __u32 -# define u16 __u16 -# define u8 __u8 -#endif - G_BEGIN_DECLS #define NM_TYPE_DEVICE_802_3_ETHERNET (nm_device_802_3_ethernet_get_type ()) diff --git a/src/wpa.c b/src/wpa.c index 02540dc587..84562d7e38 100644 --- a/src/wpa.c +++ b/src/wpa.c @@ -16,19 +16,10 @@ #include #include +#include "kernel-types.h" #include "wpa.h" #include "nm-utils.h" -/* crack */ -typedef uint64_t u64; -typedef uint32_t u32; -typedef uint16_t u16; -typedef uint8_t u8; -typedef int64_t s64; -typedef int32_t s32; -typedef int16_t s16; -typedef int8_t s8; - #define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0])) #define BIT(n) (1 << (n))