- The buffered and unbuffered file hook code is now invoked through

function pointers alone. The utility.library/CallHookPkt mechanism
  is no longer required.

- Moved the entire lseek() code relevant for files into the hook
  function.

- Simplified the close() function which now just calls into the
  hook code to perform whatever is necessary. The hook code is
  responsible for cleaning up after aliases, etc. This change in
  turn made it possible to greatly simplify the hook code for
  buffered files which now bypasses close/read/write/lseek and
  directly invokes the hook code for unbuffered files.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14835 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-02-20 13:19:40 +00:00
parent cfa6f566db
commit 410833d2ed
42 changed files with 841 additions and 999 deletions
+8 -29
View File
@@ -1,5 +1,5 @@
/*
* $Id: stdio_flushiobwritebuffer.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
* $Id: stdio_flushiobwritebuffer.c,v 1.4 2005-02-20 13:19:40 obarthel Exp $
*
* :ts=4
*
@@ -42,26 +42,9 @@
/****************************************************************************/
/*
int
__iob_write_buffer_is_full(struct iob * file)
{
int result;
assert( file != NULL );
result = (file->iob_BufferSize > 0 && (ULONG)file->iob_BufferWriteBytes == file->iob_BufferSize);
return(result);
}
*/
/****************************************************************************/
int
__flush_iob_write_buffer(struct iob * file)
{
DECLARE_UTILITYBASE();
int result = 0;
ENTER();
@@ -69,7 +52,6 @@ __flush_iob_write_buffer(struct iob * file)
SHOWPOINTER(file);
assert( file != NULL );
assert( UtilityBase != NULL );
assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) );
assert( file->iob_BufferSize > 0 );
@@ -78,7 +60,7 @@ __flush_iob_write_buffer(struct iob * file)
if(FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) && file->iob_BufferWriteBytes > 0)
{
struct file_hook_message message;
struct file_action_message fam;
assert( FLAG_IS_SET(file->iob_Flags,IOBF_WRITE) );
assert( file->iob_BufferSize > 0 );
@@ -87,22 +69,19 @@ __flush_iob_write_buffer(struct iob * file)
SHOWMSG("calling the hook");
message.action = file_hook_action_write;
message.data = file->iob_Buffer;
message.size = file->iob_BufferWriteBytes;
message.result = 0;
fam.fam_Action = file_action_write;
fam.fam_Data = file->iob_Buffer;
fam.fam_Size = file->iob_BufferWriteBytes;
assert( file->iob_Hook != NULL );
assert( file->iob_Action != NULL );
CallHookPkt(file->iob_Hook,file,&message);
if(message.result != file->iob_BufferWriteBytes)
if((*file->iob_Action)(file,&fam) != file->iob_BufferWriteBytes)
{
SHOWMSG("that didn't work");
SET_FLAG(file->iob_Flags,IOBF_ERROR);
__set_errno(message.error);
__set_errno(fam.fam_Error);
result = -1;
goto out;