From: Nuno Antunes Date: Wed, 22 Sep 2010 14:11:48 +0000 (+0100) Subject: netgraph7: staticize linker_api_avaliable() and move it to ng_socket.c. X-Git-Tag: v3.0.0~112 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/ac58e50c6493ed95cbb6066e6d153cb9db0c0dc4 netgraph7: staticize linker_api_avaliable() and move it to ng_socket.c. --- diff --git a/sys/netgraph7/dragonfly.c b/sys/netgraph7/dragonfly.c index 2c9cfae..7ee3084 100644 --- a/sys/netgraph7/dragonfly.c +++ b/sys/netgraph7/dragonfly.c @@ -11,21 +11,6 @@ #include /* End Temporary lock stuff. */ -int -linker_api_available(void) -{ - /* linker_* API won't work without a process context */ - if (curproc == NULL) - return 0; - /* - * nlookup_init() relies on namei_oc to be initialized, - * but it's not when the netgraph module is loaded during boot. - */ - if (namei_oc == NULL) - return 0; - return 1; -} - /* Locking stuff. */ diff --git a/sys/netgraph7/dragonfly.h b/sys/netgraph7/dragonfly.h index f57bb2f..9ee5c15 100644 --- a/sys/netgraph7/dragonfly.h +++ b/sys/netgraph7/dragonfly.h @@ -45,8 +45,6 @@ typedef __va_list va_list; #define va_start(ap,last) __va_start(ap,last) #define va_end(ap) __va_end(ap) -int linker_api_available(void); - /* Temporary lock stuff */ int lock_sleep(void *, int, const char *, int, struct lock *); int lockstatus_owned(struct lock *, struct thread *); diff --git a/sys/netgraph7/socket/ng_socket.c b/sys/netgraph7/socket/ng_socket.c index e6b6d97..9ec2720 100644 --- a/sys/netgraph7/socket/ng_socket.c +++ b/sys/netgraph7/socket/ng_socket.c @@ -72,9 +72,8 @@ */ #include #include -#ifdef NOTYET #include -#endif + #include #include #include "ng_socketvar.h" @@ -137,6 +136,7 @@ static int ng_bind(struct sockaddr *nam, struct ngpcb *pcbp); static int ngs_mod_event(module_t mod, int event, void *data); static void ng_socket_item_applied(void *context, int error); +static int linker_api_available(void); /* Netgraph type descriptor */ static struct ng_type typestruct = { @@ -1177,6 +1177,21 @@ ngs_mod_event(module_t mod, int event, void *data) return (error); } +static int +linker_api_available(void) +{ + /* linker_* API won't work without a process context */ + if (curproc == NULL) + return 0; + /* + * nlookup_init() relies on namei_oc to be initialized, + * but it's not when the netgraph module is loaded during boot. + */ + if (namei_oc == NULL) + return 0; + return 1; +} + SYSCTL_INT(_net_graph, OID_AUTO, family, CTLFLAG_RD, 0, AF_NETGRAPH, ""); SYSCTL_NODE(_net_graph, OID_AUTO, data, CTLFLAG_RW, 0, "DATA"); SYSCTL_INT(_net_graph_data, OID_AUTO, proto, CTLFLAG_RD, 0, NG_DATA, "");