1361 dbg_readinode("creating inocache for root inode\n");
1362 memset(f->inocache, 0, sizeof(struct jffs2_inode_cache));
1363 f->inocache->ino = f->inocache->pino_nlink = 1;
1364 f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache;
1365 f->inocache->state = INO_STATE_READING;
1366 jffs2_add_ino_cache(c, f->inocache);
1367 }
1368 if (!f->inocache) {
1369 JFFS2_ERROR("requestied to read an nonexistent ino %u\n", ino);
1370 return -ENOENT;
1371 }
1372
1373 return jffs2_do_read_inode_internal(c, f, latest_node);
1374}
1375
1376int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic)
1377{
1378 struct jffs2_raw_inode n;
1379 struct jffs2_inode_info *f = kzalloc(sizeof(*f), GFP_KERNEL);
1380 int ret;
1381
1382 if (!f)
1383 return -ENOMEM;
1384
1385 mutex_init(&f->sem);
1386 mutex_lock(&f->sem);
1387 f->inocache = ic;
1388
1389 ret = jffs2_do_read_inode_internal(c, f, &n);
1390 if (!ret) {
1391 mutex_unlock(&f->sem);
1392 jffs2_do_clear_inode(c, f);
1393 }
1394 kfree (f);
1395 return ret;
1396}
1397
1398void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f)
1399{
1400 struct jffs2_full_dirent *fd, *fds;
1401 int deleted;