home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / SKELETON / Dev32 / ioctl.c < prev    next >
C/C++ Source or Header  |  2002-04-26  |  2KB  |  80 lines

  1. /* $Id: ioctl.c,v 1.2 2002/04/26 23:09:38 smilcke Exp $ */
  2.  
  3. /*
  4.  * ioctl.c
  5.  * Autor:               Stefan Milcke
  6.  * Erstellt am:         12.11.2001
  7.  * Letzte Aenderung am: 28.03.2002
  8.  *
  9. */
  10.  
  11. extern "C"
  12. {
  13. #define INCL_NOPMAPI
  14. #define INCL_DOSINFOSEG
  15. #include <os2.h>
  16. }
  17.  
  18. #include <devhelp.h>
  19. #include <devtype.h>
  20. #include <devrp.h>
  21. #include "devown.h"
  22. #include <ldefos2.h>
  23. #include <sk_ioctl.h>
  24. #include "Ver_32.h"
  25. #include <string.h>
  26.  
  27. extern "C"
  28. {
  29. #include <linux/types.h>
  30. #include <linux/kmod.h>
  31. #include <lxapilib.h>
  32. };
  33.  
  34. extern "C" void *malloc(unsigned long size);
  35. extern "C" void free(void *ptr);
  36.  
  37. char vendor[]="Stefan Milcke";
  38.  
  39. //-------------------------------- ioctl_global --------------------------------
  40. extern "C" ULONG ioctl_global(RPIOCtl __far *rp)
  41. {
  42.  ULONG rc=0;
  43.  switch(rp->Function)
  44.  {
  45.   case SKIOCFN_GLO_GETDRIVERINFO:
  46.    {
  47.     DATAPACKET(dp,PSKIOCDP_GLO_GETDRIVERINFO,rp,VERIFY_READWRITE);
  48.     if(dp)
  49.     {
  50.      dp->ulVersionMajor=SK32_DRV_MAJOR_VERSION;
  51.      dp->ulVersionMinor=SK32_DRV_MINOR_VERSION;
  52.      dp->ulBuildLevel=BUILD_LEVEL;
  53.      strcpy(dp->vendor,vendor);
  54.      dp->ulNumModules=OS2_get_total_num_modules();
  55.      dp->ulV4LXNumDevices=OS2_v4lx_get_num_devices();
  56.     }
  57.     else
  58.      rc=RPERR_PARAMETER;
  59.    }
  60.    break;
  61.   default:
  62.    rc=RPERR_COMMAND;
  63.    break;
  64.  }
  65.  return rc | RPDONE;
  66. }
  67.  
  68. //--------------------------------- StratIOCtl ---------------------------------
  69. extern "C" ULONG StratIOCtl(RPIOCtl __far* rp)
  70. {
  71.  switch(rp->Category)
  72.  {
  73.   case SKIOCCAT_GLO:
  74.    return ioctl_global(rp);
  75.   default:
  76.    if(OS2_lxioctl)
  77.     return OS2_lxioctl((void __far*)rp);
  78.  }
  79.  return RPERR_COMMAND | RPDONE;
  80. }