public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Chubb <peter@chubb.wattle.id.au>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] mkswap fails to create large swap partitions on ia64 [patch]
Date: Wed, 13 Mar 2002 23:54:21 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590701905268@msgid-missing> (raw)

Package: util-linux
Version: 2.11n-4

Hi,
	Attempts to create large swap files/partitions fails on IA64,
because some things that are ints in mkswap source should be off_t or
long.

Here's a patch.


--- util-linux-2.11n/disk-utils/mkswap.c.orig	Thu Mar 15 21:09:57 2001
+++ util-linux-2.11n/disk-utils/mkswap.c	Thu Mar 14 10:52:09 2002
@@ -232,7 +232,7 @@
 /* patch from jj - why does this differ from the above? */
 /* 32bit kernels have a second limitation of 2GB, sparc64 is limited by
    the size of virtual address space allocation for vmalloc */
-#if defined(__alpha__)
+#if defined(__alpha__) || defined(__ia64__)
 #define V1_MAX_PAGES           ((1 << 24) - 1)
 #elif defined(__mips__)
 #define V1_MAX_PAGES           ((1 << 17) - 1)
@@ -373,7 +373,7 @@
 }
 
 static long
-valid_offset (int fd, int offset) {
+valid_offset (int fd, off_t offset) {
 	char ch;
 
 	if (lseek (fd, offset, 0) < 0)
@@ -383,16 +383,16 @@
 	return 1;
 }
 
-static int
+static off_t
 find_size (int fd) {
-	unsigned int high, low;
+	off_t high, low;
 
 	low = 0;
 	for (high = 1; high > 0 && valid_offset (fd, high); high *= 2)
 		low = high;
 	while (low < high - 1)
 	{
-		const int mid = (low + high) / 2;
+		const off_t mid = (low + high) / 2;
 
 		if (valid_offset (fd, mid))
 			low = mid;
@@ -432,9 +432,9 @@
 main(int argc, char ** argv) {
 	struct stat statbuf;
 	int i, sz;
-	int maxpages;
-	int goodpages;
-	int offset;
+	long maxpages;
+	long goodpages;
+	off_t offset;
 	int force = 0;
 	char *block_count = 0;
 	char *pp;
@@ -604,7 +604,7 @@
 	if (goodpages <= 0)
 		die(_("Unable to set up swap-space: unreadable"));
 	printf(_("Setting up swapspace version %d, size = %ld bytes\n"),
-		version, (long)(goodpages*pagesize));
+		version, (unsigned long)goodpages * pagesize);
 	write_signature((version = 0) ? "SWAP-SPACE" : "SWAPSPACE2");
 
 	offset = ((version = 0) ? 0 : 1024);


             reply	other threads:[~2002-03-13 23:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-13 23:54 Peter Chubb [this message]
2002-03-19 17:20 ` [Linux-ia64] mkswap fails to create large swap partitions on Van Maren, Kevin
2002-03-20  0:08 ` Peter Chubb
2003-06-18  3:30 ` [Linux-ia64] mkswap fails to create large swap partitions on ia64 [patch] Peter Chubb

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=marc-linux-ia64-105590701905268@msgid-missing \
    --to=peter@chubb.wattle.id.au \
    --cc=linux-ia64@vger.kernel.org \
    /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