diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-10-19 18:11:55 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-10-19 18:11:55 +0000 |
commit | 2496b0e6308e3546b3700f250b41eef9319b8715 (patch) | |
tree | 07d64d635699b9b650ca1f5748fab8cb0267f483 /sys/net/if_var.h | |
parent | 0d65229cb7c32131fd2c49e630f275a8bcd318c2 (diff) | |
download | FreeBSD-src-2496b0e6308e3546b3700f250b41eef9319b8715.zip FreeBSD-src-2496b0e6308e3546b3700f250b41eef9319b8715.tar.gz |
Define IFF_LOCKGIANT() and IFF_UNLOCKGIANT() macros, which conditionally
acquire Giant if the passed interface has IFF_NEEDSGIANT set on it.
Modify calls into (ifp)->if_ioctl() in if.c to use these macros in order
to ensure that Giant is held.
MFC after: 3 days
Bumped into by: jmg
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r-- | sys/net/if_var.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 29837fb..f596a72 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -327,6 +327,16 @@ EVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t); #define IF_AFDATA_UNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_mtx) #define IF_AFDATA_DESTROY(ifp) mtx_destroy(&(ifp)->if_afdata_mtx) +#define IFF_LOCKGIANT(ifp) do { \ + if ((ifp)->if_flags & IFF_NEEDSGIANT) \ + mtx_lock(&Giant); \ +} while (0) + +#define IFF_UNLOCKGIANT(ifp) do { \ + if ((ifp)->if_flags & IFF_NEEDSGIANT) \ + mtx_unlock(&Giant); \ +} while (0) + #define IF_HANDOFF(ifq, m, ifp) \ if_handoff((struct ifqueue *)ifq, m, ifp, 0) #define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \ |