summaryrefslogtreecommitdiffstats
path: root/sys/dev/awi
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-04-19 22:28:09 +0000
committerimp <imp@FreeBSD.org>2002-04-19 22:28:09 +0000
commit3e109d2cd3931ca713003306981eb9c6e33c03c6 (patch)
treee55959d250784cbb4de06416bce4474b79ab309a /sys/dev/awi
parent96e8895af5938fcd91b4d4862b943ce0961e1ab1 (diff)
downloadFreeBSD-src-3e109d2cd3931ca713003306981eb9c6e33c03c6.zip
FreeBSD-src-3e109d2cd3931ca713003306981eb9c6e33c03c6.tar.gz
Make this build on 4.x machines again (building a -current kernel on a
-stable machine via the old-school methods): Use __FreeBSD_version in preference to __FreeBSD__ >= N where possible. Define a single variable mythread which is set to curproc or curthread depending on the OS version (with a comment saying it is a white lie on 4.x since it really is a proc). NB: __FreeBSD__ is the OS level of the host machine, not the target, and should never be used, if possible, as __FreeBSD__ >= N.
Diffstat (limited to 'sys/dev/awi')
-rw-r--r--sys/dev/awi/awi.c39
-rw-r--r--sys/dev/awi/awi_wep.c8
-rw-r--r--sys/dev/awi/awi_wicfg.c16
3 files changed, 27 insertions, 36 deletions
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c
index 6dfde41..0ab059a 100644
--- a/sys/dev/awi/awi.c
+++ b/sys/dev/awi/awi.c
@@ -105,7 +105,7 @@
#include <sys/sockio.h>
#include <sys/errno.h>
#include <sys/syslog.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 4
+#if defined(__FreeBSD__) && __FreeBSD_version >= 400000
#include <sys/bus.h>
#else
#include <sys/device.h>
@@ -236,7 +236,7 @@ int awi_dump_len = 28;
#endif
#ifdef __FreeBSD__
-#if __FreeBSD__ >= 4
+#if __FreeBSD_version >= 400000
devclass_t awi_devclass;
#endif
@@ -462,6 +462,13 @@ awi_ioctl(ifp, cmd, data)
u_int8_t *p;
int len;
u_int8_t tmpstr[IEEE80211_NWID_LEN*2];
+#ifdef __FreeBSD_version
+#if __FreeBSD_version < 500028
+ struct proc *mythread = curproc; /* Little lie */
+#else
+ struct thread *mythread = curthread;
+#endif
+#endif
s = splnet();
@@ -521,11 +528,7 @@ awi_ioctl(ifp, cmd, data)
break;
case SIOCS80211NWID:
#ifdef __FreeBSD__
-#if __FreeBSD__ >= 5
- error = suser(curthread);
-#else
- error = suser(curproc);
-#endif
+ error = suser(mythread);
if (error)
break;
#endif
@@ -559,11 +562,7 @@ awi_ioctl(ifp, cmd, data)
break;
case SIOCS80211NWKEY:
#ifdef __FreeBSD__
-#if __FreeBSD__ >= 5
- error = suser(curthread);
-#else
- error = suser(curproc);
-#endif
+ error = suser(mythread);
if (error)
break;
#endif
@@ -621,12 +620,10 @@ awi_ioctl(ifp, cmd, data)
error = awi_wep_getkey(sc, ireq->i_val, tmpstr, &len);
if(error)
break;
-#if __FreeBSD__ >= 5
- if(!suser(curthread))
-#else
- if(!suser(curproc))
-#endif
+#ifdef __FreeBSD__
+ if (!suser(mythread))
bzero(tmpstr, len);
+#endif
ireq->i_len = len;
error = copyout(tmpstr, ireq->i_data, len);
break;
@@ -662,11 +659,7 @@ awi_ioctl(ifp, cmd, data)
}
break;
case SIOCS80211:
-#if __FreeBSD__ >= 5
- error = suser(curthread);
-#else
- error = suser(curproc);
-#endif
+ error = suser(mythread);
if(error)
break;
switch(ireq->i_type) {
@@ -1435,7 +1428,7 @@ awi_input(sc, m, rxts, rssi)
break;
}
ifp->if_ipackets++;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 4)
+#if !(defined(__FreeBSD__) && __FreeBSD_version >= 400000)
AWI_BPF_MTAP(sc, m, AWI_BPF_NORM);
#endif
#ifdef __NetBSD__
diff --git a/sys/dev/awi/awi_wep.c b/sys/dev/awi/awi_wep.c
index bdd38b2..4c8d047 100644
--- a/sys/dev/awi/awi_wep.c
+++ b/sys/dev/awi/awi_wep.c
@@ -59,7 +59,7 @@
#include <sys/socket.h>
#include <sys/errno.h>
#include <sys/sockio.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 4
+#if defined(__FreeBSD__) && __FreeBSD_version >= 400000
#include <sys/bus.h>
#else
#include <sys/device.h>
@@ -189,10 +189,10 @@ awi_wep_getnwkey(sc, nwkey)
nwkey->i_defkid = sc->sc_wep_defkid + 1;
/* do not show any keys to non-root user */
#ifdef __FreeBSD__
-#if __FreeBSD__ >= 5
- suerr = suser(curthread);
-#else
+#if __FreeBSD_version < 500028
suerr = suser(curproc);
+#else
+ suerr = suser(curthread);
#endif
#else
suerr = suser(curproc->p_ucred, &curproc->p_acflag);
diff --git a/sys/dev/awi/awi_wicfg.c b/sys/dev/awi/awi_wicfg.c
index 639ea9b..db97d63 100644
--- a/sys/dev/awi/awi_wicfg.c
+++ b/sys/dev/awi/awi_wicfg.c
@@ -50,7 +50,7 @@
#include <sys/socket.h>
#include <sys/errno.h>
#include <sys/sockio.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 4
+#if defined(__FreeBSD__) && __FreeBSD_version >= 400000
#include <sys/bus.h>
#else
#include <sys/device.h>
@@ -69,8 +69,6 @@
#include <machine/cpu.h>
#include <machine/bus.h>
-#ifdef __FreeBSD__
-#endif
#ifdef __NetBSD__
#include <dev/ic/am79c930reg.h>
@@ -108,10 +106,10 @@ awi_wicfg(ifp, cmd, data)
break;
case SIOCSWAVELAN:
#ifdef __FreeBSD__
-#if __FreeBSD__ >= 5
- error = suser(curthread);
-#else
+#if __FreeBSD_version < 500028
error = suser(curproc);
+#else
+ error = suser(curthread);
#endif
#else
error = suser(curproc->p_ucred, &curproc->p_acflag);
@@ -276,10 +274,10 @@ awi_cfgget(ifp, cmd, data)
keys = (struct wi_ltv_keys *)&wreq;
/* do not show keys to non-root user */
#ifdef __FreeBSD__
-#if __FreeBSD__ >= 5
- error = suser(curthread);
-#else
+#if __FreeBSD_version < 500028
error = suser(curproc);
+#else
+ error = suser(curthread);
#endif
#else
error = suser(curproc->p_ucred, &curproc->p_acflag);
OpenPOWER on IntegriCloud