Lines Matching refs:dirent
353 struct ext2_dir_entry *dirent, in check_dot() argument
362 if (!dirent->inode) in check_dot()
364 else if ((ext2fs_dirent_name_len(dirent) != 1) || in check_dot()
365 (dirent->name[0] != '.')) in check_dot()
367 else if (dirent->name[1] != '\0') in check_dot()
370 (void) ext2fs_get_rec_len(ctx->fs, dirent, &rec_len); in check_dot()
374 rec_len = dirent->rec_len = 12; in check_dot()
375 dirent->inode = ino; in check_dot()
376 ext2fs_dirent_set_name_len(dirent, 1); in check_dot()
377 ext2fs_dirent_set_file_type(dirent, EXT2_FT_UNKNOWN); in check_dot()
378 dirent->name[0] = '.'; in check_dot()
379 dirent->name[1] = '\0'; in check_dot()
384 if (dirent->inode != ino) { in check_dot()
386 dirent->inode = ino; in check_dot()
396 ((char *) dirent + 12); in check_dot()
397 dirent->rec_len = 12; in check_dot()
417 struct ext2_dir_entry *dirent, in check_dotdot() argument
423 if (!dirent->inode) in check_dotdot()
425 else if ((ext2fs_dirent_name_len(dirent) != 2) || in check_dotdot()
426 (dirent->name[0] != '.') || in check_dotdot()
427 (dirent->name[1] != '.')) in check_dotdot()
429 else if (dirent->name[2] != '\0') in check_dotdot()
432 (void) ext2fs_get_rec_len(ctx->fs, dirent, &rec_len); in check_dotdot()
436 dirent->rec_len = 12; in check_dotdot()
442 dirent->inode = EXT2_ROOT_INO; in check_dotdot()
443 ext2fs_dirent_set_name_len(dirent, 2); in check_dotdot()
444 ext2fs_dirent_set_file_type(dirent, EXT2_FT_UNKNOWN); in check_dotdot()
445 dirent->name[0] = '.'; in check_dotdot()
446 dirent->name[1] = '.'; in check_dotdot()
447 dirent->name[2] = '\0'; in check_dotdot()
452 if (e2fsck_dir_info_set_dotdot(ctx, ino, dirent->inode)) { in check_dotdot()
464 struct ext2_dir_entry *dirent, in check_name() argument
471 for ( i = 0; i < ext2fs_dirent_name_len(dirent); i++) { in check_name()
472 if (dirent->name[i] != '/' && dirent->name[i] != '\0') in check_name()
478 dirent->name[i] = '.'; in check_name()
485 struct ext2_dir_entry *dirent, in encrypted_check_name() argument
488 if (ext2fs_dirent_name_len(dirent) < EXT4_CRYPTO_BLOCK_SIZE) { in encrypted_check_name()
490 dirent->inode = 0; in encrypted_check_name()
502 struct ext2_dir_entry *dirent, in check_filetype() argument
506 int filetype = ext2fs_dirent_file_type(dirent); in check_filetype()
514 ext2fs_dirent_set_file_type(dirent, EXT2_FT_UNKNOWN); in check_filetype()
518 if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, dirent->inode)) { in check_filetype()
521 dirent->inode)) { in check_filetype()
525 dirent->inode)) in check_filetype()
528 e2fsck_read_inode(ctx, dirent->inode, &inode, in check_filetype()
540 ext2fs_dirent_set_file_type(dirent, should_be); in check_filetype()
678 struct ext2_dir_entry *dirent, in salvage_directory() argument
683 char *cp = (char *) dirent; in salvage_directory()
697 name_len = ext2fs_dirent_name_len(dirent); in salvage_directory()
698 (void) ext2fs_get_rec_len(fs, dirent, &rec_len); in salvage_directory()
719 dirent->inode <= fs->super->s_inodes_count && in salvage_directory()
720 strnlen(dirent->name, name_len) == name_len) { in salvage_directory()
721 (void) ext2fs_set_rec_len(fs, (int) rec_len + left, dirent); in salvage_directory()
750 (void) ext2fs_set_rec_len(fs, rec_len, dirent); in salvage_directory()
751 ext2fs_dirent_set_name_len(dirent, 0); in salvage_directory()
752 ext2fs_dirent_set_file_type(dirent, EXT2_FT_UNKNOWN); in salvage_directory()
753 dirent->inode = 0; in salvage_directory()
882 struct ext2_dir_entry *dirent, *prev, dot, dotdot; in check_dir_block() local
939 cd->pctx.dirent = 0; in check_dir_block()
1050 dirent = (struct ext2_dir_entry *) buf; in check_dir_block()
1051 (void) ext2fs_get_rec_len(fs, dirent, &rec_len); in check_dir_block()
1070 } else if ((dirent->inode == 0) && in check_dir_block()
1072 (ext2fs_dirent_name_len(dirent) == 0) && in check_dir_block()
1126 dirent = (struct ext2_dir_entry *) (buf + offset); in check_dir_block()
1134 (void) ext2fs_get_rec_len(fs, dirent, &rec_len); in check_dir_block()
1135 cd->pctx.dirent = dirent; in check_dir_block()
1140 (((unsigned) ext2fs_dirent_name_len(dirent) + EXT2_DIR_ENTRY_HEADER_LEN) > rec_len)) { in check_dir_block()
1166 ((char *)dirent) + EXT2_DIR_ENTRY_HEADER_LEN, in check_dir_block()
1171 salvage_directory(fs, dirent, prev, in check_dir_block()
1177 dirent, &rec_len); in check_dir_block()
1179 ((char *)dirent) + offset + rec_len, in check_dir_block()
1192 dirent = ˙ in check_dir_block()
1193 dirent->inode = ino; in check_dir_block()
1194 dirent->rec_len = EXT2_DIR_REC_LEN(1); in check_dir_block()
1195 dirent->name_len = 1 | filetype; in check_dir_block()
1196 dirent->name[0] = '.'; in check_dir_block()
1199 dirent = &dotdot; in check_dir_block()
1200 dirent->inode = in check_dir_block()
1202 dirent->rec_len = EXT2_DIR_REC_LEN(2); in check_dir_block()
1203 dirent->name_len = 2 | filetype; in check_dir_block()
1204 dirent->name[0] = '.'; in check_dir_block()
1205 dirent->name[1] = '.'; in check_dir_block()
1209 cd->pctx.dirent = dirent; in check_dir_block()
1214 if (check_dot(ctx, dirent, ino, &cd->pctx)) in check_dir_block()
1217 ret = check_dotdot(ctx, dirent, ino, &cd->pctx); in check_dir_block()
1222 } else if (dirent->inode == ino) { in check_dir_block()
1225 dirent->inode = 0; in check_dir_block()
1230 if (!dirent->inode) in check_dir_block()
1236 name_len = ext2fs_dirent_name_len(dirent); in check_dir_block()
1237 if (((dirent->inode != EXT2_ROOT_INO) && in check_dir_block()
1238 (dirent->inode < EXT2_FIRST_INODE(fs->super))) || in check_dir_block()
1239 (dirent->inode > fs->super->s_inodes_count)) { in check_dir_block()
1243 dirent->inode))) { in check_dir_block()
1250 (dirent->name[0] == '.')) { in check_dir_block()
1258 (dirent->name[0] == '.') && in check_dir_block()
1259 (dirent->name[1] == '.')) { in check_dir_block()
1267 (dirent->inode == EXT2_ROOT_INO)) { in check_dir_block()
1284 dirent->inode = 0; in check_dir_block()
1302 dirent->inode)) { in check_dir_block()
1304 dirent->inode, in check_dir_block()
1306 dirent->inode = 0; in check_dir_block()
1314 group = ext2fs_group_of_ino(fs, dirent->inode); in check_dir_block()
1329 pctx.num = dirent->inode; in check_dir_block()
1341 } else if (dirent->inode >= first_unused_inode) { in check_dir_block()
1342 pctx.num = dirent->inode; in check_dir_block()
1364 dirent->inode))) in check_dir_block()
1369 dirent->inode = 0; in check_dir_block()
1379 if (!encrypted && check_name(ctx, dirent, &cd->pctx)) in check_dir_block()
1383 encrypted_check_name(ctx, dirent, &cd->pctx)) { in check_dir_block()
1388 if (check_filetype(ctx, dirent, ino, &cd->pctx)) in check_dir_block()
1392 ext2fs_dirhash(dx_dir->hashversion, dirent->name, in check_dir_block()
1393 ext2fs_dirent_name_len(dirent), in check_dir_block()
1410 dirent->inode))) { in check_dir_block()
1411 if (e2fsck_dir_info_get_parent(ctx, dirent->inode, in check_dir_block()
1413 cd->pctx.ino = dirent->inode; in check_dir_block()
1421 dirent->inode = 0; in check_dir_block()
1428 dirent->inode, ino); in check_dir_block()
1434 } else if (dict_lookup(&de_dict, dirent)) { in check_dir_block()
1437 pctx.dirent = dirent; in check_dir_block()
1442 dict_alloc_insert(&de_dict, dirent, dirent); in check_dir_block()
1444 ext2fs_icount_increment(ctx->inode_count, dirent->inode, in check_dir_block()
1450 prev = dirent; in check_dir_block()
1452 (void) ext2fs_get_rec_len(fs, dirent, &rec_len); in check_dir_block()
1490 dirent->rec_len = cd->pctx.num; in check_dir_block()