diff options
author | Karel Zak | 2014-04-04 16:02:35 +0200 |
---|---|---|
committer | Karel Zak | 2014-04-04 16:02:35 +0200 |
commit | 9c7955dabebe2a8ffa868191657b57d6161ccfdd (patch) | |
tree | fdbe753bea0a6e2f0bd5553973628e91439aa32d /libfdisk | |
parent | switch_root: verify initramfs by f_type, not devno (diff) | |
download | kernel-qcow2-util-linux-9c7955dabebe2a8ffa868191657b57d6161ccfdd.tar.gz kernel-qcow2-util-linux-9c7955dabebe2a8ffa868191657b57d6161ccfdd.tar.xz kernel-qcow2-util-linux-9c7955dabebe2a8ffa868191657b57d6161ccfdd.zip |
libfdisk: make qsort_r() optional
The function is no critical for fdisk functionality. The SUN label
verification will check for less issues. All the verification code is
optional ('v' fdisk command).
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/sun.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c index 6d68c7aa9..734f5cd7d 100644 --- a/libfdisk/src/sun.c +++ b/libfdisk/src/sun.c @@ -363,6 +363,7 @@ static void fetch_sun(struct fdisk_context *cxt, } } +#ifdef HAVE_QSORT_R static int verify_sun_cmp(int *a, int *b, void *data) { unsigned int *verify_sun_starts = (unsigned int *) data; @@ -375,20 +376,20 @@ static int verify_sun_cmp(int *a, int *b, void *data) return 1; return -1; } +#endif static int sun_verify_disklabel(struct fdisk_context *cxt) { uint32_t starts[SUN_MAXPARTITIONS], lens[SUN_MAXPARTITIONS], start, stop; uint32_t i,j,k,starto,endo; +#ifdef HAVE_QSORT_R int array[SUN_MAXPARTITIONS]; unsigned int *verify_sun_starts; - +#endif assert(cxt); assert(cxt->label); assert(fdisk_is_disklabel(cxt, SUN)); - verify_sun_starts = starts; - fetch_sun(cxt, starts, lens, &start, &stop); for (k = 0; k < 7; k++) { @@ -422,12 +423,15 @@ static int sun_verify_disklabel(struct fdisk_context *cxt) } } +#ifdef HAVE_QSORT_R for (i = 0; i < SUN_MAXPARTITIONS; i++) { if (lens[i]) array[i] = i; else array[i] = -1; } + verify_sun_starts = starts; + qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]), (int (*)(const void *,const void *,void *)) verify_sun_cmp, verify_sun_starts); @@ -447,6 +451,7 @@ static int sun_verify_disklabel(struct fdisk_context *cxt) start = (starts[array[i]] + lens[array[i]]); if (start < stop) fdisk_warnx(cxt, _("Unused gap - sectors %u-%u."), start, stop); +#endif return 0; } |