Skip to content

Commit

Permalink
Fix build without MTD support
Browse files Browse the repository at this point in the history
handlers/raw_handler and corelib/installer does not need flash.h.
corelib/stream_interface and core/swupdate should include flash.h only
conditionally.

This fixes build errors if HAVE_MTD is not set and libmtd is not available:

In file included from include/swupdate.h:25:0,
                 from handlers/raw_handler.c:33:
include/flash.h:26:24: fatal error: mtd/libmtd.h: No such file or directory

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
  • Loading branch information
joerg-krause authored and sbabic committed Apr 15, 2016
1 parent 30e5f21 commit 69c0e66
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions core/swupdate.c
Expand Up @@ -43,7 +43,9 @@
#include "network_interface.h"
#include "handler.h"
#include "installer.h"
#ifdef CONFIG_MTD
#include "flash.h"
#endif
#include "lua_util.h"
#include "mongoose_interface.h"
#include "network_ipc.h"
Expand All @@ -62,12 +64,14 @@ static pthread_t network_daemon;
/* Tree derived from the configuration file */
static struct swupdate_cfg swcfg;

#ifdef CONFIG_MTD
/* Global MTD configuration */
static struct flash_description flashdesc;

struct flash_description *get_flash_info(void) {
return &flashdesc;
}
#endif

static struct option long_options[] = {
{"verbose", no_argument, NULL, 'v'},
Expand Down Expand Up @@ -375,7 +379,9 @@ int main(int argc, char **argv)
int ac = 0;
#endif

#ifdef CONFIG_MTD
memset(&flashdesc, 0, sizeof(flashdesc));
#endif
memset(main_options, 0, sizeof(main_options));
memset(image_url, 0, sizeof(image_url));
strcpy(main_options, "vhi:se:l:");
Expand Down
1 change: 0 additions & 1 deletion corelib/installer.c
Expand Up @@ -38,7 +38,6 @@
#include "util.h"
#include "swupdate.h"
#include "installer.h"
#include "flash.h"
#include "handler.h"
#include "cpiohdr.h"
#include "parsers.h"
Expand Down
2 changes: 2 additions & 0 deletions corelib/stream_interface.c
Expand Up @@ -44,7 +44,9 @@
#include "swupdate.h"
#include "util.h"
#include "handler.h"
#ifdef CONFIG_MTD
#include "flash.h"
#endif
#include "parsers.h"
#include "network_ipc.h"
#include "network_interface.h"
Expand Down
2 changes: 0 additions & 2 deletions handlers/raw_handler.c
Expand Up @@ -29,10 +29,8 @@
#include <errno.h>
#include <string.h>

#include <mtd/mtd-user.h>
#include "swupdate.h"
#include "handler.h"
#include "flash.h"
#include "util.h"

void raw_handler(void);
Expand Down
1 change: 0 additions & 1 deletion include/swupdate.h
Expand Up @@ -22,7 +22,6 @@

#include <sys/types.h>
#include "bsdqueue.h"
#include "flash.h"
#include "globals.h"

typedef enum {
Expand Down

0 comments on commit 69c0e66

Please sign in to comment.