From patchwork Sun Sep 3 15:00:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 809312 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="YcyOktc8"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xlbr93shGz9t2y for ; Mon, 4 Sep 2017 01:05:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 456D9C21EB1; Sun, 3 Sep 2017 15:04:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1EB96C21F34; Sun, 3 Sep 2017 15:01:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 66043C21D70; Sun, 3 Sep 2017 15:01:34 +0000 (UTC) Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) by lists.denx.de (Postfix) with ESMTPS id BCA16C21D79 for ; Sun, 3 Sep 2017 15:01:33 +0000 (UTC) Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:8982:ed8c:62b1:c0c8]) by mail.nic.cz (Postfix) with ESMTP id 7569762404; Sun, 3 Sep 2017 17:01:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1504450893; bh=PGDxor5uXc6lgjgc9bDM34btajGdsDHA8pi4Olewjec=; h=From:To:Date; b=YcyOktc8uTJZ6hJVsXvKSD36LWCZeNE+m/TFk7qFiVbF87rbWtTbMk4j2r9IE3xaQ W9/e0wuSFa/QN/E2j+f0vOo44pxEC9pZr+N8TjxxP+QH2nuQhzdSYxq8rSUmY4/901 1E5AD2FiLmmIDI9wqg0xxK7mYoi03fG1YAopgB1U= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: u-boot@lists.denx.de Date: Sun, 3 Sep 2017 17:00:30 +0200 Message-Id: <20170903150031.18179-9-marek.behun@nic.cz> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170903150031.18179-1-marek.behun@nic.cz> References: <20170903150031.18179-1-marek.behun@nic.cz> X-Virus-Scanned: clamav-milter 0.99.2 at mail X-Virus-Status: Clean Cc: Tomas Hlavacek , Stefan Roese , =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [U-Boot] [PATCH 8/9] cmd: Add the 'btrsubvol' command to list BTRFS subvolumes X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Marek Behun create mode 100644 cmd/btrfs.c diff --git a/cmd/Kconfig b/cmd/Kconfig index d6d130edfa..77623052c4 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1311,6 +1311,16 @@ config CMD_CROS_EC endmenu menu "Filesystem commands" +config CMD_BTRFS + bool "Enable the 'btrsubvol' command" + select FS_BTRFS + help + This enables the 'btrsubvol' command to list subvolumes + of a BTRFS filesystem. There are no special commands for + listing BTRFS directories or loading BTRFS files - this + can be done by the generic 'fs' commands (see CMD_FS_GENERIC) + when BTRFS is enabled (see FS_BTRFS). + config CMD_CBFS bool "Enable the 'cbfs' command" depends on FS_CBFS diff --git a/cmd/Makefile b/cmd/Makefile index 2a5b8ce825..2b0444d5b7 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_CMD_BOOTMENU) += bootmenu.o obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o obj-$(CONFIG_CMD_BOOTZ) += bootz.o obj-$(CONFIG_CMD_BOOTI) += booti.o +obj-$(CONFIG_CMD_BTRFS) += btrfs.o obj-$(CONFIG_CMD_CACHE) += cache.o obj-$(CONFIG_CMD_CBFS) += cbfs.o obj-$(CONFIG_CMD_CLK) += clk.o diff --git a/cmd/btrfs.c b/cmd/btrfs.c new file mode 100644 index 0000000000..3f4f1b782b --- /dev/null +++ b/cmd/btrfs.c @@ -0,0 +1,28 @@ +/* + * 2017 by Marek Behun + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include + +int do_btrsubvol(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + if (argc != 3) + return CMD_RET_USAGE; + + if (fs_set_blk_dev(argv[1], argv[2], FS_TYPE_BTRFS)) + return 1; + + btrfs_list_subvols(); + return 0; +} + +U_BOOT_CMD(btrsubvol, 3, 1, do_btrsubvol, + "list subvolumes of a BTRFS filesystem", + " \n" + " - List subvolumes of a BTRFS filesystem." +)