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

First version which should contain everything required for full long filename...

First version which should contain everything required for full long filename support of SMB shares.

Detail:
  Renaming works; setting filetypes results in a rename occurring;
  setting load/exec/attributes works - causing a rename where
  appropriate; creation of files to overwrite existing objects of
  different types causes old file to be deleted first.
Admin:
  Tested briefly and everything seems happy both at the command-line
    and from the RISC OS Filer.  More thorough development testing can
    now commence properly.

Version 1.87, 1.1.1.1.2.5. Tagged as 'LanManFS-1_87-1_1_1_1_2_5'
parent d7d9868e
...@@ -83,14 +83,13 @@ DBG_OBJS = od.LanMan o.Omni od.Logon od.CoreFn od.Printers \ ...@@ -83,14 +83,13 @@ DBG_OBJS = od.LanMan o.Omni od.Logon od.CoreFn od.Printers \
od.Xlate od.buflib Interface.o RMInfo.o Errors.o od.Transact \ od.Xlate od.buflib Interface.o RMInfo.o Errors.o od.Transact \
o.LLC o.NetBIOS o.SMB o.Attr od.RPC o.NBIP od.Stats LanMan_MH.o o.LLC o.NetBIOS o.SMB o.Attr od.RPC o.NBIP od.Stats LanMan_MH.o
OBJSI = i.LanMan i.Omni i.Logon i.CoreFn i.Printers i.PathMunge \ OBJSI = i.LanMan i.Omni i.Logon i.CoreFn i.Printers \
i.Xlate i.buflib i.Transact \ i.Xlate i.buflib i.Transact \
i.LLC i.NetBIOS i.SMB i.Attr i.RPC i.NBIP i.Stats i.LLC i.NetBIOS i.SMB i.Attr i.RPC i.NBIP i.Stats
OBJSINST = LanMan_MH.o inst.LanMan inst.Omni inst.Logon inst.CoreFn inst.Printers \ OBJSINST = LanMan_MH.o inst.LanMan inst.Omni inst.Logon inst.CoreFn inst.Printers \
inst.Xlate inst.buflib Interface.o RMInfo.o Errors.o inst.Transact\ inst.Xlate inst.buflib Interface.o RMInfo.o Errors.o inst.Transact\
inst.LLC inst.NetBIOS inst.SMB inst.Attr inst.RPC inst.NBIP inst.Stats \ inst.LLC inst.NetBIOS inst.SMB inst.Attr inst.RPC inst.NBIP inst.Stats
inst.PathMunge
LanMan_MH.h: LanMan_MH.o LanMan_MH.h: LanMan_MH.o
${CMHG} ${CMHGFLAGS} cmhg.$* -d $@ ${CMHG} ${CMHGFLAGS} cmhg.$* -d $@
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
* *
*/ */
#define Module_MajorVersion_CMHG 1.87 #define Module_MajorVersion_CMHG 1.87
#define Module_MinorVersion_CMHG 1.1.1.1.2.4 #define Module_MinorVersion_CMHG 1.1.1.1.2.5
#define Module_Date_CMHG 08 Jan 1999 #define Module_Date_CMHG 11 Jan 1999
#define Module_MajorVersion "1.87" #define Module_MajorVersion "1.87"
#define Module_Version 187 #define Module_Version 187
#define Module_MinorVersion "1.1.1.1.2.4" #define Module_MinorVersion "1.1.1.1.2.5"
#define Module_Date "08 Jan 1999" #define Module_Date "11 Jan 1999"
...@@ -328,8 +328,6 @@ static err_t Attr_GetInfoX2 ( char *filename, char *leafname, ...@@ -328,8 +328,6 @@ static err_t Attr_GetInfoX2 ( char *filename, char *leafname,
{ {
char *lastcomma; char *lastcomma;
(void) leafname;
if (Xlt_SplitLeafnameX2 ( leafname?leafname:filename, pRA, &lastcomma ) != OK) { if (Xlt_SplitLeafnameX2 ( leafname?leafname:filename, pRA, &lastcomma ) != OK) {
/* Something asked using a RISC OS name. Need to do a lookup /* Something asked using a RISC OS name. Need to do a lookup
* for the file. * for the file.
...@@ -484,13 +482,6 @@ close_file: ...@@ -484,13 +482,6 @@ close_file:
slot (with a 0 byte at the start of 'name'), which is filled slot (with a 0 byte at the start of 'name'), which is filled
in. in.
*/ */
#ifdef LONGNAMES
static err_t Attr_SetInfoX2 ( char *pathname, RISCOS_ATTRIBS *pRA )
{
}
#endif
extern err_t Attr_SetInfo ( char *pathname, RISCOS_ATTRIBS *pRA ) extern err_t Attr_SetInfo ( char *pathname, RISCOS_ATTRIBS *pRA )
{ {
err_t err; err_t err;
...@@ -501,8 +492,11 @@ extern err_t Attr_SetInfo ( char *pathname, RISCOS_ATTRIBS *pRA ) ...@@ -501,8 +492,11 @@ extern err_t Attr_SetInfo ( char *pathname, RISCOS_ATTRIBS *pRA )
debug1("SetInfo for '%s'\n", pathname); debug1("SetInfo for '%s'\n", pathname);
#ifdef LONGNAMES #ifdef LONGNAMES
/* Wonderfully ehough, we don't actually need an implementation
* of this at all!
*/
if (SMB_IsLongNameFS(pathname)) if (SMB_IsLongNameFS(pathname))
return Attr_SetInfoX2 ( pathname, pRA ); return OK;
#endif #endif
......
...@@ -360,11 +360,28 @@ _kernel_oserror *fsentry_func ( int *R ) ...@@ -360,11 +360,28 @@ _kernel_oserror *fsentry_func ( int *R )
err = Xlt_ConvertPath( name_R(1), DOSnamebuf); err = Xlt_ConvertPath( name_R(1), DOSnamebuf);
if ( err == OK ) if ( err == OK )
err = Xlt_ConvertPath( name_R(2), DOSnamebuf+DOS_NAME_LEN ); err = Xlt_ConvertPath( name_R(2), DOSnamebuf+DOS_NAME_LEN );
#ifdef LONGNAMES
if ( err == OK )
{
(void) Xlt_CnvRenameX2 ( DOSnamebuf, DOSnamebuf + DOS_NAME_LEN );
}
#endif
if ( err == OK ) if ( err == OK )
err = SMB_Rename ( DOSnamebuf, DOSnamebuf+DOS_NAME_LEN ); err = SMB_Rename ( DOSnamebuf, DOSnamebuf+DOS_NAME_LEN );
#ifdef LONGNAMES #ifdef LONGNAMES
if (SMB_IsLongNameFS(DOSnamebuf + DOS_NAME_LEN)) break; if (SMB_IsLongNameFS(DOSnamebuf + DOS_NAME_LEN)) {
if ( err == EBADRENAME )
{
R[1] = 1;
err = OK;
}
else
{
R[1] = 0;
}
break;
}
/* Don't bother with any of this rubbish for long filename discs */ /* Don't bother with any of this rubbish for long filename discs */
#endif #endif
...@@ -479,6 +496,17 @@ _kernel_oserror *fsentry_file( int *R ) ...@@ -479,6 +496,17 @@ _kernel_oserror *fsentry_file( int *R )
ra.execaddr = R[3]; ra.execaddr = R[3];
ra.flags = ROA_READ | ROA_WRITE; ra.flags = ROA_READ | ROA_WRITE;
Xlt_CnvROtoDOS(&ra, &da, CNV_DATETIME | CNV_ATTRIBS ); Xlt_CnvROtoDOS(&ra, &da, CNV_DATETIME | CNV_ATTRIBS );
#ifdef LONGNAMES
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf, ra.loadaddr)) {
/* We changed the filetype - therefore delete old file */
err = SMB_Delete(DOSnamebuf + DOS_NAME_LEN);
if (err != OK && err != EFILENOTFOUND) {
/* Oh dear - looks likely the create would fail anyway! */
break;
}
}
#endif
err = SMB_Create ( DOSnamebuf, &da, &FH ); err = SMB_Create ( DOSnamebuf, &da, &FH );
if ( err == OK ) if ( err == OK )
...@@ -539,6 +567,14 @@ _kernel_oserror *fsentry_file( int *R ) ...@@ -539,6 +567,14 @@ _kernel_oserror *fsentry_file( int *R )
{ {
ra.loadaddr = R[2]; ra.loadaddr = R[2];
Xlt_CnvROtoDOS ( &ra, &da, CNV_DATETIME ); Xlt_CnvROtoDOS ( &ra, &da, CNV_DATETIME );
#ifdef LONGNAMES
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf + DOS_NAME_LEN, ra.loadaddr)) {
err = SMB_Rename(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
if (err != OK) break;
strcpy(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
}
#endif
} }
else if ( R[0] == FSEntry_File_Reason_WriteExecutionAddress ) else if ( R[0] == FSEntry_File_Reason_WriteExecutionAddress )
{ {
...@@ -560,6 +596,15 @@ _kernel_oserror *fsentry_file( int *R ) ...@@ -560,6 +596,15 @@ _kernel_oserror *fsentry_file( int *R )
ra.execaddr = R[3]; ra.execaddr = R[3];
ra.flags = R[5]; ra.flags = R[5];
#ifdef LONGNAMES
strncpy(DOSnamebuf + DOS_NAME_LEN, DOSnamebuf, DOS_NAME_LEN);
if (Xlt_AddROType(DOSnamebuf + DOS_NAME_LEN, ra.loadaddr)) {
err = SMB_Rename(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
if (err != OK) break;
strcpy(DOSnamebuf, DOSnamebuf + DOS_NAME_LEN);
}
#endif
Xlt_CnvROtoDOS ( &ra, &da, CNV_ATTRIBS | CNV_DATETIME ); Xlt_CnvROtoDOS ( &ra, &da, CNV_ATTRIBS | CNV_DATETIME );
Attr_SetInfo ( DOSnamebuf, &ra ); Attr_SetInfo ( DOSnamebuf, &ra );
err = SMB_SetAttribs ( DOSnamebuf, &da ); err = SMB_SetAttribs ( DOSnamebuf, &da );
......
...@@ -1044,3 +1044,66 @@ err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA, ...@@ -1044,3 +1044,66 @@ err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA,
#endif #endif
/* ------------------------------- */ /* ------------------------------- */
#ifdef LONGNAMES
/* Copies the filetype information from one name to another.
* Note that the file saving routine actually uses this
* routine to strip filetype information by passing both
* parameters the same. This must continue to function.
*/
err_t Xlt_CnvRenameX2 ( char *src, char *dst )
{
RISCOS_ATTRIBS RA;
char *terminator, *nterm;
if (Xlt_SplitLeafnameX2 ( dst, &RA, &nterm ) != OK) {
/* No type information - find end of string */
nterm = strchr(dst, '\0');
}
else {
/* Strip old type information in case source didn't have any either */
*nterm = '\0';
}
if (Xlt_SplitLeafnameX2 ( src, &RA, &terminator ) == OK) {
(void) strcpy(nterm, terminator);
}
return OK;
}
#endif
/* ------------------------------- */
#ifdef LONGNAMES
int Xlt_AddROType ( char *leafname, uint loadaddr )
{
RISCOS_ATTRIBS RA;
char *terminator;
char typebuf[8];
typebuf[0] = FileChar_TypedNamePrefix;
if (loadaddr == 0xDEADDEAD) {
strcpy(typebuf+1, FileString_DeadFile);
}
else if ((loadaddr & 0xFFF00000) != 0xFFF00000) {
strcpy(typebuf+1, FileString_UntypedFile);
}
else {
int type = (loadaddr << 12) >> 20;
if (type == 0xFFF) *typebuf = '\0';
else sprintf(typebuf+1, "%03x", (loadaddr << 12) >> 20);
}
if (Xlt_SplitLeafnameX2 ( leafname, &RA, &terminator) == OK) {
strcpy(terminator, typebuf);
return (RA.loadaddr >> 8) != (loadaddr >> 8);
}
else {
strcat(leafname, typebuf);
return 1;
}
}
#endif
/* ------------------------------- */
...@@ -73,6 +73,24 @@ extern _kernel_oserror *Xlt_Error ( err_t err ); ...@@ -73,6 +73,24 @@ extern _kernel_oserror *Xlt_Error ( err_t err );
extern err_t Xlt_SetOSError ( _kernel_oserror *err ); extern err_t Xlt_SetOSError ( _kernel_oserror *err );
#ifdef LONGNAMES #ifdef LONGNAMES
/* Looks at the specified path/leaf name and determines if it has
* a ,xxx type specifier on the end of it. If it does, it returns
* the address of the comma in the terminator parameter, and updates
* the RISCOS_ATTRIBS.loadaddr field to contain the type of the file.
* The source string is not modified (but cannot be const without
* requiring a cast to store the address of the terminator)
*/
extern err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA, extern err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA,
char **terminator); char **terminator);
/* Looks at the source filename for a rename operation and updates the
* target filename to preserve any filetyping information
*/
extern err_t Xlt_CnvRenameX2 ( char *src, char *dst );
/* Alters the filename specified so that it co-incides with the
* type encoded in the given "load addr" parameter,
* Returns 1 if it changed the filetype, 0 otherwise
*/
extern int Xlt_AddROType ( char *leafname, uint loadaddr );
#endif #endif
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