Commit 22f3ec34 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Make name cache flush unconditional

CoreFn.c:
The size returned by OS_File 5 might not match the size shown in the Filer viewer (or via *EX) because the last cached version was being returned. This would manifest itself as an error from !Edit if the file on the server had grown since last queried, when loading the file the amount of memory reserved was for the smaller (stale cache copy size).
The name cache is now always flushed on exit from the FileSwitch functions, this doesn't alter performance because the size was already being queried across the network, it was just that the result was overridden by the cached copy.
LanMan.c:
Be more robust and only capture the default driver name when it starts up.
This could be a problem if LanManFS starts after the ethernet driver, and the value of Inet$EtherType is unset. When the driver dies LanManFS would have taken that name as the default - leading to "Bad parameter" when trying to connect to a share.

Tested on IOMD with WinXP SP3.

Version 2.44. Tagged as 'LanManFS-2_44'
parent 9be2c3c7
/* (2.43)
/* (2.44)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.43
#define Module_MajorVersion_CMHG 2.44
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Nov 2013
#define Module_Date_CMHG 19 Jan 2014
#define Module_MajorVersion "2.43"
#define Module_Version 243
#define Module_MajorVersion "2.44"
#define Module_Version 244
#define Module_MinorVersion ""
#define Module_Date "22 Nov 2013"
#define Module_Date "19 Jan 2014"
#define Module_ApplicationDate "22-Nov-13"
#define Module_ApplicationDate "19-Jan-14"
#define Module_ComponentName "LanManFS"
#define Module_ComponentPath "castle/RiscOS/Sources/Networking/Omni/Protocols/LanManFS"
#define Module_FullVersion "2.43"
#define Module_HelpVersion "2.43 (22 Nov 2013)"
#define Module_LibraryVersionInfo "2:43"
#define Module_FullVersion "2.44"
#define Module_HelpVersion "2.44 (19 Jan 2014)"
#define Module_LibraryVersionInfo "2:44"
......@@ -287,7 +287,6 @@ static err_t Func_ReadDir ( int reason, char *path_name, char *buffer,
_kernel_oserror *fsentry_func ( int *R )
{
err_t err;
bool flushnames = false;
debug1("FS_func(%d)", R[0] );
......@@ -343,7 +342,6 @@ _kernel_oserror *fsentry_func ( int *R )
if ( err == OK )
{
err = SMB_Rename ( DOSnamebuf, DOSnamebuf+DOS_NAME_LEN );
flushnames = true;
}
#ifdef LONGNAMES
......@@ -397,13 +395,11 @@ _kernel_oserror *fsentry_func ( int *R )
case FSEntry_Func_Reason_BootFilingSystem:
LM_Boot();
err = OK;
flushnames = true;
break;
case FSEntry_Func_Reason_ShutDown:
/* On shutdown, disconnect all drives */
err = SMB_Shutdown();
flushnames = true;
break;
case FSEntry_Func_Reason_ReadDirectoryEntries:
......@@ -419,7 +415,7 @@ _kernel_oserror *fsentry_func ( int *R )
}
#ifdef LONGNAMES
if (flushnames) NameCache_Flush(ncf_FSFUNC_EXIT);
NameCache_Flush(ncf_FSFUNC_EXIT);
#endif
return MsgError(err);
......@@ -452,7 +448,6 @@ _kernel_oserror *fsentry_file( int *R )
int tmp;
DOS_ATTRIBS da;
RISCOS_ATTRIBS ra;
bool flushnames = false;
debug1("FS_file(%d)", R[0] );
......@@ -481,7 +476,6 @@ _kernel_oserror *fsentry_file( int *R )
ra.execaddr = R[3];
ra.flags = ROA_READ | ROA_WRITE;
Xlt_CnvROtoDOS(&ra, &da, CNV_DATETIME | CNV_ATTRIBS );
flushnames = true;
#ifdef LONGNAMES
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf, ra.loadaddr)) {
......@@ -549,7 +543,6 @@ _kernel_oserror *fsentry_file( int *R )
break;
}
flushnames = true;
if ( R[0] == FSEntry_File_Reason_WriteLoadAddress )
{
ra.loadaddr = R[2];
......@@ -588,7 +581,6 @@ _kernel_oserror *fsentry_file( int *R )
ra.loadaddr = R[2];
ra.execaddr = R[3];
ra.flags = R[5];
flushnames = true;
#ifdef LONGNAMES
{
......@@ -620,7 +612,6 @@ _kernel_oserror *fsentry_file( int *R )
R[3] = ra.execaddr;
R[4] = da.length;
R[5] = ra.flags;
flushnames = true;
if ( da.attr & ATTR_DIR )
{
......@@ -644,7 +635,6 @@ _kernel_oserror *fsentry_file( int *R )
Xlt_RemoveROType ( DOSnamebuf );
#endif
err = SMB_MkDir ( DOSnamebuf );
flushnames = true;
break;
/* Read information calls ---------------------------- */
......@@ -677,7 +667,7 @@ _kernel_oserror *fsentry_file( int *R )
}
#ifdef LONGNAMES
if (flushnames) NameCache_Flush(ncf_FSFILE_EXIT);
NameCache_Flush(ncf_FSFILE_EXIT);
#endif
return MsgError(err);
......
......@@ -1241,10 +1241,11 @@ static void LM_check_driver_status(_kernel_swi_regs *r)
if_name);
#endif
if (strcmp(LM_Vars.drivername, DEFAULT_ETHER_TYPE) == 0) {
if (if_name[0] != 'l') {
(void) strncpy(LM_Vars.drivername, if_name, NAME_LIMIT);
}
if ((strcmp(LM_Vars.drivername, DEFAULT_ETHER_TYPE) == 0) &&
(r->r[2] == DCIDRIVER_STARTING) &&
(if_name[0] != 'l')) {
/* Capture the first interface to start which isn't loopback */
(void) strncpy(LM_Vars.drivername, if_name, NAME_LIMIT);
}
#ifndef NO_NETBEUI
......@@ -1252,20 +1253,15 @@ static void LM_check_driver_status(_kernel_swi_regs *r)
return;
}
if (stricmp(LM_Vars.drivername, if_name) != 0) {
/* printf("Not interested\n"); */
return;
}
else {
if (stricmp(LM_Vars.drivername, if_name) == 0) {
debug0("Ding! This was our interface\n");
if (r->r[2] == 0) {
if (r->r[2] == DCIDRIVER_STARTING) {
/*if (LM_Vars.initialised == LMInitState_FullyInited)*/ {
LM_GracefulClosedown();
}
LM_init_phase_2();
}
else if (r->r[2] == 1) {
else if (r->r[2] == DCIDRIVER_DYING) {
LM_GracefulClosedown();
}
}
......
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