rtapi_slab.h
1 // Copyright 2014 Jeff Epler 2 // 3 // This program is free software; you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation; either version 2 of the License, or 6 // (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with this program; if not, write to the Free Software 15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 #ifndef RTAPI_SLAB_H 17 #define RTAPI_SLAB_H 18 19 #include "rtapi_gfp.h" 20 21 #ifdef __KERNEL__ 22 #include <linux/slab.h> 23 24 #define rtapi_kfree kfree 25 #define rtapi_kmalloc kmalloc 26 #define rtapi_krealloc krealloc 27 #define rtapi_kzalloc kzalloc 28 29 #else 30 #include <stdlib.h> 31 32 #define rtapi_kfree free 33 #define rtapi_kmalloc(sz, flags) malloc((sz)) 34 #define rtapi_kzalloc(sz, flags) calloc(1,(sz)) 35 #define rtapi_krealloc(p, sz, flags) realloc((p), (sz)) 36 37 #endif 38 #endif