Lines Matching refs:dentry
25 static int lock_parent(struct dentry *dentry, in lock_parent() argument
26 struct dentry **lower_dentry, in lock_parent()
29 struct dentry *lower_dir_dentry; in lock_parent()
31 lower_dir_dentry = ecryptfs_dentry_to_lower(dentry->d_parent); in lock_parent()
33 *lower_dentry = ecryptfs_dentry_to_lower(dentry); in lock_parent()
115 static int ecryptfs_interpose(struct dentry *lower_dentry, in ecryptfs_interpose()
116 struct dentry *dentry, struct super_block *sb) in ecryptfs_interpose() argument
122 d_instantiate(dentry, inode); in ecryptfs_interpose()
127 static int ecryptfs_do_unlink(struct inode *dir, struct dentry *dentry, in ecryptfs_do_unlink() argument
130 struct dentry *lower_dentry; in ecryptfs_do_unlink()
134 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_do_unlink()
154 d_drop(dentry); in ecryptfs_do_unlink()
172 struct dentry *ecryptfs_dentry, umode_t mode) in ecryptfs_do_create()
175 struct dentry *lower_dentry; in ecryptfs_do_create()
210 int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry, in ecryptfs_initialize_file()
255 struct inode *directory_inode, struct dentry *ecryptfs_dentry, in ecryptfs_create()
283 static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode) in ecryptfs_i_size_read() argument
288 rc = ecryptfs_get_lower_file(dentry, inode); in ecryptfs_i_size_read()
293 dentry, rc); in ecryptfs_i_size_read()
305 rc = ecryptfs_read_and_validate_xattr_region(dentry, inode); in ecryptfs_i_size_read()
317 static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry, in ecryptfs_lookup_interpose() argument
318 struct dentry *lower_dentry) in ecryptfs_lookup_interpose()
320 struct path *path = ecryptfs_dentry_to_lower_path(dentry->d_parent); in ecryptfs_lookup_interpose()
331 fsstack_copy_attr_atime(d_inode(dentry->d_parent), in ecryptfs_lookup_interpose()
332 d_inode(path->dentry)); in ecryptfs_lookup_interpose()
335 ecryptfs_set_dentry_private(dentry, dentry_info); in ecryptfs_lookup_interpose()
337 dentry_info->lower_path.dentry = lower_dentry; in ecryptfs_lookup_interpose()
349 d_add(dentry, NULL); in ecryptfs_lookup_interpose()
352 inode = __ecryptfs_get_inode(lower_inode, dentry->d_sb); in ecryptfs_lookup_interpose()
359 rc = ecryptfs_i_size_read(dentry, inode); in ecryptfs_lookup_interpose()
368 return d_splice_alias(inode, dentry); in ecryptfs_lookup_interpose()
380 static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, in ecryptfs_lookup()
381 struct dentry *ecryptfs_dentry, in ecryptfs_lookup()
386 struct dentry *lower_dir_dentry, *lower_dentry; in ecryptfs_lookup()
389 struct dentry *res; in ecryptfs_lookup()
422 static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir, in ecryptfs_link()
423 struct dentry *new_dentry) in ecryptfs_link()
425 struct dentry *lower_old_dentry; in ecryptfs_link()
426 struct dentry *lower_new_dentry; in ecryptfs_link()
452 static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) in ecryptfs_unlink() argument
454 return ecryptfs_do_unlink(dir, dentry, d_inode(dentry)); in ecryptfs_unlink()
458 struct inode *dir, struct dentry *dentry, in ecryptfs_symlink() argument
462 struct dentry *lower_dentry; in ecryptfs_symlink()
468 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_symlink()
484 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); in ecryptfs_symlink()
491 if (d_really_is_negative(dentry)) in ecryptfs_symlink()
492 d_drop(dentry); in ecryptfs_symlink()
497 struct dentry *dentry, umode_t mode) in ecryptfs_mkdir() argument
500 struct dentry *lower_dentry; in ecryptfs_mkdir()
503 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_mkdir()
509 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); in ecryptfs_mkdir()
517 if (d_really_is_negative(dentry)) in ecryptfs_mkdir()
518 d_drop(dentry); in ecryptfs_mkdir()
522 static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry) in ecryptfs_rmdir() argument
524 struct dentry *lower_dentry; in ecryptfs_rmdir()
528 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_rmdir()
537 clear_nlink(d_inode(dentry)); in ecryptfs_rmdir()
544 d_drop(dentry); in ecryptfs_rmdir()
550 struct dentry *dentry, umode_t mode, dev_t dev) in ecryptfs_mknod() argument
553 struct dentry *lower_dentry; in ecryptfs_mknod()
556 rc = lock_parent(dentry, &lower_dentry, &lower_dir); in ecryptfs_mknod()
562 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); in ecryptfs_mknod()
569 if (d_really_is_negative(dentry)) in ecryptfs_mknod()
570 d_drop(dentry); in ecryptfs_mknod()
576 struct dentry *old_dentry, struct inode *new_dir, in ecryptfs_rename()
577 struct dentry *new_dentry, unsigned int flags) in ecryptfs_rename()
580 struct dentry *lower_old_dentry; in ecryptfs_rename()
581 struct dentry *lower_new_dentry; in ecryptfs_rename()
582 struct dentry *lower_old_dir_dentry; in ecryptfs_rename()
583 struct dentry *lower_new_dir_dentry; in ecryptfs_rename()
584 struct dentry *trap; in ecryptfs_rename()
638 static char *ecryptfs_readlink_lower(struct dentry *dentry, size_t *bufsiz) in ecryptfs_readlink_lower() argument
641 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_readlink_lower()
650 rc = ecryptfs_decode_and_decrypt_filename(&buf, bufsiz, dentry->d_sb, in ecryptfs_readlink_lower()
659 static const char *ecryptfs_get_link(struct dentry *dentry, in ecryptfs_get_link() argument
666 if (!dentry) in ecryptfs_get_link()
669 buf = ecryptfs_readlink_lower(dentry, &len); in ecryptfs_get_link()
672 fsstack_copy_attr_atime(d_inode(dentry), in ecryptfs_get_link()
673 d_inode(ecryptfs_dentry_to_lower(dentry))); in ecryptfs_get_link()
724 static int truncate_upper(struct dentry *dentry, struct iattr *ia, in truncate_upper() argument
728 struct inode *inode = d_inode(dentry); in truncate_upper()
738 rc = ecryptfs_get_lower_file(dentry, inode); in truncate_upper()
741 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; in truncate_upper()
842 int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) in ecryptfs_truncate() argument
848 rc = ecryptfs_inode_newsize_ok(d_inode(dentry), new_length); in ecryptfs_truncate()
852 rc = truncate_upper(dentry, &ia, &lower_ia); in ecryptfs_truncate()
854 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_truncate()
886 struct dentry *dentry, struct iattr *ia) in ecryptfs_setattr() argument
889 struct dentry *lower_dentry; in ecryptfs_setattr()
895 crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; in ecryptfs_setattr()
901 inode = d_inode(dentry); in ecryptfs_setattr()
903 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_setattr()
905 if (d_is_dir(dentry)) in ecryptfs_setattr()
907 else if (d_is_reg(dentry) in ecryptfs_setattr()
913 dentry->d_sb)->mount_crypt_stat; in ecryptfs_setattr()
914 rc = ecryptfs_get_lower_file(dentry, inode); in ecryptfs_setattr()
919 rc = ecryptfs_read_metadata(dentry); in ecryptfs_setattr()
940 rc = setattr_prepare(&init_user_ns, dentry, ia); in ecryptfs_setattr()
953 rc = truncate_upper(dentry, ia, &lower_ia); in ecryptfs_setattr()
977 struct dentry *dentry = path->dentry; in ecryptfs_getattr_link() local
982 dentry->d_sb)->mount_crypt_stat; in ecryptfs_getattr_link()
983 generic_fillattr(&init_user_ns, d_inode(dentry), stat); in ecryptfs_getattr_link()
988 target = ecryptfs_readlink_lower(dentry, &targetsiz); in ecryptfs_getattr_link()
1003 struct dentry *dentry = path->dentry; in ecryptfs_getattr() local
1007 rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat, in ecryptfs_getattr()
1010 fsstack_copy_attr_all(d_inode(dentry), in ecryptfs_getattr()
1011 ecryptfs_inode_to_lower(d_inode(dentry))); in ecryptfs_getattr()
1012 generic_fillattr(&init_user_ns, d_inode(dentry), stat); in ecryptfs_getattr()
1019 ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, in ecryptfs_setxattr() argument
1024 struct dentry *lower_dentry; in ecryptfs_setxattr()
1027 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_setxattr()
1043 ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode, in ecryptfs_getxattr_lower()
1060 ecryptfs_getxattr(struct dentry *dentry, struct inode *inode, in ecryptfs_getxattr() argument
1063 return ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry), in ecryptfs_getxattr()
1069 ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size) in ecryptfs_listxattr() argument
1072 struct dentry *lower_dentry; in ecryptfs_listxattr()
1074 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_listxattr()
1086 static int ecryptfs_removexattr(struct dentry *dentry, struct inode *inode, in ecryptfs_removexattr() argument
1090 struct dentry *lower_dentry; in ecryptfs_removexattr()
1093 lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_removexattr()
1106 static int ecryptfs_fileattr_get(struct dentry *dentry, struct fileattr *fa) in ecryptfs_fileattr_get() argument
1108 return vfs_fileattr_get(ecryptfs_dentry_to_lower(dentry), fa); in ecryptfs_fileattr_get()
1112 struct dentry *dentry, struct fileattr *fa) in ecryptfs_fileattr_set() argument
1114 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); in ecryptfs_fileattr_set()
1118 fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry)); in ecryptfs_fileattr_set()
1158 struct dentry *dentry, struct inode *inode, in ecryptfs_xattr_get() argument
1161 return ecryptfs_getxattr(dentry, inode, name, buffer, size); in ecryptfs_xattr_get()
1166 struct dentry *dentry, struct inode *inode, in ecryptfs_xattr_set() argument
1171 return ecryptfs_setxattr(dentry, inode, name, value, size, flags); in ecryptfs_xattr_set()
1174 return ecryptfs_removexattr(dentry, inode, name); in ecryptfs_xattr_set()