Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156919431
D20193.id57205.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D20193.id57205.diff
View Options
Index: sys/dev/iscsi/icl_soft.c
===================================================================
--- sys/dev/iscsi/icl_soft.c
+++ sys/dev/iscsi/icl_soft.c
@@ -41,6 +41,7 @@
#include <sys/capsicum.h>
#include <sys/condvar.h>
#include <sys/conf.h>
+#include <sys/crc32.h>
#include <sys/file.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
Index: sys/dev/iscsi_initiator/isc_subr.c
===================================================================
--- sys/dev/iscsi_initiator/isc_subr.c
+++ sys/dev/iscsi_initiator/isc_subr.c
@@ -39,6 +39,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/conf.h>
+#include <sys/crc32.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/ctype.h>
Index: sys/dev/liquidio/lio_bsd.h
===================================================================
--- sys/dev/liquidio/lio_bsd.h
+++ sys/dev/liquidio/lio_bsd.h
@@ -36,6 +36,7 @@
#define __LIO_BSD_H__
#include <sys/param.h>
+#include <sys/crc32.h>
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/module.h>
Index: sys/dev/usb/net/if_cdce.c
===================================================================
--- sys/dev/usb/net/if_cdce.c
+++ sys/dev/usb/net/if_cdce.c
@@ -50,6 +50,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/crc32.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
Index: sys/fs/ext2fs/ext2_csum.c
===================================================================
--- sys/fs/ext2fs/ext2_csum.c
+++ sys/fs/ext2fs/ext2_csum.c
@@ -40,6 +40,7 @@
#include <sys/buf.h>
#include <sys/endian.h>
#include <sys/conf.h>
+#include <sys/crc32.h>
#include <sys/mount.h>
#include <fs/ext2fs/fs.h>
Index: sys/geom/part/g_part_bsd64.c
===================================================================
--- sys/geom/part/g_part_bsd64.c
+++ sys/geom/part/g_part_bsd64.c
@@ -29,6 +29,7 @@
#include <sys/param.h>
#include <sys/bio.h>
+#include <sys/crc32.h>
#include <sys/disklabel.h>
#include <sys/endian.h>
#include <sys/gpt.h>
Index: sys/geom/part/g_part_gpt.c
===================================================================
--- sys/geom/part/g_part_gpt.c
+++ sys/geom/part/g_part_gpt.c
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <sys/bio.h>
#include <sys/diskmbr.h>
+#include <sys/crc32.h>
#include <sys/endian.h>
#include <sys/gpt.h>
#include <sys/kernel.h>
Index: sys/geom/raid/md_ddf.c
===================================================================
--- sys/geom/raid/md_ddf.c
+++ sys/geom/raid/md_ddf.c
@@ -31,6 +31,7 @@
#include <sys/param.h>
#include <sys/bio.h>
+#include <sys/crc32.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/kobj.h>
Index: sys/kern/subr_compressor.c
===================================================================
--- sys/kern/subr_compressor.c
+++ sys/kern/subr_compressor.c
@@ -66,6 +66,7 @@
#ifdef GZIO
+#include <sys/crc32.h>
#include <sys/zutil.h>
struct gz_stream {
Index: sys/libkern/crc32.c
===================================================================
--- sys/libkern/crc32.c
+++ sys/libkern/crc32.c
@@ -48,7 +48,7 @@
#include <sys/param.h>
#ifdef _KERNEL
-#include <sys/libkern.h>
+#include <sys/crc32.h>
#include <sys/systm.h>
#if defined(__amd64__) || defined(__i386__)
Index: sys/libkern/x86/crc32_sse42.c
===================================================================
--- sys/libkern/x86/crc32_sse42.c
+++ sys/libkern/x86/crc32_sse42.c
@@ -34,7 +34,7 @@
#include <stdlib.h>
#else
#include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/crc32.h>
#include <sys/kernel.h>
#endif
Index: sys/netinet/libalias/alias_sctp.c
===================================================================
--- sys/netinet/libalias/alias_sctp.c
+++ sys/netinet/libalias/alias_sctp.c
@@ -75,6 +75,7 @@
#ifdef _KERNEL
#include <machine/stdarg.h>
#include <sys/param.h>
+#include <sys/crc32.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
Index: sys/netinet/sctp_crc32.c
===================================================================
--- sys/netinet/sctp_crc32.c
+++ sys/netinet/sctp_crc32.c
@@ -37,6 +37,7 @@
#include "opt_sctp.h"
+#include <sys/crc32.h>
#ifdef SCTP
#include <netinet/sctp_os.h>
#include <netinet/sctp.h>
Index: sys/sys/crc32.h
===================================================================
--- /dev/null
+++ sys/sys/crc32.h
@@ -0,0 +1,72 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)crc32.h 8.1 (Berkeley) 6/10/93
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_KERN_CRC32_H_
+#define _SYS_KERN_CRC32_H_
+
+#include <sys/types.h>
+
+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
+
+#endif /* !_SYS_KERN_CRC32_H_ */
Index: sys/sys/libkern.h
===================================================================
--- sys/sys/libkern.h
+++ sys/sys/libkern.h
@@ -190,39 +190,6 @@
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)
{
Index: sys/ufs/ffs/ffs_alloc.c
===================================================================
--- sys/ufs/ffs/ffs_alloc.c
+++ sys/ufs/ffs/ffs_alloc.c
@@ -68,6 +68,7 @@
#include <sys/param.h>
#include <sys/capsicum.h>
+#include <sys/crc32.h>
#include <sys/systm.h>
#include <sys/bio.h>
#include <sys/buf.h>
Index: sys/ufs/ffs/ffs_snapshot.c
===================================================================
--- sys/ufs/ffs/ffs_snapshot.c
+++ sys/ufs/ffs/ffs_snapshot.c
@@ -44,6 +44,7 @@
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/conf.h>
+#include <sys/crc32.h>
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/fcntl.h>
Index: sys/ufs/ffs/ffs_subr.c
===================================================================
--- sys/ufs/ffs/ffs_subr.c
+++ sys/ufs/ffs/ffs_subr.c
@@ -59,6 +59,7 @@
#else /* _KERNEL */
#include <sys/systm.h>
+#include <sys/crc32.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mount.h>
Index: sys/ufs/ffs/ffs_vfsops.c
===================================================================
--- sys/ufs/ffs/ffs_vfsops.c
+++ sys/ufs/ffs/ffs_vfsops.c
@@ -40,6 +40,7 @@
#include "opt_ddb.h"
#include <sys/param.h>
+#include <sys/crc32.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/priv.h>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 8:54 AM (2 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33240807
Default Alt Text
D20193.id57205.diff (9 KB)
Attached To
Mode
D20193: Relocate crc32 functions from libkern.h to gsb_crc32.h/c
Attached
Detach File
Event Timeline
Log In to Comment