2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 07:15:17 +00:00

ofpbuf: Add ofpbuf_new_with_headroom(), ofpbuf_clone_with_headroom().

These new functions simplify an increasingly common usage pattern.

Suggested-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
Ben Pfaff
2010-09-01 12:55:38 -07:00
parent f79cb67e68
commit 68efcbec41
5 changed files with 27 additions and 6 deletions

View File

@@ -1262,8 +1262,7 @@ dp_netdev_output_control(struct dp_netdev *dp, const struct ofpbuf *packet,
}
msg_size = sizeof *header + packet->size;
msg = ofpbuf_new(msg_size + DPIF_RECV_MSG_PADDING);
ofpbuf_reserve(msg, DPIF_RECV_MSG_PADDING);
msg = ofpbuf_new_with_headroom(msg_size, DPIF_RECV_MSG_PADDING);
header = ofpbuf_put_uninit(msg, sizeof *header);
header->type = queue_no;
header->length = msg_size;