From patchwork Wed May 16 21:38:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 10404905 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 E2D3C601D2 for ; Wed, 16 May 2018 21:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D15EE28660 for ; Wed, 16 May 2018 21:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C489E286E6; Wed, 16 May 2018 21:39:07 +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 51F6F28660 for ; Wed, 16 May 2018 21:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751467AbeEPVjE (ORCPT ); Wed, 16 May 2018 17:39:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:52640 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbeEPVjD (ORCPT ); Wed, 16 May 2018 17:39:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DF59BAED2 for ; Wed, 16 May 2018 21:39:01 +0000 (UTC) Received: from starscream.home.jeffm.io (starscream-1.home.jeffm.io [IPv6:2001:559:c0d4::1fe]) by mail.home.jeffm.io (Postfix) with ESMTPS id E2F6881AD3E7; Wed, 16 May 2018 17:38:30 -0400 (EDT) Received: by starscream.home.jeffm.io (Postfix, from userid 1000) id 85BE9816BA; Wed, 16 May 2018 17:39:00 -0400 (EDT) From: jeffm@suse.com To: linux-btrfs@vger.kernel.org Cc: Jeff Mahoney Subject: [PATCH 03/18] btrfs-progs: constify pathnames passed as arguments Date: Wed, 16 May 2018 17:38:36 -0400 Message-Id: <20180516213851.10196-4-jeffm@suse.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180516213851.10196-1-jeffm@suse.com> References: <20180516213851.10196-1-jeffm@suse.com> 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 From: Jeff Mahoney It's unlikely we're going to modify a pathname argument, so codify that and use const. Reviewed-by: Qu Wenruo Signed-off-by: Jeff Mahoney --- chunk-recover.c | 4 ++-- cmds-device.c | 2 +- cmds-fi-usage.c | 6 +++--- cmds-rescue.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chunk-recover.c b/chunk-recover.c index 705bcf52..1d30db51 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -1492,7 +1492,7 @@ out: return ERR_PTR(ret); } -static int recover_prepare(struct recover_control *rc, char *path) +static int recover_prepare(struct recover_control *rc, const char *path) { int ret; int fd; @@ -2296,7 +2296,7 @@ static void validate_rebuild_chunks(struct recover_control *rc) /* * Return 0 when successful, < 0 on error and > 0 if aborted by user */ -int btrfs_recover_chunk_tree(char *path, int verbose, int yes) +int btrfs_recover_chunk_tree(const char *path, int verbose, int yes) { int ret = 0; struct btrfs_root *root = NULL; diff --git a/cmds-device.c b/cmds-device.c index 86459d1b..a49c9d9d 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -526,7 +526,7 @@ static const char * const cmd_device_usage_usage[] = { NULL }; -static int _cmd_device_usage(int fd, char *path, unsigned unit_mode) +static int _cmd_device_usage(int fd, const char *path, unsigned unit_mode) { int i; int ret = 0; diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c index b9a2b1c8..d08ec4d3 100644 --- a/cmds-fi-usage.c +++ b/cmds-fi-usage.c @@ -227,7 +227,7 @@ static int cmp_btrfs_ioctl_space_info(const void *a, const void *b) /* * This function load all the information about the space usage */ -static struct btrfs_ioctl_space_args *load_space_info(int fd, char *path) +static struct btrfs_ioctl_space_args *load_space_info(int fd, const char *path) { struct btrfs_ioctl_space_args *sargs = NULL, *sargs_orig = NULL; int ret, count; @@ -305,7 +305,7 @@ static void get_raid56_used(struct chunk_info *chunks, int chunkcount, #define MIN_UNALOCATED_THRESH SZ_16M static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo, int chunkcount, struct device_info *devinfo, int devcount, - char *path, unsigned unit_mode) + const char *path, unsigned unit_mode) { struct btrfs_ioctl_space_args *sargs = NULL; int i; @@ -933,7 +933,7 @@ static void _cmd_filesystem_usage_linear(unsigned unit_mode, static int print_filesystem_usage_by_chunk(int fd, struct chunk_info *chunkinfo, int chunkcount, struct device_info *devinfo, int devcount, - char *path, unsigned unit_mode, int tabular) + const char *path, unsigned unit_mode, int tabular) { struct btrfs_ioctl_space_args *sargs; int ret = 0; diff --git a/cmds-rescue.c b/cmds-rescue.c index c40088ad..c61145bc 100644 --- a/cmds-rescue.c +++ b/cmds-rescue.c @@ -32,8 +32,8 @@ static const char * const rescue_cmd_group_usage[] = { NULL }; -int btrfs_recover_chunk_tree(char *path, int verbose, int yes); -int btrfs_recover_superblocks(char *path, int verbose, int yes); +int btrfs_recover_chunk_tree(const char *path, int verbose, int yes); +int btrfs_recover_superblocks(const char *path, int verbose, int yes); static const char * const cmd_rescue_chunk_recover_usage[] = { "btrfs rescue chunk-recover [options] ",