On close or commit, only update those directory entry fields that have an
SFT equivalent. The rest stays unmodified on disk. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1392 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
ba75006b67
commit
7083b0a4fa
@ -145,6 +145,7 @@ BOOL checkdstart(struct dpb FAR *dpbp, struct dirent *dentry, CLUSTER value);
|
||||
#define DIR_EXT FNAME_SIZE
|
||||
#define DIR_ATTRIB (FNAME_SIZE+FEXT_SIZE)
|
||||
#define DIR_RESERVED (FNAME_SIZE+FEXT_SIZE+1)
|
||||
#define DIR_START_HIGH (FNAME_SIZE+FEXT_SIZE+9)
|
||||
#define DIR_TIME (FNAME_SIZE+FEXT_SIZE+11)
|
||||
#define DIR_DATE (FNAME_SIZE+FEXT_SIZE+13)
|
||||
#define DIR_START (FNAME_SIZE+FEXT_SIZE+15)
|
||||
|
@ -245,10 +245,10 @@ COUNT dir_read(REG f_node_ptr fnp)
|
||||
* TRUE - all OK.
|
||||
* FALSE - error occured (fnode is released).
|
||||
*/
|
||||
#ifndef IPL
|
||||
BOOL dir_write(REG f_node_ptr fnp)
|
||||
BOOL dir_write_update(REG f_node_ptr fnp, BOOL update)
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
UBYTE FAR *vp;
|
||||
|
||||
if (!(fnp->f_flags & F_DDIR))
|
||||
return FALSE;
|
||||
@ -272,7 +272,26 @@ BOOL dir_write(REG f_node_ptr fnp)
|
||||
|
||||
swap_deleted(fnp->f_dir.dir_name);
|
||||
|
||||
putdirent(&fnp->f_dir, &bp->b_buffer[fnp->f_diridx * DIRENT_SIZE]);
|
||||
vp = &bp->b_buffer[fnp->f_diridx * DIRENT_SIZE];
|
||||
|
||||
if (update)
|
||||
{
|
||||
/* only update fields that are also in the SFT, for dos_close/commit */
|
||||
fmemcpy(&vp[DIR_NAME], fnp->f_dir.dir_name, FNAME_SIZE + FEXT_SIZE);
|
||||
fputbyte(&vp[DIR_ATTRIB], fnp->f_dir.dir_attrib);
|
||||
fputword(&vp[DIR_TIME], fnp->f_dir.dir_time);
|
||||
fputword(&vp[DIR_DATE], fnp->f_dir.dir_date);
|
||||
fputword(&vp[DIR_START], fnp->f_dir.dir_start);
|
||||
#ifdef WITHFAT32
|
||||
if (ISFAT32(fnp->f_dpb))
|
||||
fputword(&vp[DIR_START_HIGH], fnp->f_dir.dir_start_high);
|
||||
#endif
|
||||
fputlong(&vp[DIR_SIZE], fnp->f_dir.dir_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
putdirent(&fnp->f_dir, vp);
|
||||
}
|
||||
|
||||
swap_deleted(fnp->f_dir.dir_name);
|
||||
|
||||
@ -281,7 +300,6 @@ BOOL dir_write(REG f_node_ptr fnp)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID dir_close(REG f_node_ptr fnp)
|
||||
{
|
||||
|
@ -279,7 +279,7 @@ COUNT dos_close(COUNT fd)
|
||||
}
|
||||
fnp->f_flags |= F_DDIR;
|
||||
|
||||
dir_write(fnp);
|
||||
dir_write_update(fnp, TRUE);
|
||||
dir_close(fnp);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -140,7 +140,8 @@ VOID fatal(BYTE * err_msg);
|
||||
VOID dir_init_fnode(f_node_ptr fnp, CLUSTER dirstart);
|
||||
f_node_ptr dir_open(const char *dirname, f_node_ptr fnp);
|
||||
COUNT dir_read(REG f_node_ptr fnp);
|
||||
BOOL dir_write(REG f_node_ptr fnp);
|
||||
BOOL dir_write_update(REG f_node_ptr fnp, BOOL update);
|
||||
#define dir_write(fnp) dir_write_update(fnp, FALSE)
|
||||
VOID dir_close(REG f_node_ptr fnp);
|
||||
COUNT dos_findfirst(UCOUNT attr, BYTE * name);
|
||||
COUNT dos_findnext(void);
|
||||
|
Loading…
Reference in New Issue
Block a user