yaffs_Object *obj = NULL;
yaffs_Object *existingTarget = NULL;
int force = 0;
- int result;
- yaffs_Device *dev;
if (!oldDir || oldDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
if (!newDir || newDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
YBUG();
- dev = oldDir->myDev;
-
#ifdef CONFIG_YAFFS_CASE_INSENSITIVE
/* Special case for case insemsitive systems (eg. WinCE).
* While look-up is case insensitive, the name isn't.
force = 1;
#endif
- if(yaffs_strlen(newName) > YAFFS_MAX_NAME_LENGTH)
+ else if (yaffs_strlen(newName) > YAFFS_MAX_NAME_LENGTH)
/* ENAMETOOLONG */
return YAFFS_FAIL;
return YAFFS_FAIL; /* EEXIST or ENOTEMPTY */
} else if (existingTarget && existingTarget != obj) {
/* Nuke the target first, using shadowing,
- * but only if it isn't the same object.
- *
- * Note we must disable gc otherwise it can mess up the shadowing.
- *
+ * but only if it isn't the same object
*/
- dev->isDoingGC=1;
yaffs_ChangeObjectName(obj, newDir, newName, force,
existingTarget->objectId);
- existingTarget->isShadowed = 1;
yaffs_UnlinkObject(existingTarget);
- dev->isDoingGC=0;
}
-
- result = yaffs_ChangeObjectName(obj, newDir, newName, 1, 0);
-
yaffs_UpdateParent(oldDir);
if(newDir != oldDir)
yaffs_UpdateParent(newDir);
- return result;
+ return yaffs_ChangeObjectName(obj, newDir, newName, 1, 0);
}
return YAFFS_FAIL;
}
if (tags.chunkId == 0) {
/* It is an object Id,
* We need to nuke the shrinkheader flags first
- * Also need to clean up shadowing.
* We no longer want the shrinkHeader flag since its work is done
* and if it is left in place it will mess up scanning.
*/
oh = (yaffs_ObjectHeader *)buffer;
oh->isShrink = 0;
tags.extraIsShrinkHeader = 0;
- oh->shadowsObject = 0;
- oh->inbandShadowsObject = 0;
- tags.extraShadows = 0;
yaffs_VerifyObjectHeader(object, oh, &tags, 1);
}
}
- /* Write a new object header to reflect the resize.
+ /* Write a new object header.
* show we've shrunk the file, if need be
- * Do this only if the file is not in the deleted directories
- * and is not shadowed.
+ * Do this only if the file is not in the deleted directories.
*/
if (in->parent &&
- !in->isShadowed &&
in->parent->objectId != YAFFS_OBJECTID_UNLINKED &&
in->parent->objectId != YAFFS_OBJECTID_DELETED)
yaffs_UpdateObjectHeader(in, NULL, 0,
/* Handle YAFFS2 case (backward scanning)
* If the shadowed object exists then ignore.
*/
- obj = yaffs_FindObjectByNumber(dev, objId);
- if(obj)
+ if (yaffs_FindObjectByNumber(dev, objId))
return;
}
YAFFS_OBJECT_TYPE_FILE);
if (!obj)
return;
- obj->isShadowed = 1;
yaffs_AddObjectToDirectory(dev->unlinkedDir, obj);
obj->variant.fileVariant.shrinkSize = 0;
obj->valid = 1; /* So that we don't read any other info for this file */