Commit 38063824 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Boot behaviour fixes.

  More debug added.
Detail:
  Trapped Service_InternetStatus reason code 0 as a tipoff to try
    to continue a pending boot operation.  Internet module is not
    sending the expected reason code 2 to indicate that the interface
    has come up when it is also having its address changed.
  Holding down SHIFT when a new connection is made prevents execution
    of !ArmBoot on the newly connected share.
  Several more debug statements added to track progress through the
    booting.
  IPConfig's internal logging system imported.  *LanMan:Free shows
    the contents of the log.
  Free space information still seems to be broken against Windows 95/98.
    Works against NT4SP4 though.
  *Free filesystem-specific command added.
Admin:
  This version managed to boot an STB22 from our NT4 server which
    was supplying it with baseline 303.
  *LanMan:Free is not yet implemented and in debug builds, shows
     the debug log instead.
  Anti-idleout work still pending.

Version 1.87, 1.1.1.1.2.11. Tagged as 'LanManFS-1_87-1_1_1_1_2_11'
parent ac517961
......@@ -79,9 +79,9 @@ ROM_OBJS = or.LanMan or.Omni or.Logon or.CoreFn or.Printers or.NameCache \
# od.Xlate od.buflib Interface.o RMInfo.o Errors.o o.Transact \
# od.LLC od.NetBIOS od.SMB od.Attr od.RPC od.NBIP od.Stats LanMan_MH.o
DBG_OBJS = od.LanMan o.Omni od.Logon od.CoreFn od.Printers od.NameCache \
DBG_OBJS = od.LanMan od.Omni od.Logon od.CoreFn od.Printers od.NameCache \
od.Xlate od.buflib Interface.o RMInfo.o Errors.o od.Transact \
o.LLC o.NetBIOS od.SMB o.Attr od.RPC o.NBIP od.Stats LanMan_MH.o
o.LLC o.NetBIOS od.SMB o.Attr od.RPC od.NBIP od.Stats LanMan_MH.o
OBJSI = i.LanMan i.Omni i.Logon i.CoreFn i.Printers i.NameCache \
i.Xlate i.buflib i.Transact \
......@@ -101,7 +101,7 @@ LanMan_MH.h: LanMan_MH.o
.SUFFIXES: .o .od .or .s .c .i .h .cmhg .inst
.c.o:; ${CC} ${CFLAGS} -o $@ $<
.c.or:; ${CC} ${CFLAGS} -DROM -o $@ $<
.c.od:; ${CC} ${CFLAGS} -DDEBUG -DTRACE -o $@ $<
.c.od:; ${CC} ${CFLAGS} -DDEBUG -DTRACE -Dprintf=module_printf -o $@ $<
.c.i:; $(CC) $(CFLAGS) -c -C -E $< >> $@
.i.inst:; $(CC) $(CFLAGS) -C++ -o $@ $<
.cmhg.o:; ${CMHG} ${CMHGFLAGS} -o $@ $< -d $*.h
......
......@@ -4,11 +4,11 @@
*
*/
#define Module_MajorVersion_CMHG 1.87
#define Module_MinorVersion_CMHG 1.1.1.1.2.10
#define Module_Date_CMHG 05 Feb 1999
#define Module_MinorVersion_CMHG 1.1.1.1.2.11
#define Module_Date_CMHG 10 Feb 1999
#define Module_MajorVersion "1.87"
#define Module_Version 187
#define Module_MinorVersion "1.1.1.1.2.10"
#define Module_Date "05 Feb 1999"
#define Module_MinorVersion "1.1.1.1.2.11"
#define Module_Date "10 Feb 1999"
......@@ -855,11 +855,13 @@ _kernel_oserror *fsentry_open( int *R )
}
else
{
R[1] = 0;
#ifdef LONGNAMES
NameCache_Flush(ncf_FSOPEN_EXIT);
/* Take a risk to enhance cacheing :-) */
NameCache_Flush(ncf_FSOPEN_EXIT);
#endif
}
return Xlt_Error(err);
}
......
......@@ -293,6 +293,18 @@ static _kernel_oserror *Cmd_LANMAN ( const char *args )
return _kernel_swi( XOS_Bit | OS_FSControl, &r, &r );
}
/* --------------------- */
static _kernel_oserror *Cmd_FREE ( const char *args )
{
(void) args;
printf("Not immplemented yet\n");
#ifdef TRACE
module_printf(NULL);
#endif
return NULL;
}
/* --------------------- */
static _kernel_oserror *Cmd_CONNECT ( const char *args )
......@@ -635,7 +647,7 @@ static _kernel_oserror *Cmd_NBNSIP( const char *args )
typedef _kernel_oserror * (*CommandFnPtr) ( const char *args );
#define MAX_CMDS 13
#define MAX_CMDS 14
static CommandFnPtr Cmd_Dispatch[MAX_CMDS] =
{
Cmd_LANMAN,
......@@ -650,7 +662,8 @@ static CommandFnPtr Cmd_Dispatch[MAX_CMDS] =
Cmd_LMSTATS,
Cmd_FS,
Cmd_LMTRANSPORT,
Cmd_NBNSIP
Cmd_NBNSIP,
Cmd_FREE
};
#ifdef TRACE
......@@ -675,6 +688,7 @@ static void chk_commands(void)
chk_a_command(Cmd_FS, CMD_FS);
chk_a_command(Cmd_LMTRANSPORT, CMD_LMTransport);
chk_a_command(Cmd_NBNSIP, CMD_LMNameServer);
chk_a_command(Cmd_FREE, CMD_Free);
}
#endif
......@@ -1101,31 +1115,33 @@ static void LM_check_driver_status(_kernel_swi_regs *r)
sprintf(if_name, "%-.8s%d", dib->dib_name, dib->dib_unit);
/*
printf("Service_DCIDriverStatus called (interface %s%d is %sing)\n"
#ifdef TRACE
printf ("Service_DCIDriverStatus called (interface %s%d is %sing)\n"
" Driver supports DCI version %d.%02d\n",
dib->dib_name, dib->dib_unit, r->r[2] ? "dy" : "start",
r->r[3] / 100, r->r[3] % 100
);
printf("We are looking for driver `%s' - got `%s'\n", LM_Vars.drivername,
printf ("We are looking for driver `%s' - got `%s'\n", LM_Vars.drivername,
if_name);
*/
#endif
if (stricmp(LM_Vars.drivername, if_name) != 0) {
/* printf("Not interested\n"); */
return;
}
else {
/* printf("Ding! This was our interface\n"); */
debug0("Ding! This was our interface\n");
if (r->r[2] == 0) {
if (LM_Vars.initialised == LMInitState_FullyInited) {
LM_Finalise(0,0,0);
LM_Declare();
}
LM_init_phase_2();
}
else if (r->r[2] == 1) {
LM_Finalise(0,0,0);
LM_Declare();
}
}
}
......@@ -1138,15 +1154,22 @@ static void LM_check_internet_status(_kernel_swi_regs *r)
{
char *cp = (char *) r->r[3];
printf ("InternetStatus: %d %d %d %p %s\n", r->r[0], r->r[1], r->r[2], cp, cp);
if (r->r[0] == InternetStatus_AddressChanged) {
goto testjump;
}
/* Was it the right reason code? */
if (r->r[0] != InternetStatus_InterfaceUpDown) return;
/* Was it the right interface? */
if (stricmp(LM_Vars.drivername, cp) != 0) return;
/* was the interface coming up? */
if (r->r[2] != 1) return;
testjump:
if (LM_Vars.initialised == LMInitState_FullyInited) {
LM_Finalise(0,0,0);
LM_Declare();
}
LM_init_phase_2();
}
......@@ -1162,3 +1185,58 @@ char *LM_Status(void)
default: return "Dead";
}
}
#ifdef TRACE
/* Debugging routine. If str is NULL, then the log is printed to 'f' (or stderr
* if f was NULL). If f is NULL, the message is added to the log but not displayed
* on the screen. If neither f nor str was NULL, the screen characteristcs are set
* to useful things (text window is reset, default colours restored and text origin
* restored to 0,0, and the message is printed to the screen and copied to tne log.
* A monotonic coumnter is incremented for each debug message logged. Timestamps
* are stored in the log buffer too.
*/
#include <stdarg.h>
int module_printf(const char *str, ...)
{
static int callcount = 0;
static char pbuffer[65536];
static int pbufferptr = 0;
va_list ap;
int inblock[2];
FILE *f;
f=stderr;
if (f != NULL || str == NULL) {
inblock[1] = -1;
inblock[0] = 132;
_swix(OS_ReadVduVariables, _INR(0,1), inblock, inblock);
_swix(OS_WriteC, _IN(0), 6);
if (inblock[0] > 20) {
int i;
for (i=0; i<0; ++i) (void) _kernel_osbyte(19,0,0);
_swix(OS_WriteN, _INR(0,1), "\x1a\x0c", 2);
}
_swix(OS_WriteC, _IN(0), 20);
}
if (!str) {
if (pbufferptr > 0) fprintf(f?f:stderr, "%s\n", pbuffer);
return 0;
}
++callcount;
if (f != NULL) {
fprintf(f, "(%4d) ", callcount);
va_start(ap, str);
vfprintf(f, str, ap);
va_end(ap);
}
va_start(ap, str);
_swix(OS_ReadMonotonicTime, _OUT(0), inblock);
pbufferptr += sprintf(pbuffer + pbufferptr, "(%8d) (%4d) ", inblock[0], callcount);
pbufferptr += vsprintf(pbuffer + pbufferptr, str, ap);
if (pbufferptr > 60000) pbufferptr = 0;
return 0;
}
#endif
......@@ -1244,7 +1244,7 @@ static NAME_ENTRY *FindRemoteName ( NETNAME *pnn )
pNE->nn = *pnn; /* Copy name */
pNE->pStatResp = NULL; /* for safety */
if (0) for ( i=3; i>=0; i-- )
for ( i=3; i>=0; i-- )
{
if ( i > 0 ) /* Send 3 broadcasts */
{
......@@ -1309,6 +1309,7 @@ static NAME_ENTRY *ValidatehName( hNAME hName )
NAME_ENTRY *pN = (NAME_ENTRY *)hName;
if ( pN != NULL )
{
debug1("Status => %d\n", pN->status);
if ( (pN->status == LCL_NAME_OK) || (pN->status == LCL_IN_CONFLICT) )
return pN;
}
......@@ -1649,11 +1650,13 @@ EXPORT err_t _NB_OpenSession ( hNAME hLocalName, NETNAME *pnnFarEnd,
int retargets=0;
/* Check parameters */
debug0("ValidatehName..\n");
lcl_end = ValidatehName(hLocalName);
if ( lcl_end == NULL || lcl_end->status != LCL_NAME_OK )
return EBADPARAM;
/* Try to find remote end */
debug0("FindRemoteName..\n");
far_end = FindRemoteName ( pnnFarEnd );
if ( far_end == NULL )
return ECANTFINDNAME;
......@@ -1696,6 +1699,7 @@ EXPORT err_t _NB_OpenSession ( hNAME hLocalName, NETNAME *pnnFarEnd,
/* Failed - don't even keep the remote name's IP address in cache */
FreeSession(pNS);
FreeNameEntry ( far_end );
debug1("NB_OpenSession(IP) returning (res=%d)\n", res);
return res;
}
......@@ -2109,10 +2113,11 @@ EXPORT err_t _NB_Startup(void)
EventsClaimed = true;
debug0("Events claimed\n");
strcpy ( LM_Vars.drivername, "TCP/IP");
// strcpy ( LM_Vars.drivername, "TCP/IP");
/* Now try to register name... */
debug1("Setting our local name as `%s'\n", LM_Vars.machinename);
return _NB_AddLocalName ( ntMACHINE, LM_Vars.machinename, &NB_MachineName);
}
......
......@@ -394,8 +394,21 @@ static err_t BootMount ( NAMELIST *pNLmount )
/* Attempts to run a !ArmBoot file or applicationn, if it exists */
if (1) {
int key;
(void) _swix(OS_Byte, _INR(0,2)|_OUT(1), 129, 255, 255, &key);
if (key == 255) {
/* SHIFT was depressed */
return OK;
}
}
sprintf ( work_buf, "%c\\!ARMBOOT", pNLmount->u.mount.smb_lettr );
#ifdef TRACE
debug1("BootMount looking for %s\n", work_buf);
#endif
/* If no such file or directory, we can stop now */
if ( SMB_GetAttribs ( work_buf, &dummy ) != OK )
return OK;
......@@ -439,6 +452,10 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd,
*mount_id_out = 0;
#ifdef TRACE
debug3("Omni_MountServer: %p %p %p\n", mountname, servname, mountpath);
#endif
if ( mountname == NULL || servname == NULL || mountpath == NULL )
return EBADPARAM;
......@@ -465,6 +482,9 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd,
if ( res != OK ) /* Didn't work. Forget it */
{
#ifdef TRACE
debug0("SMB_CreateShare failed\n");
#endif
DeleteFromList ( &MountsList, pNLmount );
return res;
}
......
......@@ -1178,18 +1178,21 @@ static err_t ConnectServer ( hSHARE hS )
/* Try to contact server */
debug0("NB_FormatName..\n");
res = NB_FormatName ( ntSERVER, hSrv->servname, &nnserver );
if ( res != OK )
return res;
/* Try to contact server */
debug0("NB_OpenSession..\n");
res = NB_OpenSession( NB_MachineName, &nnserver, &(hSrv->hSession) );
if ( res != OK )
return res;
/* Establish protocol */
debug0("SMB_Negotiate..\n");
res = SMB_Negotiate ( hS );
if ( res != OK )
goto abort_server;
......@@ -1199,12 +1202,15 @@ static err_t ConnectServer ( hSHARE hS )
if (hSrv->ProtFlags & PROT_USERLOGON)
{
Xlt_Unjumble(hSrv->password);
debug0("SMB_SessSetup..\n");
res = SMB_SessSetup ( hS, hSrv->username, hSrv->password );
Xlt_Jumble(hSrv->password);
if ( res != OK ) goto abort_server;
}
debug0("ConnectServer succeeds\n");
return OK;
abort_server:
......@@ -1555,6 +1561,10 @@ err_t SMB_CreateShare ( int sharetype_in,
err_t res;
/* Validate & format parameters */
#ifdef TRACE
debug2("Server name %p; share name %p\n", servname_in, sharename_in);
debug2("Server name `%s'; share name `%s'\n", servname_in, sharename_in);
#endif
if ( servname_in == NULL || sharename_in==NULL )
return EBADPARAM;
......
......@@ -135,5 +135,12 @@ command-keyword-table: LM_Command
invalid-syntax: "Syntax:\t*Configure LMNameServer [IP address]\r",
configure:,
status:,
)
),
Free(min-args:0, max-args:1,
help-text: "*Free displays the total free space on a LanManFS share",
invalid-syntax: "Syntax:\t*Free [<disc spec.>]\r",
fs-command:,
)
......@@ -21,10 +21,10 @@
*/
#ifdef DEBUG
#define debug0(f) printf(f)
#define debug1(f,a) printf(f,a)
#define debug2(f,a,b) printf(f,a,b)
#define debug3(f,a,b,c) printf(f,a,b,c)
#define debug0(f) printf (f)
#define debug1(f,a) printf (f,a)
#define debug2(f,a,b) printf (f,a,b)
#define debug3(f,a,b,c) printf (f,a,b,c)
#else
#define debug0(f)
#define debug1(f,a)
......@@ -161,7 +161,7 @@ typedef struct
/* RISCOS attributes */
#define ROA_READ 1
#define ROA_READ ((1<<0) | (1<<4))
#define ROA_WRITE 2
#define ROA_LOCKED 8
......
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