config: remove ZFS_GLOBAL_ZONE_PAGE_STATE and ZFS_ENUM_* generation

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16479
This commit is contained in:
Rob Norris 2024-08-24 21:24:59 +10:00 committed by Brian Behlendorf
parent 8d9cb04ea8
commit ec48dd0976
7 changed files with 0 additions and 157 deletions

View File

@ -1,69 +0,0 @@
dnl #
dnl # Create a define and autoconf variable for an enum member
dnl #
AC_DEFUN([ZFS_AC_KERNEL_ENUM_MEMBER], [
AC_MSG_CHECKING([whether enum $2 contains $1])
AS_IF([AC_TRY_COMMAND(
"${srcdir}/scripts/enum-extract.pl" "$2" "$3" | grep -Eqx $1)],[
AC_MSG_RESULT([yes])
AC_DEFINE(m4_join([_], [ZFS_ENUM], m4_toupper($2), $1), 1,
[enum $2 contains $1])
m4_join([_], [ZFS_ENUM], m4_toupper($2), $1)=1
],[
AC_MSG_RESULT([no])
])
])
dnl #
dnl # Sanity check helpers
dnl #
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR],[
AC_MSG_RESULT(no)
AC_MSG_RESULT([$1 in either node_stat_item or zone_stat_item: $2])
ZFS_LINUX_TEST_ERROR([global page state])
])
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK], [
enum_check_a="m4_join([_], [$ZFS_ENUM_NODE_STAT_ITEM], $1)"
enum_check_b="m4_join([_], [$ZFS_ENUM_ZONE_STAT_ITEM], $1)"
AS_IF([test -n "$enum_check_a" -a -n "$enum_check_b"],[
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR([$1], [DUPLICATE])
])
AS_IF([test -z "$enum_check_a" -a -z "$enum_check_b"],[
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_ERROR([$1], [NOT FOUND])
])
])
dnl #
dnl # Ensure the config tests are finding one and only one of each enum.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY], [
AC_MSG_CHECKING([whether global_page_state enums are sane])
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_FILE_PAGES])
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_ANON])
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_FILE])
AC_MSG_RESULT(yes)
])
dnl #
dnl # enum members in which we're interested
dnl #
AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE], [
ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
[node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
[node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
[node_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
[zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
[zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
[zone_stat_item], [$LINUX/include/linux/mmzone.h])
ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY
])

View File

@ -149,7 +149,6 @@ dnl #
AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_TYPES
ZFS_AC_KERNEL_ACCESS_OK_TYPE
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
ZFS_AC_KERNEL_OBJTOOL
ZFS_AC_KERNEL_PDE_DATA
ZFS_AC_KERNEL_GENERIC_FADVISE

View File

@ -1,5 +1,4 @@
usr/bin/arc_summary.py
usr/share/zfs/enum-extract.pl
usr/share/zfs/zfs-helpers.sh
etc/default/zfs
etc/init.d

View File

@ -86,7 +86,6 @@ override_dh_auto_install:
@# Install the DKMS source.
@# We only want the files needed to build the modules
install -D -t '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts' \
'$(CURDIR)/scripts/enum-extract.pl' \
'$(CURDIR)/scripts/dkms.postbuild'
$(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit 1;)

View File

@ -1,37 +1,11 @@
#ifndef _ZFS_PAGE_COMPAT_H
#define _ZFS_PAGE_COMPAT_H
/*
* We have various enum members moving between two separate enum types,
* and accessed by different functions at various times. Centralise the
* insanity.
*
* < v4.8: all enums in zone_stat_item, via global_page_state()
* v4.8: some enums moved to node_stat_item, global_node_page_state() introduced
* v4.13: some enums moved from zone_stat_item to node_state_item
* v4.14: global_page_state() rename to global_zone_page_state()
*
* The defines used here are created by config/kernel-global_page_state.m4
*/
/*
* Create our own accessor functions to follow the Linux API changes
*/
#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES)
#define nr_file_pages() global_node_page_state(NR_FILE_PAGES)
#else
#define nr_file_pages() global_zone_page_state(NR_FILE_PAGES)
#endif
#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON)
#define nr_inactive_anon_pages() global_node_page_state(NR_INACTIVE_ANON)
#else
#define nr_inactive_anon_pages() global_zone_page_state(NR_INACTIVE_ANON)
#endif
#if defined(ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE)
#define nr_inactive_file_pages() global_node_page_state(NR_INACTIVE_FILE)
#else
#define nr_inactive_file_pages() global_zone_page_state(NR_INACTIVE_FILE)
#endif
#endif /* _ZFS_PAGE_COMPAT_H */

View File

@ -28,7 +28,6 @@ endif
dist_noinst_DATA += \
%D%/cstyle.pl \
%D%/enum-extract.pl \
%D%/update_authors.pl \
%D%/zfs2zol-patch.sed \
%D%/zol2zfs-patch.sed

View File

@ -1,58 +0,0 @@
#!/usr/bin/env perl
my $usage = <<EOT;
usage: config-enum enum [file ...]
Returns the elements from an enum declaration.
"Best effort": we're not building an entire C interpreter here!
EOT
use warnings;
use strict;
use Getopt::Std;
my %opts;
if (!getopts("", \%opts) || @ARGV < 1) {
print $usage;
exit 2;
}
my $enum = shift;
my $in_enum = 0;
while (<>) {
# comments
s/\/\*.*\*\///;
if (m/\/\*/) {
while ($_ .= <>) {
last if s/\/\*.*\*\///s;
}
}
# preprocessor stuff
next if /^#/;
# find our enum
$in_enum = 1 if s/^\s*enum\s+${enum}(?:\s|$)//;
next unless $in_enum;
# remove explicit values
s/\s*=[^,]+,/,/g;
# extract each identifier
while (m/\b([a-z_][a-z0-9_]*)\b/ig) {
print $1, "\n";
}
#
# don't exit: there may be multiple versions of the same enum, e.g.
# inside different #ifdef blocks. Let's explicitly return all of
# them and let external tooling deal with it.
#
$in_enum = 0 if m/}\s*;/;
}
exit 0;