membuff: Rename functions to have membuf_ prefix
The double 'f' is not necessary and is a bit annoying as elsewhere in
U-Boot we use 'buf'. Rename all the functions before it is used more
widely.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/membuff.h b/include/membuff.h
index 4eba626..c7370e1 100644
--- a/include/membuff.h
+++ b/include/membuff.h
@@ -6,8 +6,8 @@
* Copyright (c) 1992 Simon Glass
*/
-#ifndef _MEMBUFF_H
-#define _MEMBUFF_H
+#ifndef _membuf_H
+#define _membuf_H
/**
* @struct membuff: holds the state of a membuff - it is used for input and
@@ -37,16 +37,16 @@
};
/**
- * membuff_purge() - reset a membuff to the empty state
+ * membuf_purge() - reset a membuff to the empty state
*
* Initialise head and tail pointers so that the membuff becomes empty.
*
* @mb: membuff to purge
*/
-void membuff_purge(struct membuff *mb);
+void membuf_purge(struct membuff *mb);
/**
- * membuff_putraw() - find out where bytes can be written
+ * membuf_putraw() - find out where bytes can be written
*
* Work out where in the membuff some data could be written. Return a pointer
* to the address and the number of bytes which can be written there. If
@@ -64,10 +64,10 @@
* @data: the address data can be written to
* Return: number of bytes which can be written
*/
-int membuff_putraw(struct membuff *mb, int maxlen, bool update, char **data);
+int membuf_putraw(struct membuff *mb, int maxlen, bool update, char **data);
/**
- * membuff_getraw() - find and return a pointer to available bytes
+ * membuf_getraw() - find and return a pointer to available bytes
*
* Returns a pointer to any valid input data in the given membuff and
* optionally marks it as read. Note that not all input data may not be
@@ -82,37 +82,37 @@
* @data: returns address of data in input membuff
* Return: the number of bytes available at *@data
*/
-int membuff_getraw(struct membuff *mb, int maxlen, bool update, char **data);
+int membuf_getraw(struct membuff *mb, int maxlen, bool update, char **data);
/**
- * membuff_putbyte() - Writes a byte to a membuff
+ * membuf_putbyte() - Writes a byte to a membuff
*
* @mb: membuff to adjust
* @ch: byte to write
* Return: true on success, false if membuff is full
*/
-bool membuff_putbyte(struct membuff *mb, int ch);
+bool membuf_putbyte(struct membuff *mb, int ch);
/**
* @mb: membuff to adjust
- * membuff_getbyte() - Read a byte from the membuff
+ * membuf_getbyte() - Read a byte from the membuff
* Return: the byte read, or -1 if the membuff is empty
*/
-int membuff_getbyte(struct membuff *mb);
+int membuf_getbyte(struct membuff *mb);
/**
- * membuff_peekbyte() - check the next available byte
+ * membuf_peekbyte() - check the next available byte
*
- * Return the next byte which membuff_getbyte() would return, without
+ * Return the next byte which membuf_getbyte() would return, without
* removing it from the membuff.
*
* @mb: membuff to adjust
* Return: the byte peeked, or -1 if the membuff is empty
*/
-int membuff_peekbyte(struct membuff *mb);
+int membuf_peekbyte(struct membuff *mb);
/**
- * membuff_get() - get data from a membuff
+ * membuf_get() - get data from a membuff
*
* Copies any available data (up to @maxlen bytes) to @buff and removes it
* from the membuff.
@@ -122,10 +122,10 @@
* @maxlen: maximum number of bytes to read
* Return: the number of bytes read
*/
-int membuff_get(struct membuff *mb, char *buff, int maxlen);
+int membuf_get(struct membuff *mb, char *buff, int maxlen);
/**
- * membuff_put() - write data to a membuff
+ * membuf_put() - write data to a membuff
*
* Writes some data to a membuff. Returns the number of bytes added. If this
* is less than @lnehgt, then the membuff got full
@@ -135,36 +135,36 @@
* @length: number of bytes to write from 'data'
* Return: the number of bytes added
*/
-int membuff_put(struct membuff *mb, const char *buff, int length);
+int membuf_put(struct membuff *mb, const char *buff, int length);
/**
- * membuff_isempty() - check if a membuff is empty
+ * membuf_isempty() - check if a membuff is empty
*
* @mb: membuff to check
* Return: true if empty, else false
*/
-bool membuff_isempty(struct membuff *mb);
+bool membuf_isempty(struct membuff *mb);
/**
- * membuff_avail() - check available data in a membuff
+ * membuf_avail() - check available data in a membuff
*
* @mb: membuff to check
* Return: number of bytes of data available
*/
-int membuff_avail(struct membuff *mb);
+int membuf_avail(struct membuff *mb);
/**
- * membuff_size() - get the size of a membuff
+ * membuf_size() - get the size of a membuff
*
* Note that a membuff can only old data up to one byte less than its size.
*
* @mb: membuff to check
* Return: total size
*/
-int membuff_size(struct membuff *mb);
+int membuf_size(struct membuff *mb);
/**
- * membuff_makecontig() - adjust all membuff data to be contiguous
+ * membuf_makecontig() - adjust all membuff data to be contiguous
*
* This places all data in a membuff into a single contiguous lump, if
* possible
@@ -172,18 +172,18 @@
* @mb: membuff to adjust
* Return: true on success
*/
-bool membuff_makecontig(struct membuff *mb);
+bool membuf_makecontig(struct membuff *mb);
/**
- * membuff_free() - find the number of bytes that can be written to a membuff
+ * membuf_free() - find the number of bytes that can be written to a membuff
*
* @mb: membuff to check
* Return: returns the number of bytes free in a membuff
*/
-int membuff_free(struct membuff *mb);
+int membuf_free(struct membuff *mb);
/**
- * membuff_readline() - read a line of text from a membuff
+ * membuf_readline() - read a line of text from a membuff
*
* Reads a line of text of up to 'maxlen' characters from a membuff and puts
* it in @str. Any character less than @minch is assumed to be the end of
@@ -196,10 +196,10 @@
* Return: number of bytes read (including terminator) if a line has been
* read, 0 if nothing was there or line didn't fit when must_fit is set
*/
-int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit);
+int membuf_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit);
/**
- * membuff_extend_by() - expand a membuff
+ * membuf_extend_by() - expand a membuff
*
* Extends a membuff by the given number of bytes
*
@@ -209,38 +209,38 @@
* Return: 0 if the expand succeeded, -ENOMEM if not enough memory, -E2BIG
* if the the size would exceed @max
*/
-int membuff_extend_by(struct membuff *mb, int by, int max);
+int membuf_extend_by(struct membuff *mb, int by, int max);
/**
- * membuff_init() - set up a new membuff using an existing membuff
+ * membuf_init() - set up a new membuff using an existing membuff
*
* @mb: membuff to set up
* @buff: Address of buffer
* @size: Size of buffer
*/
-void membuff_init(struct membuff *mb, char *buff, int size);
+void membuf_init(struct membuff *mb, char *buff, int size);
/**
- * membuff_uninit() - clear a membuff so it can no longer be used
+ * membuf_uninit() - clear a membuff so it can no longer be used
*
* @mb: membuff to uninit
*/
-void membuff_uninit(struct membuff *mb);
+void membuf_uninit(struct membuff *mb);
/**
- * membuff_new() - create a new membuff
+ * membuf_new() - create a new membuff
*
* @mb: membuff to init
* @size: size of membuff to create
* Return: 0 if OK, -ENOMEM if out of memory
*/
-int membuff_new(struct membuff *mb, int size);
+int membuf_new(struct membuff *mb, int size);
/**
- * membuff_dispose() - free memory allocated to a membuff and uninit it
+ * membuf_dispose() - free memory allocated to a membuff and uninit it
*
* @mb: membuff to dispose
*/
-void membuff_dispose(struct membuff *mb);
+void membuf_dispose(struct membuff *mb);
#endif