* cfs_opendir in Coffee now accepts any name.

* refer to the documentation of each whence parameter. Old documentation didn't   consider negative movements either.
This commit is contained in:
nvt-se 2009-02-28 13:40:25 +00:00
parent bc3d9d2e3c
commit 63b89a67fe
2 changed files with 9 additions and 11 deletions

View file

@ -1132,13 +1132,12 @@ cfs_write(int fd, const void *buf, unsigned size)
int int
cfs_opendir(struct cfs_dir *dir, const char *name) cfs_opendir(struct cfs_dir *dir, const char *name)
{ {
/* We have only a root directory. */ /*
if((name[0] == '/' || name[0] == '.') && name[1] == '\0') { * Coffee is only guaranteed to support "/" and ".", but it does not
* currently enforce this.
*/
*(coffee_page_t *)dir->dummy_space = 0; *(coffee_page_t *)dir->dummy_space = 0;
return 0; return 0;
}
return -1;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int

View file

@ -54,7 +54,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: cfs.h,v 1.15 2009/02/28 11:39:02 oliverschmidt Exp $ * $Id: cfs.h,v 1.16 2009/02/28 13:40:25 nvt-se Exp $
*/ */
#ifndef __CFS_H__ #ifndef __CFS_H__
#define __CFS_H__ #define __CFS_H__
@ -221,10 +221,9 @@ CCIF int cfs_write(int fd, const void *buf, unsigned int len);
* determined by the combination of the offset parameter * determined by the combination of the offset parameter
* and the whence parameter. * and the whence parameter.
* *
* If whence is CFS_SEEK_SET, the current position is set * \sa CFS_SEEK_CUR
* to the offset value. CFS_SEEK_CUR moves the position * \sa CFS_SEEK_END
* forward the number of bytes specified by offset. CFS_SEEK * \sa CFS_SEEK_SET
* end moves the position offset bytes past the end of the file.
*/ */
#ifndef cfs_seek #ifndef cfs_seek
CCIF cfs_offset_t cfs_seek(int fd, cfs_offset_t offset, int whence); CCIF cfs_offset_t cfs_seek(int fd, cfs_offset_t offset, int whence);