Save ~100 bytes by replacing s->sft_flags with flags,

s->sft_dev->dh_attr with attr and simplifying the if() statement a bit


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@757 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-01-26 19:43:06 +00:00
parent eecbe8439a
commit 44e4319e93
1 changed files with 15 additions and 13 deletions

View File

@ -85,13 +85,16 @@ COUNT DosDevIOctl(lregs * r)
return DE_INVLDHNDL; return DE_INVLDHNDL;
switch (r->AL) switch (r->AL)
{ {
unsigned attr = s->sft_dev->dh_attr;
unsigned flags = s->sft_flags;
case 0x00: case 0x00:
/* Get the flags from the SFT */ /* Get the flags from the SFT */
if (s->sft_flags & SFT_FDEVICE) if (flags & SFT_FDEVICE)
r->AX = (s->sft_dev->dh_attr & 0xff00) | s->sft_flags_lo; r->AX = (attr & 0xff00) | (flags & 0xff);
else else
r->AX = s->sft_flags; r->AX = flags;
/* Undocumented result, Ax = Dx seen using Pcwatch */ /* Undocumented result, Ax = Dx seen using Pcwatch */
r->DX = r->AX; r->DX = r->AX;
break; break;
@ -99,7 +102,7 @@ COUNT DosDevIOctl(lregs * r)
case 0x01: case 0x01:
/* sft_flags is a file, return an error because you */ /* sft_flags is a file, return an error because you */
/* can't set the status of a file. */ /* can't set the status of a file. */
if (!(s->sft_flags & SFT_FDEVICE)) if (!(flags & SFT_FDEVICE))
return DE_INVLDFUNC; return DE_INVLDFUNC;
/* Set it to what we got in the DL register from the */ /* Set it to what we got in the DL register from the */
@ -116,7 +119,7 @@ COUNT DosDevIOctl(lregs * r)
goto IoCharCommon; goto IoCharCommon;
case 0x06: case 0x06:
if (s->sft_flags & SFT_FDEVICE) if (flags & SFT_FDEVICE)
{ {
nMode = C_ISTAT; nMode = C_ISTAT;
goto IoCharCommon; goto IoCharCommon;
@ -125,7 +128,7 @@ COUNT DosDevIOctl(lregs * r)
break; break;
case 0x07: case 0x07:
if (s->sft_flags & SFT_FDEVICE) if (flags & SFT_FDEVICE)
{ {
nMode = C_OSTAT; nMode = C_OSTAT;
goto IoCharCommon; goto IoCharCommon;
@ -134,7 +137,7 @@ COUNT DosDevIOctl(lregs * r)
break; break;
case 0x0a: case 0x0a:
r->DX = s->sft_flags; r->DX = flags;
r->AX = 0; r->AX = 0;
break; break;
@ -145,12 +148,11 @@ COUNT DosDevIOctl(lregs * r)
case 0x10: case 0x10:
nMode = C_IOCTLQRY; nMode = C_IOCTLQRY;
IoCharCommon: IoCharCommon:
if ((s->sft_flags & SFT_FDEVICE) && if ((flags & SFT_FDEVICE) &&
( ((r->AL == 0x02) && (s->sft_dev->dh_attr & SFT_FIOCTL)) ( ((r->AL == 0x02 || r->AL == 0x03) && (attr & ATTR_IOCTL))
|| ((r->AL == 0x03) && (s->sft_dev->dh_attr & SFT_FIOCTL))
|| r->AL == 0x06 || r->AL == 0x07 || r->AL == 0x06 || r->AL == 0x07
|| ((r->AL == 0x10) && (s->sft_dev->dh_attr & ATTR_QRYIOCTL)) || ((r->AL == 0x10) && (attr & ATTR_QRYIOCTL))
|| ((r->AL == 0x0c) && (s->sft_dev->dh_attr & ATTR_GENIOCTL)))) || ((r->AL == 0x0c) && (attr & ATTR_GENIOCTL))))
{ {
CharReqHdr.r_unit = 0; CharReqHdr.r_unit = 0;
CharReqHdr.r_command = nMode; CharReqHdr.r_command = nMode;