- struct ext2_xattr_handler *handler = NULL;
- if (name_index > 0 && name_index <= EXT2_XATTR_INDEX_MAX) {
- read_lock(&ext2_handler_lock);
- handler = ext2_xattr_handlers[name_index-1];
- read_unlock(&ext2_handler_lock);
- }
- return handler;
-}
-
-/*
- * Inode operation getxattr()
- *
- * dentry->d_inode->i_sem: don't care
- */
-ssize_t
-ext2_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size)
-{
- struct ext2_xattr_handler *handler;
- struct inode *inode = dentry->d_inode;
-
- handler = ext2_xattr_resolve_name(&name);
- if (!handler)
- return -EOPNOTSUPP;
- return handler->get(inode, name, buffer, size);
-}
-
-/*
- * Inode operation listxattr()
- *
- * dentry->d_inode->i_sem: don't care
- */
-ssize_t
-ext2_listxattr(struct dentry *dentry, char *buffer, size_t size)
-{
- return ext2_xattr_list(dentry->d_inode, buffer, size);
-}
-
-/*
- * Inode operation setxattr()
- *
- * dentry->d_inode->i_sem: down
- */
-int
-ext2_setxattr(struct dentry *dentry, const char *name,
- const void *value, size_t size, int flags)
-{
- struct ext2_xattr_handler *handler;
- struct inode *inode = dentry->d_inode;
-
- if (size == 0)
- value = ""; /* empty EA, do not remove */
- handler = ext2_xattr_resolve_name(&name);
- if (!handler)
- return -EOPNOTSUPP;
- return handler->set(inode, name, value, size, flags);
-}