xz_malloc.c revision 229533
1229533Sray/*- 2229533Sray * Copyright (c) 2010-2012 Aleksandr Rybalko 3229533Sray * All rights reserved. 4229533Sray * 5229533Sray * Redistribution and use in source and binary forms, with or without 6229533Sray * modification, are permitted provided that the following conditions 7229533Sray * are met: 8229533Sray * 1. Redistributions of source code must retain the above copyright 9229533Sray * notice, this list of conditions and the following disclaimer. 10229533Sray * 2. Redistributions in binary form must reproduce the above copyright 11229533Sray * notice, this list of conditions and the following disclaimer in the 12229533Sray * documentation and/or other materials provided with the distribution. 13229533Sray * 14229533Sray * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15229533Sray * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16229533Sray * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17229533Sray * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18229533Sray * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19229533Sray * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20229533Sray * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21229533Sray * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22229533Sray * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23229533Sray * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24229533Sray * SUCH DAMAGE. 25229533Sray */ 26229533Sray 27229533Sray#include <sys/malloc.h> 28229533Sray#include <sys/kernel.h> 29229533Sray#include "xz_malloc.h" 30229533Sray 31229533Sray/* Wraper for XZ decompressor memmory pool */ 32229533Sray 33229533Sraystatic MALLOC_DEFINE(XZ_DEC, "XZ_DEC", "XZ decompressor data"); 34229533Sray 35229533Srayvoid * 36229533Srayxz_malloc(unsigned long size) 37229533Sray{ 38229533Sray void *addr; 39229533Sray 40229533Sray addr = malloc(size, XZ_DEC, M_NOWAIT); 41229533Sray return (addr); 42229533Sray} 43229533Sray 44229533Srayvoid 45229533Srayxz_free(void *addr) 46229533Sray{ 47229533Sray 48229533Sray free(addr, XZ_DEC); 49229533Sray} 50