Lines Matching refs:dentry
27 static int lock_parent(struct dentry *dentry, in lock_parent() argument
28 struct dentry **lower_dentry, in lock_parent()
31 struct dentry *lower_dir_dentry; in lock_parent()
33 lower_dir_dentry = ecryptfs_dentry_to_lower(dentry->d_parent); in lock_parent()
35 *lower_dentry = ecryptfs_dentry_to_lower(dentry); in lock_parent()
117 static int ecryptfs_interpose(struct dentry *lower_dentry, in ecryptfs_interpose()
118 struct dentry *dentry, struct super_block *sb) in ecryptfs_interpose() argument
124 d_instantiate(dentry, inode); in ecryptfs_interpose()
129 static int ecryptfs_do_unlink(struct inode *dir, struct dentry *dentry, in ecryptfs_do_unlink() argument
132 struct dentry *lower_dentry; in ecryptfs_do_unlink()
136 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_do_unlink()
156 d_drop(dentry); in ecryptfs_do_unlink()
174 struct dentry *ecryptfs_dentry, umode_t mode) in ecryptfs_do_create()
177 struct dentry *lower_dentry; in ecryptfs_do_create()
212 int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry, in ecryptfs_initialize_file()
257 struct inode *directory_inode, struct dentry *ecryptfs_dentry, in ecryptfs_create()
285 static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode) in ecryptfs_i_size_read() argument
290 rc = ecryptfs_get_lower_file(dentry, inode); in ecryptfs_i_size_read()
295 dentry, rc); in ecryptfs_i_size_read()
307 rc = ecryptfs_read_and_validate_xattr_region(dentry, inode); in ecryptfs_i_size_read()
319 static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry, in ecryptfs_lookup_interpose() argument
320 struct dentry *lower_dentry) in ecryptfs_lookup_interpose()
322 const struct path *path = ecryptfs_dentry_to_lower_path(dentry->d_parent); in ecryptfs_lookup_interpose()
333 fsstack_copy_attr_atime(d_inode(dentry->d_parent), in ecryptfs_lookup_interpose()
334 d_inode(path->dentry)); in ecryptfs_lookup_interpose()
337 ecryptfs_set_dentry_private(dentry, dentry_info); in ecryptfs_lookup_interpose()
339 dentry_info->lower_path.dentry = lower_dentry; in ecryptfs_lookup_interpose()
351 d_add(dentry, NULL); in ecryptfs_lookup_interpose()
354 inode = __ecryptfs_get_inode(lower_inode, dentry->d_sb); in ecryptfs_lookup_interpose()
361 rc = ecryptfs_i_size_read(dentry, inode); in ecryptfs_lookup_interpose()
370 return d_splice_alias(inode, dentry); in ecryptfs_lookup_interpose()
382 static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, in ecryptfs_lookup()
383 struct dentry *ecryptfs_dentry, in ecryptfs_lookup()
388 struct dentry *lower_dir_dentry, *lower_dentry; in ecryptfs_lookup()
391 struct dentry *res; in ecryptfs_lookup()
424 static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir, in ecryptfs_link()
425 struct dentry *new_dentry) in ecryptfs_link()
427 struct dentry *lower_old_dentry; in ecryptfs_link()
428 struct dentry *lower_new_dentry; in ecryptfs_link()
454 static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) in ecryptfs_unlink() argument
456 return ecryptfs_do_unlink(dir, dentry, d_inode(dentry)); in ecryptfs_unlink()
460 struct inode *dir, struct dentry *dentry, in ecryptfs_symlink() argument
464 struct dentry *lower_dentry; in ecryptfs_symlink()
470 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_symlink()
486 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); in ecryptfs_symlink()
493 if (d_really_is_negative(dentry)) in ecryptfs_symlink()
494 d_drop(dentry); in ecryptfs_symlink()
499 struct dentry *dentry, umode_t mode) in ecryptfs_mkdir() argument
502 struct dentry *lower_dentry; in ecryptfs_mkdir()
505 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_mkdir()
511 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); in ecryptfs_mkdir()
519 if (d_really_is_negative(dentry)) in ecryptfs_mkdir()
520 d_drop(dentry); in ecryptfs_mkdir()
524 static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry) in ecryptfs_rmdir() argument
526 struct dentry *lower_dentry; in ecryptfs_rmdir()
530 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_rmdir()
539 clear_nlink(d_inode(dentry)); in ecryptfs_rmdir()
546 d_drop(dentry); in ecryptfs_rmdir()
552 struct dentry *dentry, umode_t mode, dev_t dev) in ecryptfs_mknod() argument
555 struct dentry *lower_dentry; in ecryptfs_mknod()
558 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_mknod()
564 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); in ecryptfs_mknod()
571 if (d_really_is_negative(dentry)) in ecryptfs_mknod()
572 d_drop(dentry); in ecryptfs_mknod()
578 struct dentry *old_dentry, struct inode *new_dir, in ecryptfs_rename()
579 struct dentry *new_dentry, unsigned int flags) in ecryptfs_rename()
582 struct dentry *lower_old_dentry; in ecryptfs_rename()
583 struct dentry *lower_new_dentry; in ecryptfs_rename()
584 struct dentry *lower_old_dir_dentry; in ecryptfs_rename()
585 struct dentry *lower_new_dir_dentry; in ecryptfs_rename()
586 struct dentry *trap; in ecryptfs_rename()
640 static char *ecryptfs_readlink_lower(struct dentry *dentry, size_t *bufsiz) in ecryptfs_readlink_lower() argument
643 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_readlink_lower()
652 rc = ecryptfs_decode_and_decrypt_filename(&buf, bufsiz, dentry->d_sb, in ecryptfs_readlink_lower()
661 static const char *ecryptfs_get_link(struct dentry *dentry, in ecryptfs_get_link() argument
668 if (!dentry) in ecryptfs_get_link()
671 buf = ecryptfs_readlink_lower(dentry, &len); in ecryptfs_get_link()
674 fsstack_copy_attr_atime(d_inode(dentry), in ecryptfs_get_link()
675 d_inode(ecryptfs_dentry_to_lower(dentry))); in ecryptfs_get_link()
726 static int truncate_upper(struct dentry *dentry, struct iattr *ia, in truncate_upper() argument
730 struct inode *inode = d_inode(dentry); in truncate_upper()
740 rc = ecryptfs_get_lower_file(dentry, inode); in truncate_upper()
743 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; in truncate_upper()
844 int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) in ecryptfs_truncate() argument
850 rc = ecryptfs_inode_newsize_ok(d_inode(dentry), new_length); in ecryptfs_truncate()
854 rc = truncate_upper(dentry, &ia, &lower_ia); in ecryptfs_truncate()
856 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_truncate()
888 struct dentry *dentry, struct iattr *ia) in ecryptfs_setattr() argument
891 struct dentry *lower_dentry; in ecryptfs_setattr()
897 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; in ecryptfs_setattr()
903 inode = d_inode(dentry); in ecryptfs_setattr()
905 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_setattr()
907 if (d_is_dir(dentry)) in ecryptfs_setattr()
909 else if (d_is_reg(dentry) in ecryptfs_setattr()
915 dentry->d_sb)->mount_crypt_stat; in ecryptfs_setattr()
916 rc = ecryptfs_get_lower_file(dentry, inode); in ecryptfs_setattr()
921 rc = ecryptfs_read_metadata(dentry); in ecryptfs_setattr()
942 rc = setattr_prepare(&nop_mnt_idmap, dentry, ia); in ecryptfs_setattr()
955 rc = truncate_upper(dentry, ia, &lower_ia); in ecryptfs_setattr()
979 struct dentry *dentry = path->dentry; in ecryptfs_getattr_link() local
984 dentry->d_sb)->mount_crypt_stat; in ecryptfs_getattr_link()
985 generic_fillattr(&nop_mnt_idmap, request_mask, d_inode(dentry), stat); in ecryptfs_getattr_link()
990 target = ecryptfs_readlink_lower(dentry, &targetsiz); in ecryptfs_getattr_link()
1005 struct dentry *dentry = path->dentry; in ecryptfs_getattr() local
1009 rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat, in ecryptfs_getattr()
1012 fsstack_copy_attr_all(d_inode(dentry), in ecryptfs_getattr()
1013 ecryptfs_inode_to_lower(d_inode(dentry))); in ecryptfs_getattr()
1015 d_inode(dentry), stat); in ecryptfs_getattr()
1022 ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, in ecryptfs_setxattr() argument
1027 struct dentry *lower_dentry; in ecryptfs_setxattr()
1030 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_setxattr()
1046 ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode, in ecryptfs_getxattr_lower()
1063 ecryptfs_getxattr(struct dentry *dentry, struct inode *inode, in ecryptfs_getxattr() argument
1066 return ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry), in ecryptfs_getxattr()
1072 ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size) in ecryptfs_listxattr() argument
1075 struct dentry *lower_dentry; in ecryptfs_listxattr()
1077 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_listxattr()
1089 static int ecryptfs_removexattr(struct dentry *dentry, struct inode *inode, in ecryptfs_removexattr() argument
1093 struct dentry *lower_dentry; in ecryptfs_removexattr()
1096 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_removexattr()
1109 static int ecryptfs_fileattr_get(struct dentry *dentry, struct fileattr *fa) in ecryptfs_fileattr_get() argument
1111 return vfs_fileattr_get(ecryptfs_dentry_to_lower(dentry), fa); in ecryptfs_fileattr_get()
1115 struct dentry *dentry, struct fileattr *fa) in ecryptfs_fileattr_set() argument
1117 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_fileattr_set()
1121 fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry)); in ecryptfs_fileattr_set()
1127 struct dentry *dentry, int type) in ecryptfs_get_acl() argument
1129 return vfs_get_acl(idmap, ecryptfs_dentry_to_lower(dentry), in ecryptfs_get_acl()
1134 struct dentry *dentry, struct posix_acl *acl, in ecryptfs_set_acl() argument
1138 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_set_acl()
1144 fsstack_copy_attr_all(d_inode(dentry), lower_inode); in ecryptfs_set_acl()
1187 struct dentry *dentry, struct inode *inode, in ecryptfs_xattr_get() argument
1190 return ecryptfs_getxattr(dentry, inode, name, buffer, size); in ecryptfs_xattr_get()
1195 struct dentry *dentry, struct inode *inode, in ecryptfs_xattr_set() argument
1200 return ecryptfs_setxattr(dentry, inode, name, value, size, flags); in ecryptfs_xattr_set()
1203 return ecryptfs_removexattr(dentry, inode, name); in ecryptfs_xattr_set()