+ return yaffsfs_DoStatOrLStat_reldir(ROOT_DIR(dev), path, buf, 0);
+}
+
+int yaffs_lstat_reldev(struct yaffs_dev *dev, const YCHAR *path,
+ struct yaffs_stat *buf)
+{
+ return yaffsfs_DoStatOrLStat_reldir(ROOT_DIR(dev), path, buf, 1);
+}
+
+int yaffs_stat(const YCHAR *path, struct yaffs_stat *buf)
+{
+ return yaffs_stat_reldir(NULL, path, buf);
+}
+
+int yaffs_lstat(const YCHAR *path, struct yaffs_stat *buf)
+{
+ return yaffs_lstat_reldir(NULL, path, buf);
+}
+
+int yaffs_fstat(int fd, struct yaffs_stat *buf)
+{
+ struct yaffs_obj *obj;
+
+ int retVal = -1;
+
+ if (yaffsfs_CheckMemRegion(buf, sizeof(*buf), 1) < 0) {
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
+ yaffsfs_Lock();
+ obj = yaffsfs_HandleToObject(fd);
+
+ if (obj)
+ retVal = yaffsfs_DoStat(obj, buf);
+ else
+ /* bad handle */
+ yaffsfs_SetError(-EBADF);
+
+ yaffsfs_Unlock();
+
+ return retVal;
+}
+
+static int yaffsfs_DoUtime(struct yaffs_obj *obj,
+ const struct yaffs_utimbuf *buf)
+{
+ int retVal = -1;
+ struct yaffs_utimbuf local;
+
+ obj = yaffs_get_equivalent_obj(obj);
+
+ if (obj && obj->my_dev->read_only) {
+ yaffsfs_SetError(-EROFS);
+ return -1;
+ }
+
+#if !CONFIG_YAFFS_WINCE
+ if (!buf) {
+ local.actime = Y_CURRENT_TIME;
+ local.modtime = local.actime;
+ buf = &local;
+ }
+
+ if (obj) {
+ int result;
+
+ obj->yst_atime = buf->actime;
+ obj->yst_mtime = buf->modtime;
+ obj->dirty = 1;
+ result = yaffs_flush_file(obj, 0, 0, 0);
+ retVal = result == YAFFS_OK ? 0 : -1;
+ }
+#endif
+
+ return retVal;
+}
+
+int yaffs_utime_reldir(struct yaffs_obj *reldir, const YCHAR *path,
+ const struct yaffs_utimbuf *buf)
+{
+ struct yaffs_obj *obj = NULL;
+ struct yaffs_obj *dir = NULL;
+ int retVal = -1;
+ int notDir = 0;
+ int loop = 0;
+
+ if (!path) {
+ yaffsfs_SetError(-EFAULT);
+ return -1;
+ }
+
+ if (yaffsfs_CheckPath(path) < 0) {
+ yaffsfs_SetError(-ENAMETOOLONG);
+ return -1;
+ }