From owner-svn-src-head@freebsd.org Mon Jun 17 19:49:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEB6C15C2F5B; Mon, 17 Jun 2019 19:49:15 +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 9B1C177C72; Mon, 17 Jun 2019 19:49:15 +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 7873C2530; Mon, 17 Jun 2019 19:49:15 +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 x5HJnFtT091143; Mon, 17 Jun 2019 19:49:15 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5HJn9Ed091108; Mon, 17 Jun 2019 19:49:09 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201906171949.x5HJn9Ed091108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 17 Jun 2019 19:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349151 - in head: lib/libufs stand/libsa sys/conf sys/dev/iscsi sys/dev/iscsi_initiator sys/dev/liquidio sys/dev/usb/net sys/fs/ext2fs sys/fs/nandfs sys/geom/part sys/geom/raid sys/ker... X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head: lib/libufs stand/libsa sys/conf sys/dev/iscsi sys/dev/iscsi_initiator sys/dev/liquidio sys/dev/usb/net sys/fs/ext2fs sys/fs/nandfs sys/geom/part sys/geom/raid sys/kern sys/libkern sys/libkern... X-SVN-Commit-Revision: 349151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9B1C177C72 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] 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: Mon, 17 Jun 2019 19:49:16 -0000 Author: delphij Date: Mon Jun 17 19:49:08 2019 New Revision: 349151 URL: https://svnweb.freebsd.org/changeset/base/349151 Log: Separate kernel crc32() implementation to its own header (gsb_crc32.h) and rename the source to gsb_crc32.c. This is a prerequisite of unifying kernel zlib instances. PR: 229763 Submitted by: Yoshihiro Ota Differential Revision: https://reviews.freebsd.org/D20193 Added: head/sys/libkern/gsb_crc32.c - copied, changed from r349150, head/sys/libkern/crc32.c head/sys/sys/gsb_crc32.h (contents, props changed) Deleted: head/sys/libkern/crc32.c Modified: head/lib/libufs/Makefile head/stand/libsa/crc32_libkern.c head/sys/conf/files head/sys/dev/iscsi/icl_soft.c head/sys/dev/iscsi_initiator/isc_subr.c head/sys/dev/liquidio/lio_bsd.h head/sys/dev/usb/net/if_cdce.c head/sys/fs/ext2fs/ext2_csum.c head/sys/fs/nandfs/nandfs_segment.c head/sys/fs/nandfs/nandfs_subr.c head/sys/fs/nandfs/nandfs_vfsops.c head/sys/geom/part/g_part_bsd64.c head/sys/geom/part/g_part_gpt.c head/sys/geom/raid/md_ddf.c head/sys/kern/subr_compressor.c head/sys/libkern/x86/crc32_sse42.c head/sys/netinet/libalias/alias_sctp.c head/sys/netinet/sctp_crc32.c head/sys/netpfil/pf/pf.c head/sys/sys/libkern.h head/sys/sys/param.h head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_subr.c head/sys/ufs/ffs/ffs_vfsops.c head/tests/sys/kern/Makefile head/tests/sys/kern/libkern_crc32.c Modified: head/lib/libufs/Makefile ============================================================================== --- head/lib/libufs/Makefile Mon Jun 17 17:35:55 2019 (r349150) +++ head/lib/libufs/Makefile Mon Jun 17 19:49:08 2019 (r349151) @@ -5,7 +5,8 @@ LIB= ufs SHLIBDIR?= /lib SHLIB_MAJOR= 7 -SRCS= block.c cgroup.c crc32.c inode.c sblock.c type.c ffs_subr.c ffs_tables.c +SRCS= block.c cgroup.c gsb_crc32.c inode.c sblock.c type.c ffs_subr.c +SRCS+= ffs_tables.c INCS= libufs.h MAN= bread.3 cgread.3 getinode.3 libufs.3 sbread.3 ufs_disk_close.3 Modified: head/stand/libsa/crc32_libkern.c ============================================================================== --- head/stand/libsa/crc32_libkern.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/stand/libsa/crc32_libkern.c Mon Jun 17 19:49:08 2019 (r349151) @@ -1,3 +1,3 @@ /* $FreeBSD$ */ -#include "../../sys/libkern/crc32.c" +#include "../../sys/libkern/gsb_crc32.c" Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/conf/files Mon Jun 17 19:49:08 2019 (r349151) @@ -3982,9 +3982,9 @@ crypto/chacha20/chacha.c standard libkern/asprintf.c standard libkern/bcd.c standard libkern/bsearch.c standard -libkern/crc32.c standard libkern/explicit_bzero.c standard libkern/fnmatch.c standard +libkern/gsb_crc32.c standard libkern/iconv.c optional libiconv libkern/iconv_converter_if.m optional libiconv libkern/iconv_ucs.c optional libiconv Modified: head/sys/dev/iscsi/icl_soft.c ============================================================================== --- head/sys/dev/iscsi/icl_soft.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/dev/iscsi/icl_soft.c Mon Jun 17 19:49:08 2019 (r349151) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/dev/iscsi_initiator/isc_subr.c ============================================================================== --- head/sys/dev/iscsi_initiator/isc_subr.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/dev/iscsi_initiator/isc_subr.c Mon Jun 17 19:49:08 2019 (r349151) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/dev/liquidio/lio_bsd.h ============================================================================== --- head/sys/dev/liquidio/lio_bsd.h Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/dev/liquidio/lio_bsd.h Mon Jun 17 19:49:08 2019 (r349151) @@ -36,6 +36,7 @@ #define __LIO_BSD_H__ #include +#include #include #include #include Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/dev/usb/net/if_cdce.c Mon Jun 17 19:49:08 2019 (r349151) @@ -50,7 +50,7 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include #include Modified: head/sys/fs/ext2fs/ext2_csum.c ============================================================================== --- head/sys/fs/ext2fs/ext2_csum.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/fs/ext2fs/ext2_csum.c Mon Jun 17 19:49:08 2019 (r349151) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include Modified: head/sys/fs/nandfs/nandfs_segment.c ============================================================================== --- head/sys/fs/nandfs/nandfs_segment.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/fs/nandfs/nandfs_segment.c Mon Jun 17 19:49:08 2019 (r349151) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/fs/nandfs/nandfs_subr.c ============================================================================== --- head/sys/fs/nandfs/nandfs_subr.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/fs/nandfs/nandfs_subr.c Mon Jun 17 19:49:08 2019 (r349151) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/fs/nandfs/nandfs_vfsops.c ============================================================================== --- head/sys/fs/nandfs/nandfs_vfsops.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/fs/nandfs/nandfs_vfsops.c Mon Jun 17 19:49:08 2019 (r349151) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/geom/part/g_part_bsd64.c ============================================================================== --- head/sys/geom/part/g_part_bsd64.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/geom/part/g_part_bsd64.c Mon Jun 17 19:49:08 2019 (r349151) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/geom/part/g_part_gpt.c Mon Jun 17 19:49:08 2019 (r349151) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/geom/raid/md_ddf.c ============================================================================== --- head/sys/geom/raid/md_ddf.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/geom/raid/md_ddf.c Mon Jun 17 19:49:08 2019 (r349151) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/kern/subr_compressor.c ============================================================================== --- head/sys/kern/subr_compressor.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/kern/subr_compressor.c Mon Jun 17 19:49:08 2019 (r349151) @@ -66,6 +66,7 @@ SET_DECLARE(compressors, struct compressor_methods); #ifdef GZIO +#include #include struct gz_stream { Copied and modified: head/sys/libkern/gsb_crc32.c (from r349150, head/sys/libkern/crc32.c) ============================================================================== --- head/sys/libkern/crc32.c Mon Jun 17 17:35:55 2019 (r349150, copy source) +++ head/sys/libkern/gsb_crc32.c Mon Jun 17 19:49:08 2019 (r349151) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL #include #include +#include #if defined(__amd64__) || defined(__i386__) #include Modified: head/sys/libkern/x86/crc32_sse42.c ============================================================================== --- head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/libkern/x86/crc32_sse42.c Mon Jun 17 19:49:08 2019 (r349151) @@ -29,14 +29,14 @@ __FBSDID("$FreeBSD$"); /* * This file is compiled in userspace in order to run ATF unit tests. */ -#ifdef USERSPACE_TESTING +#ifndef _KERNEL #include #include #else #include -#include #include #endif +#include static __inline uint32_t _mm_crc32_u8(uint32_t x, uint8_t y) @@ -199,7 +199,7 @@ crc32c_shift(uint32_t zeros[][256], uint32_t crc) /* Initialize tables for shifting crcs. */ static void -#ifdef USERSPACE_TESTING +#ifndef _KERNEL __attribute__((__constructor__)) #endif crc32c_init_hw(void) @@ -214,9 +214,6 @@ SYSINIT(crc32c_sse42, SI_SUB_LOCK, SI_ORDER_ANY, crc32 #endif /* Compute CRC-32C using the Intel hardware instruction. */ -#ifdef USERSPACE_TESTING -uint32_t sse42_crc32c(uint32_t, const unsigned char *, unsigned); -#endif uint32_t sse42_crc32c(uint32_t crc, const unsigned char *buf, unsigned len) { Modified: head/sys/netinet/libalias/alias_sctp.c ============================================================================== --- head/sys/netinet/libalias/alias_sctp.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/netinet/libalias/alias_sctp.c Mon Jun 17 19:49:08 2019 (r349151) @@ -75,6 +75,7 @@ #ifdef _KERNEL #include #include +#include #include #include #include Modified: head/sys/netinet/sctp_crc32.c ============================================================================== --- head/sys/netinet/sctp_crc32.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/netinet/sctp_crc32.c Mon Jun 17 19:49:08 2019 (r349151) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include "opt_sctp.h" +#include #ifdef SCTP #include #include Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/netpfil/pf/pf.c Mon Jun 17 19:49:08 2019 (r349151) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Added: head/sys/sys/gsb_crc32.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/gsb_crc32.h Mon Jun 17 19:49:08 2019 (r349151) @@ -0,0 +1,47 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * $FreeBSD$ + */ + +#ifndef _SYS_GSB_CRC32_H_ +#define _SYS_GSB_CRC32_H_ + +#include + +#ifdef _KERNEL + +extern const uint32_t crc32_tab[]; + +static __inline uint32_t +crc32_raw(const void *buf, size_t size, uint32_t crc) +{ + const uint8_t *p = (const uint8_t *)buf; + + while (size--) + crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + return (crc); +} + +static __inline uint32_t +crc32(const void *buf, size_t size) +{ + uint32_t crc; + + crc = crc32_raw(buf, size, ~0U); + return (crc ^ ~0U); +} + +uint32_t calculate_crc32c(uint32_t crc32c, const unsigned char *buffer, + unsigned int length); +#endif + +#if defined(__amd64__) || defined(__i386__) +uint32_t sse42_crc32c(uint32_t, const unsigned char *, unsigned); +#endif +#if defined(__aarch64__) +uint32_t armv8_crc32c(uint32_t, const unsigned char *, unsigned int); +#endif + +#endif /* !_SYS_GSB_CRC32_H_ */ Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/sys/libkern.h Mon Jun 17 19:49:08 2019 (r349151) @@ -190,39 +190,6 @@ size_t strspn(const char *, const char *); char *strstr(const char *, const char *); int strvalid(const char *, size_t); -extern const uint32_t crc32_tab[]; - -static __inline uint32_t -crc32_raw(const void *buf, size_t size, uint32_t crc) -{ - const uint8_t *p = (const uint8_t *)buf; - - while (size--) - crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); - return (crc); -} - -static __inline uint32_t -crc32(const void *buf, size_t size) -{ - uint32_t crc; - - crc = crc32_raw(buf, size, ~0U); - return (crc ^ ~0U); -} - -uint32_t -calculate_crc32c(uint32_t crc32c, const unsigned char *buffer, - unsigned int length); -#ifdef _KERNEL -#if defined(__amd64__) || defined(__i386__) -uint32_t sse42_crc32c(uint32_t, const unsigned char *, unsigned); -#endif -#if defined(__aarch64__) -uint32_t armv8_crc32c(uint32_t, const unsigned char *, unsigned int); -#endif -#endif - static __inline char * index(const char *p, int ch) { Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/sys/param.h Mon Jun 17 19:49:08 2019 (r349151) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300031 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300032 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/ufs/ffs/ffs_alloc.c Mon Jun 17 19:49:08 2019 (r349151) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/ufs/ffs/ffs_snapshot.c Mon Jun 17 19:49:08 2019 (r349151) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/ufs/ffs/ffs_subr.c ============================================================================== --- head/sys/ufs/ffs/ffs_subr.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/ufs/ffs/ffs_subr.c Mon Jun 17 19:49:08 2019 (r349151) @@ -59,6 +59,7 @@ struct malloc_type; #else /* _KERNEL */ #include +#include #include #include #include Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Jun 17 19:49:08 2019 (r349151) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include +#include #include #include #include Modified: head/tests/sys/kern/Makefile ============================================================================== --- head/tests/sys/kern/Makefile Mon Jun 17 17:35:55 2019 (r349150) +++ head/tests/sys/kern/Makefile Mon Jun 17 19:49:08 2019 (r349151) @@ -46,7 +46,6 @@ LIBADD.mqueue_test+= rt ${MACHINE_ARCH} == "i386" || \ ${MACHINE_ARCH} == "aarch64" ATF_TESTS_C+= libkern_crc32 -CFLAGS.libkern_crc32+= -DUSERSPACE_TESTING .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" LDADD.libkern_crc32+= ${SRCTOP}/sys/libkern/x86/crc32_sse42.c .else Modified: head/tests/sys/kern/libkern_crc32.c ============================================================================== --- head/tests/sys/kern/libkern_crc32.c Mon Jun 17 17:35:55 2019 (r349150) +++ head/tests/sys/kern/libkern_crc32.c Mon Jun 17 19:49:08 2019 (r349151) @@ -27,16 +27,13 @@ */ #include +#include #include #include -#if defined(__amd64__) || defined(__i386__) -extern uint32_t sse42_crc32c(uint32_t, const unsigned char *, unsigned); -#elif defined(__aarch64__) -extern uint32_t armv8_crc32c(uint32_t, const unsigned char *, unsigned); -#else +#if !defined(__amd64__) && !defined(__i386__) && !defined(__aarch64__) #error These tests are not supported on this platform #endif