Crash recovery changes.
This commit is contained in:
parent
ad1f30a63f
commit
589e147ee3
2 changed files with 60 additions and 3 deletions
|
@ -62,6 +62,7 @@
|
|||
|
||||
static dpeth_t de_table[DE_PORT_NR];
|
||||
static u16_t eth_ign_proto;
|
||||
static char *progname;
|
||||
|
||||
/* Configuration */
|
||||
typedef struct dp_conf
|
||||
|
@ -111,6 +112,7 @@ _PROTOTYPE( static void do_vread, (message *mp, int vectored) );
|
|||
_PROTOTYPE( static void do_init, (message *mp) );
|
||||
_PROTOTYPE( static void do_int, (dpeth_t *dep) );
|
||||
_PROTOTYPE( static void do_getstat, (message *mp) );
|
||||
_PROTOTYPE( static void do_getname, (message *mp) );
|
||||
_PROTOTYPE( static void do_stop, (message *mp) );
|
||||
_PROTOTYPE( static void dp_init, (dpeth_t *dep) );
|
||||
_PROTOTYPE( static void dp_confaddr, (dpeth_t *dep) );
|
||||
|
@ -169,10 +171,17 @@ _PROTOTYPE( static void do_vir_outsw, (port_t port, int proc,
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
message m;
|
||||
int i, irq, r;
|
||||
int i, irq, r, tasknr;
|
||||
dpeth_t *dep;
|
||||
long v;
|
||||
|
||||
if (argc < 1)
|
||||
{
|
||||
panic("DP8390",
|
||||
"A head which at this time has no name", NO_NUM);
|
||||
}
|
||||
(progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]);
|
||||
|
||||
env_setargs(argc, argv);
|
||||
|
||||
for (i= 0, dep= de_table; i<DE_PORT_NR; i++, dep++)
|
||||
|
@ -185,6 +194,11 @@ int main(int argc, char *argv[])
|
|||
(void) env_parse("ETH_IGN_PROTO", "x", 0, &v, 0x0000L, 0xFFFFL);
|
||||
eth_ign_proto= htons((u16_t) v);
|
||||
|
||||
/* Try to notify inet that we are present (again) */
|
||||
r = findproc("inet", &tasknr);
|
||||
if (r == OK)
|
||||
notify(tasknr);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
if ((r= receive(ANY, &m)) != OK)
|
||||
|
@ -199,6 +213,7 @@ int main(int argc, char *argv[])
|
|||
case DL_READV: do_vread(&m, TRUE); break;
|
||||
case DL_INIT: do_init(&m); break;
|
||||
case DL_GETSTAT: do_getstat(&m); break;
|
||||
case DL_GETNAME: do_getname(&m); break;
|
||||
case DL_STOP: do_stop(&m); break;
|
||||
case HARD_INT:
|
||||
for (i= 0, dep= &de_table[0]; i<DE_PORT_NR; i++, dep++)
|
||||
|
@ -644,6 +659,22 @@ message *mp;
|
|||
reply(dep, OK, FALSE);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_getname *
|
||||
*===========================================================================*/
|
||||
static void do_getname(mp)
|
||||
message *mp;
|
||||
{
|
||||
int r;
|
||||
|
||||
strncpy(mp->DL_NAME, progname, sizeof(mp->DL_NAME));
|
||||
mp->DL_NAME[sizeof(mp->DL_NAME)-1]= '\0';
|
||||
mp->m_type= DL_NAME_REPLY;
|
||||
r= send(mp->m_source, mp);
|
||||
if (r != OK)
|
||||
panic("dp8390", "do_getname: send failed: %d\n", r);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_stop *
|
||||
*===========================================================================*/
|
||||
|
@ -1861,7 +1892,7 @@ void *loc_addr;
|
|||
u8_t inb(port_t port)
|
||||
{
|
||||
int r;
|
||||
u8_t value;
|
||||
u32_t value;
|
||||
|
||||
r= sys_inb(port, &value);
|
||||
if (r != OK)
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
*/
|
||||
extern int errno;
|
||||
static dpeth_t de_table[DE_PORT_NR];
|
||||
static char *progname;
|
||||
|
||||
typedef struct dp_conf { /* Configuration description structure */
|
||||
port_t dpc_port;
|
||||
|
@ -87,6 +88,8 @@ static const char SizeErrMsg[] = "illegal packet size";
|
|||
static const char TypeErrMsg[] = "illegal message type";
|
||||
static const char DevName[] = "eth#?";
|
||||
|
||||
static void do_getname(message *mp);
|
||||
|
||||
/*
|
||||
** Name: void reply(dpeth_t *dep, int err)
|
||||
** Function: Fills a DL_TASK_REPLY reply message and sends it.
|
||||
|
@ -502,6 +505,19 @@ static void do_getstat(message * mp)
|
|||
return;
|
||||
}
|
||||
|
||||
static void do_getname(mp)
|
||||
message *mp;
|
||||
{
|
||||
int r;
|
||||
|
||||
strncpy(mp->DL_NAME, progname, sizeof(mp->DL_NAME));
|
||||
mp->DL_NAME[sizeof(mp->DL_NAME)-1]= '\0';
|
||||
mp->m_type= DL_NAME_REPLY;
|
||||
r= send(mp->m_source, mp);
|
||||
if (r != OK)
|
||||
panic("dpeth", "do_getname: send failed: %d\n", r);
|
||||
}
|
||||
|
||||
/*
|
||||
** Name: void do_stop(message *mp)
|
||||
** Function: Stops network interface.
|
||||
|
@ -541,7 +557,9 @@ PUBLIC int main(int argc, char **argv)
|
|||
{
|
||||
message m;
|
||||
dpeth_t *dep;
|
||||
int rc, fkeys, sfkeys;
|
||||
int rc, fkeys, sfkeys, tasknr;
|
||||
|
||||
(progname=strrchr(argv[0],'/')) ? progname++ : (progname=argv[0]);
|
||||
|
||||
env_setargs(argc, argv);
|
||||
|
||||
|
@ -560,6 +578,11 @@ PUBLIC int main(int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Try to notify inet that we are present (again) */
|
||||
rc = findproc("inet", &tasknr);
|
||||
if (rc == OK)
|
||||
notify(tasknr);
|
||||
|
||||
while (TRUE) {
|
||||
if ((rc = receive(ANY, &m)) != OK) panic(dep->de_name, RecvErrMsg, rc);
|
||||
|
||||
|
@ -587,6 +610,9 @@ PUBLIC int main(int argc, char **argv)
|
|||
case DL_GETSTAT: /* Get device statistics */
|
||||
do_getstat(&m);
|
||||
break;
|
||||
case DL_GETNAME:
|
||||
do_getname(&m);
|
||||
break;
|
||||
case SYN_ALARM: /* to be defined */
|
||||
do_watchdog(&m);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue