Major API change:
1. Introduced a cfs_offset_t type that designates file offsets. unsigned int was insufficient on several platforms with non-volatile storage that exceed the capacity of unsigned int. 2. Switched cfs_seek signature to POSIX style with a "whence" parameter.
This commit is contained in:
parent
5e038640e2
commit
3191a2568c
6 changed files with 78 additions and 44 deletions
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: cfs-posix.c,v 1.12 2008/11/24 10:56:55 nvt-se Exp $
|
||||
* $Id: cfs-posix.c,v 1.13 2009/02/27 14:25:38 nvt-se Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -84,10 +84,19 @@ cfs_write(int f, const void *b, unsigned int l)
|
|||
return write(f, b, l);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned int
|
||||
cfs_seek(int f, unsigned int o)
|
||||
cfs_offset_t
|
||||
cfs_seek(int f, unsigned int o, int w)
|
||||
{
|
||||
return lseek(f, o, SEEK_SET);
|
||||
if(w == CFS_SEEK_SET) {
|
||||
w = SEEK_SET;
|
||||
} else if(w == CFS_SEEK_CUR) {
|
||||
w = SEEK_CUR;
|
||||
} else if(w == CFS_SEEK_END) {
|
||||
w = SEEK_END;
|
||||
} else {
|
||||
return (cfs_offset_t)-1;
|
||||
}
|
||||
return lseek(f, o, w);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue