]> git.proxmox.com Git - grub2.git/commitdiff
Use nb in all function declarations for consistency.
authorManoel Rebelo Abranches <mrabran@br.ibm.com>
Fri, 1 Apr 2011 08:27:06 +0000 (05:27 -0300)
committerManoel Rebelo Abranches <mrabran@br.ibm.com>
Fri, 1 Apr 2011 08:27:06 +0000 (05:27 -0300)
grub-core/net/netbuff.c

index cc366ae09ec92ebc97d1729fa41bd617fcaf4810..be9fc9de214f9d74f17c21421492022e9608bc93 100644 (file)
 #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;
-  if (net_buff->tail > net_buff->end)
+  nb->tail += len;
+  if (nb->tail > nb->end)
     return grub_error (GRUB_ERR_OUT_OF_RANGE, "put out of the packet range.");
   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;
-  if (net_buff->tail < net_buff->head)
+  nb->tail -= len;
+  if (nb->tail < nb->head)
     return grub_error (GRUB_ERR_OUT_OF_RANGE, "unput out of the packet range.");
   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;
-  if (net_buff->data < net_buff->head)
+  nb->data -= len;
+  if (nb->data < nb->head)
     return grub_error (GRUB_ERR_OUT_OF_RANGE, "push out of the packet range.");
   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;
-  if (net_buff->data > net_buff->end)
+  nb->data += len;
+  if (nb->data > nb->end)
     return grub_error (GRUB_ERR_OUT_OF_RANGE, "pull out of the packet range.");
   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;
-  net_buff->tail += len;
-  if ((net_buff->tail > net_buff->end) || (net_buff->data > net_buff->end))
+  nb->data += len;
+  nb->tail += len;
+  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_ERR_NONE; 
 }
@@ -73,22 +73,23 @@ struct grub_net_buff *grub_netbuff_alloc ( grub_size_t len )
   
   len = ALIGN_UP (len,NETBUFF_ALIGN);
   data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb));
+  if (!data)
+    return NULL;
   nb = (struct grub_net_buff *) ((grub_uint8_t *) data + len); 
   nb->head = nb->data = nb->tail = data;
-  nb->end = (char *) nb; 
-  
+  nb->end = (char *) 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;
    
 }
 
-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;
 }