buffer: Rename buffer_reserve_headroom to buffer_prealloc_headroom.
authorBen Pfaff <blp@nicira.com>
Mon, 14 Jul 2008 20:51:37 +0000 (13:51 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 18 Jul 2008 20:42:37 +0000 (13:42 -0700)
Similarly for buffer_reserve_tailroom.

The new name better reflects what they do, and make way for a different
use of the term "reserve" in the upcoming buffer_reserve() function.

include/buffer.h
lib/buffer.c
lib/netlink.c
lib/vconn-ssl.c
lib/vconn-tcp.c

index c2cbb13..16183f6 100644 (file)
@@ -73,7 +73,8 @@ void *buffer_push_uninit(struct buffer *b, size_t);
 
 size_t buffer_headroom(struct buffer *);
 size_t buffer_tailroom(struct buffer *);
-void buffer_reserve_tailroom(struct buffer *, size_t);
+void buffer_prealloc_headroom(struct buffer *, size_t);
+void buffer_prealloc_tailroom(struct buffer *, size_t);
 
 void buffer_clear(struct buffer *);
 void *buffer_pull(struct buffer *, size_t);
index dc9887a..8604913 100644 (file)
@@ -128,7 +128,7 @@ buffer_tailroom(struct buffer *b)
 /* Ensures that 'b' has room for at least 'size' bytes at its tail end,
  * reallocating and copying its data if necessary. */
 void
-buffer_reserve_tailroom(struct buffer *b, size_t size) 
+buffer_prealloc_tailroom(struct buffer *b, size_t size) 
 {
     if (size > buffer_tailroom(b)) {
         size_t new_allocated = b->allocated + MAX(size, 64);
@@ -152,7 +152,7 @@ buffer_reserve_tailroom(struct buffer *b, size_t size)
 }
 
 void
-buffer_reserve_headroom(struct buffer *b, size_t size) 
+buffer_prealloc_headroom(struct buffer *b, size_t size) 
 {
     assert(size <= buffer_headroom(b));
 }
@@ -164,7 +164,7 @@ void *
 buffer_put_uninit(struct buffer *b, size_t size) 
 {
     void *p;
-    buffer_reserve_tailroom(b, size);
+    buffer_prealloc_tailroom(b, size);
     p = buffer_tail(b);
     b->size += size;
     return p;
@@ -184,7 +184,7 @@ buffer_put(struct buffer *b, const void *p, size_t size)
 void *
 buffer_push_uninit(struct buffer *b, size_t size) 
 {
-    buffer_reserve_headroom(b, size);
+    buffer_prealloc_headroom(b, size);
     b->data -= size;
     b->size += size;
     return b->data;
index 0480788..2d63ceb 100644 (file)
@@ -470,12 +470,12 @@ nl_msg_nlmsgerr(const struct buffer *msg, int *errorp)
     }
 }
 
-/* Ensures that 'b' has room for at least 'size' bytes plus netlink pading at
+/* Ensures that 'b' has room for at least 'size' bytes plus netlink padding at
  * its tail end, reallocating and copying its data if necessary. */
 void
 nl_msg_reserve(struct buffer *msg, size_t size) 
 {
-    buffer_reserve_tailroom(msg, NLMSG_ALIGN(size));
+    buffer_prealloc_tailroom(msg, NLMSG_ALIGN(size));
 }
 
 /* Puts a nlmsghdr at the beginning of 'msg', which must be initially empty.
index 922f8a8..607d9b9 100644 (file)
@@ -458,7 +458,7 @@ again:
             return 0;
         }
     }
-    buffer_reserve_tailroom(rx, want_bytes);
+    buffer_prealloc_tailroom(rx, want_bytes);
 
     /* Behavior of zero-byte SSL_read is poorly defined. */
     assert(want_bytes > 0);
index 50304d3..aaff940 100644 (file)
@@ -200,7 +200,7 @@ again:
             return 0;
         }
     }
-    buffer_reserve_tailroom(rx, want_bytes);
+    buffer_prealloc_tailroom(rx, want_bytes);
 
     retval = read(tcp->fd, buffer_tail(rx), want_bytes);
     if (retval > 0) {