@@ -10,7 +10,6 @@
#include <unistd.h>
#include <errno.h>
#include "util.h"
-#include "swupdate.h"
#include "hw-compatibility.h"
/*
@@ -18,19 +17,19 @@
* in the sw-description file
*/
#ifdef CONFIG_HW_COMPATIBILITY
-int check_hw_compatibility(struct swupdate_cfg *cfg)
+int check_hw_compatibility(struct hw_type *hwt, struct hwlist *hardware)
{
struct hw_type *hw;
int ret;
- ret = get_hw_revision(&cfg->hw);
+ ret = get_hw_revision(hwt);
if (ret < 0)
return -1;
- TRACE("Hardware %s Revision: %s", cfg->hw.boardname, cfg->hw.revision);
- LIST_FOREACH(hw, &cfg->hardware, next) {
+ TRACE("Hardware %s Revision: %s", hwt->boardname, hwt->revision);
+ LIST_FOREACH(hw, hardware, next) {
if (hw &&
- (!hwid_match(hw->revision, cfg->hw.revision))) {
+ (!hwid_match(hw->revision, hwt->revision))) {
TRACE("Hardware compatibility verified");
return 0;
}
@@ -39,8 +38,7 @@ int check_hw_compatibility(struct swupdate_cfg *cfg)
return -1;
}
#else
-int check_hw_compatibility(struct swupdate_cfg
- __attribute__ ((__unused__)) *cfg)
+int check_hw_compatibility(struct hw_type __attribute__ ((__unused__)) *hwt, struct hwlist __attribute__ ((__unused__)) *hardware)
{
return 0;
}
@@ -183,7 +183,7 @@ static int extract_files(int fd, struct swupdate_cfg *software)
return -1;
}
- if (check_hw_compatibility(software)) {
+ if (check_hw_compatibility(&software->hw, &software->hardware)) {
ERROR("SW not compatible with hardware");
return -1;
}
@@ -23,7 +23,7 @@
#include "bootloader.h"
#include "progress.h"
#include "swupdate_image.h"
-#include "hw-compatibility.h"
+#include "swupdate.h"
#define LUA_TYPE_PEMBSCR 1
#define LUA_TYPE_HANDLER 2
@@ -8,9 +8,18 @@
#ifndef _SWUPDATE_HW_COMPATIBILITY_H
#define _SWUPDATE_HW_COMPATIBILITY_H
-#include "swupdate.h"
+#include "bsdqueue.h"
+#include "globals.h"
-int check_hw_compatibility(struct swupdate_cfg *cfg);
+struct hw_type {
+ char boardname[SWUPDATE_GENERAL_STRING_SIZE];
+ char revision[SWUPDATE_GENERAL_STRING_SIZE];
+ LIST_ENTRY(hw_type) next;
+};
+
+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
@@ -15,6 +15,7 @@
#include "mongoose_interface.h"
#include "swupdate_dict.h"
#include "swupdate_image.h"
+#include "hw-compatibility.h"
/*
* this is used to indicate if a file
@@ -27,14 +28,6 @@ typedef enum {
INSTALL_FROM_STREAM
} swupdate_file_t;
-struct hw_type {
- char boardname[SWUPDATE_GENERAL_STRING_SIZE];
- char revision[SWUPDATE_GENERAL_STRING_SIZE];
- LIST_ENTRY(hw_type) next;
-};
-
-LIST_HEAD(hwlist, hw_type);
-
struct extproc {
char name[SWUPDATE_GENERAL_STRING_SIZE];
char exec[SWUPDATE_GENERAL_STRING_SIZE];
Drop dependencies from swupdate configuration and just pass hardware related structures. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- core/hw-compatibility.c | 14 ++++++-------- core/stream_interface.c | 2 +- corelib/lua_interface.c | 2 +- include/hw-compatibility.h | 13 +++++++++++-- include/swupdate.h | 9 +-------- 5 files changed, 20 insertions(+), 20 deletions(-)