The Pedigree Project  0.1
cdi-osdep.h
1 /*
2  * Copyright (c) 2009 Kevin Wolf
3  *
4  * This program is free software. It comes without any warranty, to
5  * the extent permitted by applicable law. You can redistribute it
6  * and/or modify it under the terms of the Do What The Fuck You Want
7  * To Public License, Version 2, as published by Sam Hocevar. See
8  * http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9  */
10 
11 #ifndef _CDI_OSDEP_H_
12 #define _CDI_OSDEP_H_
13 
14 #include "modules/Module.h"
15 #include "pedigree/kernel/utilities/utility.h"
16 
17 #pragma GCC diagnostic push
18 #pragma GCC diagnostic ignored "-Wvariadic-macros"
19 
20 struct cdi_driver;
21 
41 #define CDI_DRIVER(name, drvobj, deps...) \
43  static bool mod_entry() {(drvobj).drv.init(); return cdi_pedigree_walk_dev_list_init((struct cdi_driver*)&(drvobj));} \
44  static void mod_exit() {cdi_pedigree_walk_dev_list_destroy((struct cdi_driver*)&(drvobj)); (drvobj).drv.destroy();} \
45  MODULE_INFO(name, &mod_entry, &mod_exit, "cdi" deps)
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
60 bool cdi_pedigree_walk_dev_list_init(struct cdi_driver *dev);
61 
71 void cdi_pedigree_walk_dev_list_destroy(struct cdi_driver *dev);
72 
73 #ifdef __cplusplus
74 }; // extern "C"
75 #endif
76 
82 typedef struct
83 {
84  void *backdev;
86 
92 typedef struct
93 {
94  void *region;
95  void *realbuffer;
97 
106 typedef struct {
108  void *pMemRegion;
109 } cdi_mem_osdep;
110 
114 struct FILE
115 {
116  char empty;
117 };
118 
119 // Forward cdi drivers to the correct utility functions.
120 #define memcpy MemoryCopy
121 #define memset ByteSet
122 
123 #pragma GCC diagnostic pop
124 
125 #endif
void * pMemRegion
A MemoryRegion on the kernel heap.
Definition: cdi-osdep.h:108