X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b0d623f7f2ae71ed96e60569f61f9a9a27016e80..bb59bff194111743b33cc36712410b5656329d3c:/bsd/net/net_str_id.c?ds=sidebyside diff --git a/bsd/net/net_str_id.c b/bsd/net/net_str_id.c index 7f4fcd52f..e1ed7e907 100644 --- a/bsd/net/net_str_id.c +++ b/bsd/net/net_str_id.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Apple Inc. All rights reserved. + * Copyright (c) 2008,2011 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -47,13 +47,12 @@ #define FIRST_NET_STR_ID 1000 static SLIST_HEAD(,net_str_id_entry) net_str_id_list = {NULL}; -static lck_mtx_t *net_str_id_lock = NULL; +decl_lck_mtx_data(static, net_str_id_lock_data); +static lck_mtx_t *net_str_id_lock = &net_str_id_lock_data; static u_int32_t nsi_kind_next[NSI_MAX_KIND] = { FIRST_NET_STR_ID, FIRST_NET_STR_ID, FIRST_NET_STR_ID }; static u_int32_t nsi_next_id = FIRST_NET_STR_ID; -#if NETMIBS - extern int sysctl_if_family_ids SYSCTL_HANDLER_ARGS; SYSCTL_DECL(_net_link_generic_system); @@ -61,9 +60,6 @@ SYSCTL_DECL(_net_link_generic_system); SYSCTL_PROC(_net_link_generic_system, OID_AUTO, if_family_ids, CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_LOCKED, 0, 0, sysctl_if_family_ids, "S, if_family_id", "Interface Family ID table"); -#endif /* NETMIBS */ - - __private_extern__ void net_str_id_init(void) { @@ -76,7 +72,7 @@ net_str_id_init(void) lck_grp_attr_free(grp_attrib); lck_attrb = lck_attr_alloc_init(); - net_str_id_lock = lck_mtx_alloc_init(lck_group, lck_attrb); + lck_mtx_init(net_str_id_lock, lck_group, lck_attrb); lck_grp_free(lck_group); lck_attr_free(lck_attrb); @@ -153,8 +149,6 @@ net_str_id_find_internal(const char *string, u_int32_t *out_id, } -#if NETMIBS - #define ROUNDUP32(a) \ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t)) @@ -210,6 +204,3 @@ done: _FREE(iffmid, M_TEMP); return error; } - -#endif /* NETMIBS */ -