mirror of https://github.com/FDOS/kernel.git
Move the ddt bitfields to df_descflags. Let SetLogDev call GetLogdev,
eliminating common code. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@868 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
5d712fc2a6
commit
7eb9514377
|
@ -242,8 +242,6 @@ typedef struct ddtstruct {
|
|||
ULONG ddt_serialno; /* serial number */
|
||||
UBYTE ddt_fstype[9]; /* ASCIIZ filesystem type ("FAT12 " or "FAT16 ") */
|
||||
ULONG ddt_offset; /* relative partition offset */
|
||||
BITS ddt_LBASupported:1; /* set, if INT13 extensions enabled */
|
||||
BITS ddt_WriteVerifySupported:1;
|
||||
} ddt;
|
||||
|
||||
/* description flag bits */
|
||||
|
@ -257,6 +255,9 @@ typedef struct ddtstruct {
|
|||
#define DF_DPCHANGED 0x080
|
||||
#define DF_REFORMAT 0x100
|
||||
#define DF_NOACCESS 0x200
|
||||
/* freedos specific flag bits */
|
||||
#define DF_LBA 0x400
|
||||
#define DF_WRTVERIFY 0x800
|
||||
|
||||
/* typedef struct ddtstruct ddt;*/
|
||||
|
||||
|
|
26
kernel/dsk.c
26
kernel/dsk.c
|
@ -317,25 +317,13 @@ STATIC WORD Getlogdev(rqptr rp, ddt * pddt)
|
|||
|
||||
STATIC WORD Setlogdev(rqptr rp, ddt * pddt)
|
||||
{
|
||||
int i;
|
||||
ddt *pddt2 = getddt(0);
|
||||
|
||||
if (!(pddt->ddt_descflags & DF_MULTLOG)) {
|
||||
rp->r_unit = 0;
|
||||
unsigned char unit = rp->r_unit;
|
||||
Getlogdev(rp, pddt);
|
||||
if (rp->r_unit == 0)
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
for (i = 0; i < blk_dev.dh_name[0]; i++, pddt2++)
|
||||
{
|
||||
if (pddt->ddt_driveno == pddt2->ddt_driveno &&
|
||||
(pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) ==
|
||||
(DF_MULTLOG | DF_CURLOG))
|
||||
break;
|
||||
}
|
||||
|
||||
pddt2->ddt_descflags &= ~DF_CURLOG;
|
||||
(&(getddt(0))[rp->r_unit - 1])->ddt_descflags &= ~DF_CURLOG;
|
||||
pddt->ddt_descflags |= DF_CURLOG;
|
||||
rp->r_unit++;
|
||||
rp->r_unit = unit + 1;
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
|
@ -995,7 +983,7 @@ STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
|||
|
||||
for (num_retries = 0; num_retries < N_RETRY; num_retries++)
|
||||
{
|
||||
if (pddt->ddt_LBASupported && mode != LBA_FORMAT)
|
||||
if ((pddt->ddt_descflags & DF_LBA) && mode != LBA_FORMAT)
|
||||
{
|
||||
dap.number_of_blocks = count;
|
||||
|
||||
|
@ -1006,7 +994,7 @@ STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
|||
|
||||
/* Load the registers and call the interrupt. */
|
||||
|
||||
if (pddt->ddt_WriteVerifySupported || mode != LBA_WRITE_VERIFY)
|
||||
if ((pddt->ddt_descflags & DF_WRTVERIFY) || mode != LBA_WRITE_VERIFY)
|
||||
{
|
||||
error_code = fl_lba_ReadWrite(pddt->ddt_driveno, mode, &dap);
|
||||
}
|
||||
|
|
|
@ -243,8 +243,7 @@ struct _bios_LBA_disk_parameterS {
|
|||
|
||||
struct DriveParamS {
|
||||
UBYTE driveno; /* = 0x8x */
|
||||
BITS LBA_supported:1; /* set, if INT13 extensions enabled */
|
||||
BITS WriteVerifySupported:1; /* */
|
||||
UWORD descflags;
|
||||
ULONG total_sectors;
|
||||
|
||||
struct CHS chs; /* for normal INT 13 */
|
||||
|
@ -584,17 +583,16 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
|||
pddt->ddt_next = MK_FP(0, 0xffff);
|
||||
pddt->ddt_driveno = driveParam->driveno;
|
||||
pddt->ddt_logdriveno = nUnits;
|
||||
pddt->ddt_LBASupported = driveParam->LBA_supported;
|
||||
pddt->ddt_descflags |= driveParam->descflags;
|
||||
/* Turn of LBA if not forced and the partition is within 1023 cyls and of the right type */
|
||||
/* the FileSystem type was internally converted to LBA_xxxx if a non-LBA partition
|
||||
above cylinder 1023 was found */
|
||||
if (!InitKernelConfig.ForceLBA && !ExtLBAForce && !IsLBAPartition(pEntry->FileSystem))
|
||||
pddt->ddt_LBASupported = FALSE;
|
||||
pddt->ddt_WriteVerifySupported = driveParam->WriteVerifySupported;
|
||||
pddt->ddt_descflags &= ~DF_LBA;
|
||||
pddt->ddt_ncyl = driveParam->chs.Cylinder;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (pddt->ddt_LBASupported)
|
||||
if (pddt->ddt_descflags & DF_LBA)
|
||||
DebugPrintf(("LBA enabled for drive %c:\n", 'A' + nUnits));
|
||||
#endif
|
||||
|
||||
|
@ -658,7 +656,7 @@ int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam)
|
|||
if (driveParam->driveno)
|
||||
return driveParam->driveno;
|
||||
|
||||
driveParam->LBA_supported = FALSE;
|
||||
driveParam->descflags = 0;
|
||||
|
||||
drive |= 0x80;
|
||||
|
||||
|
@ -727,18 +725,13 @@ int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam)
|
|||
goto StandardBios;
|
||||
}
|
||||
|
||||
if (lba_bios_parameters.information & 8)
|
||||
{
|
||||
driveParam->WriteVerifySupported = 1;
|
||||
}
|
||||
else
|
||||
driveParam->WriteVerifySupported = 0;
|
||||
|
||||
driveParam->total_sectors = lba_bios_parameters.totalSect;
|
||||
|
||||
/* if we arrive here, success */
|
||||
driveParam->LBA_supported = TRUE;
|
||||
|
||||
driveParam->descflags = DF_LBA;
|
||||
if (lba_bios_parameters.information & 8)
|
||||
driveParam->descflags |= DF_WRTVERIFY;
|
||||
|
||||
StandardBios: /* old way to get parameters */
|
||||
|
||||
regs.a.b.h = 0x08;
|
||||
|
@ -759,7 +752,7 @@ StandardBios: /* old way to get parameters */
|
|||
printf("BIOS reported 0 sectors/track, assuming 63!\n");
|
||||
}
|
||||
|
||||
if (!driveParam->LBA_supported)
|
||||
if (!(driveParam->descflags & DF_LBA))
|
||||
{
|
||||
driveParam->total_sectors =
|
||||
min(driveParam->chs.Cylinder, 1023)
|
||||
|
@ -904,7 +897,7 @@ BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type,
|
|||
if (chs.Cylinder > 1023 || end.Cylinder > 1023)
|
||||
{
|
||||
|
||||
if (!driveParam->LBA_supported)
|
||||
if (!(driveParam->descflags & DF_LBA))
|
||||
{
|
||||
printf
|
||||
("can't use LBA partition without LBA support - part %s FS %02x",
|
||||
|
@ -990,7 +983,7 @@ int Read1LBASector(struct DriveParamS *driveParam, unsigned drive,
|
|||
for (num_retries = 0; num_retries < N_RETRY; num_retries++)
|
||||
{
|
||||
regs.d.b.l = drive | 0x80;
|
||||
if (driveParam->LBA_supported)
|
||||
if (driveParam->descflags & DF_LBA)
|
||||
{
|
||||
dap.number_of_blocks = 1;
|
||||
dap.buffer_address = buffer;
|
||||
|
@ -1281,7 +1274,6 @@ void ReadAllPartitionTables(void)
|
|||
pddt->ddt_logdriveno = Unit;
|
||||
pddt->ddt_type = init_getdriveparm(0, &pddt->ddt_defbpb);
|
||||
pddt->ddt_ncyl = (pddt->ddt_type & 7) ? 80 : 40;
|
||||
pddt->ddt_LBASupported = FALSE;
|
||||
pddt->ddt_descflags = init_readdasd(0);
|
||||
|
||||
pddt->ddt_offset = 0l;
|
||||
|
|
Loading…
Reference in New Issue