From 66a431bf82da5e09e89307c250991bfc12caf532 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Tue, 16 Sep 2014 22:57:53 -0400 Subject: [PATCH] Build fixes for recent FreeBSD -current Let's try a new paradigm of using flag checks in the main code, which are based off of precise version checks in the FreeBSD-specific param.h file. It's not quite configure checks, but is much more granular. Change-Id: I8274a8ad3747d3847cdec3ce8d521837fd5b2a92 Reviewed-on: http://gerrit.openafs.org/11467 Tested-by: BuildBot Tested-by: Benjamin Kaduk Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Jeffrey Altman --- src/config/param.generic_fbsd.h | 14 ++++++++++++++ src/rx/rx_kernel.h | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/config/param.generic_fbsd.h b/src/config/param.generic_fbsd.h index 627d25efa..4d4711889 100644 --- a/src/config/param.generic_fbsd.h +++ b/src/config/param.generic_fbsd.h @@ -108,6 +108,20 @@ enum vcexcl { NONEXCL, EXCL }; # endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */ #endif /* _KERNEL */ +/* + * Consolidate version checks into configure-test-like definitions + */ + +/* r270870 moved if_data into ifnet to avoid namespace-stealing macros. */ +#if __FreeBSD_version >= 1100030 +#define FBSD_IF_METRIC_IN_STRUCT_IFNET +#endif + +/* r271438 changed the ifa_ifwithnet KPI signature. */ +#if __FreeBSD_version >= 1100032 +#define FBSD_IFA_IFWITHNET_THREE_ARGS +#endif + #else /* !defined(UKERNEL) */ /* This section for user space compiles only */ diff --git a/src/rx/rx_kernel.h b/src/rx/rx_kernel.h index 48865361b..c6318f3e6 100644 --- a/src/rx/rx_kernel.h +++ b/src/rx/rx_kernel.h @@ -78,12 +78,18 @@ extern void osi_Panic(char *fmt, ...) #endif #define rx_ifnet_mtu(x) (x)->if_mtu #define rx_ifnet_flags(x) (x?(x)->if_flags:0) -#if defined(AFS_OBSD46_ENV) || defined(AFS_FBSD81_ENV) +#if defined(FBSD_IFA_IFWITHNET_THREE_ARGS) +#define rx_ifaddr_withnet(x) ifa_ifwithnet(x, 0, RT_ALL_FIBS) +#elif defined(AFS_OBSD46_ENV) || defined(AFS_FBSD81_ENV) #define rx_ifaddr_withnet(x) ifa_ifwithnet(x, 0) #else #define rx_ifaddr_withnet(x) ifa_ifwithnet(x) #endif +#if defined(FBSD_IF_METRIC_IN_STRUCT_IFNET) +#define rx_ifnet_metric(x) (x?(x)->if_metric:0) +#else #define rx_ifnet_metric(x) (x?(x)->if_data.ifi_metric:0) +#endif #define rx_ifaddr_ifnet(x) (x?(x)->ifa_ifp:0) #define rx_ifaddr_address_family(x) (x)->ifa_addr->sa_family #define rx_ifaddr_address(x, y, z) memcpy(y, (x)->ifa_addr, z) -- 2.39.5