From patchwork Sun Oct 24 15:31:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 12580289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 142ABC433EF for ; Sun, 24 Oct 2021 15:39:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEC5960F21 for ; Sun, 24 Oct 2021 15:39:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbhJXPl6 (ORCPT ); Sun, 24 Oct 2021 11:41:58 -0400 Received: from michael.mail.tiscali.it ([213.205.33.246]:57670 "EHLO smtp.tiscali.it" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229782AbhJXPl5 (ORCPT ); Sun, 24 Oct 2021 11:41:57 -0400 Received: from venice.bhome ([78.14.151.87]) by michael.mail.tiscali.it with id 9rXD2600J1tPKGW01rXFcG; Sun, 24 Oct 2021 15:31:15 +0000 x-auth-user: kreijack@tiscali.it From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: Zygo Blaxell , Josef Bacik , David Sterba , Sinnamohideen Shafeeq , Goffredo Baroncelli Subject: [PATCH 2/4] btrfs: export dev_item.type in /sys/fs/btrfs//devinfo//type Date: Sun, 24 Oct 2021 17:31:05 +0200 Message-Id: X-Mailer: git-send-email 2.33.0 In-Reply-To: References: Reply-To: Goffredo Baroncelli MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tiscali.it; s=smtp; t=1635089475; bh=W5o/8h2LP5LdTJv0fuy5y5Z31rMYGwZQk4NuTKsxz8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To; b=yilIOOcYctLF/DcA3+ylYukNc17RTq0h6i9TjG+Q5qgxOTrpOJLKvuqbFYKsl6wsN PXvjfoX0tma7g3yAJH+CRMf0SOrawG6fZaJt0hJnadA8ApOO0MujkwmgU7mO/isArG 6dDZsQwJEFZ1UdXGnax5NsH1G+HeVuosrXd0cE4U= Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Goffredo Baroncelli Signed-off-by: Goffredo Baroncelli --- fs/btrfs/sysfs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 9d1d140118ff..402b98acf2aa 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1510,6 +1510,16 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj, } BTRFS_ATTR(devid, error_stats, btrfs_devinfo_error_stats_show); +static ssize_t btrfs_devinfo_type_show(struct kobject *kobj, + struct kobj_attribute *a, char *buf) +{ + struct btrfs_device *device = container_of(kobj, struct btrfs_device, + devid_kobj); + + return scnprintf(buf, PAGE_SIZE, "0x%08llx\n", device->type); +} +BTRFS_ATTR(devid, type, btrfs_devinfo_type_show); + static struct attribute *devid_attrs[] = { BTRFS_ATTR_PTR(devid, error_stats), BTRFS_ATTR_PTR(devid, in_fs_metadata), @@ -1517,6 +1527,7 @@ static struct attribute *devid_attrs[] = { BTRFS_ATTR_PTR(devid, replace_target), BTRFS_ATTR_PTR(devid, scrub_speed_max), BTRFS_ATTR_PTR(devid, writeable), + BTRFS_ATTR_PTR(devid, type), NULL }; ATTRIBUTE_GROUPS(devid);