Lines Matching full:de
14 * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
33 * len <= UFS_MAXNAMLEN and de != NULL are guaranteed by caller.
36 const unsigned char *name, struct ufs_dir_entry *de) in ufs_match() argument
38 if (len != ufs_get_de_namlen(sb, de)) in ufs_match()
40 if (!de->d_ino) in ufs_match()
42 return !memcmp(name, de->d_name, len); in ufs_match()
73 struct ufs_dir_entry *de; in ufs_inode_by_name() local
76 de = ufs_find_entry(dir, qstr, &page); in ufs_inode_by_name()
77 if (de) { in ufs_inode_by_name()
78 res = fs32_to_cpu(dir->i_sb, de->d_ino); in ufs_inode_by_name()
86 void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, in ufs_set_link() argument
91 (char *) de - (char *) page_address(page); in ufs_set_link()
92 unsigned len = fs16_to_cpu(dir->i_sb, de->d_reclen); in ufs_set_link()
99 de->d_ino = cpu_to_fs32(dir->i_sb, inode->i_ino); in ufs_set_link()
100 ufs_set_de_type(dir->i_sb, de, inode->i_mode); in ufs_set_link()
232 struct ufs_dir_entry *de = NULL; in ufs_dotdot() local
235 de = ufs_next_entry(dir->i_sb, in ufs_dotdot()
239 return de; in ufs_dotdot()
261 struct ufs_dir_entry *de; in ufs_find_entry() local
281 de = (struct ufs_dir_entry *) kaddr; in ufs_find_entry()
283 while ((char *) de <= kaddr) { in ufs_find_entry()
284 if (ufs_match(sb, namelen, name, de)) in ufs_find_entry()
286 de = ufs_next_entry(sb, de); in ufs_find_entry()
299 return de; in ufs_find_entry()
315 struct ufs_dir_entry *de; in ufs_add_link() local
339 de = (struct ufs_dir_entry *)kaddr; in ufs_add_link()
341 while ((char *)de <= kaddr) { in ufs_add_link()
342 if ((char *)de == dir_end) { in ufs_add_link()
346 de->d_reclen = cpu_to_fs16(sb, chunk_size); in ufs_add_link()
347 de->d_ino = 0; in ufs_add_link()
350 if (de->d_reclen == 0) { in ufs_add_link()
357 if (ufs_match(sb, namelen, name, de)) in ufs_add_link()
359 name_len = UFS_DIR_REC_LEN(ufs_get_de_namlen(sb, de)); in ufs_add_link()
360 rec_len = fs16_to_cpu(sb, de->d_reclen); in ufs_add_link()
361 if (!de->d_ino && rec_len >= reclen) in ufs_add_link()
365 de = (struct ufs_dir_entry *) ((char *) de + rec_len); in ufs_add_link()
375 (char*)de - (char*)page_address(page); in ufs_add_link()
379 if (de->d_ino) { in ufs_add_link()
381 (struct ufs_dir_entry *) ((char *) de + name_len); in ufs_add_link()
383 de->d_reclen = cpu_to_fs16(sb, name_len); in ufs_add_link()
385 de = de1; in ufs_add_link()
388 ufs_set_de_namlen(sb, de, namelen); in ufs_add_link()
389 memcpy(de->d_name, name, namelen + 1); in ufs_add_link()
390 de->d_ino = cpu_to_fs32(sb, inode->i_ino); in ufs_add_link()
391 ufs_set_de_type(sb, de, inode->i_mode); in ufs_add_link()
411 struct ufs_dir_entry *de = (struct ufs_dir_entry*)(base + offset); in ufs_validate_entry() local
413 while ((char*)p < (char*)de) in ufs_validate_entry()
442 struct ufs_dir_entry *de; in ufs_readdir() local
462 de = (struct ufs_dir_entry *)(kaddr+offset); in ufs_readdir()
464 for ( ;(char*)de <= limit; de = ufs_next_entry(sb, de)) { in ufs_readdir()
465 if (de->d_ino) { in ufs_readdir()
468 UFSD("filldir(%s,%u)\n", de->d_name, in ufs_readdir()
469 fs32_to_cpu(sb, de->d_ino)); in ufs_readdir()
470 UFSD("namlen %u\n", ufs_get_de_namlen(sb, de)); in ufs_readdir()
473 d_type = de->d_u.d_44.d_type; in ufs_readdir()
475 if (!dir_emit(ctx, de->d_name, in ufs_readdir()
476 ufs_get_de_namlen(sb, de), in ufs_readdir()
477 fs32_to_cpu(sb, de->d_ino), in ufs_readdir()
483 ctx->pos += fs16_to_cpu(sb, de->d_reclen); in ufs_readdir()
504 struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from); in ufs_delete_entry() local
510 fs32_to_cpu(sb, de->d_ino), in ufs_delete_entry()
511 fs16_to_cpu(sb, de->d_reclen), in ufs_delete_entry()
512 ufs_get_de_namlen(sb, de), de->d_name); in ufs_delete_entry()
514 while ((char*)de < (char*)dir) { in ufs_delete_entry()
515 if (de->d_reclen == 0) { in ufs_delete_entry()
521 pde = de; in ufs_delete_entry()
522 de = ufs_next_entry(sb, de); in ufs_delete_entry()
549 struct ufs_dir_entry * de; in ufs_make_empty() local
566 de = (struct ufs_dir_entry *) base; in ufs_make_empty()
568 de->d_ino = cpu_to_fs32(sb, inode->i_ino); in ufs_make_empty()
569 ufs_set_de_type(sb, de, inode->i_mode); in ufs_make_empty()
570 ufs_set_de_namlen(sb, de, 1); in ufs_make_empty()
571 de->d_reclen = cpu_to_fs16(sb, UFS_DIR_REC_LEN(1)); in ufs_make_empty()
572 strcpy (de->d_name, "."); in ufs_make_empty()
573 de = (struct ufs_dir_entry *) in ufs_make_empty()
574 ((char *)de + fs16_to_cpu(sb, de->d_reclen)); in ufs_make_empty()
575 de->d_ino = cpu_to_fs32(sb, dir->i_ino); in ufs_make_empty()
576 ufs_set_de_type(sb, de, dir->i_mode); in ufs_make_empty()
577 de->d_reclen = cpu_to_fs16(sb, chunk_size - UFS_DIR_REC_LEN(1)); in ufs_make_empty()
578 ufs_set_de_namlen(sb, de, 2); in ufs_make_empty()
579 strcpy (de->d_name, ".."); in ufs_make_empty()
599 struct ufs_dir_entry *de; in ufs_empty_dir() local
606 de = (struct ufs_dir_entry *)kaddr; in ufs_empty_dir()
609 while ((char *)de <= kaddr) { in ufs_empty_dir()
610 if (de->d_reclen == 0) { in ufs_empty_dir()
613 "kaddr=%p, de=%p\n", kaddr, de); in ufs_empty_dir()
616 if (de->d_ino) { in ufs_empty_dir()
617 u16 namelen=ufs_get_de_namlen(sb, de); in ufs_empty_dir()
619 if (de->d_name[0] != '.') in ufs_empty_dir()
625 fs32_to_cpu(sb, de->d_ino)) in ufs_empty_dir()
627 } else if (de->d_name[1] != '.') in ufs_empty_dir()
630 de = ufs_next_entry(sb, de); in ufs_empty_dir()