Commit 07af6f46 authored by Ben Avison's avatar Ben Avison
Browse files

Fix setting disc name for DOS discs

Admin:
  Changes received from Willi Theiss

Version 0.94. Tagged as 'DOSFS-0_94'
parent e953aae0
/* (0.93)
/* (0.94)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.93
#define Module_MajorVersion_CMHG 0.94
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 Jul 2012
#define Module_Date_CMHG 06 Aug 2012
#define Module_MajorVersion "0.93"
#define Module_Version 93
#define Module_MajorVersion "0.94"
#define Module_Version 94
#define Module_MinorVersion ""
#define Module_Date "23 Jul 2012"
#define Module_Date "06 Aug 2012"
#define Module_ApplicationDate "23-Jul-12"
#define Module_ApplicationDate "06-Aug-12"
#define Module_ComponentName "DOSFS"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/ImageFS/DOSFS"
#define Module_FullVersion "0.93"
#define Module_HelpVersion "0.93 (23 Jul 2012)"
#define Module_LibraryVersionInfo "0:93"
#define Module_FullVersion "0.94"
#define Module_HelpVersion "0.94 (06 Aug 2012)"
#define Module_LibraryVersionInfo "0:94"
......@@ -24,7 +24,7 @@
#include "kernel.h"
#include "swis.h"
#include "ctype.h"
#include "debuglib/debuglib.h"
#include "DebugLib/DebugLib.h"
#undef DOSFS_DiscFormat
#undef DOSFS_LayoutStructure
......@@ -42,7 +42,7 @@
#include "DOSFSops.h"
#include "MultiFS.h"
#include "wcompare.h"
#include "BOOTBLOCK.h" /* for the default BOOT BLOCK structure */
#include "BOOTblock.h" /* for the default BOOT BLOCK structure */
#include "TIMEconv.h" /* for format time-stamping */
#include "MsgTrans.h"
#include "Statics.h"
......@@ -263,6 +263,15 @@ static int testforbpb(ADFS_drecord *dr,char *sector,bool floppy,
/* There's an extended FAT32 boot record,note the volume id */
*volumeid = (bblock->BOOT_extra.fat32.VolID0 | (bblock->BOOT_extra.fat32.VolID1 << 8) |
(bblock->BOOT_extra.fat32.VolID2 << 16) | (bblock->BOOT_extra.fat32.VolID3 << 24));
/* use correct ROOTsize */
if (0 == *ROOTsize)
*ROOTsize = cluster_size(bblock);
/* .. and also correct FAT size */
if (0 == *FATsize)
{
*FATsize = (bblock->BOOT_extra.fat32.FAT_sz0 | (bblock->BOOT_extra.fat32.FAT_sz1<<8) |
(bblock->BOOT_extra.fat32.FAT_sz2<<16) | (bblock->BOOT_extra.fat32.FAT_sz3<<24)) * DOSsecsize;
}
}
discsize(dr) = bbsize; /* Use bbsize incase FileCore was guessing discSize */
heads(dr) = noSides;
......@@ -362,14 +371,24 @@ static int testforpartition(ADFS_drecord *dr,char *sector,_kernel_swi_regs *rset
/* There's an extended FAT32 boot record,note the volume id */
*volumeid = (bblock->BOOT_extra.fat32.VolID0 | (bblock->BOOT_extra.fat32.VolID1 << 8) |
(bblock->BOOT_extra.fat32.VolID2 << 16) | (bblock->BOOT_extra.fat32.VolID3 << 24));
/* use correct ROOTsize */
if (0 == *ROOTsize)
{
*ROOTsize = cluster_size(bblock);
}
/* .. and also correct FAT size */
if (0 == *FATsize)
{
*FATsize = (bblock->BOOT_extra.fat32.FAT_sz0 | (bblock->BOOT_extra.fat32.FAT_sz1<<8) |
(bblock->BOOT_extra.fat32.FAT_sz2<<16) | (bblock->BOOT_extra.fat32.FAT_sz3<<24)) * DOSsecsize;
}
}
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;
UNUSED(notracks);
tracef6("DOSFS: testforpartition %d %x %x %d %d %x\n",
(int)*magic,(int)*ROOTsize,(int)*FATsize,(int)*numFATs,(int)*numRESVD,bbsize);
dprintf(("","DOSFS: testforpartition %d %x %x %d %d %x\n",(int)*magic,(int)*ROOTsize,(int)*FATsize,(int)*numFATs,(int)*numRESVD,bbsize));
return 0;
}
......@@ -541,12 +560,12 @@ static void validatedosformat(ADFS_drecord *dr,_kernel_swi_regs *rset)
if (discopswi==FileCore_DiscOp)
{
urset.r[1] = ((floppy ? 9 : 1) | (4 << 4) | (((int)dr >> 2) << 8)) ;
urset.r[2] = (index + DOSsecsize + winioffset) | (dr->dr_rootSIN & 0xE0000000); /* disc address */
urset.r[2] = (index + numRESVD * DOSsecsize + winioffset) | (dr->dr_rootSIN & 0xE0000000); /* disc address */
}
else
{
/* rely on r2 being preserved,and the drive number in the block */
opblock.byteaddresslo = index + DOSsecsize + winioffset;
opblock.byteaddresslo = index + numRESVD * DOSsecsize + winioffset;
opblock.byteaddresshi = 0;
urset.r[1] = ((floppy ? 9 : 1) | (4 << 4)); /* Read uncached for fixed discs */
urset.r[5] = (int)dr;
......@@ -609,12 +628,12 @@ static void validatedosformat(ADFS_drecord *dr,_kernel_swi_regs *rset)
{
/* sector cache handle and FileCore private word pointer preserved from above call */
urset.r[1] = ((floppy ? 9 : 1) | (4 << 4) | (((int)dr >> 2) << 8)) ;
urset.r[2] = ((numFATs * FATsize) + loop + DOSsecsize + winioffset) | (dr->dr_rootSIN & 0xE0000000) ; /* disc address */
urset.r[2] = ((numFATs * FATsize) + loop + numRESVD * DOSsecsize + winioffset) | (dr->dr_rootSIN & 0xE0000000) ; /* disc address */
}
else
{
/* rely on r1 and r2 being preserved,and the drive number in the block*/
opblock.byteaddresslo = (numFATs * FATsize) + loop + DOSsecsize + winioffset;
opblock.byteaddresslo = (numFATs * FATsize) + loop + numRESVD * DOSsecsize + winioffset;
opblock.byteaddresshi = 0;
urset.r[5] = (int)dr;
}
......@@ -1626,6 +1645,7 @@ _kernel_oserror *init_fs(const char *cmd_tail,int podule_base,void *privateword)
/* set up debugging */
debug_initialise ("DOSFS", "", 0);
debug_set_device(DEBUGIT_OUTPUT);
// debug_set_device(HAL_OUTPUT);
// debug_set_device(PRINTF_OUTPUT);
debug_set_unbuffered_files (TRUE);
debug_set_stamp_debug (TRUE);
......
......@@ -36,7 +36,7 @@
#include "kernel.h"
#include "swis.h"
#include "Interface/MimeMap.h"
#include "debuglib/debuglib.h"
#include "DebugLib/DebugLib.h"
#include "ASCII.h"
#include "debug.h"
......@@ -4668,7 +4668,14 @@ int DOSFS_namedisc(char *newname,DOSdisc *ihand)
/* Load the ROOT directory */
if ((int)(dirstruct = loadDIR("", ihand)) < 0)
return -1;
rootdir = dirstruct->dir_entries;
rootdir = (DOS_direntry*)DI_Base(dirstruct) ;
/* check ROOTsize (could be wrong for FAT32) */
if (ROOTsize == 0)
{
ROOTsize = dirstruct->dir_size ;
rootsec = dirstruct->dir_sector ;
}
/* Search for a volume entry */
index = 0 ;
......@@ -4935,12 +4942,15 @@ word DOSFS_max_sect(DOS_bootsector *bb)
{
word max_sect = (bb->BOOT_max_sectHI << 8) | (bb->BOOT_max_sect);
dprintf(("","DOSFS_max_sect: boot block at &%08X, max_sect = %d\n",(int)bb,max_sect));
if (max_sect == 0)
{
max_sect = (bb->big_sect3 << 24) | (bb->big_sect2 << 16) |
(bb->big_sect1 << 8) | bb->big_sect;
}
if (max_sect != 0) return max_sect;
dprintf(("","DOSFS_max_sect: boot block at &%08X, max_sect = %d\n",(int)bb,max_sect));
return (bb->big_sect3 << 24) | (bb->big_sect2 << 16)
| (bb->big_sect1 << 8) | bb->big_sect;
return max_sect;
}
/*-------------------------------------------------------------------------*/
......
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