17 #define CONFIG "sampleconfig"
19 #define FILENAME_PREFIX "r"
21 PROCESS(listcoffee_process,
"CFS/Coffee process");
22 AUTOSTART_PROCESSES(&listcoffee_process);
25 return c > 47 && c < 58;
29 struct cfs_dirent dirent;
32 printf(
"Cleaning filesystem\n");
35 printf(
"\tOpened folder\n");
38 printf(
"Found file %s\n", dirent.name);
41 if (strncmp(dirent.name, CONFIG, strlen(CONFIG)) == 0) {
42 printf(
"It's a config file, skipping\n");
48 if (strlen(dirent.name) > 1 && strncmp(dirent.name, FILENAME_PREFIX, strlen(FILENAME_PREFIX)) == 0 && is_num(dirent.name[1])) {
49 printf(
"It's a sample file, skipping\n");
55 printf(
"Failed to delete file %s\n", dirent.name);
57 printf(
"Removed file %s\n", dirent.name);
62 printf(
"Done cleaning file system\n");
int cfs_opendir(struct cfs_dir *dir, const char *name)
Open a directory for reading directory entries.
#define PROCESS_END()
Define the end of a process.
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
int cfs_readdir(struct cfs_dir *dir, struct cfs_dirent *record)
Read a directory entry.
int cfs_remove(const char *name)
Remove a file.
#define PROCESS_BEGIN()
Define the beginning of a process.