struct inode_walk_struct {
ext2_ino_t dir;
ext2_ino_t *iarray;
- int inodes_left;
+ int names_left;
int num_inodes;
int position;
char *parent;
}
}
putc('\n', stdout);
- iw->inodes_left--;
+ iw->names_left--;
}
}
- if (!iw->inodes_left)
+ if (!iw->names_left)
return DIRENT_ABORT;
return 0;
}
memset(iw.iarray, 0, sizeof(ext2_ino_t) * argc);
+ iw.names_left = 0;
for (i=0; i < argc; i++) {
iw.iarray[i] = strtol(argv[i], &tmp, 0);
if (*tmp) {
com_err("ncheck", 0, "Bad inode - %s", argv[i]);
goto error_out;
}
+ if (debugfs_read_inode(iw.iarray[i], &inode, *argv))
+ goto error_out;
+ if (LINUX_S_ISDIR(inode.i_mode))
+ iw.names_left += 1;
+ else
+ iw.names_left += inode.i_links_count;
}
- iw.num_inodes = iw.inodes_left = argc;
+ iw.num_inodes = argc;
retval = ext2fs_open_inode_scan(current_fs, 0, &scan);
if (retval) {
goto next;
}
- if (iw.inodes_left == 0)
+ if (iw.names_left == 0)
break;
next: