From e4086d837469f42e4aefe88dc64431f4b10acf3f Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Fri, 21 Dec 2007 01:04:29 +0000 Subject: [PATCH] Use cfs filesystem to allow for specific implementations (and make use of fastcall). --- cpu/6502/lib/config.c | 17 ++++++++--------- cpu/6502/lib/config.h | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cpu/6502/lib/config.c b/cpu/6502/lib/config.c index 93caf03c6..2e99ec510 100644 --- a/cpu/6502/lib/config.c +++ b/cpu/6502/lib/config.c @@ -30,22 +30,21 @@ * * Author: Oliver Schmidt * - * $Id: config.c,v 1.4 2007/12/20 20:49:59 oliverschmidt Exp $ + * $Id: config.c,v 1.5 2007/12/21 01:04:29 oliverschmidt Exp $ */ -#include -#include #include #include #include "contiki-net.h" +#include "cfs/cfs.h" #include "sys/log.h" #include "lib/error.h" #include "net/ethernet-drv.h" /*-----------------------------------------------------------------------------------*/ #if LOG_CONF_ENABLED -static char * +static char * CC_FASTCALL ipaddrtoa(uip_ipaddr_t *ipaddr, char *buffer) { char *ptr = buffer; @@ -61,7 +60,7 @@ ipaddrtoa(uip_ipaddr_t *ipaddr, char *buffer) } #endif /* LOG_CONF_ENABLED */ /*-----------------------------------------------------------------------------------*/ -struct ethernet_config * +struct ethernet_config * CC_FASTCALL config_read(char *filename) { static struct { @@ -73,19 +72,19 @@ config_read(char *filename) } config; int file; - file = open(filename, O_RDONLY); + file = cfs_open(filename, CFS_READ); if(file < 0) { log_message(filename, ": File not found"); error_exit(); } - if(read(file, &config, sizeof(config)) < sizeof(config) - - sizeof(config.ethernetcfg.name)) { + if(cfs_read(file, &config, sizeof(config)) < sizeof(config) + - sizeof(config.ethernetcfg.name)) { log_message(filename, ": No config file"); error_exit(); } - close(file); + cfs_close(file); log_message("IP Address: ", ipaddrtoa(&config.hostaddr, uip_buf)); log_message("Subnet Mask: ", ipaddrtoa(&config.netmask, uip_buf)); diff --git a/cpu/6502/lib/config.h b/cpu/6502/lib/config.h index ebd42cb2c..122a376eb 100644 --- a/cpu/6502/lib/config.h +++ b/cpu/6502/lib/config.h @@ -30,12 +30,12 @@ * * Author: Oliver Schmidt * - * $Id: config.h,v 1.1 2007/11/27 21:42:02 oliverschmidt Exp $ + * $Id: config.h,v 1.2 2007/12/21 01:04:29 oliverschmidt Exp $ */ #ifndef __CONFIG_H__ #define __CONFIG_H__ -struct ethernet_config *config_read(char *filename); +struct ethernet_config * CC_FASTCALL config_read(char *filename); #endif /* __CONFIG_H__ */