-#if 0
- // Curve ball: We're unlinking an object that has a hardlink.
- // Therefore we can't really delete the object.
- // Instead, we do the following:
- // - Select a hardlink.
- // - Re-type a hardlink as the equivalent object and populate the fields, including the
- // objectId. Updating the object id is important so that all the hardlinks do not need
- // to be rewritten.
- // - Update the equivalet object pointers.
- // - Delete all object.
-
- yaffs_Object *hl;
- struct list_head *i;
-
-
- yaffs_RemoveObjectFromDirectory(obj);
-
-
-
- hl = list_entry(obj->hardLinks.next, yaffs_Object,hardLinks);
-
- hl->dirty = 1;
- hl->st_mode = obj->st_mode;
- hl->st_uid = obj->st_uid;
- hl->st_gid = obj->st_gid;
- hl->st_atime = obj->st_atime;
- hl->st_mtime = obj->st_mtime;
- hl->st_ctime = obj->st_ctime;
- hl->st_rdev = obj->st_rdev;
-
- hl->variantType = obj->variantType;
-
- switch(hl->variantType)
- {
- case YAFFS_OBJECT_TYPE_FILE:
- case YAFFS_OBJECT_TYPE_SYMLINK:
- case YAFFS_OBJECT_TYPE_SPECIAL:
- // These types are OK to just copy across.
- hl->variant = obj->variant;
- break;
- case YAFFS_OBJECT_TYPE_DIRECTORY:
- // Fix the list up
- list_add(&hl->variant.directoryVariant.children,
- &obj->variant.directoryVariant.children);
- list_del(&obj->variant.directoryVariant.children);
-
- // Now change all the directory children to point to the new parent.
- list_for_each(i,&hl->variant.directoryVariant.children)
- {
- list_entry(i,yaffs_Object,siblings)->parent = hl;
- }
- break;
-
- case YAFFS_OBJECT_TYPE_HARDLINK:
- case YAFFS_OBJECT_TYPE_UNKNOWN:
- // Should not be either of these types.
- }
-
- // Now fix up the hardlink chain
- list_del(&obj->hardLinks);
-
- list_for_each(i,&hl->hardLinks)
- {
- list_entry(i,yaffs_Object,hardLinks)->variant.hardLinkVariant.equivalentObject = hl;
- list_entry(i,yaffs_Object,hardLinks)->variant.hardLinkVariant.equivalentObjectId = hl->objectId;
- }
-
- // Now fix up the hash links.
- yaffs_UnhashObject(hl);
- hl->objectId = obj->objectId;
- yaffs_HashObject(hl);
-
- // Update the hardlink which has become an object
- yaffs_UpdateObjectHeader(hl,NULL,0);
-
- // Finally throw away the deleted object
- yaffs_DeleteChunk(obj->myDev,obj->chunkId);
- yaffs_FreeObject(obj);
-
- return YAFFS_OK;
-#else