diff options
author | archie <archie@FreeBSD.org> | 2000-05-01 23:29:19 +0000 |
---|---|---|
committer | archie <archie@FreeBSD.org> | 2000-05-01 23:29:19 +0000 |
commit | abe77c5239cbe13757b43c35aa32b9af5ea614a3 (patch) | |
tree | 67232cce2d5072dd6c8d278037a1f862498f6002 /sys | |
parent | b2d827cc6bf1568555935963da10224ae1323570 (diff) | |
download | FreeBSD-src-abe77c5239cbe13757b43c35aa32b9af5ea614a3.zip FreeBSD-src-abe77c5239cbe13757b43c35aa32b9af5ea614a3.tar.gz |
Use 'type_name' structure field instead of 'typename', which is
a C++ reserved work.
Add a ng_copy_meta() function.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netgraph/netgraph.h | 1 | ||||
-rw-r--r-- | sys/netgraph/ng_base.c | 22 | ||||
-rw-r--r-- | sys/netgraph/ng_message.h | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 9c31d3c..25c2d28 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -256,6 +256,7 @@ int ng_bypass(hook_p hook1, hook_p hook2); void ng_cutlinks(node_p node); int ng_con_nodes(node_p node, const char *name, node_p node2, const char *name2); +meta_p ng_copy_meta(meta_p meta); void ng_destroy_hook(hook_p hook); hook_p ng_findhook(node_p node, const char *name); node_p ng_findname(node_p node, const char *name); diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index a9b2783..c47273a 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -1436,7 +1436,7 @@ ng_generic_msg(node_p here, struct ng_mesg *msg, const char *retaddr, __FUNCTION__, "types"); break; } - strncpy(tp->typename, type->name, NG_TYPELEN); + strncpy(tp->type_name, type->name, NG_TYPELEN); tp->numnodes = type->refs; tl->numtypes++; } @@ -1676,6 +1676,26 @@ ng_send_dataq(hook_p hook, struct mbuf *m, meta_p meta, return (error); } +/* + * Copy a 'meta'. + * + * Returns new meta, or NULL if original meta is NULL or ENOMEM. + */ +meta_p +ng_copy_meta(meta_p meta) +{ + meta_p meta2; + + if (meta == NULL) + return (NULL); + MALLOC(meta2, meta_p, meta->used_len, M_NETGRAPH, M_NOWAIT); + if (meta2 == NULL) + return (NULL); + meta2->allocated_len = meta->used_len; + bcopy(meta, meta2, meta->used_len); + return (meta2); +} + /************************************************************************ Module routines ************************************************************************/ diff --git a/sys/netgraph/ng_message.h b/sys/netgraph/ng_message.h index 036cb22..7eeb97c 100644 --- a/sys/netgraph/ng_message.h +++ b/sys/netgraph/ng_message.h @@ -243,7 +243,7 @@ struct namelist { /* Structure used for NGM_LISTTYPES */ struct typeinfo { - char typename[NG_TYPELEN + 1]; /* name of type */ + char type_name[NG_TYPELEN + 1]; /* name of type */ u_int32_t numnodes; /* number alive */ }; |