From patchwork Wed Dec 6 19:32:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 13482205 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tiscali.it header.i=@tiscali.it header.b="0XHSktNv" X-Greylist: delayed 64 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 06 Dec 2023 11:52:27 PST Received: from smtp.tiscali.it (santino.mail.tiscali.it [213.205.33.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 99467FA for ; Wed, 6 Dec 2023 11:52:27 -0800 (PST) Received: from venice.bhome ([84.220.171.3]) by santino.mail.tiscali.it with id K7rM2B00T04l9eU017rMWX; Wed, 06 Dec 2023 19:51:22 +0000 X-Spam-Final-Verdict: clean X-Spam-State: 0 X-Spam-Score: -100 X-Spam-Verdict: clean x-auth-user: kreijack@tiscali.it From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: David Sterba , Goffredo Baroncelli Subject: [PATCH 0/4] RFC: add the btrfs_info helper Date: Wed, 6 Dec 2023 20:32:41 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 Reply-To: Goffredo Baroncelli Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tiscali.it; s=smtp; t=1701892282; bh=/Py/Q3SFsBIS7vXoE3drYtcYTpe97S9QxCVIzK1/9zk=; h=From:To:Cc:Subject:Date:Reply-To; b=0XHSktNvLuk9NWdm/9BXD75XMVAXXiOZGdlIzkw5yheJagQkH7C9WemFG37yyIxxk TrU7zso0d5Xi9Up/XmJ4P0eGnG1rt33WExRcr0aQgE8zDVztEH7miQ6l5T+D10Cvqb oVBEhAzwZ8CPUMFsdD7aCSlvud30HMY76r+zTe8U= From: Goffredo Baroncelli The aim of this patches set is to add some helper to query the layout of a btrfs filesystem. A btrfs filesystem may be composed by multiple disks, and several mountpoints on which different subvolumes are mounted. Sometime we need to know the devices list starting from a path, or a path starting from a device. These helpers allow to know all the information of a filesystem like - UUID - Label - Mountpoints list (if mounted), and for each mountpoint - subvolume - options - Devices list, and for each device - major, minor - device name - partuuid, uuid_sub - devid (if the user is root) And it is possible to build these information giving any of: - a path (if mounted) - UUID - Label - partuuid - uuid_sub These helpers uses only libblkid and /proc/self/mountinfo to extract all these information. It is not required to be root; if the user is root it is returned also the devid of a device. The first patch add the helpers. From the second patch there are two new commands ('btrfs fi info' and 'btrfs fi get-info') and an enachement of 'btrfs fi label', which can be used passing both a device or a path, or UUID=, LABEL=