\hypertarget{g__uzip__zstd_8c_source}{}\doxysection{g\+\_\+uzip\+\_\+zstd.\+c}
\label{g__uzip__zstd_8c_source}\index{geom/uzip/g\_uzip\_zstd.c@{geom/uzip/g\_uzip\_zstd.c}}
\mbox{\hyperlink{g__uzip__zstd_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2019 Conrad Meyer <cem@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00006}00006 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00007}00007 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00008}00008 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00009}00009 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00011}00011 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00012}00012 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00013}00013 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00014}00014 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00015}00015 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00016}00016 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00017}00017 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00018}00018 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00019}00019 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00020}00020 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00021}00021 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00022}00022 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00023}00023 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00024}00024 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00025}00025 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00028}00028 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00029}\mbox{\hyperlink{g__uzip__zstd_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00029}} \mbox{\hyperlink{g__uzip__zstd_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/errno.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00037}00037 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{g__uzip_8h}{geom/uzip/g\_uzip.h}}>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{g__uzip__dapi_8h}{geom/uzip/g\_uzip\_dapi.h}}>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{g__uzip__zstd_8h}{geom/uzip/g\_uzip\_zstd.h}}>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00042}00042 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00043}00043 \textcolor{comment}{ * We don't actually need any static-\/link ABI, just want to use "{}experimental"{}}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00044}00044 \textcolor{comment}{ * custom malloc/free APIs.}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00045}00045 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00046}\mbox{\hyperlink{g__uzip__zstd_8c_ad88034c8350c3d479ce0db09fd8ee0c8}{00046}} \textcolor{preprocessor}{\#define ZSTD\_STATIC\_LINKING\_ONLY}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <contrib/zstd/lib/zstd.h>}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00049}\mbox{\hyperlink{g__uzip__zstd_8c_a98a37944956ea7d9d9c82e69c22b267f}{00049}} \mbox{\hyperlink{g__uzip__zstd_8c_a98a37944956ea7d9d9c82e69c22b267f}{FEATURE}}(geom\_uzip\_zstd, \textcolor{stringliteral}{"{}g\_uzip Zstd support"{}});}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00051}\mbox{\hyperlink{structg__uzip__zstd}{00051}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__uzip__zstd}{g\_uzip\_zstd}} \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00052}\mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{00052}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__uzip__dapi}{g\_uzip\_dapi}}   \mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{guz\_pub}};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00053}\mbox{\hyperlink{structg__uzip__zstd_aa1ff796ed0cc8397f5c93046fdf6d7d4}{00053}}         uint32\_t                \mbox{\hyperlink{structg__uzip__zstd_aa1ff796ed0cc8397f5c93046fdf6d7d4}{guz\_blksz}};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00054}\mbox{\hyperlink{structg__uzip__zstd_a77df3bf7ecbe6f99c5370a2bb3a8ca49}{00054}}         ZSTD\_DCtx               *\mbox{\hyperlink{structg__uzip__zstd_a77df3bf7ecbe6f99c5370a2bb3a8ca49}{guz\_dctx}};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00055}00055 \};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00056}00056 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00057}00057 \textcolor{preprocessor}{\#ifndef container\_of}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00058}\mbox{\hyperlink{g__uzip__zstd_8c_af8c317a42292b61c93aae91e59118a46}{00058}} \textcolor{preprocessor}{\#define container\_of(ptr, type, member)                         \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00059}00059 \textcolor{preprocessor}{(\{                                                              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00060}00060 \textcolor{preprocessor}{        const \_\_typeof(((type *)0)-\/>member) *\_\_p = (ptr);       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00061}00061 \textcolor{preprocessor}{        (type *)((uintptr\_t)\_\_p -\/ offsetof(type, member));      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00062}00062 \textcolor{preprocessor}{\})}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00063}00063 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00064}\mbox{\hyperlink{g__uzip__zstd_8c_ac4bdee365b7a5b115a3303fdcb5b617a}{00064}} \textcolor{preprocessor}{\#define to\_zstd\_softc(zpp)      container\_of(zpp, struct g\_uzip\_zstd, guz\_pub)}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00066}00066 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00067}\mbox{\hyperlink{g__uzip__zstd_8c_ab03b5ccb426b661e7a64dbe3604d3576}{00067}} \mbox{\hyperlink{g__uzip__zstd_8c_ab03b5ccb426b661e7a64dbe3604d3576}{guz\_zstd\_decompress}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__uzip__dapi}{g\_uzip\_dapi}} *zpp, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *gp\_name, \textcolor{keywordtype}{void} *input,}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00068}00068     \textcolor{keywordtype}{size\_t} ilen, \textcolor{keywordtype}{void} *outputbuf)}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00069}00069 \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00070}00070         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__uzip__zstd}{g\_uzip\_zstd}} *sc;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00071}00071         \textcolor{keywordtype}{size\_t} rc;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00073}00073         sc = \mbox{\hyperlink{g__uzip__zstd_8c_ac4bdee365b7a5b115a3303fdcb5b617a}{to\_zstd\_softc}}(zpp);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00074}00074         rc = ZSTD\_decompressDCtx(sc-\/>\mbox{\hyperlink{structg__uzip__zstd_a77df3bf7ecbe6f99c5370a2bb3a8ca49}{guz\_dctx}}, outputbuf, sc-\/>\mbox{\hyperlink{structg__uzip__zstd_aa1ff796ed0cc8397f5c93046fdf6d7d4}{guz\_blksz}}, input,}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00075}00075             ilen);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00076}00076         \textcolor{keywordflow}{if} (ZSTD\_isError(rc)) \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00077}00077                 printf(\textcolor{stringliteral}{"{}\%s: UZIP(zstd) decompress failed: \%s\(\backslash\)n"{}}, gp\_name,}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00078}00078                     ZSTD\_getErrorName(rc));}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00079}00079                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00080}00080         \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00081}00081         KASSERT(rc == sc-\/>\mbox{\hyperlink{structg__uzip__zstd_aa1ff796ed0cc8397f5c93046fdf6d7d4}{guz\_blksz}}, (\textcolor{stringliteral}{"{}\%s: Expected \%u bytes, got \%zu"{}},}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00082}00082             \_\_func\_\_, sc-\/>\mbox{\hyperlink{structg__uzip__zstd_aa1ff796ed0cc8397f5c93046fdf6d7d4}{guz\_blksz}}, rc));}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00083}00083         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00084}00084 \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00086}00086 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00087}\mbox{\hyperlink{g__uzip__zstd_8c_a326655b6efed877756d50aba43ea6fdf}{00087}} \mbox{\hyperlink{g__uzip__zstd_8c_a326655b6efed877756d50aba43ea6fdf}{guz\_zstd\_free}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__uzip__dapi}{g\_uzip\_dapi}} *zpp)}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00088}00088 \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00089}00089         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__uzip__zstd}{g\_uzip\_zstd}} *sc;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00090}00090         \textcolor{keywordtype}{size\_t} rc;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00091}00091 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00092}00092         sc = \mbox{\hyperlink{g__uzip__zstd_8c_ac4bdee365b7a5b115a3303fdcb5b617a}{to\_zstd\_softc}}(zpp);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00093}00093         rc = ZSTD\_freeDCtx(sc-\/>\mbox{\hyperlink{structg__uzip__zstd_a77df3bf7ecbe6f99c5370a2bb3a8ca49}{guz\_dctx}});}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00094}00094         \textcolor{keywordflow}{if} (ZSTD\_isError(rc))}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00095}00095                 printf(\textcolor{stringliteral}{"{}\%s: UZIP(zstd) free failed: \%s\(\backslash\)n"{}}, \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00096}00096                     ZSTD\_getErrorName(rc));}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00097}00097 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00098}00098         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(sc, M\_GEOM\_UZIP);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00099}00099 \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00100}00100 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00101}00101 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00102}\mbox{\hyperlink{g__uzip__zstd_8c_a685169416d9ceaf3611e8952038e4a9a}{00102}} \mbox{\hyperlink{g__uzip__zstd_8c_a685169416d9ceaf3611e8952038e4a9a}{guz\_zstd\_rewind}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__uzip__dapi}{g\_uzip\_dapi}} *zpp, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *gp\_name)}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00103}00103 \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00104}00104         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__uzip__zstd}{g\_uzip\_zstd}} *sc;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00105}00105         \textcolor{keywordtype}{size\_t} rc;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00107}00107         sc = \mbox{\hyperlink{g__uzip__zstd_8c_ac4bdee365b7a5b115a3303fdcb5b617a}{to\_zstd\_softc}}(zpp);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00108}00108         rc = ZSTD\_DCtx\_reset(sc-\/>\mbox{\hyperlink{structg__uzip__zstd_a77df3bf7ecbe6f99c5370a2bb3a8ca49}{guz\_dctx}}, ZSTD\_reset\_session\_and\_parameters);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00109}00109         \textcolor{keywordflow}{if} (ZSTD\_isError(rc)) \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00110}00110                 printf(\textcolor{stringliteral}{"{}\%s: UZIP(zstd) rewind failed: \%s\(\backslash\)n"{}}, gp\_name,}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00111}00111                     ZSTD\_getErrorName(rc));}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00112}00112                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00113}00113         \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00114}00114         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00115}00115 \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00116}00116 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00117}00117 \textcolor{keyword}{static} \textcolor{keywordtype}{void} *}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00118}\mbox{\hyperlink{g__uzip__zstd_8c_abfdda2e0618a24693e5abab5fbd647a1}{00118}} \mbox{\hyperlink{g__uzip__zstd_8c_abfdda2e0618a24693e5abab5fbd647a1}{zstd\_alloc}}(\textcolor{keywordtype}{void} *opaque, \textcolor{keywordtype}{size\_t} size)}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00119}00119 \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00120}00120         \textcolor{keywordflow}{return} (malloc(size, opaque, M\_WAITOK));}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00121}00121 \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00122}00122 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00123}00123 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00124}\mbox{\hyperlink{g__uzip__zstd_8c_a2a9f1593516a323cfa19b55c026e7af8}{00124}} \mbox{\hyperlink{g__uzip__zstd_8c_a2a9f1593516a323cfa19b55c026e7af8}{zstd\_free}}(\textcolor{keywordtype}{void} *opaque, \textcolor{keywordtype}{void} *address)}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00125}00125 \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00126}00126         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(address, opaque);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00127}00127 \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00128}00128 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00129}\mbox{\hyperlink{g__uzip__zstd_8c_abb84976ba8868a3f988a1f26a7019645}{00129}} \textcolor{keyword}{static} \textcolor{keyword}{const} ZSTD\_customMem \mbox{\hyperlink{g__uzip__zstd_8c_abb84976ba8868a3f988a1f26a7019645}{zstd\_guz\_alloc}} = \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00130}00130         .customAlloc = \mbox{\hyperlink{g__uzip__zstd_8c_abfdda2e0618a24693e5abab5fbd647a1}{zstd\_alloc}},}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00131}00131         .customFree = \mbox{\hyperlink{g__uzip__zstd_8c_a2a9f1593516a323cfa19b55c026e7af8}{zstd\_free}},}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00132}00132         .opaque = M\_GEOM\_UZIP,}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00133}00133 \};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00134}00134 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00135}00135 \textcolor{keyword}{struct }\mbox{\hyperlink{structg__uzip__dapi}{g\_uzip\_dapi}} *}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00136}\mbox{\hyperlink{g__uzip__zstd_8c_a387171cdfd1ff4c0785d28582eeca626}{00136}} \mbox{\hyperlink{g__uzip__zstd_8c_a387171cdfd1ff4c0785d28582eeca626}{g\_uzip\_zstd\_ctor}}(uint32\_t blksz)}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00137}00137 \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00138}00138         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__uzip__zstd}{g\_uzip\_zstd}} *sc;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00139}00139 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00140}00140         sc = malloc(\textcolor{keyword}{sizeof}(*sc), M\_GEOM\_UZIP, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00142}00142         sc-\/>\mbox{\hyperlink{structg__uzip__zstd_a77df3bf7ecbe6f99c5370a2bb3a8ca49}{guz\_dctx}} = ZSTD\_createDCtx\_advanced(\mbox{\hyperlink{g__uzip__zstd_8c_abb84976ba8868a3f988a1f26a7019645}{zstd\_guz\_alloc}});}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00143}00143         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__uzip__zstd_a77df3bf7ecbe6f99c5370a2bb3a8ca49}{guz\_dctx}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00144}00144                 printf(\textcolor{stringliteral}{"{}\%s: ZSTD\_createDCtx\_advanced failed\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00145}00145                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(sc, M\_GEOM\_UZIP);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00146}00146                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00147}00147         \}}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00148}00148 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00149}00149         sc-\/>\mbox{\hyperlink{structg__uzip__zstd_aa1ff796ed0cc8397f5c93046fdf6d7d4}{guz\_blksz}} = blksz;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00150}00150         sc-\/>\mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{guz\_pub}}.\mbox{\hyperlink{structg__uzip__dapi_a7215ed7946c105e5549be73c6d21b841}{max\_blen}} = ZSTD\_compressBound(blksz);}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00151}00151         sc-\/>\mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{guz\_pub}}.\mbox{\hyperlink{structg__uzip__dapi_a31babf993fba28914f0e1d86ea2c4565}{decompress}} = \mbox{\hyperlink{g__uzip__zstd_8c_ab03b5ccb426b661e7a64dbe3604d3576}{guz\_zstd\_decompress}};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00152}00152         sc-\/>\mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{guz\_pub}}.\mbox{\hyperlink{structg__uzip__dapi_ad4c9c71497bf9d8521554d1827a3558d}{free}} = \mbox{\hyperlink{g__uzip__zstd_8c_a326655b6efed877756d50aba43ea6fdf}{guz\_zstd\_free}};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00153}00153         sc-\/>\mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{guz\_pub}}.\mbox{\hyperlink{structg__uzip__dapi_a6edb182756318bee16ccd4755cbe2c73}{rewind}} = \mbox{\hyperlink{g__uzip__zstd_8c_a685169416d9ceaf3611e8952038e4a9a}{guz\_zstd\_rewind}};}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00154}00154         sc-\/>\mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{guz\_pub}}.\mbox{\hyperlink{structg__uzip__dapi_aef7b025c396bb122b043f1f3f2a94d3a}{pvt}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00155}00155 }
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00156}00156         \textcolor{keywordflow}{return} (\&sc-\/>\mbox{\hyperlink{structg__uzip__zstd_ae94e2dd9d579ecf8a8317d400a2680ab}{guz\_pub}});}
\DoxyCodeLine{\Hypertarget{g__uzip__zstd_8c_source_l00157}00157 \}}

\end{DoxyCode}
