aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-13 22:28:18 -0700
committerEric Biggers <ebiggers@google.com>2020-05-13 22:28:18 -0700
commitae75f37c4ade32dffda0e440ffc93a7249e5aade (patch)
treed479c08fcb139effa974efd35cf6aa2ea87dad8c
parentcdaefaa25811c4389e7528fc47ba74e6e21fe0c9 (diff)
downloadfsverity-utils-ae75f37c4ade32dffda0e440ffc93a7249e5aade.tar.gz
Include local headers first
It's best practice to include local headers before standard headers. Signed-off-by: Eric Biggers <ebiggers@google.com>
-rw-r--r--cmd_enable.c8
-rw-r--r--cmd_measure.c8
-rw-r--r--cmd_sign.c8
-rw-r--r--commands.h4
-rw-r--r--fsverity.c6
-rw-r--r--hash_algs.c6
-rw-r--r--hash_algs.h4
-rw-r--r--util.c4
8 files changed, 24 insertions, 24 deletions
diff --git a/cmd_enable.c b/cmd_enable.c
index 1646299..cc22f17 100644
--- a/cmd_enable.c
+++ b/cmd_enable.c
@@ -7,6 +7,10 @@
* Written by Eric Biggers.
*/
+#include "commands.h"
+#include "fsverity_uapi.h"
+#include "hash_algs.h"
+
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
@@ -14,10 +18,6 @@
#include <string.h>
#include <sys/ioctl.h>
-#include "commands.h"
-#include "fsverity_uapi.h"
-#include "hash_algs.h"
-
static bool parse_hash_alg_option(const char *arg, u32 *alg_ptr)
{
char *end;
diff --git a/cmd_measure.c b/cmd_measure.c
index 574e3ca..e8218ab 100644
--- a/cmd_measure.c
+++ b/cmd_measure.c
@@ -7,14 +7,14 @@
* Written by Eric Biggers.
*/
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-
#include "commands.h"
#include "fsverity_uapi.h"
#include "hash_algs.h"
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+
/* Display the measurement of the given verity file(s). */
int fsverity_cmd_measure(const struct fsverity_command *cmd,
int argc, char *argv[])
diff --git a/cmd_sign.c b/cmd_sign.c
index dcb37ce..5a6deb7 100644
--- a/cmd_sign.c
+++ b/cmd_sign.c
@@ -7,6 +7,10 @@
* Written by Eric Biggers.
*/
+#include "commands.h"
+#include "fsverity_uapi.h"
+#include "hash_algs.h"
+
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
@@ -17,10 +21,6 @@
#include <stdlib.h>
#include <string.h>
-#include "commands.h"
-#include "fsverity_uapi.h"
-#include "hash_algs.h"
-
/*
* Merkle tree properties. The file measurement is the hash of this structure
* excluding the signature and with the sig_size field set to 0.
diff --git a/commands.h b/commands.h
index 98f9745..9048601 100644
--- a/commands.h
+++ b/commands.h
@@ -2,10 +2,10 @@
#ifndef COMMANDS_H
#define COMMANDS_H
-#include <stdio.h>
-
#include "util.h"
+#include <stdio.h>
+
struct fsverity_command;
void usage(const struct fsverity_command *cmd, FILE *fp);
diff --git a/fsverity.c b/fsverity.c
index 9a44df1..8d94c98 100644
--- a/fsverity.c
+++ b/fsverity.c
@@ -7,14 +7,14 @@
* Written by Eric Biggers.
*/
+#include "commands.h"
+#include "hash_algs.h"
+
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "commands.h"
-#include "hash_algs.h"
-
static const struct fsverity_command {
const char *name;
int (*func)(const struct fsverity_command *cmd, int argc, char *argv[]);
diff --git a/hash_algs.c b/hash_algs.c
index 7251bf2..bb153de 100644
--- a/hash_algs.c
+++ b/hash_algs.c
@@ -7,13 +7,13 @@
* Written by Eric Biggers.
*/
+#include "fsverity_uapi.h"
+#include "hash_algs.h"
+
#include <openssl/evp.h>
#include <stdlib.h>
#include <string.h>
-#include "fsverity_uapi.h"
-#include "hash_algs.h"
-
/* ========== libcrypto (OpenSSL) wrappers ========== */
struct openssl_hash_ctx {
diff --git a/hash_algs.h b/hash_algs.h
index 3e90f49..913c918 100644
--- a/hash_algs.h
+++ b/hash_algs.h
@@ -2,10 +2,10 @@
#ifndef HASH_ALGS_H
#define HASH_ALGS_H
-#include <stdio.h>
-
#include "util.h"
+#include <stdio.h>
+
struct fsverity_hash_alg {
const char *name;
unsigned int digest_size;
diff --git a/util.c b/util.c
index 2218f2e..2951729 100644
--- a/util.c
+++ b/util.c
@@ -7,6 +7,8 @@
* Written by Eric Biggers.
*/
+#include "util.h"
+
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@@ -17,8 +19,6 @@
#include <sys/stat.h>
#include <unistd.h>
-#include "util.h"
-
/* ========== Memory allocation ========== */
void *xmalloc(size_t size)