diff --git a/Makefile b/Makefile index 62e49d0..53ba66e 100644 --- a/Makefile +++ b/Makefile @@ -70,5 +70,21 @@ install-spank: spank $(INSTALL) -d $(DESTDIR)/$(libdir)/slurm $(INSTALL) msrsave/libspank_msrsafe.so $(DESTDIR)/$(libdir)/slurm/libspank_msrsafe.so +# The current spack package ignore this Makefile for building the +# msr-safe.ko kernel module, as it is building against an arbitrary +# version of the linux kernel and thus $(shell uname -r) is not useful. +# +# Installation relies on the spack package setting DESTDIR to the +# msr-safe package prefix spec variable. +# +# Later iterations of the spack package might also build and install +# msrsave. That will likely require a reworking of this Makefile. +# Prefer single-source-of-truth in that case. +spack-install: + $(INSTALL) -d $(DESTDIR)/lib/modules + $(INSTALL) msr-safe.ko $(DESTDIR)/lib/modules + $(INSTALL) -d $(DESTDIR)/include + $(INSTALL) msr_safe.h $(DESTDIR)/include + .SUFFIXES: .c .o .PHONY: all clean install spank install-spank diff --git a/msr-smp.c b/msr-smp.c index 34310e5..15a0b75 100644 --- a/msr-smp.c +++ b/msr-smp.c @@ -18,6 +18,7 @@ #include #include "msr_safe.h" +#include "msr-smp.h" static void __msr_safe_batch(void *info) { diff --git a/msr-smp.h b/msr-smp.h new file mode 100644 index 0000000..3dc2ad4 --- /dev/null +++ b/msr-smp.h @@ -0,0 +1,12 @@ +// Copyright 2011-2021 Lawrence Livermore National Security, LLC and other +// msr-safe Project Developers. See the top-level COPYRIGHT file for +// details. +// +// SPDX-License-Identifier: GPL-2.0-only + +#ifndef MSR_SMP_INCLUDE +#define MSR_SMP_INCLUDE + +int msr_safe_batch(struct msr_batch_array *oa); + +#endif diff --git a/msr_allowlist.c b/msr_allowlist.c index f815d05..fb5936a 100644 --- a/msr_allowlist.c +++ b/msr_allowlist.c @@ -16,6 +16,8 @@ #include #include +#include "msr_allowlist.h" + #define MAX_WLIST_BSIZE ((128 * 1024) + 1) // "+1" for null character struct allowlist_entry diff --git a/msr_allowlist.h b/msr_allowlist.h index 7e0e94d..1eda4a4 100644 --- a/msr_allowlist.h +++ b/msr_allowlist.h @@ -20,7 +20,7 @@ int msr_allowlist_init(int *majordev); -int msr_allowlist_cleanup(int majordev); +void msr_allowlist_cleanup(int majordev); int msr_allowlist_exists(void); diff --git a/msr_batch.c b/msr_batch.c index 56feb15..dd46c27 100644 --- a/msr_batch.c +++ b/msr_batch.c @@ -31,6 +31,7 @@ #include "msr_batch.h" #include "msr_safe.h" +#include "msr-smp.h" #include "msr_allowlist.h" static struct class *cdev_class; @@ -73,8 +74,6 @@ static int msrbatch_apply_allowlist(struct msr_batch_array *oa) return err; } -extern int msr_safe_batch(struct msr_batch_array *oa); - static long msrbatch_ioctl(struct file *f, unsigned int ioc, unsigned long arg) { int err = 0; diff --git a/msr_version.c b/msr_version.c index 5abe857..bee1832 100644 --- a/msr_version.c +++ b/msr_version.c @@ -12,6 +12,8 @@ #include #include +#include "msr_version.h" + static struct class *cdev_class; static char cdev_created; static char cdev_registered; diff --git a/msr_version.h b/msr_version.h index ff9d68d..1f66aae 100644 --- a/msr_version.h +++ b/msr_version.h @@ -20,6 +20,6 @@ int msr_version_init(int *majordev); -int msr_version_cleanup(int majordev); +void msr_version_cleanup(int majordev); #endif