]> 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)
committerKarel Zak <kzak@redhat.com>
Fri, 3 Jan 2025 11:21:42 +0000 (12:21 +0100)
(cherry picked from commit 6dd59417e81967036037d430cc56b3e64d45f5a3)

libblkid/src/probe.c

index 76905e1970fbbd4270190c2515611a6714fdc5fe..7c561cf4409eb98b3ad3375ecd536635be1b4091 100644 (file)
@@ -967,10 +967,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;
@@ -983,7 +992,6 @@ static uint64_t blkid_get_io_size(int fd)
 
        return DEFAULT_SECTOR_SIZE;
 }
-#endif
 
 /**
  * blkid_probe_set_device:
@@ -1192,10 +1200,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));