linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 01/27] e2fuzz: fix pwrite64/pwrite usage
Date: Sat, 16 Aug 2014 16:45:57 -0700	[thread overview]
Message-ID: <20140816234557.11171.51119.stgit@birch.djwong.org> (raw)
In-Reply-To: <20140816234550.11171.61585.stgit@birch.djwong.org>

Select pwrite64 or pwrite depending on what autoconf finds.  This
makes e2fuzz find a suitable pwrite variant regardless of platform.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 misc/e2fuzz.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)


diff --git a/misc/e2fuzz.c b/misc/e2fuzz.c
index 91aafe5..5794f97 100644
--- a/misc/e2fuzz.c
+++ b/misc/e2fuzz.c
@@ -32,15 +32,15 @@ static int metadata_only = 1;
 static unsigned long long user_corrupt_bytes = 0;
 static double user_corrupt_pct = 0.0;
 
-#ifndef HAVE_PWRITE
-ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
+#if !defined HAVE_PWRITE64 && !defined HAVE_PWRITE
+static ssize_t my_pwrite(int fd, const void *buf, size_t count, off_t offset)
 {
 	if (lseek(fd, offset, SEEK_SET) < 0)
 		return 0;
 
 	return write(fd, buf, count);
 }
-#endif /* HAVE_PWRITE */
+#endif /* !defined HAVE_PWRITE64 && !defined HAVE_PWRITE */
 
 int getseed(void)
 {
@@ -276,10 +276,22 @@ int process_fs(const char *fsname)
 			       off % fs->blocksize, off / fs->blocksize, c);
 		if (dryrun)
 			continue;
+#ifdef HAVE_PWRITE64
+		if (pwrite64(fd, &c, sizeof(c), off) != sizeof(c)) {
+			perror(fsname);
+			goto fail3;
+		}
+#elif HAVE_PWRITE
 		if (pwrite(fd, &c, sizeof(c), off) != sizeof(c)) {
 			perror(fsname);
 			goto fail3;
 		}
+#else
+		if (my_pwrite(fd, &c, sizeof(c), off) != sizeof(c)) {
+			perror(fsname);
+			goto fail3;
+		}
+#endif
 	}
 	close(fd);
 


  reply	other threads:[~2014-08-16 23:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-16 23:45 [PATCH 00/27] e2fsprogs Summer 2014 patchbomb, part 5.1 Darrick J. Wong
2014-08-16 23:45 ` Darrick J. Wong [this message]
2014-08-24 23:56   ` [PATCH 01/27] e2fuzz: fix pwrite64/pwrite usage Theodore Ts'o
2014-08-16 23:46 ` [PATCH 02/27] misc: fix gcc warnings Darrick J. Wong
2014-08-24 23:56   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 03/27] libext2fs: byteswap inode when performing the sanity scan Darrick J. Wong
2014-08-25  2:01   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 04/27] libext2fs: fix problems with LE<->BE conversions on BE platforms Darrick J. Wong
2014-08-25  2:01   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 05/27] e2fsck: on BE, re-swap everything after a damaged dirent so salvage works correctly Darrick J. Wong
2014-08-25  2:03   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 06/27] libext2fs: create inlinedata symlinks Darrick J. Wong
2014-08-25  2:05   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 07/27] contrib: add script to help resync journal code with kernel Darrick J. Wong
2014-08-27  3:44   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 08/27] e2fsck: resync jbd2 recovery code from Linux 3.16 Darrick J. Wong
2014-08-27  3:44   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 09/27] e2fsck: resync jbd2 revoke " Darrick J. Wong
2014-08-27  3:44   ` Theodore Ts'o
2014-08-16 23:46 ` [PATCH 10/27] e2fsck: fix infinite loop when recovering corrupt journal blocks Darrick J. Wong
2014-08-27  3:45   ` Theodore Ts'o
2014-08-16 23:47 ` [PATCH 11/27] e2fsck/debugfs: fix descriptor block size handling errors with journal_csum Darrick J. Wong
2014-08-28  1:15   ` Theodore Ts'o
2014-08-28  1:33     ` Darrick J. Wong
2014-08-16 23:47 ` [PATCH 12/27] debugfs: create journal handling routines Darrick J. Wong
2014-08-16 23:47 ` [PATCH 13/27] e2fsck: set journal superblock s_sequence to tail_sequence Darrick J. Wong
2014-08-16 23:47 ` [PATCH 14/27] debugfs: add the ability to write transactions to the journal Darrick J. Wong
2014-09-06  5:52   ` Darrick J. Wong
2014-08-16 23:47 ` [PATCH 15/27] tests: test writing and recovering checksum-free 32/64bit journals Darrick J. Wong
2014-08-16 23:47 ` [PATCH 16/27] tests: test writing and recovering 64bit csum_v3 journals Darrick J. Wong
2014-08-16 23:47 ` [PATCH 17/27] tests: test writing and recovering 32bit " Darrick J. Wong
2014-08-16 23:47 ` [PATCH 18/27] tests: write and replay blocks with the old journal checksum Darrick J. Wong
2014-08-16 23:47 ` [PATCH 19/27] tests: test recovery of 32 and 64-bit journals with checksum v2 Darrick J. Wong
2014-08-16 23:48 ` [PATCH 20/27] tests: test how e2fsck recovers from corrupt journal superblocks Darrick J. Wong
2014-08-16 23:48 ` [PATCH 21/27] tests: test e2fsck recovery of corrupt revoke blocks Darrick J. Wong
2014-08-16 23:48 ` [PATCH 22/27] tests: test e2fsck recovery with broken commit blocks Darrick J. Wong
2014-08-16 23:48 ` [PATCH 23/27] tests: test e2fsck recovery of corrupt descriptor blocks Darrick J. Wong
2014-08-16 23:48 ` [PATCH 24/27] mke2fs: set block_validity as a default mount option Darrick J. Wong
2014-08-16 23:48 ` [PATCH 25/27] ext2fs: add readahead method to improve scanning Darrick J. Wong
2014-08-16 23:48 ` [PATCH 26/27] libext2fs/e2fsck: provide routines to read-ahead metadata Darrick J. Wong
2014-08-16 23:48 ` [PATCH 27/27] e2fsck: read-ahead metadata during passes 1, 2, and 4 Darrick J. Wong
2014-08-17 17:23 ` [PATCH 28/27] libext2fs: write_journal_inode should check iterate return value Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140816234557.11171.51119.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).