Lines Matching refs:dentry
62 static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) in xattr_create() argument
65 return dir->i_op->create(dir, dentry, mode, NULL); in xattr_create()
69 static int xattr_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) in xattr_mkdir() argument
72 return dir->i_op->mkdir(dir, dentry, mode); in xattr_mkdir()
79 static int xattr_unlink(struct inode *dir, struct dentry *dentry) in xattr_unlink() argument
84 reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, in xattr_unlink()
86 error = dir->i_op->unlink(dir, dentry); in xattr_unlink()
87 mutex_unlock(&dentry->d_inode->i_mutex); in xattr_unlink()
90 d_delete(dentry); in xattr_unlink()
94 static int xattr_rmdir(struct inode *dir, struct dentry *dentry) in xattr_rmdir() argument
99 reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, in xattr_rmdir()
101 error = dir->i_op->rmdir(dir, dentry); in xattr_rmdir()
103 dentry->d_inode->i_flags |= S_DEAD; in xattr_rmdir()
104 mutex_unlock(&dentry->d_inode->i_mutex); in xattr_rmdir()
106 d_delete(dentry); in xattr_rmdir()
113 static struct dentry *open_xa_root(struct super_block *sb, int flags) in open_xa_root()
115 struct dentry *privroot = REISERFS_SB(sb)->priv_root; in open_xa_root()
116 struct dentry *xaroot; in open_xa_root()
139 static struct dentry *open_xa_dir(const struct inode *inode, int flags) in open_xa_dir()
141 struct dentry *xaroot, *xadir; in open_xa_dir()
174 struct dentry *xadir;
176 struct dentry *dentries[8];
184 struct dentry *dentry; in fill_with_dentries() local
194 dentry = lookup_one_len(name, dbuf->xadir, namelen); in fill_with_dentries()
195 if (IS_ERR(dentry)) { in fill_with_dentries()
196 return PTR_ERR(dentry); in fill_with_dentries()
197 } else if (!dentry->d_inode) { in fill_with_dentries()
199 reiserfs_error(dentry->d_sb, "xattr-20003", in fill_with_dentries()
202 dentry->d_name.name, dbuf->xadir->d_name.name); in fill_with_dentries()
203 dput(dentry); in fill_with_dentries()
207 dbuf->dentries[dbuf->count++] = dentry; in fill_with_dentries()
221 int (*action)(struct dentry *, void *), in reiserfs_for_each_xattr() argument
224 struct dentry *dir; in reiserfs_for_each_xattr()
258 struct dentry *dentry = buf.dentries[i]; in reiserfs_for_each_xattr() local
260 if (err == 0 && !S_ISDIR(dentry->d_inode->i_mode)) in reiserfs_for_each_xattr()
261 lerr = action(dentry, data); in reiserfs_for_each_xattr()
263 dput(dentry); in reiserfs_for_each_xattr()
307 static int delete_one_xattr(struct dentry *dentry, void *data) in delete_one_xattr() argument
309 struct inode *dir = dentry->d_parent->d_inode; in delete_one_xattr()
312 if (S_ISDIR(dentry->d_inode->i_mode)) in delete_one_xattr()
313 return xattr_rmdir(dir, dentry); in delete_one_xattr()
315 return xattr_unlink(dir, dentry); in delete_one_xattr()
318 static int chown_one_xattr(struct dentry *dentry, void *data) in chown_one_xattr() argument
321 return reiserfs_setattr(dentry, attrs); in chown_one_xattr()
348 static struct dentry *xattr_lookup(struct inode *inode, const char *name, in xattr_lookup()
351 struct dentry *xadir, *xafile; in xattr_lookup()
434 struct dentry *dentry, *xadir; in lookup_and_delete_xattr() local
441 dentry = lookup_one_len(name, xadir, strlen(name)); in lookup_and_delete_xattr()
442 if (IS_ERR(dentry)) { in lookup_and_delete_xattr()
443 err = PTR_ERR(dentry); in lookup_and_delete_xattr()
447 if (dentry->d_inode) { in lookup_and_delete_xattr()
449 err = xattr_unlink(xadir->d_inode, dentry); in lookup_and_delete_xattr()
454 dput(dentry); in lookup_and_delete_xattr()
473 struct dentry *dentry; in reiserfs_xattr_set_handle() local
492 dentry = xattr_lookup(inode, name, flags); in reiserfs_xattr_set_handle()
493 if (IS_ERR(dentry)) { in reiserfs_xattr_set_handle()
495 return PTR_ERR(dentry); in reiserfs_xattr_set_handle()
512 page = reiserfs_get_page(dentry->d_inode, file_pos); in reiserfs_xattr_set_handle()
549 if (!err && new_size < i_size_read(dentry->d_inode)) { in reiserfs_xattr_set_handle()
557 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); in reiserfs_xattr_set_handle()
558 inode_dio_wait(dentry->d_inode); in reiserfs_xattr_set_handle()
561 err = reiserfs_setattr(dentry, &newattrs); in reiserfs_xattr_set_handle()
562 mutex_unlock(&dentry->d_inode->i_mutex); in reiserfs_xattr_set_handle()
567 dput(dentry); in reiserfs_xattr_set_handle()
609 struct dentry *dentry; in reiserfs_xattr_get() local
624 dentry = xattr_lookup(inode, name, XATTR_REPLACE); in reiserfs_xattr_get()
625 if (IS_ERR(dentry)) { in reiserfs_xattr_get()
626 err = PTR_ERR(dentry); in reiserfs_xattr_get()
632 isize = i_size_read(dentry->d_inode); in reiserfs_xattr_get()
654 page = reiserfs_get_page(dentry->d_inode, file_pos); in reiserfs_xattr_get()
699 dput(dentry); in reiserfs_xattr_get()
742 reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, in reiserfs_getxattr() argument
747 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); in reiserfs_getxattr()
749 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) in reiserfs_getxattr()
752 return handler->get(dentry, name, buffer, size, handler->flags); in reiserfs_getxattr()
761 reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, in reiserfs_setxattr() argument
766 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); in reiserfs_setxattr()
768 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) in reiserfs_setxattr()
771 return handler->set(dentry, name, value, size, flags, handler->flags); in reiserfs_setxattr()
779 int reiserfs_removexattr(struct dentry *dentry, const char *name) in reiserfs_removexattr() argument
782 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); in reiserfs_removexattr()
784 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) in reiserfs_removexattr()
787 return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); in reiserfs_removexattr()
794 struct dentry *dentry; member
805 handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr, in listxattr_filler()
810 size = handler->list(b->dentry, b->buf + b->pos, in listxattr_filler()
816 size = handler->list(b->dentry, NULL, 0, name, in listxattr_filler()
832 ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) in reiserfs_listxattr() argument
834 struct dentry *dir; in reiserfs_listxattr()
838 .dentry = dentry, in reiserfs_listxattr()
843 if (!dentry->d_inode) in reiserfs_listxattr()
846 if (!dentry->d_sb->s_xattr || in reiserfs_listxattr()
847 get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) in reiserfs_listxattr()
850 dir = open_xa_dir(dentry->d_inode, XATTR_REPLACE); in reiserfs_listxattr()
870 static int create_privroot(struct dentry *dentry) in create_privroot() argument
873 struct inode *inode = dentry->d_parent->d_inode; in create_privroot()
876 err = xattr_mkdir(inode, dentry, 0700); in create_privroot()
877 if (err || !dentry->d_inode) { in create_privroot()
878 reiserfs_warning(dentry->d_sb, "jdm-20006", in create_privroot()
885 dentry->d_inode->i_flags |= S_PRIVATE; in create_privroot()
886 reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " in create_privroot()
895 static int create_privroot(struct dentry *dentry) { return 0; } in create_privroot() argument
945 static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd) in xattr_hide_revalidate() argument
956 struct dentry *dentry; in reiserfs_lookup_privroot() local
961 dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, in reiserfs_lookup_privroot()
963 if (!IS_ERR(dentry)) { in reiserfs_lookup_privroot()
964 REISERFS_SB(s)->priv_root = dentry; in reiserfs_lookup_privroot()
965 d_set_d_op(dentry, &xattr_lookup_poison_ops); in reiserfs_lookup_privroot()
966 if (dentry->d_inode) in reiserfs_lookup_privroot()
967 dentry->d_inode->i_flags |= S_PRIVATE; in reiserfs_lookup_privroot()
969 err = PTR_ERR(dentry); in reiserfs_lookup_privroot()
981 struct dentry *privroot = REISERFS_SB(s)->priv_root; in reiserfs_xattr_init()
997 struct dentry *dentry; in reiserfs_xattr_init() local
998 dentry = lookup_one_len(XAROOT_NAME, privroot, in reiserfs_xattr_init()
1000 if (!IS_ERR(dentry)) in reiserfs_xattr_init()
1001 REISERFS_SB(s)->xattr_root = dentry; in reiserfs_xattr_init()
1003 err = PTR_ERR(dentry); in reiserfs_xattr_init()