From owner-svn-src-head@freebsd.org Thu Aug 8 06:27:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A314FC4B37; Thu, 8 Aug 2019 06:27:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463z243s2Cz3PxJ; Thu, 8 Aug 2019 06:27:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C14B20F38; Thu, 8 Aug 2019 06:27:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x786Re1Q081538; Thu, 8 Aug 2019 06:27:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x786ReNW081537; Thu, 8 Aug 2019 06:27:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201908080627.x786ReNW081537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 8 Aug 2019 06:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350742 - in head/sys: geom/uzip modules/geom/geom_uzip X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head/sys: geom/uzip modules/geom/geom_uzip X-SVN-Commit-Revision: 350742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 06:27:40 -0000 Author: delphij Date: Thu Aug 8 06:27:39 2019 New Revision: 350742 URL: https://svnweb.freebsd.org/changeset/base/350742 Log: Update geom_uzip to use new zlib: - Use new zlib headers; - Removed z_alloc and z_free to use the common sys/dev/zlib version. - Replace z_compressBound with compressBound from zlib. While there, limit LZMA CFLAGS to apply only for g_uzip_lzma.c. PR: 229763 Submitted by: Yoshihiro Ota (with changes, bugs are mine) Differential Revision: https://reviews.freebsd.org/D20271 Modified: head/sys/geom/uzip/g_uzip_zlib.c head/sys/modules/geom/geom_uzip/Makefile Modified: head/sys/geom/uzip/g_uzip_zlib.c ============================================================================== --- head/sys/geom/uzip/g_uzip_zlib.c Thu Aug 8 06:26:34 2019 (r350741) +++ head/sys/geom/uzip/g_uzip_zlib.c Thu Aug 8 06:27:39 2019 (r350742) @@ -33,7 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include #include @@ -46,8 +47,6 @@ struct g_uzip_zlib { z_stream zs; }; -static void *z_alloc(void *, u_int, u_int); -static void z_free(void *, void *); static int g_uzip_zlib_rewind(struct g_uzip_dapi *, const char *); static void @@ -97,26 +96,17 @@ g_uzip_zlib_rewind(struct g_uzip_dapi *zpp, const char return (err); } -static int -z_compressBound(int len) -{ - - return (len + (len >> 12) + (len >> 14) + 11); -} - struct g_uzip_dapi * g_uzip_zlib_ctor(uint32_t blksz) { struct g_uzip_zlib *zp; - zp = malloc(sizeof(struct g_uzip_zlib), M_GEOM_UZIP, M_WAITOK); - zp->zs.zalloc = z_alloc; - zp->zs.zfree = z_free; + zp = malloc(sizeof(struct g_uzip_zlib), M_GEOM_UZIP, M_WAITOK | M_ZERO); if (inflateInit(&zp->zs) != Z_OK) { goto e1; } zp->blksz = blksz; - zp->pub.max_blen = z_compressBound(blksz); + zp->pub.max_blen = compressBound(blksz); zp->pub.decompress = &g_uzip_zlib_decompress; zp->pub.free = &g_uzip_zlib_free; zp->pub.rewind = &g_uzip_zlib_rewind; @@ -125,21 +115,4 @@ g_uzip_zlib_ctor(uint32_t blksz) e1: free(zp, M_GEOM_UZIP); return (NULL); -} - -static void * -z_alloc(void *nil, u_int type, u_int size) -{ - void *ptr; - - ptr = malloc(type * size, M_GEOM_UZIP, M_NOWAIT); - - return (ptr); -} - -static void -z_free(void *nil, void *ptr) -{ - - free(ptr, M_GEOM_UZIP); } Modified: head/sys/modules/geom/geom_uzip/Makefile ============================================================================== --- head/sys/modules/geom/geom_uzip/Makefile Thu Aug 8 06:26:34 2019 (r350741) +++ head/sys/modules/geom/geom_uzip/Makefile Thu Aug 8 06:27:39 2019 (r350742) @@ -10,7 +10,7 @@ SRCS+= g_uzip.h g_uzip_dapi.h g_uzip_lzma.h g_uzip_zli .PATH: ${SRCTOP}/sys/net -CFLAGS+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ +CFLAGS.g_uzip_lzma.c+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz/ SRCS+= opt_geom.h