From 1952fe0e2552d9b65b2db1e76c1a4a3f5ab0f27e Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Fri, 25 Oct 2019 13:40:50 -0700 Subject: Move platform dependent errno aliases EBADE, EBADR, and ENOANO do not exist on FreeBSD The libspl errno.h is similarly platform dependent. Reviewed-by: Brian Behlendorf Signed-off-by: Matt Macy Closes #9498 --- include/os/linux/spl/sys/errno.h | 10 +++++++ include/sys/zio.h | 10 ------- lib/libspl/include/os/linux/sys/Makefile.am | 1 + lib/libspl/include/os/linux/sys/errno.h | 46 +++++++++++++++++++++++++++++ lib/libspl/include/sys/Makefile.am | 1 - lib/libspl/include/sys/errno.h | 35 ---------------------- 6 files changed, 57 insertions(+), 46 deletions(-) create mode 100644 lib/libspl/include/os/linux/sys/errno.h delete mode 100644 lib/libspl/include/sys/errno.h diff --git a/include/os/linux/spl/sys/errno.h b/include/os/linux/spl/sys/errno.h index 6015b1a3e..f6d9212a6 100644 --- a/include/os/linux/spl/sys/errno.h +++ b/include/os/linux/spl/sys/errno.h @@ -44,4 +44,14 @@ #define ENOTSUP EOPNOTSUPP +/* + * We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent + * graveyard) to indicate checksum errors and fragmentation. + */ +#define ECKSUM EBADE +#define EFRAGS EBADR + +/* Similar for ENOACTIVE */ +#define ENOTACTIVE ENOANO + #endif /* _SYS_ERRNO_H */ diff --git a/include/sys/zio.h b/include/sys/zio.h index bf441ff8d..23a4a6ea9 100644 --- a/include/sys/zio.h +++ b/include/sys/zio.h @@ -265,16 +265,6 @@ enum zio_wait_type { ZIO_WAIT_TYPES }; -/* - * We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent - * graveyard) to indicate checksum errors and fragmentation. - */ -#define ECKSUM EBADE -#define EFRAGS EBADR - -/* Similar for ENOACTIVE */ -#define ENOTACTIVE ENOANO - typedef void zio_done_func_t(zio_t *zio); extern int zio_dva_throttle_enabled; diff --git a/lib/libspl/include/os/linux/sys/Makefile.am b/lib/libspl/include/os/linux/sys/Makefile.am index c11732cc1..6b170fa8c 100644 --- a/lib/libspl/include/os/linux/sys/Makefile.am +++ b/lib/libspl/include/os/linux/sys/Makefile.am @@ -1,6 +1,7 @@ libspldir = $(includedir)/libspl/sys libspl_HEADERS = \ $(top_srcdir)/lib/libspl/include/os/linux/sys/byteorder.h \ + $(top_srcdir)/lib/libspl/include/os/linux/sys/errno.h \ $(top_srcdir)/lib/libspl/include/os/linux/sys/file.h \ $(top_srcdir)/lib/libspl/include/os/linux/sys/mnttab.h \ $(top_srcdir)/lib/libspl/include/os/linux/sys/mount.h \ diff --git a/lib/libspl/include/os/linux/sys/errno.h b/lib/libspl/include/os/linux/sys/errno.h new file mode 100644 index 000000000..30d20ab89 --- /dev/null +++ b/lib/libspl/include/os/linux/sys/errno.h @@ -0,0 +1,46 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2017 Zettabyte Software, LLC. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Compiling against musl correctly points out that including sys/errno.h is + * disallowed by the Single UNIX Specification when building in userspace, so + * we implement a dummy header to redirect the include to the proper header. + */ +#ifndef _LIBSPL_SYS_ERRNO_H +#define _LIBSPL_SYS_ERRNO_H + +#include +/* + * We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent + * graveyard) to indicate checksum errors and fragmentation. + */ +#define ECKSUM EBADE +#define EFRAGS EBADR + +/* Similar for ENOACTIVE */ +#define ENOTACTIVE ENOANO + +#endif /* _LIBSPL_SYS_ERRNO_H */ diff --git a/lib/libspl/include/sys/Makefile.am b/lib/libspl/include/sys/Makefile.am index 54aece129..6855a39d1 100644 --- a/lib/libspl/include/sys/Makefile.am +++ b/lib/libspl/include/sys/Makefile.am @@ -11,7 +11,6 @@ libspl_HEADERS = \ $(top_srcdir)/lib/libspl/include/sys/debug.h \ $(top_srcdir)/lib/libspl/include/sys/dkio.h \ $(top_srcdir)/lib/libspl/include/sys/dklabel.h \ - $(top_srcdir)/lib/libspl/include/sys/errno.h \ $(top_srcdir)/lib/libspl/include/sys/feature_tests.h \ $(top_srcdir)/lib/libspl/include/sys/int_limits.h \ $(top_srcdir)/lib/libspl/include/sys/int_types.h \ diff --git a/lib/libspl/include/sys/errno.h b/lib/libspl/include/sys/errno.h deleted file mode 100644 index e8bfbe353..000000000 --- a/lib/libspl/include/sys/errno.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2017 Zettabyte Software, LLC. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Compiling against musl correctly points out that including sys/errno.h is - * disallowed by the Single UNIX Specification when building in userspace, so - * we implement a dummy header to redirect the include to the proper header. - */ -#ifndef _LIBSPL_SYS_ERRNO_H -#define _LIBSPL_SYS_ERRNO_H -#include -#endif /* _LIBSPL_SYS_ERRNO_H */ -- cgit v1.2.3