/* yaffsfs_GetInodeIdForObject Grab an inode entry when opening a new inode.  */
static int yaffsfs_GetInodeIdForObject(struct yaffs_obj *obj)
/* yaffsfs_GetInodeIdForObject Grab an inode entry when opening a new inode.  */
static int yaffsfs_GetInodeIdForObject(struct yaffs_obj *obj)
{
	int i;
	int ret;
	struct yaffsfs_Inode *in = NULL;
	if (obj)
		obj = yaffs_get_equivalent_obj(obj);
	ret = yaffsfs_FindInodeIdForObject(obj);
	for (i = 0; i < YAFFSFS_N_HANDLES && ret < 0; i++) {
		if (!yaffsfs_inode[i].iObj)
			ret = i;
	}
	if (ret >= 0) {
		in = &yaffsfs_inode[ret];
		if (!in->iObj)
			in->count = 0;
		in->iObj = obj;
		in->count++;
	}
	return ret;
}