From patchwork Mon Jun 18 08:40:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10470209 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 4055B600CC for ; Mon, 18 Jun 2018 08:42:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3366C28448 for ; Mon, 18 Jun 2018 08:42:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2805B287E7; Mon, 18 Jun 2018 08:42:42 +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 AD2ED28448 for ; Mon, 18 Jun 2018 08:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968295AbeFRIlw (ORCPT ); Mon, 18 Jun 2018 04:41:52 -0400 Received: from mgwym01.jp.fujitsu.com ([211.128.242.40]:56184 "EHLO mgwym01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968192AbeFRIiN (ORCPT ); Mon, 18 Jun 2018 04:38:13 -0400 Received: from yt-mxauth.gw.nic.fujitsu.com (unknown [192.168.229.68]) by mgwym01.jp.fujitsu.com with smtp id 7f48_4027_de2d679b_538d_4981_983e_23e049bae35a; Mon, 18 Jun 2018 17:38:09 +0900 Received: from g01jpfmpwkw01.exch.g01.fujitsu.local (g01jpfmpwkw01.exch.g01.fujitsu.local [10.0.193.38]) by yt-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id 65812AC0248 for ; Mon, 18 Jun 2018 17:38:09 +0900 (JST) Received: from g01jpexchkw33.g01.fujitsu.local (unknown [10.0.193.4]) by g01jpfmpwkw01.exch.g01.fujitsu.local (Postfix) with ESMTP id 7CA3C69240C for ; Mon, 18 Jun 2018 17:38:08 +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:06 +0900 From: Misono Tomohiro To: Subject: [PATCH v2 05/20] btrfs-progs: libbtrfsuitl: Factor out btrfs_util_subvolume_iterator_next() Date: Mon, 18 Jun 2018 17:40:53 +0900 Message-ID: <83104ddacbf4d6dbfd6adaa88930c4029a9282f3.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 Factor out the main logic of btrfs_util_subvolume_iterator_next(). This is a preparation work to relax the root privilege of this function. No functional change happens. Signed-off-by: Misono Tomohiro --- libbtrfsutil/subvolume.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libbtrfsutil/subvolume.c b/libbtrfsutil/subvolume.c index e94c7079..73471d4f 100644 --- a/libbtrfsutil/subvolume.c +++ b/libbtrfsutil/subvolume.c @@ -1255,9 +1255,9 @@ 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, - char **path_ret, - uint64_t *id_ret) +static enum btrfs_util_error subvolume_iterator_next_root(struct btrfs_util_subvolume_iterator *iter, + char **path_ret, + uint64_t *id_ret) { struct search_stack_entry *top; const struct btrfs_ioctl_search_header *header; @@ -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)