Source
...
Target
Commits (3)
  • Robert Sprowson's avatar
    Have Freeway look after its own messages · a8ffda23
    Robert Sprowson authored
    Remove faulty logic for Service_MessageFileClosed, MessageTrans reopens the file, so no need to do it again locally.
    Usual register/deregister/reregister code for ResourceFS.
    Replace clumsy casts of (_kernel_oserror *)0 with NULLs.
    
    Version 0.39. Tagged as 'Freeway-0_39'
    a8ffda23
  • ROOL's avatar
    Messages correction · a2af9e77
    ROOL authored
    Admin:
      Authentification->Authentication. Discovered during User Guide error message audit.
    
    Version 0.40. Tagged as 'Freeway-0_40'
    a2af9e77
  • Robert Sprowson's avatar
    Keep messages open when dormant · 610b8a50
    Robert Sprowson authored
    When Freeway concludes it has no interfaces, it called fw_final() & closed the messages file. In turn any errors reported from SWIs or *commands came out as untranslated tokens.
    Move the release_msgs() to when the module finalises in fw_module_final(), not just when it's given up trying.
    Also close the messages if fw_init() returns an error - there was one case where that would not happen and leave MessageTrans/ResourceFS pointing at some old RMA.
    
    Replaced a few magic numbers with defines from the appropriate headers.
    
    Tested in a machine with no network interface, which used to say "FWNoInet" in response to *FWShow.
    
    Version 0.41. Tagged as 'Freeway-0_41'
    610b8a50
| Copyright 2013 Castle Technology Ltd
| Copyright 2015 Castle Technology Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
......
......@@ -21,9 +21,9 @@ CMHGDEPENDS = module
HDRS =
ASMHDRS = Freeway
CINCLUDES = -ITCPIPLibs:,C:
CUSTOMRES = custom
RES_OBJ =
LIBS += ${INETLIB} ${SOCK4LIB} ${ASMUTILS}
ROMCDEFINES = -DROM
CMHGDEPENDS = module
ifeq ("${CMDHELP}","None")
CMHGDEFINES += -DNO_INTERNATIONAL_HELP
endif
......@@ -33,8 +33,4 @@ include CModule
CFLAGS += -wp -DAUTH32 -DCOMPAT_INET4
CDFLAGS += -DDEBUG -DDEBUGSER
resources:
@echo ${COMPONENT}: Resources in AUNMsgs
#
# Dynamic dependencies:
File added
#{DictTokens}
FWType:Type not registered
FWOExt:Object already exists
FWONEx:Object is not held by this machine
FWDBuf:Object descriptor buffer too short
FWNBuf:Object name buffer too short
FWNMem:Insufficient memory
FWOUnk:Object name not known
FWNNet:No access to network
FWLock:Network share not allowed
FWLStr:Bad string passed to Freeway
FWNLoc:Object is not local
FWNAut:Authentication invalid
FWNoInet:No valid Internet interfaces found
FwStatusMsg:Unknown Status reason code
FWInvalSWI:Unknown Freeway SWI
FWSNoInt:No serial driver specified
FWSBadParam:Bad parameter to Freeway serial SWI
Type1:Discs
Type2:Printers
Type5:Hosts
NoRNet:No remote nets
RNet:Remote nets
ShowT:Type
ShowN:Name
ShowH:Holder
/* (0.38)
/* (0.41)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.38
#define Module_MajorVersion_CMHG 0.41
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 26 Aug 2013
#define Module_Date_CMHG 26 May 2017
#define Module_MajorVersion "0.38"
#define Module_Version 38
#define Module_MajorVersion "0.41"
#define Module_Version 41
#define Module_MinorVersion ""
#define Module_Date "26 Aug 2013"
#define Module_Date "26 May 2017"
#define Module_ApplicationDate "26-Aug-13"
#define Module_ApplicationDate "26-May-17"
#define Module_ComponentName "Freeway"
#define Module_ComponentPath "castle/RiscOS/Sources/Networking/AUN/Access/Freeway"
#define Module_FullVersion "0.38"
#define Module_HelpVersion "0.38 (26 Aug 2013)"
#define Module_LibraryVersionInfo "0:38"
#define Module_FullVersion "0.41"
#define Module_HelpVersion "0.41 (26 May 2017)"
#define Module_LibraryVersionInfo "0:41"
......@@ -28,6 +28,7 @@
#include "Global/Services.h"
#include "Global/CMOS.h"
#include "Global/OsBytes.h"
#include "Global/ModHand.h"
#include "AsmUtils/irqs.h"
#include "sys/types.h"
......@@ -39,6 +40,7 @@
#include "sys/dcistructs.h"
#include "netinet/in.h"
#include "net/if.h"
#include "net/ethernet.h"
#include "socklib.h"
#include "inetlib.h"
......@@ -47,7 +49,7 @@
#include "FreewayHdr.h"
static void fw_final(void);
static void release_msgs(int *);
static int is_from_us(u_long src);
static _kernel_oserror *FreewayStatus(_kernel_swi_regs *r);
......@@ -170,7 +172,7 @@ static void setadrvar(int ifcnt, char *adr)
*/
static void rmafree(void *mem)
{
(void) _swix(OS_Module, _IN(0)|_IN(2), 7, mem);
(void) _swix(OS_Module, _IN(0)|_IN(2), ModHandReason_Free, mem);
}
/**********************************************************************
......@@ -251,7 +253,7 @@ static void read_device_name(char *buf, char *etheradr)
strcpy(buf, ifreq.ifr_name);
for( i = 0; i < 6; i++ )
for( i = 0; i < ETHER_ADDR_LEN; i++ )
etheradr[i] = chd->chd_dib->dib_address[i];
break;
......@@ -309,7 +311,7 @@ static int read_ifs(void)
struct sockaddr_in *sin = NULL;
int s, n, flags;
char etheradr[6];
char etheradr[ETHER_ADDR_LEN];
int retried = 0;
u_long byte0, byte1, byte2;
......@@ -528,7 +530,7 @@ static int read_ifs(void)
if( retc >= 0 )
{
dprintf(("module", "Seeing if this settup works.\n"));
dprintf(("module", "Seeing if this setup works.\n"));
retried = 1;
goto again;
}
......@@ -694,8 +696,6 @@ static void fw_prime(void)
{
dprintf(("module", "FWP> In Freeway Prime\n"));
(void)init_msgs(MSG_FILE, msg_fd);
/*
* clear down the main Freeway information structure.
*/
......@@ -737,6 +737,10 @@ _kernel_oserror *fw_init(const char *cmd_tail, int pbase, void *pw)
#ifdef TRACE_ENABLED
debug_initialise_trace (PRINTF_OUTPUT, "");
#endif
e = init_msgs(Module_MessagesFile, msg_fd);
if (e)
return (e);
fw_prime();
/*
......@@ -748,14 +752,18 @@ _kernel_oserror *fw_init(const char *cmd_tail, int pbase, void *pw)
if (inet_present() == 0)
{
dprintf(("module", "IN> Returning Internet not found\n"));
return (_kernel_oserror *)0;
return NULL;
}
e = fw_real_init();
if (e)
{
dprintf(("module", "IN> real init returned %s\n", e->errmess));
release_msgs(msg_fd);
return (e);
}
return (_kernel_oserror *)0;
return NULL;
}
/*
......@@ -812,7 +820,7 @@ static _kernel_oserror *fw_setup_events(void)
}
dprintf(("module", "Ok.\n"));
return(_kernel_oserror *) 0;
return NULL;
}
/**********************************************************************
......@@ -842,7 +850,7 @@ static _kernel_oserror *fw_real_init(void)
* Internet has started, but no device drivers are present so
* we should wait until some are.
*/
return((_kernel_oserror *)0);
return NULL;
}
/*
......@@ -895,7 +903,7 @@ static _kernel_oserror *fw_real_init(void)
dostart = 1;
startup_done = 1;
setcallback();
return((_kernel_oserror *)0);
return NULL;
out:
dprintf(("module", "RI> Initialisation failed\n"));
......@@ -994,6 +1002,16 @@ _kernel_oserror *init_msgs(char *filename, int *fd)
_kernel_swi_regs r;
_kernel_oserror *e;
#ifndef ROM
/*
* Place the messages into ResourceFS
*/
r.r[0] = (int)Resources();
e = _kernel_swi(ResourceFS_RegisterFiles, &r, &r);
if (e)
return e;
#endif
/*
* Look to see if the messages file exists. If it doesnt,
* there isnt much point in continuing.
......@@ -1027,7 +1045,11 @@ static void release_msgs(int *fd)
r.r[0] = (int)(fd+1);
(void)_kernel_swi(MessageTrans_CloseFile, &r, &r);
fd[0] = 0;
}
#ifndef ROM
r.r[0] = (int)Resources();
(void)_kernel_swi(ResourceFS_DeregisterFiles, &r, &r);
#endif
}
}
/**********************************************************************
......@@ -1339,7 +1361,7 @@ _kernel_oserror *fw_swi_handler(int swinum, _kernel_swi_regs *r, void *pw)
if( swinum >= (sizeof(fw_ent) / sizeof(fw_ent[0])) )
return(fw_error(Err_FWInvalSWI));
if (startup_done || (swinum == 4) )
if (startup_done || (swinum == (Freeway_Status - Freeway_00)) )
{
/*
* Call the desired SWI handler.
......@@ -1442,7 +1464,7 @@ static _kernel_oserror *calleverytick(void (*fun)(void))
if (e)
return (e);
return((_kernel_oserror *)0);
return NULL;
}
/**********************************************************************/
......@@ -1486,6 +1508,9 @@ _kernel_oserror *fw_module_final(int fatal, int podule, void *pw)
(void) podule;
(void) pw;
fw_final();
dprintf(("module", "FWMF> Closing messages\n"));
release_msgs(msg_fd);
return NULL;
}
......@@ -1592,9 +1617,6 @@ static void fw_final(void)
qnext = q->q_next;
free(q);
}
dprintf(("module", "FWF> Closing messages\n"));
release_msgs(msg_fd);
}
/**********************************************************************/
......@@ -1717,10 +1739,12 @@ void fw_service(int service_number, _kernel_swi_regs *r, void *pw)
switch( service_number )
{
case Service_MessageFileClosed:
(void)init_msgs(MSG_FILE, msg_fd);
#ifndef ROM
case Service_ResourceFSStarting:
/* Reregister the messages */
(*(void (*)(void *, void *, void *, void *))r->r[2])(Resources(), 0, 0, (void *)r->r[3]);
break;
#endif
/*
* If we get a device driver status call we need to update
* our own count of the drivers present and see if its one
......@@ -1735,7 +1759,7 @@ void fw_service(int service_number, _kernel_swi_regs *r, void *pw)
* we are only interested in device
* drivers that are starting up
*/
if( r->r[2] == 0 )
if( r->r[2] == DCIDRIVER_STARTING )
{
readdevice_callback = 1;
callback(readdevice_entry);
......@@ -1757,7 +1781,7 @@ void fw_service(int service_number, _kernel_swi_regs *r, void *pw)
/*
* it's internet - check its status
*/
if (r->r[2] == 0)
if (r->r[2] == DCIPROTOCOL_STARTING)
{
/* internet is starting */
dprintf(("module", "PP> Internet startup\n"));
......@@ -1774,7 +1798,7 @@ void fw_service(int service_number, _kernel_swi_regs *r, void *pw)
(void)fw_real_init();
}
else if( r->r[2] == 1 )
else if( r->r[2] == DCIPROTOCOL_DYING )
{
/*
* internet is terminating - shut freeway
......@@ -1835,7 +1859,7 @@ _kernel_oserror *readdevice_handler(_kernel_swi_regs *r, void *pw)
* This is the 1st interface we know of that we can use so
* we should try and finish the initialisation.
*/
dprintf(("module", "CB> Calling reall initialisation.\n"));
dprintf(("module", "CB> Calling real initialisation.\n"));
(void)fw_real_init();
}
else {
......
......@@ -27,11 +27,13 @@ date-string: Module_Date_CMHG
initialisation-code: fw_init
service-call-handler: fw_service Service_MessageFileClosed Service_DCIDriverStatus,
service-call-handler: fw_service Service_ResourceFSStarting Service_DCIDriverStatus,
Service_DCIProtocolStatus Service_InternetStatus
finalisation-code: fw_module_final
international-help-file: "Resources:$.Resources.Freeway.Messages"
#ifdef NO_INTERNATIONAL_HELP
command-keyword-table: fw_cli_handler
......
......@@ -132,8 +132,6 @@ struct address_q
#define FW_CHANGED 2
#define FW_DELETED 3
#define MSG_FILE "Resources:$.Resources.Freeway.Messages"
struct eblk
{
int err_nbr;
......@@ -170,6 +168,7 @@ extern _kernel_oserror *EnumerateObjects(_kernel_swi_regs *r);
extern struct fwtype *gettype(int type);
extern int type_id(char *str);
extern void *Resources(void); /* From ResGen */
extern void setcallback(void);
extern void fw_upcall(int upc, int type, struct object_q *rq);
......