#ifndef SERVER_H #define SERVER_H #include #include #include #include #include "net.h" #include "vars.h" #include "hashtable.h" #define TIMEOUT 5 //seconds MODULE_LICENSE("GPL"); MODULE_AUTHOR("Michael R. Hines, mhines@cs.fsu.edu"); MODULE_DESCRIPTION("Anemone Memory Server"); static timeval start, end, diff; kmem_cache_t *block_cache; struct timer_list soft_timer; struct timer_list broadcast_timer; struct timer_list session_timer; static ulong percent = 95, num_blocks = 0, reads = 0, writes = 0; HashTable table; LIST_HEAD(messages); static LIST_HEAD(session_list); extern unsigned long totalram_pages; extern unsigned long nr_free_pages(void); /* * This block is a wrapper to a real page * used to identify blocks local only to the * memory server. */ typedef struct Block { PageKey key; struct page * page; } Block; typedef struct Session Session; struct Session{ u8 mac[ETH_ALEN]; ulong sessionid; timeval timestamp; struct list_head queue; }; module_param(plog, int, 0); module_param(hash_size, int, 0); module_param(percent, ulong, 0); MODULE_PARM_DESC(plog, "To packet logging and timing. values: 1 for yes, 0 for no, default: no"); MODULE_PARM_DESC(hash_size, "Specify how many buckets in the engine/server's hashtable. Default: 2048"); MODULE_PARM_DESC(percent, "Default: 100 ; Upper limit on local memory contribution to cluster."); #define PROCNAME "sinfo" #define PROCNAME2 "sdebug" #define PROCNAME3 "squery" //procfile funtions int anemone_server_recv(sk_buff *); int server_report(char *, char **, off_t, int, int *, void *); int toggle_logging(struct file*, const char*, ulong, void*); int toggle_debug(struct file*, const char*, ulong, void*); int query_block(struct file *, const char*, ulong, void*); /* Server functions */ void mem_print(void); sk_buff * page_in(Message *, PageKey *, sk_buff *); sk_buff * page_out(Message *, PageKey *, sk_buff *); /* Initialize and Cleanup functions */ int server_init(void); void proc_init(void); int mem_initialize(void); void server_cleanup(void); void mem_cleanup(void); void broadcast_status(void); void broadcast_timeout(ulong); void session_timeout(ulong); void fill_status_info(Message*); void update_session_status(u8*, ulong); void delete_session(u8*); static char report_data[1000]; struct proc_dir_entry * aprocfile = NULL; struct proc_dir_entry * aprocfile2 = NULL; struct proc_dir_entry * aprocfile3 = NULL; #endif