switched all users of cfs_seek(x,y) to cfs_seek(x,y,CFS_SEEK_SET)
This commit is contained in:
parent
3191a2568c
commit
a0226e2418
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop-tmp.c,v 1.4 2007/03/18 13:15:01 ksb Exp $
|
* @(#)$Id: codeprop-tmp.c,v 1.5 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esb
|
/** \addtogroup esb
|
||||||
|
@ -213,7 +213,7 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
len = s.len - s.addr;
|
len = s.len - s.addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfs_seek(fd, s.addr);
|
cfs_seek(fd, s.addr, CFS_SEEK_SET);
|
||||||
cfs_read(fd, &uh->data[0], len);
|
cfs_read(fd, &uh->data[0], len);
|
||||||
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
&uh->data[0], len);*/
|
&uh->data[0], len);*/
|
||||||
|
@ -320,7 +320,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
/* eeprom_write(EEPROMFS_ADDR_CODEPROP + s.addr,
|
/* eeprom_write(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
&uh->data[0], len);*/
|
&uh->data[0], len);*/
|
||||||
cfs_seek(fd, s.addr);
|
cfs_seek(fd, s.addr, CFS_SEEK_SET);
|
||||||
cfs_write(fd, &uh->data[0], len);
|
cfs_write(fd, &uh->data[0], len);
|
||||||
|
|
||||||
/* beep();*/
|
/* beep();*/
|
||||||
|
@ -406,7 +406,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
/* eeprom_write(EEPROMFS_ADDR_CODEPROP + s.addr,
|
/* eeprom_write(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
uip_appdata,
|
uip_appdata,
|
||||||
uip_datalen());*/
|
uip_datalen());*/
|
||||||
cfs_seek(fd, s.addr);
|
cfs_seek(fd, s.addr, CFS_SEEK_SET);
|
||||||
cfs_write(fd, uip_appdata, uip_datalen());
|
cfs_write(fd, uip_appdata, uip_datalen());
|
||||||
s.addr += datalen;
|
s.addr += datalen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: deluge.c,v 1.2 2009/02/26 14:55:29 nvt-se Exp $
|
* $Id: deluge.c,v 1.3 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,7 +134,7 @@ transition(int state)
|
||||||
static int
|
static int
|
||||||
write_page(struct deluge_object *obj, unsigned pagenum, unsigned char *data)
|
write_page(struct deluge_object *obj, unsigned pagenum, unsigned char *data)
|
||||||
{
|
{
|
||||||
cfs_seek(obj->cfs_fd, pagenum * S_PAGE);
|
cfs_seek(obj->cfs_fd, pagenum * S_PAGE, CFS_SEEK_SET);
|
||||||
return cfs_write(obj->cfs_fd, (char *)data,
|
return cfs_write(obj->cfs_fd, (char *)data,
|
||||||
S_PAGE);
|
S_PAGE);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ write_page(struct deluge_object *obj, unsigned pagenum, unsigned char *data)
|
||||||
static int
|
static int
|
||||||
read_page(struct deluge_object *obj, unsigned pagenum, unsigned char *buf)
|
read_page(struct deluge_object *obj, unsigned pagenum, unsigned char *buf)
|
||||||
{
|
{
|
||||||
cfs_seek(obj->cfs_fd, pagenum * S_PAGE);
|
cfs_seek(obj->cfs_fd, pagenum * S_PAGE, CFS_SEEK_SET);
|
||||||
return cfs_read(obj->cfs_fd, (char *)buf, S_PAGE);
|
return cfs_read(obj->cfs_fd, (char *)buf, S_PAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: shell-file.c,v 1.9 2009/02/19 22:56:56 adamdunkels Exp $
|
* $Id: shell-file.c,v 1.10 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,7 +220,7 @@ PROCESS_THREAD(shell_read_process, ev, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = cfs_open(filename, CFS_READ);
|
fd = cfs_open(filename, CFS_READ);
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
|
|
||||||
if(fd < 0) {
|
if(fd < 0) {
|
||||||
shell_output_str(&read_command,
|
shell_output_str(&read_command,
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: shell-netfile.c,v 1.7 2009/02/24 21:27:43 adamdunkels Exp $
|
* $Id: shell-netfile.c,v 1.8 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,7 +111,7 @@ read_chunk(struct rudolph0_conn *c, int offset, uint8_t *to, int maxsize)
|
||||||
|
|
||||||
fd = cfs_open(filename, CFS_READ);
|
fd = cfs_open(filename, CFS_READ);
|
||||||
|
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_read(fd, to, maxsize);
|
ret = cfs_read(fd, to, maxsize);
|
||||||
/* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/
|
/* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/
|
||||||
cfs_close(fd);
|
cfs_close(fd);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: elfloader-avr.c,v 1.5 2007/11/16 09:16:31 fros4943 Exp $
|
* @(#)$Id: elfloader-avr.c,v 1.6 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -114,7 +114,7 @@ elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char
|
||||||
|
|
||||||
// Seek to patched module and burn it to flash (in chunks of
|
// Seek to patched module and burn it to flash (in chunks of
|
||||||
// size SPM_PAGESIZE, i.e. 256 bytes on the ATmega128)
|
// size SPM_PAGESIZE, i.e. 256 bytes on the ATmega128)
|
||||||
cfs_seek(fd, textoff);
|
cfs_seek(fd, textoff, CFS_SEEK_SET);
|
||||||
for (flashptr=mem; flashptr < mem + size; flashptr += SPM_PAGESIZE) {
|
for (flashptr=mem; flashptr < mem + size; flashptr += SPM_PAGESIZE) {
|
||||||
memset (buf, 0, SPM_PAGESIZE);
|
memset (buf, 0, SPM_PAGESIZE);
|
||||||
cfs_read(fd, buf, SPM_PAGESIZE);
|
cfs_read(fd, buf, SPM_PAGESIZE);
|
||||||
|
@ -169,9 +169,9 @@ elfloader_arch_relocate(int fd, unsigned int sectionoffset,
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
unsigned char instr[4];
|
unsigned char instr[4];
|
||||||
|
|
||||||
cfs_seek(fd, sectionoffset + rela->r_offset);
|
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
|
||||||
cfs_read(fd, instr, 4);
|
cfs_read(fd, instr, 4);
|
||||||
cfs_seek(fd, sectionoffset + rela->r_offset);
|
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
|
||||||
|
|
||||||
type = ELF32_R_TYPE(rela->r_info);
|
type = ELF32_R_TYPE(rela->r_info);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: elfloader-msp430.c,v 1.3 2009/01/15 09:04:55 fros4943 Exp $
|
* @(#)$Id: elfloader-msp430.c,v 1.4 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
#include "elfloader-arch.h"
|
#include "elfloader-arch.h"
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char
|
||||||
|
|
||||||
flashptr = (unsigned short *)mem;
|
flashptr = (unsigned short *)mem;
|
||||||
|
|
||||||
cfs_seek(fd, textoff);
|
cfs_seek(fd, textoff, CFS_SEEK_SET);
|
||||||
for(ptr = 0; ptr < size; ptr += READSIZE) {
|
for(ptr = 0; ptr < size; ptr += READSIZE) {
|
||||||
|
|
||||||
/* Read data from file into RAM. */
|
/* Read data from file into RAM. */
|
||||||
|
@ -97,7 +97,7 @@ elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char
|
||||||
|
|
||||||
flash_done();
|
flash_done();
|
||||||
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
|
#else /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||||
cfs_seek(fd, textoff);
|
cfs_seek(fd, textoff, CFS_SEEK_SET);
|
||||||
cfs_read(fd, (unsigned char *)mem, size);
|
cfs_read(fd, (unsigned char *)mem, size);
|
||||||
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
|
#endif /* ELFLOADER_CONF_TEXT_IN_ROM */
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ elfloader_arch_relocate(int fd, unsigned int sectionoffset,
|
||||||
{
|
{
|
||||||
addr += rela->r_addend;
|
addr += rela->r_addend;
|
||||||
|
|
||||||
cfs_seek(fd, sectionoffset + rela->r_offset);
|
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
|
||||||
cfs_write(fd, (char *)&addr, 2);
|
cfs_write(fd, (char *)&addr, 2);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: elfloader-x86.c,v 1.2 2006/12/18 14:54:04 fros4943 Exp $
|
* @(#)$Id: elfloader-x86.c,v 1.3 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
#include "elfloader-arch.h"
|
#include "elfloader-arch.h"
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
@ -69,7 +69,7 @@ elfloader_arch_allocate_rom(int size)
|
||||||
void
|
void
|
||||||
elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char *mem)
|
elfloader_arch_write_rom(int fd, unsigned short textoff, unsigned int size, char *mem)
|
||||||
{
|
{
|
||||||
cfs_seek(fd, textoff);
|
cfs_seek(fd, textoff, CFS_SEEK_SET);
|
||||||
cfs_read(fd, (unsigned char *)mem, size);
|
cfs_read(fd, (unsigned char *)mem, size);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -97,7 +97,7 @@ elfloader_arch_relocate(int fd, unsigned int sectionoffset, char *sectionaddress
|
||||||
case R_386_32:
|
case R_386_32:
|
||||||
addr += rela->r_addend; /* +A */
|
addr += rela->r_addend; /* +A */
|
||||||
|
|
||||||
cfs_seek(fd, sectionoffset + rela->r_offset);
|
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
|
||||||
cfs_write(fd, (char *)&addr, 4);
|
cfs_write(fd, (char *)&addr, 4);
|
||||||
/*printf("elfloader-x86.c: performed relocation type S + A (%d)\n", type);*/
|
/*printf("elfloader-x86.c: performed relocation type S + A (%d)\n", type);*/
|
||||||
break;
|
break;
|
||||||
|
@ -105,7 +105,7 @@ elfloader_arch_relocate(int fd, unsigned int sectionoffset, char *sectionaddress
|
||||||
addr -= (sectionaddress + rela->r_offset); /* -P */
|
addr -= (sectionaddress + rela->r_offset); /* -P */
|
||||||
addr += rela->r_addend; /* +A */
|
addr += rela->r_addend; /* +A */
|
||||||
|
|
||||||
cfs_seek(fd, sectionoffset + rela->r_offset);
|
cfs_seek(fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
|
||||||
cfs_write(fd, (char *)&addr, 4);
|
cfs_write(fd, (char *)&addr, 4);
|
||||||
/*printf("elfloader-x86.c: performed relocation type S + A - P (%d)\n", type);*/
|
/*printf("elfloader-x86.c: performed relocation type S + A - P (%d)\n", type);*/
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: elfloader.c,v 1.9 2008/07/09 20:56:25 adamdunkels Exp $
|
* @(#)$Id: elfloader.c,v 1.10 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -149,7 +149,7 @@ static const unsigned char elf_magic_header[] =
|
||||||
static void
|
static void
|
||||||
seek_read(int fd, unsigned int offset, char *buf, int len)
|
seek_read(int fd, unsigned int offset, char *buf, int len)
|
||||||
{
|
{
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
cfs_read(fd, buf, len);
|
cfs_read(fd, buf, len);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
{
|
{
|
||||||
|
@ -168,7 +168,7 @@ seek_read(int fd, unsigned int offset, char *buf, int len)
|
||||||
static void
|
static void
|
||||||
seek_write(int fd, unsigned int offset, char *buf, int len)
|
seek_write(int fd, unsigned int offset, char *buf, int len)
|
||||||
{
|
{
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
cfs_write(fd, buf, len);
|
cfs_write(fd, buf, len);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,7 +29,7 @@ elfloader_arch_relocate(int input_fd,
|
||||||
|
|
||||||
type = ELF32_R_TYPE(rela->r_info);
|
type = ELF32_R_TYPE(rela->r_info);
|
||||||
|
|
||||||
cfs_seek(input_fd, sectionoffset + rela->r_offset);
|
cfs_seek(input_fd, sectionoffset + rela->r_offset, CFS_SEEK_SET);
|
||||||
|
|
||||||
/* PRINTF("elfloader_arch_relocate: type %d\n", type); */
|
/* PRINTF("elfloader_arch_relocate: type %d\n", type); */
|
||||||
/* PRINTF("Addr: %p, Addend: %ld\n", addr, rela->r_addend); */
|
/* PRINTF("Addr: %p, Addend: %ld\n", addr, rela->r_addend); */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: codeprop-otf.c,v 1.2 2007/03/18 13:15:02 ksb Exp $
|
* @(#)$Id: codeprop-otf.c,v 1.3 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \addtogroup esb
|
/** \addtogroup esb
|
||||||
|
@ -215,7 +215,7 @@ send_udpdata(struct codeprop_udphdr *uh)
|
||||||
len = s.len - s.addr;
|
len = s.len - s.addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfs_seek(fd, s.addr);
|
cfs_seek(fd, s.addr, CFS_SEEK_SET);
|
||||||
cfs_read(fd, (char*)&uh->data[0], len);
|
cfs_read(fd, (char*)&uh->data[0], len);
|
||||||
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
/* eeprom_read(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
&uh->data[0], len);*/
|
&uh->data[0], len);*/
|
||||||
|
@ -322,7 +322,7 @@ PT_THREAD(recv_udpthread(struct pt *pt))
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
/* eeprom_write(EEPROMFS_ADDR_CODEPROP + s.addr,
|
/* eeprom_write(EEPROMFS_ADDR_CODEPROP + s.addr,
|
||||||
&uh->data[0], len);*/
|
&uh->data[0], len);*/
|
||||||
cfs_seek(fd, s.addr);
|
cfs_seek(fd, s.addr, CFS_SEEK_SET);
|
||||||
cfs_write(fd, (char*)&uh->data[0], len);
|
cfs_write(fd, (char*)&uh->data[0], len);
|
||||||
|
|
||||||
/* beep();*/
|
/* beep();*/
|
||||||
|
@ -405,7 +405,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
if(datalen > 0) {
|
if(datalen > 0) {
|
||||||
/* printf("Got %d bytes\n", datalen); */
|
/* printf("Got %d bytes\n", datalen); */
|
||||||
|
|
||||||
if (cfs_seek(fd, s.addr) != s.addr) {
|
if (cfs_seek(fd, s.addr, CFS_SEEK_SET) != s.addr) {
|
||||||
PRINTF(("codeprop: seek in buffer file failed\n"));
|
PRINTF(("codeprop: seek in buffer file failed\n"));
|
||||||
uip_abort();
|
uip_abort();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: elfloader-otf.c,v 1.1 2007/03/07 16:07:26 ksb Exp $
|
* @(#)$Id: elfloader-otf.c,v 1.2 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
@ -152,7 +152,7 @@ copy_segment_data(int input_fd, unsigned int offset,
|
||||||
{
|
{
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
int res;
|
int res;
|
||||||
if (cfs_seek(input_fd, offset) != offset) return ELFLOADER_INPUT_ERROR;
|
if (cfs_seek(input_fd, offset, CFS_SEEK_SET) != offset) return ELFLOADER_INPUT_ERROR;
|
||||||
while(len > sizeof(buffer)) {
|
while(len > sizeof(buffer)) {
|
||||||
res = cfs_read(input_fd, buffer, sizeof(buffer));
|
res = cfs_read(input_fd, buffer, sizeof(buffer));
|
||||||
if (res != sizeof(buffer)) return ELFLOADER_INPUT_ERROR;
|
if (res != sizeof(buffer)) return ELFLOADER_INPUT_ERROR;
|
||||||
|
@ -170,7 +170,7 @@ copy_segment_data(int input_fd, unsigned int offset,
|
||||||
static int
|
static int
|
||||||
seek_read(int fd, unsigned int offset, char *buf, int len)
|
seek_read(int fd, unsigned int offset, char *buf, int len)
|
||||||
{
|
{
|
||||||
if (cfs_seek(fd, offset) != offset) return -1;
|
if (cfs_seek(fd, offset, CFS_SEEK_SET) != offset) return -1;
|
||||||
return cfs_read(fd, buf, len);
|
return cfs_read(fd, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: example-rudolph0.c,v 1.1 2008/01/25 18:00:51 adamdunkels Exp $
|
* $Id: example-rudolph0.c,v 1.2 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ write_chunk(struct rudolph0_conn *c, int offset, int flag,
|
||||||
|
|
||||||
if(datalen > 0) {
|
if(datalen > 0) {
|
||||||
int ret;
|
int ret;
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_write(fd, data, datalen);
|
ret = cfs_write(fd, data, datalen);
|
||||||
/* printf("write_chunk wrote %d bytes at %d, %d\n", ret, offset, (unsigned char)data[0]);*/
|
/* printf("write_chunk wrote %d bytes at %d, %d\n", ret, offset, (unsigned char)data[0]);*/
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ read_chunk(struct rudolph0_conn *c, int offset, uint8_t *to, int maxsize)
|
||||||
|
|
||||||
fd = cfs_open("hej", CFS_READ);
|
fd = cfs_open("hej", CFS_READ);
|
||||||
|
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_read(fd, to, maxsize);
|
ret = cfs_read(fd, to, maxsize);
|
||||||
/* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/
|
/* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/
|
||||||
cfs_close(fd);
|
cfs_close(fd);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: example-rudolph1.c,v 1.3 2008/11/17 22:52:10 oliverschmidt Exp $
|
* $Id: example-rudolph1.c,v 1.4 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ write_chunk(struct rudolph1_conn *c, int offset, int flag,
|
||||||
|
|
||||||
if(datalen > 0) {
|
if(datalen > 0) {
|
||||||
int ret;
|
int ret;
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_write(fd, data, datalen);
|
ret = cfs_write(fd, data, datalen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ read_chunk(struct rudolph1_conn *c, int offset, uint8_t *to, int maxsize)
|
||||||
|
|
||||||
fd = cfs_open("hej", CFS_READ);
|
fd = cfs_open("hej", CFS_READ);
|
||||||
|
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_read(fd, to, maxsize);
|
ret = cfs_read(fd, to, maxsize);
|
||||||
/* printf("%d.%d: read_chunk %d bytes at %d, %d\n",
|
/* printf("%d.%d: read_chunk %d bytes at %d, %d\n",
|
||||||
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: example-rudolph2.c,v 1.2 2008/11/17 22:52:10 oliverschmidt Exp $
|
* $Id: example-rudolph2.c,v 1.3 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,7 @@ write_chunk(struct rudolph2_conn *c, int offset, int flag,
|
||||||
|
|
||||||
if(datalen > 0) {
|
if(datalen > 0) {
|
||||||
int ret;
|
int ret;
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_write(fd, data, datalen);
|
ret = cfs_write(fd, data, datalen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ read_chunk(struct rudolph2_conn *c, int offset, uint8_t *to, int maxsize)
|
||||||
|
|
||||||
fd = cfs_open("hej", CFS_READ);
|
fd = cfs_open("hej", CFS_READ);
|
||||||
|
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_read(fd, to, maxsize);
|
ret = cfs_read(fd, to, maxsize);
|
||||||
/* printf("%d.%d: read_chunk %d bytes at %d, %d\n",
|
/* printf("%d.%d: read_chunk %d bytes at %d, %d\n",
|
||||||
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tcprudolph0.c,v 1.11 2008/11/17 22:52:10 oliverschmidt Exp $
|
* @(#)$Id: tcprudolph0.c,v 1.12 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -132,7 +132,7 @@ PT_THREAD(recv_tcpthread(struct pt *pt))
|
||||||
leds_toggle(LEDS_RED);
|
leds_toggle(LEDS_RED);
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
s.fd = cfs_open("codeprop.out", CFS_WRITE + CFS_APPEND);
|
s.fd = cfs_open("codeprop.out", CFS_WRITE + CFS_APPEND);
|
||||||
cfs_seek(s.fd, s.addr);
|
cfs_seek(s.fd, s.addr, CFS_SEEK_SET);
|
||||||
/* xmem_pwrite(uip_appdata, uip_len, EEPROMFS_ADDR_CODEPROP + s.addr);*/
|
/* xmem_pwrite(uip_appdata, uip_len, EEPROMFS_ADDR_CODEPROP + s.addr);*/
|
||||||
cfs_write(s.fd, uip_appdata, uip_len);
|
cfs_write(s.fd, uip_appdata, uip_len);
|
||||||
cfs_close(s.fd);
|
cfs_close(s.fd);
|
||||||
|
@ -220,7 +220,7 @@ write_chunk(struct rudolph0_conn *c, int offset, int flag,
|
||||||
|
|
||||||
if(datalen > 0) {
|
if(datalen > 0) {
|
||||||
int ret;
|
int ret;
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_write(fd, data, datalen);
|
ret = cfs_write(fd, data, datalen);
|
||||||
/* printf("write_chunk wrote %d bytes at %d, %d\n", ret, offset, (unsigned char)data[0]);*/
|
/* printf("write_chunk wrote %d bytes at %d, %d\n", ret, offset, (unsigned char)data[0]);*/
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ read_chunk(struct rudolph0_conn *c, int offset, uint8_t *to, int maxsize)
|
||||||
|
|
||||||
fd = cfs_open("codeprop.out", CFS_READ);
|
fd = cfs_open("codeprop.out", CFS_READ);
|
||||||
|
|
||||||
cfs_seek(fd, offset);
|
cfs_seek(fd, offset, CFS_SEEK_SET);
|
||||||
ret = cfs_read(fd, to, maxsize);
|
ret = cfs_read(fd, to, maxsize);
|
||||||
/* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/
|
/* printf("read_chunk %d bytes at %d, %d\n", ret, offset, (unsigned char)to[0]);*/
|
||||||
if(ret < maxsize) {
|
if(ret < maxsize) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: test-coffee.c,v 1.8 2009/02/22 15:17:36 nvt-se Exp $
|
* $Id: test-coffee.c,v 1.9 2009/02/27 14:28:02 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +151,7 @@ coffee_file_test(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test 9: Seek to beginning. */
|
/* Test 9: Seek to beginning. */
|
||||||
if(cfs_seek(wfd, 0) != 0) {
|
if(cfs_seek(wfd, 0, CFS_SEEK_SET) != 0) {
|
||||||
FAIL(-11);
|
FAIL(-11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ coffee_file_test(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test 11: Read the data from the log. */
|
/* Test 11: Read the data from the log. */
|
||||||
cfs_seek(rfd, 0);
|
cfs_seek(rfd, 0, CFS_SEEK_SET);
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
r = cfs_read(rfd, buf, sizeof(buf));
|
r = cfs_read(rfd, buf, sizeof(buf));
|
||||||
if(r < 0) {
|
if(r < 0) {
|
||||||
|
@ -184,7 +184,7 @@ coffee_file_test(void)
|
||||||
for(r = 0; r < sizeof(buf); r++) {
|
for(r = 0; r < sizeof(buf); r++) {
|
||||||
buf[r] = sizeof(buf) - r - 1;
|
buf[r] = sizeof(buf) - r - 1;
|
||||||
}
|
}
|
||||||
if(cfs_seek(wfd, 0) != 0) {
|
if(cfs_seek(wfd, 0, CFS_SEEK_SET) != 0) {
|
||||||
FAIL(-17);
|
FAIL(-17);
|
||||||
}
|
}
|
||||||
r = cfs_write(wfd, buf, sizeof(buf));
|
r = cfs_write(wfd, buf, sizeof(buf));
|
||||||
|
@ -193,12 +193,12 @@ coffee_file_test(void)
|
||||||
} else if(r < sizeof(buf)) {
|
} else if(r < sizeof(buf)) {
|
||||||
FAIL(-19);
|
FAIL(-19);
|
||||||
}
|
}
|
||||||
if(cfs_seek(rfd, 0) != 0) {
|
if(cfs_seek(rfd, 0, CFS_SEEK_SET) != 0) {
|
||||||
FAIL(-20);
|
FAIL(-20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test 14: Read the reversed buffer. */
|
/* Test 14: Read the reversed buffer. */
|
||||||
cfs_seek(rfd, 0);
|
cfs_seek(rfd, 0, CFS_SEEK_SET);
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
r = cfs_read(rfd, buf, sizeof(buf));
|
r = cfs_read(rfd, buf, sizeof(buf));
|
||||||
if(r < 0) {
|
if(r < 0) {
|
||||||
|
@ -235,7 +235,7 @@ coffee_file_test(void)
|
||||||
buf[r] = r;
|
buf[r] = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cfs_seek(wfd, offset) != offset) {
|
if(cfs_seek(wfd, offset, CFS_SEEK_SET) != offset) {
|
||||||
FAIL(-26);
|
FAIL(-26);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ coffee_file_test(void)
|
||||||
FAIL(-27);
|
FAIL(-27);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cfs_seek(wfd, offset) != offset) {
|
if(cfs_seek(wfd, offset, CFS_SEEK_SET) != offset) {
|
||||||
FAIL(-28);
|
FAIL(-28);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue