36 #include "contiki-net.h"
39 #include "httpd-fsdata.h"
40 #include "httpd-fsdata.c"
42 #if HTTPD_FS_STATISTICS==2
43 u16_t httpd_filecount[HTTPD_FS_NUMFILES];
50 return (
void *)HTTPD_FS_ROOT;
61 httpd_fs_open(
const char *name,
struct httpd_fs_file *file)
63 #if HTTPD_FS_STATISTICS
66 struct httpd_fsdata_file_noconst *f,fram;
68 for(f = (
struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
70 f = (
struct httpd_fsdata_file_noconst *)fram.next) {
73 httpd_memcpy(&fram,f,
sizeof(fram));
76 if(httpd_fs_strcmp((
char *)name, fram.name) == 0) {
78 file->data = fram.data;
80 #if HTTPD_FS_STATISTICS==1 //increment count in linked list field if it is in RAM
86 #elif HTTPD_FS_STATISTICS==2 //increment count in RAM array when linked list is in flash
89 return httpd_filecount[i];
92 #else //no file statistics
105 #if HTTPD_FS_STATISTICS && 0 //count will already be zero at boot
107 for(i = 0; i < HTTPD_FS_NUMFILES; i++) {
113 #if HTTPD_FS_STATISTICS && 0 //Not needed, httpd_fs_open returns count
115 httpd_fs_count(
char *name)
117 struct httpd_fsdata_file_noconst *f,fram;
121 for(f = (
struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
123 f = (
struct httpd_fsdata_file_noconst *)fram.next) {
124 httpd_memcpy(&fram,f,
sizeof(fram));
125 if(httpd_strcmp(name, fram.name) == 0) {
126 #if HTTPD_FS_STATISTICS==1
128 #elif HTTPD_FS_STATISTICS==2