]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: improve portability
authorYang Kun <91833768+ikspress@users.noreply.github.com>
Sat, 24 Aug 2024 14:15:16 +0000 (22:15 +0800)
committerYang Kun <91833768+ikspress@users.noreply.github.com>
Sat, 24 Aug 2024 14:15:16 +0000 (22:15 +0800)
libblkid/src/probe.c

index 5e7aceb595e06d4dd457c670ae7688fd3a083a9e..5a17e873de13531d2263c7dd6052b5e71bd5d5af 100644 (file)
@@ -972,10 +972,19 @@ failed:
 
 #endif
 
-#ifdef BLKIOOPT
 static uint64_t blkid_get_io_size(int fd)
 {
-       static const int ioctls[] = { BLKIOOPT, BLKIOMIN, BLKBSZGET };
+       static const int ioctls[] = {
+#ifdef BLKIOOPT
+               BLKIOOPT,
+#endif
+#ifdef BLKIOMIN
+               BLKIOMIN,
+#endif
+#ifdef BLKBSZGET
+               BLKBSZGET,
+#endif
+       };
        unsigned int s;
        size_t i;
        int r;
@@ -988,7 +997,6 @@ static uint64_t blkid_get_io_size(int fd)
 
        return DEFAULT_SECTOR_SIZE;
 }
-#endif
 
 /**
  * blkid_probe_set_device:
@@ -1197,10 +1205,8 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
        }
 # endif
 
-#ifdef BLKIOOPT
        if (S_ISBLK(sb.st_mode) && !is_floppy && !blkid_probe_is_tiny(pr))
                pr->io_size = blkid_get_io_size(fd);
-#endif
 
        DBG(LOWPROBE, ul_debug("ready for low-probing, offset=%"PRIu64", size=%"PRIu64", zonesize=%"PRIu64", iosize=%"PRIu64,
                                pr->off, pr->size, pr->zone_size, pr->io_size));