home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / kernex32.zip / mwdd_src.zip / 32bits / ext2-os2 / mwdd32 / mwdd32_strategy.c < prev    next >
C/C++ Source or Header  |  1997-03-16  |  3KB  |  88 lines

  1. //
  2. // $Header: d:\\32bits\\ext2-os2\\mwdd32\\rcs\\mwdd32_strategy.c,v 1.2 1997/03/16 12:44:29 Willm Exp $
  3. //
  4.  
  5. // 32 bits OS/2 device driver and IFS support. Provides 32 bits kernel 
  6. // services (DevHelp) and utility functions to 32 bits OS/2 ring 0 code 
  7. // (device drivers and installable file system drivers).
  8. // Copyright (C) 1995, 1996, 1997  Matthieu WILLM (willm@ibm.net)
  9. //
  10. // This program is free software; you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation; either version 2 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program; if not, write to the Free Software
  22. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  
  24. #define INCL_DOSERRORS
  25. #define INCL_DOS
  26. #define INCL_NOPMAPI
  27. #include <os2.h>
  28.  
  29. #include <os2/types.h>
  30. #include <mwdd32_entry_points.h>
  31. #include <reqpkt32.h>
  32.  
  33. static int (*driver_routing_table[32])() = {
  34.     mwdd32_invalid_command,  // 0 = Init
  35.     mwdd32_invalid_command,  // 1 = Media Check
  36.     mwdd32_invalid_command,  // 2 = Build BPB
  37.     mwdd32_invalid_command,  // 3 = Reserved
  38.     mwdd32_invalid_command,  // 4 = Read
  39.     mwdd32_invalid_command,  // 5 = Non-Destruct Read NoWait
  40.     mwdd32_invalid_command,  // 6 = Input Status
  41.     mwdd32_invalid_command,  // 7 = Input Flush
  42.     mwdd32_invalid_command,  // 8 = Write
  43.     mwdd32_invalid_command,  // 9 = Write w/Verify
  44.     mwdd32_invalid_command,  // A = Output Status
  45.     mwdd32_invalid_command,  // B = Output Flush
  46.     mwdd32_invalid_command,  // C = Reserved
  47.     mwdd32_open,             // D = Device Open (R/M)
  48.     mwdd32_close,            // E = Device Close (R/M)
  49.     mwdd32_invalid_command,  // F = Removable Media (R/M)
  50.     mwdd32_ioctl,            // 10 = Generic Ioctl
  51.     mwdd32_invalid_command,  // 11 = Reset Media
  52.     mwdd32_invalid_command,  // 12 = Get Logical Drive Map
  53.     mwdd32_invalid_command,  // 13 = Set Logical Drive Map
  54.     mwdd32_invalid_command,  // 14 = DeInstall
  55.     mwdd32_invalid_command,  // 15 = 
  56.     mwdd32_invalid_command,  // 16 = Get # Partitions
  57.     mwdd32_invalid_command,  // 17 = Get Unit map
  58.     mwdd32_invalid_command,  // 18 = No caching read
  59.     mwdd32_invalid_command,  // 19 = No caching write
  60.     mwdd32_invalid_command,  // 1A = No caching write w/Verify
  61.     mwdd32_init_base,        // 1B = Initialize
  62.     mwdd32_shutdown,         // 1C = Shutdown
  63.     mwdd32_invalid_command,  // 1D = Get DCS/VCS
  64.     mwdd32_invalid_command,  // 1E = ???
  65.     mwdd32_init_complete     // 1F = Init Complete
  66. };
  67.  
  68.  
  69. /*
  70.  * This is the 32 bits strategy entry point
  71.  */
  72. int DRV32ENTRY mwdd32_strategy(PTR16 reqpkt, int index) {
  73.     int status;
  74.  
  75.     if (index < sizeof(driver_routing_table) / sizeof(*driver_routing_table)) {
  76.         /*
  77.          * Valid command received
  78.          */
  79.         status = driver_routing_table[index](reqpkt);
  80.     } else {
  81.         /*
  82.          * Invalid command received
  83.          */
  84.         status = STDON + STERR + ERROR_I24_INVALID_PARAMETER;
  85.     }
  86.     return status;
  87. }
  88.