@@ -1,6 +1,6 @@
/*
* (C) Copyright 2017
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2022
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
@@ -11,8 +11,7 @@
* but just what is needed by swupdate
*/
-#ifndef _CPIOHDR_SWUPD_H
-#define _CPIOHDR_SWUPD_H
+#pragma once
/* Global swupdate defines */
#include <stdbool.h>
@@ -61,5 +60,3 @@ int extract_cpio_header(int fd, struct filehdr *fhdr, unsigned long *offset);
int extract_img_from_cpio(int fd, unsigned long offset, struct filehdr *fdh);
void extract_padding(int fd);
bool swupdate_verify_chksum(const uint32_t chk1, struct filehdr *fhdr);
-
-#endif
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2021
- * Stefano Babic, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
@@ -1,13 +1,12 @@
/*
* (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _DWL_INTERFACE_H
-#define _DWL_INTERFACE_H
+#pragma once
/*
* This is used by swupdate to start the Downloader Process
@@ -15,5 +14,3 @@
int start_download_server(const char *cfgfname, int argc, char *argv[]);
void download_print_help(void);
-
-#endif
@@ -1,13 +1,12 @@
/*
* (C) Copyright 2014
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _FLASH_PART_H
-#define _FLASH_PART_H
+#pragma once
#include <stdint.h>
#include <libmtd.h>
@@ -58,5 +57,3 @@ struct flash_description *get_flash_info(void);
#define isNand(flash, index) \
(flash->mtd_info[index].mtd.type == MTD_NANDFLASH || \
flash->mtd_info[index].mtd.type == MTD_MLCNANDFLASH)
-
-#endif
@@ -1,11 +1,10 @@
/*
- * Copyright (C) 2021 Stefano Babic <sbabic@denx.de>
+ * Copyright (C) 2021 Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _FS_INTERFACE_H
-#define _FS_INTERFACE_H
+#pragma once
char *diskformat_fs_detect(char *device);
int diskformat_fs_exists(char *device, char *fstype);
@@ -24,4 +23,3 @@ extern int ext_mkfs(const char *device_name, const char *fstype, unsigned long f
#if defined (CONFIG_BTRFS_FILESYSTEM)
extern int btrfs_mkfs(const char *device_name, const char *fstype);
#endif
-#endif
@@ -1,12 +1,11 @@
/*
* (C) Copyright 2014
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _GLOBALS_H
-#define _GLOBALS_H
+#pragma once
#define BANNER "SWUpdate v" SWU_VER "\n"
@@ -31,6 +30,3 @@
#define SCRIPTS_DIR_SUFFIX "scripts/"
#define DATADST_DIR_SUFFIX "datadst/"
#define BOOT_SCRIPT_SUFFIX "boot-script"
-
-#endif
-
@@ -1,14 +1,12 @@
/*
* (C) Copyright 2012-2013
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
- * on behalf of ifm electronic GmbH
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _HANDLER_H
-#define _HANDLER_H
+#pragma once
struct img_type;
typedef enum {
@@ -58,5 +56,3 @@ struct installer_handler *find_handler(struct img_type *img);
void print_registered_handlers(void);
struct installer_handler *get_next_handler(void);
unsigned int get_handler_mask(struct img_type *img);
-
-#endif
@@ -1,13 +1,11 @@
/*
- * (C) Copyright 2023
- * Stefano Babic, sbabic@denx.de.
+ * (C) Copyright 2013-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWUPDATE_HW_COMPATIBILITY_H
-#define _SWUPDATE_HW_COMPATIBILITY_H
-
+#pragma once
#include "bsdqueue.h"
#include "globals.h"
@@ -21,6 +19,3 @@ LIST_HEAD(hwlist, hw_type);
int check_hw_compatibility(struct hw_type *hwt, struct hwlist *hardware);
int get_hw_revision(struct hw_type *hw);
-
-#endif
-
@@ -1,13 +1,12 @@
/*
* (C) Copyright 2013
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _INSTALLER_H
-#define _INSTALLER_H
+#pragma once
#include <stdbool.h>
#include "swupdate.h"
@@ -23,5 +22,3 @@ int install_from_file(const char *filename, bool check);
int postupdate(struct swupdate_cfg *swcfg, const char *info);
int preupdatecmd(struct swupdate_cfg *swcfg);
void cleanup_files(struct swupdate_cfg *software);
-
-#endif
@@ -1,13 +1,11 @@
/*
* (C) Copyright 2020
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _INSTALLER_PRIV_H
-#define _INSTALLER_PRIV_H
-
+#pragma once
#include "swupdate_status.h"
#include "network_ipc.h"
@@ -20,5 +18,3 @@ struct installer {
struct swupdate_request req;
struct swupdate_cfg *software;
};
-
-#endif
@@ -1,14 +1,11 @@
/*
- * (C) Copyright 2013
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
- * on behalf of ifm electronic GmbH
+ * (C) Copyright 2013-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _LUA_UTIL_H
-#define _LUA_UTIL_H
-
+#pragma once
#ifdef CONFIG_LUA
#include "lua.h"
#include "lauxlib.h"
@@ -92,6 +89,3 @@ static inline int lua_parser_fn(lua_State __attribute__ ((__unused__)) *L,
struct img_type __attribute__ ((__unused__)) *img) { return -1; }
static inline int lua_handlers_init(void) { return 0; }
#endif
-
-
-#endif
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2012-2014
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2012-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _MONGOOSE_INTERFACE_H
-#define _MONGOOSE_INTERFACE_H
+#pragma once
/*
* Max number of command line options
@@ -19,5 +18,3 @@
int start_mongoose(const char *cfgfname, int argc, char *argv[]);
void mongoose_print_help(void);
-
-#endif
@@ -3,8 +3,7 @@
*
* SPDX-License-Identifier: MIT
*/
-#ifndef _multipart_parser_h
-#define _multipart_parser_h
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -46,4 +45,3 @@ void *multipart_parser_get_data(multipart_parser * p);
#ifdef __cplusplus
} /* extern "C" */
#endif
-#endif
@@ -1,14 +1,11 @@
/*
- * (C) Copyright 2013
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de
- * on behalf of ifm electronic GmbH
+ * (C) Copyright 2013-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _NETWORK_INTERFACE_H
-#define _NETWORK_INTERFACE_H
-
+#pragma once
void *network_initializer(void *data);
void *network_thread(void *data);
int listener_create(const char *path, int type);
@@ -16,4 +13,3 @@ int listener_create(const char *path, int type);
extern bool stream_wkup;
extern pthread_mutex_t stream_mutex;
extern pthread_cond_t stream_cond;
-#endif
@@ -1,13 +1,11 @@
/*
- * (C) Copyright 2008-2017
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
- * on behalf of ifm electronic GmbH
+ * (C) Copyright 2013-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef _IPC_H
-#define _IPC_H
+#pragma once
#include <stdlib.h>
#include <stdbool.h>
@@ -157,5 +155,3 @@ int swupdate_set_version_range(const char *minversion,
#ifdef __cplusplus
} // extern "C"
#endif
-
-#endif
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2016-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _PARSE_LIBRARY_H
-#define _PARSE_LIBRARY_H
+#pragma once
#include <assert.h>
#include <stdbool.h>
@@ -112,6 +111,3 @@ bool set_find_path(const char **nodes, const char *newpath, char **tmp);
d[0] = '\0'; \
GET_FIELD_STRING(p, e, name, d); \
} while (0)
-
-
-#endif
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2008-2013
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2013-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _RECOVERY_PARSERS_H
-#define _RECOVERY_PARSERS_H
+#pragma once
#include "generated/autoconf.h"
@@ -22,5 +21,3 @@ int parse(struct swupdate_cfg *swcfg, const char *filename);
int parse_cfg (struct swupdate_cfg *swcfg, const char *filename);
int parse_json(struct swupdate_cfg *swcfg, const char *filename);
int parse_external(struct swupdate_cfg *swcfg, const char *filename);
-#endif
-
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2016-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWUPDATE_PCTL_H
-#define _SWUPDATE_PCTL_H
+#pragma once
#include <swupdate_status.h>
#include <sys/types.h>
@@ -54,5 +53,3 @@ int pctl_getfd_from_type(sourcetype s);
const char *pctl_getname_from_type(sourcetype s);
int run_system_cmd(const char *cmd);
int run_function_background(void *fn, int argc, char **argv);
-
-#endif
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2016-2023
+ * Stefano Babic, <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _INSTALL_PROGRESS_H
-#define _INSTALL_PROGRESS_H
+#pragma once
#include <swupdate_status.h>
#include <progress_ipc.h>
@@ -28,5 +27,3 @@ void swupdate_progress_info(RECOVERY_STATUS status, int cause, const char *msg);
void swupdate_download_update(unsigned int perc, unsigned long long totalbytes, sourcetype source);
void *progress_bar_thread (void *data);
-
-#endif
@@ -5,8 +5,7 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef _PROGRESS_IPC_H
-#define _PROGRESS_IPC_H
+#pragma once
#include <stdbool.h>
#include <swupdate_status.h>
@@ -55,5 +54,3 @@ int progress_ipc_receive(int *connfd, struct progress_msg *msg);
#ifdef __cplusplus
} // extern "C"
#endif
-
-#endif
@@ -6,8 +6,7 @@
* SPDX-License-Identifier: MIT
*/
-#ifndef __SEMVER_H
-#define __SEMVER_H
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -102,5 +101,3 @@ semver_clean (char *s);
#ifdef __cplusplus
}
#endif
-
-#endif
@@ -1,6 +1,6 @@
/*
* (C) Copyright 2018
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
@@ -5,8 +5,7 @@
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWUPDATE_SSL_H
-#define _SWUPDATE_SSL_H
+#pragma once
#include <stdint.h>
#include "util.h"
@@ -221,6 +220,3 @@ UNUSED static inline struct swupdate_digest *swupdate_DECRYPT_init(
#define SSL_PURPOSE_CODE_SIGN -1
#define SSL_PURPOSE_DEFAULT -1
#endif
-
-#endif
-
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2012-2014
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2013-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWUPDATE_H
-#define _SWUPDATE_H
+#pragma once
#include <sys/types.h>
#include <stdbool.h>
@@ -111,5 +110,3 @@ struct swupdate_cfg {
int cpio_scan(int fd, struct swupdate_cfg *cfg, off_t start);
struct swupdate_cfg *get_swupdate_cfg(void);
void free_image(struct img_type *img);
-
-#endif
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2016-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWDICT_H
-#define _SWDICT_H
+#pragma once
#include <bsdqueue.h>
@@ -35,5 +34,3 @@ int dict_insert_value(struct dict *dictionary, const char *key, const char *valu
void dict_remove(struct dict *dictionary, const char *key);
void dict_drop_db(struct dict *dictionary);
int dict_parse_script(struct dict *dictionary, const char *script);
-
-#endif
@@ -1,12 +1,11 @@
/*
* (C) Copyright 2023
- * Stefano Babic, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWUPDATE_IMAGE_H
-#define _SWUPDATE_IMAGE_H
+#pragma once
#include <sys/types.h>
#include <stdbool.h>
@@ -72,6 +71,3 @@ struct img_type {
};
LIST_HEAD(imglist, img_type);
-
-#endif
-
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2016-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWUPDATE_SETTINGS_H
-#define _SWUPDATE_SETTINGS_H
+#pragma once
#include <unistd.h>
@@ -69,5 +68,3 @@ static inline int settings_into_dict(void __attribute__ ((__unused__)) *settings
return -1;
}
#endif
-
-#endif
@@ -1,13 +1,11 @@
/*
- * (C) Copyright 2015-2017
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2015-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef _SWUPDATE_STATUS_H
-#define _SWUPDATE_STATUS_H
-
+#pragma once
#ifdef __cplusplus
extern "C" {
#endif
@@ -42,5 +40,3 @@ typedef enum {
#ifdef __cplusplus
} // extern "C"
#endif
-
-#endif
@@ -5,8 +5,7 @@
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWVARS_H
-#define _SWVARS_H
+#pragma once
#include <libuboot.h>
@@ -15,5 +14,3 @@ int swupdate_vars_apply_list(const char *filename, const char *namespace);
char *swupdate_vars_get(const char *name, const char *namespace);
int swupdate_vars_set(const char *name, const char *value, const char *namespace);
int swupdate_vars_unset(const char *name, const char *namespace);
-
-#endif
@@ -1,12 +1,11 @@
/*
- * (C) Copyright 2012-2016
- * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ * (C) Copyright 2012-2023
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _UTIL_H
-#define _UTIL_H
+#pragma once
#include <fcntl.h>
#include <stdint.h>
@@ -272,4 +271,3 @@ int swupdate_umount(const char *dir);
/* Date / Time utilities */
char *swupdate_time_iso8601(struct timeval *tv);
-#endif
@@ -1,15 +1,12 @@
/*
* (C) Copyright 2023
- * Stefano Babic, sbabic@denx.de.
+ * Stefano Babic <stefano.babic@swupdate.org>
*
* SPDX-License-Identifier: GPL-2.0-only
*/
-#ifndef _SWUPDATE_VERSION_H
-#define _SWUPDATE_VERSION_H
+#pragma once
#include "swupdate_settings.h"
void get_sw_versions(swupdate_cfg_handle *handle, struct swupdate_cfg *sw);
-#endif
-
There is a mix of #ifndef and #pragma once to check if a header is already include. Drop the mix and use the pragma in all headers. Uodate SPDX to current information. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- include/bootloader.h | 2 +- include/chained_handler.h | 2 +- include/cpiohdr.h | 7 ++----- include/delta_process.h | 2 +- include/download_interface.h | 7 ++----- include/flash.h | 7 ++----- include/fs_interface.h | 6 ++---- include/globals.h | 8 ++------ include/handler.h | 8 ++------ include/hw-compatibility.h | 11 +++-------- include/installer.h | 7 ++----- include/installer_priv.h | 8 ++------ include/lua_util.h | 12 +++--------- include/mongoose_interface.h | 9 +++------ include/multipart_parser.h | 4 +--- include/network_interface.h | 10 +++------- include/network_ipc.h | 10 +++------- include/parselib.h | 10 +++------- include/parsers.h | 9 +++------ include/pctl.h | 9 +++------ include/progress.h | 9 +++------ include/progress_ipc.h | 5 +---- include/semver.h | 5 +---- include/server_utils.h | 2 +- include/sslapi.h | 6 +----- include/swupdate.h | 9 +++------ include/swupdate_dict.h | 9 +++------ include/swupdate_image.h | 8 ++------ include/swupdate_settings.h | 9 +++------ include/swupdate_status.h | 10 +++------- include/swupdate_vars.h | 5 +---- include/util.h | 8 +++----- include/versions.h | 7 ++----- 33 files changed, 71 insertions(+), 169 deletions(-)