/* * Get ip_vs_dest associated with supplied parameters. */ static inline struct ip_vs_dest * ip_vs_sh_get(struct ip_vs_service *svc, struct ip_vs_sh_state *s, const union nf_inet_addr *addr, __be16 port) { unsigned int hash = ip_vs_sh_hashkey(svc->af, addr, port, 0); struct ip_vs_dest *dest = rcu_dereference(s->buckets[hash].dest); return (!dest || is_unavailable(dest)) ? NULL : dest; }
/* As ip_vs_sh_get, but with fallback if selected server is unavailable */ static inline struct ip_vs_dest * ip_vs_sh_get_fallback(struct ip_vs_service *svc, struct ip_vs_sh_state *s, const union nf_inet_addr *addr, __be16 port) { unsigned int offset; unsigned int hash; struct ip_vs_dest *dest; for (offset = 0; offset < IP_VS_SH_TAB_SIZE; offset++) { hash = ip_vs_sh_hashkey(svc->af, addr, port, offset); dest = rcu_dereference(s->buckets[hash].dest); if (!dest) break; if (is_unavailable(dest)) IP_VS_DBG_BUF(6, "SH: selected unavailable server " "%s:%d (offset %d)", IP_VS_DBG_ADDR(svc->af, &dest->addr), ntohs(dest->port), offset); else return dest; } return NULL; }
bool vehicle_part::is_available( const bool carried ) const { return !is_unavailable( carried ); }