Show info about net devices in loader's 'lsdev' command. While there fix style.

This commit is contained in:
Rafal Jaworowski 2008-09-03 17:41:44 +00:00
parent 09c7f9e338
commit 387a29b78d
2 changed files with 182 additions and 169 deletions

View File

@ -103,7 +103,8 @@ struct devsw netdev = {
int int
net_init(void) net_init(void)
{ {
return 0;
return (0);
} }
/* /*
@ -151,10 +152,8 @@ net_open(struct open_file *f, ...)
} }
int int
net_close(f) net_close(struct open_file *f)
struct open_file *f;
{ {
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) if (debug)
printf("net_close: opens=%d\n", netdev_opens); printf("net_close: opens=%d\n", netdev_opens);
@ -182,7 +181,8 @@ net_close(f)
int int
net_strategy() net_strategy()
{ {
return EIO;
return (EIO);
} }
#define SUPPORT_BOOTP #define SUPPORT_BOOTP
@ -205,8 +205,7 @@ int try_bootp = 1;
extern n_long ip_convertaddr(char *p); extern n_long ip_convertaddr(char *p);
static int static int
net_getparams(sock) net_getparams(int sock)
int sock;
{ {
char buf[MAXHOSTNAMELEN]; char buf[MAXHOSTNAMELEN];
char temp[FNAME_SIZE]; char temp[FNAME_SIZE];
@ -306,5 +305,18 @@ net_getparams(sock)
static void static void
net_print(int verbose) net_print(int verbose)
{ {
return; struct netif_driver *drv;
int i, d, cnt;
cnt = 0;
for (d = 0; netif_drivers[d]; d++) {
drv = netif_drivers[d];
for (i = 0; i < drv->netif_nifs; i++) {
printf("\t%s%d:", "net", cnt++);
if (verbose)
printf(" (%s%d)", drv->netif_bname,
drv->netif_ifs[i].dif_unit);
}
}
printf("\n");
} }

View File

@ -59,6 +59,7 @@ devopen(struct open_file *f, const char *fname, const char **file)
int int
devclose(struct open_file *f) devclose(struct open_file *f)
{ {
if (f->f_devdata != NULL) { if (f->f_devdata != NULL) {
free(f->f_devdata); free(f->f_devdata);
} }