From patchwork Fri May 11 07:29:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10393391 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 A210D602B1 for ; Fri, 11 May 2018 07:28:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DC5F28AEF for ; Fri, 11 May 2018 07:28:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 423A328AF2; Fri, 11 May 2018 07:28:10 +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 BFBAF28AE1 for ; Fri, 11 May 2018 07:28:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580AbeEKH1g (ORCPT ); Fri, 11 May 2018 03:27:36 -0400 Received: from mgwkm01.jp.fujitsu.com ([202.219.69.168]:44835 "EHLO mgwkm01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbeEKH1e (ORCPT ); Fri, 11 May 2018 03:27:34 -0400 Received: from kw-mxq.gw.nic.fujitsu.com (unknown [192.168.231.130]) by mgwkm01.jp.fujitsu.com with smtp id 1afa_1a65_1756ffbf_91ad_4369_aaf6_729b1bfd83cd; Fri, 11 May 2018 16:27:31 +0900 Received: from g01jpfmpwkw01.exch.g01.fujitsu.local (g01jpfmpwkw01.exch.g01.fujitsu.local [10.0.193.38]) by kw-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id 6D632AC0209 for ; Fri, 11 May 2018 16:27:31 +0900 (JST) Received: from g01jpexchkw35.g01.fujitsu.local (unknown [10.0.193.4]) by g01jpfmpwkw01.exch.g01.fujitsu.local (Postfix) with ESMTP id 9F2246926ED for ; Fri, 11 May 2018 16:27:30 +0900 (JST) Received: from luna3.soft.fujitsu.com (10.124.196.199) by g01jpexchkw35.g01.fujitsu.local (10.0.193.50) with Microsoft SMTP Server id 14.3.352.0; Fri, 11 May 2018 16:27:30 +0900 From: Tomohiro Misono To: Subject: [PATCH 04/11] btrfs-progs: libbtrfsuitl: Factor out btrfs_util_subvolume_iterator_next() Date: Fri, 11 May 2018 16:29:42 +0900 Message-ID: <20180511072949.15269-5-misono.tomohiro@jp.fujitsu.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180511072949.15269-1-misono.tomohiro@jp.fujitsu.com> References: <20180511072949.15269-1-misono.tomohiro@jp.fujitsu.com> 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 Factor out the main logic of btrfs_util_subvolume_iterator_next(). This is a prepareation work to update the behavior of this function and relax the required root privilege. No functional change happens. Signed-off-by: Tomohiro Misono --- libbtrfsutil/subvolume.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libbtrfsutil/subvolume.c b/libbtrfsutil/subvolume.c index 3ce6e0a6..08bbeca2 100644 --- a/libbtrfsutil/subvolume.c +++ b/libbtrfsutil/subvolume.c @@ -1255,7 +1255,7 @@ static enum btrfs_util_error build_subvol_path(struct btrfs_util_subvolume_itera return BTRFS_UTIL_OK; } -PUBLIC enum btrfs_util_error btrfs_util_subvolume_iterator_next(struct btrfs_util_subvolume_iterator *iter, +static enum btrfs_util_error subvolume_iterator_next_root(struct btrfs_util_subvolume_iterator *iter, char **path_ret, uint64_t *id_ret) { @@ -1331,6 +1331,13 @@ out: return BTRFS_UTIL_OK; } +PUBLIC enum btrfs_util_error btrfs_util_subvolume_iterator_next(struct btrfs_util_subvolume_iterator *iter, + char **path_ret, + uint64_t *id_ret) +{ + return subvolume_iterator_next_root(iter, path_ret, id_ret); +} + PUBLIC enum btrfs_util_error btrfs_util_subvolume_iterator_next_info(struct btrfs_util_subvolume_iterator *iter, char **path_ret, struct btrfs_util_subvolume_info *subvol)