Add DRM(calloc), which is convenient, used by the new sis code, and takes
advantage of M_ZERO on BSDs.main
parent
db78129116
commit
a7aebb6dac
|
@ -401,6 +401,7 @@ extern int DRM(version)( DRM_IOCTL_ARGS );
|
|||
extern void DRM(mem_init)(void);
|
||||
extern void DRM(mem_uninit)(void);
|
||||
extern void *DRM(alloc)(size_t size, int area);
|
||||
extern void *DRM(calloc)(size_t nmemb, size_t size, int area);
|
||||
extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size,
|
||||
int area);
|
||||
extern void DRM(free)(void *pt, size_t size, int area);
|
||||
|
|
|
@ -58,6 +58,11 @@ void *DRM(alloc)(size_t size, int area)
|
|||
return malloc(size, DRM(M_DRM), M_NOWAIT);
|
||||
}
|
||||
|
||||
void *DRM(calloc)(size_t nmemb, size_t size, int area)
|
||||
{
|
||||
return malloc(size * nmemb, DRM(M_DRM), M_NOWAIT | M_ZERO);
|
||||
}
|
||||
|
||||
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
void *pt;
|
||||
|
|
|
@ -401,6 +401,7 @@ extern int DRM(version)( DRM_IOCTL_ARGS );
|
|||
extern void DRM(mem_init)(void);
|
||||
extern void DRM(mem_uninit)(void);
|
||||
extern void *DRM(alloc)(size_t size, int area);
|
||||
extern void *DRM(calloc)(size_t nmemb, size_t size, int area);
|
||||
extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size,
|
||||
int area);
|
||||
extern void DRM(free)(void *pt, size_t size, int area);
|
||||
|
|
|
@ -58,6 +58,11 @@ void *DRM(alloc)(size_t size, int area)
|
|||
return malloc(size, DRM(M_DRM), M_NOWAIT);
|
||||
}
|
||||
|
||||
void *DRM(calloc)(size_t nmemb, size_t size, int area)
|
||||
{
|
||||
return malloc(size * nmemb, DRM(M_DRM), M_NOWAIT | M_ZERO);
|
||||
}
|
||||
|
||||
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
void *pt;
|
||||
|
|
|
@ -817,6 +817,7 @@ extern void DRM(mem_init)(void);
|
|||
extern int DRM(mem_info)(char *buf, char **start, off_t offset,
|
||||
int request, int *eof, void *data);
|
||||
extern void *DRM(alloc)(size_t size, int area);
|
||||
extern void *DRM(calloc)(size_t nmemb, size_t size, int area);
|
||||
extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size,
|
||||
int area);
|
||||
extern void DRM(free)(void *pt, size_t size, int area);
|
||||
|
|
|
@ -226,6 +226,18 @@ void *DRM(alloc)(size_t size, int area)
|
|||
return kmalloc(size, GFP_KERNEL);
|
||||
}
|
||||
|
||||
/** Wrapper around kmalloc() */
|
||||
void *DRM(calloc)(size_t size, size_t nmemb, int area)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
addr = kmalloc(size * nmemb, GFP_KERNEL);
|
||||
if (addr != NULL)
|
||||
memset((void *)addr, 0, size * nmemb);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
/** Wrapper around kmalloc() and kfree() */
|
||||
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
|
|
|
@ -167,6 +167,17 @@ void *DRM(alloc)(size_t size, int area)
|
|||
return pt;
|
||||
}
|
||||
|
||||
void *DRM(calloc)(size_t size, size_t nmemb, int area)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
addr = DRM(alloc)(nmemb * size, area);
|
||||
if (addr != NULL)
|
||||
memset((void *)addr, 0, size * nmemb);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
void *pt;
|
||||
|
|
|
@ -817,6 +817,7 @@ extern void DRM(mem_init)(void);
|
|||
extern int DRM(mem_info)(char *buf, char **start, off_t offset,
|
||||
int request, int *eof, void *data);
|
||||
extern void *DRM(alloc)(size_t size, int area);
|
||||
extern void *DRM(calloc)(size_t nmemb, size_t size, int area);
|
||||
extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size,
|
||||
int area);
|
||||
extern void DRM(free)(void *pt, size_t size, int area);
|
||||
|
|
|
@ -226,6 +226,18 @@ void *DRM(alloc)(size_t size, int area)
|
|||
return kmalloc(size, GFP_KERNEL);
|
||||
}
|
||||
|
||||
/** Wrapper around kmalloc() */
|
||||
void *DRM(calloc)(size_t size, size_t nmemb, int area)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
addr = kmalloc(size * nmemb, GFP_KERNEL);
|
||||
if (addr != NULL)
|
||||
memset((void *)addr, 0, size * nmemb);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
/** Wrapper around kmalloc() and kfree() */
|
||||
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
|
|
|
@ -167,6 +167,17 @@ void *DRM(alloc)(size_t size, int area)
|
|||
return pt;
|
||||
}
|
||||
|
||||
void *DRM(calloc)(size_t size, size_t nmemb, int area)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
addr = DRM(alloc)(nmemb * size, area);
|
||||
if (addr != NULL)
|
||||
memset((void *)addr, 0, size * nmemb);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
void *pt;
|
||||
|
|
Loading…
Reference in New Issue