更改之后使用yaffs的时候,发现dfs_file定义的file中没有path这个参数
static int dfs_yfile_open(struct dfs_file *file)
{
struct dfs_filesystem *fs;
struct yaffs_obj *obj;
int fd;
int oflag;
int result;
fs = (struct dfs_filesystem *)file->data;
obj = (struct yaffs_obj *)fs->data;
oflag = file->flags;
if (oflag & O_DIRECTORY)
{
yaffs_DIR *dir;
if (oflag & O_CREAT)
{
result = yaffs_mkdir_reldir(obj, file->path, 0x777);
if (result < 0)
return yaffsfs_GetLastError();
}
/* open dir */
dir = yaffs_opendir_reldir(obj, file->path);
if (dir == RT_NULL)
return yaffsfs_GetLastError();
/* save this pointer,will used by dfs_yaffs_getdents*/
file->data = dir;
return 0;
}
/* regular file operations */
fd = yaffs_open_reldir(obj, file->path, oflag, S_IREAD | S_IWRITE);
if (fd < 0)
return yaffsfs_GetLastError();
file->data = (void *)fd;
file->pos = yaffs_lseek(fd, 0, SEEK_CUR);
file->size = yaffs_lseek(fd, 0, SEEK_END);
yaffs_lseek(fd, file->pos, SEEK_SET);
if (oflag & O_APPEND)
{
file->pos = file->size;
file->size = yaffs_lseek(fd, 0, SEEK_END);
}
return 0;
}
其中file->path、file->size这两个参数都是没有