In the main() function, we declare a single services array entry for the socket services functions and a null entry for the flash services functions.
/* ** File: f3s_ram_main.c ** ** Description: ** ** This file contains the main function for the f3s ** flash filesystem ** */ #include "f3s_ram.h" int main(int argc, char **argv) { int error; static f3s_service_t service[] = { { sizeof(f3s_service_t), f3s_ram_open, f3s_ram_page, f3s_ram_status, f3s_ram_close }, { /* mandatory last entry */ 0, 0, 0, 0, 0 } }; static f3s_flash_v2_t flash[] = { { sizeof(f3s_flash_v2_t), f3s_sram_ident, /* Common Ident */ f3s_sram_reset, /* Common Reset */ NULL, /* v1 Read (Deprecated) */ NULL, /* v1 Write (Deprecated) */ NULL, /* v1 Erase (Deprecated) */ NULL, /* v1 Suspend (Deprecated) */ NULL, /* v1 Resume (Deprecated) */ NULL, /* v1 Sync (Deprecated) */ NULL, /* v2 Read (Use default) */ f3s_sram_v2write, /* v2 Write */ f3s_sram_v2erase, /* v2 Erase */ NULL, /* v2 Suspend (Unused) */ NULL, /* v2 Resume (Unused) */ f3s_sram_v2sync, /* v2 Sync */ f3s_sram_v2islock, /* v2 Islock */ f3s_sram_v2lock, /* v2 Lock */ f3s_sram_v2unlock, /* v2 Unlock */ f3s_sram_v2unlockall /* v2 Unlockall */ }, { /* mandatory last entry */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; /* init f3s */ f3s_init(argc, argv, (f3s_flash_t *)flash); /* start f3s */ error = f3s_start(service, (f3s_flash_t *)flash); return (error); }