Commit b219d9c8 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

When a disc has no title but does have the extended boot sig and the volumeid...

When a disc has no title but does have the extended boot sig and the volumeid is non zero then the disc title will be set to %04X-%04X of the volumeid instead of "Untitled" which should cut down on ambiguous disc names a bit.

Version 0.78. Tagged as 'DOSFS-0_78'
parent 43d66052
/* (0.77)
/* (0.78)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
*
*/
#define Module_MajorVersion_CMHG 0.77
#define Module_MajorVersion_CMHG 0.78
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 26 Jun 2003
#define Module_Date_CMHG 25 Jul 2003
#define Module_MajorVersion "0.77"
#define Module_Version 77
#define Module_MajorVersion "0.78"
#define Module_Version 78
#define Module_MinorVersion ""
#define Module_Date "26 Jun 2003"
#define Module_Date "25 Jul 2003"
#define Module_ApplicationDate "26-Jun-03"
#define Module_ApplicationDate "25-Jul-03"
#define Module_ComponentName "DOSFS"
#define Module_ComponentPath "RiscOS/Sources/FileSys/ImageFS/DOSFS"
#define Module_FullVersion "0.77"
#define Module_HelpVersion "0.77 (26 Jun 2003)"
#define Module_LibraryVersionInfo "0:77"
#define Module_FullVersion "0.78"
#define Module_HelpVersion "0.78 (25 Jul 2003)"
#define Module_LibraryVersionInfo "0:78"
......@@ -201,7 +201,8 @@ static _kernel_oserror *FSSWI_DiscFormat(_kernel_swi_regs *rset,void *privatewor
}
static int testforbpb(ADFS_drecord *dr,char *sector,bool floppy,
int *numFATs,int *FATsize,int *magic,int *ROOTsize,int *Atari,int *dblstep,int *numRESVD)
int *numFATs,int *FATsize,int *magic,int *ROOTsize,
int *Atari,int *dblstep,int *numRESVD,word *volumeid)
{
DOS_bootsector *bblock = (DOS_bootsector *)sector;
int discSize, noSides;
......@@ -250,6 +251,12 @@ static int testforbpb(ADFS_drecord *dr,char *sector,bool floppy,
*Atari = (bblock->BOOT_JMP[0] == 0); /* No JMP means Atari */
*numRESVD = (bblock->BOOT_reserved | (bblock->BOOT_reservedHI << 8)) ;
*dblstep = ((notracks / noSides) == 40);
if (bblock->BOOT_extra.wini.sig_rec == 0x29)
{
/* There's an extended boot record,note the volume id */
*volumeid = (bblock->BOOT_extra.wini.volid | (bblock->BOOT_extra.wini.volid1 << 8) |
(bblock->BOOT_extra.wini.volid2 << 16) | (bblock->BOOT_extra.wini.volid3 << 24));
}
discsize(dr) = bbsize; /* Use bbsize incase FileCore was guessing discSize */
heads(dr) = noSides;
if (!floppy) secspertrk(dr) = (bblock->BOOT_secstrackHI << 8) | bblock->BOOT_secstrack;
......@@ -263,7 +270,8 @@ static int testforbpb(ADFS_drecord *dr,char *sector,bool floppy,
}
static int testforpartition(ADFS_drecord *dr,char *sector,_kernel_swi_regs *rset,word *winioffset,
int *numFATs,int *FATsize,int *magic,int *ROOTsize,int *Atari,int *dblstep,int *numRESVD)
int *numFATs,int *FATsize,int *magic,int *ROOTsize,
int *Atari,int *dblstep,int *numRESVD,word *volumeid)
{
DOS_bootsector *bblock = (DOS_bootsector *)sector;
_kernel_swi_regs urset ;
......@@ -336,6 +344,12 @@ static int testforpartition(ADFS_drecord *dr,char *sector,_kernel_swi_regs *rset
*Atari = 0; /* Never Atari */
*numRESVD = (bblock->BOOT_reserved | (bblock->BOOT_reservedHI << 8)) ;
*dblstep = 0; /* Never double step */
if (bblock->BOOT_extra.wini.sig_rec == 0x29)
{
/* There's an extended boot record,note the volume id */
*volumeid = (bblock->BOOT_extra.wini.volid | (bblock->BOOT_extra.wini.volid1 << 8) |
(bblock->BOOT_extra.wini.volid2 << 16) | (bblock->BOOT_extra.wini.volid3 << 24));
}
discsize(dr) = bbsize; /* Use bbsize incase FileCore was guessing discSize */
heads(dr) = 0; /* It's a harddisc */
secspertrk(dr) = (bblock->BOOT_secstrackHI << 8) | bblock->BOOT_secstrack;
......@@ -350,7 +364,8 @@ static int testforpartition(ADFS_drecord *dr,char *sector,_kernel_swi_regs *rset
}
static int testfor160360k(ADFS_drecord *dr,char *sector,bool floppy,
int *numFATs,int *FATsize,int *magic,int *ROOTsize,int *Atari,int *dblstep,int *numRESVD)
int *numFATs,int *FATsize,int *magic,int *ROOTsize,
int *Atari,int *dblstep,int *numRESVD)
{
/* If we have not claimed the disc then it could still be valid only if it is a 320K or
* 160K format, both of which have 8 sectors per track (these old formats need not have a
......@@ -397,7 +412,7 @@ static void validatedosformat(ADFS_drecord *dr,_kernel_swi_regs *rset)
int discID = 0;
char *buf = 0;
int bufsz = 0;
word winioffset = 0;
word winioffset = 0, volumeid = 0;
bool floppy = !((log2secsize(dr) == 0) || (dr->dr_floppy_density == 0) || (secspertrk(dr) == 0) || (heads(dr) == 0));
int loop, index, step;
......@@ -467,13 +482,16 @@ static void validatedosformat(ADFS_drecord *dr,_kernel_swi_regs *rset)
tracef0("DOSFS: validatedosformat: sector read OK\n");
/* See if the sector read contains a BPB */
if (testforbpb(dr,sector,floppy,&numFATs,&FATsize,&magic,&ROOTsize,&Atari,&dblstep,&numRESVD))
if (testforbpb(dr,sector,floppy,&numFATs,&FATsize,&magic,&ROOTsize,
&Atari,&dblstep,&numRESVD,&volumeid))
{
/* Crusty 160 & 360k floppies don't need one */
if (!floppy || testfor160360k(dr,sector,floppy,&numFATs,&FATsize,&magic,&ROOTsize,&Atari,&dblstep,&numRESVD))
if (!floppy || testfor160360k(dr,sector,floppy,&numFATs,&FATsize,&magic,&ROOTsize,
&Atari,&dblstep,&numRESVD))
{
/* Last ditch attempt scanning for partitions on harddiscs */
if (floppy || testforpartition(dr,sector,rset,&winioffset,&numFATs,&FATsize,&magic,&ROOTsize,&Atari,&dblstep,&numRESVD))
if (floppy || testforpartition(dr,sector,rset,&winioffset,&numFATs,&FATsize,&magic,&ROOTsize,
&Atari,&dblstep,&numRESVD,&volumeid))
{
free(sector);
tracef0("DOSFS: validatedosformat: shame,not a DOS disc\n");
......@@ -566,6 +584,9 @@ static void validatedosformat(ADFS_drecord *dr,_kernel_swi_regs *rset)
strncpy((char *)(dr->dr_discname), buf, bufsz);
dr->dr_discname[bufsz] = '\0';
/* A volume id is better than the default */
if (volumeid != 0) sprintf((char*)(dr->dr_discname),"%04X-%04X\0",(volumeid >> 16) & 0xFFFF,volumeid & 0xFFFF);
/* Try to find a volume label on the disc. */
for (loop = 0; loop < ROOTsize; loop+= DOSsecsize)
{
......
......@@ -220,7 +220,7 @@ typedef struct {
byte big_sect3 ;
byte driveno ; /* drive number */
byte unused ;
byte sig_rec ; /* external boot signature record (x29) */
byte sig_rec ; /* extended boot record signature (0x29) */
byte volid ; /* 32 bit volume id */
byte volid1 ;
byte volid2 ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment