Lines Matching refs:obj
52 static void yaffs_UpdateParent(yaffs_Object *obj);
53 static int yaffs_UnlinkObject(yaffs_Object *obj);
54 static int yaffs_ObjectHasCachedWriteData(yaffs_Object *obj);
68 yaffs_Object *obj);
71 static void yaffs_RemoveObjectFromDirectory(yaffs_Object *obj);
83 static int yaffs_UnlinkWorker(yaffs_Object *obj);
545 static void yaffs_VerifyObjectHeader(yaffs_Object *obj, yaffs_ObjectHeader *oh, yaffs_ExtendedTags … in yaffs_VerifyObjectHeader() argument
547 if (obj && yaffs_SkipVerification(obj->myDev)) in yaffs_VerifyObjectHeader()
550 if (!(tags && obj && oh)) { in yaffs_VerifyObjectHeader()
553 (__u32)tags, (__u32)obj, (__u32)oh)); in yaffs_VerifyObjectHeader()
563 if (tags->objectId != obj->objectId) in yaffs_VerifyObjectHeader()
566 tags->objectId, obj->objectId)); in yaffs_VerifyObjectHeader()
575 if (parentCheck && tags->objectId > 1 && !obj->parent) in yaffs_VerifyObjectHeader()
580 if (parentCheck && obj->parent && in yaffs_VerifyObjectHeader()
581 oh->parentObjectId != obj->parent->objectId && in yaffs_VerifyObjectHeader()
583 obj->parent->objectId != YAFFS_OBJECTID_DELETED)) in yaffs_VerifyObjectHeader()
586 tags->objectId, oh->parentObjectId, obj->parent->objectId)); in yaffs_VerifyObjectHeader()
591 obj->objectId)); in yaffs_VerifyObjectHeader()
596 obj->objectId)); in yaffs_VerifyObjectHeader()
601 static int yaffs_VerifyTnodeWorker(yaffs_Object *obj, yaffs_Tnode *tn, in yaffs_VerifyTnodeWorker() argument
605 yaffs_Device *dev = obj->myDev; in yaffs_VerifyTnodeWorker()
613 ok = yaffs_VerifyTnodeWorker(obj, in yaffs_VerifyTnodeWorker()
621 __u32 objectId = obj->objectId; in yaffs_VerifyTnodeWorker()
647 static void yaffs_VerifyFile(yaffs_Object *obj) in yaffs_VerifyFile() argument
659 if (!obj) in yaffs_VerifyFile()
662 if (yaffs_SkipVerification(obj->myDev)) in yaffs_VerifyFile()
665 dev = obj->myDev; in yaffs_VerifyFile()
666 objectId = obj->objectId; in yaffs_VerifyFile()
669 lastChunk = obj->variant.fileVariant.fileSize / dev->nDataBytesPerChunk + 1; in yaffs_VerifyFile()
677 actualTallness = obj->variant.fileVariant.topLevel; in yaffs_VerifyFile()
682 obj->objectId, actualTallness, requiredTallness)); in yaffs_VerifyFile()
694 tn = yaffs_FindLevel0Tnode(dev, &obj->variant.fileVariant, i); in yaffs_VerifyFile()
712 static void yaffs_VerifyHardLink(yaffs_Object *obj) in yaffs_VerifyHardLink() argument
714 if (obj && yaffs_SkipVerification(obj->myDev)) in yaffs_VerifyHardLink()
720 static void yaffs_VerifySymlink(yaffs_Object *obj) in yaffs_VerifySymlink() argument
722 if (obj && yaffs_SkipVerification(obj->myDev)) in yaffs_VerifySymlink()
728 static void yaffs_VerifySpecial(yaffs_Object *obj) in yaffs_VerifySpecial() argument
730 if (obj && yaffs_SkipVerification(obj->myDev)) in yaffs_VerifySpecial()
734 static void yaffs_VerifyObject(yaffs_Object *obj) in yaffs_VerifyObject() argument
746 if (!obj) in yaffs_VerifyObject()
749 if (obj->beingCreated) in yaffs_VerifyObject()
752 dev = obj->myDev; in yaffs_VerifyObject()
762 …chunkInRange = (((unsigned)(obj->hdrChunk)) >= chunkMin && ((unsigned)(obj->hdrChunk)) <= chunkMax… in yaffs_VerifyObject()
763 chunkIdOk = chunkInRange || (obj->hdrChunk == 0); in yaffs_VerifyObject()
766 obj->hdrChunk / dev->nChunksPerBlock, in yaffs_VerifyObject()
767 obj->hdrChunk % dev->nChunksPerBlock); in yaffs_VerifyObject()
770 if (!obj->fake && in yaffs_VerifyObject()
774 obj->objectId, obj->hdrChunk, in yaffs_VerifyObject()
786 yaffs_ReadChunkWithTagsFromNAND(dev, obj->hdrChunk, buffer, in yaffs_VerifyObject()
789 yaffs_VerifyObjectHeader(obj, oh, &tags, 1); in yaffs_VerifyObject()
795 if (obj && !obj->fake && in yaffs_VerifyObject()
796 (!obj->parent || obj->parent->myDev != dev)) { in yaffs_VerifyObject()
799 obj->objectId, obj->parent)); in yaffs_VerifyObject()
803 if (obj->parent && obj->parent->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { in yaffs_VerifyObject()
806 obj->objectId, obj->parent->variantType)); in yaffs_VerifyObject()
809 switch (obj->variantType) { in yaffs_VerifyObject()
811 yaffs_VerifyFile(obj); in yaffs_VerifyObject()
814 yaffs_VerifySymlink(obj); in yaffs_VerifyObject()
817 yaffs_VerifyDirectory(obj); in yaffs_VerifyObject()
820 yaffs_VerifyHardLink(obj); in yaffs_VerifyObject()
823 yaffs_VerifySpecial(obj); in yaffs_VerifyObject()
829 obj->objectId, obj->variantType)); in yaffs_VerifyObject()
836 yaffs_Object *obj; in yaffs_VerifyObjects() local
848 obj = ylist_entry(lh, yaffs_Object, hashLink); in yaffs_VerifyObjects()
849 yaffs_VerifyObject(obj); in yaffs_VerifyObjects()
1130 static void yaffs_SetObjectName(yaffs_Object *obj, const YCHAR *name) in yaffs_SetObjectName() argument
1133 memset(obj->shortName, 0, sizeof(YCHAR) * (YAFFS_SHORT_NAME_LENGTH+1)); in yaffs_SetObjectName()
1135 yaffs_strcpy(obj->shortName, name); in yaffs_SetObjectName()
1137 obj->shortName[0] = _Y('\0'); in yaffs_SetObjectName()
1139 obj->sum = yaffs_CalcNameSum(name); in yaffs_SetObjectName()
1736 static void yaffs_SoftDeleteFile(yaffs_Object *obj) in yaffs_SoftDeleteFile() argument
1738 if (obj->deleted && in yaffs_SoftDeleteFile()
1739 obj->variantType == YAFFS_OBJECT_TYPE_FILE && !obj->softDeleted) { in yaffs_SoftDeleteFile()
1740 if (obj->nDataChunks <= 0) { in yaffs_SoftDeleteFile()
1742 yaffs_FreeTnode(obj->myDev, in yaffs_SoftDeleteFile()
1743 obj->variant.fileVariant.top); in yaffs_SoftDeleteFile()
1744 obj->variant.fileVariant.top = NULL; in yaffs_SoftDeleteFile()
1747 obj->objectId)); in yaffs_SoftDeleteFile()
1748 yaffs_DoGenericObjectDeletion(obj); in yaffs_SoftDeleteFile()
1750 yaffs_SoftDeleteWorker(obj, in yaffs_SoftDeleteFile()
1751 obj->variant.fileVariant.top, in yaffs_SoftDeleteFile()
1752 obj->variant.fileVariant. in yaffs_SoftDeleteFile()
1754 obj->softDeleted = 1; in yaffs_SoftDeleteFile()
1952 yaffs_Object *obj = in yaffs_CreateFakeDirectory() local
1954 if (obj) { in yaffs_CreateFakeDirectory()
1955 obj->fake = 1; /* it is fake so it might have no NAND presence... */ in yaffs_CreateFakeDirectory()
1956 obj->renameAllowed = 0; /* ... and we're not allowed to rename it... */ in yaffs_CreateFakeDirectory()
1957 obj->unlinkAllowed = 0; /* ... or unlink it */ in yaffs_CreateFakeDirectory()
1958 obj->deleted = 0; in yaffs_CreateFakeDirectory()
1959 obj->unlinked = 0; in yaffs_CreateFakeDirectory()
1960 obj->yst_mode = mode; in yaffs_CreateFakeDirectory()
1961 obj->myDev = dev; in yaffs_CreateFakeDirectory()
1962 obj->hdrChunk = 0; /* Not a valid chunk. */ in yaffs_CreateFakeDirectory()
1965 return obj; in yaffs_CreateFakeDirectory()
2022 void yaffs_HandleDeferedFree(yaffs_Object *obj) in yaffs_HandleDeferedFree() argument
2024 if (obj->deferedFree) in yaffs_HandleDeferedFree()
2025 yaffs_FreeObject(obj); in yaffs_HandleDeferedFree()
2406 static int yaffs_ChangeObjectName(yaffs_Object *obj, yaffs_Object *newDir, in yaffs_ChangeObjectName() argument
2415 newDir = obj->parent; /* use the old directory */ in yaffs_ChangeObjectName()
2426 if (obj->myDev->isYaffs2) in yaffs_ChangeObjectName()
2427 unlinkOp = (newDir == obj->myDev->unlinkedDir); in yaffs_ChangeObjectName()
2429 unlinkOp = (newDir == obj->myDev->unlinkedDir in yaffs_ChangeObjectName()
2430 && obj->variantType == YAFFS_OBJECT_TYPE_FILE); in yaffs_ChangeObjectName()
2432 deleteOp = (newDir == obj->myDev->deletedDir); in yaffs_ChangeObjectName()
2447 yaffs_SetObjectName(obj, newName); in yaffs_ChangeObjectName()
2448 obj->dirty = 1; in yaffs_ChangeObjectName()
2450 yaffs_AddObjectToDirectory(newDir, obj); in yaffs_ChangeObjectName()
2453 obj->unlinked = 1; in yaffs_ChangeObjectName()
2456 if (yaffs_UpdateObjectHeader(obj, newName, 0, deleteOp, shadows) >= 0) in yaffs_ChangeObjectName()
2466 yaffs_Object *obj = NULL; in yaffs_RenameObject() local
2489 obj = yaffs_FindObjectByName(oldDir, oldName); in yaffs_RenameObject()
2491 if (obj && obj->renameAllowed) { in yaffs_RenameObject()
2501 } else if (existingTarget && existingTarget != obj) { in yaffs_RenameObject()
2505 yaffs_ChangeObjectName(obj, newDir, newName, force, in yaffs_RenameObject()
2513 return yaffs_ChangeObjectName(obj, newDir, newName, 1, 0); in yaffs_RenameObject()
3846 static int yaffs_ObjectHasCachedWriteData(yaffs_Object *obj) in yaffs_ObjectHasCachedWriteData() argument
3848 yaffs_Device *dev = obj->myDev; in yaffs_ObjectHasCachedWriteData()
3851 int nCaches = obj->myDev->nShortOpCaches; in yaffs_ObjectHasCachedWriteData()
3855 if (cache->object == obj && in yaffs_ObjectHasCachedWriteData()
3864 static void yaffs_FlushFilesChunkCache(yaffs_Object *obj) in yaffs_FlushFilesChunkCache() argument
3866 yaffs_Device *dev = obj->myDev; in yaffs_FlushFilesChunkCache()
3871 int nCaches = obj->myDev->nShortOpCaches; in yaffs_FlushFilesChunkCache()
3879 if (dev->srCache[i].object == obj && in yaffs_FlushFilesChunkCache()
3922 yaffs_Object *obj; in yaffs_FlushEntireDeviceCache() local
3930 obj = NULL; in yaffs_FlushEntireDeviceCache()
3931 for (i = 0; i < nCaches && !obj; i++) { in yaffs_FlushEntireDeviceCache()
3934 obj = dev->srCache[i].object; in yaffs_FlushEntireDeviceCache()
3937 if (obj) in yaffs_FlushEntireDeviceCache()
3938 yaffs_FlushFilesChunkCache(obj); in yaffs_FlushEntireDeviceCache()
3940 } while (obj); in yaffs_FlushEntireDeviceCache()
4016 static yaffs_ChunkCache *yaffs_FindChunkCache(const yaffs_Object *obj, in yaffs_FindChunkCache() argument
4019 yaffs_Device *dev = obj->myDev; in yaffs_FindChunkCache()
4023 if (dev->srCache[i].object == obj && in yaffs_FindChunkCache()
4215 yaffs_Object *obj) in yaffs_ObjectToCheckpointObject() argument
4218 cp->objectId = obj->objectId; in yaffs_ObjectToCheckpointObject()
4219 cp->parentId = (obj->parent) ? obj->parent->objectId : 0; in yaffs_ObjectToCheckpointObject()
4220 cp->hdrChunk = obj->hdrChunk; in yaffs_ObjectToCheckpointObject()
4221 cp->variantType = obj->variantType; in yaffs_ObjectToCheckpointObject()
4222 cp->deleted = obj->deleted; in yaffs_ObjectToCheckpointObject()
4223 cp->softDeleted = obj->softDeleted; in yaffs_ObjectToCheckpointObject()
4224 cp->unlinked = obj->unlinked; in yaffs_ObjectToCheckpointObject()
4225 cp->fake = obj->fake; in yaffs_ObjectToCheckpointObject()
4226 cp->renameAllowed = obj->renameAllowed; in yaffs_ObjectToCheckpointObject()
4227 cp->unlinkAllowed = obj->unlinkAllowed; in yaffs_ObjectToCheckpointObject()
4228 cp->serial = obj->serial; in yaffs_ObjectToCheckpointObject()
4229 cp->nDataChunks = obj->nDataChunks; in yaffs_ObjectToCheckpointObject()
4231 if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) in yaffs_ObjectToCheckpointObject()
4232 cp->fileSizeOrEquivalentObjectId = obj->variant.fileVariant.fileSize; in yaffs_ObjectToCheckpointObject()
4233 else if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) in yaffs_ObjectToCheckpointObject()
4234 cp->fileSizeOrEquivalentObjectId = obj->variant.hardLinkVariant.equivalentObjectId; in yaffs_ObjectToCheckpointObject()
4237 static int yaffs_CheckpointObjectToObject(yaffs_Object *obj, yaffs_CheckpointObject *cp) in yaffs_CheckpointObjectToObject() argument
4242 if (obj->variantType != cp->variantType) { in yaffs_CheckpointObjectToObject()
4246 obj->variantType)); in yaffs_CheckpointObjectToObject()
4250 obj->objectId = cp->objectId; in yaffs_CheckpointObjectToObject()
4254 obj->myDev, in yaffs_CheckpointObjectToObject()
4269 yaffs_AddObjectToDirectory(parent, obj); in yaffs_CheckpointObjectToObject()
4272 obj->hdrChunk = cp->hdrChunk; in yaffs_CheckpointObjectToObject()
4273 obj->variantType = cp->variantType; in yaffs_CheckpointObjectToObject()
4274 obj->deleted = cp->deleted; in yaffs_CheckpointObjectToObject()
4275 obj->softDeleted = cp->softDeleted; in yaffs_CheckpointObjectToObject()
4276 obj->unlinked = cp->unlinked; in yaffs_CheckpointObjectToObject()
4277 obj->fake = cp->fake; in yaffs_CheckpointObjectToObject()
4278 obj->renameAllowed = cp->renameAllowed; in yaffs_CheckpointObjectToObject()
4279 obj->unlinkAllowed = cp->unlinkAllowed; in yaffs_CheckpointObjectToObject()
4280 obj->serial = cp->serial; in yaffs_CheckpointObjectToObject()
4281 obj->nDataChunks = cp->nDataChunks; in yaffs_CheckpointObjectToObject()
4283 if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) in yaffs_CheckpointObjectToObject()
4284 obj->variant.fileVariant.fileSize = cp->fileSizeOrEquivalentObjectId; in yaffs_CheckpointObjectToObject()
4285 else if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) in yaffs_CheckpointObjectToObject()
4286 obj->variant.hardLinkVariant.equivalentObjectId = cp->fileSizeOrEquivalentObjectId; in yaffs_CheckpointObjectToObject()
4288 if (obj->hdrChunk > 0) in yaffs_CheckpointObjectToObject()
4289 obj->lazyLoaded = 1; in yaffs_CheckpointObjectToObject()
4330 static int yaffs_WriteCheckpointTnodes(yaffs_Object *obj) in yaffs_WriteCheckpointTnodes() argument
4335 if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) { in yaffs_WriteCheckpointTnodes()
4336 ok = yaffs_CheckpointTnodeWorker(obj, in yaffs_WriteCheckpointTnodes()
4337 obj->variant.fileVariant.top, in yaffs_WriteCheckpointTnodes()
4338 obj->variant.fileVariant.topLevel, in yaffs_WriteCheckpointTnodes()
4341 ok = (yaffs_CheckpointWrite(obj->myDev, &endMarker, sizeof(endMarker)) == in yaffs_WriteCheckpointTnodes()
4348 static int yaffs_ReadCheckpointTnodes(yaffs_Object *obj) in yaffs_ReadCheckpointTnodes() argument
4352 yaffs_Device *dev = obj->myDev; in yaffs_ReadCheckpointTnodes()
4353 yaffs_FileStructure *fileStructPtr = &obj->variant.fileVariant; in yaffs_ReadCheckpointTnodes()
4395 yaffs_Object *obj; in yaffs_WriteCheckpointObjects() local
4409 obj = ylist_entry(lh, yaffs_Object, hashLink); in yaffs_WriteCheckpointObjects()
4410 if (!obj->deferedFree) { in yaffs_WriteCheckpointObjects()
4411 yaffs_ObjectToCheckpointObject(&cp, obj); in yaffs_WriteCheckpointObjects()
4416 cp.objectId, cp.parentId, cp.variantType, cp.hdrChunk, (unsigned) obj)); in yaffs_WriteCheckpointObjects()
4420 if (ok && obj->variantType == YAFFS_OBJECT_TYPE_FILE) in yaffs_WriteCheckpointObjects()
4421 ok = yaffs_WriteCheckpointTnodes(obj); in yaffs_WriteCheckpointObjects()
4439 yaffs_Object *obj; in yaffs_ReadCheckpointObjects() local
4459 obj = yaffs_FindOrCreateObjectByNumber(dev, cp.objectId, cp.variantType); in yaffs_ReadCheckpointObjects()
4460 if (obj) { in yaffs_ReadCheckpointObjects()
4461 ok = yaffs_CheckpointObjectToObject(obj, &cp); in yaffs_ReadCheckpointObjects()
4464 if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) { in yaffs_ReadCheckpointObjects()
4465 ok = yaffs_ReadCheckpointTnodes(obj); in yaffs_ReadCheckpointObjects()
4466 } else if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) { in yaffs_ReadCheckpointObjects()
4467 obj->hardLinks.next = in yaffs_ReadCheckpointObjects()
4469 hardList = obj; in yaffs_ReadCheckpointObjects()
5047 loff_t yaffs_GetFileSize(yaffs_Object *obj) in yaffs_GetFileSize() argument
5049 obj = yaffs_GetEquivalentObject(obj); in yaffs_GetFileSize()
5051 switch (obj->variantType) { in yaffs_GetFileSize()
5053 return obj->variant.fileVariant.fileSize; in yaffs_GetFileSize()
5055 return yaffs_strlen(obj->variant.symLinkVariant.alias); in yaffs_GetFileSize()
5180 static int yaffs_IsNonEmptyDirectory(yaffs_Object *obj) in yaffs_IsNonEmptyDirectory() argument
5182 return (obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY) && in yaffs_IsNonEmptyDirectory()
5183 !(ylist_empty(&obj->variant.directoryVariant.children)); in yaffs_IsNonEmptyDirectory()
5186 static int yaffs_DeleteDirectory(yaffs_Object *obj) in yaffs_DeleteDirectory() argument
5189 if (yaffs_IsNonEmptyDirectory(obj)) in yaffs_DeleteDirectory()
5192 return yaffs_DoGenericObjectDeletion(obj); in yaffs_DeleteDirectory()
5211 int yaffs_DeleteObject(yaffs_Object *obj) in yaffs_DeleteObject() argument
5214 switch (obj->variantType) { in yaffs_DeleteObject()
5216 retVal = yaffs_DeleteFile(obj); in yaffs_DeleteObject()
5219 return yaffs_DeleteDirectory(obj); in yaffs_DeleteObject()
5222 retVal = yaffs_DeleteSymLink(obj); in yaffs_DeleteObject()
5225 retVal = yaffs_DeleteHardLink(obj); in yaffs_DeleteObject()
5228 retVal = yaffs_DoGenericObjectDeletion(obj); in yaffs_DeleteObject()
5238 static int yaffs_UnlinkWorker(yaffs_Object *obj) in yaffs_UnlinkWorker() argument
5244 if (!obj->myInode) in yaffs_UnlinkWorker()
5247 if (obj->inUse <= 0) in yaffs_UnlinkWorker()
5251 if(obj) in yaffs_UnlinkWorker()
5252 yaffs_UpdateParent(obj->parent); in yaffs_UnlinkWorker()
5254 if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) { in yaffs_UnlinkWorker()
5255 return yaffs_DeleteHardLink(obj); in yaffs_UnlinkWorker()
5256 } else if (!ylist_empty(&obj->hardLinks)) { in yaffs_UnlinkWorker()
5275 hl = ylist_entry(obj->hardLinks.next, yaffs_Object, hardLinks); in yaffs_UnlinkWorker()
5282 retVal = yaffs_ChangeObjectName(obj, hl->parent, name, 0, 0); in yaffs_UnlinkWorker()
5290 switch (obj->variantType) { in yaffs_UnlinkWorker()
5292 return yaffs_DeleteFile(obj); in yaffs_UnlinkWorker()
5295 return yaffs_DeleteDirectory(obj); in yaffs_UnlinkWorker()
5298 return yaffs_DeleteSymLink(obj); in yaffs_UnlinkWorker()
5301 return yaffs_DoGenericObjectDeletion(obj); in yaffs_UnlinkWorker()
5308 } else if(yaffs_IsNonEmptyDirectory(obj)) in yaffs_UnlinkWorker()
5311 return yaffs_ChangeObjectName(obj, obj->myDev->unlinkedDir, in yaffs_UnlinkWorker()
5316 static int yaffs_UnlinkObject(yaffs_Object *obj) in yaffs_UnlinkObject() argument
5319 if (obj && obj->unlinkAllowed) in yaffs_UnlinkObject()
5320 return yaffs_UnlinkWorker(obj); in yaffs_UnlinkObject()
5327 yaffs_Object *obj; in yaffs_Unlink() local
5329 obj = yaffs_FindObjectByName(dir, name); in yaffs_Unlink()
5330 return yaffs_UnlinkObject(obj); in yaffs_Unlink()
5338 yaffs_Object *obj; in yaffs_HandleShadowedObject() local
5356 obj = in yaffs_HandleShadowedObject()
5359 if (!obj) in yaffs_HandleShadowedObject()
5361 yaffs_AddObjectToDirectory(dev->unlinkedDir, obj); in yaffs_HandleShadowedObject()
5362 obj->variant.fileVariant.shrinkSize = 0; in yaffs_HandleShadowedObject()
5363 obj->valid = 1; /* So that we don't read any other info for this file */ in yaffs_HandleShadowedObject()
5860 yaffs_Object *obj; in yaffs_Scan() local
5868 obj = yaffs_FindObjectByNumber(dev, fixer->shadowedId); in yaffs_Scan()
5869 if (obj) in yaffs_Scan()
5870 yaffs_DeleteObject(obj); in yaffs_Scan()
5872 obj = yaffs_FindObjectByNumber(dev, fixer->objectId); in yaffs_Scan()
5874 if (obj) in yaffs_Scan()
5875 yaffs_UpdateObjectHeader(obj, NULL, 1, 0, 0); in yaffs_Scan()
6616 static void yaffs_VerifyObjectInDirectory(yaffs_Object *obj) in yaffs_VerifyObjectInDirectory() argument
6623 if (!obj) { in yaffs_VerifyObjectInDirectory()
6629 if (yaffs_SkipVerification(obj->myDev)) in yaffs_VerifyObjectInDirectory()
6632 if (!obj->parent) { in yaffs_VerifyObjectInDirectory()
6638 if (obj->parent->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { in yaffs_VerifyObjectInDirectory()
6645 ylist_for_each(lh, &obj->parent->variant.directoryVariant.children) { in yaffs_VerifyObjectInDirectory()
6649 if (obj == listObj) in yaffs_VerifyObjectInDirectory()
6702 static void yaffs_UpdateParent(yaffs_Object *obj) in yaffs_UpdateParent() argument
6704 if(!obj) in yaffs_UpdateParent()
6707 obj->dirty = 1; in yaffs_UpdateParent()
6708 obj->yst_mtime = obj->yst_ctime = Y_CURRENT_TIME; in yaffs_UpdateParent()
6710 yaffs_UpdateObjectHeader(obj,NULL,0,0,0); in yaffs_UpdateParent()
6713 static void yaffs_RemoveObjectFromDirectory(yaffs_Object *obj) in yaffs_RemoveObjectFromDirectory() argument
6715 yaffs_Device *dev = obj->myDev; in yaffs_RemoveObjectFromDirectory()
6718 yaffs_VerifyObjectInDirectory(obj); in yaffs_RemoveObjectFromDirectory()
6719 parent = obj->parent; in yaffs_RemoveObjectFromDirectory()
6724 dev->removeObjectCallback(obj); in yaffs_RemoveObjectFromDirectory()
6727 ylist_del_init(&obj->siblings); in yaffs_RemoveObjectFromDirectory()
6728 obj->parent = NULL; in yaffs_RemoveObjectFromDirectory()
6734 yaffs_Object *obj) in yaffs_AddObjectToDirectory() argument
6752 if (obj->siblings.prev == NULL) { in yaffs_AddObjectToDirectory()
6760 yaffs_RemoveObjectFromDirectory(obj); in yaffs_AddObjectToDirectory()
6764 ylist_add(&obj->siblings, &directory->variant.directoryVariant.children); in yaffs_AddObjectToDirectory()
6765 obj->parent = directory; in yaffs_AddObjectToDirectory()
6767 if (directory == obj->myDev->unlinkedDir in yaffs_AddObjectToDirectory()
6768 || directory == obj->myDev->deletedDir) { in yaffs_AddObjectToDirectory()
6769 obj->unlinked = 1; in yaffs_AddObjectToDirectory()
6770 obj->myDev->nUnlinkedFiles++; in yaffs_AddObjectToDirectory()
6771 obj->renameAllowed = 0; in yaffs_AddObjectToDirectory()
6775 yaffs_VerifyObjectInDirectory(obj); in yaffs_AddObjectToDirectory()
6877 yaffs_Object *yaffs_GetEquivalentObject(yaffs_Object *obj) in yaffs_GetEquivalentObject() argument
6879 if (obj && obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) { in yaffs_GetEquivalentObject()
6881 obj = obj->variant.hardLinkVariant.equivalentObject; in yaffs_GetEquivalentObject()
6882 yaffs_CheckObjectDetailsLoaded(obj); in yaffs_GetEquivalentObject()
6884 return obj; in yaffs_GetEquivalentObject()
6887 int yaffs_GetObjectName(yaffs_Object *obj, YCHAR *name, int buffSize) in yaffs_GetObjectName() argument
6891 yaffs_CheckObjectDetailsLoaded(obj); in yaffs_GetObjectName()
6893 if (obj->objectId == YAFFS_OBJECTID_LOSTNFOUND) { in yaffs_GetObjectName()
6895 } else if (obj->hdrChunk <= 0) { in yaffs_GetObjectName()
6899 unsigned v = obj->objectId; in yaffs_GetObjectName()
6913 else if (obj->shortName[0]) in yaffs_GetObjectName()
6914 yaffs_strcpy(name, obj->shortName); in yaffs_GetObjectName()
6918 __u8 *buffer = yaffs_GetTempBuffer(obj->myDev, __LINE__); in yaffs_GetObjectName()
6922 memset(buffer, 0, obj->myDev->nDataBytesPerChunk); in yaffs_GetObjectName()
6924 if (obj->hdrChunk > 0) { in yaffs_GetObjectName()
6925 result = yaffs_ReadChunkWithTagsFromNAND(obj->myDev, in yaffs_GetObjectName()
6926 obj->hdrChunk, buffer, in yaffs_GetObjectName()
6931 yaffs_ReleaseTempBuffer(obj->myDev, buffer, __LINE__); in yaffs_GetObjectName()
6937 int yaffs_GetObjectFileLength(yaffs_Object *obj) in yaffs_GetObjectFileLength() argument
6940 obj = yaffs_GetEquivalentObject(obj); in yaffs_GetObjectFileLength()
6942 if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) in yaffs_GetObjectFileLength()
6943 return obj->variant.fileVariant.fileSize; in yaffs_GetObjectFileLength()
6944 if (obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK) in yaffs_GetObjectFileLength()
6945 return yaffs_strlen(obj->variant.symLinkVariant.alias); in yaffs_GetObjectFileLength()
6948 return obj->myDev->nDataBytesPerChunk; in yaffs_GetObjectFileLength()
6952 int yaffs_GetObjectLinkCount(yaffs_Object *obj) in yaffs_GetObjectLinkCount() argument
6957 if (!obj->unlinked) in yaffs_GetObjectLinkCount()
6960 ylist_for_each(i, &obj->hardLinks) in yaffs_GetObjectLinkCount()
6966 int yaffs_GetObjectInode(yaffs_Object *obj) in yaffs_GetObjectInode() argument
6968 obj = yaffs_GetEquivalentObject(obj); in yaffs_GetObjectInode()
6970 return obj->objectId; in yaffs_GetObjectInode()
6973 unsigned yaffs_GetObjectType(yaffs_Object *obj) in yaffs_GetObjectType() argument
6975 obj = yaffs_GetEquivalentObject(obj); in yaffs_GetObjectType()
6977 switch (obj->variantType) { in yaffs_GetObjectType()
6991 if (S_ISFIFO(obj->yst_mode)) in yaffs_GetObjectType()
6993 if (S_ISCHR(obj->yst_mode)) in yaffs_GetObjectType()
6995 if (S_ISBLK(obj->yst_mode)) in yaffs_GetObjectType()
6997 if (S_ISSOCK(obj->yst_mode)) in yaffs_GetObjectType()
7005 YCHAR *yaffs_GetSymlinkAlias(yaffs_Object *obj) in yaffs_GetSymlinkAlias() argument
7007 obj = yaffs_GetEquivalentObject(obj); in yaffs_GetSymlinkAlias()
7008 if (obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK) in yaffs_GetSymlinkAlias()
7009 return yaffs_CloneString(obj->variant.symLinkVariant.alias); in yaffs_GetSymlinkAlias()
7016 int yaffs_SetAttributes(yaffs_Object *obj, struct iattr *attr) in yaffs_SetAttributes() argument
7021 obj->yst_mode = attr->ia_mode; in yaffs_SetAttributes()
7023 obj->yst_uid = attr->ia_uid; in yaffs_SetAttributes()
7025 obj->yst_gid = attr->ia_gid; in yaffs_SetAttributes()
7028 obj->yst_atime = Y_TIME_CONVERT(attr->ia_atime); in yaffs_SetAttributes()
7030 obj->yst_ctime = Y_TIME_CONVERT(attr->ia_ctime); in yaffs_SetAttributes()
7032 obj->yst_mtime = Y_TIME_CONVERT(attr->ia_mtime); in yaffs_SetAttributes()
7035 yaffs_ResizeFile(obj, attr->ia_size); in yaffs_SetAttributes()
7037 yaffs_UpdateObjectHeader(obj, NULL, 1, 0, 0); in yaffs_SetAttributes()
7042 int yaffs_GetAttributes(yaffs_Object *obj, struct iattr *attr) in yaffs_GetAttributes() argument
7046 attr->ia_mode = obj->yst_mode; in yaffs_GetAttributes()
7048 attr->ia_uid = obj->yst_uid; in yaffs_GetAttributes()
7050 attr->ia_gid = obj->yst_gid; in yaffs_GetAttributes()
7053 Y_TIME_CONVERT(attr->ia_atime) = obj->yst_atime; in yaffs_GetAttributes()
7055 Y_TIME_CONVERT(attr->ia_ctime) = obj->yst_ctime; in yaffs_GetAttributes()
7057 Y_TIME_CONVERT(attr->ia_mtime) = obj->yst_mtime; in yaffs_GetAttributes()
7060 attr->ia_size = yaffs_GetFileSize(obj); in yaffs_GetAttributes()
7071 int yaffs_DumpObject(yaffs_Object *obj)
7075 yaffs_GetObjectName(obj, name, YAFFS_MAX_NAME_LENGTH + 1);
7081 TENDSTR), obj->objectId, yaffs_GetObjectInode(obj), name,
7082 obj->dirty, obj->valid, obj->serial, obj->sum, obj->hdrChunk,
7083 yaffs_GetObjectType(obj), yaffs_GetObjectFileLength(obj)));