From 8a4a67b9f16d3f8dd89c7bf88fb3811b7c65f6d2 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Nov 2007 00:27:51 +0100 Subject: [PATCH] sfdisk: use get_linux_version() Signed-off-by: Karel Zak --- fdisk/sfdisk.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 94a7c958..07834fa1 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -49,6 +49,7 @@ #include /* _syscall */ #include "nls.h" #include "blkdev.h" +#include "linux_version.h" #include "common.h" #include "gpt.h" @@ -1500,22 +1501,6 @@ bsd_partition(char *dev, int fd, struct part_desc *ep, struct disk_desc *z) { z->partno = pno; } -#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) - -static int -linux_version_code(void) { - struct utsname my_utsname; - int p, q, r; - - if (uname(&my_utsname) == 0) { - p = atoi(strtok(my_utsname.release, ".")); - q = atoi(strtok(NULL, ".")); - r = atoi(strtok(NULL, ".")); - return MAKE_VERSION(p,q,r); - } - return 0; -} - static int msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) { int i; @@ -1524,7 +1509,7 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) { struct sector *s; struct part_desc *partitions = &(z->partitions[0]); int pno = z->partno; - int bsd_later = (linux_version_code() >= MAKE_VERSION(2,3,40)); + int bsd_later = (get_linux_version() >= KERNEL_VERSION(2,3,40)); if (!(s = get_sector(dev, fd, start))) return 0; -- 2.39.5