diff options
author | Ben Pfaff <blp@nicira.com> | 2011-12-26 14:17:55 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-01-16 13:35:21 -0800 |
commit | c2b565b54e36bc33d0406afb225c9bf3d01405ef (patch) | |
tree | 9861ebc77f2a857bf62c4ae43fa6231384ed10d6 /lib/dpif.c | |
parent | 8338659aa5a02421959bece64f6233216de6a101 (diff) |
dpif: Factor 'type' and 'error' out of individual dpif_op members.
I'd like to change ->dpif_flow_put() and ->dpif_execute() in the dpif
provider to take the structures of the same names as parameters, instead of
passing them discrete parameters, because this seems like a more sensible
way to do things internally than to have two different ways to pass the
parameters. It might even simplify code slightly. But ->flow_put() and
->execute() wouldn't want the 'type' (because it's implied by the function
being called) or 'error' (because it would be the same as the return
value). Although of course they could just ignore those members, it seems
slightly cleaner to omit them entirely, as this change allows.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/dpif.c')
-rw-r--r-- | lib/dpif.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -984,7 +984,7 @@ dpif_execute(struct dpif *dpif, * This function exists because some datapaths can perform batched operations * faster than individual operations. */ void -dpif_operate(struct dpif *dpif, union dpif_op **ops, size_t n_ops) +dpif_operate(struct dpif *dpif, struct dpif_op **ops, size_t n_ops) { size_t i; @@ -994,25 +994,25 @@ dpif_operate(struct dpif *dpif, union dpif_op **ops, size_t n_ops) } for (i = 0; i < n_ops; i++) { - union dpif_op *op = ops[i]; + struct dpif_op *op = ops[i]; struct dpif_flow_put *put; struct dpif_execute *execute; switch (op->type) { case DPIF_OP_FLOW_PUT: - put = &op->flow_put; - put->error = dpif_flow_put(dpif, put->flags, - put->key, put->key_len, - put->actions, put->actions_len, - put->stats); + put = &op->u.flow_put; + op->error = dpif_flow_put(dpif, put->flags, + put->key, put->key_len, + put->actions, put->actions_len, + put->stats); break; case DPIF_OP_EXECUTE: - execute = &op->execute; - execute->error = dpif_execute(dpif, execute->key, execute->key_len, - execute->actions, - execute->actions_len, - execute->packet); + execute = &op->u.execute; + op->error = dpif_execute(dpif, execute->key, execute->key_len, + execute->actions, + execute->actions_len, + execute->packet); break; default: |