Skip to content

Commit

Permalink
Fixes several missing-prototype warnings. (LLNL#165)
Browse files Browse the repository at this point in the history
Compiling under Linux 6.9.9 and gcc 10.3.1.

* Adds spack-install target to Makefile.

* Addresses Stephanie's review comments

Removes empty line at the end of the file.
Adds empty lines around material within #define/#endif
Adds line separating system and local #include statements.
Removes duplicate #include
Add separating line between system and local includes.
Adds copyright info.
Remove extra line

---------

Co-authored-by: Barry <[email protected]>
Co-authored-by: Stephanie Brink <[email protected]>
  • Loading branch information
3 people authored Sep 23, 2024
1 parent 207e27e commit 465f56e
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 4 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions msr-smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/smp.h>

#include "msr_safe.h"
#include "msr-smp.h"

static void __msr_safe_batch(void *info)
{
Expand Down
12 changes: 12 additions & 0 deletions msr-smp.h
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions msr_allowlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <linux/uaccess.h>
#include <linux/version.h>

#include "msr_allowlist.h"

#define MAX_WLIST_BSIZE ((128 * 1024) + 1) // "+1" for null character

struct allowlist_entry
Expand Down
2 changes: 1 addition & 1 deletion msr_allowlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions msr_batch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions msr_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <linux/module.h>
#include <linux/uaccess.h>

#include "msr_version.h"

static struct class *cdev_class;
static char cdev_created;
static char cdev_registered;
Expand Down
2 changes: 1 addition & 1 deletion msr_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@

int msr_version_init(int *majordev);

int msr_version_cleanup(int majordev);
void msr_version_cleanup(int majordev);

#endif

0 comments on commit 465f56e

Please sign in to comment.