mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 21:32:46 +00:00
Simplify HTTPD #include path handling
- Move fsdata.h content to lwip/apps/fs.h -> no #include path needed any more to src/apps/httpd/ - Create a #define to specify fsdata file name. One can use path in there now, e.g. "../mywebserver/mkfsdata_output.c" -> no #include path needed any more to location of generated file
This commit is contained in:
parent
a038e1502f
commit
f8ef8c48f7
@ -33,15 +33,10 @@
|
|||||||
#include "lwip/apps/httpd_opts.h"
|
#include "lwip/apps/httpd_opts.h"
|
||||||
#include "lwip/def.h"
|
#include "lwip/def.h"
|
||||||
#include "lwip/apps/fs.h"
|
#include "lwip/apps/fs.h"
|
||||||
#include "fsdata.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
#if HTTPD_USE_CUSTOM_FSDATA
|
#include HTTPD_FSDATA_FILE
|
||||||
#include "fsdata_custom.c"
|
|
||||||
#else /* HTTPD_USE_CUSTOM_FSDATA */
|
|
||||||
#include "fsdata.c"
|
|
||||||
#endif /* HTTPD_USE_CUSTOM_FSDATA */
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "lwip/apps/fs.h"
|
#include "lwip/apps/fs.h"
|
||||||
#include "lwip/def.h"
|
#include "lwip/def.h"
|
||||||
#include "fsdata.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define file_NULL (struct fsdata_file *) NULL
|
#define file_NULL (struct fsdata_file *) NULL
|
||||||
|
@ -35,16 +35,7 @@
|
|||||||
#include "lwip/apps/httpd_opts.h"
|
#include "lwip/apps/httpd_opts.h"
|
||||||
#include "lwip/apps/fs.h"
|
#include "lwip/apps/fs.h"
|
||||||
|
|
||||||
struct fsdata_file {
|
/* THIS FILE IS DEPRECATED AND WILL BE REMOVED IN THE FUTURE */
|
||||||
const struct fsdata_file *next;
|
/* content was moved to fs.h to simplify #include structure */
|
||||||
const unsigned char *name;
|
|
||||||
const unsigned char *data;
|
|
||||||
int len;
|
|
||||||
u8_t flags;
|
|
||||||
#if HTTPD_PRECALCULATED_CHECKSUM
|
|
||||||
u16_t chksum_count;
|
|
||||||
const struct fsdata_chksum *chksum;
|
|
||||||
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* LWIP_FSDATA_H */
|
#endif /* LWIP_FSDATA_H */
|
||||||
|
@ -306,8 +306,7 @@ int main(int argc, char *argv[])
|
|||||||
CHDIR(path);
|
CHDIR(path);
|
||||||
|
|
||||||
fprintf(data_file, "#include \"lwip/apps/fs.h\"" NEWLINE);
|
fprintf(data_file, "#include \"lwip/apps/fs.h\"" NEWLINE);
|
||||||
fprintf(data_file, "#include \"lwip/def.h\"" NEWLINE);
|
fprintf(data_file, "#include \"lwip/def.h\"" NEWLINE NEWLINE NEWLINE);
|
||||||
fprintf(data_file, "#include \"fsdata.h\"" NEWLINE NEWLINE NEWLINE);
|
|
||||||
|
|
||||||
fprintf(data_file, "#define file_NULL (struct fsdata_file *) NULL" NEWLINE NEWLINE NEWLINE);
|
fprintf(data_file, "#define file_NULL (struct fsdata_file *) NULL" NEWLINE NEWLINE NEWLINE);
|
||||||
/* define FS_FILE_FLAGS_HEADER_INCLUDED to 1 if not defined (compatibility with older httpd/fs) */
|
/* define FS_FILE_FLAGS_HEADER_INCLUDED to 1 if not defined (compatibility with older httpd/fs) */
|
||||||
|
@ -96,6 +96,18 @@ void *fs_state_init(struct fs_file *file, const char *name);
|
|||||||
void fs_state_free(struct fs_file *file, void *state);
|
void fs_state_free(struct fs_file *file, void *state);
|
||||||
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
||||||
|
|
||||||
|
struct fsdata_file {
|
||||||
|
const struct fsdata_file *next;
|
||||||
|
const unsigned char *name;
|
||||||
|
const unsigned char *data;
|
||||||
|
int len;
|
||||||
|
u8_t flags;
|
||||||
|
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||||
|
u16_t chksum_count;
|
||||||
|
const struct fsdata_chksum *chksum;
|
||||||
|
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -310,10 +310,14 @@
|
|||||||
#define LWIP_HTTPD_FS_ASYNC_READ 0
|
#define LWIP_HTTPD_FS_ASYNC_READ 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the
|
/** Filename (including path) to use as FS data file */
|
||||||
* file system (to prevent changing the file included in CVS) */
|
#if !defined HTTPD_FSDATA_FILE || defined __DOXYGEN__
|
||||||
#if !defined HTTPD_USE_CUSTOM_FSDATA || defined __DOXYGEN__
|
/* HTTPD_USE_CUSTOM_FSDATA: Compatibility with deprecated lwIP option */
|
||||||
#define HTTPD_USE_CUSTOM_FSDATA 0
|
#if HTTPD_USE_CUSTOM_FSDATA
|
||||||
|
#define HTTPD_FSDATA_FILE "fsdata_custom.c"
|
||||||
|
#else
|
||||||
|
#define HTTPD_FSDATA_FILE "fsdata.c"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user