Commit 61345d56 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

New build option to exclude NetBEUI support.

Detail:
  Pass OPTIONS=-DNO_NETBEUI from the Components file if you do not need
    NetBEUI support, and LanManFS will be 12K smaller.
  In NetBEUI mode, LanManFS sends Service_DCIProtocolStatus as required.
  In IP mode, LanManFS notices Service_DCIProtocolStatus from the Internet
    module when it dies and marks all its sockets as needing reconnection.
  Booting behaviour changed to look for !ArmBoot again and not attempt
    the boot if it is missing.  Removed lots of grotty backdoor hacks
    that used to be used to determine this.
Admin:
  Not tested at all.  This will need very thorough testing before it can
    be considered for release.

Version 2.14. Tagged as 'LanManFS-2_14'
parent 6adc491d
......@@ -14,4 +14,4 @@
|
Dir <Obey$Dir>
wimpslot 4000k
amu_machine all
amu_machine all OPTIONS=-DCHECK_ARMBOOT_EXISTS
| Copyright 2000 Pace Micro Technology plc
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot 4000k
amu_machine all OPTIONS="-DNO_NETBEUI -DCHECK_ARMBOOT_EXISTS"
......@@ -37,19 +37,19 @@ CMHG = cmhg
CP = copy
LD = link
RM = remove
MODSQZ = modsqz
MODSQZ = |modsqz
WIPE = -wipe
CD = dir
CD = dir
RESGEN = resgen
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
DFLAGS = -UTML -DCOMPAT_INET4 -DLONGNAMES
DFLAGS = -DCOMPAT_INET4 -DLONGNAMES ${OPTIONS}
AFLAGS = -depend !Depend ${THROWBACK} -Stamp -quit
CFLAGS = -depend !Depend ${THROWBACK} -c -Wpcs -ff -zps1 -zM ${INCLUDES},. ${DFLAGS}
CMHGFLAGS = -depend !Depend ${THROWBACK} -p
CMHGFLAGS = -depend !Depend ${THROWBACK} -p ${OPTIONS}
INCLUDES = -ITCPIPLibs:,C:
#
......
/* (2.13)
/* (2.14)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 2.13
#define Module_MajorVersion_CMHG 2.14
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Aug 2000
#define Module_Date_CMHG 11 Aug 2000
#define Module_MajorVersion "2.13"
#define Module_Version 213
#define Module_MajorVersion "2.14"
#define Module_Version 214
#define Module_MinorVersion ""
#define Module_Date "08 Aug 2000"
#define Module_Date "11 Aug 2000"
#define Module_ApplicationDate2 "08-Aug-00"
#define Module_ApplicationDate4 "08-Aug-2000"
#define Module_ApplicationDate2 "11-Aug-00"
#define Module_ApplicationDate4 "11-Aug-2000"
#define Module_FullVersion "2.13"
#define Module_FullVersion "2.14"
......@@ -27,6 +27,8 @@
#include <string.h>
#include <ctype.h>
#ifndef NO_NETBEUI
/* RISCOS includes */
#include "kernel.h"
......@@ -46,12 +48,6 @@
#include "LanMan_MH.h"
#ifdef DEBUG
#ifdef TML
#include "debug:tml.h"
#endif
#endif
/* Private definitions ******************** */
typedef enum
......@@ -1575,11 +1571,4 @@ void LLC_Shutdown ( void )
}
}
#endif /* !NO_NETBEUI */
......@@ -56,6 +56,7 @@
#include "LanMan_MH.h"
static volatile int callbackflag = 0;
/* ---------------------------------- */
......@@ -168,6 +169,24 @@ static void GetFSName ( char *buf_out )
*buf_out = 0;
}
/* --------------------- */
enum dps_reason {
protocolstatus_STARTING,
protocolstatus_TERMINATING
};
static void lanman_announce_lanmanfs(enum dps_reason r2, void *pw)
{
#ifndef NO_NETBEUI
/* Send the service call announcing the presence/absence of a protocol module */
if (NB_InitedTransport == NB_NetBEUI_Startup)
(void) _swix(OS_ServiceCall, _INR(0,4), pw,
Service_DCIProtocolStatus, r2, DCIVERSION, Module_Title);
#endif
}
/* Finalisation code ------------------------------------ */
static void LM_Undeclare ( void )
......@@ -207,6 +226,8 @@ _kernel_oserror * LM_Finalise (int fatal, int podule, void *pw)
(void) podule;
(void) pw;
lanman_announce_lanmanfs(protocolstatus_TERMINATING, pw);
LM_GracefulClosedown();
LM_Undeclare();
return NULL;
......@@ -483,8 +504,12 @@ static void SetDefaultVars ( void )
LM_Vars.namemode = NM_FIRSTCAPS;
/* Set transport type from CMOS, unless overridden on command line */
#ifdef NO_NETBEUI
LanMan_InitTransport(NB_NBIP_Setup);
#else
LanMan_InitTransport(RdCMOS ( CMOS_NB_TYPE ) & NBTYPE_IP_BIT ?
NB_NBIP_Setup : NB_NetBEUI_Setup);
NB_NBIP_Setup : NB_NetBEUI_Setup);
#endif
}
/* --------------------- */
......@@ -634,27 +659,38 @@ static _kernel_oserror *Cmd_LMTRANSPORT ( const char *args )
{
/* This is a *Configure/Status command handler */
char *argv[1];
char *tp0 = "NetBEUI";
char *tp1 = "IP";
if ( (int) args == 0 ) /* Show 'Configure' options */
#ifdef NO_NETBEUI
if (args == arg_CONFIGURE_SYNTAX || args == arg_STATUS)
{
printf("LMTransport IP\n");
return NULL;
}
#else
char *tp0 = "NetBEUI";
if ( args == arg_CONFIGURE_SYNTAX ) /* Show 'Configure' options */
{
printf("LMTransport [%s | %s]\n", tp0, tp1);
return NULL;
}
else if ( (int) args == 1 ) /* Show FS status */
else if ( args == arg_STATUS ) /* Show FS status */
{
printf("LMTransport %s\n",
(RdCMOS(CMOS_NB_TYPE) & NBTYPE_IP_BIT) ? tp1:tp0);
return NULL;
}
#endif
if ( GetArgs( args, argv, 1 ) < 1 )
return Xlt_Error ( EBADPARAM );
#ifndef NO_NETBEUI
if ( stricmp ( argv[0], tp0 ) == 0 )
WrCMOS(CMOS_NB_TYPE, RdCMOS(CMOS_NB_TYPE) & ~NBTYPE_IP_BIT );
else if ( stricmp ( argv[0], tp1 ) == 0 )
else
#endif
if ( stricmp ( argv[0], tp1 ) == 0 )
WrCMOS(CMOS_NB_TYPE, RdCMOS(CMOS_NB_TYPE) | NBTYPE_IP_BIT );
else
printf("'%s' isn't a supported option\n", argv[0] );
......@@ -670,12 +706,12 @@ static _kernel_oserror *Cmd_NBNSIP( const char *args )
struct in_addr address;
int result;
if ( (int)args == 0 ) /* Show 'Configure' options */
if ( args == arg_CONFIGURE_SYNTAX ) /* Show 'Configure' options */
{
printf("LMNameServer xx.xx.xx.xx\n");
return NULL;
}
else if ( (int) args == 1 ) /* Show FS status */
else if ( args == arg_STATUS ) /* Show FS status */
{
int b0, b1, b2, b3;
......@@ -786,6 +822,7 @@ _kernel_oserror *LM_Command ( const char *args, int argc, int cmd_no, void *pw )
/* Service call handler --------------------------------- */
static void LM_check_driver_status(_kernel_swi_regs *r);
static void LM_check_internet_status(_kernel_swi_regs *r);
static void LM_check_protocol_status(_kernel_swi_regs *r);
void LM_Service ( int service_number, _kernel_swi_regs *r, void *pw )
{
......@@ -810,6 +847,10 @@ void LM_Service ( int service_number, _kernel_swi_regs *r, void *pw )
LM_check_driver_status(r);
break;
case Service_DCIProtocolStatus:
LM_check_protocol_status(r);
break;
case Service_InternetStatus:
if (NB_InitedTransport == NB_NBIP_Setup) {
LM_check_internet_status(r);
......@@ -905,7 +946,9 @@ static err_t ProcessCmdLine ( const char *_line )
"\t-n\tto disable network browsing\n"
"\t-mMYNAME\tto set machine name to MYNAME\n"
"\t-i\tto use NetBIOS-over-IP transport\n"
#ifndef NO_NETBEUI
"\t-t\tto use NetBEUI transport\n"
#endif
"\t-v\tto show progress information on startup\n"
"\t-?\tto display this help\n" );
return ENOTINSTALLED;
......@@ -927,9 +970,11 @@ static err_t ProcessCmdLine ( const char *_line )
LanMan_InitTransport(NB_NBIP_Setup);
break;
#ifndef NO_NETBEUI
case 'T':
LanMan_InitTransport(NB_NetBEUI_Setup);
break;
#endif
default:
printf("\nCommand line switch '-%c' not recognised\n", line[0] );
......@@ -1067,6 +1112,15 @@ if (cmd_tail != NULL)
LM_Vars.initialised = LMInitState_PreInit;
(void) LM_init_phase_2();
#ifndef NO_NETBEUI
/* Cheap way to set a callback ;-) Send service call announcing ourselves */
if (LM_InitedTransport == NB_NetBEUI_Startup) {
callevery_handler(&R, pw);
callbackflag = 2;
}
#endif
return NULL;
}
......@@ -1202,6 +1256,7 @@ static void LM_check_driver_status(_kernel_swi_regs *r)
}
}
#ifndef NO_NETBEUI
if (NB_InitedTransport != NB_NetBEUI_Setup) {
return;
}
......@@ -1223,8 +1278,21 @@ static void LM_check_driver_status(_kernel_swi_regs *r)
LM_GracefulClosedown();
}
}
#endif
}
static void LM_check_protocol_status(_kernel_swi_regs *r)
{
/* A protocol module came or went (could be us in NetBEUI mode!)
* Inform our transport layer if we find it was Internet leaving.
*/
const char *proto = (char *) r->r[4];
if (r->r[2] == protocolstatus_TERMINATING && strcmp(proto, "Internet") == 0) {
NB_InternetGone();
}
}
#ifdef TRACE
static void DumpBuffer(void *ptr, int len)
......@@ -1376,13 +1444,17 @@ int module_printf(const char *str, ...)
/* Callback management. Some servers tend to idle-out connections. This code stops
* that happening.
*/
static volatile int callbackflag = 0;
_kernel_oserror *callback_handler(_kernel_swi_regs *r, void *pw)
{
(void) r;
(void) pw;
if (callbackflag != 0) {
switch (callbackflag) {
case 2:
/* Re-entrancy on this code is OK - announce we are starting */
callbackflag = 0;
lanman_announce_lanmanfs(protocolstatus_STARTING, pw);
break;
case 1:
debug0("Anti IdleOut Callback entered\n");
SMB_AntiIdle();
callbackflag = 0;
......
......@@ -2125,6 +2125,25 @@ EXPORT err_t _NB_Startup(void)
return _NB_AddLocalName ( ntMACHINE, LM_Vars.machinename, &NB_MachineName);
}
/* NB_InternetGone() ---------------------------
The Internet module has disappeared. Mark all sessions as disconnected and
pray that a new Internet module comes back before anything tries to do
anything with a session.
*/
static void _NB_InternetGone(void)
{
int i;
for (i=0; i < MAX_SESSIONS; ++i) {
if (NB_Sessions[i].status == SESS_CONNECTED) {
NB_Sessions[i].sid = -1;
NB_Sessions[i].LinkOK = false;
}
}
}
/* Setup routine ------------------------------- */
......@@ -2152,6 +2171,7 @@ void NB_NBIP_Setup ( void )
p->pfnCloseSession = _NB_CloseSession;
p->pfnFindNames = _NB_FindNames;
p->pfnDescribeLink = _NB_DescribeLink;
p->pfnInternetGone = _NB_InternetGone;
}
......@@ -24,6 +24,7 @@
/* Standard includes */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -32,6 +33,8 @@
/* Our includes */
#ifndef NO_NETBEUI
#include "stdtypes.h"
#include "buflib.h"
#include "stats.h"
......@@ -39,6 +42,7 @@
#include "netbios.h"
#include "lmvars.h"
#define EXPORT static
/* Timeouts ************ */
......@@ -1332,6 +1336,14 @@ EXPORT void _NB_Shutdown(void)
LLC_Shutdown(); /* Detach driver & turn off timers, etc */
}
/* NB_InternetGone() --------------------------- */
static void _NB_InternetGone(void)
{
/* We don't care - we're the protocol module? */
}
/* Setup routine ------------------------------- */
static struct NETBIOS_TRANSPORT NetBEUI_Transport;
......@@ -1358,7 +1370,6 @@ void NB_NetBEUI_Setup ( void )
p->pfnCloseSession = _NB_CloseSession;
p->pfnFindNames = _NB_FindNames;
p->pfnDescribeLink = _NB_DescribeLink;
p->pfnInternetGone = _NB_InternetGone;
}
#endif
......@@ -400,12 +400,18 @@ static void MountNameCpy ( char *d, char *s )
static int ReentryCount = 0;
#ifdef CHECK_ARMBOOT_EXISTS
static err_t BootMount_check_file ( char drive )
static err_t BootMount_check_file ( NAMELIST *pNLmount, const char *leaf )
{
DOS_ATTRIBS dummy;
sprintf ( work_buf, "%c\\!ARMBOOT", drive );
return SMB_GetAttribs ( work_buf, &dummy );
int type;
static char filename[80];
err_t e;
sprintf ( filename, FilingSystemName "::%s.$.%s", pNLmount->name, leaf );
e = Xlt_SetOSError(_swix(OS_File, _INR(0,1)|_OUT(0), 23, filename, &type));
if (e == OK) {
if (type == 0) e = ECANTFINDNAME;
}
return e;
}
#endif
......@@ -416,13 +422,9 @@ 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;
}
if ((_kernel_osbyte(129, 255, 255) & 0xFF00) == 0xFF00) {
/* SHIFT was depressed, or an error occurred */
return OK;
}
......@@ -432,8 +434,7 @@ static err_t BootMount ( NAMELIST *pNLmount )
/* If no such file or directory, we can stop now */
#ifdef CHECK_ARMBOOT_EXISTS
/* Only works if !ARMBOOT is a directory! */
if (BootMount_check_file(pNLmount->u.mount.smb_lettr) != OK)
if (BootMount_check_file(pNLmount, "!ARMBOOT") != OK)
return OK;
#endif
......
......@@ -17,6 +17,7 @@
; <module-is-runnable:> - NO
#include "VersionNum"
#include "Global/Services.h"
; Title string
title-string: LanManFS
......@@ -33,7 +34,9 @@ finalisation-code: LM_Finalise
; Service calls: FSRedeclare; ResourceFSStarting; DCIDriverStatus; OmniAction
; InternetStatus
service-call-handler: LM_Service &40 &60 &9D &A0 &B0
service-call-handler: LM_Service Service_OmniAction Service_ResourceFSStarting,
Service_FSRedeclare,
Service_DCIDriverStatus Service_InternetStatus Service_DCIProtocolStatus
swi-handler-code: LM_Swi
......@@ -46,9 +49,11 @@ swi-decoding-table: LanMan,
generic-veneers: callback_entry/callback_handler, ; for anti-idleout callback
callevery_entry/callevery_handler
vector-handlers: ReceiveFn TickerFn LLC_CallbackFn,
NBIP_CallbackFn/NBIP_CallbackFn_handler_ctrl,
EventFn
vector-handlers: NBIP_CallbackFn/NBIP_CallbackFn_handler_ctrl,
#ifndef NO_NETBEUI
ReceiveFn TickerFn LLC_CallbackFn,
#endif
EventFn
command-keyword-table: LM_Command
......
......@@ -96,6 +96,7 @@ struct NETBIOS_TRANSPORT
int results_max,
int timeout );
char * (*pfnDescribeLink) ( hSESSION hS );
void (*pfnInternetGone) ( void );
};
/* Definitions for supplied transports ------------------------- */
......@@ -133,11 +134,4 @@ extern void NB_NBIP_Setup(void);
#define NB_FindNames(a,b,c,d,e) (NB_ActiveTransport->pfnFindNames(a,b,c,d,e))
#define NB_DescribeLink(a) (NB_ActiveTransport->pfnDescribeLink(a))
#define NB_InternetGone(a) (NB_ActiveTransport->pfnInternetGone(a))
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