diff options
author | Harald Welte <laforge@netfilter.org> | 2005-08-13 16:55:44 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:57:59 -0400 |
commit | 0ba2c6e8c0fb5cde5a23a213c2e7cb851b85c310 (patch) | |
tree | 62317e893be4261f456d666efd1105b7871d36b9 | |
parent | 17b085eacef81a6286bd478f2ec75e04abb091cb (diff) |
[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: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netfilter/nfnetlink_log.h | 5 | ||||
-rw-r--r-- | include/linux/netfilter/nfnetlink_queue.h | 5 | ||||
-rw-r--r-- | include/linux/types.h | 3 |
3 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h index a61836a083e7..b04b03880595 100644 --- a/include/linux/netfilter/nfnetlink_log.h +++ b/include/linux/netfilter/nfnetlink_log.h | |||
@@ -5,6 +5,7 @@ | |||
5 | * and not any kind of function definitions. It is shared between kernel and | 5 | * and not any kind of function definitions. It is shared between kernel and |
6 | * userspace. Don't put kernel specific stuff in here */ | 6 | * userspace. Don't put kernel specific stuff in here */ |
7 | 7 | ||
8 | #include <linux/types.h> | ||
8 | #include <linux/netfilter/nfnetlink.h> | 9 | #include <linux/netfilter/nfnetlink.h> |
9 | 10 | ||
10 | enum nfulnl_msg_types { | 11 | enum nfulnl_msg_types { |
@@ -27,8 +28,8 @@ struct nfulnl_msg_packet_hw { | |||
27 | } __attribute__ ((packed)); | 28 | } __attribute__ ((packed)); |
28 | 29 | ||
29 | struct nfulnl_msg_packet_timestamp { | 30 | struct nfulnl_msg_packet_timestamp { |
30 | u_int64_t sec; | 31 | aligned_u64 sec; |
31 | u_int64_t usec; | 32 | aligned_u64 usec; |
32 | } __attribute__ ((packed)); | 33 | } __attribute__ ((packed)); |
33 | 34 | ||
34 | #define NFULNL_PREFIXLEN 30 /* just like old log target */ | 35 | #define NFULNL_PREFIXLEN 30 /* just like old log target */ |
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h index 2d8d2b2cfcaa..9e774373244c 100644 --- a/include/linux/netfilter/nfnetlink_queue.h +++ b/include/linux/netfilter/nfnetlink_queue.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _NFNETLINK_QUEUE_H | 1 | #ifndef _NFNETLINK_QUEUE_H |
2 | #define _NFNETLINK_QUEUE_H | 2 | #define _NFNETLINK_QUEUE_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
4 | #include <linux/netfilter/nfnetlink.h> | 5 | #include <linux/netfilter/nfnetlink.h> |
5 | 6 | ||
6 | enum nfqnl_msg_types { | 7 | enum nfqnl_msg_types { |
@@ -24,8 +25,8 @@ struct nfqnl_msg_packet_hw { | |||
24 | } __attribute__ ((packed)); | 25 | } __attribute__ ((packed)); |
25 | 26 | ||
26 | struct nfqnl_msg_packet_timestamp { | 27 | struct nfqnl_msg_packet_timestamp { |
27 | u_int64_t sec; | 28 | aligned_u64 sec; |
28 | u_int64_t usec; | 29 | aligned_u64 usec; |
29 | } __attribute__ ((packed)); | 30 | } __attribute__ ((packed)); |
30 | 31 | ||
31 | enum nfqnl_attr_type { | 32 | enum nfqnl_attr_type { |
diff --git a/include/linux/types.h b/include/linux/types.h index dcb13f865df9..2b678c22ca4a 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
@@ -123,6 +123,9 @@ typedef __u64 u_int64_t; | |||
123 | typedef __s64 int64_t; | 123 | typedef __s64 int64_t; |
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | /* this is a special 64bit data type that is 8-byte aligned */ | ||
127 | #define aligned_u64 unsigned long long __attribute__((aligned(8))) | ||
128 | |||
126 | /* | 129 | /* |
127 | * The type used for indexing onto a disc or disc partition. | 130 | * The type used for indexing onto a disc or disc partition. |
128 | * If required, asm/types.h can override it and define | 131 | * If required, asm/types.h can override it and define |