fix several bugs
This commit is contained in:
parent
48ac061ab6
commit
eea841440d
10 changed files with 89 additions and 90 deletions
|
@ -26,7 +26,7 @@ send_card_buffer (struct grub_net_card *dev __attribute__ ((unused)),
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_size_t
|
||||
static grub_ssize_t
|
||||
get_card_packet (struct grub_net_card *dev __attribute__ ((unused)),
|
||||
struct grub_net_buff *pack)
|
||||
{
|
||||
|
@ -35,10 +35,7 @@ get_card_packet (struct grub_net_card *dev __attribute__ ((unused)),
|
|||
grub_netbuff_clear(pack);
|
||||
actual = read (fd, pack->data, 1500);
|
||||
if (actual < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_IO, "couldn't receive packets");
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
grub_netbuff_put (pack, actual);
|
||||
|
||||
return actual;
|
||||
|
@ -65,7 +62,6 @@ static struct grub_net_card emucard =
|
|||
GRUB_MOD_INIT(emunet)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
// char fullname[64];
|
||||
fd = open ("/dev/net/tun", O_RDWR | O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <grub/net/netbuff.h>
|
||||
#include <grub/net/ethernet.h>
|
||||
#include <grub/ieee1275/ofnet.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/dl.h>
|
||||
|
@ -49,7 +48,7 @@ send_card_buffer (struct grub_net_card *dev, struct grub_net_buff *pack)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
static grub_ssize_t
|
||||
get_card_packet (struct grub_net_card *dev, struct grub_net_buff *nb)
|
||||
{
|
||||
|
||||
|
@ -65,9 +64,9 @@ get_card_packet (struct grub_net_card *dev, struct grub_net_buff *nb)
|
|||
if (actual)
|
||||
{
|
||||
grub_netbuff_put (nb, actual);
|
||||
return grub_net_recv_ethernet_packet (nb);
|
||||
return actual;
|
||||
}
|
||||
return GRUB_ERR_TIMEOUT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct grub_net_card_driver ofdriver =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue