K 10 svn:author V 7 glebius K 8 svn:date V 27 2012-02-14T17:35:44.448822Z K 7 svn:log V 1598 Merge netgraph related fixes and enhancements from head/. Revisions merged: r223754,224031,226829,229003,230213,230480, 230486-230487,231585. r223754 to ng_base: - Use refcount(9) API to manage node and hook refcounting. r224031 to ng_socket: In ng_attach_cntl() first allocate things that may fail, and then do the rest of initialization. This simplifies code and fixes a double free in failure scenario. r226829 to ng_base: - If KDB & NETGRAPH_DEBUG are on, print traces on discovered failed invariants. - Reduce tautology in NETGRAPH_DEBUG output. r229003 to ng_base: style(9), whitespace and spelling nits. r230213 to ng_socket: Remove some disabled NOTYET code. Probability of enabling it is low, if anyone wants, he/she can take it from svn. r230480 to ng_base: Convert locks that protect name hash, ID hash and typelist from mutex(9) to rwlock(9) based locks. While here remove dropping lock when processing NGM_LISTNODES, and NGM_LISTTYPES generic commands. We don't need to drop it since memory allocation is done with M_NOWAIT. r230486 to hashinit(9): Convert panic()s to KASSERT()s. This is an optimisation for hashdestroy() since in absence of INVARIANTS a compiler will drop the entire for() cycle. r230487,r231585 to ng_socket: Provide a findhook method for ng_socket(4). The node stores a hash with names of its hooks. It starts with size of 16, and grows when number of hooks reaches twice the current size. A failure to grow (memory is allocated with M_NOWAIT) isn't fatal, however. Tested by: Eugene Grosbein, Mike Tancsa END