-/*
- * @param name - the xattr name
- * @return - the xattr_handler for the xattr, NULL if its not found
- *
- * use this with listxattr where we don't already know the type of xattr we
- * have
- */
-static struct xattr_handler *find_btrfs_xattr_handler(struct extent_buffer *l,
- unsigned long name_ptr,
- u16 name_len)
-{
- struct xattr_handler *handler = NULL;
- int i = 0;
-
- for (handler = btrfs_xattr_handlers[i]; handler != NULL; i++,
- handler = btrfs_xattr_handlers[i]) {
- u16 prefix_len = strlen(handler->prefix);
-
- if (name_len < prefix_len)
- continue;
-
- if (memcmp_extent_buffer(l, handler->prefix, name_ptr,
- prefix_len) == 0)
- break;
- }
-
- return handler;
-}
-
-/*
- * @param name_index - the index for the xattr handler
- * @return the xattr_handler if we found it, NULL otherwise
- *
- * use this if we know the type of the xattr already
- */
-static struct xattr_handler *btrfs_xattr_handler(int name_index)
-{
- struct xattr_handler *handler = NULL;
-
- if (name_index >= 0 &&
- name_index < ARRAY_SIZE(btrfs_xattr_handler_map))
- handler = btrfs_xattr_handler_map[name_index];
-
- return handler;
-}
-
-static inline char *get_name(const char *name, int name_index)
-{
- char *ret = NULL;
- struct xattr_handler *handler = btrfs_xattr_handler(name_index);
- int prefix_len;
-
- if (!handler)
- return ret;
-
- prefix_len = strlen(handler->prefix);
-
- ret = kmalloc(strlen(name) + prefix_len + 1, GFP_KERNEL);
- if (!ret)
- return ret;
-
- memcpy(ret, handler->prefix, prefix_len);
- memcpy(ret+prefix_len, name, strlen(name));
- ret[prefix_len + strlen(name)] = '\0';
-
- return ret;
-}
-
-size_t btrfs_xattr_generic_list(struct inode *inode, char *list,
- size_t list_size, const char *name,
- size_t name_len)
-{
- if (list && (name_len+1) <= list_size) {
- memcpy(list, name, name_len);
- list[name_len] = '\0';
- } else
- return -ERANGE;
-
- return name_len+1;
-}
-
-ssize_t btrfs_xattr_get(struct inode *inode, int name_index,
- const char *attr_name, void *buffer, size_t size)