~ubuntu-branches/ubuntu/vivid/wpasupplicant/vivid

« back to all changes in this revision

Viewing changes to debian/madwifi-headers/include/compat.h

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2008-03-12 20:03:04 UTC
  • mfrom: (1.1.10 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080312200304-4331y9wj46pdd34z
Tags: 0.6.3-1
* New upstream release.
* Drop patches applied upstream:
  - debian/patches/30_wpa_gui_qt4_eventhistoryui_rework.patch
  - debian/patches/31_wpa_gui_qt4_eventhistory_always_scrollbar.patch
  - debian/patches/32_wpa_gui_qt4_eventhistory_scroll_with_events.patch
  - debian/patches/40_dbus_ssid_data.patch
* Tidy up the clean target of debian/rules. Now that the madwifi headers are
  handled differently we no longer need to do any cleanup.
* Fix formatting error in debian/ifupdown/wpa_action.8 to make lintian
  quieter.
* Add patch to fix formatting errors in manpages build from sgml source. Use
  <emphasis> tags to hightlight keywords instead of surrounding them in
  strong quotes.
  - debian/patches/41_manpage_format_fixes.patch
* wpasupplicant binary package no longer suggests pcscd, guessnet, iproute
  or wireless-tools, nor does it recommend dhcp3-client. These are not
  needed.
* Add debian/patches/10_silence_siocsiwauth_icotl_failure.patch to disable
  ioctl failure messages that occur under normal conditions.
* Cherry pick two upstream git commits concerning the dbus interface:
  - debian/patches/11_avoid_dbus_version_namespace.patch
  - debian/patches/12_fix_potential_use_after_free.patch
* Add debian/patches/42_manpage_explain_available_drivers.patch to explain
  that not all of the driver backends are available in the provided
  wpa_supplicant binary, and that the canonical list of supported driver
  backends can be retrieved from the wpa_supplicant -h (help) output.
  (Closes: #466910)
* Add debian/patches/20_wpa_gui_qt4_disable_link_prl.patch to remove
  link_prl CONFIG compile flag added by qmake-qt4 >= 4.3.4-2 to avoid excess
  linking.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-
 
2
 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
 
3
 * All rights reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 * 1. Redistributions of source code must retain the above copyright
 
9
 *    notice, this list of conditions and the following disclaimer,
 
10
 *    without modification.
 
11
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 
12
 *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
 
13
 *    redistribution must be conditioned upon including a substantially
 
14
 *    similar Disclaimer requirement for further binary redistribution.
 
15
 * 3. Neither the names of the above-listed copyright holders nor the names
 
16
 *    of any contributors may be used to endorse or promote products derived
 
17
 *    from this software without specific prior written permission.
 
18
 *
 
19
 * Alternatively, this software may be distributed under the terms of the
 
20
 * GNU General Public License ("GPL") version 2 as published by the Free
 
21
 * Software Foundation.
 
22
 *
 
23
 * NO WARRANTY
 
24
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
25
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
26
 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
 
27
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 
28
 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
 
29
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
30
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
31
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 
32
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
33
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 
34
 * THE POSSIBILITY OF SUCH DAMAGES.
 
35
 *
 
36
 * $Id: compat.h 2394 2007-05-30 01:41:18Z mtaylor $
 
37
 */
 
38
#ifndef _ATH_COMPAT_H_
 
39
#define _ATH_COMPAT_H_
 
40
 
 
41
/* Compatibility with older Linux kernels */
 
42
#ifdef __KERNEL__
 
43
#include <linux/types.h>
 
44
#endif
 
45
#if !defined(__KERNEL__) || !defined (__bitwise)
 
46
#define __le16 u_int16_t
 
47
#define __le32 u_int32_t
 
48
#define __le64 u_int64_t
 
49
#define __be16 u_int16_t
 
50
#define __be32 u_int32_t
 
51
#define __be64 u_int64_t
 
52
#define __force
 
53
#endif
 
54
 
 
55
#ifndef container_of
 
56
#define container_of(ptr, type, member) ({                      \
 
57
            const typeof( ((type *)0)->member ) *__mptr = (ptr);        \
 
58
            (type *)( (char *)__mptr - offsetof(type,member) );})
 
59
#endif
 
60
 
 
61
/*
 
62
 * BSD/Linux compatibility shims.  These are used mainly to
 
63
 * minimize differences when importing necesary BSD code.
 
64
 */
 
65
#define NBBY    8                       /* number of bits/byte */
 
66
 
 
67
/* roundup() appears in Linux 2.6.18 */
 
68
#include <linux/kernel.h>
 
69
#ifndef roundup
 
70
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
 
71
#endif
 
72
 
 
73
#define howmany(x, y)   (((x)+((y)-1))/(y))
 
74
 
 
75
/* Bit map related macros. */
 
76
#define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
 
77
#define clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
 
78
#define isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
 
79
#define isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
 
80
 
 
81
#ifndef __packed
 
82
#define __packed        __attribute__((__packed__))
 
83
#endif
 
84
 
 
85
#define __printflike(_a,_b) \
 
86
        __attribute__ ((__format__ (__printf__, _a, _b)))
 
87
#define __offsetof(t,m) offsetof(t,m)
 
88
 
 
89
#ifndef ALIGNED_POINTER
 
90
/*
 
91
 * ALIGNED_POINTER is a boolean macro that checks whether an address
 
92
 * is valid to fetch data elements of type t from on this architecture.
 
93
 * This does not reflect the optimal alignment, just the possibility
 
94
 * (within reasonable limits). 
 
95
 *
 
96
 */
 
97
#define ALIGNED_POINTER(p,t)    1
 
98
#endif
 
99
 
 
100
#ifdef __KERNEL__
 
101
#define KASSERT(exp, msg) do {                  \
 
102
        if (unlikely(!(exp))) {                 \
 
103
                printk msg;                     \
 
104
                BUG();                          \
 
105
        }                                       \
 
106
} while (0)
 
107
#endif /* __KERNEL__ */
 
108
 
 
109
/*
 
110
 * NetBSD/FreeBSD defines for file version.
 
111
 */
 
112
#define __FBSDID(_s)
 
113
#define __KERNEL_RCSID(_n,_s)
 
114
 
 
115
/*
 
116
 * Fixes for Linux API changes
 
117
 */
 
118
#ifdef __KERNEL__
 
119
 
 
120
#include <linux/version.h>
 
121
#include <linux/sysctl.h>
 
122
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) && \
 
123
        (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) || defined(CTL_ANY))
 
124
#define ATH_REGISTER_SYSCTL_TABLE(t) register_sysctl_table(t, 1)
 
125
#else
 
126
#define ATH_REGISTER_SYSCTL_TABLE(t) register_sysctl_table(t)
 
127
#endif
 
128
 
 
129
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
 
130
#define __user
 
131
#define __kernel
 
132
#define __iomem
 
133
#endif
 
134
 
 
135
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 
136
#include <linux/skbuff.h>
 
137
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
 
138
{
 
139
        return skb->end;
 
140
}
 
141
 
 
142
static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
 
143
{
 
144
        return skb->tail;
 
145
}
 
146
 
 
147
static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
 
148
{
 
149
        skb->nh.raw = skb->data + offset;
 
150
}
 
151
 
 
152
static inline void skb_reset_network_header(struct sk_buff *skb)
 
153
{
 
154
        skb->nh.raw = skb->data;
 
155
}
 
156
 
 
157
static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
 
158
{
 
159
        return skb->mac.raw;
 
160
}
 
161
 
 
162
static inline void skb_reset_mac_header(struct sk_buff *skb)
 
163
{
 
164
        skb->mac.raw = skb->data;
 
165
}
 
166
#endif
 
167
 
 
168
#endif /* __KERNEL__ */
 
169
 
 
170
#endif /* _ATH_COMPAT_H_ */