diff --git a/hdr/sft.h b/hdr/sft.h index 1adc1be..2fff420 100644 --- a/hdr/sft.h +++ b/hdr/sft.h @@ -85,8 +85,6 @@ typedef struct { #endif } sft; -#define sft_status sft_mach - /* SFT Table header definition */ typedef struct _sftheader { struct sfttbl FAR * /* link to next table in list */ diff --git a/kernel/dosfns.c b/kernel/dosfns.c index fda1a05..5c31f84 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -298,7 +298,7 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode) } /* /// End of additions for SHARE - Ron Cemer */ { - long XferCount = rwblock(s->sft_status, bp, n, mode); + long XferCount = rwblock(sft_idx, bp, n, mode); if (XferCount < 0) return XferCount; s->sft_posit += XferCount; @@ -360,7 +360,7 @@ COUNT SftSeek(int sft_idx, LONG new_pos, COUNT mode) } else { - LONG result = dos_lseek(s->sft_status, new_pos, mode); + LONG result = dos_lseek(sft_idx, new_pos, mode); if (result < 0l) return (int)result; else @@ -599,22 +599,20 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib) result = dos_open(PriPathName, flags, attrib, sft_idx); if (result >= 0) { - int status = (int)(result >> 16); - if (status == S_OPENED) + if (result == S_OPENED) { /* Check permissions. -- JPP (do not allow to open volume labels/directories) */ if (sftp->sft_attrib & (D_DIR | D_VOLID)) { - dos_close((COUNT)result); + dos_close(sft_idx); sftp->sft_count--; return DE_ACCESS; } } - sftp->sft_status = (COUNT)result; sftp->sft_flags = PriPathName[0] - 'A'; DosGetFile(PriPathName, sftp->sft_name); - return sft_idx | ((long)status << 16); + return sft_idx | ((long)result << 16); } else { @@ -699,16 +697,10 @@ COUNT DosForceDup(unsigned OldHandle, unsigned NewHandle) } /* If everything looks ok, bump it up. */ - if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED)) - || (Sftp->sft_status >= 0)) - { - p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle]; - /* possible hazard: integer overflow ska*/ - Sftp->sft_count += 1; - return SUCCESS; - } - else - return DE_INVLDHNDL; + p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle]; + /* possible hazard: integer overflow ska*/ + Sftp->sft_count += 1; + return SUCCESS; } COUNT DosCloseSft(int sft_idx, BOOL commitonly) @@ -747,7 +739,7 @@ COUNT DosCloseSft(int sft_idx, BOOL commitonly) } /* else call file system handler */ - result = dos_close(sftp->sft_status); + result = dos_close(sft_idx); if (commitonly || result != SUCCESS) return result; @@ -1168,7 +1160,7 @@ COUNT DosSetFtimeSft(int sft_idx, date dp, time tp) return SUCCESS; /* call file system handler */ - return dos_setftime(s->sft_status, dp, tp); + return dos_setftime(sft_idx, dp, tp); } COUNT DosGetFattr(BYTE FAR * name) diff --git a/kernel/fatfs.c b/kernel/fatfs.c index f9fb547..780197c 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -137,7 +137,7 @@ STATIC void init_direntry(struct dirent *dentry, unsigned attrib, /* see DosOpenSft(), dosfns.c for an explanation of the flags bits */ /* directory opens are allowed here; these are not allowed by DosOpenSft*/ -long dos_open(char *path, unsigned flags, unsigned attrib, int fd) +int dos_open(char *path, unsigned flags, unsigned attrib, int fd) { REG f_node_ptr fnp; char fcbname[FNAME_SIZE + FEXT_SIZE]; @@ -242,7 +242,7 @@ long dos_open(char *path, unsigned flags, unsigned attrib, int fd) fnp->f_cluster_offset = 0; save_far_f_node(fnp); - return xlt_fnp(fnp) | ((long)status << 16); + return status; } BOOL fcmp_wild(const char * s1, const char * s2, unsigned n) diff --git a/kernel/fcbfns.c b/kernel/fcbfns.c index fb8d1fc..6fba332 100644 --- a/kernel/fcbfns.c +++ b/kernel/fcbfns.c @@ -628,7 +628,7 @@ UBYTE FcbClose(xfcb FAR * lpXfcb) /* change time and set file size */ s->sft_size = lpFcb->fcb_fsize; if (!(s->sft_flags & SFT_FSHARED)) - dos_setfsize(s->sft_status, lpFcb->fcb_fsize); + dos_setfsize(lpFcb->fcb_sftno, lpFcb->fcb_fsize); DosSetFtimeSft(lpFcb->fcb_sftno, lpFcb->fcb_date, lpFcb->fcb_time); if ((CritErrCode = -DosCloseSft(lpFcb->fcb_sftno, FALSE)) == SUCCESS) { diff --git a/kernel/proto.h b/kernel/proto.h index 615aeb7..15b4be2 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -151,7 +151,7 @@ int FileName83Length(BYTE * filename83); /* fatfs.c */ struct dpb FAR *get_dpb(COUNT dsk); ULONG clus2phys(CLUSTER cl_no, struct dpb FAR * dpbp); -long dos_open(char * path, unsigned flag, unsigned attrib, int fd); +int dos_open(char * path, unsigned flag, unsigned attrib, int fd); BOOL fcbmatch(const char *fcbname1, const char *fcbname2); BOOL fcmp_wild(const char * s1, const char * s2, unsigned n); VOID touc(BYTE * s, COUNT n);