From patchwork Mon Jun 18 08:41:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10470183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2E2F600CC for ; Mon, 18 Jun 2018 08:41:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95EF62899B for ; Mon, 18 Jun 2018 08:41:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93708289A3; Mon, 18 Jun 2018 08:41:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B2252899B for ; Mon, 18 Jun 2018 08:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968132AbeFRIlQ (ORCPT ); Mon, 18 Jun 2018 04:41:16 -0400 Received: from mgwym03.jp.fujitsu.com ([211.128.242.42]:18248 "EHLO mgwym03.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968212AbeFRIiS (ORCPT ); Mon, 18 Jun 2018 04:38:18 -0400 Received: from yt-mxoi1.gw.nic.fujitsu.com (unknown [192.168.229.67]) by mgwym03.jp.fujitsu.com with smtp id 2671_647a_ac1aa152_65d3_45e9_97fa_a5ca72457271; Mon, 18 Jun 2018 17:38:11 +0900 Received: from g01jpfmpwkw03.exch.g01.fujitsu.local (g01jpfmpwkw03.exch.g01.fujitsu.local [10.0.193.57]) by yt-mxoi1.gw.nic.fujitsu.com (Postfix) with ESMTP id 2AA0BAC0195 for ; Mon, 18 Jun 2018 17:38:11 +0900 (JST) Received: from g01jpexchkw33.g01.fujitsu.local (unknown [10.0.193.4]) by g01jpfmpwkw03.exch.g01.fujitsu.local (Postfix) with ESMTP id 4A9E8BD670B for ; Mon, 18 Jun 2018 17:38:10 +0900 (JST) Received: from luna3.soft.fujitsu.com (10.124.196.199) by g01jpexchkw33.g01.fujitsu.local (10.0.193.36) with Microsoft SMTP Server id 14.3.352.0; Mon, 18 Jun 2018 17:38:08 +0900 From: Misono Tomohiro To: Subject: [PATCH v2 15/20] btrfs-progs: sub list: Update help message of -d option Date: Mon, 18 Jun 2018 17:41:03 +0900 Message-ID: <113c9e55f4eb4fab5fb991be0fe1288f64f66316.1529310485.git.misono.tomohiro@jp.fujitsu.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: References: MIME-Version: 1.0 X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Explicitly states that -d requires root privileges. Also, update some option handling with regard to -d option. Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 3 ++- cmds-subvolume.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/btrfs-subvolume.asciidoc b/Documentation/btrfs-subvolume.asciidoc index 0381c92c..2db1d479 100644 --- a/Documentation/btrfs-subvolume.asciidoc +++ b/Documentation/btrfs-subvolume.asciidoc @@ -149,7 +149,8 @@ only snapshot subvolumes in the filesystem will be listed. -r:::: only readonly subvolumes in the filesystem will be listed. -d:::: -list deleted subvolumes that are not yet cleaned. +list deleted subvolumes that are not yet cleaned +(require root privileges). Other;; -t:::: diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 552c6dea..ef39789a 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -1569,6 +1569,7 @@ static const char * const cmd_subvol_list_usage[] = { "-s list only snapshots", "-r list readonly subvolumes (including snapshots)", "-d list deleted subvolumes that are not yet cleaned", + " (require root privileges)", "", "Other:", "-t print the result as a table", @@ -1744,6 +1745,13 @@ static int cmd_subvol_list(int argc, char **argv) goto out; } + if (filter_set->only_deleted && + (is_list_all || absolute_path || follow_mount)) { + ret = -1; + error("cannot use -d with -a/f/A option"); + goto out; + } + subvol = argv[optind]; fd = btrfs_open_dir(subvol, &dirstream, 1); if (fd < 0) {