Eliminate the sft_status field as it is now equal to the SFT index.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1400 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2009-05-26 14:11:50 +00:00
parent f9f2fe447d
commit a69b4ba011
5 changed files with 15 additions and 25 deletions

View File

@ -85,8 +85,6 @@ typedef struct {
#endif #endif
} sft; } sft;
#define sft_status sft_mach
/* SFT Table header definition */ /* SFT Table header definition */
typedef struct _sftheader { typedef struct _sftheader {
struct sfttbl FAR * /* link to next table in list */ struct sfttbl FAR * /* link to next table in list */

View File

@ -298,7 +298,7 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode)
} }
/* /// End of additions for SHARE - Ron Cemer */ /* /// 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) if (XferCount < 0)
return XferCount; return XferCount;
s->sft_posit += XferCount; s->sft_posit += XferCount;
@ -360,7 +360,7 @@ COUNT SftSeek(int sft_idx, LONG new_pos, COUNT mode)
} }
else else
{ {
LONG result = dos_lseek(s->sft_status, new_pos, mode); LONG result = dos_lseek(sft_idx, new_pos, mode);
if (result < 0l) if (result < 0l)
return (int)result; return (int)result;
else else
@ -599,22 +599,20 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
result = dos_open(PriPathName, flags, attrib, sft_idx); result = dos_open(PriPathName, flags, attrib, sft_idx);
if (result >= 0) if (result >= 0)
{ {
int status = (int)(result >> 16); if (result == S_OPENED)
if (status == S_OPENED)
{ {
/* Check permissions. -- JPP /* Check permissions. -- JPP
(do not allow to open volume labels/directories) */ (do not allow to open volume labels/directories) */
if (sftp->sft_attrib & (D_DIR | D_VOLID)) if (sftp->sft_attrib & (D_DIR | D_VOLID))
{ {
dos_close((COUNT)result); dos_close(sft_idx);
sftp->sft_count--; sftp->sft_count--;
return DE_ACCESS; return DE_ACCESS;
} }
} }
sftp->sft_status = (COUNT)result;
sftp->sft_flags = PriPathName[0] - 'A'; sftp->sft_flags = PriPathName[0] - 'A';
DosGetFile(PriPathName, sftp->sft_name); DosGetFile(PriPathName, sftp->sft_name);
return sft_idx | ((long)status << 16); return sft_idx | ((long)result << 16);
} }
else else
{ {
@ -699,16 +697,10 @@ COUNT DosForceDup(unsigned OldHandle, unsigned NewHandle)
} }
/* If everything looks ok, bump it up. */ /* If everything looks ok, bump it up. */
if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED)) p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle];
|| (Sftp->sft_status >= 0)) /* possible hazard: integer overflow ska*/
{ Sftp->sft_count += 1;
p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle]; return SUCCESS;
/* possible hazard: integer overflow ska*/
Sftp->sft_count += 1;
return SUCCESS;
}
else
return DE_INVLDHNDL;
} }
COUNT DosCloseSft(int sft_idx, BOOL commitonly) COUNT DosCloseSft(int sft_idx, BOOL commitonly)
@ -747,7 +739,7 @@ COUNT DosCloseSft(int sft_idx, BOOL commitonly)
} }
/* else call file system handler */ /* else call file system handler */
result = dos_close(sftp->sft_status); result = dos_close(sft_idx);
if (commitonly || result != SUCCESS) if (commitonly || result != SUCCESS)
return result; return result;
@ -1168,7 +1160,7 @@ COUNT DosSetFtimeSft(int sft_idx, date dp, time tp)
return SUCCESS; return SUCCESS;
/* call file system handler */ /* call file system handler */
return dos_setftime(s->sft_status, dp, tp); return dos_setftime(sft_idx, dp, tp);
} }
COUNT DosGetFattr(BYTE FAR * name) COUNT DosGetFattr(BYTE FAR * name)

View File

@ -137,7 +137,7 @@ STATIC void init_direntry(struct dirent *dentry, unsigned attrib,
/* see DosOpenSft(), dosfns.c for an explanation of the flags bits */ /* see DosOpenSft(), dosfns.c for an explanation of the flags bits */
/* directory opens are allowed here; these are not allowed by DosOpenSft*/ /* 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; REG f_node_ptr fnp;
char fcbname[FNAME_SIZE + FEXT_SIZE]; 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; fnp->f_cluster_offset = 0;
save_far_f_node(fnp); 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) BOOL fcmp_wild(const char * s1, const char * s2, unsigned n)

View File

@ -628,7 +628,7 @@ UBYTE FcbClose(xfcb FAR * lpXfcb)
/* change time and set file size */ /* change time and set file size */
s->sft_size = lpFcb->fcb_fsize; s->sft_size = lpFcb->fcb_fsize;
if (!(s->sft_flags & SFT_FSHARED)) 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); DosSetFtimeSft(lpFcb->fcb_sftno, lpFcb->fcb_date, lpFcb->fcb_time);
if ((CritErrCode = -DosCloseSft(lpFcb->fcb_sftno, FALSE)) == SUCCESS) if ((CritErrCode = -DosCloseSft(lpFcb->fcb_sftno, FALSE)) == SUCCESS)
{ {

View File

@ -151,7 +151,7 @@ int FileName83Length(BYTE * filename83);
/* fatfs.c */ /* fatfs.c */
struct dpb FAR *get_dpb(COUNT dsk); struct dpb FAR *get_dpb(COUNT dsk);
ULONG clus2phys(CLUSTER cl_no, struct dpb FAR * dpbp); 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 fcbmatch(const char *fcbname1, const char *fcbname2);
BOOL fcmp_wild(const char * s1, const char * s2, unsigned n); BOOL fcmp_wild(const char * s1, const char * s2, unsigned n);
VOID touc(BYTE * s, COUNT n); VOID touc(BYTE * s, COUNT n);