diff options
Diffstat (limited to 'src/vnet/dpo/dpo.c')
-rw-r--r-- | src/vnet/dpo/dpo.c | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/src/vnet/dpo/dpo.c b/src/vnet/dpo/dpo.c index 85f2c5d3622..19e3714c536 100644 --- a/src/vnet/dpo/dpo.c +++ b/src/vnet/dpo/dpo.c @@ -153,20 +153,22 @@ format_dpo_id (u8 * s, va_list * args) if (NULL != dpo_vfts[dpo->dpoi_type].dv_format) { - return (format(s, "%U", - dpo_vfts[dpo->dpoi_type].dv_format, - dpo->dpoi_index, - indent)); + s = format(s, "%U", + dpo_vfts[dpo->dpoi_type].dv_format, + dpo->dpoi_index, + indent); } - - switch (dpo->dpoi_type) + else { - case DPO_FIRST: - s = format(s, "unset"); - break; - default: - s = format(s, "unknown"); - break; + switch (dpo->dpoi_type) + { + case DPO_FIRST: + s = format(s, "unset"); + break; + default: + s = format(s, "unknown"); + break; + } } return (s); } @@ -303,6 +305,18 @@ dpo_default_get_next_node (const dpo_id_t *dpo) return (node_indices); } +/** + * A default variant of the make interpose function that just returns + * the original + */ +static void +dpo_default_mk_interpose (const dpo_id_t *original, + const dpo_id_t *parent, + dpo_id_t *clone) +{ + dpo_copy(clone, original); +} + void dpo_register (dpo_type_t type, const dpo_vft_t *vft, @@ -314,6 +328,10 @@ dpo_register (dpo_type_t type, { dpo_vfts[type].dv_get_next_node = dpo_default_get_next_node; } + if (NULL == dpo_vfts[type].dv_mk_interpose) + { + dpo_vfts[type].dv_mk_interpose = dpo_default_mk_interpose; + } vec_validate(dpo_nodes, type); dpo_nodes[type] = nodes; @@ -331,6 +349,17 @@ dpo_register_new_type (const dpo_vft_t *vft, } void +dpo_mk_interpose (const dpo_id_t *original, + const dpo_id_t *parent, + dpo_id_t *clone) +{ + if (!dpo_id_is_valid(original)) + return; + + dpo_vfts[original->dpoi_type].dv_mk_interpose(original, parent, clone); +} + +void dpo_lock (dpo_id_t *dpo) { if (!dpo_id_is_valid(dpo)) |