00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef DAZUKO_CALL_H
00036 #define DAZUKO_CALL_H
00037
00038 #include "dazuko_platform.h"
00039
00040 #include "dazuko_xp.h"
00041
00042 #include <rsbac/helpers.h>
00043 #include <rsbac/debug.h>
00044
00045 struct xp_mutex;
00046 struct xp_rwlock;
00047 struct xp_queue;
00048 struct xp_atomic;
00049 struct xp_file;
00050 struct dazuko_file_struct;
00051 struct xp_daemon_id;
00052
00053 #define call_xp_sys_hook xp_sys_hook
00054 #define call_xp_sys_unhook xp_sys_unhook
00055 #define call_xp_print xp_print
00056
00057
00058
00059
00060 static inline int call_xp_init_mutex(struct xp_mutex *mutex)
00061 {
00062 if (mutex == NULL)
00063 {
00064 rsbac_printk(KERN_WARNING "dazuko: xp_init_mutex(NULL)\n");
00065 return -1;
00066 }
00067
00068 return xp_init_mutex(mutex);
00069 }
00070
00071 static inline int call_xp_down(struct xp_mutex *mutex)
00072 {
00073 if (mutex == NULL)
00074 {
00075 rsbac_printk(KERN_WARNING "dazuko: warning: xp_down(NULL)\n");
00076 return -1;
00077 }
00078
00079 return xp_down(mutex);
00080 }
00081
00082 static inline int call_xp_up(struct xp_mutex *mutex)
00083 {
00084 if (mutex == NULL)
00085 {
00086 rsbac_printk(KERN_WARNING "dazuko: warning: xp_up(NULL)\n");
00087 return -1;
00088 }
00089
00090 return xp_up(mutex);
00091 }
00092
00093 static inline int call_xp_destroy_mutex(struct xp_mutex *mutex)
00094 {
00095 if (mutex == NULL)
00096 {
00097 rsbac_printk(KERN_WARNING "dazuko: warning: xp_destroy_mutex(NULL)\n");
00098 return -1;
00099 }
00100
00101 return xp_destroy_mutex(mutex);
00102 }
00103
00104
00105
00106
00107 static inline int call_xp_init_rwlock(struct xp_rwlock *rwlock)
00108 {
00109 if (rwlock == NULL)
00110 {
00111 rsbac_printk(KERN_WARNING "dazuko: warning: xp_init_rwlock(NULL)\n");
00112 return -1;
00113 }
00114
00115 return xp_init_rwlock(rwlock);
00116 }
00117
00118 static inline int call_xp_write_lock(struct xp_rwlock *rwlock)
00119 {
00120 if (rwlock == NULL)
00121 {
00122 rsbac_printk(KERN_WARNING "dazuko: warning: xp_write_lock(NULL)\n");
00123 return -1;
00124 }
00125
00126 return xp_write_lock(rwlock);
00127 }
00128
00129 static inline int call_xp_write_unlock(struct xp_rwlock *rwlock)
00130 {
00131 if (rwlock == NULL)
00132 {
00133 rsbac_printk(KERN_WARNING "dazuko: warning: xp_write_unlock(NULL)\n");
00134 return -1;
00135 }
00136
00137 return xp_write_unlock(rwlock);
00138 }
00139
00140 static inline int call_xp_read_lock(struct xp_rwlock *rlock)
00141 {
00142 if (rlock == NULL)
00143 {
00144 rsbac_printk(KERN_WARNING "dazuko: warning: xp_read_lock(NULL)\n");
00145 return -1;
00146 }
00147
00148 return xp_read_lock(rlock);
00149 }
00150
00151 static inline int call_xp_read_unlock(struct xp_rwlock *rlock)
00152 {
00153 if (rlock == NULL)
00154 {
00155 rsbac_printk(KERN_WARNING "dazuko: warning: xp_read_unlock(NULL)\n");
00156 return -1;
00157 }
00158
00159 return xp_read_unlock(rlock);
00160 }
00161
00162 static inline int call_xp_destroy_rwlock(struct xp_rwlock *rwlock)
00163 {
00164 if (rwlock == NULL)
00165 {
00166 rsbac_printk(KERN_WARNING "dazuko: warning: xp_destroy_rwlock(NULL)\n");
00167 return -1;
00168 }
00169
00170 return xp_destroy_rwlock(rwlock);
00171 }
00172
00173
00174
00175
00176 static inline int call_xp_init_queue(struct xp_queue *queue)
00177 {
00178 if (queue == NULL)
00179 {
00180 rsbac_printk(KERN_WARNING "dazuko: warning: xp_init_queue(NULL)\n");
00181 return -1;
00182 }
00183
00184 return xp_init_queue(queue);
00185 }
00186
00187 static inline int call_xp_wait_until_condition(struct xp_queue *queue, int (*cfunction)(void *), void *cparam, int allow_interrupt)
00188 {
00189 if (queue == NULL)
00190 {
00191 rsbac_printk(KERN_WARNING "dazuko: warning: xp_wait_until_condition(queue=NULL)\n");
00192 return -1;
00193 }
00194
00195 if (cfunction == NULL)
00196 {
00197 rsbac_printk(KERN_WARNING "dazuko: warning: xp_wait_until_condition(cfunction=NULL)\n");
00198 return -1;
00199 }
00200
00201 return xp_wait_until_condition(queue, cfunction, cparam, allow_interrupt);
00202 }
00203
00204 static inline int call_xp_notify(struct xp_queue *queue)
00205 {
00206 if (queue == NULL)
00207 {
00208 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_notify(NULL)\n");
00209 return -1;
00210 }
00211
00212 return xp_notify(queue);
00213 }
00214
00215 static inline int call_xp_destroy_queue(struct xp_queue *queue)
00216 {
00217 if (queue == NULL)
00218 {
00219 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_destroy_queue(NULL)\n");
00220 return -1;
00221 }
00222
00223 return xp_destroy_queue(queue);
00224 }
00225
00226
00227
00228
00229 static inline void* call_xp_malloc(size_t size)
00230 {
00231 void *ptr;
00232
00233 if (size < 1)
00234 {
00235 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_malloc(%d)\n", size);
00236 return NULL;
00237 }
00238
00239 ptr = xp_malloc(size);
00240
00241 if (ptr == NULL)
00242 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_malloc(%d) -> NULL\n", size);
00243
00244 return ptr;
00245 }
00246
00247 static inline int call_xp_free(void *ptr)
00248 {
00249 if (ptr == NULL)
00250 {
00251 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_free(NULL)\n");
00252 return 0;
00253 }
00254
00255 return xp_free(ptr);
00256 }
00257
00258 static inline int call_xp_copyin(const void *user_src, void *kernel_dest, size_t size)
00259 {
00260 if (user_src == NULL)
00261 {
00262 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copyin(user_src=NULL)\n");
00263 return -1;
00264 }
00265
00266 if (kernel_dest == NULL)
00267 {
00268 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copyin(kernel_dest=NULL)\n");
00269 return -1;
00270 }
00271
00272 if (size < 1)
00273 {
00274 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copyin(size=%d)\n", size);
00275 return 0;
00276 }
00277
00278 return xp_copyin(user_src, kernel_dest, size);
00279 }
00280
00281 static inline int call_xp_copyout(const void *kernel_src, void *user_dest, size_t size)
00282 {
00283 if (kernel_src == NULL)
00284 {
00285 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copyout(kernel_src=NULL)\n");
00286 return -1;
00287 }
00288
00289 if (user_dest == NULL)
00290 {
00291 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copyout(user_dest=NULL)\n");
00292 return -1;
00293 }
00294
00295 if (size < 1)
00296 {
00297 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copyout(size=%d)\n", size);
00298 return 0;
00299 }
00300
00301 return xp_copyout(kernel_src, user_dest, size);
00302 }
00303
00304 static inline int call_xp_verify_user_writable(const void *user_ptr, size_t size)
00305 {
00306 if (user_ptr == NULL)
00307 {
00308 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_verify_user_writable(user_ptr=NULL)\n");
00309 return -1;
00310 }
00311
00312 if (size < 1)
00313 {
00314 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_verify_user_writable(size=%d)\n", size);
00315 return -1;
00316 }
00317
00318 return xp_verify_user_writable(user_ptr, size);
00319 }
00320
00321 static inline int call_xp_verify_user_readable(const void *user_ptr, size_t size)
00322 {
00323 if (user_ptr == NULL)
00324 {
00325 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_verify_user_readable(user_ptr=NULL)\n");
00326 return -1;
00327 }
00328
00329 if (size < 1)
00330 {
00331 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_verify_user_readable(size=%d)\n", size);
00332 return -1;
00333 }
00334
00335 return xp_verify_user_readable(user_ptr, size);
00336 }
00337
00338
00339
00340
00341 static inline int call_xp_is_absolute_path(const char *path)
00342 {
00343 if (path == NULL)
00344 {
00345 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_is_absolute_path(NULL)\n");
00346 return 0;
00347 }
00348
00349 return xp_is_absolute_path(path);
00350 }
00351
00352
00353
00354
00355 static inline int call_xp_atomic_set(struct xp_atomic *atomic, int value)
00356 {
00357 if (atomic == NULL)
00358 {
00359 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_atomic_set(atomic=NULL)\n");
00360 return -1;
00361 }
00362
00363 return xp_atomic_set(atomic, value);
00364 }
00365
00366 static inline int call_xp_atomic_inc(struct xp_atomic *atomic)
00367 {
00368 if (atomic == NULL)
00369 {
00370 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_atomic_inc(NULL)\n");
00371 return -1;
00372 }
00373
00374 return xp_atomic_inc(atomic);
00375 }
00376
00377 static inline int call_xp_atomic_dec(struct xp_atomic *atomic)
00378 {
00379 if (atomic == NULL)
00380 {
00381 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_atomic_dec(NULL)\n");
00382 return -1;
00383 }
00384
00385 return xp_atomic_dec(atomic);
00386 }
00387
00388 static inline int call_xp_atomic_read(struct xp_atomic *atomic)
00389 {
00390 if (atomic == NULL)
00391 {
00392 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_atomic_read(NULL)\n");
00393 return -1;
00394 }
00395
00396 return xp_atomic_read(atomic);
00397 }
00398
00399
00400
00401
00402 static inline int call_xp_copy_file(struct xp_file *dest, struct xp_file *src)
00403 {
00404 if (dest == NULL)
00405 {
00406 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copy_file(dest=NULL)\n");
00407 return -1;
00408 }
00409
00410 if (src == NULL)
00411 {
00412 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_copy_file(src=NULL)\n");
00413 return -1;
00414 }
00415
00416 return xp_copy_file(dest, src);
00417 }
00418
00419 static inline int call_xp_compare_file(struct xp_file *file1, struct xp_file *file2)
00420 {
00421 if (file1 == NULL)
00422 {
00423 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_compare_file(file1=NULL)\n");
00424 return -1;
00425 }
00426
00427 if (file2 == NULL)
00428 {
00429 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_compare_file(file2=NULL)\n");
00430 return -1;
00431 }
00432
00433 return xp_compare_file(file1, file2);
00434 }
00435
00436
00437
00438
00439 static inline int call_xp_fill_file_struct(struct dazuko_file_struct *dfs)
00440 {
00441 if (dfs == NULL)
00442 {
00443 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_fill_file_struct(NULL)\n");
00444 return -1;
00445 }
00446
00447 return xp_fill_file_struct(dfs);
00448 }
00449
00450
00451
00452
00453 static inline int call_xp_id_compare(struct xp_daemon_id *id1, struct xp_daemon_id *id2)
00454 {
00455 if (id1 == NULL)
00456 {
00457 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_id_compare(id1=NULL)\n");
00458 return -1;
00459 }
00460
00461 if (id2 == NULL)
00462 {
00463 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_id_compare(id2=NULL)\n");
00464 return -1;
00465 }
00466
00467 return xp_id_compare(id1, id2);
00468 }
00469
00470 static inline int call_xp_id_free(struct xp_daemon_id *id)
00471 {
00472 if (id == NULL)
00473 {
00474 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_id_free(NULL)\n");
00475 return 0;
00476 }
00477
00478 return xp_id_free(id);
00479 }
00480
00481 static inline struct xp_daemon_id* call_xp_id_copy(struct xp_daemon_id *id)
00482 {
00483 struct xp_daemon_id *ptr;
00484
00485 if (id == NULL)
00486 {
00487 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_id_copy(NULL)\n");
00488 return NULL;
00489 }
00490
00491 ptr = xp_id_copy(id);
00492
00493 if (ptr == NULL)
00494 rsbac_printk(KERN_WARNING, "dazuko: warning: xp_id_copy() -> NULL\n");
00495
00496 return ptr;
00497 }
00498
00499 #endif