Lines Matching full:inode
36 /* The inode block count for a file/directory is in units of 512 byte blocks,
240 printf(" Inode size: %d\n", info.inode_size);
255 static int read_inode(int fd, unsigned int inum, struct ext4_inode *inode)
268 critical_error_errno("failed to seek to inode %d\n", inum);
271 len=read(fd, inode, sizeof(*inode));
272 if (len != sizeof(*inode)) {
273 critical_error_errno("failed to read inode %d\n", inum);
343 * new_inodes_per_group, retrieve the inode bitmap, and make sure
359 printf("Warning: updated inode bitmap for block group %d\n", bg_num);
396 critical_error("Failed sanity check on new inode count\n");
399 critical_error("Failed sanity check on new inode per group alignment\n");
450 static int get_direct_blocks(struct ext4_inode *inode, unsigned long long *block_list,
458 while ((i < (inode->i_blocks_lo / sectors_per_block)) && (i < EXT4_NDIR_BLOCKS)) {
459 block_list[i] = inode->i_block[i];
465 if ((inode->i_blocks_lo / sectors_per_block) > EXT4_NDIR_BLOCKS) {
472 static int get_indirect_blocks(int fd, struct ext4_inode *inode,
486 read_block(fd, inode->i_block[EXT4_NDIR_BLOCKS], indirect_block);
488 for(i = 0; i < (inode->i_blocks_lo / sectors_per_block - EXT4_NDIR_BLOCKS); i++) {
499 static int get_block_list_indirect(int fd, struct ext4_inode *inode, unsigned long long *block_list)
503 if (get_direct_blocks(inode, block_list, &count)) {
504 get_indirect_blocks(fd, inode, block_list, &count);
569 static int get_block_list_extents(int fd, struct ext4_inode *inode, unsigned long long *block_list)
573 extent_hdr = (struct ext4_extent_header *)inode->i_block;
581 get_extent_ents(fd, (struct ext4_extent_header *)inode->i_block, block_list);
585 get_extent_idx(fd, (struct ext4_extent_header *)inode->i_block, block_list);
592 struct ext4_inode inode;
599 * so we have to go fetch it from the inode. Grrr.
601 /* if UPDATE_INODE_NUMS pass and the inode high bit is not
603 * already updated. Otherwise, fetch inode, and return answer.
605 if ((pass == UPDATE_INODE_NUMS) && !(dirp->inode & 0x80000000)) {
608 read_inode(fd, (dirp->inode & 0x7fffffff), &inode);
609 if (S_ISDIR(inode.i_mode)) {
618 static int recurse_dir(int fd, struct ext4_inode *inode, char *dirbuf, int dirsize, int mode)
650 if (inode->i_flags & EXT4_EXTENTS_FL) {
651 get_block_list_extents(fd, inode, block_list);
665 get_block_list_indirect(fd, inode, block_list);
691 if (dirp->inode == 0) {
700 * Otherwise, this inode entry has already been updated
706 * seems to imply I need to read the inode and get it.
711 ((mode == UPDATE_INODE_NUMS) && (dirp->inode & 0x80000000))) ) {
713 read_inode(fd, dirp->inode & 0x7fffffff, &tmp_inode);
716 critical_error("inode %d for name %s does not point to a directory\n",
717 dirp->inode & 0x7fffffff, name);
720 printf("inode %d %s use extents\n", dirp->inode & 0x7fffffff,
747 /* Process entry based on current mode. Either set high bit or change inode number */
749 dirp->inode |= 0x80000000;
751 if (dirp->inode & 0x80000000) {
752 dirp->inode = compute_new_inum(dirp->inode & 0x7fffffff);
831 critical_error("root inode %d does not point to a directory\n", EXT4_ROOT_INO);
834 printf("inode %d %s use extents\n", EXT4_ROOT_INO,
856 * old inodes/group, but some inode numbers may be updated to the new number.