35 #include "contiki-net.h"
38 #include "httpd-fsdata.h"
39 #include "httpd-fsdata.c"
41 #if HTTPD_FS_STATISTICS==2
42 uint16_t httpd_filecount[HTTPD_FS_NUMFILES];
49 return (
void *)HTTPD_FS_ROOT;
60 httpd_fs_open(
const char *name,
struct httpd_fs_file *file)
62 #if HTTPD_FS_STATISTICS
65 struct httpd_fsdata_file_noconst *f,fram;
67 for(f = (
struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
69 f = (
struct httpd_fsdata_file_noconst *)fram.next) {
72 httpd_memcpy(&fram,f,
sizeof(fram));
75 if(httpd_fs_strcmp((
char *)name, fram.name) == 0) {
77 file->data = fram.data;
79 #if HTTPD_FS_STATISTICS==1 //increment count in linked list field if it is in RAM
85 #elif HTTPD_FS_STATISTICS==2 //increment count in RAM array when linked list is in flash
88 return httpd_filecount[i];
91 #else //no file statistics
104 #if HTTPD_FS_STATISTICS && 0 //count will already be zero at boot
106 for(i = 0; i < HTTPD_FS_NUMFILES; i++) {
112 #if HTTPD_FS_STATISTICS && 0 //Not needed, httpd_fs_open returns count
114 httpd_fs_count(
char *name)
116 struct httpd_fsdata_file_noconst *f,fram;
120 for(f = (
struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
122 f = (
struct httpd_fsdata_file_noconst *)fram.next) {
123 httpd_memcpy(&fram,f,
sizeof(fram));
124 if(httpd_strcmp(name, fram.name) == 0) {
125 #if HTTPD_FS_STATISTICS==1
127 #elif HTTPD_FS_STATISTICS==2
#define NULL
The null pointer.