home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 10 / mycd10.iso / share / os2 / utilidad / ext2fl / e2filt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-31  |  3.9 KB  |  77 lines

  1. /************************************************************************/
  2. /*                       Linux partition filter.                        */
  3. /*          (C) Copyright Deon van der Westhuysen, July 1995.           */
  4. /*                                                                      */
  5. /*  Dedicated to Jesus Christ, my Lord and Saviour.                     */
  6. /*                                                                      */
  7. /* This program is free software; you can redistribute it and/or modify */
  8. /* it under the terms of the GNU General Public License as published by */
  9. /* the Free Software Foundation; either version 2, or (at your option)  */
  10. /* any later version.                                                   */
  11. /*                                                                      */
  12. /* This program is distributed in the hope that it will be useful,      */
  13. /* but WITHOUT ANY WARRANTY; without even the implied warranty of       */
  14. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
  15. /* GNU General Public License for more details.                         */
  16. /*                                                                      */
  17. /* You should have received a copy of the GNU General Public License    */
  18. /* along with this program; if not, write to the Free Software          */
  19. /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            */
  20. /*                                                                      */
  21. /*  This code is still under development; expect some rough edges.      */
  22. /*                                                                      */
  23. /************************************************************************/
  24.  
  25. #include "debug.h"
  26. #include "e2data.h"
  27. #include "e2router.h"
  28. #include "e2filt.h"
  29. #include "e2wrap.h"
  30.  
  31. /* Any IORBs for the base units arrive here, including requests generated */
  32. /* by accesses to the data in the virtual partitions. */
  33. void FilterHandler (PIORB pIORB)
  34. {
  35.  NPBaseUnitRec    pUnitRec;            /* Ptr to unit record */
  36.  
  37.  pUnitRec= (NPBaseUnitRec) pIORB->UnitHandle;    /* Get ptr to unit record */
  38.                         /* from the unit handle */
  39.  pUnitRec->SaveReqCtrl= pIORB->RequestControl;    /* Save request flags */
  40.  pUnitRec->SaveNotify= pIORB->NotifyAddress;    /* Save notify address */
  41.  pUnitRec->SaveReserved= pIORB->Reserved_1;    /* Save reserved field */
  42.  pIORB->Reserved_1= pIORB->UnitHandle;        /* Save unit handle */
  43.  
  44.  pIORB->UnitHandle= pUnitRec->UnitHandle;    /* Restore old unit handle */
  45.  pIORB->NotifyAddress= &FilterNotifyWrapper;    /* Install our routine */
  46.  pIORB->RequestControl|= IORB_ASYNC_POST;    /* Request notification */
  47.  pIORB->RequestControl&= ~IORB_CHAIN;        /* No IORBs to chain */
  48.  
  49.  /* Check for commands that we might wish to change. None yet. */
  50.  /* except allocation- but that was allready done in the router */
  51.  
  52.  /* If we are still here then the command was not intercepted... */
  53.  pUnitRec->pADDEntry(pIORB);    /* Ask the original driver to do the request */
  54. }
  55.  
  56. /* This routine is called by the original device driver as soon as the */
  57. /* filtered request is done. Here the fields we modified in the IORB are */
  58. /* restored before we pass it back to the original caller. */
  59. void FilterNotify (PIORB pIORB)
  60. {
  61.  NPBaseUnitRec    pUnitRec;            /* Ptr to unit record */
  62.  NPIORBQueue    pQueue;                /* Queue request came from */
  63.  
  64.  pUnitRec= (NPBaseUnitRec) pIORB->Reserved_1;    /* Get ptr to unit record */
  65.  
  66.  pIORB->UnitHandle= (USHORT) pUnitRec;        /* Restore old unit handle */
  67.  pIORB->RequestControl= pUnitRec->SaveReqCtrl;    /* Restore rest of IORB */
  68.  pIORB->Reserved_1= pUnitRec->SaveReserved;
  69.  pIORB->NotifyAddress= pUnitRec->SaveNotify;
  70.  
  71.  pQueue= &(pUnitRec->Hdr.IORBQueue);        /* Get ptr to IORB queue */
  72.  
  73.  pQueue->Flags&=~F_REQUEST_BUSY;        /* Indicate queue finished */
  74.  NotifyDone (pIORB);                /* Notify caller */
  75.  StartIORBQueue (pQueue);            /* Try to restart queue */
  76. }
  77.