Eliminate dos_getftime, dos_getfsize, and dos_getfattr_fd, because we can

now get these properties directly from the SFT.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1399 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2009-05-26 13:59:44 +00:00
parent e63e5dd125
commit f9f2fe447d
4 changed files with 4 additions and 86 deletions

View File

@ -301,8 +301,6 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode)
long XferCount = rwblock(s->sft_status, bp, n, mode);
if (XferCount < 0)
return XferCount;
if (mode == XFR_WRITE)
s->sft_size = dos_getfsize(s->sft_status);
s->sft_posit += XferCount;
return XferCount;
}
@ -604,7 +602,6 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
int status = (int)(result >> 16);
if (status == S_OPENED)
{
sftp->sft_attrib = dos_getfattr_fd((COUNT)result);
/* Check permissions. -- JPP
(do not allow to open volume labels/directories) */
if (sftp->sft_attrib & (D_DIR | D_VOLID))
@ -613,14 +610,10 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
sftp->sft_count--;
return DE_ACCESS;
}
sftp->sft_size = dos_getfsize((COUNT)result);
}
sftp->sft_status = (COUNT)result;
sftp->sft_flags = PriPathName[0] - 'A';
DosGetFile(PriPathName, sftp->sft_name);
dos_getftime(sftp->sft_status,
(date FAR *) & sftp->sft_date,
(time FAR *) & sftp->sft_time);
return sft_idx | ((long)status << 16);
}
else
@ -1150,16 +1143,9 @@ COUNT DosGetFtime(COUNT hndl, date * dp, time * tp)
if (FP_OFF(s = get_sft(hndl)) == (size_t) - 1)
return DE_INVLDHNDL;
/* If SFT entry refers to a device, return the date and time of opening */
if (s->sft_flags & (SFT_FDEVICE | SFT_FSHARED))
{
*dp = s->sft_date;
*tp = s->sft_time;
return SUCCESS;
}
/* call file system handler */
return dos_getftime(s->sft_status, dp, tp);
*dp = s->sft_date;
*tp = s->sft_time;
return SUCCESS;
}
COUNT DosSetFtimeSft(int sft_idx, date dp, time tp)

View File

@ -842,30 +842,6 @@ time dos_gettime(void)
return time_encode(&dt);
}
/* */
/* dos_getftime for the file time */
/* */
COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp)
{
f_node_ptr fnp;
/* Translate the fd into an fnode pointer, since all internal */
/* operations are achieved through fnodes. */
fnp = xlt_fd(fd);
/* If the fd was invalid because it was out of range or the */
/* requested file was not open, tell the caller and exit */
/* note: an invalid fd is indicated by a 0 return */
if (fnp == (f_node_ptr) 0)
return DE_INVLDHNDL;
/* Get the date and time from the fnode and return */
*dp = fnp->f_dir.dir_date;
*tp = fnp->f_dir.dir_time;
return SUCCESS;
}
/* */
/* dos_setftime for the file time */
/* */
@ -893,27 +869,6 @@ COUNT dos_setftime(COUNT fd, date dp, time tp)
return SUCCESS;
}
/* */
/* dos_getfsize for the file time */
/* */
ULONG dos_getfsize(COUNT fd)
{
f_node_ptr fnp;
/* Translate the fd into an fnode pointer, since all internal */
/* operations are achieved through fnodes. */
fnp = xlt_fd(fd);
/* If the fd was invalid because it was out of range or the */
/* requested file was not open, tell the caller and exit */
/* note: an invalid fd is indicated by a 0 return */
if (fnp == (f_node_ptr) 0)
return (ULONG)-1l;
/* Return the file size */
return fnp->f_dir.dir_size;
}
/* */
/* dos_setfsize for the file time */
/* */
@ -1865,19 +1820,6 @@ int dos_cd(char * PathName)
#endif
#ifndef IPL
COUNT dos_getfattr_fd(COUNT fd)
{
f_node_ptr fnp = xlt_fd(fd);
/* If the fd was invalid because it was out of range or the */
/* requested file was not open, tell the caller and exit */
/* note: an invalid fd is indicated by a 0 return */
if (fnp == (f_node_ptr) 0)
return DE_TOOMANY;
return fnp->f_dir.dir_attrib;
}
COUNT dos_getfattr(BYTE * name)
{
f_node_ptr fnp;

View File

@ -161,9 +161,7 @@ COUNT dos_rmdir(BYTE * path);
COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib);
date dos_getdate(void);
time dos_gettime(void);
COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp);
COUNT dos_setftime(COUNT fd, date dp, time tp);
ULONG dos_getfsize(COUNT fd);
BOOL dos_setfsize(COUNT fd, LONG size);
COUNT dos_mkdir(BYTE * dir);
BOOL last_link(f_node_ptr fnp);
@ -180,7 +178,6 @@ VOID trim_path(BYTE FAR * s);
int dos_cd(char * PathName);
COUNT dos_getfattr_fd(COUNT fd);
COUNT dos_getfattr(BYTE * name);
COUNT dos_setfattr(BYTE * name, UWORD attrp);
COUNT media_check(REG struct dpb FAR * dpbp);

View File

@ -89,14 +89,7 @@ ULONG SftGetFsize(int sft_idx)
if (FP_OFF(s) == (size_t) -1)
return DE_INVLDHNDL;
/* If SFT entry refers to a device, return the date and time of opening */
if (s->sft_flags & (SFT_FDEVICE | SFT_FSHARED))
{
return s->sft_size;
}
/* call file system handler */
return dos_getfsize(s->sft_status);
return s->sft_size;
}
STATIC COUNT ChildEnv(exec_blk * exp, UWORD * pChildEnvSeg, char far * pathname)