1 /* This file contains the SFFS initialization code and message loop. 2 * 3 * The entry points into this file are: 4 * sffs_init initialization 5 * sffs_signal signal handler 6 * sffs_loop main message loop 7 * 8 * Created: 9 * April 2009 (D.C. van Moolenbroek) 10 */ 11 12 #include "inc.h" 13 14 /*===========================================================================* 15 * sffs_init * 16 *===========================================================================*/ sffs_init(char * name,const struct sffs_table * table,struct sffs_params * params)17int sffs_init(char *name, const struct sffs_table *table, 18 struct sffs_params *params) 19 { 20 /* Initialize this file server. Called at startup time. 21 */ 22 int i; 23 24 /* Make sure that the given path prefix doesn't end with a slash. */ 25 i = strlen(params->p_prefix); 26 while (i > 0 && params->p_prefix[i - 1] == '/') i--; 27 params->p_prefix[i] = 0; 28 29 sffs_name = name; 30 sffs_table = table; 31 sffs_params = params; 32 33 return OK; 34 } 35 36 /*===========================================================================* 37 * sffs_signal * 38 *===========================================================================*/ sffs_signal(int signo)39void sffs_signal(int signo) 40 { 41 42 /* Only check for termination signal, ignore anything else. */ 43 if (signo != SIGTERM) return; 44 45 dprintf(("%s: got SIGTERM\n", sffs_name)); 46 47 fsdriver_terminate(); 48 } 49 50 /*===========================================================================* 51 * sffs_loop * 52 *===========================================================================*/ sffs_loop(void)53void sffs_loop(void) 54 { 55 /* The main function of this file server. Libfsdriver does the real work. 56 */ 57 58 fsdriver_task(&sffs_dtable); 59 } 60