Commit 95b10dd4 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Deleted some dead variables and switches.

Eliminated MOVS and R14 fiddling to achieve 32 bit compatibility
RISCOS Ltd made 3 changes in their sources
 - ensure disc titles don't contain rogue characters (added)
 - files with time,date,and reserved fields of zero appears as DEADDEAD
   which is silly since Winodws uses this to mark a file unstamped which
   isn't quite the same thing! (not added)
 - syslog debugging support (not added)

Version 0.69. Tagged as 'DOSFS-0_69'
parent 206ce85d
/* (0.68)
/* (0.69)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.63.
* Last processed by srccommit version: 1.68.
*
*/
#define Module_MajorVersion_CMHG 0.68
#define Module_MajorVersion_CMHG 0.69
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 03 May 2002
#define Module_Date_CMHG 22 Sep 2002
#define Module_MajorVersion "0.68"
#define Module_Version 68
#define Module_MajorVersion "0.69"
#define Module_Version 69
#define Module_MinorVersion ""
#define Module_Date "03 May 2002"
#define Module_Date "22 Sep 2002"
#define Module_ApplicationDate2 "03-May-02"
#define Module_ApplicationDate4 "03-May-2002"
#define Module_ApplicationDate2 "22-Sep-02"
#define Module_ApplicationDate4 "22-Sep-2002"
#define Module_ComponentName "DOSFS"
#define Module_ComponentPath "RiscOS/Sources/FileSys/ImageFS/DOSFS"
#define Module_FullVersion "0.68"
#define Module_HelpVersion "0.68 (03 May 2002)"
#define Module_LibraryVersionInfo "0:68"
#define Module_FullVersion "0.69"
#define Module_HelpVersion "0.69 (22 Sep 2002)"
#define Module_LibraryVersionInfo "0:69"
......@@ -14,7 +14,7 @@
*/
/*> c.DOSFS <*/
/*-------------------------------------------------------------------------*/
/* DOSFS (MultiFS support module) Copyright (c) 1990 JGSmith */
/* DOSFS (image filing system module) Copyright (c) 1990 JGSmith */
/*-------------------------------------------------------------------------*/
#include <stdio.h>
......@@ -24,10 +24,8 @@
#include "swis.h"
#include "ctype.h"
#if 1 /* SMC_FIX */
#undef DOSFS_DiscFormat
#undef DOSFS_LayoutStructure
#endif
#include "h.ASCII"
#include "h.DOSFS"
......@@ -205,7 +203,7 @@ static _kernel_oserror *declare_FS(void *privateword)
}
#endif
/* register our module as a MultiFS filing system support */
/* register our module as an image filing system */
/* "OS_FSControl" reason 35 */
infoblock[0] = (word)0x00000000 ; /* bit27 is only significant flag */
infoblock[1] = (word)imagetype ;
......@@ -814,9 +812,15 @@ void fs_service(int service_number,_kernel_swi_regs *rset,void *privateword)
if ((dentry = findDIRtype((byte)FILE_win95,(byte)FILE_volume,(DOS_direntry *)sector,DOSsecsize,&i)) != NULL) {
tracef0("DOSFS: Service_IdentifyDisc: volume label found\n") ;
memmove((void *)&(dr->dr_discname[0]),(void *)&(dentry->FILE_status),(discnamesize - 1)) ;
#if 0 /* SMC 03-08-94: This terminates past the discname space (currently unused so was OK but no need to do it anyway). */
dr->dr_discname[discnamesize - 1] = nul ; /* ensure terminating NUL */
#endif
/* Replace invalid characters in disc name */
{
byte *name;
for (name=dr->dr_discname; *name; name++)
{
*name=mapchar(*name,DOSmapping,ROmapping);
}
}
tracef1("DOSFS: Service_IdentifyDisc: volume \"%s\"\n",(char *)dr->dr_discname) ;
break;
}
......@@ -1308,19 +1312,11 @@ _kernel_oserror *fs_commands(const char *argv,int argc,int command,void *private
}
else
{
#if 1 /* SMC_FIX */
char tmpstr[8];
#else
char tmpstr[4] ; /* temporary "short" string */
#endif
int fhand = 0 ; /* open file handle */
/* Load the BOOT BLOCK from the source drive */
#if 1 /* SMC_FIX */
sprintf(tmpstr,"adfs::%d",srcdrive) ;
#else
sprintf(tmpstr,":%d",srcdrive) ;
#endif
rset.r[0] = 0x40;
rset.r[1] = (int)tmpstr;
rset.r[2] = 0;
......@@ -1344,28 +1340,12 @@ _kernel_oserror *fs_commands(const char *argv,int argc,int command,void *private
rerror = global_error(err_readfailed) ;
/* close the image file */
#if 1 /* SMC_FIX */
rset.r[0] = 0;
rset.r[1] = fhand;
_kernel_swi(OS_Find, &rset, &rset);
#else
_kernel_osfind(0x40,(char *)fhand) ;
#endif
if (rerror == NULL)
{
int bbsize = (srcblock->BOOT_secsize | (srcblock->BOOT_secsizeHI << 8)) ;
#if 0 /* SMC_FIX */
for (loop = 0; (DOS_formats[loop].magic_ID != 0x00); loop++)
if (DOS_formats[loop].magic_ID == srcblock->BOOT_magic)
break ;
if ((DOS_formats[loop].magic_ID == 0x00) || (bbsize != DOSsecsize))
{
tracef0("CMD_CopyBoot: logical disc format not recognised\n") ;
rerror = global_error(err_badbootblock) ;
}
#endif
tracef1("CMD_CopyBoot: source secsize = %d\n", (srcblock->BOOT_secsizeHI << 8)
| srcblock->BOOT_secsize);
tracef1("CMD_CopyBoot: source secalloc = %d\n", srcblock->BOOT_secalloc);
......@@ -1426,11 +1406,7 @@ _kernel_oserror *fs_commands(const char *argv,int argc,int command,void *private
if (rerror == NULL)
{
/* Load the BOOT BLOCK from the destination drive */
#if 1 /* SMC_FIX */
sprintf(tmpstr,"adfs::%d",destdrive) ;
#else
sprintf(tmpstr,":%d",destdrive) ;
#endif
rset.r[0] = 0xC0;
rset.r[1] = (int)tmpstr;
rset.r[2] = 0;
......@@ -1455,17 +1431,6 @@ _kernel_oserror *fs_commands(const char *argv,int argc,int command,void *private
else
{
bbsize = (destblock->BOOT_secsize | (destblock->BOOT_secsizeHI << 8)) ;
#if 0 /* SMC_FIX */
for (loop = 0; (DOS_formats[loop].magic_ID != 0x00); loop++)
if (DOS_formats[loop].magic_ID == destblock->BOOT_magic)
break ;
if ((DOS_formats[loop].magic_ID == 0x00) || (bbsize != DOSsecsize))
{
tracef0("CMD_CopyBoot: logical disc format not recognised\n") ;
rerror = global_error(err_badbootblock) ;
}
#endif
if (rerror == NULL)
{
/* Copy the 3byte JMP, OEM information and
......@@ -1492,13 +1457,9 @@ _kernel_oserror *fs_commands(const char *argv,int argc,int command,void *private
}
}
/* close the image file */
#if 1 /* SMC_FIX */
rset.r[0] = 0;
rset.r[1] = fhand;
_kernel_swi(OS_Find, &rset, &rset);
#else
_kernel_osfind(0x40,(char *)fhand) ;
#endif
}
}
}
......
......@@ -2158,7 +2158,7 @@ static int DOSFS_ensure_exact(FILEhand *fhand,int ensure)
if (ensure_FATs(fhand->ihand) != 0) {
/* We've messed up the FAT so re-load it. */
DOS_FAT_RW(Rdata, fhand->ihand);
return((word)-1) ; /* error already defined */
return -1; /* error already defined */
}
fhand->startCLUSTER = startCLUSTER ;
......@@ -2486,7 +2486,6 @@ static int DOS_bytes_RW(int op, char *memaddr, word bytes, word foff, FILEhand *
break;
}
#if 1
if (bytes > clustersize-foff) {
/* Try to read/write as much as possible straight to/from memory using a cluster multiple op. */
size = (zero ? clustersize-foff : bytes);
......@@ -2507,79 +2506,7 @@ static int DOS_bytes_RW(int op, char *memaddr, word bytes, word foff, FILEhand *
}
}
foff = 0; /* if we go round again then must have stopped at cluster boundary */
#else
tracef3("DOS_bytes_RW: cluster=%d, offset=%d, bytes left=%d\n",nextcluster,foff,bytes);
if (nextcluster == fhand->currentCLUSTER) {
/* If we have the next cluster cached then just copy the data. */
char *to, *from;
size = (bytes > clustersize-foff) ? clustersize-foff : bytes;
from = fhand->filebuff + foff;
if (op == Rdata) {
to = memaddr;
} else {
to = from;
from = memaddr;
fhand->modified = -1;
}
tracef1("DOS_bytes_RW: transferring %d bytes to/from cache\n",size);
memcpy(to, from, size);
if ((foff += size) == clustersize) {
/* If we have reached the end of this cluster then move on to the next. */
nextcluster = getnextCLUSTER(nextcluster, ihand);
foff = 0;
}
} else if (bytes > clustersize-foff) {
/* We don't have the next cluster cached and we have not reached the last cluster
* in the transfer so go straight to the disk.
*/
size = clustersize-foff;
tracef1("DOS_bytes_RW: transferring %d bytes to/from disk\n",size);
if ((nextcluster = DOS_cluster_RW(op, nextcluster, foff, memaddr, size, ihand)) < 0)
{
result = -1;
break;
}
foff = 0;
} else {
/* We have reached the last cluster in the transfer and it's not cached so we
* try to cache it as it is likely that the next transfer will use it.
*/
if (fhand->filebuff != NULL) {
/* Don't cache the next cluster without flushing the cache first!! */
if (fhand->modified != 0) {
tracef1("DOS_bytes_RW: flushing cached cluster %d to disk\n",fhand->currentCLUSTER);
if (DOS_cluster_RW(Wdata,fhand->currentCLUSTER,0,fhand->filebuff,clustersize,ihand) < 0)
{
result = -1;
break;
}
}
} else
fhand->filebuff = (char *)malloc(clustersize);
if (fhand->filebuff != NULL) {
/* We have a cache so cache the next cluster but go round the loop to do the transfer. */
tracef1("DOS_bytes_RW: caching cluster %d\n",nextcluster);
fhand->currentCLUSTER = nextcluster;
if (DOS_cluster_RW(Rdata, nextcluster, 0, fhand->filebuff, clustersize, ihand) < 0)
{
result = -1;
break;
}
fhand->modified = 0;
size = 0;
--clustercount; /* Don't count this cluster (transfer happens next time round). */
} else {
/* Didn't get a cache so we have to go straight to the disk. */
size = bytes;
tracef1("DOS_bytes_RW: no cache so transferring %d bytes to/from disk\n",size);
if (DOS_cluster_RW(op, nextcluster, foff, memaddr, size, ihand) < 0)
{
result = -1;
break;
}
}
}
#endif
if (!zero)
memaddr += size;
bytes -= size;
......@@ -2607,15 +2534,10 @@ int DOSFS_put_bytes(FILEhand *fhand,char *ma,word bytes,word foff,char dummy)
/*-------------------------------------------------------------------------*/
#if 1 /* This call is not mentioned in JRoachs documents. However I have
* been called through the entry point and so have included the code
* here.
*/
int DOSFS_write_zeros(FILEhand *fhand,word foff,word bytes)
{
return DOS_bytes_RW(Wzero, 0, bytes, foff, fhand);
}
#endif /* newcode */
/*-------------------------------------------------------------------------*/
......@@ -3274,9 +3196,6 @@ int DOSFS_create_dir(char *fname,word ld,word ex,word size,DOSdisc *ihand)
int loop ; /* general index counter */
int startCLUSTER ; /* CLUSTER where the directory starts */
time5byte saveTIME ; /* time the directory was created */
#if 0 /* JRS 6/3/92 removed this as RISC OS directories are not typed */
int cROStype = ((ld & ADFStypemask) >> ADFStypeshift) ;
#endif
int ROOTcluster ; /* CLUSTER for the ROOT of the filesystem */
/* in:
......@@ -3404,18 +3323,6 @@ int DOSFS_create_dir(char *fname,word ld,word ex,word size,DOSdisc *ihand)
saveTIME.hi = (ld & 0xFF) ;
put_FILE_time(dentry,RISCOStoTIME(&saveTIME)) ;
put_FILE_date(dentry,RISCOStoDATE(&saveTIME)) ;
#if 0 /* JRS 6/3/92 removed this as (1) RISC OS directories are not typed, and 2) it upsets norton DE */
if (cROStype == DOStype)
{
erase_ROStype(dentry) ; /* remove any possible RISC OS file-type */
}
else
{
put_FILE_ROStype(dentry,cROStype) ; /* place in the specified value */
}
#endif
put_FILE_cluster(dentry,startCLUSTER) ;
dentry->FILE_size = 0; /* JRS 6/3/92 DOS directories have size set to 0. Removed: (CLUSTERs_required * CLUSTERsize) ;*/
......@@ -3606,10 +3513,6 @@ word DOSFS_rename(char *oldname,char *newname,DOSdisc *ihand)
if ((dentry = findemptyDIRentry(&(ndir->dir_entries[0]),ndir->dir_size)) == NULL)
{
#if 0
free(DOSname) ;
return_error0(word,err_dirfull) ;
#else /* JRS 26/3/92 change to extend directory if full */
DIR_info *pdir = NULL ; /* parent directory (not required) */
set_dir_flags(ndir, dir_LOCKED); /* lock the current directory entry in the cache so it isn't flushed by the extend */
if (extend_dir(&ndir,&dentry,ihand,&pdir) < 0)
......@@ -3623,7 +3526,6 @@ word DOSFS_rename(char *oldname,char *newname,DOSdisc *ihand)
unset_dir_flags(ndir, dir_LOCKED);
if (ensure_FATs(ihand) != 0) /* the FAT has been modified by extending the directory. Ensure it is written to the disc */
return(-1) ; /* error already defined */
#endif
}
/* place filename and attributes */
......
......@@ -70,7 +70,7 @@ int validchar(char *string,char init)
/*---------------------------------------------------------------------------*/
/* Map certain characters between filing systems */
static char mapchar(char cchr,char *fromlist,char *tolist)
char mapchar(char cchr,char *fromlist,char *tolist)
{
while (*fromlist != NULL)
{
......@@ -153,26 +153,10 @@ int namematch(char *wcname,char *fname)
{
/* "string1" is the full (non-wildcarded) filename we have matched with */
/* "string2" is the original (wildcarded) filename we were given on entry */
#if 0 /* SMC_FIX */
if (strpbrk(wcname,string1) == NULL)
{
tracef0("namematch: no extension present\n") ;
if (strpbrk(fname,string1) != NULL)
return(FALSE) ; /* extension present in full filename */
else
return(TRUE) ; /* no extension present - filenames matched */
}
#endif
after(string1,fname,file_sep,0) ;
after(string2,wcname,file_sep,0) ;
#if 0 /* SMC_FIX */
/* deal with truncated DOS names on RISC OS */
string2[strlen(string2) + 1] = '\0' ;
string2[strlen(string2)] = wcmult ;
#endif
if (wild_card_compare(string1,string2,DOSwcmult,DOSwcsing) == TRUE)
return(TRUE) ;
}
......
......@@ -199,11 +199,7 @@ int convert5bytetoBCD(time5byte *intime,BCDtime *outtime)
word arg2[2] ;
word *result ;
word divisor[2] ;
#if 1 /* SMC_FIX */
word *dividend;
#else
word dividend[2] ;
#endif
word *quotient ;
#ifdef TIMEWORK
......@@ -226,15 +222,10 @@ int convert5bytetoBCD(time5byte *intime,BCDtime *outtime)
/* the UNIX time is only a 32bit seconds (as opposed to 40bit centi-seconds)
* quantity
*/
#if 1 /* SMC_FIX */
/* Make sure we always round up. */
arg2[0] = tickssec - 1;
arg2[1] = 0;
dividend = library_double_addition(result, arg2);
#else
dividend[0] = result[0] ;
dividend[1] = result[1] ;
#endif
divisor[0] = tickssec ;
divisor[1] = 0 ; /* assumes "tickssec" is a 32bit quantity */
quotient = library_double_udivide(divisor,dividend) ;
......
......@@ -41,9 +41,7 @@ extern int DOSFS_get_bytes(FILEhand *fhand,char *memaddr,word bytes,w
extern int DOSFS_put_bytes(FILEhand *fhand,char *ma,word bytes,word foff,char dbyte) ;
#if 1
extern int DOSFS_write_zeros(FILEhand *fhand,word foff,word bytes) ;
#endif
extern int DOSFS_close_file(FILEhand *fhand,word loadaddr,word execaddr) ;
......@@ -65,11 +63,7 @@ extern FS_cat_entry *DOSFS_read_cat(char *fname,DOSdisc *ihand) ;
extern FS_cat_entry *DOSFS_delete(char *fname,DOSdisc *ihand) ;
#if 1 /* documentation failure */
extern int DOSFS_create(char *fname,word ld,word ex,char *base,char *end,DOSdisc *ihand) ;
#else
extern int DOSFS_create(char *fname,word ld,word ex,word length,DOSdisc *ihand) ;
#endif
extern int DOSFS_create_dir(char *fname,word ld,word ex,word size,DOSdisc *ihand) ;
......
......@@ -32,6 +32,7 @@ extern char *after(char *newptr,char *text,char marker,int npad) ;
extern int namematch(char *wcname,char *fname) ;
extern char *convertRISCOStoDOS(char *source,char *dest) ;
extern char *convertDOStoRISCOS(char *source,char *dest) ;
extern char mapchar(char cchr,char *fromlist,char *tolist) ;
/*---------------------------------------------------------------------------*/
......
......@@ -31,7 +31,6 @@
#define err_mask (0xFF)
#define ext_err(v) (((v) & err_mask) | FS_errflag | (FS_number << 8))
#if 1 /* SMC_FIX */
typedef enum {NO,YES} takesparm ; /* does error message require parameter */
typedef struct {
......@@ -39,7 +38,6 @@ typedef struct {
takesparm pars ;
char *errtext ;
} errentry ;
#endif
/* a reference symbol for each of the error messages */
......
......@@ -31,9 +31,7 @@
#define ticksmin (tickssec * 60) /* seconds in a minute */
#define tickshour (ticksmin * 60) /* minutes in a hour */
#define ticksday (tickshour * 24) /* hours in a day */
#if 0 /* overflows with this compiler */
#define ticksyear (ticksday * 365) /* days in an average year */
#else
#define ticksyear (0xBBF81E00) /* avoid cpp overflow */
/* This equates to 0xBBF81E00 if "cpp" can't do it. The month additions
* work out as follows (number, month (days in month)):
* 0x00000000 Jan (31)
......@@ -49,8 +47,6 @@
* 0x9C8E2000 Nov (30)
* 0xAC013400 Dec (31)
*/
#define ticksyear (0xBBF81E00)
#endif
/*-------------------------------------------------------------------------*/
/* RISC OS and BBC centi-second time is stored in a 5byte structure */
......
This diff is collapsed.
......@@ -12,7 +12,7 @@
; See the License for the specific language governing permissions and
; limitations under the License.
;
TTL MACRO definitions required for MultiFS > s.MFSmacros
TTL MACRO definitions required for DOSFS > s.MFSmacros
; -------------------------------------------------------------------
; The "ERRBLK" constructs a RISC OS style error block. The error
; number is taken from the variable "next_errnum". This is
......@@ -56,11 +56,14 @@ free_stack * &00000400 ; 1K minimum stack size
$label Ccall $address,$pushnumber,$pushstack
$label
STMFD sp!,{sl,fp,lk} ; preserve entry state
[ No26bitCode
MRS lk,CPSR
STMFD sp!,{lk}
]
MOV sl,sp,LSR #20 ; sl = MByte boundary below sp
MOV sl,sl,LSL #20 ; sl = real stack limit
SUB fp,sp,sl ; fp = number of free bytes
CMP fp,#free_stack ; minimum size of stack
LDMCCFD sp!,{sl,fp,lk} ; recover entry registers
BCC DOS_not_enough_stack ; and complain to the user
LDMIA sl,{v4,v5} ; stack-frame description
LDR r12,[r12] ; load private word contents
......@@ -92,20 +95,22 @@ $label
LDREQ fp,[lk,#&04] ; reference our static data
ADDEQ r0,fp,r0 ; reference the pointer
LDREQ r0,[r0,#&00] ; and load the pointer
; -- This code should NOT update the PSR ----------------------------
; this code must NOT affect the Z bit
ADRL lk,sl_offset
LDR lk,[lk,#&00] ; stack overflow buffer
SUB sl,sl,lk ; recover true stack-limit
STMIA sl,{v4,v5} ; and restore stack-limit contents
[ No26bitCode
LDMFD sp!,{lk}
ORREQ lk,lk,#Vbit
MSR CPSR_cxsf,lk
LDMFD sp!,{sl,fp,lk} ; recover entry state
; -------------------------------------------------------------------
BEQ %FT00 ; error = V set
; no error = V clear
CLRV
B %FT01
00 ; error = V set
SETV
01 ; exit with V reflecting error state
|
LDMFD sp!,{sl,fp,lk} ; recover entry state
SETV EQ
CLRV NE ; exit with V reflecting error state
]
MEND
; -------------------------------------------------------------------
......@@ -137,5 +142,4 @@ $label = "$string" ; place string into memory
% ($n - (:LEN: "$string")) ; and zero the remainder
MEND
; -------------------------------------------------------------------
END
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