+int ventoy_is_disk_4k_native(const char *disk)
+{
+ int fd;
+ int rc = 0;
+ int logsector = 0;
+ int physector = 0;
+ char diskpath[256] = {0};
+
+ snprintf(diskpath, sizeof(diskpath) - 1, "/dev/%s", disk);
+
+ fd = open(diskpath, O_RDONLY | O_BINARY);
+ if (fd >= 0)
+ {
+ ioctl(fd, BLKSSZGET, &logsector);
+ ioctl(fd, BLKPBSZGET, &physector);
+
+ if (logsector == 4096 && physector == 4096)
+ {
+ rc = 1;
+ }
+ close(fd);
+ }
+
+ vdebug("is 4k native disk <%s> <%d>\n", disk, rc);
+ return rc;
+}
+