Use 'type_name' structure field instead of 'typename', which is
a C++ reserved work. Add a ng_copy_meta() function.
This commit is contained in:
parent
74bfa92ce0
commit
5d5ea68a69
@ -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);
|
||||
|
@ -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
|
||||
************************************************************************/
|
||||
|
@ -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 */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user