aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-24 15:38:03 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-24 15:38:03 +0000
commitd398ecab9d6e42b1091d214df50bf938030d11a2 (patch)
tree222947a9a358931ea4f4f33679fd336cb5f36a8f /util-linux
parent8023d7df788fbc45217473e6a290d4409881d2cd (diff)
downloadbusybox-w32-d398ecab9d6e42b1091d214df50bf938030d11a2.tar.gz
busybox-w32-d398ecab9d6e42b1091d214df50bf938030d11a2.tar.bz2
busybox-w32-d398ecab9d6e42b1091d214df50bf938030d11a2.zip
hunt down improper include <>, make mkswap output 4Gb+ friendly
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mkswap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 2dee5ac18..7baa3ecfb 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -6,7 +6,7 @@
6 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 6 * Licensed under GPL version 2, see file LICENSE in this tarball for details.
7 */ 7 */
8 8
9#include <busybox.h> 9#include "busybox.h"
10 10
11int mkswap_main(int argc, char *argv[]) 11int mkswap_main(int argc, char *argv[])
12{ 12{
@@ -16,18 +16,19 @@ int mkswap_main(int argc, char *argv[])
16 16
17 // No options supported. 17 // No options supported.
18 18
19 if (argc!=2) bb_show_usage(); 19 if (argc != 2) bb_show_usage();
20 20
21 // Figure out how big the device is and announce our intentions. 21 // Figure out how big the device is and announce our intentions.
22 22
23 fd = xopen(argv[1],O_RDWR); 23 fd = xopen(argv[1], O_RDWR);
24 len = fdlength(fd); 24 len = fdlength(fd);
25 pagesize = getpagesize(); 25 pagesize = getpagesize();
26 printf("Setting up swapspace version 1, size = %ld bytes\n", (long)(len-pagesize)); 26 printf("Setting up swapspace version 1, size = %"OFF_FMT"d bytes\n",
27 len - pagesize);
27 28
28 // Make a header. 29 // Make a header.
29 30
30 memset(hdr, 0, 129 * sizeof(unsigned int)); 31 memset(hdr, 0, sizeof(hdr));
31 hdr[0] = 1; 32 hdr[0] = 1;
32 hdr[1] = (len / pagesize) - 1; 33 hdr[1] = (len / pagesize) - 1;
33 34
@@ -35,7 +36,7 @@ int mkswap_main(int argc, char *argv[])
35 // signature on disk (not in cache) during swapon. 36 // signature on disk (not in cache) during swapon.
36 37
37 xlseek(fd, 1024, SEEK_SET); 38 xlseek(fd, 1024, SEEK_SET);
38 xwrite(fd, hdr, 129 * sizeof(unsigned int)); 39 xwrite(fd, hdr, sizeof(hdr));
39 xlseek(fd, pagesize-10, SEEK_SET); 40 xlseek(fd, pagesize-10, SEEK_SET);
40 xwrite(fd, "SWAPSPACE2", 10); 41 xwrite(fd, "SWAPSPACE2", 10);
41 fsync(fd); 42 fsync(fd);