From Eric, reduce unnecessary calls to share hook, only re-check (int 2f/1000) on open/close, not on each access

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1379 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Kenneth J Davis 2009-05-11 22:04:43 +00:00
parent d41599e2cc
commit 01cc83bc82
3 changed files with 11 additions and 8 deletions

View File

@ -289,7 +289,7 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode)
/* a block transfer */
/* /// Added for SHARE - Ron Cemer */
if (IsShareInstalled() && (s->sft_shroff >= 0))
if (IsShareInstalled(FALSE) && (s->sft_shroff >= 0))
{
int rc = share_access_check(cu_psp, s->sft_shroff, s->sft_posit,
(unsigned long)n, 1);
@ -581,7 +581,7 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
}
/* /// Added for SHARE. - Ron Cemer */
if (IsShareInstalled())
if (IsShareInstalled(TRUE))
{
if ((sftp->sft_shroff =
share_open_check(PriPathName, cu_psp,
@ -625,7 +625,7 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
else
{
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
if (IsShareInstalled())
if (IsShareInstalled(TRUE))
{
share_close_file(sftp->sft_shroff);
sftp->sft_shroff = -1;
@ -755,7 +755,7 @@ COUNT DosCloseSft(int sft_idx, BOOL commitonly)
return dos_commit(sftp->sft_status);
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
if (IsShareInstalled())
if (IsShareInstalled(TRUE))
{
if (sftp->sft_shroff >= 0)
share_close_file(sftp->sft_shroff);
@ -1359,7 +1359,7 @@ COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock)
return remote_lock_unlock(s, pos, len, unlock);
/* Invalid function unless SHARE is installed or remote. */
if (!IsShareInstalled())
if (!IsShareInstalled(FALSE))
return DE_INVLDFUNC;
/* Lock violation if this SFT entry does not support locking. */
@ -1449,10 +1449,13 @@ struct dhdr FAR *IsDevice(const char FAR * fname)
}
/* /// Added for SHARE. - Ron Cemer */
/* Eric 8/2008: only re-check (2f.1000) on open/close, not on each access */
BOOL IsShareInstalled(void)
BOOL IsShareInstalled(BOOL recheck)
{
extern unsigned char ASMPASCAL share_check(void);
if (recheck == FALSE)
return share_installed;
if (!share_installed && share_check() == 0xff)
share_installed = TRUE;
return share_installed;

View File

@ -447,7 +447,7 @@ STATIC void merge_file_changes(f_node_ptr fnp, int collect)
f_node_ptr fnp2;
int i, fd;
if (!IsShareInstalled())
if (!IsShareInstalled(FALSE))
return;
fd = xlt_fnp(fnp);

View File

@ -112,7 +112,7 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2);
COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib);
COUNT DosMkRmdir(const char FAR * dir, int action);
struct dhdr FAR *IsDevice(const char FAR * FileName);
BOOL IsShareInstalled(void);
BOOL IsShareInstalled(BOOL recheck);
COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock);
int idx_to_sft_(int SftIndex);
sft FAR *idx_to_sft(int SftIndex);