File: slab.h

package info (click to toggle)
comedi 0.7.76%2B20080817cvs-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,660 kB
  • ctags: 14,259
  • sloc: ansic: 104,304; sh: 1,417; makefile: 625; perl: 457
file content (38 lines) | stat: -rw-r--r-- 754 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

#ifndef __COMPAT_LINUX_SLAB_H
#define __COMPAT_LINUX_SLAB_H

#include <linux/version.h>
#include <linux/string.h>

#include_next <linux/slab.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)

/* Some RHEL4 2.6.9 kernels have kzalloc.  Redefine to avoid warnings
   about static declaration following non-static declaration. */
#undef kzalloc
#define kzalloc comedi_kzalloc
static inline void *comedi_kzalloc(size_t size, unsigned int flags)
{
	void *ret = kmalloc(size, flags);
	if (ret)
		memset(ret, 0, size);
	return ret;
}

#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)

static inline void *kcalloc(size_t n, size_t size, int flags)
{
	if (n != 0 && size > INT_MAX / n)
		return NULL;
	return kzalloc(n * size, flags);
}

#endif

#endif