Commit ac44a2cf authored by Ben Avison's avatar Ben Avison
Browse files

Changes from John.

Detail:
  > Default filetype now text
  >
  > Default type given to any file that has neither a dos extent, nor a
  > ',xxx' riscos extent at the server
  >
  > Ensure that files given the default type never have a ',xxx' riscos
  > extent appended.
  >
  > Add environment variable 'LMDefaultType' which checked for a default
  > type on module initialisation .. thus setting this to (e.g.) dos, then
  > rmreinitting LanManFS will change the default type to (e.g.) dos.
Admin:
  Not tested here yet.

Version 2.29. Tagged as 'LanManFS-2_29'
parent ead18e4c
/* (2.28) /* (2.29)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.2. * Last processed by srccommit version: 1.2.
* *
*/ */
#define Module_MajorVersion_CMHG 2.28 #define Module_MajorVersion_CMHG 2.29
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 07 Jan 2004 #define Module_Date_CMHG 09 Jan 2004
#define Module_MajorVersion "2.28" #define Module_MajorVersion "2.29"
#define Module_Version 228 #define Module_Version 229
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "07 Jan 2004" #define Module_Date "09 Jan 2004"
#define Module_ApplicationDate "07-Jan-04" #define Module_ApplicationDate "09-Jan-04"
#define Module_ComponentName "LanManFS" #define Module_ComponentName "LanManFS"
#define Module_ComponentPath "RiscOS/Sources/Networking/Omni/Protocols/LanManFS" #define Module_ComponentPath "RiscOS/Sources/Networking/Omni/Protocols/LanManFS"
#define Module_FullVersion "2.28" #define Module_FullVersion "2.29"
#define Module_HelpVersion "2.28 (07 Jan 2004)" #define Module_HelpVersion "2.29 (09 Jan 2004)"
#define Module_LibraryVersionInfo "2:28" #define Module_LibraryVersionInfo "2:29"
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "smb.h" #include "smb.h"
#include "xlate.h" #include "xlate.h"
#include "omni.h" #include "omni.h"
#include "LanMan.h"
/* "Default" filetype logic ------------------------------------- */ /* "Default" filetype logic ------------------------------------- */
...@@ -86,8 +87,8 @@ static void GetDefaultType ( char *leafname, RISCOS_ATTRIBS *ra ) ...@@ -86,8 +87,8 @@ static void GetDefaultType ( char *leafname, RISCOS_ATTRIBS *ra )
leafname = strchr(leafname, '.'); leafname = strchr(leafname, '.');
if ( leafname == NULL ) /* No extension */ if ( leafname == NULL ) /* No extension */
{ {
debug1("No suffix,assuming DOS filetype for '%s'\n", leafname ); debug1("No suffix,assuming Text filetype for '%s'\n", leafname );
ra->loadaddr = FileType_MSDOS << 8; ra->loadaddr = Default_FileType << 8;
return; return;
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "kernel.h" #include "kernel.h"
#include "swis.h" #include "swis.h"
#include "Global/FileTypes.h"
#include "stdtypes.h" #include "stdtypes.h"
#include "lanman.h" #include "lanman.h"
#include "lmvars.h" #include "lmvars.h"
...@@ -92,6 +93,13 @@ static pfnTransportInit NB_InitedTransport; /* Identify active transport */ ...@@ -92,6 +93,13 @@ static pfnTransportInit NB_InitedTransport; /* Identify active transport */
static bool LM_Declared; /* True if we're registered as a filing system */ static bool LM_Declared; /* True if we're registered as a filing system */
/* ------------------------------- */ /* ------------------------------- */
char Default_FileTName[6];
int Default_FileType;
/* ------------------------------- */
#define CMOS_FSNUMBER 5 #define CMOS_FSNUMBER 5
/* Contains number of FS to be booted */ /* Contains number of FS to be booted */
...@@ -505,6 +513,18 @@ static void SetDefaultVars ( void ) ...@@ -505,6 +513,18 @@ static void SetDefaultVars ( void )
LM_Vars.namemode = NM_FIRSTCAPS; LM_Vars.namemode = NM_FIRSTCAPS;
// load and convert default filetype to textual HEX
if(name = getenv(DefaultTypeEnvVar),name)
{
_swix(OS_FSControl,_INR(0,1)|_OUT(2),31,name,&Default_FileType);
}
else
{
Default_FileType=Default_File_Type_Number;
}
sprintf(Default_FileTName,",%03x",Default_FileType);
/* Set transport type from CMOS, unless overridden on command line */ /* Set transport type from CMOS, unless overridden on command line */
#ifdef NO_NETBEUI #ifdef NO_NETBEUI
LanMan_InitTransport(NB_NBIP_Setup); LanMan_InitTransport(NB_NBIP_Setup);
......
...@@ -356,7 +356,7 @@ static err_t DoCLIop ( char *command, int mount_id ) ...@@ -356,7 +356,7 @@ static err_t DoCLIop ( char *command, int mount_id )
{ {
_kernel_swi_regs R; _kernel_swi_regs R;
NAMELIST *pNL = Validate(mount_id, M_VALID_TAG); NAMELIST *pNL = Validate(mount_id, (int)M_VALID_TAG);
if ( pNL == NULL ) if ( pNL == NULL )
return EBADPARAM; return EBADPARAM;
...@@ -488,7 +488,7 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd, ...@@ -488,7 +488,7 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd,
/* Check for mount with same name */ /* Check for mount with same name */
pNLmount = AddToList ( &MountsList, M_VALID_TAG, namebuf ); pNLmount = AddToList ( &MountsList, (int)M_VALID_TAG, namebuf );
if ( pNLmount == NULL ) /* Out of memory -oops! */ if ( pNLmount == NULL ) /* Out of memory -oops! */
return ECONNLIMIT; return ECONNLIMIT;
...@@ -524,7 +524,7 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd, ...@@ -524,7 +524,7 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd,
if ( pNLsrv != NULL ) if ( pNLsrv != NULL )
{ {
pNLmount->u.mount.diskname = pNLmount->u.mount.diskname =
AddToList ( &pNLsrv->u.server.known_disks, D_VALID_TAG, mountpath ); AddToList ( &pNLsrv->u.server.known_disks, (int)D_VALID_TAG, mountpath );
} }
else /* Out of memory - carry on anyway */ else /* Out of memory - carry on anyway */
{ {
...@@ -551,7 +551,7 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd, ...@@ -551,7 +551,7 @@ err_t Omni_MountServer ( char *servname, char *userID, char *passwd,
err_t Omni_DismountServer ( int mount_id ) err_t Omni_DismountServer ( int mount_id )
{ {
NAMELIST *pNL = Validate(mount_id, M_VALID_TAG); NAMELIST *pNL = Validate(mount_id, (int)M_VALID_TAG);
if ( pNL == NULL ) if ( pNL == NULL )
return EBADPARAM; return EBADPARAM;
...@@ -576,7 +576,7 @@ static uint size_clip ( uint val, uint limit, uint blksize ) ...@@ -576,7 +576,7 @@ static uint size_clip ( uint val, uint limit, uint blksize )
static err_t Omni_DetermineFreeSpace ( int mount_id, static err_t Omni_DetermineFreeSpace ( int mount_id,
struct disk_size_response *DSR) struct disk_size_response *DSR)
{ {
NAMELIST *pNL = Validate(mount_id, M_VALID_TAG); NAMELIST *pNL = Validate(mount_id, (int)M_VALID_TAG);
if ( pNL == NULL ) if ( pNL == NULL )
return EBADPARAM; return EBADPARAM;
...@@ -760,7 +760,7 @@ static err_t Omni_ListMounts ( ...@@ -760,7 +760,7 @@ static err_t Omni_ListMounts (
if ( token_in != 0 ) if ( token_in != 0 )
{ {
pNLdisk = Validate(token_in, D_VALID_TAG); pNLdisk = Validate(token_in, (int)D_VALID_TAG);
if ( pNLdisk == NULL ) if ( pNLdisk == NULL )
return EBADPARAM; return EBADPARAM;
} }
...@@ -837,7 +837,7 @@ static err_t Omni_ListActiveMounts ( char *buf_ptr, int buf_size, ...@@ -837,7 +837,7 @@ static err_t Omni_ListActiveMounts ( char *buf_ptr, int buf_size,
pNL = MountsList; pNL = MountsList;
else else
{ {
pNL = Validate(token_in, M_VALID_TAG); pNL = Validate(token_in, (int)M_VALID_TAG);
if ( pNL == NULL ) if ( pNL == NULL )
return EBADPARAM; return EBADPARAM;
} }
...@@ -891,7 +891,7 @@ static err_t Omni_ListPrinters ( char *buf_ptr, int buf_size, ...@@ -891,7 +891,7 @@ static err_t Omni_ListPrinters ( char *buf_ptr, int buf_size,
pNLstart = NULL; pNLstart = NULL;
else else
{ {
pNLstart = Validate ( token_in, P_VALID_TAG ); pNLstart = Validate ( token_in, (int)P_VALID_TAG );
if ( pNLstart == NULL ) if ( pNLstart == NULL )
return EBADPARAM; return EBADPARAM;
} }
...@@ -1025,7 +1025,7 @@ err_t Omni_GetMountInfo ( int mount_id, char **pServName, ...@@ -1025,7 +1025,7 @@ err_t Omni_GetMountInfo ( int mount_id, char **pServName,
char **pUserName, char **pMountName, char **pMountPath, int *pServerID ) char **pUserName, char **pMountName, char **pMountPath, int *pServerID )
{ {
char smbletter; char smbletter;
NAMELIST *pNL = Validate(mount_id, M_VALID_TAG); NAMELIST *pNL = Validate(mount_id, (int)M_VALID_TAG);
if ( pNL == NULL ) if ( pNL == NULL )
return EBADPARAM; return EBADPARAM;
......
...@@ -242,7 +242,7 @@ static err_t RPC_EnumServersOnConnection ( char drv, char *domain ) ...@@ -242,7 +242,7 @@ static err_t RPC_EnumServersOnConnection ( char drv, char *domain )
StartParams ( 0x0068, "WrLehDz", "B16BBDz", 8 ); StartParams ( 0x0068, "WrLehDz", "B16BBDz", 8 );
addword (0x0001); /* Detail level */ addword (0x0001); /* Detail level */
addword (TP.data_out_maxlen); /* Return buf size */ addword (TP.data_out_maxlen); /* Return buf size */
addlong (0xFFFFFFFF); /* Return all server types */ addlong ((int)0xFFFFFFFF); /* Return all server types */
addstring ( domain ); /* Domain name */ addstring ( domain ); /* Domain name */
/* Make call */ /* Make call */
......
...@@ -30,12 +30,12 @@ ...@@ -30,12 +30,12 @@
#include "kernel.h" #include "kernel.h"
#include "stdtypes.h" #include "stdtypes.h"
#include "Global/FileTypes.h"
#include "swis.h" #include "swis.h"
#include "Xlate.h" #include "Xlate.h"
#include "attr.h" #include "attr.h"
#include "omni.h" #include "omni.h"
#include "LanMan.h"
#include "lmvars.h" #include "lmvars.h"
#include "SMB.h" #include "SMB.h"
#include "NameCache.h" #include "NameCache.h"
...@@ -245,7 +245,7 @@ void Xlt_CnvDOStoRO ( DOS_ATTRIBS *pDA, RISCOS_ATTRIBS *pRA, int flags ) ...@@ -245,7 +245,7 @@ void Xlt_CnvDOStoRO ( DOS_ATTRIBS *pDA, RISCOS_ATTRIBS *pRA, int flags )
/* Total = (thi << 16)+tlo; */ /* Total = (thi << 16)+tlo; */
pRA->loadaddr = 0xFFF00000 + ( (thi+ (tlo >> 16) ) >> 16) + pRA->loadaddr = 0xFFF00000 + ( (thi+ (tlo >> 16) ) >> 16) +
0xFE400; /* Default type = 'DOS' */ (Default_FileType << 8); /* Default type = 'Text' */
pRA->execaddr = (thi << 16) + tlo; pRA->execaddr = (thi << 16) + tlo;
} }
...@@ -1282,8 +1282,8 @@ err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA, ...@@ -1282,8 +1282,8 @@ err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA,
if (res != OK) if (res != OK)
{ {
/* No ",ttt" and no mimemap lookup - mark as a DOS file */ /* No ",ttt" and no mimemap lookup - mark as a Text file */
pRA->loadaddr = ENCODE_FILETYPE(pRA->loadaddr, FileType_MSDOS); pRA->loadaddr = ENCODE_FILETYPE(pRA->loadaddr, Default_FileType);
} }
return res; return res;
...@@ -1382,7 +1382,8 @@ int Xlt_AddROType ( char *leafname, uint loadaddr ) ...@@ -1382,7 +1382,8 @@ int Xlt_AddROType ( char *leafname, uint loadaddr )
if(!strcmp(typebuf,ftypebuf)) return 1; // its OK.. no need to append type if(!strcmp(typebuf,ftypebuf)) return 1; // its OK.. no need to append type
} }
} }
strcat(leafname, typebuf); // Don't append ,xxx filetype if its the default
if(strcmp(typebuf,Default_FileTName))strcat(leafname, typebuf);
return 1; return 1;
} }
#endif #endif
......
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
#define FilingSystemName "LanMan" #define FilingSystemName "LanMan"
#define Our_FS_Number 102 #define Our_FS_Number 102
/* Default map filetype when file on server has no type info */
#define Default_File_Type_Number FileType_Text
/* Env Variable to contain replacement default type */
#define DefaultTypeEnvVar "LMDefaultType"
#define FSControl_AddFilingSystem 12 #define FSControl_AddFilingSystem 12
#define FSControl_SelectFilingSystem 14 #define FSControl_SelectFilingSystem 14
...@@ -96,4 +102,5 @@ extern void Free_ServiceRoutine(void); ...@@ -96,4 +102,5 @@ extern void Free_ServiceRoutine(void);
extern void CollectCallbacks(void); extern void CollectCallbacks(void);
extern char Default_FileTName[6];
extern int Default_FileType;
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