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
This commit is contained in:
Kenneth J Davis 2004-12-19 22:16:40 +00:00
parent e90387e6dd
commit 4de23bcebf
2 changed files with 11 additions and 4 deletions

View File

@ -1443,7 +1443,8 @@ STATIC BOOL LoadDevice(PCStr p, VFP top, int mode)
do do
{ {
struct dhdr FAR *dhp = MK_PTR(struct dhdr, base, next); 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; break;
next = FP_OFF(dhp->dh_next); next = FP_OFF(dhp->dh_next);

View File

@ -478,6 +478,7 @@ BOOL init_device(struct dhdr FAR * dhp, PCStr cmdLine, int mode, VFP *r_top)
if (r_top) if (r_top)
{ {
/* Don't link in device drivers which do not take up memory */ /* 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) if (rq.r_endaddr == (BYTE FAR *) dhp)
return TRUE; 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; *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; if (rq.r_nunits) /* if unit count is nonzero */
update_dcb(dhp); {
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) if (dhp->dh_attr & ATTR_CONIN)