bytes, (uintmax_t) fdisk_get_nsectors(cxt));
free(strsz);
- if (fdisk_label_require_geometry(lb) || fdisk_use_cylinders(cxt))
+ if (lb && (fdisk_label_require_geometry(lb) || fdisk_use_cylinders(cxt)))
fdisk_info(cxt, _("Geometry: %d heads, %llu sectors/track, %llu cylinders"),
fdisk_get_geom_heads(cxt),
fdisk_get_geom_sectors(cxt),
* fdisk_get_optimal_iosize:
* @cxt: context
*
+ * The optimal I/O is optional and does not have to be provided by device,
+ * anyway libfdisk never returns zero. If the optimal I/O size is not provided
+ * then libfdisk returns minimal I/O size or sector size.
+ *
* Returns: optimal I/O size
*/
unsigned long fdisk_get_optimal_iosize(struct fdisk_context *cxt)
{
assert(cxt);
- return cxt->optimal_io_size;
+ return cxt->optimal_io_size ? cxt->optimal_io_size : cxt->io_size;
}
/**
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: <removed>
-
-
-------------------
Create 1st primary partition
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: <removed>
-
-
-------------------
Create partitions
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: <removed>
-
-
-------------------
Create primary partition
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: <removed>
-
-
-------------------
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: <removed>
-
-
-------------------
Create 1st primary partition
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: <removed>
-
-
-------------------
Empty image listing
Disk testimage: 10 MiB, 10485760 bytes, 20480 sectors
-Geometry: 255 heads, 63 sectors/track, 1 cylinders
Units: cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: sun
-
-
Create first partition
e730c7ec8208601f41963f0485147248 sunlabel.img