aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkswap.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/mkswap.c')
-rw-r--r--util-linux/mkswap.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 289692da3..949c71a78 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -86,23 +86,19 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv)
86 off_t len; 86 off_t len;
87 const char *label = ""; 87 const char *label = "";
88 88
89 opt_complementary = "=1"; 89 opt_complementary = "-1"; /* at least one param */
90 /* TODO: -p PAGESZ, -U UUID, 90 /* TODO: -p PAGESZ, -U UUID */
91 * optional SIZE_IN_KB 2nd param
92 */
93 getopt32(argv, "L:", &label); 91 getopt32(argv, "L:", &label);
94 argv += optind; 92 argv += optind;
95 93
96 fd = xopen(argv[0], O_WRONLY); 94 fd = xopen(argv[0], O_WRONLY);
97 95
98 /* Figure out how big the device is and announce our intentions */ 96 /* Figure out how big the device is */
99 /* fdlength was reported to be unreliable - use seek */ 97 len = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ 1);
100 len = xlseek(fd, 0, SEEK_END);
101 if (ENABLE_SELINUX)
102 xlseek(fd, 0, SEEK_SET);
103
104 pagesize = getpagesize(); 98 pagesize = getpagesize();
105 len -= pagesize; 99 len -= pagesize;
100
101 /* Announce our intentions */
106 printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", len); 102 printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", len);
107 mkswap_selinux_setcontext(fd, argv[0]); 103 mkswap_selinux_setcontext(fd, argv[0]);
108 104