- struct bkey_s_c_xattr xattr;
- size_t n = 0;
-
- switch (k.k->type) {
- case BCH_XATTR:
- xattr = bkey_s_c_to_xattr(k);
-
- handler = bch2_xattr_type_to_handler(xattr.v->x_type);
- if (handler && handler->prefix)
- n += scnprintf(buf + n, size - n, "%s", handler->prefix);
- else if (handler)
- n += scnprintf(buf + n, size - n, "(type %u)",
- xattr.v->x_type);
- else
- n += scnprintf(buf + n, size - n, "(unknown type %u)",
- xattr.v->x_type);
-
- n += bch_scnmemcpy(buf + n, size - n, xattr.v->x_name,
- xattr.v->x_name_len);
- n += scnprintf(buf + n, size - n, ":");
- n += bch_scnmemcpy(buf + n, size - n, xattr_val(xattr.v),
- le16_to_cpu(xattr.v->x_val_len));
- break;
- case BCH_XATTR_WHITEOUT:
- scnprintf(buf, size, "whiteout");
- break;
- }
+ struct bkey_s_c_xattr xattr = bkey_s_c_to_xattr(k);
+
+ handler = bch2_xattr_type_to_handler(xattr.v->x_type);
+ if (handler && handler->prefix)
+ pr_buf(out, "%s", handler->prefix);
+ else if (handler)
+ pr_buf(out, "(type %u)", xattr.v->x_type);
+ else
+ pr_buf(out, "(unknown type %u)", xattr.v->x_type);
+
+ pr_buf(out, "%.*s:%.*s",
+ xattr.v->x_name_len,
+ xattr.v->x_name,
+ le16_to_cpu(xattr.v->x_val_len),
+ (char *) xattr_val(xattr.v));