+static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
+{
+ struct disklabel dl;
+
+ if (!ioctl(f->fd, DIOCGDINFO, &dl)) {
+ *bytes = ((unsigned long long)dl.d_secperunit) * dl.d_secsize;
+ return 0;
+ }
+
+ *bytes = 0;
+ return errno;
+}
+