Use nb in all function declarations for consistency.
This commit is contained in:
parent
6ccb7a35e6
commit
6d5c2ed68a
1 changed files with 23 additions and 22 deletions
|
@ -22,43 +22,43 @@
|
||||||
#include <grub/net/netbuff.h>
|
#include <grub/net/netbuff.h>
|
||||||
|
|
||||||
|
|
||||||
grub_err_t grub_netbuff_put (struct grub_net_buff *net_buff ,grub_size_t len)
|
grub_err_t grub_netbuff_put (struct grub_net_buff *nb ,grub_size_t len)
|
||||||
{
|
{
|
||||||
net_buff->tail += len;
|
nb->tail += len;
|
||||||
if (net_buff->tail > net_buff->end)
|
if (nb->tail > nb->end)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "put out of the packet range.");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "put out of the packet range.");
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t grub_netbuff_unput (struct grub_net_buff *net_buff ,grub_size_t len)
|
grub_err_t grub_netbuff_unput (struct grub_net_buff *nb ,grub_size_t len)
|
||||||
{
|
{
|
||||||
net_buff->tail -= len;
|
nb->tail -= len;
|
||||||
if (net_buff->tail < net_buff->head)
|
if (nb->tail < nb->head)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "unput out of the packet range.");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "unput out of the packet range.");
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t grub_netbuff_push (struct grub_net_buff *net_buff ,grub_size_t len)
|
grub_err_t grub_netbuff_push (struct grub_net_buff *nb ,grub_size_t len)
|
||||||
{
|
{
|
||||||
net_buff->data -= len;
|
nb->data -= len;
|
||||||
if (net_buff->data < net_buff->head)
|
if (nb->data < nb->head)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "push out of the packet range.");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "push out of the packet range.");
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t grub_netbuff_pull (struct grub_net_buff *net_buff ,grub_size_t len)
|
grub_err_t grub_netbuff_pull (struct grub_net_buff *nb ,grub_size_t len)
|
||||||
{
|
{
|
||||||
net_buff->data += len;
|
nb->data += len;
|
||||||
if (net_buff->data > net_buff->end)
|
if (nb->data > nb->end)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "pull out of the packet range.");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "pull out of the packet range.");
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t grub_netbuff_reserve (struct grub_net_buff *net_buff ,grub_size_t len)
|
grub_err_t grub_netbuff_reserve (struct grub_net_buff *nb ,grub_size_t len)
|
||||||
{
|
{
|
||||||
net_buff->data += len;
|
nb->data += len;
|
||||||
net_buff->tail += len;
|
nb->tail += len;
|
||||||
if ((net_buff->tail > net_buff->end) || (net_buff->data > net_buff->end))
|
if ((nb->tail > nb->end) || (nb->data > nb->end))
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "reserve out of the packet range.");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "reserve out of the packet range.");
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -73,22 +73,23 @@ struct grub_net_buff *grub_netbuff_alloc ( grub_size_t len )
|
||||||
|
|
||||||
len = ALIGN_UP (len,NETBUFF_ALIGN);
|
len = ALIGN_UP (len,NETBUFF_ALIGN);
|
||||||
data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb));
|
data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb));
|
||||||
|
if (!data)
|
||||||
|
return NULL;
|
||||||
nb = (struct grub_net_buff *) ((grub_uint8_t *) data + len);
|
nb = (struct grub_net_buff *) ((grub_uint8_t *) data + len);
|
||||||
nb->head = nb->data = nb->tail = data;
|
nb->head = nb->data = nb->tail = data;
|
||||||
nb->end = (char *) nb;
|
nb->end = (char *) nb;
|
||||||
|
|
||||||
return nb;
|
return nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t grub_netbuff_free (struct grub_net_buff *net_buff)
|
grub_err_t grub_netbuff_free (struct grub_net_buff *nb)
|
||||||
{
|
{
|
||||||
grub_free (net_buff->head);
|
grub_free (nb->head);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t grub_netbuff_clear (struct grub_net_buff *net_buff)
|
grub_err_t grub_netbuff_clear (struct grub_net_buff *nb)
|
||||||
{
|
{
|
||||||
net_buff->data = net_buff->tail = net_buff->head;
|
nb->data = nb->tail = nb->head;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue