X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=c6eb37bebe3f6708787c6387c4fd0eac83cdfc24;hp=a0961904ef1def831117843b58edb0767587d0c1;hb=3eeb7039cdf6bfef271c20ea3e579a120af5e251;hpb=f77aa1fad3df8da19d74365c44b31ec95491aed9 diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index a096190..c6eb37b 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -24,7 +24,7 @@ #endif -const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.24 2008-11-11 01:47:46 charles Exp $"; +const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.27 2009-10-08 01:57:59 charles Exp $"; // configurationList is the list of devices that are supported static yaffsfs_DeviceConfiguration *yaffsfs_configurationList; @@ -587,7 +587,7 @@ int yaffs_open(const YCHAR *path, int oflag, int mode) return handle; } -int yaffs_flush(int fd) +int yaffs_Dofsync(int fd,int datasync) { yaffsfs_Handle *h = NULL; int retVal = 0; @@ -599,7 +599,7 @@ int yaffs_flush(int fd) if(h && h->inUse) { // flush the file - yaffs_FlushFile(h->obj,1); + yaffs_FlushFile(h->obj,1,datasync); } else { @@ -613,6 +613,20 @@ int yaffs_flush(int fd) return retVal; } +int yaffs_fsync(int fd) +{ + return yaffs_Dofsync(fd,0); +} + +int yaffs_flush(int fd) +{ + return yaffs_fsync(fd); +} + +int yaffs_fdatasync(int fd) +{ + return yaffs_Dofsync(fd,1); +} int yaffs_close(int fd) { @@ -626,11 +640,11 @@ int yaffs_close(int fd) if(h && h->inUse) { // clean up - yaffs_FlushFile(h->obj,1); + yaffs_FlushFile(h->obj,1,0); h->obj->inUse--; if(h->obj->inUse <= 0 && h->obj->unlinked) { - yaffs_DeleteFile(h->obj); + yaffs_DeleteObject(h->obj); } yaffsfs_PutHandle(fd); retVal = 0; @@ -1265,7 +1279,7 @@ int yaffs_set_wince_times(int fd, } obj->dirty = 1; - result = yaffs_FlushFile(obj,0); + result = yaffs_FlushFile(obj,0,0); retVal = 0; } else @@ -1295,7 +1309,7 @@ static int yaffsfs_DoChMod(yaffs_Object *obj,mode_t mode) { obj->yst_mode = mode; obj->dirty = 1; - result = yaffs_FlushFile(obj,0); + result = yaffs_FlushFile(obj,0,0); } return result == YAFFS_OK ? 0 : -1; @@ -1849,14 +1863,19 @@ int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath) yaffsfs_Lock(); parent = yaffsfs_FindDirectory(NULL,newpath,&name,0); - obj = yaffs_MknodSymLink(parent,name,mode,0,0,oldpath); - if(obj) - { - retVal = 0; - } - else - { - yaffsfs_SetError(-ENOSPC); // just assume no space for now + if(parent){ + obj = yaffs_MknodSymLink(parent,name,mode,0,0,oldpath); + if(obj) + { + retVal = 0; + } + else + { + yaffsfs_SetError(-ENOSPC); // just assume no space for now + retVal = -1; + } + } else { + yaffsfs_SetError(-EINVAL); retVal = -1; } @@ -1957,7 +1976,10 @@ int yaffs_link(const YCHAR *oldpath, const YCHAR *newpath) return retVal; } -int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev); +int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev) +{ + return -1; +} int yaffs_DumpDevStruct(const YCHAR *path) {