Commit 0ba2c6e8 authored by Harald Welte's avatar Harald Welte Committed by David S. Miller

[NETFILTER]: introduce and use aligned_u64 data type

As proposed by Andi Kleen, this is required esp. for x86_64 architecture,
where 64bit code needs 8byte aligned 64bit data types, but 32bit userspace
apps will only align to 4bytes.
Signed-off-by: default avatarHarald Welte <laforge@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 17b085ea
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* and not any kind of function definitions. It is shared between kernel and * and not any kind of function definitions. It is shared between kernel and
* userspace. Don't put kernel specific stuff in here */ * userspace. Don't put kernel specific stuff in here */
#include <linux/types.h>
#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink.h>
enum nfulnl_msg_types { enum nfulnl_msg_types {
...@@ -27,8 +28,8 @@ struct nfulnl_msg_packet_hw { ...@@ -27,8 +28,8 @@ struct nfulnl_msg_packet_hw {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct nfulnl_msg_packet_timestamp { struct nfulnl_msg_packet_timestamp {
u_int64_t sec; aligned_u64 sec;
u_int64_t usec; aligned_u64 usec;
} __attribute__ ((packed)); } __attribute__ ((packed));
#define NFULNL_PREFIXLEN 30 /* just like old log target */ #define NFULNL_PREFIXLEN 30 /* just like old log target */
......
#ifndef _NFNETLINK_QUEUE_H #ifndef _NFNETLINK_QUEUE_H
#define _NFNETLINK_QUEUE_H #define _NFNETLINK_QUEUE_H
#include <linux/types.h>
#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink.h>
enum nfqnl_msg_types { enum nfqnl_msg_types {
...@@ -24,8 +25,8 @@ struct nfqnl_msg_packet_hw { ...@@ -24,8 +25,8 @@ struct nfqnl_msg_packet_hw {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct nfqnl_msg_packet_timestamp { struct nfqnl_msg_packet_timestamp {
u_int64_t sec; aligned_u64 sec;
u_int64_t usec; aligned_u64 usec;
} __attribute__ ((packed)); } __attribute__ ((packed));
enum nfqnl_attr_type { enum nfqnl_attr_type {
......
...@@ -123,6 +123,9 @@ typedef __u64 u_int64_t; ...@@ -123,6 +123,9 @@ typedef __u64 u_int64_t;
typedef __s64 int64_t; typedef __s64 int64_t;
#endif #endif
/* this is a special 64bit data type that is 8-byte aligned */
#define aligned_u64 unsigned long long __attribute__((aligned(8)))
/* /*
* The type used for indexing onto a disc or disc partition. * The type used for indexing onto a disc or disc partition.
* If required, asm/types.h can override it and define * If required, asm/types.h can override it and define
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment