/* Combine the results of the list() operation from every xattr_handler in the list.  */
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
/* Combine the results of the list() operation from every xattr_handler in the list.  */
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
{
	struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr;
	unsigned int size = 0;
	if (!buffer) {
		for_each_xattr_handler(handlers, handler) {
			size += handler->list(dentry, NULL, 0, NULL, 0,
					      handler->flags);
		}
	} else {
		char *buf = buffer;
		for_each_xattr_handler(handlers, handler) {
			size = handler->list(dentry, buf, buffer_size,
					     NULL, 0, handler->flags);
			if (size > buffer_size)
				return -ERANGE;
			buf += size;
			buffer_size -= size;
		}
		size = buf - buffer;
	}
	return size;
}