home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Utilities / vmount-0.6a-I / src / dummies.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-30  |  3.9 KB  |  228 lines

  1. /*
  2.  * Name: dummies.c
  3.  * Description: These functions try to do nothing in the smartest possible way.
  4.  * Author: Christian Starkjohann <cs@hal.kph.tuwien.ac.at>
  5.  * Date: 1996-11-14
  6.  * Copyright: GNU-GPL
  7.  * Tabsize: 4
  8.  */
  9.  
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include <stdlib.h>
  13. #include <time.h>
  14. #include <sys/time.h>
  15. #include "my_defines.h"
  16.  
  17.  
  18. #define    DPRINTF(arg)    if(debug_mode & DEBUG_DUMMIES)    dprintf arg
  19.  
  20. /* ------------------------------------------------------------------------- */
  21.  
  22. int                securelevel = 0;
  23. struct timezone    sys_tz;
  24. struct timeval    xtime;        /* should contain current time */
  25. unsigned long volatile    jiffies;
  26. int                event = 0;
  27. void            *chrdev_inode_operations[20] = {NULL};
  28. void            *blkdev_inode_operations[20] = {NULL};
  29. int                read_ahead[256];
  30. int                *hardsect_size[256];
  31. int                *blksize_size[256];
  32. int                *blk_size[256];
  33.  
  34. /* ------------------------------------------------------------------------- */
  35.  
  36. static char    *dev_name;
  37.  
  38. /* ------------------------------------------------------------------------- */
  39.  
  40. int    printk(char *fmt,int arg1,int arg2, int arg3, int arg4, int arg5, int arg6)
  41. {
  42.     eprintf(fmt, arg1, arg2, arg3, arg4, arg5, arg6);
  43.     return 1;
  44. }
  45.  
  46. void    panic(char *fmt,int arg1,int arg2, int arg3, int arg4, int arg5, int arg6)
  47. {
  48.     eprintf("linux kernel panic: ");
  49.     fatal_error(fmt, arg1, arg2, arg3, arg4, arg5, arg6);
  50. }
  51.  
  52. char    *___strtok(char *s1, const char *s2)
  53. {
  54.     return strtok(s1, s2);
  55. }
  56.  
  57. unsigned long simple_strtoul(const char *s, char **p, unsigned int base)
  58. {
  59.     return strtoul(s, p, base);
  60. }
  61.  
  62. char    *kdevname(void)
  63. {
  64.     return dev_name;
  65. }
  66.  
  67. void    refile_buffer(void)
  68. {
  69. }
  70.  
  71. void    insert_inode_hash(void)
  72. {
  73. }
  74.  
  75. void    schedule(void)
  76. {
  77. }
  78.  
  79. void    *kmalloc(long size, int priority)
  80. {
  81.     return malloc(size);
  82. }
  83.  
  84. void    kfree(void *obj)
  85. {
  86.     free(obj);
  87. }
  88.  
  89. int        verify_area(void)
  90. {
  91.     return 0; /* verifies readability of arguments */
  92. }
  93.  
  94. int        register_symtab_from(void)
  95. {
  96.     return 0;
  97. }
  98.  
  99. void    init_fifo(void)
  100. {
  101. }
  102.  
  103. void    sleep_on(void)
  104. {
  105. }
  106.  
  107. void    wake_up(void)
  108. {
  109. }
  110.  
  111. void    __wait_on_super(void)
  112. {
  113. }
  114.  
  115. void    __wait_on_buffer(void)
  116. {
  117. }
  118.  
  119. void    update_vm_cache(void)
  120. {
  121. }
  122.  
  123. void    file_fsync(void)
  124. {
  125.     fatal_error("** file_fsync() called but not implemented\n");
  126. }
  127.  
  128. void    dcache_add(void)
  129. {
  130. }
  131.  
  132. int        dcache_lookup(void)
  133. {
  134.     return 0;
  135. }
  136.  
  137. int        generate_cluster(void)
  138. {
  139.     return 0;
  140. }
  141.  
  142. int        down_failed(void)
  143. {
  144.     return 0;
  145. }
  146.  
  147. int        up_wakeup(void)
  148. {
  149.     return 0;
  150. }
  151.  
  152. int        inode_change_ok(void)
  153. {
  154.     eprintf("** inode_change_ok() called but not implemented\n");
  155.     return -1;
  156. }
  157.  
  158. void    inode_setattr(void)
  159. {
  160.     fatal_error("** inode_change_ok() called but not implemented\n");
  161. }
  162.  
  163. int    check_disk_change(void)
  164. {
  165.     return 0;
  166. }
  167.  
  168. void    open_namei(void)
  169. {
  170.     fatal_error("** open_namei() called but not implemented\n");
  171. }
  172.  
  173. void    generic_file_mmap(void)
  174. {
  175.     fatal_error("** generic_file_mmap() called but not implemented\n");
  176. }
  177.  
  178. void    generic_readpage(void)
  179. {
  180.     fatal_error("** generic_readpage() called but not implemented\n");
  181. }
  182.  
  183. int        in_group_p(void)
  184. {
  185.     return 1;
  186. }
  187.  
  188. /* ------------------------------------------------------------------------- */
  189.  
  190. void    dummies_regular(void)
  191. {
  192. static long    last_seconds;
  193.  
  194.     gettimeofday(&xtime, &sys_tz);
  195.     if(xtime.tv_sec != last_seconds){
  196.         DPRINTF(("dummies_regular(): executing regulars\n"));
  197.         last_seconds = xtime.tv_sec;
  198.         jiffies += 100;
  199.         fops_regular();
  200.         missing_regular();
  201.         buffer_regular();
  202.     }
  203. }
  204.  
  205. /* ------------------------------------------------------------------------- */
  206.  
  207. void    dummies_init(char *devicename, int hssize, int blksz, int devsize)
  208. {
  209. int            i;
  210. static int    my_hardsectsize[256];
  211. static int    my_blk_size[256];
  212. static int    my_devicesize[256];
  213.  
  214.     gettimeofday(&xtime, &sys_tz);    /* system time */
  215.     dev_name = devicename;
  216.     for(i=0;i<256;i++){
  217.         read_ahead[i] = 10;
  218.         hardsect_size[i] = my_hardsectsize;
  219.         blk_size[i] = my_blk_size;        
  220.         blksize_size[i] = my_devicesize;
  221.         my_hardsectsize[i] = hssize;
  222.         my_blk_size[i] = blksz;
  223.         my_devicesize[i] = devsize/blksz*512;
  224.     }
  225. }
  226.  
  227. /* ------------------------------------------------------------------------- */
  228.