From 4de23bcebfe5dd3beb7b76ea71cc78cc1dbce5b1 Mon Sep 17 00:00:00 2001 From: Kenneth J Davis Date: Sun, 19 Dec 2004 22:16:40 +0000 Subject: [PATCH] handle block drivers that indicate load failure just by returning units = 0 git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1074 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/config.c | 3 ++- kernel/main.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/config.c b/kernel/config.c index 4541eaf..48ea048 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -1443,7 +1443,8 @@ STATIC BOOL LoadDevice(PCStr p, VFP top, int mode) do { struct dhdr FAR *dhp = MK_PTR(struct dhdr, base, next); - if ((ret = init_device(dhp, szBuf, mode, &top)) != SUCCESS) + /* init_device returns FALSE on SUCCESS, TRUE otherwise */ + if ((ret = init_device(dhp, szBuf, mode, &top))) break; next = FP_OFF(dhp->dh_next); diff --git a/kernel/main.c b/kernel/main.c index 714354e..ca2b4d2 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -478,6 +478,7 @@ BOOL init_device(struct dhdr FAR * dhp, PCStr cmdLine, int mode, VFP *r_top) if (r_top) { /* Don't link in device drivers which do not take up memory */ + /* ie device drivers that fail to load and return top==CS:0 */ if (rq.r_endaddr == (BYTE FAR *) dhp) return TRUE; @@ -530,10 +531,15 @@ BOOL init_device(struct dhdr FAR * dhp, PCStr cmdLine, int mode, VFP *r_top) *r_top = rq.r_endaddr; } - if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0)) + if (!(dhp->dh_attr & ATTR_CHAR)) /* if block device (not character) */ { - dhp->dh_name[0] = rq.r_nunits; - update_dcb(dhp); + if (rq.r_nunits) /* if unit count is nonzero */ + { + dhp->dh_name[0] = rq.r_nunits; + update_dcb(dhp); + } + else /* returned unit count of 0, indication of load failure */ + return TRUE; } if (dhp->dh_attr & ATTR_CONIN)