From 8a101b1447ce3f5c0286c5ebea452920b38133d3 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 25 Apr 2014 21:37:58 +0100 Subject: mkswap, swaplabel: move version number to header Corrently only the swap version 1 is supported, which is a magic value so move it to header. Signed-off-by: Sami Kerola --- sys-utils/swapon.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sys-utils/swapon.c') diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index 3866ee70d..6c422ce41 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -402,21 +402,19 @@ static unsigned long long swap_get_size(const char *hdr, const char *devname, unsigned int pagesize) { unsigned int last_page = 0; - int swap_version = 0; + const unsigned int swap_version = SWAP_VERSION; int flip = 0; struct swap_header_v1_2 *s; s = (struct swap_header_v1_2 *) hdr; - if (s->version == 1) { - swap_version = 1; + if (s->version == swap_version) { last_page = s->last_page; - } else if (swab32(s->version) == 1) { + } else if (swab32(s->version) == swap_version) { flip = 1; - swap_version = 1; last_page = swab32(s->last_page); } if (verbose) - warnx(_("%s: found swap signature: version %d, " + warnx(_("%s: found swap signature: version %ud, " "page-size %d, %s byte order"), devname, swap_version, -- cgit v1.2.3-55-g7522