2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

classifier: New function cls_rule_move().

This function will acquire its first user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
Ben Pfaff
2013-08-27 12:25:48 -07:00
parent 1828ae5140
commit b2c1f00b73
6 changed files with 49 additions and 3 deletions

View File

@@ -1136,6 +1136,21 @@ miniflow_clone(struct miniflow *dst, const struct miniflow *src)
memcpy(dst->values, src->values, n * sizeof *dst->values);
}
/* Initializes 'dst' with the data in 'src', destroying 'src'.
* The caller must eventually free 'dst' with miniflow_destroy(). */
void
miniflow_move(struct miniflow *dst, struct miniflow *src)
{
int n = miniflow_n_values(src);
if (n <= MINI_N_INLINE) {
dst->values = dst->inline_values;
memcpy(dst->values, src->values, n * sizeof *dst->values);
} else {
dst->values = src->values;
}
memcpy(dst->map, src->map, sizeof dst->map);
}
/* Frees any memory owned by 'flow'. Does not free the storage in which 'flow'
* itself resides; the caller is responsible for that. */
void
@@ -1353,6 +1368,14 @@ minimask_clone(struct minimask *dst, const struct minimask *src)
miniflow_clone(&dst->masks, &src->masks);
}
/* Initializes 'dst' with the data in 'src', destroying 'src'.
* The caller must eventually free 'dst' with minimask_destroy(). */
void
minimask_move(struct minimask *dst, struct minimask *src)
{
miniflow_clone(&dst->masks, &src->masks);
}
/* Initializes 'dst_' as the bit-wise "and" of 'a_' and 'b_'.
*
* The caller must provide room for FLOW_U32S "uint32_t"s in 'storage', for use