Commit d8c8a2ba authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL

Find occupied drives after empty ones and warn if silly

Change the loop scanning for SCSI discs to not stop if a LUN reports an error, only stop if the LUN is not present. This ensures that multi-in-one card readers that have empty sockets in the lower numbered LUNs (giving "Target error - not ready" errors) don't cause the discs in higher numbered LUNs to be missed.

Also, based on an idea from Alan Adams, warn if it appears the user is about to do something silly. That is: formatting the !Boot disc or formatting the disc on which !HForm is running. Neither is illegal, but it may reduce the chance of someone who didn't read the previous 9 prompts saying what's about to happen to think harder before the 10th and final prompt.

Version 2.76. Tagged as 'HForm-2_76'
parent 79d02dfe
......@@ -82,6 +82,8 @@ DiscSizeError:This disc is greater than 512 Mbytes in size but this version of %
BootDefectError:Cannot map out defect at address &%0 (on top of boot block fragment)|M|J
MapDefectError:Cannot map out defect at address &%0 (on top of free space map fragment)|M|J
Dismount:Dismounting drive|M|J
WarnBootFmt:|M|JWARNING - the selected drive contains the Boot application|M|J
WarnCDirFmt:|M|JWARNING - the selected drive is where HForm is running from|M|J
# Tokens used for recognised drive types. These may be translated, as the
# english versions are held in the program as well to allow auto recognition
......
/* (2.75)
/* (2.76)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.75
#define Module_MajorVersion_CMHG 2.76
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 09 Dec 2017
#define Module_Date_CMHG 10 Oct 2020
#define Module_MajorVersion "2.75"
#define Module_Version 275
#define Module_MajorVersion "2.76"
#define Module_Version 276
#define Module_MinorVersion ""
#define Module_Date "09 Dec 2017"
#define Module_Date "10 Oct 2020"
#define Module_ApplicationDate "09-Dec-17"
#define Module_ApplicationDate "10-Oct-20"
#define Module_ComponentName "HForm"
#define Module_ComponentPath "castle/RiscOS/Sources/Utilities/HForm"
#define Module_FullVersion "2.75"
#define Module_HelpVersion "2.75 (09 Dec 2017)"
#define Module_LibraryVersionInfo "2:75"
#define Module_FullVersion "2.76"
#define Module_HelpVersion "2.76 (10 Oct 2020)"
#define Module_LibraryVersionInfo "2:76"
......@@ -83,6 +83,17 @@ IF NewMap% THEN
UNTIL FNdoalloc(TRUE,Log%)
ENDIF
IF DriveCanon$<>"" THEN
REM Warn of impending gun/foot incidents
IF INSTR(FNcanon(FNreadvarval("Boot$Dir")),DriveCanon$)=1 THEN
PROCmessage_print_0("WarnBootFmt")
ELSE
IF INSTR(FNcanon(FNreadvarval("HForm$Dir")),DriveCanon$)=1 THEN
PROCmessage_print_0("WarnCDirFmt")
ENDIF
ENDIF
ENDIF
REM Last chance to bail out
PRINT
IF FNchoose_no_lookup("Q03:",FNmessage_lookup_2("SureChoose",myfsname$,STR$(Drive%)),"YN", "")="N" THEN PROCfinish
......@@ -283,22 +294,20 @@ CASE myfs% OF
PROCmessage_print_0("DriveList")
Dev%()=-1
FOR i%=0 TO 31:REM For each of 8 devices on 4 SCSI cards
SYS"XSCSI_Initialise",2,i%,buf% TO;F%
IF ((F%AND1)=0) AND (?buf%<>&7F) THEN
FOR k%=i% TO &FF STEP &20:REM For each of 8 LUNs in that device
?buf%=&7F:REM Look like LUN not present if fatal
SYS"XSCSI_Initialise",2,k%,buf% TO;F%
IF (F%AND1)=1 THEN
IF ?buf%=&7F THEN
k%=&100:REM Nothing attached, exit FOR
ELSE
REM Only consider 'Direct-access' devices
IF ?buf%=0 THEN
IF ((F%AND1)=0) AND (?buf%=0) THEN
REM Only consider devices SCSIFS knows about
SYS"SCSIFS_Partitions",1,k% TO,,j%
IF j%>=0 AND j%<8 THEN Dev%(j%)=k%
ENDIF
ENDIF
NEXT
ENDIF
NEXT
REM List out devices in SCSIFS order
j%=TRUE
......@@ -639,6 +648,9 @@ ELSE
BigDisc%=FALSE
ENDIF
REM Capture the drive name (if already formatted) before dismounting
DriveCanon$=FNcanon(myfsname$+"::"+STR$Drive%+".$")
old_retries%=FNFixedDiscRetries(0)
LOCAL ERROR
ON ERROR LOCAL : ON ERROR OFF : old_retries%=FNFixedDiscRetries(old_retries%) : PROCAsm : ENDPROC
......@@ -2317,6 +2329,17 @@ varbuf%?varlen% = 13
=$varbuf%
:
REM *****************************************************************
DEF FNcanon(object$)
LOCAL canon$,I%,F%,table%
SYS"XOS_FSControl",37,object$,STRING$(255," "),,,255 TO,,canon$;F%
IF (F%AND1)=1 THEN=""
SYS"Territory_UpperCaseTable",-1 TO table%
FOR I%=1 TO LEN(canon$)
MID$(canon$,I%,1)=CHR$(table%?ASC(MID$(canon$,I%,1)))
NEXT
=canon$
:
REM *****************************************************************
DEF PROCCheckPut(I%)
......
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