diff options
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 7cdeb084883..d90a9a80451 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drmP.h,v 1.166 2014/02/04 22:19:53 kettenis Exp $ */ +/* $OpenBSD: drmP.h,v 1.167 2014/02/09 10:50:43 jsg Exp $ */ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ @@ -247,6 +247,14 @@ kmalloc(size_t size, int flags) } static inline void * +kmalloc_array(size_t n, size_t size, int flags) +{ + if (n == 0 || SIZE_MAX / n < size) + return NULL; + return malloc(n * size, M_DRM, flags); +} + +static inline void * kcalloc(size_t n, size_t size, int flags) { if (n == 0 || SIZE_MAX / n < size) @@ -266,6 +274,18 @@ kfree(void *objp) free(objp, M_DRM); } +static inline void * +vzalloc(unsigned long size) +{ + return malloc(size, M_DRM, M_WAITOK | M_CANFAIL | M_ZERO); +} + +static inline void +vfree(void *objp) +{ + free(objp, M_DRM); +} + #define min_t(t, a, b) ({ \ t __min_a = (a); \ t __min_b = (b); \ |