2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +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

@@ -478,8 +478,7 @@ dpif_linux_recv(struct dpif *dpif_, struct ofpbuf **bufp)
int retval;
int error;
buf = ofpbuf_new(65536 + DPIF_RECV_MSG_PADDING);
ofpbuf_reserve(buf, DPIF_RECV_MSG_PADDING);
buf = ofpbuf_new_with_headroom(65536, DPIF_RECV_MSG_PADDING);
retval = read(dpif->fd, ofpbuf_tail(buf), ofpbuf_tailroom(buf));
if (retval < 0) {
error = errno;