home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
e2fltsrc.zip
/
e2filt.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-25
|
3KB
|
66 lines
/************************************************************************/
/* Linux partition filter (C) Deon van der Westhuysen. */
/* */
/* Dedicated to Jesus Christ, my Lord and Saviour. */
/* */
/* Permission is granted to freely use and modify this code for non- */
/* profit use on the condition that this notice is not removed. All */
/* other rights are reserved. No warranty, etc. */
/* */
/* This code is still under development; expect some rough edges. */
/* */
/************************************************************************/
#include "debug.h"
#include "e2data.h"
#include "e2router.h"
#include "e2filt.h"
#include "e2wrap.h"
/* Any IORBs for the base units arrive here, including requests generated */
/* by accesses to the data in the virtual partitions. */
void FilterHandler (PIORB pIORB)
{
NPBaseUnitRec pUnitRec; /* Ptr to unit record */
pUnitRec= (NPBaseUnitRec) pIORB->UnitHandle; /* Get ptr to unit record */
/* from the unit handle */
pUnitRec->SaveReqCtrl= pIORB->RequestControl; /* Save request flags */
pUnitRec->SaveNotify= pIORB->NotifyAddress; /* Save notify address */
pUnitRec->SaveReserved= pIORB->Reserved_1; /* Save reserved field */
pIORB->Reserved_1= pIORB->UnitHandle; /* Save unit handle */
pIORB->UnitHandle= pUnitRec->UnitHandle; /* Restore old unit handle */
pIORB->NotifyAddress= &FilterNotifyWrapper; /* Install our routine */
pIORB->RequestControl|= IORB_ASYNC_POST; /* Request notification */
pIORB->RequestControl&= ~IORB_CHAIN; /* No IORBs to chain */
/* Check for commands that we might wish to change. None yet. */
/* except allocation- but that was allready done in the router */
/* If we are still here then the command was not intercepted... */
pUnitRec->pADDEntry(pIORB); /* Ask the original driver to do the request */
}
/* This routine is called by the original device driver as soon as the */
/* filtered request is done. Here the fields we modified in the IORB are */
/* restored before we pass it back to the original caller. */
void FilterNotify (PIORB pIORB)
{
NPBaseUnitRec pUnitRec; /* Ptr to unit record */
NPIORBQueue pQueue; /* Queue request came from */
pUnitRec= (NPBaseUnitRec) pIORB->Reserved_1; /* Get ptr to unit record */
pIORB->UnitHandle= (USHORT) pUnitRec; /* Restore old unit handle */
pIORB->RequestControl= pUnitRec->SaveReqCtrl; /* Restore rest of IORB */
pIORB->Reserved_1= pUnitRec->SaveReserved;
pIORB->NotifyAddress= pUnitRec->SaveNotify;
pQueue= &(pUnitRec->Hdr.IORBQueue); /* Get ptr to IORB queue */
pQueue->Flags&=~F_REQUEST_BUSY; /* Indicate queue finished */
NotifyDone (pIORB); /* Notify caller */
StartIORBQueue (pQueue); /* Try to restart queue */
}