From patchwork Fri Oct 5 04:03:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F487184E for ; Fri, 5 Oct 2018 04:03:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 501282881E for ; Fri, 5 Oct 2018 04:03:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44D642907B; Fri, 5 Oct 2018 04:03:26 +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 000C728884 for ; Fri, 5 Oct 2018 04:03:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726753AbeJELAM (ORCPT ); Fri, 5 Oct 2018 07:00:12 -0400 Received: from sandeen.net ([63.231.237.45]:48088 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727176AbeJELAM (ORCPT ); Fri, 5 Oct 2018 07:00:12 -0400 Received: by sandeen.net (Postfix, from userid 500) id CEA14544; Thu, 4 Oct 2018 23:03:17 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 01/15] xfsprogs: minor sparse fixes Date: Thu, 4 Oct 2018 23:03:02 -0500 Message-Id: <1538712196-13625-2-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen Remove stray semicolon, add missing return. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- io/init.c | 1 + repair/agheader.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/io/init.c b/io/init.c index 82774c7..e9449a2 100644 --- a/io/init.c +++ b/io/init.c @@ -240,6 +240,7 @@ idle_loop(void *arg) { for (;;) pause(); + return NULL; } void diff --git a/repair/agheader.c b/repair/agheader.c index 77e04f6..218ee25 100644 --- a/repair/agheader.c +++ b/repair/agheader.c @@ -245,7 +245,7 @@ secondary_sb_whack( int do_bzero = 0; int size; char *ip; - int rval = 0;; + int rval = 0; uuid_t tmpuuid; rval = do_bzero = 0; From patchwork Fri Oct 5 04:03:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB4AC3B73 for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBFEE2907B for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B042729340; Fri, 5 Oct 2018 04:03:29 +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 6876E2907B for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727176AbeJELAM (ORCPT ); Fri, 5 Oct 2018 07:00:12 -0400 Received: from sandeen.net ([63.231.237.45]:48090 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727134AbeJELAM (ORCPT ); Fri, 5 Oct 2018 07:00:12 -0400 Received: by sandeen.net (Postfix, from userid 500) id E846D54F; Thu, 4 Oct 2018 23:03:17 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 02/15] xfsprogs: use ANSI declarations of void-arg functions Date: Thu, 4 Oct 2018 23:03:03 -0500 Message-Id: <1538712196-13625-3-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- db/io.h | 2 +- io/init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/io.h b/db/io.h index a60aaaa..8d5720b 100644 --- a/db/io.h +++ b/db/io.h @@ -59,7 +59,7 @@ extern void xfs_verify_recalc_crc(struct xfs_buf *bp); * returns -1 for unchecked, 0 for bad and 1 for good */ static inline int -iocur_crc_valid() +iocur_crc_valid(void) { if (!iocur_top->bp) return -1; diff --git a/io/init.c b/io/init.c index e9449a2..29afe09 100644 --- a/io/init.c +++ b/io/init.c @@ -244,7 +244,7 @@ idle_loop(void *arg) } void -start_idle_thread() +start_idle_thread(void) { pthread_t t; From patchwork Fri Oct 5 04:03:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 326711926 for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22B082881E for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EB662925D; Fri, 5 Oct 2018 04:03:27 +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 C673A28884 for ; Fri, 5 Oct 2018 04:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727134AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: from sandeen.net ([63.231.237.45]:48092 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727456AbeJELAM (ORCPT ); Fri, 5 Oct 2018 07:00:12 -0400 Received: by sandeen.net (Postfix, from userid 500) id 0FF50559; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 03/15] mkfs.xfs: include full parser prototype in subopts definition Date: Thu, 4 Oct 2018 23:03:04 -0500 Message-Id: <1538712196-13625-4-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- mkfs/xfs_mkfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 7c05c6f..2eec005 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1661,7 +1661,10 @@ sector_opts_parser( struct subopts { char opt; struct opt_params *opts; - int (*parser)(); + int (*parser)(struct opt_params *opts, + int subopt, + char *value, + struct cli_params *cli); } subopt_tab[] = { { 'b', &bopts, block_opts_parser }, { 'd', &dopts, data_opts_parser }, From patchwork Fri Oct 5 04:03:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87C61112B for ; Fri, 5 Oct 2018 04:03:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 789A32881E for ; Fri, 5 Oct 2018 04:03:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D2FC28884; Fri, 5 Oct 2018 04:03:26 +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 241CE2925B for ; Fri, 5 Oct 2018 04:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727456AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: from sandeen.net ([63.231.237.45]:48094 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727535AbeJELAM (ORCPT ); Fri, 5 Oct 2018 07:00:12 -0400 Received: by sandeen.net (Postfix, from userid 500) id 2A562EDE; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 04/15] xfs_db: single-bit bitfields are unsigned Date: Thu, 4 Oct 2018 23:03:05 -0500 Message-Id: <1538712196-13625-5-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen --- db/check.c | 4 ++-- db/io.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/check.c b/db/check.c index e85afb9..76a833a 100644 --- a/db/check.c +++ b/db/check.c @@ -41,8 +41,8 @@ typedef struct inodata { struct inodata *next; nlink_t link_set; nlink_t link_add; - char isdir:1; - char isreflink:1; + unsigned char isdir:1; + unsigned char isreflink:1; char security; char ilist; xfs_ino_t ino; diff --git a/db/io.h b/db/io.h index 8d5720b..9fd2651 100644 --- a/db/io.h +++ b/db/io.h @@ -26,10 +26,10 @@ typedef struct iocur { const struct typ *typ; /* type of "data" */ bbmap_t *bbmap; /* map daddr if fragmented */ struct xfs_buf *bp; /* underlying buffer */ - int ino_crc_ok:1; - int ino_buf:1; - int dquot_buf:1; - int need_crc:1; + unsigned int ino_crc_ok:1; + unsigned int ino_buf:1; + unsigned int dquot_buf:1; + unsigned int need_crc:1; } iocur_t; #define DB_RING_ADD 1 /* add to ring on set_cur */ From patchwork Fri Oct 5 04:03:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F3FE112B for ; Fri, 5 Oct 2018 04:03:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FA752881E for ; Fri, 5 Oct 2018 04:03:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 044A128884; Fri, 5 Oct 2018 04:03:31 +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 1A304290B4 for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727654AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: from sandeen.net ([63.231.237.45]:48096 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727576AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id 4545C22C7; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 05/15] xfsprogs: don't use 0 as pointer Date: Thu, 4 Oct 2018 23:03:06 -0500 Message-Id: <1538712196-13625-6-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen Use NULL as appropriate. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- db/dir2sf.c | 4 ++-- fsr/xfs_fsr.c | 10 +++++----- libxfs/libxfs_priv.h | 2 +- libxfs/rdwr.c | 6 +++--- mkfs/proto.c | 4 ++-- scrub/fscounters.c | 2 +- scrub/inodes.c | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/db/dir2sf.c b/db/dir2sf.c index 977a932..5737f2a 100644 --- a/db/dir2sf.c +++ b/db/dir2sf.c @@ -30,8 +30,8 @@ const field_t dir2sf_flds[] = { }; const field_t dir2_inou_flds[] = { - { "i8", FLDT_DIR2_INO8, 0, dir2_inou_i8_count, FLD_COUNT, TYP_INODE }, - { "i4", FLDT_DIR2_INO4, 0, dir2_inou_i4_count, FLD_COUNT, TYP_INODE }, + { "i8", FLDT_DIR2_INO8, NULL, dir2_inou_i8_count, FLD_COUNT, TYP_INODE}, + { "i4", FLDT_DIR2_INO4, NULL, dir2_inou_i4_count, FLD_COUNT, TYP_INODE}, { NULL } }; diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c index e21643a..c8aea98 100644 --- a/fsr/xfs_fsr.c +++ b/fsr/xfs_fsr.c @@ -241,7 +241,7 @@ main(int argc, char **argv) if (vflag) setbuf(stdout, NULL); - starttime = time(0); + starttime = time(NULL); /* Save the caller's real uid */ RealUid = getuid(); @@ -525,7 +525,7 @@ fsrallfs(char *mtab, int howlong, char *leftofffile) signal(SIGTERM, aborter); /* reorg for 'howlong' -- checked in 'fsrfs' */ - while (endtime > time(0)) { + while (endtime > time(NULL)) { pid_t pid; if (npasses > 1 && !fs->npass) @@ -560,7 +560,7 @@ fsrallfs(char *mtab, int howlong, char *leftofffile) break; } } - fsrall_cleanup(endtime <= time(0)); + fsrall_cleanup(endtime <= time(NULL)); } /* @@ -578,7 +578,7 @@ fsrall_cleanup(int timeout) if (timeout) { fsrprintf(_("%s startpass %d, endpass %d, time %d seconds\n"), progname, startpass, fs->npass, - time(0) - endtime + howlong); + time(NULL) - endtime + howlong); /* record where we left off */ fd = open(leftofffile, O_WRONLY|O_CREAT|O_EXCL, 0644); @@ -688,7 +688,7 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange) break; } } - if (endtime && endtime < time(0)) { + if (endtime && endtime < time(NULL)) { tmp_close(mntdir); close(fsfd); fsrall_cleanup(1); diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index a2fbeac..b4bdc64 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -391,7 +391,7 @@ roundup_64(uint64_t x, uint32_t y) #define XBRW_READ LIBXFS_BREAD #define XBRW_WRITE LIBXFS_BWRITE #define xfs_buf_iomove(bp,off,len,data,f) libxfs_iomove(bp,off,len,data,f) -#define xfs_buf_zero(bp,off,len) libxfs_iomove(bp,off,len,0,LIBXFS_BZERO) +#define xfs_buf_zero(bp,off,len) libxfs_iomove(bp,off,len,NULL,LIBXFS_BZERO) /* mount stuff */ #define XFS_MOUNT_32BITINODES LIBXFS_MOUNT_32BITINODES diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 0ee3ba8..c160e20 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -779,7 +779,7 @@ struct xfs_buf * libxfs_getbuf_flags(struct xfs_buftarg *btp, xfs_daddr_t blkno, int len, unsigned int flags) { - struct xfs_bufkey key = {0}; + struct xfs_bufkey key = {NULL}; key.buftarg = btp; key.blkno = blkno; @@ -822,7 +822,7 @@ static struct xfs_buf * __libxfs_getbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps, int flags) { - struct xfs_bufkey key = {0}; + struct xfs_bufkey key = {NULL}; int i; if (nmaps == 1) @@ -882,7 +882,7 @@ libxfs_putbuf(xfs_buf_t *bp) void libxfs_purgebuf(xfs_buf_t *bp) { - struct xfs_bufkey key = {0}; + struct xfs_bufkey key = {NULL}; key.buftarg = bp->b_target; key.blkno = bp->b_bn; diff --git a/mkfs/proto.c b/mkfs/proto.c index 687c53a..1cd5436 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -259,7 +259,7 @@ newfile( exit(1); } d = XFS_FSB_TO_DADDR(mp, map.br_startblock); - bp = libxfs_trans_get_buf(logit ? tp : 0, mp->m_dev, d, + bp = libxfs_trans_get_buf(logit ? tp : NULL, mp->m_dev, d, nb << mp->m_blkbb_log, 0); memmove(bp->b_addr, buf, len); if (len < bp->b_bcount) @@ -297,7 +297,7 @@ newregfile( exit(1); } } else - buf = 0; + buf = NULL; close(fd); return buf; } diff --git a/scrub/fscounters.c b/scrub/fscounters.c index 6e9bd05..9e93e2a 100644 --- a/scrub/fscounters.c +++ b/scrub/fscounters.c @@ -41,7 +41,7 @@ xfs_count_inodes_range( uint64_t last_ino, uint64_t *count) { - struct xfs_fsop_bulkreq igrpreq = {0}; + struct xfs_fsop_bulkreq igrpreq = {NULL}; struct xfs_inogrp inogrp; __u64 igrp_ino; uint64_t nr = 0; diff --git a/scrub/inodes.c b/scrub/inodes.c index add6876..693f21e 100644 --- a/scrub/inodes.c +++ b/scrub/inodes.c @@ -50,7 +50,7 @@ xfs_iterate_inodes_range_check( struct xfs_inogrp *inogrp, struct xfs_bstat *bstat) { - struct xfs_fsop_bulkreq onereq = {0}; + struct xfs_fsop_bulkreq onereq = {NULL}; struct xfs_bstat *bs; __u64 oneino; __s32 onelen = 0; @@ -98,8 +98,8 @@ xfs_iterate_inodes_range( xfs_inode_iter_fn fn, void *arg) { - struct xfs_fsop_bulkreq igrpreq = {0}; - struct xfs_fsop_bulkreq bulkreq = {0}; + struct xfs_fsop_bulkreq igrpreq = {NULL}; + struct xfs_fsop_bulkreq bulkreq = {NULL}; struct xfs_handle handle; struct xfs_inogrp inogrp; struct xfs_bstat bstat[XFS_INODES_PER_CHUNK]; From patchwork Fri Oct 5 04:03:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65A3E112B for ; Fri, 5 Oct 2018 04:03:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55F622881E for ; Fri, 5 Oct 2018 04:03:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A9532907B; Fri, 5 Oct 2018 04:03:30 +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 815202881E for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: from sandeen.net ([63.231.237.45]:48098 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727595AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id 5FF482ABA; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 06/15] xfsprogs: minor endian annotation fixes Date: Thu, 4 Oct 2018 23:03:07 -0500 Message-Id: <1538712196-13625-7-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen No actual bugs, just quiet the sparse checker. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen --- copy/xfs_copy.c | 2 +- db/crc.c | 4 ++-- db/write.c | 4 ++-- logprint/log_misc.c | 5 +++-- repair/rmap.c | 3 ++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index a7b4656..1d04780 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -507,7 +507,7 @@ sb_update_uuid( */ if (xfs_sb_version_hascrc(sb) && !xfs_sb_version_hasmetauuid(sb) && !uuid_equal(&tcarg->uuid, &sb->sb_uuid)) { - __be32 feat; + __u32 feat; feat = be32_to_cpu(ag_hdr->xfs_sb->sb_features_incompat); feat |= XFS_SB_FEAT_INCOMPAT_META_UUID; diff --git a/db/crc.c b/db/crc.c index b6775bc..c4136a4 100644 --- a/db/crc.c +++ b/db/crc.c @@ -144,8 +144,8 @@ crc_f( bit_length *= fcount(sfl->fld, iocur_top->data, parentoffset); crc = getbitval(iocur_top->data, sfl->offset, bit_length, BVUNSIGNED); - /* Off by one.. */ - crc = cpu_to_be32(crc + 1); + /* Off by one, ignore endianness - we're just corrupting it. */ + crc++; setbitval(iocur_top->data, sfl->offset, bit_length, &crc); /* Temporarily remove write verifier to write a bad CRC */ diff --git a/db/write.c b/db/write.c index a48576b..e25d6ea 100644 --- a/db/write.c +++ b/db/write.c @@ -525,7 +525,7 @@ convert_arg( char *endp; char *rbuf; char *ostr; - __u64 *value; + __be64 *value; __u64 val = 0; if (bit_length <= 64) @@ -535,7 +535,7 @@ convert_arg( buf = xrealloc(buf, alloc_size); memset(buf, 0, alloc_size); - value = (__u64 *)buf; + value = (__be64 *)buf; rbuf = buf; if (*arg == '\"') { diff --git a/logprint/log_misc.c b/logprint/log_misc.c index 640c00e..c5dba30 100644 --- a/logprint/log_misc.c +++ b/logprint/log_misc.c @@ -467,6 +467,7 @@ xlog_print_dir2_sf( xfs_dir2_sf_hdr_t *sfp, int size) { + __be64 pino; /* parent inode nr */ xfs_ino_t ino; int count; int i; @@ -481,8 +482,8 @@ xlog_print_dir2_sf( printf(_("SHORTFORM DIRECTORY size %d count %d\n"), size, sfp->count); - memmove(&ino, &(sfp->parent), sizeof(ino)); - printf(_(".. ino 0x%llx\n"), (unsigned long long) be64_to_cpu(ino)); + memmove(&pino, &(sfp->parent), sizeof(pino)); + printf(_(".. ino 0x%llx\n"), (unsigned long long) be64_to_cpu(pino)); count = sfp->count; sfep = xfs_dir2_sf_firstentry(sfp); diff --git a/repair/rmap.c b/repair/rmap.c index 6de4a10..ebb5a3a 100644 --- a/repair/rmap.c +++ b/repair/rmap.c @@ -482,7 +482,8 @@ rmap_store_ag_btree_rec( */ agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, agflbp); b = agfl_bno + ag_rmaps[agno].ar_flcount; - while (*b != NULLAGBLOCK && b - agfl_bno < libxfs_agfl_size(mp)) { + while (*b != cpu_to_be32(NULLAGBLOCK) && + b - agfl_bno < libxfs_agfl_size(mp)) { error = rmap_add_ag_rec(mp, agno, be32_to_cpu(*b), 1, XFS_RMAP_OWN_AG); if (error) From patchwork Fri Oct 5 04:03:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 535E6184E for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4541E2925B for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A1E029261; Fri, 5 Oct 2018 04:03:29 +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 EC2862925D for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727679AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: from sandeen.net ([63.231.237.45]:48100 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727581AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id 79B572AD1; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 07/15] libxfs: avoid redefinitions of macros in mount.h Date: Thu, 4 Oct 2018 23:03:08 -0500 Message-Id: <1538712196-13625-8-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen MS_* (MS_NOSUID ... etc) get redefined. Fix this by simply removing the inclusion of mount.h, which isn't needed. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- io/label.c | 1 - libfrog/linux.c | 1 - 2 files changed, 2 deletions(-) diff --git a/io/label.c b/io/label.c index df6ac36..602ece8 100644 --- a/io/label.c +++ b/io/label.c @@ -4,7 +4,6 @@ */ #include -#include #include "platform_defs.h" #include "libxfs.h" #include "path.h" diff --git a/libfrog/linux.c b/libfrog/linux.c index 2af2675..46f15d6 100644 --- a/libfrog/linux.c +++ b/libfrog/linux.c @@ -6,7 +6,6 @@ #include #include -#include #include #include From patchwork Fri Oct 5 04:03:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97FA4112B for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8891328884 for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7576E290B4; Fri, 5 Oct 2018 04:03:27 +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 318C92907B for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727595AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: from sandeen.net ([63.231.237.45]:48102 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727578AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id 984FE4A2; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 08/15] xfsprogs: avoid redefinition of NBBY Date: Thu, 4 Oct 2018 23:03:09 -0500 Message-Id: <1538712196-13625-9-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen sys/param.h (re)defines NBBY so just include it first. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen --- include/platform_defs.h.in | 1 + 1 file changed, 1 insertion(+) diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in index c4f0e8b..411a9bf 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include From patchwork Fri Oct 5 04:03:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17C86184E for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 075482907B for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F03B2290B4; Fri, 5 Oct 2018 04:03:26 +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 A45412881E for ; Fri, 5 Oct 2018 04:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727650AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: from sandeen.net ([63.231.237.45]:48104 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727535AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id B937C544; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 09/15] xfsprogs: remove write-only variables Date: Thu, 4 Oct 2018 23:03:10 -0500 Message-Id: <1538712196-13625-10-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- copy/xfs_copy.c | 3 --- libfrog/linux.c | 1 - libxfs/init.h | 1 - 3 files changed, 5 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 1d04780..5fbc0f3 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -39,7 +39,6 @@ target_control *target; wbuf w_buf; wbuf btree_buf; -pid_t parent_pid; unsigned int kids; thread_control glob_masks; @@ -631,8 +630,6 @@ main(int argc, char **argv) target[i].err_type = 0; } - parent_pid = getpid(); - /* open up source -- is it a file? */ open_flags = O_RDONLY; diff --git a/libfrog/linux.c b/libfrog/linux.c index 46f15d6..fc9f3ac 100644 --- a/libfrog/linux.c +++ b/libfrog/linux.c @@ -12,7 +12,6 @@ #include "libxfs_priv.h" #include "xfs_fs.h" -int platform_has_uuid = 1; extern char *progname; static int max_block_alignment; diff --git a/libxfs/init.h b/libxfs/init.h index 2c3cd91..e0b5091 100644 --- a/libxfs/init.h +++ b/libxfs/init.h @@ -19,6 +19,5 @@ extern char *platform_findblockpath (char *path); extern int platform_direct_blockdev (void); extern int platform_align_blockdev (void); extern unsigned long platform_physmem(void); /* in kilobytes */ -extern int platform_has_uuid; #endif /* LIBXFS_INIT_H */ From patchwork Fri Oct 5 04:03:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BECF71926 for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA9B628884 for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EC8829338; Fri, 5 Oct 2018 04:03:29 +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 A868128884 for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: from sandeen.net ([63.231.237.45]:48106 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727599AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id D6F4F54F; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 10/15] xfsprogs: make static things static Date: Thu, 4 Oct 2018 23:03:11 -0500 Message-Id: <1538712196-13625-11-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen There are tons of functions which can be static, make them so. Fixes many sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- copy/xfs_copy.c | 66 +++++++++++++++++++++++------------------------ db/btblock.c | 2 +- db/check.c | 4 +-- db/fsmap.c | 2 +- db/init.c | 8 +++--- db/input.c | 6 ++--- db/io.c | 2 +- db/logformat.c | 2 +- estimate/xfs_estimate.c | 34 ++++++++++++------------ fsr/xfs_fsr.c | 40 ++++++++++++++-------------- io/bmap.c | 2 +- io/fiemap.c | 2 +- io/freeze.c | 4 +-- io/fsmap.c | 2 +- io/imap.c | 2 +- io/init.c | 10 +++---- io/madvise.c | 2 +- io/mincore.c | 2 +- io/mmap.c | 10 +++---- io/parent.c | 2 +- io/readdir.c | 2 +- io/seek.c | 4 +-- io/stat.c | 8 +++--- libxcmd/command.c | 4 +-- libxfs/cache.c | 2 +- libxfs/init.c | 2 +- libxfs/rdwr.c | 6 ++--- libxfs/util.c | 6 ++--- logprint/log_misc.c | 34 ++++++++++++------------ logprint/log_print_all.c | 2 +- logprint/logprint.c | 6 ++--- mdrestore/xfs_mdrestore.c | 6 ++--- mkfs/xfs_mkfs.c | 26 +++++++++---------- repair/btree.c | 2 +- repair/incore_ext.c | 10 +++---- repair/incore_ino.c | 4 +-- repair/phase6.c | 2 +- repair/progress.c | 2 +- repair/sb.c | 2 +- repair/scan.c | 2 +- rtcp/xfs_rtcp.c | 4 +-- scrub/scrub.c | 2 +- spaceman/init.c | 4 +-- 43 files changed, 174 insertions(+), 172 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 5fbc0f3..3f6535c 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -18,33 +18,32 @@ extern int platform_check_ismounted(char *, char *, struct stat *, int); -int logfd; -char *logfile_name; -FILE *logerr; -char LOGFILE_NAME[] = "/var/tmp/xfs_copy.log.XXXXXX"; +static char *logfile_name; +static FILE *logerr; +static char LOGFILE_NAME[] = "/var/tmp/xfs_copy.log.XXXXXX"; -char *source_name; -int source_fd; +static char *source_name; +static int source_fd; -unsigned int source_blocksize; /* source filesystem blocksize */ -unsigned int source_sectorsize; /* source disk sectorsize */ +static unsigned int source_blocksize; /* source filesystem blocksize */ +static unsigned int source_sectorsize; /* source disk sectorsize */ -xfs_agblock_t first_agbno; +static xfs_agblock_t first_agbno; -uint64_t barcount[11]; +static uint64_t barcount[11]; -unsigned int num_targets; -target_control *target; +static unsigned int num_targets; +static target_control *target; -wbuf w_buf; -wbuf btree_buf; +static wbuf w_buf; +static wbuf btree_buf; -unsigned int kids; +static unsigned int kids; -thread_control glob_masks; -thread_args *targ; +static thread_control glob_masks; +static thread_args *targ; -pthread_mutex_t mainwait; +static pthread_mutex_t mainwait; #define ACTIVE 1 #define INACTIVE 2 @@ -61,7 +60,7 @@ static int format_logs(struct xfs_mount *); #define PRE 0x08 /* append strerror string */ #define LAST 0x10 /* final message we print */ -void +static void signal_maskfunc(int addset, int newset) { sigset_t set; @@ -71,7 +70,7 @@ signal_maskfunc(int addset, int newset) sigprocmask(newset, &set, NULL); } -void +static void do_message(int flags, int code, const char *fmt, ...) { va_list ap; @@ -133,7 +132,7 @@ int xlog_recover_do_trans(struct xlog *log, struct xlog_recover *t, int p) return 0; } -void +static void check_errors(void) { int i, first_error = 0; @@ -167,7 +166,7 @@ check_errors(void) * don't have to worry about alignment and mins because those * are taken care of when the buffer's read in */ -int +static int do_write( thread_args *args, wbuf *buf) @@ -200,7 +199,7 @@ do_write( return error; } -void * +static void * begin_reader(void *arg) { thread_args *args = arg; @@ -228,7 +227,7 @@ handle_error: return NULL; } -void +static void handler(int sig) { pid_t pid; @@ -290,7 +289,7 @@ handler(int sig) signal(SIGCHLD, handler); } -void +static void usage(void) { fprintf(stderr, @@ -299,7 +298,7 @@ usage(void) exit(1); } -void +static void init_bar(uint64_t source_blocks) { int i; @@ -308,7 +307,7 @@ init_bar(uint64_t source_blocks) barcount[i] = (source_blocks/10)*i; } -int +static int bump_bar(int tenths, uint64_t numblocks) { static char *bar[11] = { @@ -340,7 +339,7 @@ bump_bar(int tenths, uint64_t numblocks) static xfs_off_t source_position = -1; -wbuf * +static wbuf * wbuf_init(wbuf *buf, int data_size, int data_align, int min_io_size, int id) { ASSERT(data_size % BBSIZE == 0); @@ -357,7 +356,7 @@ wbuf_init(wbuf *buf, int data_size, int data_align, int min_io_size, int id) return buf; } -void +static void read_wbuf(int fd, wbuf *buf, xfs_mount_t *mp) { int res = 0; @@ -412,7 +411,7 @@ read_wbuf(int fd, wbuf *buf, xfs_mount_t *mp) buf->length = res; } -void +static void read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag, xfs_mount_t *mp, int blocksize, int sectorsize) { @@ -459,7 +458,7 @@ read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag, } -void +static void write_wbuf(void) { int i; @@ -491,7 +490,7 @@ write_wbuf(void) signal_maskfunc(SIGCHLD, SIG_BLOCK); } -void +static void sb_update_uuid( xfs_sb_t *sb, /* Original fs superblock */ ag_header_t *ag_hdr, /* AG hdr to update for this copy */ @@ -528,6 +527,7 @@ int main(int argc, char **argv) { int i, j; + int logfd; int howfar = 0; int open_flags; xfs_off_t pos; @@ -1205,7 +1205,7 @@ main(int argc, char **argv) return 0; } -char * +static char * next_log_chunk(char *p, int offset, void *private) { wbuf *buf = (wbuf *)private; diff --git a/db/btblock.c b/db/btblock.c index cbd2990..af42bf7 100644 --- a/db/btblock.c +++ b/db/btblock.c @@ -19,7 +19,7 @@ /* * Definition of the possible btree block layouts. */ -struct xfs_db_btree { +static struct xfs_db_btree { uint32_t magic; size_t block_len; size_t key_len; diff --git a/db/check.c b/db/check.c index 76a833a..754441c 100644 --- a/db/check.c +++ b/db/check.c @@ -996,7 +996,7 @@ blocktrash_b( bit_offset / NBBY, bit_offset % NBBY, modestr[mode]); } -int +static int blocktrash_f( int argc, char **argv) @@ -1204,7 +1204,7 @@ out: return 0; } -int +static int blockuse_f( int argc, char **argv) diff --git a/db/fsmap.c b/db/fsmap.c index 4836381..29f3827 100644 --- a/db/fsmap.c +++ b/db/fsmap.c @@ -99,7 +99,7 @@ fsmap( } } -int +static int fsmap_f( int argc, char **argv) diff --git a/db/init.c b/db/init.c index a70b02b..455220a 100644 --- a/db/init.c +++ b/db/init.c @@ -23,10 +23,10 @@ char *fsdevice; int blkbb; int exitcode; int expert_mode; -int force; -struct xfs_mount xmount; +static int force; +static struct xfs_mount xmount; struct xfs_mount *mp; -struct xlog xlog; +static struct xlog xlog; libxfs_init_t x; xfs_agnumber_t cur_agno = NULLAGNUMBER; @@ -39,7 +39,7 @@ usage(void) exit(1); } -void +static void init( int argc, char **argv) diff --git a/db/input.c b/db/input.c index 9c59a56..4d6c737 100644 --- a/db/input.c +++ b/db/input.c @@ -20,9 +20,9 @@ # include #endif -int inputstacksize; -FILE **inputstack; -FILE *curinput; +static int inputstacksize; +static FILE **inputstack; +static FILE *curinput; static void popfile(void); static int source_f(int argc, char **argv); diff --git a/db/io.c b/db/io.c index 8c51b4d..0486ae2 100644 --- a/db/io.c +++ b/db/io.c @@ -155,7 +155,7 @@ print_iocur( ioc->dirino, ioc->typ == NULL ? _("none") : ioc->typ->name); } -void +static void print_ring(void) { int i; diff --git a/db/logformat.c b/db/logformat.c index 4bbab2a..42ce245 100644 --- a/db/logformat.c +++ b/db/logformat.c @@ -145,7 +145,7 @@ print_logres( i, res->tr_logres, res->tr_logcount, res->tr_logflags); } -int +static int logres_f( int argc, char **argv) diff --git a/estimate/xfs_estimate.c b/estimate/xfs_estimate.c index eaa2cba..9e01cce 100644 --- a/estimate/xfs_estimate.c +++ b/estimate/xfs_estimate.c @@ -13,7 +13,7 @@ #include #include -unsigned long long +static unsigned long long cvtnum(char *s) { unsigned long long i; @@ -43,22 +43,22 @@ int ffn(const char *, const struct stat *, int, struct FTW *); #define FBLOCKS(n) ((n)/blocksize) -unsigned long long dirsize=0; /* bytes */ -unsigned long long logsize=LOGSIZE*BLOCKSIZE; /* bytes */ -unsigned long long fullblocks=0; /* FS blocks */ -unsigned long long isize=0; /* inodes bytes */ -unsigned long long blocksize=BLOCKSIZE; -unsigned long long nslinks=0; /* number of symbolic links */ -unsigned long long nfiles=0; /* number of regular files */ -unsigned long long ndirs=0; /* number of directories */ -unsigned long long nspecial=0; /* number of special files */ -unsigned long long verbose=0; /* verbose mode TRUE/FALSE */ - -int __debug = 0; -int ilog = 0; -int elog = 0; - -void +static unsigned long long dirsize=0; /* bytes */ +static unsigned long long logsize=LOGSIZE*BLOCKSIZE; /* bytes */ +static unsigned long long fullblocks=0; /* FS blocks */ +static unsigned long long isize=0; /* inodes bytes */ +static unsigned long long blocksize=BLOCKSIZE; +static unsigned long long nslinks=0; /* number of symbolic links */ +static unsigned long long nfiles=0; /* number of regular files */ +static unsigned long long ndirs=0; /* number of directories */ +static unsigned long long nspecial=0; /* number of special files */ +static unsigned long long verbose=0; /* verbose mode TRUE/FALSE */ + +static int __debug = 0; +static int ilog = 0; +static int elog = 0; + +static void usage(char *progname) { fprintf(stderr, diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c index c8aea98..fef6262 100644 --- a/fsr/xfs_fsr.c +++ b/fsr/xfs_fsr.c @@ -28,21 +28,21 @@ char *progname; -int vflag; -int gflag; +static int vflag; +static int gflag; static int Mflag; /* static int nflag; */ -int dflag = 0; +static int dflag = 0; /* static int sflag; */ -int argv_blksz_dio; +static int argv_blksz_dio; extern int max_ext_size; static int npasses = 10; static int startpass = 0; -struct getbmap *outmap = NULL; -int outmap_size = 0; -int RealUid; -int tmp_agi; +static struct getbmap *outmap = NULL; +static int outmap_size = 0; +static int RealUid; +static int tmp_agi; static int64_t minimumfree = 2048; #define MNTTYPE_XFS "xfs" @@ -85,7 +85,7 @@ static char * tmp_next(char *mnt); static void tmp_close(char *mnt); int xfs_getgeom(int , xfs_fsop_geom_v1_t * ); -xfs_fsop_geom_v1_t fsgeom; /* geometry of active mounted system */ +static xfs_fsop_geom_v1_t fsgeom; /* geometry of active mounted system */ #define NMOUNT 64 static int numfs; @@ -96,19 +96,19 @@ typedef struct fsdesc { int npass; } fsdesc_t; -fsdesc_t *fs, *fsbase, *fsend; -int fsbufsize = 10; /* A starting value */ -int nfrags = 0; /* Debug option: Coerse into specific number +static fsdesc_t *fs, *fsbase, *fsend; +static int fsbufsize = 10; /* A starting value */ +static int nfrags = 0; /* Debug option: Coerse into specific number * of extents */ -int openopts = O_CREAT|O_EXCL|O_RDWR|O_DIRECT; +static int openopts = O_CREAT|O_EXCL|O_RDWR|O_DIRECT; -int +static int xfs_fsgeometry(int fd, xfs_fsop_geom_v1_t *geom) { return ioctl(fd, XFS_IOC_FSGEOMETRY_V1, geom); } -int +static int xfs_bulkstat_single(int fd, xfs_ino_t *lastip, xfs_bstat_t *ubuffer) { xfs_fsop_bulkreq_t bulkreq; @@ -120,7 +120,7 @@ xfs_bulkstat_single(int fd, xfs_ino_t *lastip, xfs_bstat_t *ubuffer) return ioctl(fd, XFS_IOC_FSBULKSTAT_SINGLE, &bulkreq); } -int +static int xfs_bulkstat(int fd, xfs_ino_t *lastip, int icount, xfs_bstat_t *ubuffer, __s32 *ocount) { @@ -133,19 +133,19 @@ xfs_bulkstat(int fd, xfs_ino_t *lastip, int icount, return ioctl(fd, XFS_IOC_FSBULKSTAT, &bulkreq); } -int +static int xfs_swapext(int fd, xfs_swapext_t *sx) { return ioctl(fd, XFS_IOC_SWAPEXT, sx); } -int +static int xfs_fscounts(int fd, xfs_fsop_counts_t *counts) { return ioctl(fd, XFS_IOC_FSCOUNTS, counts); } -void +static void aborter(int unused) { fsrall_cleanup(1); @@ -1586,7 +1586,7 @@ int read_fd_bmap(int fd, xfs_bstat_t *sin, int *cur_nextents) /* * Read the block map and return the number of extents. */ -int +static int getnextents(int fd) { int nextents; diff --git a/io/bmap.c b/io/bmap.c index f917831..d408826 100644 --- a/io/bmap.c +++ b/io/bmap.c @@ -43,7 +43,7 @@ bmap_help(void) "\n")); } -int +static int bmap_f( int argc, char **argv) diff --git a/io/fiemap.c b/io/fiemap.c index 8090dc4..485bae1 100644 --- a/io/fiemap.c +++ b/io/fiemap.c @@ -214,7 +214,7 @@ calc_print_format( } } -int +static int fiemap_f( int argc, char **argv) diff --git a/io/freeze.c b/io/freeze.c index b52df91..3333b08 100644 --- a/io/freeze.c +++ b/io/freeze.c @@ -12,7 +12,7 @@ static cmdinfo_t freeze_cmd; static cmdinfo_t thaw_cmd; -int +static int freeze_f( int argc, char **argv) @@ -29,7 +29,7 @@ freeze_f( return 0; } -int +static int thaw_f( int argc, char **argv) diff --git a/io/fsmap.c b/io/fsmap.c index 0bc8ae6..477c36f 100644 --- a/io/fsmap.c +++ b/io/fsmap.c @@ -364,7 +364,7 @@ dump_verbose_key(void) NFLG+1, NFLG+1, FLG_ESW); } -int +static int fsmap_f( int argc, char **argv) diff --git a/io/imap.c b/io/imap.c index 048d1a4..fbc8e9e 100644 --- a/io/imap.c +++ b/io/imap.c @@ -11,7 +11,7 @@ static cmdinfo_t imap_cmd; -int +static int imap_f(int argc, char **argv) { int count; diff --git a/io/init.c b/io/init.c index 29afe09..b5eade3 100644 --- a/io/init.c +++ b/io/init.c @@ -14,11 +14,11 @@ char *progname; int exitcode; int expert; -int idlethread; +static int idlethread; size_t pagesize; struct timeval stopwatch; -void +static void usage(void) { fprintf(stderr, @@ -124,7 +124,7 @@ init_check_command( return 1; } -void +static void init( int argc, char **argv) @@ -235,7 +235,7 @@ init( * are not reference counted. Spawning an idle thread can help detecting file * struct reference leaks. */ -void * +static void * idle_loop(void *arg) { for (;;) @@ -243,7 +243,7 @@ idle_loop(void *arg) return NULL; } -void +static void start_idle_thread(void) { pthread_t t; diff --git a/io/madvise.c b/io/madvise.c index c001a2f..9f6c010 100644 --- a/io/madvise.c +++ b/io/madvise.c @@ -34,7 +34,7 @@ madvise_help(void) "\n")); } -int +static int madvise_f( int argc, char **argv) diff --git a/io/mincore.c b/io/mincore.c index c4f354c..239134f 100644 --- a/io/mincore.c +++ b/io/mincore.c @@ -12,7 +12,7 @@ static cmdinfo_t mincore_cmd; -int +static int mincore_f( int argc, char **argv) diff --git a/io/mmap.c b/io/mmap.c index dbfcca5..44749bb 100644 --- a/io/mmap.c +++ b/io/mmap.c @@ -290,7 +290,7 @@ msync_help(void) "\n")); } -int +static int msync_f( int argc, char **argv) @@ -374,7 +374,7 @@ mread_help(void) "\n")); } -int +static int mread_f( int argc, char **argv) @@ -477,7 +477,7 @@ mread_f( return 0; } -int +static int munmap_f( int argc, char **argv) @@ -531,7 +531,7 @@ mwrite_help(void) "\n")); } -int +static int mwrite_f( int argc, char **argv) @@ -618,7 +618,7 @@ mremap_help(void) "\n")); } -int +static int mremap_f( int argc, char **argv) diff --git a/io/parent.c b/io/parent.c index 53ac659..ffa55f6 100644 --- a/io/parent.c +++ b/io/parent.c @@ -358,7 +358,7 @@ error: return retval; } -int +static int parent_f(int argc, char **argv) { int c; diff --git a/io/readdir.c b/io/readdir.c index 4321bde..2cb8977 100644 --- a/io/readdir.c +++ b/io/readdir.c @@ -18,7 +18,7 @@ static struct cmdinfo readdir_cmd; -const char *d_type_str(unsigned int type) +static const char *d_type_str(unsigned int type) { const char *str; diff --git a/io/seek.c b/io/seek.c index ae6e9f5..59ba1cf 100644 --- a/io/seek.c +++ b/io/seek.c @@ -49,7 +49,7 @@ seek_help(void) #define DATA 0 #define HOLE 1 -struct seekinfo { +static struct seekinfo { char *name; /* display item name */ int seektype; /* data or hole */ int mask; /* compared for print and looping */ @@ -59,7 +59,7 @@ struct seekinfo { }; /* print item type and offset. catch special cases of eof and error */ -void +static void seek_output( int startflag, char *type, diff --git a/io/stat.c b/io/stat.c index cde7780..64662b4 100644 --- a/io/stat.c +++ b/io/stat.c @@ -77,7 +77,8 @@ dump_raw_stat(struct stat *st) return 0; } -void print_file_info(void) +static void +print_file_info(void) { printf(_("fd.path = \"%s\"\n"), file->name); printf(_("fd.flags = %s,%s,%s%s%s%s%s\n"), @@ -90,7 +91,8 @@ void print_file_info(void) file->flags & IO_TMPFILE ? _(",tmpfile") : ""); } -void print_xfs_info(int verbose) +static void +print_xfs_info(int verbose) { struct dioattr dio; struct fsxattr fsx, fsxa; @@ -291,7 +293,7 @@ dump_raw_statx(struct statx *stx) * - output style for flags (and all else?) (chars vs. hex?) * - output - mask out incidental flag or not? */ -int +static int statx_f( int argc, char **argv) diff --git a/libxcmd/command.c b/libxcmd/command.c index ceb359d..a76d151 100644 --- a/libxcmd/command.c +++ b/libxcmd/command.c @@ -19,8 +19,8 @@ struct cmdline { bool iterate; }; -static int ncmdline; -struct cmdline *cmdline; +static int ncmdline; +static struct cmdline *cmdline; static int compare(const void *a, const void *b) diff --git a/libxfs/cache.c b/libxfs/cache.c index 77866bc..139c7c1 100644 --- a/libxfs/cache.c +++ b/libxfs/cache.c @@ -77,7 +77,7 @@ cache_init( return cache; } -void +static void cache_expand( struct cache * cache) { diff --git a/libxfs/init.c b/libxfs/init.c index d7543d4..10dcbf3 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -37,7 +37,7 @@ static int manage_zones(int); /* setup/teardown global zones */ * dev_map - map open devices to fd. */ #define MAX_DEVS 10 /* arbitary maximum */ -int nextfakedev = -1; /* device number to give to next fake device */ +static int nextfakedev = -1; /* device number to give to next fake device */ static struct dev_to_fd { dev_t dev; int fd; diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index c160e20..753b939 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -544,7 +544,7 @@ libxfs_bcompare(struct cache_node *node, cache_key_t key) return CACHE_MISS; } -void +static void libxfs_bprint(xfs_buf_t *bp) { fprintf(stderr, "Buffer %p blkno=%llu bytes=%u flags=0x%x count=%u\n", @@ -624,7 +624,7 @@ libxfs_initbuf_map(xfs_buf_t *bp, struct xfs_buftarg *btp, bp->b_flags |= LIBXFS_B_DISCONTIG; } -xfs_buf_t * +static xfs_buf_t * __libxfs_getbufr(int blen) { xfs_buf_t *bp; @@ -681,7 +681,7 @@ libxfs_getbufr(struct xfs_buftarg *btp, xfs_daddr_t blkno, int bblen) return bp; } -xfs_buf_t * +static xfs_buf_t * libxfs_getbufr_map(struct xfs_buftarg *btp, xfs_daddr_t blkno, int bblen, struct xfs_buf_map *map, int nmaps) { diff --git a/libxfs/util.c b/libxfs/util.c index eb99ef7..9932186 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -230,7 +230,7 @@ xfs_flags2diflags2( * This was once shared with the kernel, but has diverged to the point * where it's no longer worth the hassle of maintaining common code. */ -int +static int libxfs_ialloc( xfs_trans_t *tp, xfs_inode_t *pip, @@ -380,7 +380,7 @@ libxfs_ialloc( return 0; } -void +static void libxfs_iprint( xfs_inode_t *ip) { @@ -753,7 +753,7 @@ xfs_inode_verifier_error( * repair can validate it against the state of the log. */ xfs_lsn_t libxfs_max_lsn = 0; -pthread_mutex_t libxfs_max_lsn_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t libxfs_max_lsn_lock = PTHREAD_MUTEX_INITIALIZER; bool xfs_log_check_lsn( diff --git a/logprint/log_misc.c b/logprint/log_misc.c index c5dba30..e29366a 100644 --- a/logprint/log_misc.c +++ b/logprint/log_misc.c @@ -24,7 +24,7 @@ typedef struct xlog_split_item { int si_skip; } xlog_split_item_t; -xlog_split_item_t *split_list = NULL; +static xlog_split_item_t *split_list = NULL; void print_xlog_op_line(void) @@ -33,7 +33,7 @@ print_xlog_op_line(void) "--------------------------------------\n"); } /* print_xlog_op_line */ -void +static void print_xlog_xhdr_line(void) { printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" @@ -58,7 +58,7 @@ print_stars(void) * Given a pointer to a data segment, print out the data as if it were * a log operation header. */ -void +static void xlog_print_op_header(xlog_op_header_t *op_head, int i, char **ptr) @@ -98,7 +98,7 @@ xlog_print_op_header(xlog_op_header_t *op_head, } /* xlog_print_op_header */ -void +static void xlog_print_add_to_trans(xlog_tid_t tid, int skip) { @@ -115,7 +115,7 @@ xlog_print_add_to_trans(xlog_tid_t tid, } /* xlog_print_add_to_trans */ -int +static int xlog_print_find_tid(xlog_tid_t tid, uint was_cont) { xlog_split_item_t *listp = split_list; @@ -149,7 +149,7 @@ xlog_print_find_tid(xlog_tid_t tid, uint was_cont) return 1; } /* xlog_print_find_tid */ -int +static int xlog_print_trans_header(char **ptr, int len) { xfs_trans_header_t *h; @@ -181,7 +181,7 @@ xlog_print_trans_header(char **ptr, int len) } /* xlog_print_trans_header */ -int +static int xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops) { xfs_buf_log_format_t *f; @@ -416,7 +416,7 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops) } /* xlog_print_trans_buffer */ -int +static int xlog_print_trans_qoff(char **ptr, uint len) { xfs_qoff_logformat_t *f; @@ -435,7 +435,7 @@ xlog_print_trans_qoff(char **ptr, uint len) } /* xlog_print_trans_qoff */ -void +static void xlog_print_trans_inode_core( struct xfs_log_dinode *ip) { @@ -461,7 +461,7 @@ xlog_print_trans_inode_core( } } -void +static void xlog_print_dir2_sf( struct xlog *log, xfs_dir2_sf_hdr_t *sfp, @@ -497,7 +497,7 @@ xlog_print_dir2_sf( } } -int +static int xlog_print_trans_inode( struct xlog *log, char **ptr, @@ -648,7 +648,7 @@ xlog_print_trans_inode( } /* xlog_print_trans_inode */ -int +static int xlog_print_trans_dquot(char **ptr, int len, int *i, int num_ops) { xfs_dq_logformat_t *f; @@ -756,7 +756,7 @@ xlog_print_lseek(struct xlog *log, int fd, xfs_daddr_t blkno, int whence) } /* xlog_print_lseek */ -void +static void print_lsn(char *string, __be64 *lsn) { @@ -765,7 +765,7 @@ print_lsn(char *string, } -int +static int xlog_print_record( struct xlog *log, int fd, @@ -1020,7 +1020,7 @@ xlog_print_record( } /* xlog_print_record */ -int +static int xlog_print_rec_head(xlog_rec_header_t *head, int *len, int bad_hdr_warn) { int i; @@ -1094,7 +1094,7 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len, int bad_hdr_warn) return(be32_to_cpu(head->h_num_logops)); } /* xlog_print_rec_head */ -void +static void xlog_print_rec_xhead(xlog_rec_ext_header_t *head, int coverage) { int i; @@ -1134,7 +1134,7 @@ print_xlog_bad_header(xfs_daddr_t blkno, char *buf) xlog_exit("Bad log record header"); } /* print_xlog_bad_header */ -void +static void print_xlog_bad_data(xfs_daddr_t blkno) { print_stars(); diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c index cd47313..eafffe2 100644 --- a/logprint/log_print_all.c +++ b/logprint/log_print_all.c @@ -430,7 +430,7 @@ xlog_recover_print_logitem( } } -void +static void xlog_recover_print_item( xlog_recover_item_t *item) { diff --git a/logprint/logprint.c b/logprint/logprint.c index 5aaa30c..7754a2a 100644 --- a/logprint/logprint.c +++ b/logprint/logprint.c @@ -25,9 +25,9 @@ int print_overwrite; int print_no_data; int print_no_print; int print_exit = 1; /* -e is now default. specify -c to override */ -int print_operation = OP_PRINT; +static int print_operation = OP_PRINT; -void +static void usage(void) { fprintf(stderr, _("Usage: %s [options...] \n\n\ @@ -52,7 +52,7 @@ Options:\n\ exit(1); } -int +static int logstat(xfs_mount_t *mp) { int fd; diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c index bb4246f..3375e08 100644 --- a/mdrestore/xfs_mdrestore.c +++ b/mdrestore/xfs_mdrestore.c @@ -8,9 +8,9 @@ #include "xfs_metadump.h" char *progname; -int show_progress = 0; -int show_info = 0; -int progress_since_warning = 0; +static int show_progress = 0; +static int show_info = 0; +static int progress_since_warning = 0; static void fatal(const char *msg, ...) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 2eec005..9877959 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -31,8 +31,8 @@ * XXX: The configured block and sector sizes are defined as global variables so * that they don't need to be passed to getnum/cvtnum(). */ -unsigned int blocksize; -unsigned int sectorsize; +static unsigned int blocksize; +static unsigned int sectorsize; /* * Enums for each CLI parameter type are declared first so we can calculate the @@ -216,9 +216,9 @@ struct opt_params { * about tables that haven't yet been defined. Work around this ordering * issue with extern definitions here. */ -extern struct opt_params sopts; +static struct opt_params sopts; -struct opt_params bopts = { +static struct opt_params bopts = { .name = 'b', .subopts = { [B_SIZE] = "size", @@ -235,7 +235,7 @@ struct opt_params bopts = { }, }; -struct opt_params dopts = { +static struct opt_params dopts = { .name = 'd', .subopts = { [D_AGCOUNT] = "agcount", @@ -372,7 +372,7 @@ struct opt_params dopts = { }; -struct opt_params iopts = { +static struct opt_params iopts = { .name = 'i', .subopts = { [I_ALIGN] = "align", @@ -433,7 +433,7 @@ struct opt_params iopts = { }, }; -struct opt_params lopts = { +static struct opt_params lopts = { .name = 'l', .subopts = { [L_AGNUM] = "agnum", @@ -532,7 +532,7 @@ struct opt_params lopts = { }, }; -struct opt_params nopts = { +static struct opt_params nopts = { .name = 'n', .subopts = { [N_SIZE] = "size", @@ -563,7 +563,7 @@ struct opt_params nopts = { }, }; -struct opt_params ropts = { +static struct opt_params ropts = { .name = 'r', .subopts = { [R_EXTSIZE] = "extsize", @@ -613,7 +613,7 @@ struct opt_params ropts = { }, }; -struct opt_params sopts = { +static struct opt_params sopts = { .name = 's', .subopts = { [S_SIZE] = "size", @@ -643,7 +643,7 @@ struct opt_params sopts = { }, }; -struct opt_params mopts = { +static struct opt_params mopts = { .name = 'm', .subopts = { [M_CRC] = "crc", @@ -1658,7 +1658,7 @@ sector_opts_parser( return 0; } -struct subopts { +static struct subopts { char opt; struct opt_params *opts; int (*parser)(struct opt_params *opts, @@ -2964,7 +2964,7 @@ _("Due to stripe alignment, the internal log size (%lld) is too large.\n" } } -void +static void validate_log_size(uint64_t logblocks, int blocklog, int min_logblocks) { if (logblocks < min_logblocks) { diff --git a/repair/btree.c b/repair/btree.c index dd7717b..a402d0a 100644 --- a/repair/btree.c +++ b/repair/btree.c @@ -444,7 +444,7 @@ btree_lookup_prev( return value; } -void * +static void * btree_uncached_lookup( struct btree_root *root, unsigned long key) diff --git a/repair/incore_ext.c b/repair/incore_ext.c index 0624d6d..e7ef9eb 100644 --- a/repair/incore_ext.c +++ b/repair/incore_ext.c @@ -144,7 +144,7 @@ release_extent_tree_node(extent_tree_node_t *node) * reused. the duplicate and bno/bcnt extent trees for each AG * are recycled after they're no longer needed to save memory */ -void +static void release_extent_tree(avltree_desc_t *tree) { extent_tree_node_t *ext; @@ -517,12 +517,12 @@ avl_ext_bcnt_end(avlnode_t *node) return((uintptr_t) ((extent_tree_node_t *)node)->ex_blockcount); } -avlops_t avl_extent_bcnt_tree_ops = { +static avlops_t avl_extent_bcnt_tree_ops = { avl_ext_bcnt_start, avl_ext_bcnt_end }; -avlops_t avl_extent_tree_ops = { +static avlops_t avl_extent_tree_ops = { avl_ext_start, avl_ext_end }; @@ -714,7 +714,7 @@ avl64_ext_end(avl64node_t *node) ((rt_extent_tree_node_t *) node)->rt_blockcount); } -avl64ops_t avl64_extent_tree_ops = { +static avl64ops_t avl64_extent_tree_ops = { avl64_rt_ext_start, avl64_ext_end }; @@ -792,7 +792,7 @@ incore_ext_teardown(xfs_mount_t *mp) extent_bno_ptrs = NULL; } -int +static int count_extents(xfs_agnumber_t agno, avltree_desc_t *tree, int whichtree) { extent_tree_node_t *node; diff --git a/repair/incore_ino.c b/repair/incore_ino.c index ed10d06..82956ae 100644 --- a/repair/incore_ino.c +++ b/repair/incore_ino.c @@ -535,7 +535,7 @@ set_inode_free_alloc(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t ino) return(ino_rec); } -void +static void print_inode_list_int(xfs_agnumber_t agno, int uncertain) { ino_tree_node_t *ino_rec; @@ -776,7 +776,7 @@ avl_ino_end(avlnode_t *node) XFS_INODES_PER_CHUNK)); } -avlops_t avl_ino_tree_ops = { +static avlops_t avl_ino_tree_ops = { avl_ino_start, avl_ino_end }; diff --git a/repair/phase6.c b/repair/phase6.c index e2e4446..e017326 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -513,7 +513,7 @@ res_failed( do_error(_("xfs_trans_reserve returned %d\n"), err); } -void +static void mk_rbmino(xfs_mount_t *mp) { xfs_trans_t *tp; diff --git a/repair/progress.c b/repair/progress.c index b049fd1..5ee0822 100644 --- a/repair/progress.c +++ b/repair/progress.c @@ -81,7 +81,7 @@ progress_rpt_t progress_rpt_reports[] = { &rpt_fmts[FMT1], &rpt_types[TYPE_AG]} }; -pthread_t report_thread; +static pthread_t report_thread; typedef struct msg_block_s { pthread_mutex_t mutex; diff --git a/repair/sb.c b/repair/sb.c index 94a4726..059422c 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -71,7 +71,7 @@ copy_sb(xfs_sb_t *source, xfs_sb_t *dest) memset(source->sb_fname, 0, 12); } -int +static int verify_sb_blocksize(xfs_sb_t *sb) { /* check to make sure blocksize is legal 2^N, 9 <= N <= 16 */ diff --git a/repair/scan.c b/repair/scan.c index 4bcc626..65a76e2 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -1449,7 +1449,7 @@ enum inobt_type { INOBT, FINOBT }; -const char *inobt_names[] = { +static const char *inobt_names[] = { "inobt", "finobt" }; diff --git a/rtcp/xfs_rtcp.c b/rtcp/xfs_rtcp.c index a77561d..f928a86 100644 --- a/rtcp/xfs_rtcp.c +++ b/rtcp/xfs_rtcp.c @@ -9,10 +9,10 @@ int rtcp(char *, char *, int); int xfsrtextsize(char *path); -int pflag; +static int pflag; char *progname; -void +static void usage(void) { fprintf(stderr, _("%s [-e extsize] [-p] [-V] source target\n"), progname); diff --git a/scrub/scrub.c b/scrub/scrub.c index 0059adb..0f0c963 100644 --- a/scrub/scrub.c +++ b/scrub/scrub.c @@ -305,7 +305,7 @@ _("Optimizations of %s are possible."), scrubbers[i].name); } /* Save a scrub context for later repairs. */ -bool +static bool xfs_scrub_save_repair( struct scrub_ctx *ctx, struct xfs_action_list *alist, diff --git a/spaceman/init.c b/spaceman/init.c index 68bd8a0..181a344 100644 --- a/spaceman/init.c +++ b/spaceman/init.c @@ -14,7 +14,7 @@ char *progname; int exitcode; -void +static void usage(void) { fprintf(stderr, @@ -54,7 +54,7 @@ init_check_command( return 1; } -void +static void init( int argc, char **argv) From patchwork Fri Oct 5 04:03:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 050131926 for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9FDF290B4 for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEF5129261; Fri, 5 Oct 2018 04:03:28 +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 1575F2925B for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727652AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: from sandeen.net ([63.231.237.45]:48108 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727640AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id 02309559; Thu, 4 Oct 2018 23:03:18 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 11/15] xfsprogs: include headers for extern variables Date: Thu, 4 Oct 2018 23:03:12 -0500 Message-Id: <1538712196-13625-12-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen Include headers which export functions so that they don't appear to be static to the sparse checker. Remove redundant extern declarations in c code which are no longer needed. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen --- copy/xfs_copy.c | 3 +-- db/crc.c | 1 + db/fuzz.c | 1 + db/hash.c | 1 + db/logformat.c | 1 + db/symlink.c | 2 +- db/text.c | 1 + include/avl64.h | 6 ++++++ include/kmem.h | 2 ++ include/libxfs.h | 2 -- io/getrusage.c | 1 + io/log_writes.c | 1 + libfrog/crc32.c | 1 + libfrog/linux.c | 1 + libfrog/topology.c | 1 + libxfs/init.c | 9 --------- libxfs/init.h | 11 +++++++++++ libxfs/logitem.c | 1 + libxfs/trans.c | 1 + libxfs/util.c | 1 + mdrestore/xfs_mdrestore.c | 3 +-- repair/phase2.c | 2 -- repair/scan.h | 1 + repair/xfs_repair.c | 1 + scrub/xfs_scrub.c | 1 + 25 files changed, 38 insertions(+), 18 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 3f6535c..862573f 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -5,6 +5,7 @@ */ #include "libxfs.h" +#include "init.h" #include #include #include @@ -16,8 +17,6 @@ #define rounddown(x, y) (((x)/(y))*(y)) #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) -extern int platform_check_ismounted(char *, char *, struct stat *, int); - static char *logfile_name; static FILE *logerr; static char LOGFILE_NAME[] = "/var/tmp/xfs_copy.log.XXXXXX"; diff --git a/db/crc.c b/db/crc.c index c4136a4..23702cc 100644 --- a/db/crc.c +++ b/db/crc.c @@ -17,6 +17,7 @@ #include "output.h" #include "bit.h" #include "print.h" +#include "crc.h" static int crc_f(int argc, char **argv); static void crc_help(void); diff --git a/db/fuzz.c b/db/fuzz.c index 5d5d54f..65157bd 100644 --- a/db/fuzz.c +++ b/db/fuzz.c @@ -21,6 +21,7 @@ #include "print.h" #include "write.h" #include "malloc.h" +#include "fuzz.h" static int fuzz_f(int argc, char **argv); static void fuzz_help(void); diff --git a/db/hash.c b/db/hash.c index bda3316..68c53e7 100644 --- a/db/hash.c +++ b/db/hash.c @@ -10,6 +10,7 @@ #include "type.h" #include "io.h" #include "output.h" +#include "hash.h" static int hash_f(int argc, char **argv); static void hash_help(void); diff --git a/db/logformat.c b/db/logformat.c index 42ce245..3374c29 100644 --- a/db/logformat.c +++ b/db/logformat.c @@ -9,6 +9,7 @@ #include "init.h" #include "output.h" #include "libxlog.h" +#include "logformat.h" #define MAX_LSUNIT 256 * 1024 /* max log buf. size */ diff --git a/db/symlink.c b/db/symlink.c index ebf6637..752cae4 100644 --- a/db/symlink.c +++ b/db/symlink.c @@ -11,7 +11,7 @@ #include "field.h" #include "bit.h" #include "init.h" - +#include "symlink.h" /* * XXX: no idea how to handle multiple contiguous block symlinks here. diff --git a/db/text.c b/db/text.c index 3a279d1..adf33a7 100644 --- a/db/text.c +++ b/db/text.c @@ -17,6 +17,7 @@ #include "io.h" #include "output.h" #include "init.h" +#include "text.h" static void print_rawtext(void *data, int len); diff --git a/include/avl64.h b/include/avl64.h index 7a66883..4042f6c 100644 --- a/include/avl64.h +++ b/include/avl64.h @@ -69,6 +69,12 @@ avl64_insert_immediate( avl64node_t *afterp, avl64node_t *newnode); +avl64node_t * +avl64_firstino(avl64node_t *root); + +avl64node_t * +avl64_lastino(avl64node_t *root); + void avl64_init_tree( avl64tree_desc_t *tree, diff --git a/include/kmem.h b/include/kmem.h index 03475c6..ec19ee7 100644 --- a/include/kmem.h +++ b/include/kmem.h @@ -6,6 +6,8 @@ #ifndef __KMEM_H__ #define __KMEM_H__ +#include + #define KM_SLEEP 0x0001u #define KM_NOSLEEP 0x0002u #define KM_NOFS 0x0004u diff --git a/include/libxfs.h b/include/libxfs.h index 2bdef70..a690008 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -133,8 +133,6 @@ extern dev_t libxfs_device_open (char *, int, int, int); extern void libxfs_device_close (dev_t); extern int libxfs_device_alignment (void); extern void libxfs_report(FILE *); -extern void platform_findsizes(char *path, int fd, long long *sz, int *bsz); -extern int platform_nproc(void); /* check or write log footer: specify device, log size in blocks & uuid */ typedef char *(libxfs_get_block_t)(char *, int, void *); diff --git a/io/getrusage.c b/io/getrusage.c index ba704b7..6962913 100644 --- a/io/getrusage.c +++ b/io/getrusage.c @@ -9,6 +9,7 @@ #include #include #include "init.h" +#include "io.h" static cmdinfo_t getrusage_cmd; diff --git a/io/log_writes.c b/io/log_writes.c index 114f818..9c2285f 100644 --- a/io/log_writes.c +++ b/io/log_writes.c @@ -8,6 +8,7 @@ #include #include "command.h" #include "init.h" +#include "io.h" static cmdinfo_t log_writes_cmd; diff --git a/libfrog/crc32.c b/libfrog/crc32.c index 1d52f68..e3f3fd1 100644 --- a/libfrog/crc32.c +++ b/libfrog/crc32.c @@ -33,6 +33,7 @@ #include "xfs.h" #include "xfs_arch.h" #include "crc32defs.h" +#include "crc32c.h" /* types specifc to this file */ typedef __u8 u8; diff --git a/libfrog/linux.c b/libfrog/linux.c index fc9f3ac..baf75ab 100644 --- a/libfrog/linux.c +++ b/libfrog/linux.c @@ -10,6 +10,7 @@ #include #include "libxfs_priv.h" +#include "init.h" #include "xfs_fs.h" extern char *progname; diff --git a/libfrog/topology.c b/libfrog/topology.c index cac164f..2453b84 100644 --- a/libfrog/topology.c +++ b/libfrog/topology.c @@ -10,6 +10,7 @@ # include #endif /* ENABLE_BLKID */ #include "xfs_multidisk.h" +#include "init.h" #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog))) #define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog))) diff --git a/libxfs/init.c b/libxfs/init.c index 10dcbf3..80fbe6a 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -363,15 +363,6 @@ done: static int manage_zones(int release) { - extern kmem_zone_t *xfs_buf_zone; - extern kmem_zone_t *xfs_ili_zone; - extern kmem_zone_t *xfs_inode_zone; - extern kmem_zone_t *xfs_ifork_zone; - extern kmem_zone_t *xfs_buf_item_zone; - extern kmem_zone_t *xfs_da_state_zone; - extern kmem_zone_t *xfs_btree_cur_zone; - extern kmem_zone_t *xfs_bmap_free_item_zone; - extern kmem_zone_t *xfs_trans_zone; extern void xfs_dir_startup(); if (release) { /* free zone allocation */ diff --git a/libxfs/init.h b/libxfs/init.h index e0b5091..227c768 100644 --- a/libxfs/init.h +++ b/libxfs/init.h @@ -6,7 +6,10 @@ #ifndef LIBXFS_INIT_H #define LIBXFS_INIT_H +#include "kmem.h" + struct stat; +extern int use_xfs_buf_lock; extern int platform_check_ismounted (char *path, char *block, struct stat *sptr, int verbose); @@ -19,5 +22,13 @@ extern char *platform_findblockpath (char *path); extern int platform_direct_blockdev (void); extern int platform_align_blockdev (void); extern unsigned long platform_physmem(void); /* in kilobytes */ +extern void platform_findsizes(char *path, int fd, long long *sz, int *bsz); +extern int platform_nproc(void); + +extern kmem_zone_t *xfs_buf_item_zone; +extern kmem_zone_t *xfs_ili_zone; +extern kmem_zone_t *xfs_buf_zone; +extern kmem_zone_t *xfs_inode_zone; +extern kmem_zone_t *xfs_trans_zone; #endif /* LIBXFS_INIT_H */ diff --git a/libxfs/logitem.c b/libxfs/logitem.c index 4da9bc1..e850680 100644 --- a/libxfs/logitem.c +++ b/libxfs/logitem.c @@ -15,6 +15,7 @@ #include "xfs_inode_fork.h" #include "xfs_inode.h" #include "xfs_trans.h" +#include "init.h" kmem_zone_t *xfs_buf_item_zone; kmem_zone_t *xfs_ili_zone; /* inode log item zone */ diff --git a/libxfs/trans.c b/libxfs/trans.c index 46ff8b4..eb1e390 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -18,6 +18,7 @@ #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_defer.h" +#include "init.h" static void xfs_trans_free_items(struct xfs_trans *tp); STATIC struct xfs_trans *xfs_trans_dup(struct xfs_trans *tp); diff --git a/libxfs/util.c b/libxfs/util.c index 9932186..0a9a08e 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -5,6 +5,7 @@ */ #include "libxfs_priv.h" +#include "libxfs.h" #include "libxfs_io.h" #include "init.h" #include "xfs_fs.h" diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c index 3375e08..b48c5d4 100644 --- a/mdrestore/xfs_mdrestore.c +++ b/mdrestore/xfs_mdrestore.c @@ -5,6 +5,7 @@ */ #include "libxfs.h" +#include "init.h" #include "xfs_metadump.h" char *progname; @@ -183,8 +184,6 @@ usage(void) exit(1); } -extern int platform_check_ismounted(char *, char *, struct stat *, int); - int main( int argc, diff --git a/repair/phase2.c b/repair/phase2.c index b92ceb8..4bd6c63 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -15,8 +15,6 @@ #include "progress.h" #include "scan.h" -void set_mp(xfs_mount_t *mpp); - /* workaround craziness in the xlog routines */ int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *t, int p) { diff --git a/repair/scan.h b/repair/scan.h index aa7c38d..cf4d563 100644 --- a/repair/scan.h +++ b/repair/scan.h @@ -58,4 +58,5 @@ scan_ags( struct xfs_mount *mp, int scan_threads); +extern void set_mp(xfs_mount_t *mpp); #endif /* _XR_SCAN_H */ diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 41ab301..b73e611 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -22,6 +22,7 @@ #include "dinode.h" #include "slab.h" #include "rmap.h" +#include "init.h" /* * option tables for getsubopt calls diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index 076a86a..c611f1f 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -10,6 +10,7 @@ #include #include #include +#include "libxfs.h" #include "platform_defs.h" #include "input.h" #include "path.h" From patchwork Fri Oct 5 04:03:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D6EA112B for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E0B62881E for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 230212925D; Fri, 5 Oct 2018 04:03:28 +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 555DB2881E for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727578AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: from sandeen.net ([63.231.237.45]:48102 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id 2B45D2B27; Thu, 4 Oct 2018 23:03:19 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 12/15] xfsprogs: kill EXTERN macro Date: Thu, 4 Oct 2018 23:03:13 -0500 Message-Id: <1538712196-13625-13-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen The EXTERN macro was a too-clever hack to allow a header file to both declare global variables and export them. Get rid of the hack and do things the predictable way. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- repair/globals.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++-- repair/globals.h | 136 +++++++++++++++++++++++++++--------------------------- repair/versions.c | 23 +++++++-- repair/versions.h | 16 +++---- 4 files changed, 214 insertions(+), 84 deletions(-) diff --git a/repair/globals.c b/repair/globals.c index d00e964..e963edb 100644 --- a/repair/globals.c +++ b/repair/globals.c @@ -1,10 +1,125 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. + * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. * All Rights Reserved. */ -#include "libxfs.h" - -#define EXTERN #include "globals.h" + +/* global variables for xfs_repair */ + +/* arguments and argument flag variables */ + +char *fs_name; /* name of filesystem */ +int verbose; /* verbose flag, mostly for debugging */ + + +/* for reading stuff in manually (bypassing libsim) */ + +char *iobuf; /* large buffer */ +int iobuf_size; +char *smallbuf; /* small (1-4 page) buffer */ +int smallbuf_size; +int sbbuf_size; + +/* direct I/O info */ + +int minio_align; /* min I/O size and alignment */ +int mem_align; /* memory alignment */ +int max_iosize; /* max I/O size */ + +/* file descriptors */ + +int fs_fd; /* filesystem fd */ + +/* command-line flags */ + +int verbose; +int no_modify; +int dangerously; /* live dangerously ... fix ro mount */ +int isa_file; +int zap_log; +int dumpcore; /* abort, not exit on fatal errs */ +int force_geo; /* can set geo on low confidence info */ +int assume_xfs; /* assume we have an xfs fs */ +char *log_name; /* Name of log device */ +int log_spec; /* Log dev specified as option */ +char *rt_name; /* Name of realtime device */ +int rt_spec; /* Realtime dev specified as option */ +int convert_lazy_count; /* Convert lazy-count mode on/off */ +int lazy_count; /* What to set if to if converting */ + +/* misc status variables */ + +int primary_sb_modified; +int bad_ino_btree; +int copied_sunit; +int fs_is_dirty; + +/* for hunting down the root inode */ + +int need_root_inode; +int need_root_dotdot; + +int need_rbmino; +int need_rsumino; + +int lost_quotas; +int have_uquotino; +int have_gquotino; +int have_pquotino; +int lost_uquotino; +int lost_gquotino; +int lost_pquotino; + +xfs_agino_t first_prealloc_ino; +xfs_agino_t last_prealloc_ino; +xfs_agblock_t bnobt_root; +xfs_agblock_t bcntbt_root; +xfs_agblock_t inobt_root; + +/* configuration vars -- fs geometry dependent */ + +int inodes_per_block; +int inodes_per_cluster; +unsigned int glob_agcount; +int chunks_pblock; /* # of 64-ino chunks per allocation */ +int max_symlink_blocks; +int64_t fs_max_file_offset; + +/* realtime info */ + +xfs_rtword_t *btmcompute; +xfs_suminfo_t *sumcompute; + +/* inode tree records have full or partial backptr fields ? */ + +int full_ino_ex_data; /* + * if 1, use ino_ex_data_t component + * of ino_un union, if 0, use + * parent_list_t component. see + * incore.h for more details + */ + +#define ORPHANAGE "lost+found" + +/* superblock counters */ + +uint64_t sb_icount; /* allocated (made) inodes */ +uint64_t sb_ifree; /* free inodes */ +uint64_t sb_fdblocks; /* free data blocks */ +uint64_t sb_frextents; /* free realtime extents */ + +/* superblock geometry info */ + +xfs_extlen_t sb_inoalignmt; +uint32_t sb_unit; +uint32_t sb_width; + +struct aglock *ag_locks; + +int report_interval; +uint64_t *prog_rpt_done; + +int ag_stride; +int thread_count; diff --git a/repair/globals.h b/repair/globals.h index 9a9465f..05121d4 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -7,9 +7,7 @@ #ifndef _XFS_REPAIR_GLOBAL_H #define _XFS_REPAIR_GLOBAL_H -#ifndef EXTERN -#define EXTERN extern -#endif +#include "libxfs.h" /* useful macros */ @@ -53,91 +51,91 @@ /* arguments and argument flag variables */ -EXTERN char *fs_name; /* name of filesystem */ -EXTERN int verbose; /* verbose flag, mostly for debugging */ +extern char *fs_name; /* name of filesystem */ +extern int verbose; /* verbose flag, mostly for debugging */ /* for reading stuff in manually (bypassing libsim) */ -EXTERN char *iobuf; /* large buffer */ -EXTERN int iobuf_size; -EXTERN char *smallbuf; /* small (1-4 page) buffer */ -EXTERN int smallbuf_size; -EXTERN int sbbuf_size; +extern char *iobuf; /* large buffer */ +extern int iobuf_size; +extern char *smallbuf; /* small (1-4 page) buffer */ +extern int smallbuf_size; +extern int sbbuf_size; /* direct I/O info */ -EXTERN int minio_align; /* min I/O size and alignment */ -EXTERN int mem_align; /* memory alignment */ -EXTERN int max_iosize; /* max I/O size */ +extern int minio_align; /* min I/O size and alignment */ +extern int mem_align; /* memory alignment */ +extern int max_iosize; /* max I/O size */ /* file descriptors */ -EXTERN int fs_fd; /* filesystem fd */ +extern int fs_fd; /* filesystem fd */ /* command-line flags */ -EXTERN int verbose; -EXTERN int no_modify; -EXTERN int dangerously; /* live dangerously ... fix ro mount */ -EXTERN int isa_file; -EXTERN int zap_log; -EXTERN int dumpcore; /* abort, not exit on fatal errs */ -EXTERN int force_geo; /* can set geo on low confidence info */ -EXTERN int assume_xfs; /* assume we have an xfs fs */ -EXTERN char *log_name; /* Name of log device */ -EXTERN int log_spec; /* Log dev specified as option */ -EXTERN char *rt_name; /* Name of realtime device */ -EXTERN int rt_spec; /* Realtime dev specified as option */ -EXTERN int convert_lazy_count; /* Convert lazy-count mode on/off */ -EXTERN int lazy_count; /* What to set if to if converting */ +extern int verbose; +extern int no_modify; +extern int dangerously; /* live dangerously ... fix ro mount */ +extern int isa_file; +extern int zap_log; +extern int dumpcore; /* abort, not exit on fatal errs */ +extern int force_geo; /* can set geo on low confidence info */ +extern int assume_xfs; /* assume we have an xfs fs */ +extern char *log_name; /* Name of log device */ +extern int log_spec; /* Log dev specified as option */ +extern char *rt_name; /* Name of realtime device */ +extern int rt_spec; /* Realtime dev specified as option */ +extern int convert_lazy_count; /* Convert lazy-count mode on/off */ +extern int lazy_count; /* What to set if to if converting */ /* misc status variables */ -EXTERN int primary_sb_modified; -EXTERN int bad_ino_btree; -EXTERN int copied_sunit; -EXTERN int fs_is_dirty; +extern int primary_sb_modified; +extern int bad_ino_btree; +extern int copied_sunit; +extern int fs_is_dirty; /* for hunting down the root inode */ -EXTERN int need_root_inode; -EXTERN int need_root_dotdot; +extern int need_root_inode; +extern int need_root_dotdot; -EXTERN int need_rbmino; -EXTERN int need_rsumino; +extern int need_rbmino; +extern int need_rsumino; -EXTERN int lost_quotas; -EXTERN int have_uquotino; -EXTERN int have_gquotino; -EXTERN int have_pquotino; -EXTERN int lost_uquotino; -EXTERN int lost_gquotino; -EXTERN int lost_pquotino; +extern int lost_quotas; +extern int have_uquotino; +extern int have_gquotino; +extern int have_pquotino; +extern int lost_uquotino; +extern int lost_gquotino; +extern int lost_pquotino; -EXTERN xfs_agino_t first_prealloc_ino; -EXTERN xfs_agino_t last_prealloc_ino; -EXTERN xfs_agblock_t bnobt_root; -EXTERN xfs_agblock_t bcntbt_root; -EXTERN xfs_agblock_t inobt_root; +extern xfs_agino_t first_prealloc_ino; +extern xfs_agino_t last_prealloc_ino; +extern xfs_agblock_t bnobt_root; +extern xfs_agblock_t bcntbt_root; +extern xfs_agblock_t inobt_root; /* configuration vars -- fs geometry dependent */ -EXTERN int inodes_per_block; -EXTERN int inodes_per_cluster; -EXTERN unsigned int glob_agcount; -EXTERN int chunks_pblock; /* # of 64-ino chunks per allocation */ -EXTERN int max_symlink_blocks; -EXTERN int64_t fs_max_file_offset; +extern int inodes_per_block; +extern int inodes_per_cluster; +extern unsigned int glob_agcount; +extern int chunks_pblock; /* # of 64-ino chunks per allocation */ +extern int max_symlink_blocks; +extern int64_t fs_max_file_offset; /* realtime info */ -EXTERN xfs_rtword_t *btmcompute; -EXTERN xfs_suminfo_t *sumcompute; +extern xfs_rtword_t *btmcompute; +extern xfs_suminfo_t *sumcompute; /* inode tree records have full or partial backptr fields ? */ -EXTERN int full_ino_ex_data;/* +extern int full_ino_ex_data;/* * if 1, use ino_ex_data_t component * of ino_un union, if 0, use * parent_list_t component. see @@ -148,26 +146,26 @@ EXTERN int full_ino_ex_data;/* /* superblock counters */ -EXTERN uint64_t sb_icount; /* allocated (made) inodes */ -EXTERN uint64_t sb_ifree; /* free inodes */ -EXTERN uint64_t sb_fdblocks; /* free data blocks */ -EXTERN uint64_t sb_frextents; /* free realtime extents */ +extern uint64_t sb_icount; /* allocated (made) inodes */ +extern uint64_t sb_ifree; /* free inodes */ +extern uint64_t sb_fdblocks; /* free data blocks */ +extern uint64_t sb_frextents; /* free realtime extents */ /* superblock geometry info */ -EXTERN xfs_extlen_t sb_inoalignmt; -EXTERN uint32_t sb_unit; -EXTERN uint32_t sb_width; +extern xfs_extlen_t sb_inoalignmt; +extern uint32_t sb_unit; +extern uint32_t sb_width; struct aglock { pthread_mutex_t lock __attribute__((__aligned__(64))); }; -EXTERN struct aglock *ag_locks; +extern struct aglock *ag_locks; -EXTERN int report_interval; -EXTERN uint64_t *prog_rpt_done; +extern int report_interval; +extern uint64_t *prog_rpt_done; -EXTERN int ag_stride; -EXTERN int thread_count; +extern int ag_stride; +extern int thread_count; #endif /* _XFS_REPAIR_GLOBAL_H */ diff --git a/repair/versions.c b/repair/versions.c index 9766e92..8fad41f 100644 --- a/repair/versions.c +++ b/repair/versions.c @@ -6,11 +6,28 @@ #include "libxfs.h" -#define EXTERN -#include "versions.h" -#undef EXTERN #include "err_protos.h" #include "globals.h" +#include "versions.h" + +/* + * filesystem feature global vars, set to 1 if the feature + * is on, 0 otherwise + */ + +int fs_attributes; +int fs_attributes2; +int fs_inode_nlink; +int fs_quotas; +int fs_aligned_inodes; +int fs_sb_feature_bits; +int fs_has_extflgbit; + +/* + * inode chunk alignment, fsblocks + */ + +xfs_extlen_t fs_ino_alignment; void update_sb_version(xfs_mount_t *mp) diff --git a/repair/versions.h b/repair/versions.h index 0cecf16..e1e2521 100644 --- a/repair/versions.h +++ b/repair/versions.h @@ -16,19 +16,19 @@ * is on, 0 otherwise */ -EXTERN int fs_attributes; -EXTERN int fs_attributes2; -EXTERN int fs_inode_nlink; -EXTERN int fs_quotas; -EXTERN int fs_aligned_inodes; -EXTERN int fs_sb_feature_bits; -EXTERN int fs_has_extflgbit; +extern int fs_attributes; +extern int fs_attributes2; +extern int fs_inode_nlink; +extern int fs_quotas; +extern int fs_aligned_inodes; +extern int fs_sb_feature_bits; +extern int fs_has_extflgbit; /* * inode chunk alignment, fsblocks */ -EXTERN xfs_extlen_t fs_ino_alignment; +extern xfs_extlen_t fs_ino_alignment; /* * modify superblock to reflect current state of global fs From patchwork Fri Oct 5 04:03:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD256112B for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB4952925D for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C029429261; Fri, 5 Oct 2018 04:03:28 +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 3F501290B4 for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727616AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: from sandeen.net ([63.231.237.45]:48110 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727652AbeJELAN (ORCPT ); Fri, 5 Oct 2018 07:00:13 -0400 Received: by sandeen.net (Postfix, from userid 500) id 375734A2; Thu, 4 Oct 2018 23:03:19 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 13/15] libxfs: export unused nonstatic functions to quiet static checkers Date: Thu, 4 Oct 2018 23:03:14 -0500 Message-Id: <1538712196-13625-14-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen libxfs functions which aren't used or exported get flagged as "should be static" but we stay in sync with kernelspace, which has other headers which export them. Export the lot of them in libxfs_priv.h to shut up sparse. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- libxfs/libxfs_priv.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index b4bdc64..b29e887 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -606,5 +606,59 @@ static inline int test_bit(int nr, const volatile unsigned long *addr) return *p & mask; } +/* Keep static checkers quiet about nonstatic functions by exporting */ +int xfs_inode_hasattr(struct xfs_inode *ip); +int xfs_attr_get_ilocked(struct xfs_inode *ip, struct xfs_da_args *args); +int xfs_attr_get(struct xfs_inode *ip, const unsigned char *name, + unsigned char *value, int *valuelenp, int flags); +int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name, + unsigned char *value, int valuelen, int flags); +int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags); + +int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t block, int issum, struct xfs_buf **bpp); +int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, int val, + xfs_rtblock_t *new, int *stat); +int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_rtblock_t limit, + xfs_rtblock_t *rtblock); +int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_rtblock_t limit, + xfs_rtblock_t *rtblock); +int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, int val); +int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp, + int log, xfs_rtblock_t bbno, int delta, + xfs_buf_t **rbpp, xfs_fsblock_t *rsb, + xfs_suminfo_t *sum); +int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log, + xfs_rtblock_t bbno, int delta, xfs_buf_t **rbpp, + xfs_fsblock_t *rsb); +int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, + struct xfs_buf **rbpp, xfs_fsblock_t *rsb); +int xfs_rtalloc_query_range(struct xfs_trans *tp, + struct xfs_rtalloc_rec *low_rec, + struct xfs_rtalloc_rec *high_rec, + xfs_rtalloc_query_range_fn fn, + void *priv); +int xfs_rtalloc_query_all(struct xfs_trans *tp, + xfs_rtalloc_query_range_fn fn, + void *priv); +bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno); +int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp, + xfs_rtblock_t start, xfs_extlen_t len, + bool *is_free); +/* xfs_bmap_util.h */ +struct xfs_bmalloca; +int xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp, + struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz, + int rt, int eof, int delay, int convert, + xfs_fileoff_t *offp, xfs_extlen_t *lenp); +void xfs_bmap_adjacent(struct xfs_bmalloca *ap); +int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip, + int whichfork, struct xfs_bmbt_irec *rec, + int *is_empty); #endif /* __LIBXFS_INTERNAL_XFS_H__ */ From patchwork Fri Oct 5 04:03:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7AB501731 for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A14B2925B for ; Fri, 5 Oct 2018 04:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F05F2925D; Fri, 5 Oct 2018 04:03:29 +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 A15592907B for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727576AbeJELAP (ORCPT ); Fri, 5 Oct 2018 07:00:15 -0400 Received: from sandeen.net ([63.231.237.45]:48098 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727535AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: by sandeen.net (Postfix, from userid 500) id 5C0D4544; Thu, 4 Oct 2018 23:03:19 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 14/15] xfsprogs: eliminate shadow variables Date: Thu, 4 Oct 2018 23:03:15 -0500 Message-Id: <1538712196-13625-15-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen None of these seem activel harmful, but to avoid confusion, remove all shadow variables by just renaming them in their local scope. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen --- db/check.c | 15 +++++++-------- db/metadump.c | 2 +- io/mmap.c | 8 ++++---- logprint/log_misc.c | 43 ++++++++++++++++++++++--------------------- repair/scan.c | 22 +++++++++++----------- scrub/xfs_scrub.c | 9 +++++---- 6 files changed, 50 insertions(+), 49 deletions(-) diff --git a/db/check.c b/db/check.c index 754441c..04c3212 100644 --- a/db/check.c +++ b/db/check.c @@ -2050,7 +2050,7 @@ process_block_dir_v2( int nex; xfs_ino_t parent; int v; - int x; + int i; nex = blkmap_getn(blkmap, 0, mp->m_dir_geo->fsbcount, &bmp); v = id->ilist || verbose; @@ -2067,9 +2067,9 @@ process_block_dir_v2( make_bbmap(&bbmap, nex, bmp); set_cur(&typtab[TYP_DIR2], XFS_FSB_TO_DADDR(mp, bmp->startblock), mp->m_dir_geo->fsbcount * blkbb, DB_RING_IGN, nex > 1 ? &bbmap : NULL); - for (x = 0; !v && x < nex; x++) { - for (b = bmp[x].startblock; - !v && b < bmp[x].startblock + bmp[x].blockcount; + for (i = 0; !v && i < nex; i++) { + for (b = bmp[i].startblock; + !v && b < bmp[i].startblock + bmp[i].blockcount; b++) v = CHECK_BLIST(b); } @@ -2998,7 +2998,6 @@ process_leaf_node_dir_v2( int t = 0; int v; int v2; - int x; v2 = verbose || id->ilist; v = parent = 0; @@ -3012,9 +3011,9 @@ process_leaf_node_dir_v2( while ((dbno = blkmap_next_off(blkmap, dbno, &t)) != NULLFILEOFF) { nex = blkmap_getn(blkmap, dbno, mp->m_dir_geo->fsbcount, &bmp); ASSERT(nex > 0); - for (v = v2, x = 0; !v && x < nex; x++) { - for (b = bmp[x].startblock; - !v && b < bmp[x].startblock + bmp[x].blockcount; + for (v = v2, i = 0; !v && i < nex; i++) { + for (b = bmp[i].startblock; + !v && b < bmp[i].startblock + bmp[i].blockcount; b++) v = CHECK_BLIST(b); } diff --git a/db/metadump.c b/db/metadump.c index cc2ae9a..8f85f4c 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -1515,7 +1515,7 @@ process_dir_data_block( dup = (xfs_dir2_data_unused_t *)ptr; if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { - int length = be16_to_cpu(dup->length); + length = be16_to_cpu(dup->length); if (dir_offset + length > end_of_data || !length || (length & (XFS_DIR2_DATA_ALIGN - 1))) { if (show_warnings) diff --git a/io/mmap.c b/io/mmap.c index 44749bb..1130b9b 100644 --- a/io/mmap.c +++ b/io/mmap.c @@ -30,7 +30,7 @@ print_mapping( int index, int braces) { - char buffer[8] = { 0 }; + char buf[8] = { 0 }; int i; static struct { @@ -44,16 +44,16 @@ print_mapping( }; for (i = 0, p = pflags; p->prot != PROT_NONE; i++, p++) - buffer[i] = (map->prot & p->prot) ? p->mode : '-'; + buf[i] = (map->prot & p->prot) ? p->mode : '-'; if (map->map_sync) - sprintf(&buffer[i], " S"); + sprintf(&buf[i], " S"); printf("%c%03d%c 0x%lx - 0x%lx %s %14s (%lld : %ld)\n", braces? '[' : ' ', index, braces? ']' : ' ', (unsigned long)map->addr, (unsigned long)((char *)map->addr + map->length), - buffer, map->name ? map->name : "???", + buf, map->name ? map->name : "???", (long long)map->offset, (long)map->length); } diff --git a/logprint/log_misc.c b/logprint/log_misc.c index e29366a..0c51d20 100644 --- a/logprint/log_misc.c +++ b/logprint/log_misc.c @@ -192,7 +192,6 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops) int64_t blkno; xfs_buf_log_format_t lbuf; int size, blen, map_size, struct_size; - __be64 x, y; unsigned short flags; /* @@ -247,20 +246,22 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops) if (be32_to_cpu(head->oh_len) < 4*8) { printf(_("Out of space\n")); } else { + __be64 a, b; + printf("\n"); /* * memmove because *ptr may not be 8-byte aligned */ - memmove(&x, *ptr, sizeof(__be64)); - memmove(&y, *ptr+8, sizeof(__be64)); - printf(_("icount: %llu ifree: %llu "), - (unsigned long long) be64_to_cpu(x), - (unsigned long long) be64_to_cpu(y)); - memmove(&x, *ptr+16, sizeof(__be64)); - memmove(&y, *ptr+24, sizeof(__be64)); - printf(_("fdblks: %llu frext: %llu\n"), - (unsigned long long) be64_to_cpu(x), - (unsigned long long) be64_to_cpu(y)); + memmove(&a, *ptr, sizeof(__be64)); + memmove(&b, *ptr+8, sizeof(__be64)); + printf(_("icount: %llu ifree: %llu "), + (unsigned long long) be64_to_cpu(a), + (unsigned long long) be64_to_cpu(b)); + memmove(&a, *ptr+16, sizeof(__be64)); + memmove(&b, *ptr+24, sizeof(__be64)); + printf(_("fdblks: %llu frext: %llu\n"), + (unsigned long long) be64_to_cpu(a), + (unsigned long long) be64_to_cpu(b)); } super_block = 0; } else if (be32_to_cpu(*(__be32 *)(*ptr)) == XFS_AGI_MAGIC) { @@ -394,15 +395,15 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops) if (print_data) { uint *dp = (uint *)*ptr; int nums = be32_to_cpu(head->oh_len) >> 2; - int i = 0; + int j = 0; - while (i < nums) { - if ((i % 8) == 0) - printf("%2x ", i); + while (j < nums) { + if ((j % 8) == 0) + printf("%2x ", j); printf("%8x ", *dp); dp++; - i++; - if ((i % 8) == 0) + j++; + if ((j % 8) == 0) printf("\n"); } printf("\n"); @@ -1185,7 +1186,7 @@ xlog_print_extended_headers( int num_hdrs; int num_required; char xhbuf[XLOG_HEADER_SIZE]; - xlog_rec_ext_header_t *x; + xlog_rec_ext_header_t *xhdr; num_required = howmany(len, XLOG_HEADER_CYCLE_SIZE); num_hdrs = be32_to_cpu(hdr->h_size) / XLOG_HEADER_CYCLE_SIZE; @@ -1210,7 +1211,7 @@ xlog_print_extended_headers( *ret_num_hdrs = num_hdrs; /* don't include 1st header */ - for (i = 1, x = *ret_xhdrs; i < num_hdrs; i++, (*blkno)++, x++) { + for (i = 1, xhdr = *ret_xhdrs; i < num_hdrs; i++, (*blkno)++, xhdr++) { /* read one extra header blk */ if (read(fd, xhbuf, 512) == 0) { printf(_("%s: physical end of log\n"), progname); @@ -1240,9 +1241,9 @@ xlog_print_extended_headers( * will look asymmetric with the 1 hdr normal case * which does endian coversion on access. */ - x->xh_cycle = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle; + xhdr->xh_cycle = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle; for (j = 0; j < XLOG_HEADER_CYCLE_SIZE / BBSIZE; j++) { - x->xh_cycle_data[j] = + xhdr->xh_cycle_data[j] = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle_data[j]; } } diff --git a/repair/scan.c b/repair/scan.c index 65a76e2..12ca314 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -738,7 +738,7 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"), } for (i = 0; i < numrecs; i++) { - xfs_agblock_t bno = be32_to_cpu(pp[i]); + xfs_agblock_t agbno = be32_to_cpu(pp[i]); /* * XXX - put sibling detection right here. @@ -749,17 +749,17 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"), * pointer mismatch, try and extract as much data * as possible. */ - if (bno != 0 && verify_agbno(mp, agno, bno)) { + if (agbno != 0 && verify_agbno(mp, agno, agbno)) { switch (magic) { case XFS_ABTB_CRC_MAGIC: case XFS_ABTB_MAGIC: - scan_sbtree(bno, level, agno, suspect, + scan_sbtree(agbno, level, agno, suspect, scan_allocbt, 0, magic, priv, &xfs_allocbt_buf_ops); break; case XFS_ABTC_CRC_MAGIC: case XFS_ABTC_MAGIC: - scan_sbtree(bno, level, agno, suspect, + scan_sbtree(agbno, level, agno, suspect, scan_allocbt, 0, magic, priv, &xfs_allocbt_buf_ops); break; @@ -1177,7 +1177,7 @@ advance: } for (i = 0; i < numrecs; i++) { - xfs_agblock_t bno = be32_to_cpu(pp[i]); + xfs_agblock_t agbno = be32_to_cpu(pp[i]); /* * XXX - put sibling detection right here. @@ -1199,12 +1199,12 @@ advance: /* Look for impossible flags. */ do_warn( _("invalid flags in high key %u of %s btree block %u/%u\n"), - i, name, agno, bno); + i, name, agno, agbno); continue; } - if (bno != 0 && verify_agbno(mp, agno, bno)) { - scan_sbtree(bno, level, agno, suspect, scan_rmapbt, 0, + if (agbno != 0 && verify_agbno(mp, agno, agbno)) { + scan_sbtree(agbno, level, agno, suspect, scan_rmapbt, 0, magic, priv, &xfs_rmapbt_buf_ops); } } @@ -1419,10 +1419,10 @@ _("extent (%u/%u) len %u claimed, state is %d\n"), } for (i = 0; i < numrecs; i++) { - xfs_agblock_t bno = be32_to_cpu(pp[i]); + xfs_agblock_t agbno = be32_to_cpu(pp[i]); - if (bno != 0 && verify_agbno(mp, agno, bno)) { - scan_sbtree(bno, level, agno, suspect, scan_refcbt, 0, + if (agbno != 0 && verify_agbno(mp, agno, agbno)) { + scan_sbtree(agbno, level, agno, suspect, scan_refcbt, 0, magic, priv, &xfs_refcountbt_buf_ops); } } diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index c611f1f..0f9f765 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -423,7 +423,6 @@ run_scrub_phases( bool moveon = true; unsigned int debug_phase = 0; unsigned int phase; - unsigned int nr_threads; int rshift; if (debug && debug_tweak_on("XFS_SCRUB_PHASE")) @@ -455,12 +454,14 @@ run_scrub_phases( if (!moveon) break; if (sp->estimate_work) { - moveon = sp->estimate_work(ctx, &max_work, &nr_threads, - &rshift); + unsigned int work_threads; + + moveon = sp->estimate_work(ctx, &max_work, + &work_threads, &rshift); if (!moveon) break; moveon = progress_init_phase(ctx, progress_fp, phase, - max_work, rshift, nr_threads); + max_work, rshift, work_threads); } else { moveon = progress_init_phase(ctx, NULL, phase, 0, 0, 0); } From patchwork Fri Oct 5 04:03:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10627343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7251A184E for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 648932881E for ; Fri, 5 Oct 2018 04:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 597442925D; Fri, 5 Oct 2018 04:03:28 +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 E059A2907B for ; Fri, 5 Oct 2018 04:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727599AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: from sandeen.net ([63.231.237.45]:48096 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727576AbeJELAO (ORCPT ); Fri, 5 Oct 2018 07:00:14 -0400 Received: by sandeen.net (Postfix, from userid 500) id 77F7722C7; Thu, 4 Oct 2018 23:03:19 -0500 (CDT) From: Eric Sandeen To: linux-xfs@vger.kernel.org Subject: [PATCH 15/15] libfrog: change project entity variable scope Date: Thu, 4 Oct 2018 23:03:16 -0500 Message-Id: <1538712196-13625-16-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> References: <1538712196-13625-1-git-send-email-sandeen@sandeen.net> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Sandeen The global "p" got shadowed in some other functions, and it was a bit hard to keep track of what's what. Change the scope of some of the project entity retrieval function variables to make the behavior more clear. Fixes sparse warnings about this. Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen --- libfrog/projects.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libfrog/projects.c b/libfrog/projects.c index d4dda3f..91bc78f 100644 --- a/libfrog/projects.c +++ b/libfrog/projects.c @@ -15,12 +15,8 @@ char *projid_file; char *projects_file; static FILE *projects; -static fs_project_t p; -static char projects_buffer[512]; static FILE *project_paths; -static fs_project_path_t pp; -static char project_paths_buffer[1024]; void setprfiles(void) @@ -64,8 +60,10 @@ endprpathent(void) fs_project_t * getprent(void) { - char *idstart, *idend; - size_t size = sizeof(projects_buffer) - 1; + static fs_project_t p; + static char projects_buffer[512]; + char *idstart, *idend; + size_t size = sizeof(projects_buffer) - 1; if (!projects) return NULL; @@ -125,6 +123,8 @@ getprprid( fs_project_path_t * getprpathent(void) { + static fs_project_path_t pp; + static char project_paths_buffer[1024]; char *nmstart, *nmend; size_t size = sizeof(project_paths_buffer) - 1;