From patchwork Sat Aug 6 10:45:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Janda X-Patchwork-Id: 9266223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE7C26075A for ; Sun, 7 Aug 2016 07:35:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D197E27D4D for ; Sun, 7 Aug 2016 07:35:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C633427F88; Sun, 7 Aug 2016 07:35:57 +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=-3.2 required=2.0 tests=BAYES_00, DATE_IN_PAST_12_24, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B52027D4D for ; Sun, 7 Aug 2016 07:35:57 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id E4F217CE4; Sun, 7 Aug 2016 02:35:50 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay2.corp.sgi.com [137.38.102.29]) by oss.sgi.com (Postfix) with ESMTP id 9E03B7CDA for ; Sun, 7 Aug 2016 02:35:48 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay2.corp.sgi.com (Postfix) with ESMTP id 6F6A6304048 for ; Sun, 7 Aug 2016 00:35:48 -0700 (PDT) X-ASG-Debug-ID: 1470555344-0bf57c1369420100001-NocioJ Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by cuda.sgi.com with ESMTP id fh9xzU0hbFqHHCqw (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 07 Aug 2016 00:35:45 -0700 (PDT) X-Barracuda-Envelope-From: felix.janda@posteo.de X-Barracuda-Effective-Source-IP: mout02.posteo.de[185.67.36.66] X-Barracuda-Apparent-Source-IP: 185.67.36.66 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id A15FC20A85 for ; Sun, 7 Aug 2016 09:35:44 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3s6XQS1RVZz104W for ; Sun, 7 Aug 2016 09:35:44 +0200 (CEST) X-Mailbox-Line: From 672b1929c1d96977bf5755fbbc541d530f31198b Mon Sep 17 00:00:00 2001 Message-Id: <672b1929c1d96977bf5755fbbc541d530f31198b.1470555003.git.felix.janda@posteo.de> In-Reply-To: References: From: Felix Janda Date: Sat, 6 Aug 2016 12:45:43 +0200 Subject: [PATCH xfsprogs 03/14] replace fstat64 by equivalent fstat To: xfs@oss.sgi.com X-ASG-Orig-Subj: [PATCH xfsprogs 03/14] replace fstat64 by equivalent fstat X-Barracuda-Connect: mout02.posteo.de[185.67.36.66] X-Barracuda-Start-Time: 1470555345 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.176.15:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 6645 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.81 X-Barracuda-Spam-Status: No, SCORE=0.81 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.7 tests=DATE_IN_PAST_12_24, DATE_IN_PAST_12_24_2 X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.31809 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.01 DATE_IN_PAST_12_24 Date: is 12 to 24 hours before Received: date 0.80 DATE_IN_PAST_12_24_2 DATE_IN_PAST_12_24_2 X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Felix Janda Reviewed-by: Christoph Hellwig --- copy/xfs_copy.c | 2 +- fsr/xfs_fsr.c | 4 ++-- include/darwin.h | 1 - include/freebsd.h | 1 - io/copy_file_range.c | 4 ++-- io/open.c | 12 ++++++------ io/sendfile.c | 4 ++-- libxfs/darwin.c | 2 +- libxfs/init.c | 2 +- libxfs/irix.c | 2 +- libxfs/linux.c | 4 ++-- mkfs/proto.c | 2 +- repair/xfs_repair.c | 2 +- 13 files changed, 20 insertions(+), 22 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 3c8998c..6dcc51a 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -641,7 +641,7 @@ main(int argc, char **argv) die_perror(); } - if (fstat64(source_fd, &statbuf) < 0) { + if (fstat(source_fd, &statbuf) < 0) { do_log(_("%s: couldn't stat source \"%s\"\n"), progname, source_name); die_perror(); diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c index d75990a..2eaf1e7 100644 --- a/fsr/xfs_fsr.c +++ b/fsr/xfs_fsr.c @@ -514,7 +514,7 @@ fsrallfs(char *mtab, int howlong, char *leftofffile) if ( (fd = open(leftofffile, O_RDONLY)) == -1 ) { fsrprintf(_("%s: open failed\n"), leftofffile); } - else if ( fstat64(fd, &sb2) == 0) { + else if ( fstat(fd, &sb2) == 0) { /* * Verify that lstat & fstat point to the * same regular file (no links/no quick spoofs) @@ -1054,7 +1054,7 @@ fsr_setup_attr_fork( /* attr2 w/ fork offsets */ - if (fstat64(tfd, &tstatbuf) < 0) { + if (fstat(tfd, &tstatbuf) < 0) { fsrprintf(_("unable to stat temp file: %s\n"), strerror(errno)); return -1; diff --git a/include/darwin.h b/include/darwin.h index 45e0c03..1666294 100644 --- a/include/darwin.h +++ b/include/darwin.h @@ -142,7 +142,6 @@ typedef u_int32_t xfs_dev_t; typedef int64_t xfs_daddr_t; #define stat64 stat -#define fstat64 fstat #define lseek64 lseek #define pread64 pread #define pwrite64 pwrite diff --git a/include/freebsd.h b/include/freebsd.h index 6e77427..d6e75f4 100644 --- a/include/freebsd.h +++ b/include/freebsd.h @@ -34,7 +34,6 @@ #define __LITTLE_ENDIAN LITTLE_ENDIAN /* FreeBSD file API is 64-bit aware */ -#define fstat64 fstat #define ftruncate64 ftruncate #define lseek64 lseek #define stat64 stat diff --git a/io/copy_file_range.c b/io/copy_file_range.c index eddc634..a354fab 100644 --- a/io/copy_file_range.c +++ b/io/copy_file_range.c @@ -62,8 +62,8 @@ copy_src_filesize(int fd) { struct stat64 st; - if (fstat64(fd, &st) < 0) { - perror("fstat64"); + if (fstat(fd, &st) < 0) { + perror("fstat"); return -1; }; return st.st_size; diff --git a/io/open.c b/io/open.c index 2303527..766ac48 100644 --- a/io/open.c +++ b/io/open.c @@ -54,8 +54,8 @@ filesize(void) { struct stat64 st; - if (fstat64(file->fd, &st) < 0) { - perror("fstat64"); + if (fstat(file->fd, &st) < 0) { + perror("fstat"); return -1; } return st.st_size; @@ -102,8 +102,8 @@ stat_f( file->flags & IO_APPEND ? _(",append-only") : "", file->flags & IO_NONBLOCK ? _(",non-block") : "", file->flags & IO_TMPFILE ? _(",tmpfile") : ""); - if (fstat64(file->fd, &st) < 0) { - perror("fstat64"); + if (fstat(file->fd, &st) < 0) { + perror("fstat"); } else { printf(_("stat.ino = %lld\n"), (long long)st.st_ino); printf(_("stat.type = %s\n"), filetype(st.st_mode)); @@ -576,8 +576,8 @@ set_extsize(const char *path, int fd, long extsz) struct fsxattr fsx; struct stat64 stat; - if (fstat64(fd, &stat) < 0) { - perror("fstat64"); + if (fstat(fd, &stat) < 0) { + perror("fstat"); return 0; } if ((xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx)) < 0) { diff --git a/io/sendfile.c b/io/sendfile.c index 21ab444..0dc6154 100644 --- a/io/sendfile.c +++ b/io/sendfile.c @@ -135,8 +135,8 @@ sendfile_f( } else { struct stat64 stat; - if (fstat64(fd, &stat) < 0) { - perror("fstat64"); + if (fstat(fd, &stat) < 0) { + perror("fstat"); goto done; } count = stat.st_size; diff --git a/libxfs/darwin.c b/libxfs/darwin.c index 017e190..3923473 100644 --- a/libxfs/darwin.c +++ b/libxfs/darwin.c @@ -71,7 +71,7 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz) __uint64_t size; struct stat64 st; - if (fstat64(fd, &st) < 0) { + if (fstat(fd, &st) < 0) { fprintf(stderr, _("%s: cannot stat the device file \"%s\": %s\n"), progname, path, strerror(errno)); diff --git a/libxfs/init.c b/libxfs/init.c index e04b6e0..919a510 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -124,7 +124,7 @@ retry: exit(1); } - if (fstat64(fd, &statb) < 0) { + if (fstat(fd, &statb) < 0) { fprintf(stderr, _("%s: cannot stat %s: %s\n"), progname, path, strerror(errno)); exit(1); diff --git a/libxfs/irix.c b/libxfs/irix.c index 65aaa7e..532ea34 100644 --- a/libxfs/irix.c +++ b/libxfs/irix.c @@ -53,7 +53,7 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz) { struct stat64 st; - if (fstat64(fd, &st) < 0) { + if (fstat(fd, &st) < 0) { fprintf(stderr, _("%s: cannot stat the device file \"%s\": %s\n"), progname, path, strerror(errno)); diff --git a/libxfs/linux.c b/libxfs/linux.c index c9f2baf..175156d 100644 --- a/libxfs/linux.c +++ b/libxfs/linux.c @@ -129,7 +129,7 @@ platform_flush_device(int fd, dev_t device) if (major(device) == RAMDISK_MAJOR) return; - if (fstat64(fd, &st) < 0) + if (fstat(fd, &st) < 0) return; if (S_ISREG(st.st_mode)) @@ -145,7 +145,7 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz) __uint64_t size; int error; - if (fstat64(fd, &st) < 0) { + if (fstat(fd, &st) < 0) { fprintf(stderr, _("%s: " "cannot stat the device file \"%s\": %s\n"), progname, path, strerror(errno)); diff --git a/mkfs/proto.c b/mkfs/proto.c index 5f7f0b4..a008801 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -784,7 +784,7 @@ filesize( { struct stat64 stb; - if (fstat64(fd, &stb) < 0) + if (fstat(fd, &stb) < 0) return -1; return (long)stb.st_size; } diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 50a1ac9..4986cc5 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -670,7 +670,7 @@ main(int argc, char **argv) int fd = libxfs_device_to_fd(x.ddev); struct stat64 statbuf; - if (fstat64(fd, &statbuf) < 0) + if (fstat(fd, &statbuf) < 0) do_warn(_("%s: couldn't stat \"%s\"\n"), progname, fs_name); else if (S_ISREG(statbuf.st_mode))